Skip navigation

Category Archives: Uncategorized

If you want to edit an existing chrome extension, it is very easy!
There are many reasons why someone might want to do this, perhaps to enable a pay only option, perhaps to remove some of the tracking elements extension designers add in.
Chrome extensions are written in javascript and each file gets a MD5 signature that chrome checks before it runs the extension.
If you don’t bypass this check, then Chrome will disable the extension thinking it is corrupted.

First, you wan to find the extension folder, on windows it is
C:\Users\\AppData\Local\Google\Chrome\User Data\Default\Extensions

Here is a Stackoverflow link that discusses the path for other OSes
http://stackoverflow.com/questions/14543896/where-does-chrome-store-extensions

Now copy this folder somewhere else, like in your `code` or `workspace` dirs.
Now go to chrome://extensions/ and enable developer mode.
Now load ‘unpacked extension’
Everytime you make a change to your extension, just go back to chrome://extensions/ and reload the extension to see your changes.

For some reason, my Macbook Pro Late 2011 8,3 will not show the TailsGreeter. All I get is a blank screen that if I hit enter, will then boot to the desktop.

It’s a pain in the ass, however there isn’t much of a point to Tails unless I can save some session data.
I was able to create my persiatnce volumne, I just can’t activate it because I do not physically see the TailsGretter screen.

So the answer is to hit tab in Grub and edit the boot command line from ‘nopersistance’ to ‘persistance’, and add rootpw= and hit enter.

Once booted into X, open a terminal and type:
su // and enter your password from the boot command line
/sbin/cryptsetup luksOpen --tries 1 /dev/sdb2 TailsData_unlocked
/usr/local/sbin/live-persist activate /dev/mapper/TailsData_unlocked

You might need to change /dev/sdb2 to whatever you persistance volume was created under.

So I was fortunate enough to recently have to store data that was stored as two merged Javascript Objects yeasterday. Yeah, I know what your thing ‘everything is an object’. It wasn’t stored as an array, just as a default Object. I wanted my change to be as stealth as possible and not interfere too much with the existing structure of the code base. And I wanted to return a sorted object.

I think I didn’t have JQuery linked in the file and didn’t want to add it unless I had to. I forget things. Anyway, Here’s the code I ended up using (and later scrapping because I decided to just do it in PHP and change some other things)


//first I had to merge my two objects
var myObj1 = somefucntionthatshouldhavebeenreturnarraysbutreturnsanobject();
var myObj2 = someotherfucntionthatshouldhavebeenreturnarraysbutreturnsanobject();
for(var attrname in myObj2) {
if(typeof availableBundles[attrname] === 'undefined') {
myObj1[attrname] = myObj2[attrname];
}
}
//so now we have both objects merged into myObj1

//sort myObj1 into a temporary variable called sortedObj
var sortedArr = [];
for (var attrname in myObj1) {
sortedArr.push({key:attrname, value:myObj1[attrname]});
}
//now we have a sorted array

//now we will parse the sorted array, and put it back into the object
myObj = {};

//in my case I was sorting by the value, not the key, and the value was text, hence the use of localeCompare
sortedArr.sort(function(a, b) {return a.value.localeCompare(b.value);});
for (var i=0;i

So, some interesting things to note here, is that in order to sort by value and not run into duplicate keys overwriting data, we store the value and key as objects, and in order to use the sort() method, we store store them in an array, and then pass into sort() a function that compares the values.
As mentioned in the source code, we use localeComapre to compare two strings. Since this is a sorting method you want to return a negative number os the first value is less than the second, a zero is they are equal, and a postive number is the forst value is greateer than the second. Sort() takes care of the rest.
LocaleCompare is used for strings because that's basically what the function does, it compares two strings and returns an integer based on the above rules. We just need to tell it that we want to compare using sortedArr->value, not sortedArr->key.

Typical startup picture
This post may very well be a death sentence as far as my career is concerned. Some companies need to be called out on their BS. Looking for a job near the Philadelphia area? I have noticed during my time in Philadelphia that there is a group of companies that are always hiring and never really growing. If you are a recruiter, take note, you might want to give up on trying to fill positions for these companies.

The following is MY OPINION of some shops that should probably be avoided because they always seem to be hiring and do not seem to be growing:

  • Monetate – a very `startup like` company, that is at least 5 years old. Open office, very noisy office. They are very active in the developer community. Honestly, they seem like they operate on VC money and are not making a profit.
  • CoreDial – I get emails from recruiters about once a year, always looking for an entry level PHP developer
  • SevOne – every time a recruiter has contacted me, they state that this company is under new ownership and everything has changed. Why does this company keep getting sold?
  • MeetMe.com – free energy drinks apparently aren’t enough to get them iOS and Android devs
  • I have no relation to these companies, I have never worked at any of them. For all I know they are great companies that just can not find the employees they want. I have also been in this industry for a while and I have pretty good instincts.

    I had a embdded YouTube video stepping over my registration popup (using jQuery-ui’s dialog()). The solution was to add “?wmode=transparent” after the youtube url specified in the src attribute.

    I was getting an odd error whenever I tried to use yum.
    I checked my /etc/yum.repos.d/ folder and there were no ‘dag’ entries.

    [root@localhost yum.repos.d]# yum list php\*
    Loaded plugins: auto-update-debuginfo, langpacks, presto, refresh-packagekit
    http://apt.sw.be/fedora/18/en/i386/dag/repodata/repomd.xml: [Errno 14] curl#22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
    Error: failure: repodata/repomd.xml from dag: [Errno 256] No more mirrors to try.
    http://apt.sw.be/fedora/18/en/i386/dag/repodata/repomd.xml: [Errno 14] curl#22 - "The requested URL returned error: 404 Not Found"

    I ignored it at first but eventually updates started failing and Yum wasn’t finding software I knew existed in the repos.
    The solution was that the dag repo was listed in my /etc/yum.conf

    I removed that and ran a

    sudo yum clean all

    and everything was fine again!

    Creepier Door Knocker

     

    I picked up this scary face door knocker last year at Walmart for $5, they probably still sell them but I haven’t checked. I am not actually using an ardunio, but a similair thing called a Digispark made by Digistump (hard not to mix these names around) but I friggin love these things. They are not as full featured as an Arduino, but for what I’m about to do they are overkill and super easy to use and pretty cheap. They also use the same software (the software made by Ardunio). Most hobbists will probably tell you that you could make the thing for even cheaper yourself, I am lazy and I defend that trait for two reasons, conservation of enegry and the fact that I do not need to reinvent the wheel. Ten bucks is cheap enough in my opinion (I am not mass producing anything using these).

    I have some plans for what to do to it next year, I always break things up into multiple revisions. I definitely want to add a motion sensor, currently it just repeats this loop until I turn it off or until the battery dies. I also want to add sound. However instead of installing a speaker inside the knocker,  I want to try to use bluetooth and have the sound play on an external speaker hidden in the bushes or next to the porch. Maybe I can have it ping my phone so that I know someone is there before they even ring the door bell.

    Parts List

    • 1 Plastic scary old man door knocker from Walmart (here is a similar one on Amazon)
    • 2 RGB LEDs (I purchased form SparkFun)
    • 1 Digispark or any arduino (not much code here so even an Uno would be overkill)
    • 1 servo (I purchased the ‘Medium Servo’ from SparkFun)
    • ! pack of 100 Ohm resistors (1/2 watt radio shack 2711108)
    • 1 AA battery pack (Sparkfun, again)
    • 1 switch (I had it left over in the parts bin)
    • Misc: Hot glue, epoxy putty, wire, solder, USB Hub (highly recommended), some think aluminum from home depot

    So, I present to you my build log, happy Halloween!

     

    original door knocker

    The is the door knocker after I had removed the two cheezy red LEDs I put in it last year

    digispark

    Digispark, for those not in the know

    a guy with epoxy putty goes mad

    Beginning of the servo mount, don’t worry, it gets sloppier!

    LEDs and servo installed

    Jump ahead to where I have the eyes cut out, RGB LEDs installed, and used hot glue to shape the eyes and fill in the gaps. I also have a battery pack Velcro-ed to a metal plate that I used epoxy putty (JB Weld) to hold the plate in with 4 AA batteries. The servo is mounted and fully secured using, you guessed it, HOT GLUE. Oh, and also, I burnt out the green and blue LEDs after I had hot glued them in, so the defective ones are staying there this year. I fashion an L shape key out of some aluminum sheet metal I got from Home Depot that I had lying around. I also used this to make a bracket for the top of the servo and I epoxied it down. I coated everything in liquid electrical tape and hot glue. I would still probably take it down and bring it inside if we had any rain just to be safe.

    switch install

    Here I am dremeling out a space for the switch

     

    The wiring for this is;

    Servo

    • Brown to Digipark ground
    • Red to Digispark +
    • Orange to p0

    Battery pack

    • Red to switch then from switch to Digispark +
    • Black to Digispark –

    LEDs

    • Red to 100 Ohm resistor then to p4
    • Return (ground) to Digispark ground
    • Green to 100 Ohm resistor then to p5
    • Blue to 100 Ohm resistor then to p0

     

    For the source code I used analogWrite to set the brightness of the LEDs. I would have probably went with a progressive green fade-in fade-out but I did something wrong and burnt out the green and blue components so I only had red left.

    I did not use any servo libraries, I just used digitalWrite() and delayMicroseconds() to get the servo to the desired position. This is a really basic build up. Nothing complicated here.

    Source code can be found here

     

     

     

     

     

     

     

     

     

    This was an easy fix, but it was quite weird. Android AIDL files can only contain primitive data types such as int, long, char and boolean, as well as String, List, CharSequence and Map.

    In my case, I was passing around a Bitmap.

    All I need to do was to add an import statement at the top of my .aidl file for Bitmap library:

    import android.graphics.Bitmap;

    and in my function declaration state whether it was in/out/both:

    void openFile(String path, int hash, String title, in Bitmap image);

    In my case it was input only, but, as the error message says, it could have been in, out or inout.