Wednesday, December 30, 2015

Fallout 4 Improve Framerate

Running Fallout 4 at 50FPS on a low end graphic card

My self built development rig (currently pumping out OrchestraCMS/Salesforce sites) does not have a discrete 3d video card, but instead it has a low end Radeon HD 6530D built-in as part of the AMD A6-3650 CPU. Clearly it is a system not designed to handle latest games, but once in a while I like to indulge and so this time I tried playing Fallout 4...

Even at all the lowest resolution and settings I was only able to squeeze about 16 frames per second (FPS) --- I rather watch paint dry.

Overclocking the rig front side bus (FSB) 35% from 100MHz to 135MHz, that is CPU from 2600MHz to 3150MHz and DDR3 memory from 1333MHz to 1799MhZ (the F1A75-V PRO motherboard is fantastic for overclockability, just ensure to run the latest BIOS which allowed me to push it this far) things improved by 8 frames to 24FPS. Better but that's when there isn't anything existing happening on the screen so still unplayable.

Changing resolution in `Fallout4Prefs.ini`

I almost gave up but then decided to take a look inside the `Fallout4Prefs.ini` file and noticed the screen resolution mode settings `iSize H` and `iSize W`. And so I changed them to the lowest resolution my card supported (see 'Display Settings > Display adapter properties > List All Modes'): 640px by 480px and behold the glorious FPS now!

So even though the frame-rate is very fine indeed the resolution sucks, maybe I'll just pretend this is the Pip-Boy experience mode - maybe I should get an old CRT monitor too :). Feel free to comment or .

Thursday, November 26, 2015

Speed up Saleforce Development

Fast Salesforce `staticresrouces` Development Locally

The problem with front end development in the cloud is that it is painfully slow! Unfortunately this is the reality of the cloud nature of SF and it will remain so - at least until there will be ability to spin up local SF development servers.

It takes about 30 seconds or more to save on a busy org. That is mainly because of the typical save cycle, 'change', 'zip', 'save to server', and then 'refresh in browser':

  • doing this many times a day adds up to a substantial time lost
  • loss of focus/concentration - while you wait
  • ‘clobbering of static resources’ when working in a team
  • pure maddening in tight timelines

Current Solutions

Make changes in browser, ex. Chrome
  • Great for CSS
  • Limited for JS (can’t re-run `onload` event)
  • Cumbersome for HTML
  • Can’t use your favorite (Eclipse IDE) editor
Develop files locally
  • Ok for initial design mockups
  • Impractical once code starts living in SF
  • Javascript / CSS injection
  • Browser security issues as file must live on server
  • Ok for CSS, problematic for JS
  • Order issues, `onload` event, etc.
  • Can’t do HTML

  • The Solution: Have Charles or Fiddler serve it!

    The idea is to use an intermediate proxy to highjack our requests and inject files from a local file system. There are two mainstream popular programs to accomplish this. An old and tried Fiddler for Windows machines and Charles Mac

    Once you setup Charles or Fiddler you can map any server response to local files. In the case of CSS/JS this allows you to edit these locally and immediately be able to preview your changes in the browser. Since the common design pattern is to use folder for static resoruces you can just map the entire `resource-bundles` folder instead of individual files:

    • In Charels the 'Path' matching pattern should be of format `/resource//*` mapped to local path to the bundle in `resource-bundles` folder (a Maven's Mate convention that Eclipsers should follow).
    • For Fiddler the 'AutoResponder' rule should be `REGEX:.+?//.visual.force.com/resource/.+?//(.+)$` mapped to `\resource-bundles\\$2`.

    If you found this useful please feel free to comment or follow me .

    Sunday, October 25, 2015

    Fix for 'unknown ACL condition/modifier in "spam = debian-spamd:true"'

    Exim configuration error in line 438 of /var/lib/exim4/config.autogenerated.tmp: error in ACL: unknown ACL condition/modifier in "spam = debian-spamd:true"

    root@sh1:/etc/exim4# dpkg-reconfigure exim4-config
    2015-10-25 14:09:40 Exim configuration error in line 438 of /var/lib/exim4/config.autogenerated.tmp:
      error in ACL: unknown ACL condition/modifier in "spam = debian-spamd:true"
    Invalid new configfile /var/lib/exim4/config.autogenerated.tmp, not installing
    /var/lib/exim4/config.autogenerated.tmp to /var/lib/exim4/config.autogenerated
    

    The one stumped be for a bit but the solution - at least on a Debian based system - is to ensure you have installed 'exim4-daemon-heavy` instead of the light packages, aptitude install exim4-daemon-heavy.

    If this has helped comment of follow me .

    Friday, October 23, 2015

    Linux Benchmarking

    Simple Linux Performance Script

    When deploying new virtual machines with different provides I like to do basic performance tests using built in utilities like `dd` and `bc`. I had a little script linux-benchmark.sh which I have now cleaned up and making it public. When run it will do basic test for HD, Internet and CPU and save it as a timestamped text file.

    Sample output:

    root@sh1:~# ./linux-benchmark.sh
    Please be patient, this might take a minute or so.
    
    Hostname:             sh1
    IP(s):                45.55.218.113
    CPU model:            Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
    Number of cores:      1
    CPU frequency:        2399.998 MHz
    System uptime:        60 days, 2:17,
    Total amount of ram:  500 MB
    Total amount of swap: 2929 MB
    Calc PI to 5000:      0m31.818s
    Download speed:       106MB/s
    I/O (conv=fdatasync): 528MB/s
    I/O (oflad=dsync):    293MB/s
    
    

    The `linux-benchmark.sh` script

    #!/bin/bash
    # Author: Daniel Sokolowski
    # source: https://bitbucket.org/snippets/danielsokolowski/G5oeA
    # inspired by http://www.commandlinefu.com/commands/view/229/quick-integer-cpu-benchmark, http://serverfault.com/questions/372020/what-are-the-best-possible-ways-to-benchmark-ram-no-ecc-under-linux-arm
    
    
    echo "Please be patient, this might take a minute or so."
    hostname=$(cat /etc/hostname)
    ips=$(hostname --all-ip-addresses)
    cname=$(cat /proc/cpuinfo|grep name|head -1|awk '{ $1=$2=$3=""; print }' | xargs)  # xargs left/left trims the string
    cores=$(cat /proc/cpuinfo|grep MHz|wc -l | xargs)
    freq=$(cat /proc/cpuinfo|grep MHz|head -1|awk '{ print $4 }')
    cpuspeed=$( (time echo "scale=5000; a(1)*4" | bc -l > /dev/null) 2>&1 | head --lines=2 | tail --lines=1 | awk -F ' ' '{print $2}')
    tram=$(free -m | awk 'NR==2'|awk '{ print $2 }')
    swap=$(free -m | awk 'NR==4'| awk '{ print $2 }')
    up=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }' | xargs) # xargs left/left trims the string
    
    cache=$((wget -O /dev/null http://cachefly.cachefly.net/100mb.test) 2>&1 | tail -2 | head -1 | awk '{print $3 $4 }' | sed 's/^(\(.*\))$/\1/' )
    io=$( (dd if=/dev/zero of=test_$$ bs=1M count=256 conv=fdatasync &&rm -f test_$$) 2>&1 | tail -1| awk '{ print $(NF-1) $NF }')
    io2=$( (dd if=/dev/zero of=test_$$ bs=1M count=256 oflag=dsync &&rm -f test_$$) 2>&1 | tail -1| awk '{ print $(NF-1) $NF }')
    
    # memory test
    tempDir=`mktemp -d -t linux-benchmark-XXX`
    mount -t tmpfs $tempDir $tempDir
    #io3=$( (dd if=/dev/zero of=$tempDir/test_$$ bs=1M count=256 conv=fdatasync &&rm -f test_$$) 2>&1 | tail -1| awk '{ print $(NF-1) $NF }')
    io3=$( (dd if=/dev/zero of=$tempDir/test_$$ bs=1M conv=fdatasync &&rm -f test_$$) 2>&1 | tail -1| awk '{ print $(NF-1) $NF }')
    umount -f $tempDir
    mount -t tmpfs $tempDir $tempDir
    #io4=$( (dd if=/dev/zero of=$tempDir/test_$$ bs=1M count=256 oflag=dsync &&rm -f test_$$) 2>&1 | tail -1| awk '{ print $(NF-1) $NF }')
    io4=$( (dd if=/dev/zero of=$tempDir/test_$$ bs=1M oflag=dsync &&rm -f test_$$) 2>&1 | tail -1| awk '{ print $(NF-1) $NF }')
    umount -f $tempDir
    
    outputfilename=$(basename $0-run-`date "+%Y.%m.%d-%H.%M.%S".txt`)
    echo "Hostname:             $hostname" >> $outputfilename
    echo "IP(s):                $ips"  >> $outputfilename
    echo "CPU model:            $cname" >> $outputfilename
    echo "Number of cores:      $cores" >> $outputfilename
    echo "CPU frequency:        $freq MHz" >> $outputfilename
    echo "System uptime:        $up" >> $outputfilename
    echo "Total amount of ram:  $tram MB" >> $outputfilename
    echo "Total amount of swap: $swap MB" >> $outputfilename
    echo "Calc PI to 5000:      $cpuspeed"  >> $outputfilename
    echo "Download speed:       $cache " >> $outputfilename
    echo "HDD I/O (conv=fdatasync): $io" >> $outputfilename
    echo "HDD I/O (oflad=dsync):    $io2" >> $outputfilename
    echo "Memory I/O (conv=fdatasync): $io3" >> $outputfilename
    echo "Memory I/O (oflad=dsync):    $io4" >> $outputfilename
    
    echo ""
    cat $outputfilename
    echo ""
    

    If you found this useful comment or follow me .

    Thursday, October 22, 2015

    Linphone keys (DTMF) not working with Freeswitch VOIP Server

    Work around to key tones not working in Linphone when connected through Freeswtich

    If you find that after dialing into any IVR your key presses are not registering, and you are connecting to a Freeswitch voip gateway it is likely due to this Bug: Telephone-event codec clock-rate mismatch (leads to DTMF issue); go 'Options > Settings > Codec' and move the 8000Hz codes up.

    A temporary work around is to change your codec priorities in Linphone to use one of the lower quality 8000Hz ones first.

    Comment or follow me if this has helped you.

    Tuesday, October 13, 2015

    dnsmasq as an external DNS server

    Creating a 'NS' record

    It's NOT possible - try setting u BIND instead or contacting the author to add support for it; I am creating this entry so that it would save hours of searching for others.
    The basic setup that should work is to point your domain dns servers to to 'ns1.yourdomain.com` where ns1 resolves to your servers IP, however because dnsmasq can not answer with a NS record and the process fails - that is my understanding based on my readings
    Comment or follow on twitter .

    Sunday, October 11, 2015

    Windows Insider stuck at build 10162

    Windows Insider won't updated

    So my 10162 insider windows edition is now expired, keeps restarting, telling me it will stop working and yet Windows Update says there is no updates.

    Search on the Internet found many with similar issues but none of the solutions worked, however the below did the trick for me

    • Download the Windows 10 ISO Installation
    • Mount the file by right clicking
    • Enter one of the following Product Keys - Windows 10 build 10240 keys:
      • Windows 10 Home build 10240 - TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
      • Windows 10 Pro build 10240 - VK7JG-NPHTM-C97JM-9MPGT-3V66T
      • Windows 10 Enterprise build 10240 - NPPR9-FWDCX-D2C8J-H872K-2YT43
    • When the installation finishes ensure you are still part of the insider builds

    If this has helped you drop me a comment or follow me on twitter @danielsokolows.

    Wednesday, August 26, 2015

    Salesforce Sortable Changeset Dependency List

    Sorting the results of 'View/Add Dependencies'

    When you have to shift through over 100+ entries it would help if SF's interface allowed for sorting. The missing functionality can be achieved by running the below JS, which can be invoked using a handy bookmarklet. Create one as follows:
    • In your browser add a new bookmark
    • Name it `SF Make `<table class='list' ...>` Sortable`
    • In the url paste the blelow JS snippet
    javascript:/* `sortTable` from https://gist.github.com/danielsokolowski/994d47baa95ef81fd8fc */ function TableSort(a){this.tbl=a;this.lastSortedTh=null;if(this.tbl&&"TABLE"==this.tbl.nodeName){a=this.tbl.tHead.rows[0].cells;for(var b=0;a[b];b++)a[b].className.match(/asc|dsc/)&&(this.lastSortedTh=a[b]);this.makeSortable()}}TableSort.prototype.makeSortable=function(){for(var a=this.tbl.tHead.rows[0].cells,b=0;a[b];b++){a[b].cIdx=b;var c=document.createElement("a");c.href="#";c.innerHTML=a[b].innerHTML;c.onclick=function(a){return function(){a.sortCol(this);return!1}}(this);a[b].innerHTML="";a[b].appendChild(c)}};TableSort.prototype.sortCol=function(a){var b=this.tbl.rows,c=[],f=[],g=0,d=0;a=a.parentNode;for(var l=a.cIdx,e=1;b[e];e++){var h=b[e].cells[l],h=h.textContent?h.textContent:h.innerText,k=h.replace(/(\$|\,|\s)/g,"");parseFloat(k)==k?f[d++]={value:Number(k),row:b[e]}:c[g++]={value:h,row:b[e]}}b=[];a.className.match("asc")?(e=bubbleSort(c,-1),c=bubbleSort(f,-1),a.className=a.className.replace(/asc/,"dsc")):(e=bubbleSort(f,1),c=bubbleSort(c,1),a.className.match("dsc")?a.className=a.className.replace(/dsc/,"asc"):a.className+="asc");this.lastSortedTh&&a!=this.lastSortedTh&&(this.lastSortedTh.className=this.lastSortedTh.className.replace(/dsc|asc/g,""));this.lastSortedTh=a;b=e.concat(c);c=this.tbl.tBodies[0];for(e=0;b[e];e++)c.appendChild(b[e].row)};function bubbleSort(a,b){var c,f;1===b?(c=0,f=a.length):-1===b&&(c=a.length-1,f=-1);for(var g=!0;g;)for(var g=!1,d=c;d!=f;d+=b)a[d+b]&&a[d].value>a[d+b].value&&(g=a[d],a[d]=a[d+b],a[d+b]=g,g=!0);return a};new TableSort(document.querySelector('table.list'));
    

    Example of sorting the Salesforce Chageset dependency list


    If you found this post useful, please post a comment or follow me on twitter .

    Tuesday, August 11, 2015

    Compass can't find any Sass files to compile.

    Is your compass configuration correct?.

    Unbelievable, compass chokes on directories with spaces (I think, and at least on a Windows machine).

    I have resolved it by creating a junction from the repository into a folder without spaces - see this awesome utility: http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html

    And food for thought: consider if SASS is needed, do you want to debug your SASS or CSS?

    sass-can-not-find-any-files-fix

    If this post has saved you hair pulling post a comment and a follow is always appricited.

    Friday, August 7, 2015

    Freeswitch 1.4 'mod_shout' compiling fails on Debian 8.0

    Error: inlining failed in call to always_inline '_mm_loadu_ps'

    The error happens when trying to compile the 'lame' needed by the 'mod_shout' module. From Google it appears to only happen on 32bit architecture.

    The solution is to search for `xmmintrin.h` and remove the line from file `./lib/lame-3.98.4/configure`. The final code block should look as follows:

    ...
     for ac_header in \
        errno.h \
        fcntl.h \
        sys/soundcard.h \
        sys/time.h \
        unistd.h \
        linux/soundcard.h
     do :
    ...
    

    If you found this useful please comment or follow me on twitter @danielsokolows.

    Tuesday, May 26, 2015

    Google Hangouts Crashes Chrome

    Latest stable Google Chrome crashes when starting Google Hangouts

    This is on Windows 10 Preview, updated drivers, updated flash, clean Chrome install, re-installed Chrome, deleted user profile - all of these failed to resolve the crash when trying to start a Google Hangouts.

    Solution is to un-install Google Stable and install Google Canary. Feel free to comment or follow me on twitter @danielsokolows if this post has helped you.

    Monday, February 16, 2015

    Salesforce "Save error: An unexpected error occurred."

    Description Path Location Type Resource Save error: An unexpected error occurred. Please include this ErrorId if you contact support: 693681547-51638 (-1906541512) ... line 0 Force.com save problem ...

    The blackbox that SF is does not lend it self to debugging so this one took me a while to track so if this post has helped you do comment or follow me on twitter :). The cause was using `this` keyword in my bind SOQL variables and removing it fixed the problem.

    Looks like a bug if you ask me to me. If you find others send them to me or comment and I will update the post.

    oOrderedContentIds = [SELECT Id FROM cms__Content__c 
            WHERE Id in :oPrunedContentRenderingsMap.keySet()
            ORDER BY cms__Original_Published_Start_Date__c DESC
            LIMIT :iQueryLimit // *NOTE:* using `this.` keyword will crap out with unexpected error when saving
            OFFSET :iQueryOffset];
    

    Be great

    Sunday, January 18, 2015

    VirtualBox vs. VMware - choose neither and use Hyper-V instead

    Free built in Hyper-V in Windows is a fantastic free product

    In an effort to self host my Linode server my research has led me to decided to Virtual Machine to run a Debian distribution. Those interested might want to know that I have fully explored other options mainly OpenWRT or running Debian on a beefy MIPS processor; former failed due to lack of proper packages, latter failed due to the difficultly hacking Debian onto MIPS and the lack of tailored router interface.

    The two main products a quick Google search returns are VirtualBox and VMWare Player, both are free but I was leaning towards VMWare because - it is my understanding - it's native format can be uploaded to an online host as is. However to my big surprise Microsoft provides it's own Virtualization software built into Windows 8.1.

    It's fantastic to use, full of professional features such as VM auto start for and seems to have better virtualisation as I was able to adjust the console's frame buffer resolution without a problem but could not do so in VMWare virtualization.

    To install in Start screen type 'Turn Windows features on or off' and locate the Hyper V grouping. While you there notice there are other goodies like a solid free web server 'ISS'

    If you found this post helpful do comment or follow me on twitter .