American dream is slowing fading…

feels like the american dream is slowing getting out of reach for many. how many can afford college these days or a house? for many, the only thing people can afford is fast food and mobile apps. many of these free apps and games feel like fast food. cant really sustain you in long run. we need more innovation in other areas other than web and mobile, like in transportation, energy, etc.. 

jQuery append images to table add new column

var re = new RegExp(‘(http:\\/\\/\\S+[\\.png|\\.jpg|\\.gif])’,’g’);

 

$(“tr .item_name”).each(function() {

    var newimage=”;

    var images = $(this).html().match(/http:\/\/\S+(\.png|\.jpg|\.gif)/g);

    var thumbs = $(this).html().replace(re, ‘<img src=”$1″ class=”thumbnail50″/>’); 

    $.each(images, function(index, value) { 

          newimage += “<img class=’thumbnail50′ src=”+value+”>”;

    });

    $(this).parent().prepend(“<td>BBB</td>”);

 

});

jqGrid not editable TD within editable TR row

line 2368: if($(ptr).length === 0 || ptr[0].className.indexOf( ‘ui-state-disabled’ ) > -1 || ($(td,ts).hasClass(‘noEdit’)) || ($(td,ts).closest(“table.ui-jqgrid-btable”).attr(‘id’) || ”).replace(“_frozen”,””) !== ts.id ) { 

I added noEdit class to column so it wont be clickable.

Rsync hostgator SSH 2222

rsync on hostgator

http://forums.hostgator.com/rsync-t55940.html

http://blog.aseaofflames.com/2010/10/how-to-backup-your-shared-server/#step1

 

rsync -vre ‘ssh -p 2222’ . –exclude ‘.hg’ –exclude ‘.git’ me@199.99.99.9:~/www/sitename

Really pissed at Google Storage right now…

I was on the $5/year plan for $20 and when I went to visit the Google Storage recently, it said there was an upgrade to $2.49. I mistakenly thought it was $2.49 for the year but in fact, it’s per month. They make all the plans look similiar and said it was UPGRADE.

So stupid me, I clicked it and next thing I know, I lost my $5 plan and was put in the higher monthly plan.

Damn you Google. Bullshit.

Fancybox load iframe into fancybox popup manually

$.fancybox(
                            { ‘href’: ‘www.yahoo.com’ },
                            {
                                ‘width’: 950,
                                ‘height’: 300,
                                overlayShow: true,
                                type: ‘iframe’
                            }).resize();

PHP recursive find files and directories by filename

http://snippets.dzone.com/posts/show/4147

function my_handler($filename) {
  echo $filename . "\n";
}
find_files('c:/', '/php$/', 'my_handler');



And the actual snippet

function find_files($path, $pattern, $callback) {
  $path = rtrim(str_replace("\\", "/", $path), '/') . '/';
  $matches = Array();
  $entries = Array();
  $dir = dir($path);
  while (false !== ($entry = $dir->read())) {
    $entries[] = $entry;
  }
  $dir->close();
  foreach ($entries as $entry) {
    $fullname = $path . $entry;
    if ($entry != '.' && $entry != '..' && is_dir($fullname)) {
      find_files($fullname, $pattern, $callback);
    } else if (is_file($fullname) && preg_match($pattern, $entry)) {
      call_user_func($callback, $fullname);
    }
  }
}

Fast way to create PNG thumbnails of EPS files on Mac OS X

  1. Install MacPort at http://www.macports.org/install.php
  2. Install ImageMagick http://www.imagemagick.org/script/binary-releases.php
  3. Go to directory with all your vector files and open Terminal
  4. find . \( ! -regex ‘.*/\..*’ \) -type f -name “*.eps” -print -exec convert -resize 200×200  -colorspace RGB -quality 50  ‘{}’ ‘{}’-thumbnail.png \;
  5. The regex ignores the hidden files in directories and resize resizes it

Running latest Mediatomb on Promise NS4300N NAS drive

  1. Go to http://mediatomb.cc/pages/download#static
    1. Find the one for the Promise architecture. Just search the page for promise.
    2. Download it and unarchive it
  2. Go to your media server using network drive on your computer
  3. Copy the files from unarchived media tomb to your media server
  4. Go to your media server using SSH (you’ll have to download plugin to allow you to SSH into it)
  5. Go to directory where you copied the files and run using command ./mediatomb.sh 
  6. Might have to make it executable using chmod +x mediatomb.sh

ZMODO 8 CH DVR Outdoor IR Surveillance System PKD-DK0866-NHD Review

I am using the Zmodo 8 chnnel DVD IR Surveillance system PKD-DK0866-NHD and have to say it’s kind of crappy. It’s very cheap and not that hard to install. The only problem is the video quality. The cameras that come with it are pure crap at 420TVL or something like that and if you want to view on browser, you must use IE with ActiveX. 

You can run it using Asee on the Mac. Just run App Store app in your Mac OS X and find the Asee app and install it and it’ll work. I go tit working fairly simple but again, crappy video quality.

I bought some higher resolution cameras off ebay (mostly from Hong Kong) that were 700TVL and more but the quality was again crappy. I am not sure if it’s the DVR system or the cameras. I am suspecting it’s the Zmodo DVR.

I just ordered a Swann 16 channel system from Costco and will let you know if that’s any better. I’ll also try to include some sample photos of the Zmodo here for comparison.

Again, for less than $200, it’s kind of crappy. 

Update 2/15/2012: I tested the Swann 8 channel system from Costco for $599 and found it to be also bad. Same software as Zmodo and looks great on monitor but as soon as you view it via mobile, it looks crappy. The Swann cameras were much better than Zmodo though… esp in black and white situations. Software was the same. 

Promise NS4300 losing PICTURE or VIDEO folder when swapping drives

The PICTURE and VIDEO folders are automatically linked via symbolic links by Promise 4300. So if you swap in a new drive and those PICTURE and VIDEO folders are on anything other than VOLUME1, it’ll become lost.

You’ll need to SSH into the server and rename the folder to something else. 

I used command mv PICTURE PHOTOS

So your stuff are still there. Just hidden.