Friday, August 2, 2013

LESS Mixins!

I find that I often use LESS  If you do front end web development, and don't use LESS you are missing out.  In short, it let's you nest CSS, create CSS functions, gives you CSS variables, and do math in your CSS (and much more).

It can turn this:
Into this:

Now, that might not look great right now, but it will save you time in the long run. I will probably write a post at a later point about the magic of LESS, however for now, I figured I'd just post a few of my favorite mixins (think of them like functions) that I use on the daily.

As I do more, I'll add them , just look for the LESS tags

Thursday, August 1, 2013

Killing X11 in linux

Recently my father in law bought me a Raspberry Pi for my birthday, super sweet!  I've always tooled around with linux, however never got serious about it.  As I started playing with it, I found that using the default OS (the NOOBS) was slowing me down and I just wanted a command line.  I have 2 options at this point

  1. SSH
  2. Kill window manager, and just get to the command line.
I opted for #2.  However how the hell do you do that without restarting (you know, cause I'm lazy) I figure you start it by saying 'startx' perhaps you kill it by 'stopx'.  No dice.  I went on and tried some other things, none of which worked.  Eventually I consulted my linux friend and he told me to try hitting 'ctrl+alt+F1'  Sure enough, that killed it and there I am on just the command line!

startx - starts X11
'ctrl+alt+F1' - kills X11

Long time no post....

So I've realized I don't really post here that much... That's fine, I don't have much to say.  However I'm going to try to post more of my "Gee how do I do X... oh like this, great" moments here.  Hopefully they help others.

Tuesday, February 5, 2013

PHP 5.4, Memcached and Windows 7

Recently I was asked to get memcached working with PHP 5.4.8 on my Windows 7 64 bit machine at work, took a while and some looking around, but I was able to get it working successfully.  Below are the steps which I took to get it to work.  Hopefully this helps someone else in the future.


  1. You have apache, php 5.4 installed.  my directories are as follows:
  2. You are an admin on your machine... If you aren't get access.
  3. I'm using Windows 7, 64 bit
  4. In reading this you realize that this is what has worked for ME, I can't promise that it will work for you, nor do I take any responsibility for any of the files below.  They didn't break my machine, but who knows what they will do to yours. Use at your own risk
Let's get down to business! 
  1. Download this
  2. Unzip here: c:/etc/memcahced
  3. Right click ->; properties ->; compatibility ->; run as admin
  4. Go to command line:
    c:\etc\memcached\memcached.exe –d install
  5. If window throws an error saying that it is missing or can not find "MSVCR71.dll" do the following, else go to #6
    1. Download this:
    2. Copy file to c:\windows\system32
    3. Try #4, if it works, great go to #6, 
    4. Didn’t work huh? Ok, move file to c:\windows\system and try again.
    5. Still didn't work? I've heard going placing in C:\windows\sysWOW64 works... but I haven't tried that.
  6. Go to services.msc, start service (find where it says memcached, right click and hit 'start')
  7. Confirm everything is proper by going to regedit and making sure you have this:
    to access regedit open a run window and type 'regedit'
  8. Raise memory limit (if you want):
    c:\etc\memcached\memcached.exe –d runservice –m 512
  9. Download PHP .dll (now as I've said earlier, this is only for php 5.4):
  10. Unzip contents to c:\etc\php\ext
  11. Add the following to php.ini
  12. Restart server
  13. Add this to a test page:
//Create a new instance of memCached
$memcache = new Memcache;

//Of course you can use "localhost" instead of the IP if you want
$memcache->connect('', 11211) or die ("Could not connect");

//Get the version, cause why not
$version = $memcache->getVersion();
echo "Memcache's version: $version

//Make some object
$tmp_object = (object) null;
$tmp_object->;someString = 'Testing...';
$tmp_object->;someInt = 9083202;

//Get the contents of the memcache
$get_result = $memcache->;get('key');
echo "-- Data currently in the cache:

//set the memcache
$memcache->set('key', $tmp_object, false, 15) or die ("Failed to save data at the server");

echo "
\n-- Data is stored in the cache, will expire in 15 seconds
//Get the contents of the memcache
$get_result = $memcache->;get('key');
echo "-- Data currently in the cache:
var_dump($get_result) ;

Now, assuming you have no errors, you are good to go!  Hope this helped!

Friday, September 25, 2009

Test for work

Sorry guys, but this is just a test for work

Friday, July 31, 2009


Ever since ~ 1995 I have been working off the handle of 'whomba'. It has been my email, aim, part of my phone number, Nickname and the list can go on. Finally I realized that I don't own the domain, so this morning I bought it. Right now It just is forwarded to my blog, but hopefully sometime in the future it will actually do something.

At the very least it is here and mine!

Thursday, June 18, 2009

Ugh, My Mac book, Yay the Genius's

So my Mac Book Pro of 2.5 years went and died the other day. I had my Mac here on my table and closed it then took it off to a coffee shop. Once I got to the coffee shop I opened it up and it flashes the screen (as if it was to wake up), then black screened.
Without going through all the specifics, after 2 hours of debugging, (trying to restart with and without battery, resetting PRAM, PMU, and others). So what was I to do?? Off to the Genius Bar and deal with the arrogant Mac jerks.
Now as you probably know I am a programmer, and build computers (for family and such) so I am not by any means a novice to technology. Unfortunately, whenever I go to the Mac store, the 'geniuses' treat you like a dumb ass. "Well sir, this is a computer, these buttons on the top are called 'keys' you type on it and magic happens then words appear on the screen. Am I going to fast??" So For this reason, I constantly dread going to them because i don't want to deal with their pompousness.
Thankfully, this time I got someone that didn't suck. I went in and explained to him (Mike) what the problem was. I then explained to him what I have already tried to fix it and he just replied with "Sounds good, you know your stuff.. well these are all things that we would have done. So I will have to take this in and send it out." I then asked If apple had some sort of 'lemon' policy, he stated that they didn't officially, however I could call Apple Care and ask them to help me out (get a new laptop). So I asked him if this was his laptop, what would he do? He stated that he would probably call Apple Care, and that I might get lucky. I then thanked him for all the help, and expressed how much I appreciated him not being a douche, and he just laughed and replied with 'ya, probably cause I am an older guy'
So The next day, I call Apple Care, and explain the problems. After 1.5 - 2 hours of talking with them they say that they will mail me a box for me to ship back the broken laptop. I then asked to speak to the guys superior and after talking with him I convinced him to give me a new laptop. So, I now am using a brand new Mac Book Pro!! The man apologized for the inconvenience and said that I should get it by mid week. So I sent my laptop in Friday at 3pm, and received my new MBP on the following Tuesday ~ 11am
The reason I am writing this is mainly just to say how pleased I was with Apple. They have done right in my book. They listened to my problem, and, albeit after much whining, they fixed my problem by giving me a new computer faster than I could have hoped for. So thank you very much Apple!!

Tuesday, June 9, 2009


Hello all, here is my random AS3 statement / question of the day. I have posted this on numerous forums, however no one seems to feel like replying, so I figured I would put it on the blog and see what answers I can catch here.

I am trying to mimic a paint brush in AS3 (in flex) for a mock art studio. Right now I am simply checking for mouse down + mouse move then putting a copy of some bitmapData on a sprite, then adding that to the main application. This sucks because after a while it starts to get bogged down.

As a result I checked out graphics.lineBitmapStyle() (an AS3 Flash 10 Feature documentation can be found here), I was able to get that to work (technically) but not how I wanted to use it. Right now it just tiles it (yes, I know there is a switch to turn repeating off) thus causing it to act like a 'scratch off' lottery ticket. What I mean by this is that it looks like there is a static image underneath (this is my bitmap) and my 'drawing' on the stage just makes it visible. Any help would be greatly appreciated... code is below:

var oldWay:Canvas = new Canvas()
//get bmpdata
var bRect:BitmapData = new BitmapData(100, 100); //create bitmap
var c:Canvas = new Canvas(); //create spoof canvas; //start fill,0, 100, 100,10,10); //draw that stuff!; //end fill
bRect.draw(c); //draw this out to the bmpdata
//now draw it on the stage,0); //start a line style,null,true,false) //set bitmap style, nY1); //move the point to my previous point, nY2); //draw to new location

Image of results here:

and with repeating on:

Saturday, June 6, 2009

HTPC hardware issue

So here's the deal, I recently (back in Feb 09) decided to build a HTPC (Home Theater Personal Computer) and at first it worked great! Now it is F-ed. I am looking for help where people are willing, here is the skinny: When building it, I used the following hardware:
I got the computer, built it and all was well. I was using Windows Vista Ultimate (trial version) and that worked awesomely, everything was going super. I left the machine on at all times, and let it sleep when it ws inactive for > 3 hours. Then out of the blue, the computer started dying every once in a while (usually at night time, and I found it dead the next morning, no I didn't have any jobs set to run at night aside from windows update)

So I do some debugging and figure its the HD, this was 'confirmed' by the memory test running 10 times all turning up positive, along with seeing the following message on the bios screen "SATA Drive 1:"

So I contact NewEgg and (as always) they exchange it for me with no problems. 1 week later I get my new HD, and re-install everything (same setup as before). After about 2 months, the same thing happens, and I get the nice old friendly "Bzbzbzbzbzbzbz" again. Once again I test everything, and while running my good ol' friend Knoppix, it shows that there is no hard drive... fucking super.

So I sent out and got ANOTHER HD (3rd one) and install linux ( a distro of kbuntu and it is not even instaleld for a day or so and the Bzbzbzbzbz begins... so obviously, something is F-ed In the A somewhere else on the machine.

So the question is how do I start going about debugging this fuck-fest? If you can think of a way to help i will give you... um... a virtual hug.

Wednesday, April 15, 2009

Removing anonymous function from an event listener

Hey guys and gals, quick lesson in flex. One popular thing to do is use something called an anonymous function with eventListeners when you want to pass the function something more than just the event. You would typically just say:

myObj.addEventListener(Event.ENTER_FRAME, function(a_event:Event):void{someotherFunc(a_event, additionalArgs);});

But this sucks if you are going to want to remove the listener. So something you can do is the following. You can create a function variable (func), then set the anonymous function to this var. Then the second function that you ultimately want to call (func2) will have an optional parameter ‘myHackFunc’ that will be the variable that you created (func). Then you just call remove event listener on ‘myHackFunc’.

I have heard of other ways of doing this, mainly, using ‘arguments.callee’ This causes my app to die, but the way described above, and shown below, seems to work all the time. Hope it helps!

public function myFunc1():void{
var func:Function = function(a:Event):void{ func2 (a, some_args, func)};
i.addEventListener(Event.ENTER_FRAME, func);

public function func2(a_event:Event, some_args:*, myHackFunc:Function = null):void{
a_event.currentTarget.removeEventListener(Event.ENTER_FRAME, myHackFunc);

Oh, or you could just go and use a custom event class... but that isn't the point of this exercise :P