git archive the current directory into a zip file
Monkeying around with Bosco. These are notes to myself. If you're reading this, you're probably lost.
rake db:migrate RAILS_ENV="production"That command will run all the Migrations it finds under db/migrate until it's at the highest version number. You can override the version number by appending VERSION=x after the command. - i.e., pass RAILS_ENV="test to force the migration to run on the test.
Just installed Ubuntu 9.04 (released Apr 23, 2009) on my work laptop. Here are all the things I needed to do to get a Rails environment working. One additional complication is that I use Heroku to deploy. Install non-default Ubuntu packages
The example at Mandarin Soda didn't work for the latest version of the Ruby oauth gem (version 0.3.2.2 as of this writing). Took me a day to work out all the differences. The slightly alter code is a gist on GitHub (and reproduced here). The differences are:
In Mac OS X, to open Safari on a file (e.g., README.html) from the command line, use the "open" command with the "-a" switch:
open -a /Applications/Safari.app README.htmlReplace Safari with Firefox to use Mozilla Firefox. Why do this at all? I'm working on the command line and it's a pain to "open ." to get a Finder window, and then drag-&-drop the file in question onto the appropriate dock icon. Lastly, add aliases to ~/.bashrc to cut down on the typing even further:
Use the Twitter4R gem. I tried using Twitter, but could never install it properly in the vendor directory - probably my own gem naivete, though, YMMV.
Like Chris Wanstrath says - "vendor everything". Unpack it into your vendor/gem directory. If the gem is already installed, cd to vendor/gem and use this command:
Add Chris' code to the Rails::Initializer.run block in your config/environment.rb:
Add this line of code at the bottom of the Rails::Initializer.run block in your config/environment.rb - it tells Rails that the "twitter" gem is found in "twitter4r.rb":
(Optional) Register your app with Twitter. Otherwise, tweets you send will display on the Twitter home page with a link to twitter4r. Once Twitter registers your app, you'll get an email with a "source token" (usually the name of your app in lowercase). Add an init file (i.e., set_twitter4r_source.rb) to config/initializers/ to initialize twitter4r with that source token. Don't bother grepping for Twitter4R and changing URLs randomly - it won't work (I tried):
Using the following code snippets, you should be able to authenticate and to send a tweet:
Tag:
git tag -a some_release_nameExport:
git archive --prefix=quikcms/ HEAD > ../quikcms.tarSince I have to be in the same level as .git, I want to export the tarball one level higher. Moreover, the files inside won't have a dir prefix, so I have to add that on the command line.
This test GWT application demonstrates a few bugs I encountered while using gwt-dnd-2.0.7.jar [1] for drag-and-drop of DIV's inside a FlowPanel [2] wrapped inside a ScrollPanel [3].
The app displays three such ScrollingDropPanel's on the page and allows users to drag-and-drop "strips" within a panel and between panels. Note that the app uses strict mode.
The bugs are:
References
rsync -a src/ dst/ is too aggresive when backing up files between different file systems - most notably between Samba & Unix. -a is a short hand for -rlptgoD
Inspired by this Firefly Lamp on Etsy, I made my own version. The difference being that the LEDs are held in micro-sockets and thus the owner can change the LED configuration at her discretion. Things to watch out for:
Yet another script to make non-Pro QuickTime display a movie in full screen:
(*
Works only as "Drag & Drop" program.
Written by F-3000
*)
on run
-- if invoked w/o movie, see if quicktime player is running
tell application "Finder"
using terms from application "Finder"
if "QuickTime Player" is in (get name of every process) then
-- if quicktime player is running, try to maximize a movie
tell application "QuickTime Player"
try
-- if no movies are loaded, the try block degrades graceful
present front document scale screen
end try
end tell
else
-- quicktime player is NOT running
display dialog "Drop a movie on the application icon." buttons {"OK"} ¬
default button 1 with icon stop
end if
end using terms from
end tell
end run
on open (dMovie)
if (count (dMovie)) > 1 then
display dialog ¬
"Try dropping a single movie, if you don't mind." buttons ¬
{"Quit"} default button 1 with icon stop
else
tell application "QuickTime Player"
activate
try -- Prevents error when QT is already open.
close document 1 -- Closes any possibly opening advertises.
end try
open dMovie
present document 1
play
end tell
end if
end open
Links:My Favorite Points:
This eclipse project archive demonstrates a technique in GWT to call an RPC service, implemented in one module (Common), from another module (Display). Note:
inherits name='com.boscomonkey.data.Common'
I always forget how to use Perl regex to capitalize every word in a string buffer. So here it is for future reference:
$buffer =~ s/\b\w/\u\L$&/g;
In my 1.5.0.9 Windows version of Firefox, all the search sites in the Search Bar disappeared one day. Didn't realized how much I used that Search Bar until it wasn't functional. I tried reinstalling the app, and when that didn't fix anything, I suspected that the problem was in the user specific application data. I deleted the
Application Data\Mozilla\Firefox directory and all my settings got cleared.
I've customized my Firefox so much that it was going to be a pain to redo all the settings and so I restored my settings directory from the trash and proceeded to wade through the Profiles directory and removed one file at a time to figure out which caused the Search Bar to come back.
In the end, it was the localstore.rdf file that turned out to be corrupted. When I removed it, my Search Bar returned to normal. Yay!
Details can be found by following the title link. In short, though WinXP has an "Internet Time" tab on the "Date & Time" control panel, other versions of Win32 doesn't. For all versions, you can sync your Windows machine time by first setting a time server:
net time /setsntp:tick.usno.navy.miland then syncing the time:
net time /setIf your time service is not already setup, read the article. The US Naval Observatory has a backup time server named tock.usno.navy.mil; so if tick doesn't work, try tock. A Microsoft web page has a list of time servers that are available on the Internet.
My ToDo list for new Redhat-derivative builds:
growisofs -Z /dev/dvd=ISOFILENAME -speed=2Where ISOFILENAME is CentOS-4.4-i386-binDVD.iso, for instance. Note:
Posted and answered my own question regarding Google Web Toolkit. The way to handle non-GWT POSTs in GWT servlet is to:
Since I use Instantiation's GWT Designer, it automatically generates the service's Async interface java file, implementation java file, and servlet entry in the MODULE.gwt.xml file. Thus all I do is add the service(...) method in the implementation file.
Cheers.boscomonkey wrote: > In our GWT app, we have a login dialog box that pops up to handle fresh > users or users whose sessions have timed out. Now we wish to accept > username/password POSTs from our static web site or even affiliate web > sites. What are some approaches for handling POSTs from outside the GWT > app? > It seems that one simple approach is to write a standard servlet that > implements doPost, place it in our GWT app's server package space, and > if users authenticate properly, redirect to our GWT app's URL. In this > case, do I have to map this servlet in our MODULE.gwt.xml? What's the > URL to this servlet?
Note to self: in order to get
xsltproc on cygwin, I need to install the libxml2 and libxslt packages under the Libs category
I reassembled my cold cathode bicycle lights (see this or this or this) for BM 2006. While commuting home last night, a woman caught up to me and asked me where I got them. She was disappointed when I told her that I made them. That got me thinking however...
You can buy these lights online for anywhere from $30 to $100. But if you assemble them from readily available parts, they'll cost around $15 (excluding batteries) and you'll have the satisfaction of knowing they're your handiwork.
So here's the part list:I'm turning my old Pentium III 800 MHz box into a Linux RAID5 server. Steps are:
fdisk. Create one full size partition with type FD.mdadm:/dev/md0 available for LVM use:pvcreate /dev/md0vgdata with 32MB extent:vgcreate -s 32M vgdata /dev/md0
lvdata:17885 is the total number of LVM extents (at 32MB each) in my RAID. Uselvcreate -l 17885 -n lvdata vgdata
vgdisplay to find out how many free extents you have.reiserfs:mkreiserfs /dev/vgdata/lvdata
mount /dev/vgdata/lvdata /mnt/data
/proc/mdstat/ periodically to see if the recovery has completed. The cat output should look like this:Do not reboot your machine until the recovery is complete as it'll just start all over again.Personalities : [raid5] md0 : active raid5 hdh1[3] hdg1[2] hdf1[1] hde1[0] 586075008 blocks level 5, 128k chunk, algorithm 2 [4/4] [UUUU] unused devices:
In this article about installing Ruby, and Ruby-on-Rails for Mac OSX, I found that it also works for Fedora Core 2 Linux (and probably other *nuxes). However, if MySQL was installed with RPM, there isn't one root MySQL directory. Thus, the last command that you issue must be modified to point to where the include and lib files are located. So instead of using this command to install the Ruby MySQL native bindings:
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysqlsudo gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysqlmysql RPM distribution, the include files aren't. You'll also need mysql-devel for the include files.
The San Francisco Ruby Meetup Group met for the first time in a while on Dec 13, 2005. I did the 1st presentation - Running Ruby and Ruby-on-Rails on the Macintosh - because my colleague who promised to do it had to go on a business trip. It's basically a rehash of the steps in the following articles:
readline on my Mac, it was at version 5.1 but the instructions in the 1st article was still referring to version 5.0. The instructions have now been updated to 5.1 and the following note (here for historical purpose) can be ignored:Note that the latest version of readline is 5.1 and you don't have to do the business with sed/mv after running configure (skip these two lines):sed -e 's/-dynamic/-dynamiclib/' shlib/Makefile > shlib/Makefile.new mv shlib/Makefile.new shlib/Makefile
In a previous post, I noted that you can use RSS Digest to embed your del.icio.us links into your web page. It turns out that del.icio.us offers its own JavaScript facility to do that - they call it linkrolls. Once you're logged into del.icio.us, go to http://del.icio.us/doc/feeds/js and use the form there to customize the JavaScript that you can embed into your web page. Why do I prefer it over RSS Digest?
The 2-finger trackpad scrolling on the new iBook causes vertical scrolling to jump really fast on Firefox. The solution is to use a custom number of lines per scroll rather than the default system number of lines. The changes in
about:config are:mousewheel.withnokey.numlines values. To me, 3 seems closest to Safari's behavior but your mileage may vary.
By default, the horizontal 2-finger scrolling feature on the new iBook trackpad causes Firefox to move backwards and forwards in the history list - quite annoying. This Mac OSX Hints page tells you the Firefox
about:config preferences to set to change that. In short:del.icio.us has an experimental "remember me" bookmarklet that pops up instead of showing in-page. The advantage is that you can flip back and forth between the page you're bookmarking and the del.icio.us dialog. The only downside I've seen so far is that the post does not occur immediately (and sometimes not at all :-). To try this out, add this bookmark by hand and replace ACCOUNTNAME with your del.icio.us account name:
remember this (popup)In Mozilla Firefox, you can simply drag the above link to your Bookmarks Toolbar. You may also have to have to increase the height if you have a lot of tags in order to avoid the scroll bar.
First determine what devices are available:
cdrecord -scanbuscdrecord -v dev=0,0,0 driveropts=burnproof -dao -eject DATAFILE.iso cdrecord to query the CD blank for its purported speed md5sum -b /dev/cdrom md5sum