Wednesday, September 30, 2015

Cool way to count bits

Count the set bits in a number.  Pretty cool.

for( count = 0; value != 0; count++ )
{
   value &= value – 1;

}


Wednesday, July 24, 2013

Tomato router and usb ext3 fs

I was copying some files to my routers external hd and sshed into it to notice that 75% of the CPU was being used by the ntfs daemon.  I had formatted the drive and used it with a windows machine before attaching it to the router.  I wanted to change it over to ext3 to hopefully bottle neck the router with smb instead :).

I ran into a problem making the fs on Tomato though, I had to create a swap device and turn it on for the mke2fs command to run successfully.  I didn't realize it would take so much memory.  But simple solution.  I also had to write the partition table after deleting the old partitions.

fdisk /dev/sda # adjust for disk if necessary
p # to see existing partitions
d # to delete partition if any
w # write table
fdisk /dev/sda
n # new swap
p # primary
1 # partition 1 swap
 # start at default block
+64M # size of Swap in MB; can be larger
t # set type of Swap partition
2 # partition 2 is Swap
82 # swap type
p # check partitions
n # new Data for remaining
p # primary
2 # partition 2 Data
 # default start block
 # default remaining blocks
p # check partitions
w # write it all out and exit
mkswap -L swap /dev/sda1
swapon
mke2fs -j -L data /dev/sda2


Friday, June 15, 2012

Dojo and the Grid !!!

DataGrid is making me pull my hair out.  I just wanted to be able to use a custom widget in the grid to edit things.  Worked pretty well, until we needed to make it AlwaysEditing (when the edit button was clicked).

If you have a button to edit, DO NOT USE AlwaysEditing and set the grid to editable.  It didn't work for me at least.

The way to do it is to return the widget from the formatter function, you create two functions and toggle between them depending on the state of your edit button.  Gottcha's include setting selectable for the grid in order to select text with your mouse, and override onCellClick so that the grid doesn't cause your widget to lose focus on the first click.

Tuesday, October 25, 2011

Dojo Tree's

I am working with Dojo Tree's at work.  Some interesting notes:

If you want to highlight the selectedNode in the tree use: .dijitTreeRowSelected.
You can set the selectedNode to null when there is a click in the root area of the tree like this:
    if(className.indexOf('dijitTreeContainer') !== -1) {
      this._objTree.set('selectedItem', null);
    }
Also you might want to expand the selected node if you are creating a new node as a child of it:
    if(this._objTree.selectedItem) {
      this._objTree._expandNode( this._objTree.getNodeFromItem(this._objTree.selectedItem)[0] );
    }

Wednesday, April 20, 2011

Tuesday, April 5, 2011

New cell phone plans

Jen and I are switching over to prepaid cell phone plans. We both transfered our "known" phone numbers to Google Voice, so that it is easy to switch plans and not have to worry about transferring the number.

I am still on Lockheed's cell phone plan, but we just bought Jen a sim card and 1000 minutes on T-mobile prepaid. The first challenge was getting Jen's cell phone an old Cingular phone unlocked so she could use it (all the prepaid phones are pretty ugly).

In the end I had to call AT&T to get the unlock code, but they didn't have a problem giving it to me, even though I had already canceled my plan with them, so that was nice. Here is the process:

  1. Get the IMEI number: Dial: * # 0 6 # and it will show up. I had to put in the old SIM card so that I could find this information. So get it while you can.
  2. Call the phone company (AT&T: 1-800-331-0500) and get the unlock code ours was: 4992009364755526, though I doubt it will do much good for anyone else.
  3. Enter the unlock code, for our w300i we had to press left, left, star, star while it was booting up. You can probably find instructions for most phones online.
The only problem is how to get the callee to see our GV number instead of our disposable phone number. You can do it multiple ways.
  • If someone texts you, the text will appear to come from some random number, you can call this and it will appear as if GV called them.
  • You can program in the number to call as , <2>, . the comma's are pauses, you also have to set GV to not ask for a password when the call comes from you mobile phone.
  • You can make the call from GV itself, and it will call your phone then your callee's.
Not a prefect system, but probably the best they can do w/o becoming a provider.

NFS is a ...

I recently started my new job and have been tasked with creating an embedded application to speed up the processing a certain web pages. The process for embedded application at Trane involves booting the SC from a NFS mount, so that you can build your application and it is immediately ready to run and debug.

It was really strange, the SC would boot once, then it would return a -13 error during boot. Running the NFS daemon in the foreground showed me that it was complaining about my /etc/exports. I had my export set to "10.*", which seemed to cause a problem, even though the client was a 10..

Anyways changing the export to * seemed to fix the problem, so I am going to go with that for now. Might try to look at it again if things slow down again someday.

Friday, December 24, 2010

Gift list for my forgetful mind.

Chris:
  • Kinect (Mom and Dad)
  • Awkward Family Photos Book (Jen)
  • Lips (Mom and Dad)
  • Lips Party Classics (Jen and Stephon)
  • Your Shape Fitness Evolved (Jen and Stephon)
  • Darth Vader Flash Drive (Stephon)
  • Food Chopper (Mom and Dad)
  • Black Socks (Mom and Dad)
  • Pizza Wheel (Mom and Dad)
  • Ornament (Mom and Dad, for all)
  • Undershirts (Mom and Dad)

Jen:
  • Pie Server (Mom and Dad)
  • Cricut Cartridge (Chris)
  • Pizza Wheel (Chris)
  • Craft carrying case (Jen and Stephon)
  • Cupcake carrier (Mom and Dad)
  • Waffle Maker

Nick:
  • Santa Hoodie Towel (Jen and Stephon)
  • Little Green Elmer Fudd Hat (Jen and Stephon)
  • Bear Hat (Mom and Dad)
  • Play tape measure (Chris and Jen)
  • Hand made sock monkey (Jen)
  • Little People Santa and Reindeer set (Mom and Dad)
  • Money Jar (Mom and Dad)
  • Recycle remote control car (Chris and Jen)
  • Me Hungry book (Chris and Jen)
  • 2nd Christmas ornament (Mom and Dad)

Wednesday, August 19, 2009

BCK-08 AD2P


I wanted a blue tooth headset I could use to watch movies on the TV through the computer while in bed w/o disturbing Jen. They are prohibitive expensive though, so when I saw the BCK-08 on deal extreme for 12 bucks I wanted to give it a shot.

Deal extreme is a pretty amazing site, that has cool electronics for ridiculously low prices. The BCK-08 is an AD2P stereo receiver and hands free headset. At the same time I purchased a blue tooth adapter SKU: 11866. I did not have much luck with the adapter though.

Fortunately, I did have another larger adapter which I was able to get the headset to pair with. It works pretty well, I am impressed. The distance is plenty for my purposes, the only issue is if the laptop gets in between the two it breaks up.

Tuesday, July 21, 2009

Setting up PXE boot

This was done on a Ubuntu install.
  1. Create /tftpboot directory
  2. Copy pxelinux.0 from /usr/lib/syslinux to /tftpboot
  3. Statically assign an IP address to the MAC of the ethernet adapter (192.168.1.200) (I use tomato on my router so it is pretty easy).
  4. Create a pxelinux.cfg directory in tftpboot.
  5. 192.168.1.200 is C0-A8-01-C8 in hex notation so add the following 0 length files(use touch) to the above directory:
    C
    C0
    C0A
    C0A8
    ...
    C0A801C8
  6. Also "touch" a file with the MAC address of the client adapter. Prepend 01-... For example: 01-23-55-03-34-09-11 (use you MAC address)
  7. Add dchp-boot=pxelinux.0,,ip of tftp server - to the custom dnsmasq configuration (again in tomato advanced->DNS).
  8. Enable the TFTP server.
If you start your client computer you should get to a boot screen. If you try to boot, there won't be an image there yet. Will get to that in the next post.

Reference websites:

Saturday, July 18, 2009

My web domain

Recently my contract with my hosting service came up. The cost is $190 for 2 years, which seemed high, since new contracts were going for less then that.

Well a couple months ago, they recommended switching my email to google apps which was pretty painless and much better then their mail app.

So I was thinking, I don't do much on that host anymore so could I get rid of them. Turns out I could and save myself $190 a year. I am now using dnsexit.com for my dns purposes, which will freely take care of DNS for mail and sub-domains on your domain. And Google Apps for the website I use, and email (plus calendars, docs, ect for gratis).

Only cost (6.99 / yr) will be if I can't figure out how to forward the mail domain from my router to google as well. But even requiring a www at the frontend isn't that big a deal.

Saturday, July 11, 2009

Some interesting posts

From: As a programmer what perks do you get?


Wavicle 18 points 2 hours ago[-]

I work for a fortune-50. We get:

  • Free overtime! We can work all the overtime we want without it impacting our salary.
  • Your very own laptop with VPN. Excellent for getting all that free overtime.
  • Customized bureaucracy. Each org unit within the company gets to make its own!
  • On-site cafeteria with prices just slightly above nearby restaurants and food almost as good.
  • Annual stock option grants of constantly declining share value! I can buy hundreds of company shares for just a modest premium over market value!

Suck it, small-timers!



I like where this is going.

  • We were growing by leaps and bounds for the last 3 years and the board said that instead of giving employees bonuses they'll use the extra money to grow even more. Now that our sales volumes have dropped and we're in the red, the board generously mentioned that part of future profits will go towards bonuses!

  • In the interest of making management's job easier things like telecommuting are being discouraged and taking time off for personal reasons is made more difficult.

  • I've been instrumental in the data design for our new productivity tracking system except half of my suggestions are noted but eventually forgotten. Then when it's brought up later on they ask why they didn't get around to this sooner. Or they'll give credit to someone else on the team for suggestions I made months ago.

  • I have the privilege of paying for basic medical coverage. I opted out of the extended medical plan though since i don't really need to pay extra from my paycheck for prescription eyewear, massages and dental. I just cough up the cash when i visit the dentist.

  • When I come in hung-over I need to stop over at 7-11 first since they got rid of the powerade from the vending machines.

gaoshan 32 points 6 hours ago[-]

My company offered to let us buy coffee cups, with the corporate logo on them, for a special employee rate of $6.99. I thought that was a pretty sweet deal.

deong 13 points 5 hours ago[-]

Tickets to our company picnic are $10.

Tuesday, June 23, 2009

Thursday, June 18, 2009

Books to read...

Lord of the Flies.
Catch-22

Monday, May 4, 2009

windows and linux

In case you ever get a "command not found" error when trying to run a script as such "./command". Which I encountered today, try running dos2unix on it. Damn ^M.

Wednesday, April 29, 2009

ATI card and Westinghouse TV

So I bought a Zotac motherboard with an integrated Geforce 7100, I thought this would be enough to play hd-dvd and blu-ray movies, since I have a 6600 quad core. I was able to connect to my 52" Westinghouse TV and it would display fine, however hd-dvd movies would stutter a bit... Bummer.

Enter the Apollo AP-HD4350 from newegg. Cheap card made especially for hd movie playback. Install it and it displays on my 1280x1024 lcd just fine, install the latest and greatest drivers (catalyst 9.4) and hook it up to the 52" Westy. Of course there are problems, nothing ever works out at first.

First there was the LCD Overscan that defaulted to an 8% reduction in screen size, no biggie, fixed in the Catalyst Control Center (CCC). But the screen flashes to Black about once every 3 seconds, it is sporadic, but about that. I tried to playback a hd-dvd and it plays back fine now w/o stutter, but with the flashing to black...

Tried going back to the driver on the disk included, same problem. Tried bringing the computer up so that the hdmi cable was much shorter, nothing doing. Tried many things. The thing that ended up working was to interface to the DVI port instead of the hdmi port. Put a DVI to HDMI adapter in the mix and that seemed to clear up the flickering.

However, then the display was jumping up and down by about 1 pixel multiple times per second. Looking through the CCC panel I found an option for vertical timing and adjusted that to be on all the time, instead of application specific and that seems to fix that problem.

In conclusion, I should be able to play hd movies on my big screen now. But is was not w/o quite a bit of bug fixing along the way, and obviously the disadvantage of not being about to use the hdmi audio component.

Thursday, April 16, 2009

Great picture

New egg order on 3/36

D-Link DGS-2205 10/100/1000Mbps 5-Port Green Technology Switch - 34.99
MASSCOOL 8W553B1M3 90mm Ball CPU Cooler - 9.99
Link Depot 16 ft. HDMI TO HDMI - 9.99
LG Black LG Blu-ray/HD DVD-ROM GGC-H20LK - OEM - 94.99

The reason I am bringing this up because I wanted to talk about the intel q6600 I purchased awhile before this. I am running it on a Zontac motherboard (which I think was $35...). Anyways, my processor would idle at 45-50C, which seemed quite bad, so I ordered the Masscool above. I thought I had seated the intel cooler on the CPU reasonably well, though it was quite a hassle to get on.

I received the above order and played an hddvd, when I checked the core temps they were in the 90C range, big problem. Then installed the Masscool and the idle temps dropped to the high 20C and while playing an hddvd (for a short period) the temps went up to 50C. Acceptable I figure. Of course, this is with the old thermal paste still sitting on the CPU and just the stock paste on the Masscool. But I don't have an interest in overclocking, so it should be fine. Actually I wouldn't mind underclocking it, but the Zontac motherboard is quite barebones...

Tuesday, April 7, 2009