<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 <title>Matt Di Pasquale</title>
 <link href="http://www.mattdipasquale.com/atom.xml" rel="self" />
 <link href="http://www.mattdipasquale.com/" />
 <updated>2012-02-18T15:38:47-08:00</updated>
 <id>http://www.mattdipasquale.com/</id>
 <author>
   <name>Matt Di Pasquale</name>
 </author>

 
 <entry>
   <title>How to Install or Update to Xcode 4.3</title>
   <link href="http://www.mattdipasquale.com/blog/2012/02/18/how-to-install-or-update-to-xcode-4.3" />
   <updated>2012-02-18T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2012/02/18/how-to-install-or-update-to-xcode-4.3</id>
   <content type="html"><p>Install or update <a href="https://developer.apple.com/xcode/">Xcode</a> from the <a href="http://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12">Mac App Store</a> before compiling programs on your Mac because Apple has recently updated compilers (from <a href="http://gcc.gnu.org/">GCC</a> to <a href="http://llvm.org/">LLVM</a>).</p>

<h3>Optional</h3>

<ul>
<li>If Xcode prompts you on first launch to trash older versions, I recommend doing so. (For me, Xcode trashed <code>/Developer/</code> but only <code>Xcode.app</code> in <code>/Xcodes/Xcode-4.3/</code>, where I had a custom, beta install, so I trashed <code>/Xcodes/Xcode-4.3/</code> manually.)</li>
<li>In Terminal, run <code>xcode-select -switch /Applications/Xcode.app</code> to update the path to the Xcode folder for Xcode BSD tools.</li>
<li>Install the <a href="https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html#//apple_ref/doc/uid/1006-SW2">Command-Line Tools</a> from the Components tab of the Downloads preferences panel.</li>
</ul>
</content>
 </entry>
 
 <entry>
   <title>How to Build a Website</title>
   <link href="http://www.mattdipasquale.com/blog/2011/07/02/how-to-build-a-website" />
   <updated>2011-07-02T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2011/07/02/how-to-build-a-website</id>
   <content type="html"><h2>Setup</h2>

<ol>
<li><p>Get a <a href="http://www.apple.com/mac/">Mac</a> with an Internet connection, and turn it on.</p>

<p>Experienced software engineers use Macs because they just work.</p></li>
<li><p>Install <a href="http://www.google.com/chrome/">Google Chrome</a>, and set it as the default browser.</p>

<p>It's fast and lets you inspect parts of a website by typing Command-Shift-C. (Although, I still prefer Firefox &amp; Firebug for intense web development.)</p></li>
<li><p>Install <a href="http://developer.apple.com/xcode/">Xcode</a>.</p></li>
<li><p>Open <a href="http://www.apple.com/macosx/apps/all.html#terminal">Terminal</a> (Press Command-Spacebar, start typing &quot;terminal,&quot; and hit enter once Terminal is highlighted.), enter the following commands, and follow any instructions that Terminal prints out.</p></li>
<li><p>Append some niceties to your <code>~/.bash_profile</code> file.</p>

<pre><code>curl -s https://raw.github.com/gist/380318/.bash_profile &gt;&gt; &quot;$HOME/bash_profile&quot;
</code></pre>

<p>Note: If you already have stuff in your <code>~/.bas_profile</code>, open it in a text editor to fix any conflicts.</p></li>
<li><p>Install <a href="http://mxcl.github.com/homebrew/">Homebrew</a>.</p>

<pre><code>ruby -e &quot;$(curl -fsSL https://raw.github.com/gist/323731)&quot;
</code></pre></li>
<li><p>Install <a href="http://git-scm.com/">Git</a>.</p>

<pre><code>brew install git
</code></pre></li>
<li><p>Install <a href="https://gist.github.com/419201">useful Git aliases &amp; configurations</a>.</p>

<pre><code>bash &lt;(curl -s https://raw.github.com/gist/419201/gitconfig.bash)
</code></pre></li>
<li><p>Install <a href="https://rvm.beginrescueend.com/">RVM</a>. Follow the instructions output by the command below:</p>

<pre><code>bash &lt; &lt;(curl -s https://rvm.beginrescueend.com/install/rvm)
</code></pre></li>
<li><p>Install the current stable version of <a href="http://www.ruby-lang.org/en/">Ruby</a>, according to <a href="http://www.ruby-lang.org/en/downloads/">Ruby Download</a>.</p>

<pre><code>rvm install 1.9.3-p0
</code></pre></li>
<li><p>Set your default <a href="http://beginrescueend.com/gemsets/">Gemset</a> to <code>global</code>.</p>

<pre><code>rvm --default use 1.9.2@global
</code></pre></li>
<li><p>Update <a href="http://rubygems.org/">Ruby Gems</a> and cleanup old versions of gems.</p>

<pre><code>gem update --system
gem update
gem cleanup
</code></pre></li>
<li><p>Install a web framework, like <a href="http://rubyonrails.org/">Rails</a>, <a href="http://www.sinatrarb.com/">Sinatra</a>, or <a href="http://jekyllrb.com/">Jekyll</a>, with which to build your website. Execute one of the following lines.</p>

<pre><code>gem install rails
gem install sinatra
gem install jekyll
</code></pre></li>
<li><p>Create a directory in which to store all your websites. I like to put them in <code>Projects</code>.</p>

<pre><code>cd                # Change directory to home.
mkdir Projects    # Make a directory named &quot;Projects.&quot;
cd Projects
</code></pre></li>
<li><p>Create your first website.</p>

<ul>
<li><p>Sinatra</p>

<pre><code>mkdir website # where &quot;website&quot; is the name of your website
cd website
</code></pre>

<p>Highlight &amp; copy (Command-C) the following code snippet:</p>

<pre><code>require &quot;sinatra&quot;

get &quot;/&quot; do
  &quot;Hello World!&quot;
end
</code></pre>

<p>Run the following command in Terminal to paste it into a new file called <code>app.rb</code>:</p>

<pre><code>pbpaste &gt; app.rb
</code></pre></li>
<li><p>Rails</p>

<pre><code>rails new website # where &quot;website&quot; is the name of your website
cd website
</code></pre></li>
</ul></li>
<li><p>Configure for RVM (optional), add all unignored files to the <a href="http://book.git-scm.com/1_the_git_index.html">Git index</a>, and make your first commit.</p>

<pre><code>echo rvm 1.9.2@website --create &gt; .rvmrc # if you want a separate gemset
echo .DS_Store &gt;&gt; .gitignore # Ignore `.DS_Store` files.
git add -A                   # Add all unignored files to the index.
git ci                       # Stage all changes to files tracked by Git, and commit.
</code></pre>

<p>To enter a commit message, type:</p>

<ol>
<li><code>i</code> to enter insert mode,</li>
<li>a commit message, like &quot;1st commit: rails new website,&quot;</li>
<li>Control-[ (or Esc) to go from insert mode back to normal mode,</li>
<li>Shift-ZZ to save &amp; quit vim.</li>
</ol></li>
<li><p>Install <a href="http://pow.cx/">Pow</a>, and use it to view the website in a browser as you build it.</p>

<pre><code>curl get.pow.cx | sh
cd ~/.pow
ln -s ~/Projects/website
</code></pre></li>
<li><p>View the website locally at http://website.dev/.</p></li>
<li><p>Follow <a href="http://guides.rubyonrails.org/getting_started.html">Rails Guides: Getting Started with Rails</a> to enhance &amp; customize the website.</p></li>
<li><p>When the website is complete, deploy it for free with <a href="http://www.heroku.com/">Heroku</a>, which is built on the <a href="http://aws.amazon.com/ec2/">Amazon EC2</a> cloud.</p></li>
</ol>

<h2>Other stuff...</h2>

<p>Ruby:</p>

<ul>
<li><a href="http://tryruby.org/">Try Ruby</a></li>
</ul>

<p>HTML5, CSS3, and Javascript:</p>

<ul>
<li><a href="http://www.sitepoint.com/books/htmlcss1/"><em>HTML5 &amp; CSS3 For The Real World</em></a></li>
<li><a href="http://www.codecademy.com/">Codecademy</a></li>
<li><a href="http://javascript.crockford.com/">Crockford on JavaScript</a></li>
<li><a href="http://www.jslint.com/">JSLint</a></li>
</ul>

<p>Use <a href="http://jquery.com/">jQuery</a>, <a href="http://www.json.org/js.html">JSON</a>, and <a href="http://api.jquery.com/jQuery.getJSON/">AJAX with JSON</a> to only load the parts of the page that change.</p>

<ul>
<li>Publish your source code on <a href="https://github.com/">GitHub</a>.</li>
</ul>
</content>
 </entry>
 
 <entry>
   <title>Rails Model-Safe Migrations</title>
   <link href="http://www.mattdipasquale.com/blog/2011/02/28/rails-model-safe-migrations" />
   <updated>2011-02-28T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2011/02/28/rails-model-safe-migrations</id>
   <content type="html"><p>Ever hear people complain about how <a href="http://lmgtfy.com/?q=rails+migrations+suck">Rails migrations suck</a>? Or, maybe you think so yourself?</p>

<p>Whatever the answer, recently, a couple fellow Rails colleagues informed me of a practice they follow to make Rails migrations sturdier.</p>

<p>They redefine (or mock), inside each migration, the models and the parts of those models being used in the migration so that the migration works independently of the application code. That way, if the application code is ever refactored (like if the name of the model being used in the migration is changed), the migration still works!</p>

<p>I thought this was a nice solution to make migrations stronger, but there was just one problem... It didn't use Git!</p>

<p>We can strengthen migrations with Git by creating a <code>rake db:commit</code> command to automatically assign commits to new migrations by tagging the commit with the migration's filename. Then, we can rewrite <code>rake db:migrate</code> to checkout the correct version of the codebase before running each migration.</p>

<p>The new <code>rake db:migrate</code> command would look something like this:</p>

<ul>
<li><p>Check if the Rails application is using Git. If not, execute <code>rake db:migrate</code> normally. Else, add the following modifications:</p></li>
<li><p>Before running each migration, checkout its assigned commit if it has one.</p>

<ul>
<li>Let <code>$MIGR</code> be the migration's filename.</li>
<li><p>If a Git tag exists with the filename of the migration to be run:</p>

<p>git tag | grep $MIGR # TODO: find better (lower-level) way</p></li>
<li><p>Then:</p></li>
<li><p>Initialize <code>$STASHED</code> to false.</p>

<p>export STASHED=false</p></li>
<li><p>In case the working directory is dirty, try to <code>git stash</code> (stores away changes since the last commit). Set <code>$STASHED</code> to true if changes were stashed.</p>

<p>[ <code>git stash | grep Saved</code> ] &amp;&amp; export STASHED=true</p></li>
<li><p>Checkout this migration's corresponding codebase.</p>

<p>git checkout $MIGRATION_FILENAME</p></li>
<li><p>Run the migration as usual now that we've checked out the corresponding codebase.</p>

<p>git checkout HEAD@{1} # checkout last tree, not quite right</p></li>
<li><p>If $STASHED is true, <code>git stash pop</code>.</p>

<p>[ $STASHED == true ] &amp;&amp; git stash pop</p></li>
<li><p>Else, a Git tag with the filename of this migration doesn't exist. So, assume it's a new migration and just do what <code>rake db:migrate</code> normally does.</p></li>
</ul></li>
</ul>

<p>The <code>rake db:commit</code> command would do exactly what our new <code>rake db:migrate</code> command does and add something like this at the end:</p>

<ul>
<li><p>After running a new migration successfully, create a new commit, tagged with the migration's filename.</p>

<p>git add -A # very aggressive but what if untracked files needed?
  git commit -m &quot;$MIGR&quot; # OK if nothing to commit
  git tag $MIGR -f # -f option overwrites tag if it already exists
  git push $REMOTENAME $MIGR # push tag to remote repo (use correct var)</p></li>
</ul>

<p>Perhaps we could write a Gem that does this. It would strengthen migrations without having to redefine our models inside them.</p>
</content>
 </entry>
 
 <entry>
   <title>Lovers Facebook Application for Valentine's Day</title>
   <link href="http://www.mattdipasquale.com/blog/2011/02/14/lovers-facebook-application-valentines-day" />
   <updated>2011-02-14T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2011/02/14/lovers-facebook-application-valentines-day</id>
   <content type="html"><p>Happy Valentine's Day!!</p>

<p>I built a new version of a nifty <a href="http://apps.facebook.com/mylovers/">Facebook application called Lovers</a> with some friends using Sinatra &amp; Redis.</p>

<p>We released it today. Check it out and send your friends some gifts!
I just sent one from my iPhone! (It works on the iPhone if you're patient with the friend selector.)</p>

<p>Also, check out the <a href="https://github.com/mattdipasquale/loversapp.com">Lovers Facebook app source code on GitHub</a>.</p>

<p>It's got a lot of cool stuff:</p>

<ul>
<li><p>a nice little custom Facebook plugin in vendor</p>

<p>This decodes <a href="http://developers.facebook.com/docs/authentication/signed_request/">Facebook's signed_request</a>, and it also encodes a user cookie, using the same encoding algorithm.</p></li>
<li><p>a custom friend selector for iframe canvas apps</p></li>
<li><p>a custom <a href="http://developers.facebook.com/docs/creditsapi/">Facebook Credits API</a> implementation</p></li>
<li><p>examples of Graph API calls via the <code>FB.api</code> JS SDK method</p></li>
</ul>

<p>And much more...</p>
</content>
 </entry>
 
 <entry>
   <title>Install & Configure ack on Mac</title>
   <link href="http://www.mattdipasquale.com/blog/2011/02/03/install-configure-ack-on-mac" />
   <updated>2011-02-03T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2011/02/03/install-configure-ack-on-mac</id>
   <content type="html"><h2>ack! I think I just pooped myself.</h2>

<p><a href="http://betterthangrep.com/">ack</a> is way sweeter than grep. It's much faster and easier to use.</p>

<h2>Install</h2>

<p>Simply download the <a href="http://betterthangrep.com/ack-standalone">standalone version of ack</a> to your path, and make the file executable:</p>

<pre><code>sudo curl http://betterthangrep.com/ack-standalone &gt; /usr/local/bin/ack &amp;&amp; chmod 0755 !#:3
</code></pre>

<h2>Usage</h2>

<p>Now, in Terminal, you can run <code>ack 'hello world'</code> (instead of <code>grep -r 'hello world' .</code>) to search all files for <code>hello world</code>.</p>

<h2>Configure</h2>

<p>As a good starting point, simply download <a href="https://github.com/r00k">r00k</a>'s <code>.ackrc</code> file:</p>

<pre><code>curl https://github.com/r00k/dotfiles/raw/master/ackrc &gt; ~/.ackrc
</code></pre>
</content>
 </entry>
 
 <entry>
   <title>How to Test/Check If a Value Is an Array in JavaScript</title>
   <link href="http://www.mattdipasquale.com/blog/2011/01/06/how-to-test-check-if-a-value-is-an-array-in-javascript" />
   <updated>2011-01-06T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2011/01/06/how-to-test-check-if-a-value-is-an-array-in-javascript</id>
   <content type="html"><p>Read about the <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray">JavaScript isArray() function</a>.</p>

<pre><code>Array.isArray = Array.isArray || function(o) { return Object.prototype.toString.call(o) === '[object Array]'; };
</code></pre>
</content>
 </entry>
 
 <entry>
   <title>How to Find Posts/Pages Using a Custom WordPress Template</title>
   <link href="http://www.mattdipasquale.com/blog/2011/01/06/how-to-find-posts-pages-using-custom-wordpress-template" />
   <updated>2011-01-06T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2011/01/06/how-to-find-posts-pages-using-custom-wordpress-template</id>
   <content type="html"><p>To find out which WordPress posts and/or pages are using a specific custom template, e.g., <code>template-file.php</code>, run the following MySQL query:</p>

<pre><code>SELECT * FROM `wp_postmeta` WHERE `meta_value`='template-filename.php';
</code></pre>
</content>
 </entry>
 
 <entry>
   <title>Fake Profile Pictures</title>
   <link href="http://www.mattdipasquale.com/blog/2010/12/31/fake-profile-pictures" />
   <updated>2010-12-31T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/12/31/fake-profile-pictures</id>
   <content type="html"><h2>Purpose</h2>

<p>While building &amp; testing <a href="http://www.acani.com/">acani</a>, an iPhonw app for meeting people nearby with similar interests, I used the <a href="https://github.com/EmmanuelOga/ffaker">Fast Faker (ffaker) Ruby Gem</a> to generate fake profile data. I also wanted to generate fake profile pictures, so I scraped a collection of hand-selected portraits from Flickr.</p>

<h2>License</h2>

<p>The code is open sourced under the <a href="https://github.com/acani/acani/blob/master/MIT-LICENSE">MIT License</a>.</p>

<p>All photos are licensed under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons - Attribution 2.0 Generic</a> or <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons - Attribution-ShareAlike 2.0 Generic</a> licenses. Thus, the photos may be used for commercial purposes as long as you obey the Attribution (attribute the work to the owner) and/or ShareAlike (only share the work under the same license) clauses.</p>

<h2>Usage</h2>

<p>Simply, access the photos from the GitHub directory that contains the <a href="https://github.com/acani/acani-sinatra/tree/master/seed/pics-thbs/">Fake Profile Pictures from Flickr</a>.</p>

<h2>How to Contribute New Pictures</h2>

<ol>
<li><p>Find <a href="http://www.flickr.com/search/?q=people+OR+person+OR+boy+OR+girl+OR+man+OR+woman+OR+persons+OR+friends+OR+face+OR+faces+OR+portrait+OR+headshot+OR+shot&l=commderiv&ss=0&ct=0&mt=all&w=all&adv=1">open-source portraits on Flickr</a>. Make sure the original is large enough to be reduced to 640x960px and still look good.</p></li>
<li><p>For each photo:</p>

<ol>
<li>Download the original &amp; open in Photoshop (or any application that can resize photos).</li>
<li>Select the Marquee Tool. Set the settings to a 3:2 ratio. Copy &amp; paste the desired portion of the image to a new canvas.</li>
<li>Resize the image to 640x960px &amp; 320x480px (bicubic sharper for reduction) and save for web (select Preset: JPEG High, then set to Maximum).</li>
</ol></li>
<li><p>Make thumbnails with the <a href="https://github.com/acani/acani-sinatra/blob/master/seed/resize-pics.rb">RMagick <code>resize-pics.rb</code> script</a>. Add the picture number to the <code>gravity</code> array if you want the thumbnail to be positioned above center. The <code>resize-pics.rb</code> script requires the <a href="http://rmagick.rubyforge.org/">RMagick Ruby Gem</a>, which depends upon <a href="http://www.imagemagick.org/">ImageMagick</a>.</p></li>
<li><p>Re-seed the MongoDB database and regenerate the <code>seed/pics-thbs/README.md</code> file with the <a href="https://github.com/acani/acani-sinatra/blob/master/seed/profiles.rb">MongoDB <code>profiles.rb</code> script</a>. If you just want to regenerate the <code>README.md</code> file, just comment out all the excess code. Otherwise, the execution of the <code>profiles.rb</code> script requires <a href="http://www.mongodb.org/">MongoDB</a> and the <a href="https://github.com/mongodb/mongo-ruby-driver">mongo Ruby Gem</a>.</p></li>
<li><p>Push your changes (or send me a pull request and make sure I merge in your changes). Then, send a message to the Flickr user with a link to <a href="https://github.com/acani/acani-sinatra/tree/master/seed/pics-thbs/">https://github.com/acani/acani-sinatra/tree/master/seed/pics-thbs/</a> to inform them of and thank them for the usage.</p></li>
</ol>

<h2>TODO</h2>

<p><em>I challenge you to take on implementing these enhancements. Think you can hack it?</em></p>

<ul>
<li>Extract the code into a separate gem repository. (Currently, it's part of <a href="https://github.com/acani/acani-sinatra">acani-sinatra</a>.)</li>
<li>Add more profile pictures, esp. to create some more ethnic diversity.</li>
</ul>
</content>
 </entry>
 
 <entry>
   <title>How to Get jQuery Working</title>
   <link href="http://www.mattdipasquale.com/blog/2010/12/29/how-to-get-jquery-working" />
   <updated>2010-12-29T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/12/29/how-to-get-jquery-working</id>
   <content type="html"><p>Put this in the <code>&lt;head&gt;</code> section your html file:</p>

<pre><code>&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js&quot;&gt;&lt;/script&gt;
</code></pre>

<p>That loads the file at this URL:</p>

<p><a href="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js">http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js</a></p>

<p>That file is a minified (condensed) version of the <a href="http://code.jquery.com/jquery-latest.js">jQuery JavaScript Library source code</a>, which uses JavaScript to define extra useful functions, such as $.</p>

<p>Check out this <a href="http://docs.jquery.com/Tutorials:How_jQuery_Works">jQuery tutorial</a>. Especially, look at the Complete Example.</p>

<p>I found the link to the jQuery source by replacing the release number (1.3) in the link from the example with the latest release number (1.4.4). Also, view the <a href="http://docs.jquery.com/Downloading_jQuery">jQuery Download</a> &amp; <a href="http://docs.jquery.com/Source_Code">jQuery Source Code</a> pages.</p>

<p>Check out the <a href="http://jquery.malsup.com/cycle/">jQuery Cycle Plugin</a> for rotating images, text, and other types of HTML content.</p>
</content>
 </entry>
 
 <entry>
   <title>Personal Growth Is Awesome!</title>
   <link href="http://www.mattdipasquale.com/blog/2010/12/23/personal-growth-is-awesome" />
   <updated>2010-12-23T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/12/23/personal-growth-is-awesome</id>
   <content type="html"><p>A friend recently asked me how personal growth stuff was going. I replied, &quot;Personal growth stuff is going Awesome!&quot;</p>

<p>I've become somewhat of a programmer... I worked on my personal site a bit... <a href="http://www.mattdipasquale.com/">http://www.mattdipasquale.com/</a>. Istill have improvements I want to make, mainly made it for marketing myself to new positions.</p>

<p>I got inspired by <em>Think &amp; Grow Rich</em>. Napoleon Hill writes about a true story of a mom who diligently put together a well-organized, nicely-bound, 50-page composition of all her son's accomplishments, talents, etc. And, when he presented it to employers, he was offered a position &amp; salary that most people would've had to put in 5+ years of experience to get. That's pretty cool. Hill tells it to demonstrate the importance of marketing yourself. He says, if you spend time on careful planning, you can save yourself a lot of time in the long-run. That inspired me to work on my personal website.</p>

<p>But, more than anything, the book is pure gold! You know <em>The Secret</em>? Well, ya know the book that the producer's daughter gives her in the beginning? I'm pretty sure that's <em>Think and Grow Rich</em> cause the preface of the book talks about how there's a Secret that's alluded to all throughout the book that will jump out at you if you're ready to receive it. It's mad cool.</p>

<p>I've know about <em>T&amp;GR</em> for a while, but this is what really convinced me of it's power. Check out this <a href="http://www.martialdevelopment.com/blog/think-grow-rich-or-die-trying-the-bruce-lee-story/">article on Bruce Lee's application of Think &amp; Grow Rich</a>.</p>

<p>Bruce Lee basically wrote down how his life went verbatim... before it even happened! The dude practically scripted his life as if it were a movie. Imagine that... I believe that's possible... That's why I'm doing the same. :) As Tony Robbins often says, &quot;Success leaves clues.&quot; This quote is the whole basis of the book <em>Think &amp; Grow Rich</em> as it is the most comprehensive study of successful people every conducted. Hill spent over 20 <em>years</em> interviewing extremely successful people and then compiled all of their advice into a masterpiece of a book, <em>Think &amp; Grow Rich</em>, a book praised as being responsible for the most self-made millionaires, and I'd argue billionaires &amp; soon to be trillionaires!</p>
</content>
 </entry>
 
 <entry>
   <title>Install WordPress on Mac with MAMP</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/29/install-wordpress-on-mac-with-mamp" />
   <updated>2010-11-29T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/29/install-wordpress-on-mac-with-mamp</id>
   <content type="html"><h3>Create WordPress Database &amp; Database User</h3>

<p>Note: Please substitute username &amp; password with your personal, secure values, and name the database something other than wordpress.</p>

<p>First, make sure MAMP is running.</p>

<h4>Via GUI (see &quot;Via Terminal&quot; below if you prefer)</h4>

<ol>
<li>Open MAMP. It should open your browser to <a href="http://localhost:8888">http://localhost:8888</a> automatically. If not, in the MAMP window, click &quot;Open start page,&quot; or just navigate your browser to <a href="http://localhost:8888">http://localhost:8888</a>.</li>
<li>Click phpMyAdmin at the top of the page.</li>
<li>Click Privileges at the top right.</li>
<li>Click &quot;Add new user.&quot; Enter the following:
<dl>
<dt>User name:</dt>
<dd>username</dd>
<dt>Host:</dt>
<dd>(select Local from dropdown)</dd>
<dt>Password:</dt>
<dd>password</dd>
<dt>Re-type:</dt>
<dd>(password from line above)</dd>
</dl></li>
<li>Under &quot;Database for user,&quot; select &quot;Create database with same name and grant all privileges.&quot;<br></li>
<li>Click &quot;Go&quot; at bottom right of page.</li>
<li>Done!</li>
</ol>

<h4>Via Terminal* (see &quot;Via GUI&quot; above if you prefer)</h4>

<pre><code>/Applications/MAMP/Library/bin/mysql -u root -proot -P 8889
CREATE DATABASE `wordpress`;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT USAGE ON * . * TO 'username'@'localhost' IDENTIFIED BY 'password' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
GRANT ALL PRIVILEGES ON `wordpress` . * TO 'username'@'localhost';
QUIT ;
</code></pre>

<h3>Get Code, Prepare Database, and Go!</h3>

<p>In Terminal, type each of the following lines, one at a time:</p>

<pre><code>cd ~/Projects # or wherever you store your projects
git clone git@github.com:you/example.com.git # git clone your project
cd example.com
/Applications/MAMP/Library/bin/mysql -u username -ppassword -P 8889 wordpress &lt; wordpress.bak.sql # load backup of db
/Applications/MAMP/Library/bin/mysql -u username -ppassword -P 8889 wordpress # start mysql command prompt
UPDATE `wordpress`.`wp_options` SET `option_value` = 'http://localhost:8888' WHERE `wp_options`.`option_name` = 'siteurl' OR `wp_options`.`option_name` = 'home' ;
</code></pre>

<p>Navigate to <a href="http://localhost:8888/wp-admin">http://localhost:8888/wp-admin</a> in the browser.</p>

<h3>Deploy</h3>

<p>See: <a href="http://stackoverflow.com/questions/4236161/git-github-and-web-server-deployment-configuration/4281789#4281789">http://stackoverflow.com/questions/4236161/git-github-and-web-server-deployment-configuration/4281789#4281789</a></p>
</content>
 </entry>
 
 <entry>
   <title>Install mysql/mysqlplus Ruby Gem on MAMP</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/29/install-mysql-mysqlplus-ruby-gem-on-mamp" />
   <updated>2010-11-29T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/29/install-mysql-mysqlplus-ruby-gem-on-mamp</id>
   <content type="html"><p>To install mysqlplus on my 32-bit MacBook, running Snow Leopard, I followed: <a href="http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html">http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html</a></p>

<p>However, I'm using MAMP 1.9.4 and couldn't find the source for 1.9.4 at <a href="http://sourceforge.net/projects/mamp/files/">http://sourceforge.net/projects/mamp/files/</a>. So, I did the following:</p>

<h3>Detect MySQL version MAMP is using</h3>

<p>After downloading &amp; installing MAMP, open Terminal, and run:</p>

<pre><code>/Applications/MAMP/Library/bin/mysql --version
</code></pre>

<p>Running MAMP 1.9.4, I got:</p>

<pre><code>/Applications/MAMP/Library/bin/mysql  Ver 14.14 Distrib 5.1.44, for apple-darwin8.11.1 (i386) using  EditLine wrapper
</code></pre>

<p>So, I downloaded the MySQL Database Server 5.1.44 source code (<a href="http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.44.tar.gz">http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.44.tar.gz</a>). You can find other sources at <a href="http://downloads.mysql.com/archives.php">http://downloads.mysql.com/archives.php</a> by clicking through to the correct version of the MySQL Database Server and scrolling down to the bottom of the page to &quot;Source and other files.&quot;</p>

<p>Then, follow the rest of the instructions here: <a href="http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html">http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html</a></p>

<p><em>Note</em>: For mysqlplus, simply replace mysql with mysqlplus in the final gem install command.</p>

<p>P.S. You might also want to close MAMP before copying the files to the MAMP dir. I forgot to, and it still worked fine... but just in case.</p>
</content>
 </entry>
 
 <entry>
   <title>Migrate from Drupal to Jekyll</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/27/migrate-from-drupal-to-jekyll" />
   <updated>2010-11-27T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/27/migrate-from-drupal-to-jekyll</id>
   <content type="html"><p>This morning, I played some football with friends from Staples High School. What fun!</p>

<p>I told a bunch of the guys that I'm going to fix up <a href="http://www.mattdipasquale.com/">my personal website</a> today. So, here I go. I'm renovating it and migrating it from <a href="http://drupal.org/">Drupal</a> to <a href="http://pages.github.com/">GitHub Pages</a>. One of the other big reasons for this move is that my hosting with [GoDaddy Economy Hosting][gd-hosting] is expiring. And, although GoDaddy offers really cheap hosting (I got three years for $80.) and does the job well enough, why choose GoDaddy when I can host my website on <a href="https://github.com/">GitHub</a> for free? Plus, being a <a href="http://www.ruby-lang.org/">Ruby</a> guy, I think I'll enjoy <a href="https://github.com/mojombo/jekyll">Jekyll</a> much more than Drupal.</p>

<p>So, here are the steps to complete this project:</p>

<ul>
<li>GitHub Pages: Get this post up on mattdipasquale.github.com

<ul>
<li>Copy &amp; modify <a href="https://github.com/mojombo/mojombo.github.com">mojombo's GitHub Pages repo</a>.</li>
<li>Create &amp; push to the [GitHub repo mattdipasquale.github.com][GitHub-me].</li>
</ul></li>
<li>Theme/style it up, add some photos, <a href="http://www.google.com/analytics/">Google Analytics</a> tracking code, <a href="http://disqus.com/">Disqus</a>, etc.</li>
<li>Write a script for Jekyll to migrate all my posts from Drupal to Jekyll.</li>
</ul>

<p>This is sort of a test post to get this migration started and to test things out.</p>

<p>Wish me the best!</p>
</content>
 </entry>
 
 <entry>
   <title>How to Create a Blank Background for a Screencast</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/25/how-to-create-a-blank-background-for-a-screencast" />
   <updated>2010-11-25T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/25/how-to-create-a-blank-background-for-a-screencast</id>
   <content type="html"><p>Note: This solution uses Firefox, but it should work in any other browser that supports View &gt; Full Screen.</p>

<p>Open Firefox to a new, blank tab (Navigate to about:blank to force a blank tab.). Press Shift+⌘+F, or go to View &gt; Full Screen. Voila! Now, ⌘+Tab to the application you'd like to record. This works well for capturing the iPhone Simulator on a white background. If you'd like a different background color than white, then use Firebug, or just create a simple text file with the line <code>&lt;html style=&quot;background-color:#35ef8d&quot;&gt;&lt;/html&gt;</code> (Change <code>#35ef8d</code> to any color you want.), save it as <code>background.html</code>, and open it with Firefox.</p>
</content>
 </entry>
 
 <entry>
   <title>How to Build an iPhone Photo Viewer App</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/25/how-to-build-an-iphone-photo-viewer-app" />
   <updated>2010-11-25T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/25/how-to-build-an-iphone-photo-viewer-app</id>
   <content type="html"><p>Just copy the one I built by modifying Apple's sample code: <a href="https://github.com/mattdipasquale/PicSciP">https://github.com/mattdipasquale/PicSciP</a></p>

<p>Duh!</p>
</content>
 </entry>
 
 <entry>
   <title>Script to Resize Images & Slice into Square Tiles</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/21/script-to-resize-images-and-slice-into-square-tiles" />
   <updated>2010-11-21T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/21/script-to-resize-images-and-slice-into-square-tiles</id>
   <content type="html"><h2>Inspiration</h2>

<p><a href="https://gist.github.com/708892">This Adobe Photoshop Script</a> (written in JavaScript) is handy for use with Core Animation's CATiledLayer as used in the Xcode sample project: Photo Scroller. It was inspired by <a href="http://iphonedevelopment.blogspot.com/2010/10/cutting-large-images-into-tiles-for.html">Cutting Large Images into Tiles for UIScrollView</a>. I tried out that program, but it only worked on a photo by photo basis and only 1 level at a time. I wanted something that could do multiple images at multiples levels. Thus, I tried using <a href="https://github.com/appsinyourpants/Pants-Framework/blob/master/Scripts/tile.rb">Paul Alexander's ImageMagick Ruby script (tile.rb) for tiling images</a>, but for some reason, my images came out better when I resized them with Photoshop than with ImageMagick, so I figured I'd rewrite Paul's script for Photoshop.</p>

<h2>Learning How to Write a Photoshop Script</h2>

<p>This is the first Photoshop script I've written, but I've had previous experience with JavaScript and the <a href="http://www.adobe.com/devnet/photoshop/scripting.html">Photoshop JavaScript Reference</a> has fairly good documentation. It's funny that I found it more useful than things I found online. Being a Ruby developer, I'm used to finding more goodies on the Internet. However, wherever the documentation did not have thorough examples, I just googled the property or method in question and was able to find sample scripts. For example, I googled historyStates undo and found this <a href="http://profile.iiita.ac.in/mukesh/photoshop7/PhotoshopCS2-Portable/Adobe_Photoshop_CS2/Scripting%20Guide/Sample%20Scripts/VBScript/HistoryState.vbs">script that uses Photoshop undo history</a>. You can also learn things by analyzing the interesting sample scripts that come with Photoshop and live in the directory that you install this script into (<strong>See the comments at the top of the script for install instructions.</strong>). Anyway, on with the fun!</p>

<h2>How It Works</h2>

<p>The script prompts you to select an input &amp; output folder. Then, for every .jpg file in the input folder, it:</p>

<ul>
<li>resizes it (default initial size: 1024x1536.)</li>
<li>slices square tiles (default size: 256x256) and saves them to the output folder</li>
<li>repeats the above two steps for the number of levels specified (default: 2)</li>
</ul>

<p>There are a few things you'll probably want to change in the script to fit your specs:</p>

<ul>
<li>Change inputFolder.getFiles(&quot;*.jpg&quot;) to inputFolder.getFiles() to run on all files in the input folder, not just .jpg files.</li>
<li>Change Tiler(1024, 1536). The format is Tiler(width, height, tileSize, levels) and all arguments should be integers.

<ul>
<li>width &amp; height are the dimensions (in pixels) that each image is initially resized to.</li>
<li>tileSize is the width/height (in pixels) of the tiles that will be sliced.</li>
<li>levels is the number of sizes for each image. A level of 3 will slice up the initial size, half of the initial size, and a quarter of the initial size.</li>
</ul></li>
</ul>

<h2>Discussion &amp; Conclusion</h2>

<p>I think that's it, but if I've missed anything, let me know. It's best to <a href="https://github.com/mattdipasquale" target="-blank">contact me through github</a>. The program is not very modular rather procedural but should be pretty easy to understand. It uses historyState to go back to the original image after cropping it and saving each time. I didn't see a way to use the Slice tool within the JavaScript API. If you know of ways to improve the script, please let me know. It worked for me on Photoshop CS4 on MacBook and was fast enough for what I was doing. It only took like a minute or two to run on 20 pictures. <a href="https://github.com/jlamarche/Tile-Cutter">Jeff LaMarche's Tile Cutter</a> is probably faster because I think he uses NSOperationQueue to run the processing for each row of the image on a separate thread. That means it processes all the rows at the same time (asynchronously or in parallel) whereas this script does one row at a time (synchronously or in series).</p>
</content>
 </entry>
 
 <entry>
   <title>Gails Nails</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/07/gails-nails" />
   <updated>2010-11-07T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/07/gails-nails</id>
   <content type="html"><p>I like gails that do their hails<br>
and paint their nails.<br>
And wear their sunglasses like vails.</p>

<p>I don't mind if they party &amp; drink ales,<br>
As long as they stay outta jails<br>
And keep that needle down on the scales.</p>

<p>But, they shouldn't look like they toss their lunch in pails,<br>
Or like their legs and arms have rails,<br>
Rather, like they've skied Vale and ridden Canondales.</p>

<p>She faithfully pursues her dreams and leaves trails.<br>
Often, she's busy sending texts &amp; emails.<br>
Any cab, she easily hails.</p>

<p>If she sold real-estate, she'd make titanic sales.<br>
She looks hot in a suit, or jeans &amp; pig-tails.<br>
She enjoys cooking me a great veggie soup with sweet potatoes, yams, and kales (not quale).</p>

<p>She's so gorgeous that she's rarely approached by maies,<br>
Except for the one whose courage prevails.<br>
Even if he often doubts himself and bails.<br>
That one success is worth all the &quot;fails.&quot;</p>

<p>P.S. Her name is Gale.<br>
No, actually, it's not, I just wanted to end with a rhyme.<br>
Aw, shit. I fucked it up.</p>
</content>
 </entry>
 
 <entry>
   <title>Rename Multiple Files in a Directory from Bash Terminal</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/06/rename-multiple-files-in-a-directory-from-bash-terminal" />
   <updated>2010-11-06T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/06/rename-multiple-files-in-a-directory-from-bash-terminal</id>
   <content type="html"><p>The following code replaces files named: <code>page_01.jpg</code>, <code>page_02.jpg</code> ... to <code>page_1.jpg</code>, <code>page_2.jpg</code></p>

<pre><code>for f in *; do mv $f ${f/page_0/page_}; done
</code></pre>
</content>
 </entry>
 
 <entry>
   <title>Gigapedia Is the New Napster (for Books)</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/06/gigapedia-is-the-new-napster-for-books" />
   <updated>2010-11-06T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/06/gigapedia-is-the-new-napster-for-books</id>
   <content type="html"><h3>What's Good?</h3>

<ul>
<li>Get a free PDF of any book off gigapedia.</li>
<li>All knowledge should be free.</li>
<li>Gigapedia is my new favorite site.</li>
<li>I found out about this through the grape-vines (from a Harvard peer).</li>
</ul>

<h3>Here's How:</h3>

<ul>
<li>Go to <a href="http://gigapedia.com">http://gigapedia.com</a></li>
<li>Sign up for an account. You must do this step and verify that you've received the email in order to sign in. Just use an email address you never check if you're worried about spam. Although, I haven't noticed any spam anyway but still good practice.</li>
<li>Sign in and search gigapedia for a book title. Click on the book title you want. Then click links. Click on one of the links. This will take you to rapidshare.com or some other file-sharing site. Choose the free option of downloading. After the timer counts down to zero, click download. Enjoy!</li>
</ul>

<p>Software is free. Music is free. Knowledge should be too. And now, thanks to gigapedia, it is.</p>

<h3>Is this bad news for publishing companies and authors?</h3>

<p>No, I don't think so. I rarely buy programming books anymore because so much info is free online. Gigapedia sometimes encourages me to buy books. It gives me a great way to start reading the book before I choose purchase it. So, in some ways, gigapedia might even be beneficial to authors. Also, I personally much prefer reading books in paper format. So, if the book's really good and/or if I really want to make sure I read it, I'll buy it and keep it around. Also, if I really like the book, sometimes, I'll buy it as a way of saying thanks to the author, etc. That's the way businesses should work, like a farmer plants seeds. A farmer plants seeds knowing that he'll reep benefits even though not every seed will grow.</p>

<p>You can give back by helping to make knowledge free and sharing your ebooks on gigapedia. Just click the &quot;create&quot; button and follow the instructions.</p>

<p>You can thank me by sending donations via PayPal. My PayPal email is liveloveprosper at gmail. Haha.</p>

<p>P.S. I love you, gigapedia!!!</p>
</content>
 </entry>
 
 <entry>
   <title>How to Add Multiple UIBarButtonItems to UINavigationBar</title>
   <link href="http://www.mattdipasquale.com/blog/2010/11/02/how-to-add-multiple-uibarbuttonitems-to-uinavigationbar" />
   <updated>2010-11-02T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/11/02/how-to-add-multiple-uibarbuttonitems-to-uinavigationbar</id>
   <content type="html"><p>Create a toolBar, add buttons to it, use it to initialize a UIBarButtonItem, which you then set as the navigationItem's rightBarButton item. You can set <code>barStyle = -1</code> instead of subclassing <code>UIToolbar</code>.</p>

<pre><code>UIToolbar *tools = [[UIToolbar alloc]
                    initWithFrame:CGRectMake(0.0f, 0.0f, 103.0f, 44.01f)]; // 44.01 shifts it up 1px for some reason
tools.clearsContextBeforeDrawing = NO;
tools.clipsToBounds = NO;
tools.tintColor = [UIColor colorWithWhite:0.305f alpha:0.0f]; // closest I could get by eye to black, translucent style.
                                                              // anyone know how to get it perfect?
tools.barStyle = -1; // clear background
NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:3];

// Create a standard refresh button.
UIBarButtonItem *bi = [[UIBarButtonItem alloc]
    initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)];
[buttons addObject:bi];
[bi release];

// Create a spacer.
bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
bi.width = 12.0f;
[buttons addObject:bi];
[bi release];

// Add profile button.
bi = [[UIBarButtonItem alloc] initWithTitle:@&quot;Profile&quot; style:UIBarButtonItemStylePlain target:self action:@selector(goToProfile)];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];

// Add buttons to toolbar and toolbar to nav bar.
[tools setItems:buttons animated:NO];
[buttons release];
UIBarButtonItem *twoButtons = [[UIBarButtonItem alloc] initWithCustomView:tools];
[tools release];
self.navigationItem.rightBarButtonItem = twoButtons;
[twoButtons release];
</code></pre>
</content>
 </entry>
 
 <entry>
   <title>How I Use GitHiub</title>
   <link href="http://www.mattdipasquale.com/blog/2010/10/29/how-i-use-githiub" />
   <updated>2010-10-29T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/10/29/how-i-use-githiub</id>
   <content type="html"><p>&quot;What is <a href="http://github.com/">GitHub</a>?&quot; you ask?</p>

<p>&quot;Obviously, you're not a golfer...&quot; - The Big Lebowski</p>

<p>Seriously though. It's probably the sweetest website since Google. It's a way for programmers to open-source/share/collaborate on their code.</p>

<p>Anyway, I use it to search the codebase of a project at work because there's over 4 million lines of code and TextMate takes forever to search it. But GitHub must index the code or something. Cause it searches it so fast! and it even allows regex search.</p>

<p>Try it! It's awesome!</p>

<p>Enjoy!</p>
</content>
 </entry>
 
 <entry>
   <title>How to Build Web Apps...</title>
   <link href="http://www.mattdipasquale.com/blog/2010/10/28/how-to-build-web-apps" />
   <updated>2010-10-28T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/10/28/how-to-build-web-apps</id>
   <content type="html"><p>Sorry Facebook... PHP is dead. But, that's okay, because I would recommend Ruby anyway... much cooler IMHO. I've coded extensively with both.</p>

<p>Actually, if you really want to know the way to go... It's HTML5 + CSS3 + JavaScript. And then Node.js with Express.js for a very light-weight server that just serves data. And MongoDB and/or Redis for persistent storage. The application &amp; business logic (and in many cases, storage, esp. now with HTML5) should go mostly in client-side JavaScript as much as possible. This will help the app scale by taking load off the server.</p>

<p>So, JavaScript is really the language to learn. I recommend <em>JavaScript the Good Parts</em> for object-oriented JS. Helpful frameworks are jQuery, and I'm also checking out backbone.js. looks cool.</p>

<p>There really aren't many books on Node.js yet, but there's a lot on the web about it.</p>
</content>
 </entry>
 
 <entry>
   <title>Getting Started with Ruby on Rails</title>
   <link href="http://www.mattdipasquale.com/blog/2010/10/15/getting-started-with-ruby-on-rails" />
   <updated>2010-10-15T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/10/15/getting-started-with-ruby-on-rails</id>
   <content type="html"><p>For source control management (SCM), go with Git. The <a href="http://book.git-scm.com/">Git SCM Book</a> is a great resource for learning how to use Git. Start by reading that. GitHub is sweet too. Check it out. Many Japanese Rubyists use Windows, but almost all Americans use Macs. I come from PC and definitely prefer Mac for web development. I mainly love *nix operating systems vs. Windows.</p>

<p>Besides Ruby on Rails, I also recommend checking out:</p>

<ul>
<li>Node.js w/ Express &amp; EJS (very fast, cutting edge)</li>
<li>Scala &amp; Lift, which Twitter &amp; Foursquare use. (Possibly, the new Rails? Based on Java)</li>
<li>MongoDB &amp; Redis (two great persistent data stores)</li>
</ul>

<p><em>Agile Web Development with Ruby on Rails</em> is a good book. You can also learn a lot from stuff online:</p>

<p>If you have a Mac, start by registering for a free Apple developer account &amp; downloading and installing XCode: <a href="http://developer.apple.com/technologies/xcode.html">http://developer.apple.com/technologies/xcode.html</a> Then, you can install Git. You should have Ruby installed on Mac. Just type which ruby or ruby -v in the Terminal to see.</p>

<p>Otherwise (or if you want a newer version of Ruby), I recommend installing Ruby with <a href="http://rvm.beginrescueend.com/">RVM</a>. It's really cool. You can also use it to install different versions of Ruby if necessary.</p>

<p>To learn ruby: <a href="http://tryruby.org/">http://tryruby.org/</a> You can do something similar once you have Ruby installed. Open up Terminal and type <code>irb</code>.</p>

<p>To learn rails:</p>

<ul>
<li><a href="http://edgeguides.rubyonrails.org/getting_started.html">http://edgeguides.rubyonrails.org/getting_started.html</a><br></li>
<li><a href="http://www.railscasts.com/">http://www.railscasts.com/</a></li>
</ul>

<p>And if you're installing on Windows: <a href="http://rhnh.net/2010/10/10/rails-3-ruby-1-9-2-windows-2008-and-sql-server-2008-tutorial">http://rhnh.net/2010/10/10/rails-3-ruby-1-9-2-windows-2008-and-sql-server-2008-tutorial</a></p>

<p>Found that from: <a href="http://ruby5.envylabs.com/episodes/121-episode-119-october-12-2010">http://ruby5.envylabs.com/episodes/121-episode-119-october-12-2010</a> (A great site to keep up to date with all the awesome stuff coming out.)</p>
</content>
 </entry>
 
 <entry>
   <title>How to Delete Comment Spam in Drupal 6</title>
   <link href="http://www.mattdipasquale.com/blog/2010/09/06/how-to-delete-comment-spam-in-drupal-6" />
   <updated>2010-09-06T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/09/06/how-to-delete-comment-spam-in-drupal-6</id>
   <content type="html"><p>I examined the documentation. Here is the important function:</p>

<p>http://api.drupal.org/api/function/<em>comment</em>delete_thread/6</p>

<p>The other things, like updating the comment stats &amp; clearing the cache, are not important to run, IMHO, because they will most likely eventually get called in normal use anyway.</p>

<p>Also, if some of the comments you want to keep have parent comments, make sure you keep all the parent comments all the way to the root comment of the thread.</p>

<p>Run the following MySQL query:</p>

<p><code>DELETE FROM comments WHERE cid NOT IN (1,2,3,41826);</code> where 1,2,3,... are the ids of comments that you do not want to delete. This worked since I had very few real comments.</p>

<p>To determine the cids of real comments and their pids (parent ids), do:</p>

<p><code>SELECT cid, pid, subject, comment FROM comments;</code></p>

<p>If there are pids that are greater than 0, you'll have to investigate to find out if that pid has a pid &gt; 0 and so on all the way up the chain. Keep all the parents.</p>

<p>HTH!</p>
</content>
 </entry>
 
 <entry>
   <title>Handy MySQL Query to Find All Unique/Different Values of a Column</title>
   <link href="http://www.mattdipasquale.com/blog/2010/08/02/handy-mysql-query-to-find-all-unique-different-values-of-a-column" />
   <updated>2010-08-02T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/08/02/handy-mysql-query-to-find-all-unique-different-values-of-a-column</id>
   <content type="html"><pre><code>select col_name, count(col_name) from table_references group by col_name;
</code></pre>
</content>
 </entry>
 
 <entry>
   <title>How to add HTML to a JavaScript alert box</title>
   <link href="http://www.mattdipasquale.com/blog/2010/07/24/how-to-add-html-to-a-javascript-alert-box" />
   <updated>2010-07-24T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/07/24/how-to-add-html-to-a-javascript-alert-box</id>
   <content type="html"><p>Okay, well, it's not really HTML,</p>

<p>Just add <code>\n</code> wherever you want a newline/line-break (<code>&lt;br&gt;</code>). So, put two (<code>\n\n</code>) for two newlines, like a paragraph. You can also use <code>\t</code> for a tab character. You could even just make an actual return or tab within the JavaScript string. View the source that creates the button below:</p>

<p><script>
  function show<em>alert() {
    alert(&quot;Hello! I am an alert box!\n\nWith more than one paragraph. To make \
this alert box, read the tutorial from whence it came. You can also \
right-click to inspect elements on the page or to view the source of this \
page and reverse engineer it. Or, get Firefox and Firebug. It's \
sweet.\n\n\tHere's a tab-indented paragarph.\n\n    Here's a paragraph \
indented with 4 spaces.&quot;);
  }
</script>
&lt;input type=&quot;button&quot; onclick=&quot;show</em>alert()&quot; value=&quot;Show alert box&quot;&gt;</p>

<p>Check out this <a href="http://www.htmlgoodies.com/beyond/javascript/article.php/3470891/Web-Developer-Tutorial-Escape-Characters.htm">tutorial on escaping characters in a JavaScript alert</a>.</p>

<p>To try an example:</p>

<ol>
<li><p>Go to <a href="http://www.w3schools.com/JS/tryit.asp?filename=tryjs_alert">w3schools' try-it=yourself=editor for the JavaScript alert() function</a>.</p></li>
<li><p>Then, copy and paste this code into the textarea:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
  function show_alert() {
    alert(&quot;Hello! I am an alert box!\n\nWith more than one paragraph. To make \
this alert box, read the tutorial from whence it came. You can also \
right-click to inspect elements on the page or to view the source of this \
page and reverse engineer it. Or, get Firefox and Firebug. It's \
sweet.\n\n\tHere's a tab-indented paragarph.\n\n    Here's a paragraph \
indented with 4 spaces.&quot;);
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;input type=&quot;button&quot; onclick=&quot;show_alert()&quot; value=&quot;Show alert box&quot;&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre></li>
<li><p>Then, click the &quot;Edit and Click Me &gt;&gt;&quot; button at the top. After the page loads with the new html that you pasted, click the &quot;Show alert box&quot; button on the right.</p></li>
</ol>

<p>Does it have newlines &amp; tabs?</p>

<hr>

<p>The better way to add HTML to your JavaScript alert box is... Well, I think you could just do it mainly with CSS.</p>

<p>Check out <a href="http://www.match.com/search/searchSubmit.aspx?lid=107&r2s=1&cpp=cppp/floatingreg/test/43321.html&q=woman,men,25,35&st=quicksearch&pn=1&rn=4&do=2">how Match.com does an alert box</a>.</p>

<p>Right-clicking and selecting &quot;Inspect Element&quot; in Google Chrome (and using Firefox's plugin Firebug), I gathered some ideas in how to do this.</p>

<ul>
<li>Make a container div that covers the whole page, and give it the CSS <code>{ background-color:black; opacity: 0.3; display: none }</code>.</li>
<li>Make a div centered inside your container div for your alert message.</li>
<li>Use JavaScript or jQuery to change the display:none to display:block</li>
</ul>
</content>
 </entry>
 
 <entry>
   <title>WriteRoom: The Matrix of Word Processors</title>
   <link href="http://www.mattdipasquale.com/blog/2010/06/26/writeroom-the-matrix-of-word-processors" />
   <updated>2010-06-26T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/06/26/writeroom-the-matrix-of-word-processors</id>
   <content type="html"><p>Here is my first experience with <a href="http://www.hogbaysoftware.com/products/writeroom">WriteRoom</a>:</p>

<p>Wow... This is freaking sweet... haha... cool... i like this... I can make this my journal.. I wonder who this guy is who makes this software. It's pretty cool. Simple design is the way to go. I wonder what happens if you scroll? Anything cool? Is there a scroll bar? Hmmm... I'm making this very messy. I like the default of check spelling as you type. Green on black is sooooooo money. who thought of that? The matrix of word processors.</p>

<p>I'm already a lover of <a href="http://www.hogbaysoftware.com/products/taskpaper">TaskPaper</a>, which I highly recommend also.</p>

<p>P.S. There is no scroll bar. You just use the scroll on your mouse or the up &amp; down arrow keys.</p>
</content>
 </entry>
 
 <entry>
   <title>Matt V. Git: Inspired by JW</title>
   <link href="http://www.mattdipasquale.com/blog/2010/06/16/matt-v-git-inspired-by-jw" />
   <updated>2010-06-16T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/06/16/matt-v-git-inspired-by-jw</id>
   <content type="html"><p>Note: apparently this is solved by:</p>

<pre><code>git config --global alias.up 'pull --rebase'
</code></pre>

<p>Thanks goes to wereHamster and others on chat.freenode.irc #git</p>

<hr>

<p>In this Supreme Court Case, I, Matt Di Pasquale, challenge Git.</p>

<p>I do not think that Git should record a merge commit if the merge completes automatically, w/o conflicts. Understand?</p>

<p>Is there a reason it does this?</p>

<p>Any challenges?</p>

<p>Matt</p>

<p>P.S. To get around this, I <code>git stash; git pull; git stash pop; git commit</code>.</p>

<p>P.P.S. Now, I know it's easier to just do <code>git pull --rebase</code>.</p>
</content>
 </entry>
 
 <entry>
   <title>Instructions: How to Install Git from Source on Mac OS X 10.6 (Snow Leopard) Intel x86 (32 or 64 bit) or </title>
   <link href="http://www.mattdipasquale.com/blog/2010/05/30/instructions-how-to-install-git-from-source-on-mac-os-x-10-6-snow-leopard-intel-x86-32-bit" />
   <updated>2010-05-30T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/05/30/instructions-how-to-install-git-from-source-on-mac-os-x-10-6-snow-leopard-intel-x86-32-bit</id>
   <content type="html"><p>UPDATE: Install Homebrew and run <code>brew install git</code> instead of this script. Trust me. It's the best. It has a strict policy of only installing files into one directory (<code>/usr/local</code> by default). You could just uninstall everything by doing <code>rm -rf /usr/local</code>. There are many other great things. It just works!</p>

<p>Anyway, this used to be the best way to install Git on your Mac OS X 10.6 (Snow Leopard) Intel x86 (32 or 64 bit).</p>

<script src="https://gist.github.com/419201.js?file=git-install.bash"></script>

<p>And a sample <code>~/.gitconfig</code> file:</p>

<script src="https://gist.github.com/419201.js?file=.gitconfig"></script>

<p>And my <code>~/.gitignore</code> file:</p>

<script src="https://gist.github.com/419201.js?file=.gitignore"></script>

<p>Enjoy!</p>
</content>
 </entry>
 
 <entry>
   <title>When a Fuse Has Blown, It Is Not Sufficient Merely to Replace It with a New One.</title>
   <link href="http://www.mattdipasquale.com/blog/2010/05/29/when-a-fuse-has-blown-it-is-not-sufficient-merely-to-replace-it-with-a-new-one" />
   <updated>2010-05-29T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/05/29/when-a-fuse-has-blown-it-is-not-sufficient-merely-to-replace-it-with-a-new-one</id>
   <content type="html"><p>Here is one of my A papers that I wrote as a Sophomore at Staples High School. I left it unchanged. Since writing it, however, I've learned a lot more about heart disease: <a href="http://www.youtube.com/watch?v=YNeWCvLZaFM">How it kills (excerpt)</a> and how to prevent and even <a href="http://video.google.com/videoplay?docid=-5215695644951404318#">cure it (full)</a>. I highly recommend Dr. Caldwell B. Esselstyn. He is one of the masters of nutrition &amp; heart disease: <a href="http://www.heartattackproof.com/">http://www.heartattackproof.com/</a></p>

<p>I also highly recommend <a href="http://www.thechinastudy.com/"><em>The China Study</em></a> as one of the bests books on nutrition, especially for curing and preventing America's three leading killers: cancer, heart disease, and diabetes; as well as obesity, macular degeneration, MS, strokes, Alzheimer's, osteoporosis, and many more.</p>

<p>Here's the paper. I may have left out some of the formatting in copying it over. (TODO: add formatting)</p>

<hr>

<p>Matthew Di Pasquale<br>
Mrs. Richardson<br>
English 2A-4<br>
November 13, 2000  </p>

<h3>#13. POEM</h3>

<div style="text-align:center">
  When a fuse<br>
  Has blown,<br>
  It is not sufficient<br>
  Merely<br>
  To replace<br>
  It<br>
  With a new<br>
  One.
</div>

<p>In the poem above, the writer presents to us a situation, a blown fuse, and then tells us what is not a sufficient course of action to take. What, then, would be “sufficient,” if not a replacement, when a fuse has blown? The word “sufficient” suggests a meeting of a need: by using that word, the author implies that some need is still unfulfilled if the blown fuse is only replaced. What, then, is the need, or problem, that another fuse would not be able to solve? First, I analyze the poem on a literal level, to elucidate its implications. Then, I show that these implications are valid not only on a literal level, to fuses, but also figuratively, to problems in everyday life.</p>

<p>A fuse is a part of an electrical circuit that melts and breaks the circuit if the electrical current becomes dangerously strong. Since a dangerously strong current causes a fuse to blow, to just replace a blown fuse with a new one is not sufficient to fix the broken circuit. One must also reduce the strength of the current to allow it to pass through the new fuse without melting it. Otherwise, the current will blow the new fuse, which will again break the circuit. Therefore, only replacing a blown fuse with a new one will not solve the problem that the circuit had to begin with, too strong of a current. The message the author is conveying is that if a blown fuse breaks a circuit, then to fix the circuit, one must not only replace the blown fuse but also eliminate the causes of the blown fuse.</p>

<p>My father’s atherosclerosis was a problem in life that reflects the metaphoric meaning of the poem. He died on July 28, 1994 of a heart attack caused by atherosclerosis, the thickening and hardening of the arteries. Just as a fuse blows when the current is too strong, my father’s heart stopped when the amount of oxygen to his heart was too low. Since a dangerously low amount of oxygen going to his heart caused it to stop, to have replaced his stopped heart with a new one would not have been sufficient to keep him alive. The doctors would have also had to increase the amount of oxygen going to his heart by eliminating his atherosclerosis, allowing his heart to keep pumping. Unfortunately, the doctors were unable to increase the amount of oxygen entering my dad’s heart, and he died. My father’s heart was like the fuse in this poem; to simply replace it would not have been sufficient.</p>

<p>By looking closely at the literal meaning of this poem, I was able to determine its implicit meaning. The poem is not only accurate in terms of fuses, however, but also in general. Just as one should lower the circuit’s current when a fuse blows, one should eliminate the cause of a problem, not a symptom.</p>

<hr>

<p>With what I now know about heart disease, I propose a revised analogy:</p>

<p>To understand this new explanation, please watch how a heart attack happens (See the link to the video at the top of this article.). Atherosclerosis is when plaque deposits build up underneath the endothelium (a thin layer of cells that line the inside of the arteries). When the endothelium ruptures, the released plaque acts as a clotting factor. Immediately, heart muscle down-stream is deprived of blood and begins to die. The clot is like the blown fuse. And similarly, merely putting a stint inside the artery or replacing the artery with a bypass (as is done in the popular bypass surgery) is insufficient. The problem is actually the heightened acidity level of the blood. To protect the arteries from this acidic blood, plaque builds up underneath the endothelium. And poor eating habits, such as the typical American diet, cause acidic blood. Other lifestyle factors, such as stress &amp; sleep deprivation increase blood acidity. Read <a href="http://www.phmiracleliving.com/"><em>The PH Miracle</em></a>.</p>

<p>So, the main problem &amp; solution (factor) is nutrition. Eat healthy; live healthy. Sleep is also very important. Sleep consistently at sundown &amp; rise at sunup. Circadian rhythm and REM sleep.</p>
<blockquote>
<p>&quot;Early to bed and early to rise, makes a man healthy, wealthy, and wise.&quot; - Ben Franklin</p>

<p>&quot;Nature to be commanded must be obeyed.&quot; - Francis Bacon</p>
</blockquote></content>
 </entry>
 
 <entry>
   <title>Natural Vision Improvement</title>
   <link href="http://www.mattdipasquale.com/blog/2010/05/29/natural-vision-improvement" />
   <updated>2010-05-29T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/05/29/natural-vision-improvement</id>
   <content type="html"><h3>My Experiences with Myopia</h3>

<p>Note: Although I speak mainly about myopia, other forms of blurry vision, like hyperopia &amp; presbyopia, and conditions, like amblyopia or strabismus, can be improved &amp; healed naturally.</p>

<p>I remember wearing glasses for myopia ever since 4th grade. Unfortunately, I wasn't taught that merely wearing glasses is rather like <a href="/blog/2010/05/29/when-a-fuse-has-blown-it-is-not-sufficient-merely-to-replace-it-with-a-new-one/">merely replacing a blown fuse with a new one</a>, same with laser eye surgery, or Lasiks. Depending on any kind of corrective lenses or laser surgery is like putting frosting on a mud cake, as they say at <a href="http://www.landmarkeducation.com/">Landmark Education</a>. Like most traditional western medicine, corrective lenses &amp; Lasiks treat the symptoms but not the underlying causes of disease.</p>

<p>I have <strong>myopia</strong> (near-sightedness). Myopia is a disease in the same way that obesity is. Poor eating habits lead to obesity; poor vision habits lead to nearsightedness. Unfortunately, society's typical lifestyle is sedentary and consists of lots of near-point stress on the eyes (reading &amp; computer user... Ever wonder why the typical nerd has thick glasses?), <a href="http://www.youtube.com/watch?v=G96Sztb8Ctk">eating food that isn't really food</a>, and poor sleeping habits (Before the light bulb was invented, the average amount of sleep was 10 hours/day; now, it's 7 with more circadian rhythm disruption.)... all things lead to both obesity &amp; blurred vision. Like most prominent diseases, both of these diseases have very little to do with genetics and much to do with nutrition, lifestyle, and environment. If you learn solely from the popular media &amp; traditional education, that last sentence may have just challenged your beliefs. (Do you get defensive if your beliefs are challenged?) Read <a href="http://thechinastudy.com">The China Study</a> if you don't believe me.</p>

<p>I first stumbled upon the possibility of improving my vision after watch <em>The Secret</em> for like the seventh time. It finally hit me when the Reverend was saying, &quot;I've see cancer cured... I've seen vision improve, and come back...&quot; I was like, &quot;What??? No way.&quot; I ran upstairs to my computer and went straight to Google. I got tons of hits and immediately transformed into a sponge. Minutes later, I ordered a book off Amazon.</p>

<h3>Why improve your eye-sight?</h3>

<ul>
<li>Joe Blogs' answer: Do it for your sanity. Ever try looking for your glasses when you're actually wearing them?</li>
<li>Do it for you health, esp. your eye health, and to prevent eye diseases that could lead to blindness. Blurred vision is a sign of unhealthy eyes and, in most cases, mind &amp; body. Myopes are more likely to experience floaters, dry/red/tired eyes, headaches, eye pain, etc. More importantly, myopes are also more likely to develop eye diseases such as retinal detachment, glaucoma, cataracts, etc. that could lead to blindness. Macular degeneration can be prevented with a high-nutrient, plant-based diet (Basically, the antioxidants in plants protect your macula from the free radicals caused by sun rays. This is explained by T. Colin Campbell in <em>The China Study</em>.).</li>
<li>Do it for better vision. You can see better with healthy eyes than with unhealthy eyes corrected to 20/20 acuity with corrective lenses or Lasiks. There is more to vision than just acuity (an eye's ability to focus near &amp; far). For example, healthy eyes have better contrast &amp; 3D perception than myopic eyes. Healthy eyes can also move faster, facilitating such things as faster reading and better hand-eye coordination for sports.</li>
<li>Do it for your appearance. People with myopia tend to have rings under their eyes because they are constantly straining to see. Also sleep deprivation gives the rings under the eyes and is another cause of myopia. Lazy eye can also be corrected naturally. The whites of healthy eyes are clearer. Whereas, the whites of unhealthy eyes tend to have more visible blood vessels.</li>
<li>Can you think of any other reasons? Add them below as comments.</li>
</ul>

<h3>Start with Prevention</h3>
<blockquote>
<p>&quot;Nature, to be commanded, must be obeyed.&quot; - Francis Bacon</p>
</blockquote>
<ul>
<li>Obey the 10-10-10 rule. If you're engaging in near-point activities, like reading or using the computer, every 10 minutes, bring into focus, for at least 10 seconds, a specific point that is at least 10 feet away.</li>
<li>William Bates, however, argues that with the correct visual habits, we can use our eyes at the near-point for extended periods w/o straining our eyes. Ever wonder how some people can do this? I highly recommend <a href="http://www.i-see.org/perfect_sight/chap24.html">William Bate's Home Treatment</a>. Here is the <a href="http://www.central-fixation.com/bates-medical-articles/myopia-prevention-teachers.php">evidence that William Bate's Home Treatment works to prevent &amp; even reverse myopia</a>. Here are some <a href="http://www.i-see.org/eyecharts.html">Snellen eye charts</a> you could print out and use.<br></li>
<li>Do not get glasses or laser surgery (Lasiks). They will make your eyes &amp; uncorrected vision worse. &quot;It is fortunate that many people for whom glasses have been prescribed refuse to wear them, thus escaping not only much discomfort but also much injury to their eyes.&quot; - Perfect Eyesight Without Glasses</li>
</ul>

<h3>References</h3>

<ul>
<li><a href="http://www.i-see.org/">http://www.i-see.org/</a> - This site is a great reference. I recommend joining their mailing list for at least a week or so. You'll learn a lot. Also, check out William Bates' book <em>Perfect Sight Without Glasses</em>: http://www.i-see.org/perfect_sight/.</li>
<li><a href="http://www.emofree.com/cases/visionfrontier.htm">http://www.emofree.com/cases/visionfrontier.htm</a> - Improve your vision with Emotional Freedom Technique (EFT)</li>
<li><a href="http://en.wikipedia.org/wiki/Myopia">http://en.wikipedia.org/wiki/Myopia</a></li>
</ul>
</content>
 </entry>
 
 <entry>
   <title>How to Prevent Osteoporosis?</title>
   <link href="http://www.mattdipasquale.com/blog/2010/05/09/how-to-prevent-osteoporosis" />
   <updated>2010-05-09T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2010/05/09/how-to-prevent-osteoporosis</id>
   <content type="html"><p>Read Chapter 10 of <a href="http://thechinastudy.com"><em>The China Study</em></a>. It starts on page 203.</p>

<p>The meat (actually, more like the sweet potatoes) of it =&gt; a research study on hip fractures done at Yale:</p>
<blockquote>
<p>&quot;It found that a very impressive 70% of the fracture rate was attributable to the consumption of animal protein. These researchers explained that animal protein, unlike plant protein, increases the acid load in the body. An increased acid load means that our blood and tissues become more acidic. The body does not like this acidic environment and begins to fight it. In order to neutralize the acid, the body uses calcium, which acts as a very effective base. This calcium, however, must come from somewhere. It ends up being pulled from the bones, and the calcium loss weakens them, putting them at greater risk for fracture&quot; (The China Study - p. 205)</p>
</blockquote>
<p>Coffee also increases the acidity of the body. Ironically, lemon and other citrus fruits decrease the acidity of the body because they &quot;burn&quot; alkaline (while being digested). Further reading: <a href="http://www.phmiracleliving.com/">The PH Miracle</a></p>

<p>Also, skim milk has a higher density of casein (animal protein) than whole milk. (I'll let you reason why that is.) So, it's arguably worse for you! &quot;But I thought milk does a body good?&quot; Yep, the milk industry tricked you! :) What do you think would happen to the milk industry if everyone knew that milk is the most carcinogenic substance that humans consume?</p>

<p>So, next time the barista at Starbucks asks you if you'd like room for milk in your coffee, tell him: &quot;Did I say coffee? I meant herbal tea, no milk. Thanks!&quot; ... unless, of course, you enjoy peeing out your bones.</p>
</content>
 </entry>
 
 <entry>
   <title>bash foreach File in Directory</title>
   <link href="http://www.mattdipasquale.com/blog/2009/12/16/bash-foreach-file-in-directory" />
   <updated>2009-12-16T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/12/16/bash-foreach-file-in-directory</id>
   <content type="html"><h2>How to Iterate over All Files in a Directory</h2>

<p>This works on my MacBook, running Mac OSX Snow Leopard (10.6). Unix.</p>

<p>To list all files in your Documents folder, for example, enter in Terminal (Mac's command-line):</p>

<pre><code>for file in ~/Documents/*; do echo &quot;$file&quot;; done
</code></pre>

<p>To create hardlinks in the present working directory that point to files in your Documents folder, enter:</p>

<pre><code>for file in ~/Documents/*; do ln &quot;$file&quot;; done
</code></pre>
</content>
 </entry>
 
 <entry>
   <title>Is Coffee God or Bad for You?</title>
   <link href="http://www.mattdipasquale.com/blog/2009/07/20/is-coffee-god-or-bad-for-you" />
   <updated>2009-07-20T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/07/20/is-coffee-god-or-bad-for-you</id>
   <content type="html"><p>This is my response to a <a href="http://www.facebook.com/profile.php?id=514417&v=feed&story_fbid=593962322586">comment made on my facebook page</a>:</p>

<p>UPDATE: Research has shown that consumption of coffee increases the acid load in the body, speeding the aging process and causing diseases such as heart disease, cancer, osteoporosis, baldness, and many more. Read my blog post on <a href="/blog/2010/05/09/how-to-prevent-osteoporosis/">how to prevent osteoporosis</a>, The China Study, or PH Miracle Diet to learn more about this.</p>

<p>Okay... i'm gonna wing this cause I don't have anything definitive to go on. I've heard both sides of the story. I've heard more to stay away from coffee as Eric says. The best explanation I've heard from reading is from Rob Young author of Ph Miracle. He says coffee (although perhaps alkaline) leaves an acidic ash when digested by ur body. And it's better to eat more alkaline foods 80% like plants and leafy-greens and some fruit (lemons, although acidic, actually leave an acid ash), legumes, etc. than acidic foods 20%.</p>

<p>Also, if u only have a small amount of milk in ur coffee/diet, ur prob fine (as all rats were that only had 5% casein in diet as compared 20% rats, which all got liver cancer.) But milk is actually unhealthy for u and ur bones contrary to what propaganda implies. So, sparingly if any.</p>

<p>From a common sense perspective, coffee bean is the seed of the coffee plant. I believe that most seeds are very bitter (think orange seeds, etc.) because they are not meant to be eaten by animals. It makes sense that nature would intend this to be the case because if seeds were sweet and tasted really good, than many animals would eat them... and then there would be no more coffee plants or orange trees or lemon trees or apple trees, etc.. actually, aren't <a href="http://bit.ly/U3P4J">apple seeds poisonous</a>? Yes, they are. Apparently, cherry pits are also poisonous. Did you know that <a href="http://bit.ly/rbibq">coffee beans are actually the pits of coffee cherries</a> Hmmm... perhaps I'm onto something here... who knows? Some say the <a href="http://bit.ly/lOg6l">coffee plant is minorly poisonous</a>.</p>

<p>I like how in the 1st link in the paragraph above she says: &quot;Chewing the seeds makes them much more hazardous to your health.&quot; This makes sense because seeds have a protective covering around them so that if we accidentally swallow one or two or three or four or five, etc. when we're eating say an orange the protective shell prevents it from being easily digested. Ever take a shit to see whole seeds in there? ... oops... maybe I'm the only one... hmm... anyway... never-mind.... now... what was i saying [God... i can't believe i said that!] ... Oh, yes... soo.. it's kinda like swallowing a cocaine balloon... If the balloon pops, it could be deadly. Similarly, if the outer shell of the seed is punctured, by for example chewing the seed, you are &quot;punished&quot; with a strong, bitter taste... probably to signal you to spit it out, dummy! And as she says: &quot;Chewing the seeds makes them much more hazardous to your health.&quot; Nowadays, most fruits are genetically engineered not to have seeds... stick to local, organic, natural, non-genetically engineered produce. You must ask the store/farmer you buy from.</p>

<p>Now... how do we make coffee? We get the coffee seeds, strip off some outer layers, roast them, grind them, make coffee. Well, coffee is basically made from all the nutrients extracted from the seeds. Based on my assumption of nature's intention for these nutrients, I don't think it's necessary or beneficial to drink coffee. But I don't think a little here or there will hurt.</p>

<p>Then again, this reasoning could all be completely wrong with this approach... since I eat almonds, which are also seeds, and <a href="http://bit.ly/2KRptj">almonds are supposed to be very healthy for you</a>. But, they're not really bitter... haha... that's how I rationalized that. :P</p>

<p>For me, a big reason I stay away from coffee is cause my mom says she's addicted to it and she doesn't like the effects it has on her. She gets withdrawal if she tries to quit (like headaches and trembling). She wants to stop drinking it but can't. Talking to my mom about her experiences with coffee was enough to scare me away from it... Plus, I don't like the taste. Way too bitter... Although they sometimes say some bitter things are good for you... I forget what though...</p>
</content>
 </entry>
 
 <entry>
   <title>GTE - Day 2</title>
   <link href="http://www.mattdipasquale.com/blog/2009/07/03/gte-day-2" />
   <updated>2009-07-03T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/07/03/gte-day-2</id>
   <content type="html"><p>Nice Edwin.<br>
Okay. so i'm kinda embarrassed to share this... but... i got honest with myself and reminded myself that:</p>

<ol>
<li>get disturbed/get honest</li>
</ol>

<p>I'm single and in a slump (it's been about a month since any action... haha... although i have been in a new place for the past 3 weeks. prague... have to build up new social circle of prospects.. haha.. there i go with the excuses again! :) ) anyway. so i'm single and i feel like i have very little power with women. like in my past, i've almost always settled for the women i've been with. i've rarely felt like I 'chose' the women i dated or hooked up with. etc.</p>

<ol>
<li>What do I want?</li>
</ol>

<p>Again, being honest. Sex with really hot, classy women. Like girls I think are 10s, where i would chose them over others... not where i settle for them just because they fall into my lap. Due date. 1 week have sex with 1 10. and in 2 weeks have sex with 2 10s.</p>

<p>Why do I want this?</p>

<p>I have a natural, powerful, sexual attraction to women, especially women i find really hot! haha... I'm tired of seeing all these beautiful women around me and letting the pass me by... and then being stuck with a girl that's into me, but I'm not into. I want to have sex with hot women because it will make me feel good. not only the sex, but also the accomplishment of attracting a woman that i find beautiful. i will be much more confident. i will never break another girl's heart again because i will no longer settle for a girl that i'm not that into... just to tell her after she's fallen in love with me that i didn't really like her in the first place... she was just my only option because i really didn't have a choice... i will be confident and able to help other guys with women. if i can have sex with 3 10s in 3 weeks, then i can repeat the results and build off them. and maybe i'll even meet the girl of my dreams. and i'll care less what girls think about me cause i know i'll just be able to meet other girls.</p>

<ol>
<li>Results focused, Purpose driven, Major action plan - RPM</li>
</ol>

<p>Brainstorm:</p>

<pre><code>  - post add on czech version of craigslist
      - I posted add on annonce.cz but i don't think it went through... hmmm weird.
  - approach at least 3 HOT girls/day
      - i approached about 5 today, but i passed on about 3 or 4 REALLY hot ones cause i made up some stupid excuse. still. i was pretty proud that i broke that goal. I asked a bunch on dates and stuff, but got all nos. I got a pretty positive response though from one girl. well, let's just say i made her day. too bad she was on her way to the airport.
  - spend 30 mins each day talking to girls in parks, etc...
      - i didn't get to this today. i will tomorrow. and will keep u posted.
</code></pre>

<p>I definitely noticed some limiting beliefs i have in this area... like that it's not okay to approach women in public and ask them out etc... that's messed up. anyway... looking forward to stuff on beliefs.</p>

<p>Oh, and of course. i did my 15 mins of fufilment this morning. good stuff. feeling great! that's what really helped me to break through fears of approaching women today.</p>
</content>
 </entry>
 
 <entry>
   <title>GTE - Day 1</title>
   <link href="http://www.mattdipasquale.com/blog/2009/07/02/gte-day-1" />
   <updated>2009-07-02T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/07/02/gte-day-1</id>
   <content type="html"><p>let's get this party started. here's my share.</p>

<p>guess we're supposed to start with 1st week of PP2 but are skipping it? that's cool. i did the first 10 days of PP2 twice before, although a refresher wouldn't hurt since it's been a while. anyhow... i don't mind skipping it. on with the fun.</p>

<p>parts of day 1 audio that i liked:</p>

<ul>
<li>skepticism is being afraid to get your hopes up.</li>
<li>in today's world, depression is merely a prozac deficiency. LOL!</li>
<li>yeah, a ton of people talk the talk... but action is what matters. walk the walk.</li>
<li>all of my negative emotions (reserved, fear, etc...) are 100% related to my restricted body movements. wow... even some of my positive emotions are, like being laid back.</li>
</ul>

<p>Fifteen minutes of fulfillment. I did that this morning right after waking up and brushing my teeth. great time. i really got grateful. liked the breathing. really felt powerful and good. did some good visualization. i'm going to get clear on my incantations and also going to make a personal hypnosis tape for myself to really help myself imagine how i want things to be and be grateful for them. did some good incantations. those are POWERFUL!! took a shower after. and went to school.</p>

<p>I'm back now. i'll work out for 45 mins at 5pm. then go to sleep by 8:30pm. nice</p>
</content>
 </entry>
 
 <entry>
   <title>In the Future, We Won't Have to Work</title>
   <link href="http://www.mattdipasquale.com/blog/2009/05/27/in-the-future-we-wont-have-to-work" />
   <updated>2009-05-27T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/05/27/in-the-future-we-wont-have-to-work</id>
   <content type="html"><p>Going off my last post of musing about what the future holds in store for us, is it me or do we work way too hard these days?</p>

<p>With the age of computers and technology and this new age of information... our goal should be AUTOMATION...</p>

<p>Many things are already automated. For example, ATM machines. Did you know that the owner of an ATM machine makes money off you (by charging you that $2 fee or whatever) automatically? That's automatic continual income. You can invest in an ATM machine for a few thousand dollars, make a deal with a restaurant owner to put it in her restaurant, and start making money right away. Warren Buffet's first investment was similar. He bought a pinball machine and made a deal with a barber to put it in his shop.</p>

<p>The funny thing is, in the future, we probably wont even need ATM machines at all... why? because, if everything is automated. And I mean things like farming (We can make robots that will sew and harvest plants.), construction, landscaping (We can make automatic lawnmowers that remember a certain path to take.), cooking (sudo make me a sandwich), etc. If everything is automated (Use your imagination. Anything is possible.), then we won't have to pay for anything (You don't have to pay robots or computers to run. They work for you for free. And we can find natural, automatic ways to power them, like solar power. Nature is automatic.).</p>

<p>So, humans should be working toward automation to the next level (way past industrialization). And it should be done with health and environmental concerns as a top priority. For example, gasoline should no longer be used to fuel cars. We've already shown it's plausible to use hydrogen and water to fuel cars. But then again, the gasoline industry are doing a great job resisting this transition.</p>

<p>Not to mention the transition from the unhealthy American diet to the healthy whole plant-based diet. Sigh... I could go on and on. Educate yourselves! Or how about how blurred vision is the new normal vision. And laser surgery. The doctors don't even tell you the risks involved. Yes, that's right, you're more likely to get blinding eye diseases later in life if you're myopic (nearsighted) or presbyopic (farsighted). And if you get laser surgery, you will be permanently myopic. Myopia can be cured. It is not hereditary. Really, google how to improve your vision. I'm living proof that it can be done.</p>
</content>
 </entry>
 
 <entry>
   <title>How to Send Email with MAMP</title>
   <link href="http://www.mattdipasquale.com/blog/2009/05/27/how-to-send-email-with-mamp" />
   <updated>2009-05-27T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/05/27/how-to-send-email-with-mamp</id>
   <content type="html"><p>How to use the mail() php function to send mail.</p>

<p>This works and is REALLY easy! And can be undone later. It's just editing a text file. I know it's scary and advanced (I was scared and confused at first), but just do it. It's fine. And if it doesn't work, you can change it back. Simple! :)</p>

<ol>
  <li>Shutdown MAMP completely</li>
  <li>Edit /etc/postfix/main.cf</li>
    <ul>
      <li>Search for "relayhost"</li>
      <li>Add relayhost = smtp.example.com</li>
    </ul>
  <li>Start up MAMP again</li>
</ol>

<p>smtp.example.com is an example smtp server. It's different depending on your internet provider. I'm at Harvard now, so mine is: smtp.fas.harvard.edu.</p>

<p>I'm not really sure why this works, but here's what I think it's doing:   postfix is a mailserver that comes installed on your Mac (like php does). MAMP uses postfix to send emails. By setting up a relayhost, it tells postfix to send the emails from your current ISP because before it didn't know how to send the email and the email just got stuck in a queue.</p>

<p>So, now all those old emails should be in your inbox, or wherever you sent them to! :)</p>

<p>If you'd like to view your mail log, it should be here: <code>/var/log/mail.log</code></p>

<p>FYI: I'm running Mac Leopard OS X 10.5.7 on one of the new MacBooks (with the silver titanium cover and black rim around the screen).</p>

<p>Source: <a href="http://mikeryan.name/books/knowledge-base/web-server-generated-email-under-mamp">http://mikeryan.name/books/knowledge-base/web-server-generated-email-under-mamp</a></p>

<p>Thanks to Mike for this! I didn't trust him at first because it seemed too easy, yet sophisticated, but it works!</p>
</content>
 </entry>
 
 <entry>
   <title>The World Without Computers</title>
   <link href="http://www.mattdipasquale.com/blog/2009/05/21/the-world-without-computers" />
   <updated>2009-05-21T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/05/21/the-world-without-computers</id>
   <content type="html"><p>Eventually, computers will be obsolete. Not in the general sense of the word, but personal computers specifically.</p>

<p>What is the point of a personal computer?</p>

<p>I use mine to write papers, make presentations or websites (and blog posts like this one), and to check email. You can also use computers to advertise and sell products and services (e-commerce).</p>

<p>So, yes, computers are useful, especially as a means of communication and business, but isn't there better?</p>

<p><strong>Email &amp; Communication</strong>: What if your mind stored a mental image of everyone in the world, even people you've never met before, and you could use thoughts and/or gestures to browse or search these mental images of people to find the one(s) who you want to communicate with. Then, you could think of the communication you'd like to send and it would effortlessly manifest before you while you're thinking. After sending it, the person would get your message upon checking his mental inbox. Spamming would be easily traceable and regulated.</p>

<p><strong>Search</strong>: Why would I need a PC to find what I'm looking for when I can tap into the collective knowledge of all human beings for free by merely snapping my right thumb and middle finger together.</p>

<p><strong>Business</strong>: Business and money will soon be obsolete once we have robots doing all of our work for us. We won't have to pay robots to make or do anything for us. Instead of hefting over $20 for a nice dinner, we can tell our robot &quot;sudo make me a sandwich&quot; or merely think it or make a gesture and it will do just that with exactly what you want. Plus, all the food will be grown locally in your backyard garden (managed completely by your robots). And it will be completely organic and everyone will only eat whole plants because that is the healthiest way to eat. Read The China Study if you don't believe me.</p>

<p>And we certainly wont need planes when we can instantly teleport to one of the hundreds of millions of galaxies.</p>

<p>With all these technical advancements and gadgets, will humans be happy? Or will depression rates be even higher?</p>

<p>When will humans really learn to enjoy life to the fullest?</p>
</content>
 </entry>
 
 <entry>
   <title>PHP Benchmark Testing</title>
   <link href="http://www.mattdipasquale.com/blog/2009/05/20/php-benchmark-testing" />
   <updated>2009-05-20T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/05/20/php-benchmark-testing</id>
   <content type="html"><p>echo vs. assignment and string concatenation inside a display function.</p>

<p>I made this function <code>nav()</code> to display the navigation <code>&lt;ul&gt;</code> (unordered list) on <code>index.php</code> for my main page because I wanted to reuse this code on <code>index.php</code> of my wordpress blog for the same site. two <code>index.php</code> pages... i couldn't figure out how to condence the wp <code>index.php</code> file into my main <code>index.php</code> file for the main part of the site...</p>

<p>anyway... i did a benchmark test between <code>nav()</code> and <code>nav2()</code>, which uses a slightly different approach than <code>nav()</code>. I saw <code>nav2</code>'s approach used in facebook's code for sample facebook apps (like smiley, and therunaround)... but it looked slower than <code>nav()</code> because it creates an unnecessary (in my opinion) variable ($html) and assigns to it multiple times, (and I think assignments take longer than one cycle).</p>

<p>I did a benchmark test to test my hypothesis.</p>

<pre><code>&lt;?php
// filename: display.inc
// this file gets included in index.php, with include(), and I ran it by loading index.php.
/*
 * Render the main navigation that goes at the top of each page.
 */
function nav() {
  global $pgs;
  echo '&lt;ul id=&quot;nav&quot;&gt;';
    foreach($pgs as $pg_key =&gt; $pg) {
      $pg_pname = $pg['pname'] ? $pg['pname'] : $pg_key;
      $pg_aname = $pg['aname'] ? $pg['aname'] : ucfirst($pg_pname);
      $pg_link = is_null($pg['link']) ? $pg_key : $pg['link'];
      echo '&amp;lt;li class=&quot;',$pg_pname,'&quot;&amp;gt;&amp;lt;a href=&quot;',BASE_PATH,$pg_link,'&quot;&amp;gt;',$pg_aname,'&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;';
    }
  echo '&lt;/ul&gt;';
}

function nav2() {
  global $pgs;
  $html = '&lt;ul id=&quot;nav&quot;&gt;';
    foreach($pgs as $pg_key =&gt; $pg) {
      $pg_pname = $pg['pname'] ? $pg['pname'] : $pg_key;
      $pg_aname = $pg['aname'] ? $pg['aname'] : ucfirst($pg_pname);
      $pg_link = is_null($pg['link']) ? $pg_key : $pg['link'];
      $html .= '&amp;lt;li class=&quot;'.$pg_pname.'&quot;&amp;gt;&amp;lt;a href=&quot;'.BASE_PATH.$pg_link.'&quot;&amp;gt;'.$pg_aname.'&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;';
    }
  $html .= '&lt;/ul&gt;';
  echo $html;
}

/* The Test */
$t = microtime(true);
for($i = 0; $i &lt; 100; ++$i) {
  nav();
}
echo '&lt;br&gt;';
echo ($t = (microtime(true) - $t));
for($i = 0; $i &lt; 100; ++$i) {
  nav2();
}
echo '&lt;br&gt;';
echo ($t = (microtime(true) - $t));
</code></pre>

<p><strong>Results</strong>:</p>

<p><code>nav()</code> took 0.0039050579071 ms to run 100 times
<code>nav2()</code> took 1242865035.99 ms to run 100 times</p>

<p><strong>Discussion</strong>:</p>

<p><code>nav()</code> runs much faster than <code>nav2()</code>.</p>

<p><strong>Conclusion</strong>:</p>

<p>Use <code>nav()</code> style. i.e. when feasible, replace string concatenations and string variable assignments with <code>echo()</code> (separating arguments with commas).</p>

<p>No wonder facebook is so slow... :P (I kiddd... I love facebook. I'm sure they have some really smart people working there.)</p>
</content>
 </entry>
 
 <entry>
   <title>CSS Styling Tips</title>
   <link href="http://www.mattdipasquale.com/blog/2009/05/20/css-styling-tips" />
   <updated>2009-05-20T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/05/20/css-styling-tips</id>
   <content type="html"><p>If ur gonna be doing a fair amount of css styling, you must download the firebug firefox extension (google firebug). if you don't have firefox, you could try firebug light or you might prefer downloading webkit. <a href="http://webkit.org/">http://webkit.org/</a></p>

<p>it's basically the same thing as safari, except with the latest updates and extra developer bells and whistles i.e. you can right click and &quot;inspect element&quot; to see it's styles (which u can also enable on safari by going to safari -&gt; preferences -&gt; advanced -&gt; show develop menu... but this is not as nice and doesn't let u edit css styles on the fly) and then you can edit them and see the changes in real time. i prefer firebug for firefox but webkit is pretty sweet and good to have for testing how your site will look on next versions of safari. also google chrome comes with these features. i'll prob get that when it comes out for mac. it's sick.</p>

<p>the reason i prefer firefox is cause they abide by the w3c standards very well. so it's recommended to start by styling using ff w/ firebug. then, once it looks good, check out ur website in the other &quot;broken&quot; browsers and fix their non-standard interpretations of ur css styles.</p>

<p>when working with css, u should check recent versions of ff, ie6+, safari, chrome, opera, etc... cause different browsers interpret the code differently...</p>

<p>here's a good reference. test on these browsers. <a href="http://kimblim.dk/css-tests/selectors/">http://kimblim.dk/css-tests/selectors/</a></p>
</content>
 </entry>
 
 <entry>
   <title>Whole Wheat Vs. Multigrain</title>
   <link href="http://www.mattdipasquale.com/blog/2009/04/08/whole-wheat-vs-multigrain" />
   <updated>2009-04-08T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2009/04/08/whole-wheat-vs-multigrain</id>
   <content type="html"><p>This post is a response I made to this article: <a href="http://la.foodblogging.com/2005/07/31/337/">http://la.foodblogging.com/2005/07/31/337/</a></p>

<p>Pauline, you know how they tell you to go with your gut?<br>
Well, your gut is correct in this instance: it looks the same because it is virtually the same: lacking in nutrition. As you say in your comment above: &quot;Multigrain is a bit tricky - it is not necessarily made entirely of whole grains.&quot; That is spot on [more discussion - <a href="http://www.wisegeek.com/what-is-multigrain-bread.htm">http://www.wisegeek.com/what-is-multigrain-bread.htm</a>]. You want to stay away from &quot;enriched&quot; multigrain pasta like this because it is virtually as unhealthy as white pasta. &quot;Enriched&quot; means they take all the grains, strip all the natural fiber, minerals, and vitamins, and &quot;enrich&quot; the end malnutritious result by adding the following minerals and vitamins back: niacin (vit. B3), ferrous lactate (iron), thiamine mononitrate (vit. B1), riboflavin (vit. B2), folic acid (vit. B9). [ingredients -&gt; ]</p>

<p>If you really must stick with Barilla, this is the pasta you want: <a href="http://www.barillaus.com/home/Pages/Barilla_Whole_Grain.aspx">http://www.barillaus.com/home/Pages/Barilla_Whole_Grain.aspx</a>. But, it's still only 51% whole grain and not organic, so there are pesticides in it and it is lacking in vitamin B12.</p>

<p>So if you really want to man-up, then you need to go with something 100% whole grain and all organic. For example: <a href="http://www.edenfoods.com/store/index.php?cPath=22_34">http://www.edenfoods.com/store/index.php?cPath=22_34</a></p>

<p>Finally, tt: wheat is a type of grain. Other grains are barley, quinoa, oats, etc. Whole wheat is usually better than multigrain because, as discussed above, multigrain is often not made of whole grains. But, if you can find multigrain pasta that is made of 100% whole grains, then that's even better than whole wheat because you want to eat a variety of grains.</p>

<p>As far as weight goes, eating either will cause you to lose weight. They've done studies that if you eat a whole plant-based diet as suggested in The China Study, you can eat as much as you want and still lose weight. The Atkins diet will slowly kill you... plus you have to monitor what you eat. Why would you want to worry about all that calorie counting? It's much easier to worry about ingredients. Well, actually, not that much easier with how corrupt our food industry is now, but it should be much easier. :)</p>
</content>
 </entry>
 
 <entry>
   <title>OpenOffice Personal Settings Locked Mac</title>
   <link href="http://www.mattdipasquale.com/blog/2008/12/09/openoffice-personal-settings-locked-mac" />
   <updated>2008-12-09T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2008/12/09/openoffice-personal-settings-locked-mac</id>
   <content type="html"><p>System: MacBook, running OS X Leopard (10.5.5)</p>

<p>Pop-up error upon attempting to open OpenOffice.org 3.0.0:</p>
<blockquote>
<p>&quot;Either another instance of OpenOffice.org is accessing your personal settings or your personal settings are locked. Simultaneous access can lead to inconsistencies in your personal settings. Before continuing you should make sure user 'user' closes OpenOffice.org on host 'host'. Do you really want to continue? Yes. No.&quot;</p>
</blockquote>
<p><strong>Solution</strong>:</p>

<p>Click &quot;No&quot;, then press command + 'q' to quit OpenOffice, unlock OpenOffice (per the instructions below), and then restart OpenOffice.</p>

<p>You can unlock your personal settings by entering the following command in Terminal:</p>

<pre><code>rm ~/Library/Application Support/OpenOffice.org/3/.lock
</code></pre>

<p><code>rm</code> stands for remove and virtually cannot be undone. That's why I use it carefully and constantly backup my files with Time Machine onto my external hard drive.</p>

<p>In case the <code>.lock</code> file is located somewhere else on your system, you can enter the following Terminal command to find it:</p>

<p>sudo find / -name=&quot;.lock&quot;</p>
</content>
 </entry>
 
 <entry>
   <title>Sleep Committment</title>
   <link href="http://www.mattdipasquale.com/blog/2008/12/04/sleep-committment" />
   <updated>2008-12-04T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2008/12/04/sleep-committment</id>
   <content type="html"><p>I'm going to sleep right now. 10:30pm and i'm going to wake up in the morning. :)</p>
</content>
 </entry>
 
 <entry>
   <title>I Watched Someone Die Today...</title>
   <link href="http://www.mattdipasquale.com/blog/2008/10/25/i-watched-someone-die-today" />
   <updated>2008-10-25T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2008/10/25/i-watched-someone-die-today</id>
   <content type="html"><p>I woke up early today to go to the River Run, a college intramural race at Harvard. The Dunster House team met in G-Entryway and walked down to the Charles River together. The men's run went well. It was fun. I finished 58th place out of over 100 guys. Not bad... I've been training with the Harvard Hockey team, and although that's gotten me in great shape (I gained 10 lbs. of muscle mass in three weeks.), it's prepared me more for explosive speed (that's good for hockey) rather than endurance for long-distance running. I started off in the top 10, and then everything went downhill from there. it felt like my legs were weighing me down. my thighs are huge. good for explosive skating strides. but toward the end of the race, I started passing people as I gave it my all to the finish.</p>

<p>We were all tired after the race, catching our breaths. I jumped into a group photo with our team. Then, the photographer pointed and said, &quot;Whoa!&quot; surprisedly. One of the students from the race had passed out and was lying on his back on the ground. A couple of the other racers were kneeling beside him, and one yelled for someone to call 911. A girl was talking on her cell phone. I wasn't sure if she was talking to 911 or not. I called them to be sure and they said an ambulance was on the way.</p>

<p>All I could really do was watch. I felt so helpless. I felt like I did when I watched my dad die when I was 9. It was all too similar. He was unconscious. People were surrounding him, working together to deliver CPR. He had stopped breathing. People calling 911. These things were all the same. But what struck me as most similar was the feeling. The feeling of not knowing how to help... thinking that there was nothing I could do to help. Was there anything I could do? I wasn't sure... I thought after coming back to my room after the ambulance came and took him to the hospital... i thought that maybe I could've rounded up the crowd of people at the event and we could've prayed together. At least we could've come together and breaded positive energy with our minds that might've helped. I had heard of the time people came together to pray in Washington D.C. or something and the crime level decreased. Maybe that would've helped...</p>

<p>Everyone was watching and hoping and wondering and worried. We all wanted him to be okay. We were all scared. Some people were crying. I started praying for him to wake up. I prayed to my Dad and I prayed to God. I visualized myself seeing him healthy and shaking his hand and smiling at him and saying, &quot;Hey! you're okay! :) you really scared me, there!&quot; and then I would've wanted to hug him. Even though I didn't really know who he was... who knows... perhaps I've met him before at a meal or whereever... I'm sure I've seen him around. But that didn't matter. He's a human being just like me. A student at Harvard. I ran the race with him. I felt for him. I wanted him to live. I was really pulling for him.</p>

<p>After a couple minutes of CPR, he started breathing. He arched his head back as if to really open up the pathway for the air to go down his throat and into his lungs. He looked like he was struggling to breath. And he still seemed to be unconscious even though he was moving. A man helping said, &quot;That's it! keep breathing. you're doing great!&quot; I said to myself, &quot;WHAT THE FUCK???&quot; He was not looking good. He looked like he was trying to jump out of his body... like he was really struggling to get air. But I thought he was going to be okay. I thought they'd be able to resuscitate him. You see it happen in the movies a lot... (i guess the movies just like to fuck with your emotions and make you think the main character is gonna die, but then they resuscitate him...) but I mean, why would he die? Then, all of a sudden, I saw his legs spasm and he was lifeless again... no longer breathing. &quot;What happened?&quot; someone asked.</p>

<p>They got him breathing again at least one more time... maybe two more times.. i couldn't tell with all the people surrounding him. I was just standing there watching... and then, bamb... spasm and back to no longer breathing... then, they started the CPR again.</p>

<p>The ambulance came almost immediately. it took them like 5 minutes to come. that's amazing. After they got him an oxygen mask and an IV and took him away to the hospital on a stretcher, we started walking back to Dunster House. We didn't talk much. We were all worried.</p>

<p>I showered... talking to God and Dad in the shower... then I got dressed and ate some lunch in the Dunster House dining hall. Then, I went to the computer lab to check my email... before leaving, I looked up the number for the hospital and called them. I asked them if they knew how the Harvard student was doing. She told me to call HUHS about that. I did, and they told me they weren't giving any information about that currently but that I could attend a meeting at Adams house at 1pm. That didn't sound good. Actually, it sounded really bad. Actually, it sounded like that meant he died.</p>

<p>It was 12:55 so I grabbed my skateboard and booked it over there after quickly seeing if, in the dining hall, I could find anyone from the run who wanted to go with me. Nope. I went by myself. When I got there, I walked in through the back door and I overheard a couple of the dining hall staff members talking and I overheard one say, &quot;... died ...&quot; &quot;Wait, what happened?&quot; I asked. They were like, oh shit, don't go and start something now. I think that meant I wasn't supposed to tell anyone... It was hard not to. I walked in the dining hall and asked another staff member where the meeting was. He said it would be here at 1:30pm. I had 30 minutes. I looked around and said hi to a friend I knew. We talked for a bit and then I left.</p>

<p>As I walked out of Adams House, I saw the church in front of me. I walked into the church (I love how churches are like always open.), and I kneeled down at one of the pews to pray. The organist was playing the organ. It was nice. I prayed to Dad and I prayed to God. I started crying. The student died so fast. One second everyone was happy for having completed the race. The next second, he was dying. I think he died in like 20 minutes. They said it was possibly due to an undiagnosed heart condition. His heart just stopped functioning properly. My friend in premed said &quot;ever get a muscle cramp in your leg before? imagine that happening to your heart.&quot; he said that's probably what happened. cause you're heart is a muscle.</p>

<p>But that made me think that that could've been anybody. That could've been me... or someone I know... or you... life can end so quickly and so unpredictably. I often ask myself, what am I doing with my life? Now, I'm going to start asking myself, &quot;What can I do today that would make today more fun than ever before?&quot; That's a good question. &quot;What can I do today that would make me really happy and proud of myself?&quot; &quot;What can I do today in order to live my life to the fullest?&quot; Because we only get one life. Enjoy it. and go to the doctor and make sure you're healthy. health is so important.</p>
</content>
 </entry>
 
 <entry>
   <title>ToDo Today</title>
   <link href="http://www.mattdipasquale.com/blog/2008/10/23/todo-today" />
   <updated>2008-10-23T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2008/10/23/todo-today</id>
   <content type="html"><p><strong>School</strong>:</p>

<ul>
<li>stats - hw4 - today</li>
<li>scib60 - paper2 - today</li>
<li>cs164 - hw1 - today</li>
</ul>
</content>
 </entry>
 
 <entry>
   <title>This Is Really Nice...</title>
   <link href="http://www.mattdipasquale.com/blog/2008/10/22/this-is-really-nice" />
   <updated>2008-10-22T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2008/10/22/this-is-really-nice</id>
   <content type="html"><p>I can come here to blog about anything and everything. sigh... i love journaling... sooo good!!! woot woot!</p>

<p>I went to bed at 11pm last night. took me a little longer to get to bed cause i'm just starting to go to bed early (before 10:30pm)... I woke up at 11:30am!!! slept a bunch! I was beginning to get sick. I felt so much better in the morning though. I feel a lot better now too. I'm gonna keep up sleeping well.</p>

<p>Does anyone know what woop means? I've been hanging out with the hockey team a bunch recently and they always say, &quot;alotta woop!&quot; in reference to partying. I think it either means a lot of drinking (alcohol) or a lot of ass (hot girls). I'm not really sure which... and I'm too scared to ask cause I don't want to get made fun of for not being in on the lingo... &quot;yeah buddy!&quot;</p>

<p>Didn't make the al gore thing today... heard it was aight. I still gotta see his movie, &quot;an inconvenient truth&quot;</p>

<p>but more importantly: here are some things on my agenda today:</p>

<ul>
<li>put take home quiz in teacher's box</li>
<li>start ad campaign for diamond models on facebook</li>
<li>finish hw1 for cs164</li>
<li>prepare a bit for meeting at 8pm</li>
</ul>

<p>Go to sleep by 10:30pm! because it's good for me! and cause I gotta wake up at 7:30am tomorrow for psych. first time on time to class is tomorrow. go matt!</p>

<p>And, some other things to do tomorrow and in future:</p>

<ul>
<li>send forms to incorporate diamond</li>
<li>write proposal for extra term</li>
<li>finish about page for this site</li>
<li>make diamond website look cooler</li>
<li>start asking girls to hang out</li>
</ul>
</content>
 </entry>
 
 <entry>
   <title>Reestablishing Sleep Commitment</title>
   <link href="http://www.mattdipasquale.com/blog/2008/10/21/reestablishing-sleep-commitment" />
   <updated>2008-10-21T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2008/10/21/reestablishing-sleep-commitment</id>
   <content type="html"><p>I liked going to bed before 10:30pm. I'm tired now and it's natural to go to sleep when it gets dark.</p>

<p>Good night. :)</p>
</content>
 </entry>
 
 <entry>
   <title>Finally made my own website...</title>
   <link href="http://www.mattdipasquale.com/blog/2008/10/21/finally-made-my-own-website" />
   <updated>2008-10-21T00:00:00-07:00</updated>
   <id>http://www.mattdipasquale.com/blog/2008/10/21/finally-made-my-own-website</id>
   <content type="html"><p>I've been wanting to make my own webpage for a while. Here it is! :) Obviously, still a work in progress.</p>

<p>I will be using this mainly to share information about me, share photos, and to share my experiences, thoughts, and emotions.</p>

<p>Specifically, I want to blog about my life, what I'm up to, and my committments.</p>

<p>Thanks for your support! :)</p>
</content>
 </entry>
 
 <entry>
   <title>Drink More Water</title>
   <link href="http://www.mattdipasquale.com/blog/2006/12/17/drink-more-water" />
   <updated>2006-12-17T00:00:00-08:00</updated>
   <id>http://www.mattdipasquale.com/blog/2006/12/17/drink-more-water</id>
   <content type="html"><p>I will continue to drink two glasses of pure water in the morning and two in the evening:</p>

<ul>
<li>to clense my body</li>
<li>to clear my mind</li>
</ul>

<p>I will also start drinking a glass of water every hour.</p>
</content>
 </entry>
 
</feed>

