Pen the Pig

February 27th, 2010

Here’s a little game I made a while ago. Just found it on a disk going through old school papers. Enjoy

Pen the Pig Java App

I’ve been warned to not try this. but the nagging of software update and sluggish video playback with some flash sites leaves me wanting to give it a shot.

Steps

Do stuff

  • CCC to backup my system drive.

  • boot from it to make sure things work.

    • shutdown, start and press F2 to enter bios setup

    • enable Legacy USB support, so you can see the bootable new cloned usb drive

    • save and exit, then restart and log in making sure your clone is solid…

Research stuff

  • Find some instructions on how to update properly

    • Download Jim’s zipped up resource manuals

      referring to the file named: “Snow Leopard 10.6.2 Update Guide.rtf” and for more details on post update procedures “How To Hackintosh a Dell Mini 10v - THE GUIDE.pdf” see Odds and Ends on page 7

    • netbook installer download 0.8.3 alpha is the latest right now.

    • Download os x 10.6.2 combo update from apple

Do more stuff:

Instructions followed from “Snow Leopard 10.6.2 Update Guide.rtf”

  1. Run NetbookInstaller 0.8.3.
    • this take about 5 minutes. left everything default (after selecting my main hard drive)
    • you will be greeted with a success message. close the app
  2. Install Snow Leopard 10.6.2 update.
    • this takes a few minutes, play some cello while you wait
  3. Restart.
    • restart hasn’t worked on my 10.6.1 install. it seems to not power off after shutting down.
    • crash won’t restart. Need to start in safe mode.
      • press and hold shift when powering on
      • you will see your boot drive (the UI looks better now, that is still the bootloader screen)
      • type ‘-x’ to enter safe mode, then wait for it to boot, it takes a while.
      • login with your password, and press shift as you click ‘login’ this prevents login items from being loaded
      • looking at Apple->”About this Mac” it says 10.6.2…we’re getting closer
  4. Copy third-party kexts to the Extra/AdditionalExtensions folder
    • I don’t have any
  5. Run Extra/UpdateExtra
    • press the ‘Update Extensions’ button
    • enter your password, this takes about as long as running NetbookInstaller
    • (appears to be restarting properly!)
  6. Restart.
    • success!

Updates

I’d been putting off installing the security updates as well. I did a quick search for ‘mini 10v 2010-001’ and found the top hit at mydellmini.com said no problems.

Reminder

I needed to turn off usb legacy support in bios


For future reference

“When a new version of NetbookInstaller is released, simply download it to the Applications folder and run it.”

A couple months ago I excitedly jumped up and my uncased iPhone fell out of my shirt pocket, crashing down on some hard cement. It shattered the screen. The LCD underneath was fine.

I ordered the a new screen kit for about $24 with shipping. amazon link

and replaced it following the instructions from two videos. video

In performing this repair I broke the home button. The razor knife slipped as I was cleaning broken glass off from around the button.

Home Button Replacement

It’s not quite time for an android phone…so I looked for a software solution to a broken home button. I would need to restart my phone to close an existing app.

There is a handy app called SBSettings. I then downloaded a widget for that app which closes the currently open app. Close Button widget

This site mentioned it.

Git Setup

February 1st, 2010

Git Setup

So one thing I put off was setting my global git config file. This is useful for making command line usage more visually appealing and there are a few alias’s I like.

from Wincent.com and me

  # personalize these with your own name and email address
  git config --global user.name "Wincent Colaiuta"
  git config --global user.email "win@wincent.com"

  # colorize output (Git 1.5.5 or later)
  git config --global color.ui auto

  # colorize output (prior to Git 1.5.5)
  git config --global color.status auto
  git config --global color.diff auto
  git config --global color.branch auto

  # and from 1.5.4 onwards, this will works:
  git config --global color.interactive auto


  # support habits from Subversion/CVS
  git config --global alias.st status
  git config --global alias.co checkout
  git config --global alias.ci commit


  # mine
  git config --global alias.br branch

Warning this is yet again a pretty sloppy post. See the links listed for more linear directions…

So I did a few things.

The post that finally gave me enough info to get it working:

fuzzylizard blog

I wanted to stay away from the passenger preference pane mainly because it didn’t work right away and taking away 1 layer of abstraction seemed like a better way to narrow down the cause(s) of the problem.

Key points:

  • Apache Logs can be viewed with Console a mac utility app. It’s also nice to see what else might be crashing in the background (so you can fix it!)

  • Once apache is running and the app is being served you can view custom apache logs for your sites or the general apache logs here:

    cd /private/var/log/apache2/

  • To get passenger running I needed to do the standard two main things, then 3 more files needed to be configured. When all is working adding a new site only requires touching files.

First install passenger and the apache2 module. passenger site

sudo gem install passenger
sudo passenger-install-apache2-module

then this stuff…

  1. /etc/hosts

    # add your urls, so browsers know to look locally
      127.0.0.1 priorities.local
    
  2. /etc/apache2/http.conf

    # uncomment
    Include /private/etc/apache2/extra/httpd-manual.conf
    

    make sure correct version is listed

    LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/apache2/mod_passenger.so
    PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9
    PassengerRuby /usr/local/bin/ruby
    
    
    RailsEnv development
    
    
    <Directory "/Users/vizzle/Sites">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
    
    <Directory "/Users/vizzle/Documents/MyStuff/Code">
        Order allow,deny
        Allow from all
    </Directory>
    
  3. /etc/apche2/extra/httpd-vhosts.conf

    NameVirtualHost *:80

    ServerName priorities.local DocumentRoot “/Users/vizzle/Documents/MyStuff/Code/MyApp/public” ErrorLog “/private/var/log/apache2/priorities-error_log” CustomLog “/private/var/log/apache2/priorities-access_log” common

    The environment can be set from within each vhost (prod, test, dev, staging, etc)

    RailsEnv production ServerName priorities.local DocumentRoot “/Users/vizzle/Documents/MyStuff/Code/MyApp/public” ErrorLog “/private/var/log/apache2/priorities-error_log” CustomLog “/private/var/log/apache2/priorities-access_log” common

Then this

So with Sharing on, apache was still needing my Code directory (the place I keep rails apps) to be shared. This unacceptable so my current solution/work-around is this

  • Turn of Sharing via the System Preferences.

  • Then start apache as root

    sudo apachectl start
    

NOTES / Reminders

So to add new sites just add them to the extra vhosts file, and to the /etc/hosts file, then restart apache.

  sudo apache graceful

or

sudo apache restart

Setting RAILS_ENV for running your app

  RAILS_ENV='production' rake db:create

Google Image JSON API

January 19th, 2010

So as you may now notice there are some little images to the right of each post.

These are generated based on the text content of each article title. Using google’s AJAX API, a single random image from an array of image results is displayed.

code.google.com/apis/ajaxsearch/documentation

This method returns the URL of a random image.

 require 'net/http'
 def get_image(keyword, position=0)
   @response = Net::HTTP.get(URI.parse(
     "http://ajax.googleapis.com/ajax/services/search/images?rsz=large&start=#{position}&v=1.0&q=#{keyword}"))
   ruby_response = ActiveSupport::JSON.decode(@response)
   list = ruby_response["responseData"]["results"]
   size = list.length <= 10 ? list.length - 1 : 10
   first_image = list[(rand * size).round]["url"]
 end

So this posting is really just my personal notes I took while going through this process. I followed the listed links, and mention the exceptions and things I needed to do to resolve the various snags I ran into.

Worst one is that I started with my old 10.5.5 install disk. Apparently if you start with 10.7.x life will be better.


How To: Hackintosh a Dell Mini 10v Into the Ultimate Snow Leopard Netbook - Dell mini 10v hackintosh…

… Needed to boot from a USB device not directly from an SD card. … probably coulda worked but didnt so i got my usb flash drive.

in windows copy the file after the boot image has been made.

boot from dos memory stick

“R225278.exe /forceit /forcetype”

use NetbookBootMaker to put stuff on osx image

try to install not working

via Disk Utility launch os x install disk again and manually reformat by making original drive 1 partition, make sure it’s GUID Partition Table in ‘Options…’ section


Frozen at install screen. “os not found” found out that message by booting in verbose mode: F12 then in bios mode, select ‘-v’ then restart.


Freaky. the install disk froze on me several times. I think because I am using this sdhc card reader and card, the connection was bad. or if I bumped it at all or it wasn’t in just right…problems. I don’t like that a 3rd attempt succeeds.


Its there with 10.5.5

but installing to 10.5.8 via software update is causing problems.

-http://osx.mechdrew.com/guides/nbi1.shtml

need to update, then boot in safe mode “-x”

Then….run NetbookInstaller which is in my applications folder.


another problem…won’t boot…

put in my install drive to start terminal. No vi, pico, or nano available so had to change the file with sed.

backup your com.apple.Boot.plist file, sed -e ‘s/machkernel.10.5.6/machkernel/’ com.apple.Boot.plist > tmp.txt mv tmp.txt com

from: http://www.mydellmini.com/forum/dell-mini-10v-mac-os-x-discussion/12839-cant-find-mach_kernel-10-5-6-error.html

  1. On the Chameleon screen, type “mach_kernel” and hit return. (The characters are shown at the bottom.)
  2. OS X starts up.
  3. Use Terminal and go to /Extra directory.
  4. Find com.apple.Boot.plist
  5. sudo vi com.apple.Boot.plist and find the string “mach_kernel.10.5.6”, erase “.10.5.6” and save it. (You know how to use vi.)
  6. Restart the system and cross your fingers.

Then it worked…

THEN I started using it and found how well 1 gig of ram and the smaller harddrive felt.

I bought some ram from fry’s for $50 Kingston 1GB DDR2 PC2-5300 667MHz

and a 500 gig drive.

I prepared the drive as follows:

Used Carbon Copy Cloner to clone my existing drive. -Ran the NetbookBootMaker on it with default options. -Enabled the USB Legacy Support bios setting -did a test boot from it to make sure everything was working well.

then followed the video below. First I just swapped the drive then put the keyboard back on and turned it on. The hard drive is really easy to get to. It booted as expected with Lots more space.

then I proceeded with the videos to replace the RAM.

parts 1-3 http://www.youtube.com/watch?v=mXOZDNVRkZo

The guy is really clear. And I found it was nice having a buddy alongside this adventure.


I also have another 10 gig partition to put windows on. I’ve tried it with VMware. It was really sluggish with 1 gig of ram. I figure I’d like a native windows version for browser testing/ IE testing. That’s a lot of memory for 1 use.

From what I’ve read its best to install Windows first but…I’ll see how it goes.

also: http://www.mydellmini.com/forum/faqs-how-tos/2099-virtually-increase-your-dell-mini-screen-resolution.html

    defaults write -g AppleDisplayScaleFactor 0.95
    defaults write NSGlobalDomain AppleDisplayScaleFactor 0.95

How to save flash videos for free

November 13th, 2009

So there are a bunch of apps out there that will let you do this. BUT why not just learn how to use your browser a little better?

command-option-a will open the ‘Activity’ window. Look for the larger file listed there copy and paste it into a new window and watch the .flv file downoad.

(thanks: http://www.macosxhints.com/article.php?story=20070420014456930)

not necessarily a code snippet but something worth passing on.

CSS and Design stuff

May 3rd, 2009

Now that I’m getting back into design I thought I’d share a few interesting resources:

Transcending CSS the fine art of web design by Andy Clarke is great. This jumps straight to the finer points of web design and as the title suggests the subject matter is treated with class.

I like reading of current conventions: semantic naming is great.

POSH

Microformats

Alright it’s only fitting that the first post describes how this site was successfully deployed.

Context: How can I deploy Mephisto using my Dreamhost account?

(Let’s see how do I do links in Markdown? like this)

It looks like the latest github edge branches are working on rails 2.3 support. Given that using Dreamhost I am forced to use whatever version of passenger they have installed (correct me if I’m wrong), I’ve stayed with the Mephisto version that can run on rails 2.2.2.

  • No need for github for your private personal projects

    gitn-your-shared-host-on

  • This covers settting up your dreamhost site, db, capifying your app, pushing it to your new repo from the above link, then running cap deploy.

    deploying-rails-on-dreamhost-with-passenger

    Be sure your database.yml file is configured properly.

    production:
      adapter: mysql
      database: DB_NAME_production
      username: YOUR_MYSQL_UN
      password: xxxxxxxxxxxxxxxxx
      host: mysql.YOUR_DOMAIN.com
    
  • After obeying the installation instructions included with Mephisto, I was still having trouble getting passenger to run. The error page it spit out didn’t include include any clues. So I looked for logs. Where are they on dreamhost?

    tail -f /home/YOUR_DH_USERNAME/YOUR.SITE.COM/current/log/prooduction.log
    
  • Turn up debug in production for informative error messages. In config/environment.rb

    config.log_level = :debug
    
  • I had a hunch passenger with 2.2.2 wanted ruby 1.8.7 (Dreamhost has 1.8.5 pre-installed) so I installed it like so

    cd ~/.packages
    wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
    tar zxvf ruby-1.8.7-p72.tar.gz
    cd ruby-1.8.7-p72
    ./configure --prefix=$HOME/.packages --with-openssl-dir=$HOME/.packages --with-readline-dir=$HOME/.packages
    make
    make install
    
  • I’m not sure when I did this but it’s a good idea:

    rake rails:freeze:gems
    
  • As suggested, I added the following lines to the top of config/environment.rb.

    ENV["GEM_HOME"]="/home/YOUR_DH_USERNAME/.gems"
    ENV["GEM_PATH"]="/home/YOUR_DH_USERNAME/.gems:/usr/lib/ruby/gems/1.8"
    
  • After fiddling around with all that stuff my current deploy zone looks like this

    locally, make changes, ci, then push

    git push origin master # goes to my dreamhost git repo
    

    then update the site

    cap deploy # no migrations needed, this runs 'touch YOUR_SITE/current/tmp/restart.txt' to restart Apache so your changes can be seen.
    

    then remotely log in to your dreamhost account, and navigate to your domain/current

    RAILS_ENV=production rake config/initializers/session_store.rb # if you forget to do this the passenger error log will tell you to
    

Mephisto Changes

  • So Mephisto has a few things broken that needed to be fixed. (See your logs for those details)

    The location of the default liquid theme couldn’t be found so I moved it.

    themes/default/site-1/simpla to themes/site-1/simpla

    But it had some formatting issues making git complain and not allow me to post my changes. just strip out the trailing spaces and reformat a block.

Purpose

April 6th, 2009

This site is intended to be a place to put tips I found useful in setting up various code related projects.

My apologies for any dead links or outdated info.

Hopefully when you stumble into these pages through random web searches, your solution will be a little closer than it was for me.

Vincent