<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-234643770079039118</id><updated>2012-02-16T07:50:00.284-08:00</updated><category term='rspec'/><category term='stash'/><category term='find'/><category term='git'/><category term='sql'/><category term='mocking'/><category term='Mac'/><category term='migration'/><category term='mocha'/><category term='Terminal'/><category term='testing'/><category term='script/generate'/><category term='HTML5'/><title type='text'>Tiny Tips From a Software Apprentice</title><subtitle type='html'>A software apprentice who's mind is not like an elephants needed a place to note little things she keeps having to do. Even (and especially) if they are *very* simple/easy things.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-234643770079039118.post-3643031040367586175</id><published>2009-09-30T13:35:00.000-07:00</published><updated>2009-10-07T09:47:28.283-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><title type='text'>HTML5 Databases &amp; Palm Pre Development</title><content type='html'>Recently I have been working on a Palm Pre project in the Obtiva Studio. A feature arose where we needed to know if the user had arrived in the application (or at a certain page with in the application) for the first time. After doing some searches we discovered that the Palm Pre supports HTML5 which allows for some pretty awesome database setups and calls.&lt;br /&gt;&lt;br /&gt;So here is what our code looks like:&lt;br /&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/204108.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;We needed to use this code at two different places on the application and so pulled it out into it's own class. The initialize function does just what you would think it would do, and the beginning of the new interesting stuff is on line 4&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;this.db = openDatabase("Database Name", "1.0", "Display Name", 10000);&lt;/pre&gt;&lt;/blockquote&gt;This openDatabase command is a new HTML5 window method, so it starts to get interesting. This method takes 4 things:&lt;br /&gt;&lt;ol style="font-style: italic;"&gt;&lt;li&gt;The database name: here brillantly named, Database Name (I didn't say it had to be interesting)&lt;/li&gt;&lt;li&gt;The version of the database: 1.0&lt;/li&gt;&lt;li&gt;The display name: Display Name (again....interesting naming isn't the game)&lt;/li&gt;&lt;li&gt;The estimated size in bytes of data that will be stored in the database: 10000&lt;/li&gt;&lt;/ol&gt;Now, we move on to some more interesting things, and what to do with this now opened Database. We need to note if the user has been at that particular page in the past, and if they haven't then they need to see different information than a user that's been around the block a few times.&lt;br /&gt;&lt;br /&gt;The two things we did were to call a transaction on the database object and then execute some SQL statements on that transaction. All the interesting happens in these lines:&lt;br /&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/204125.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;In general to execute the SQL you do this:&lt;br /&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/204138.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Where the function(tx,result){} is going to hold the action of what you want to do if the SQL instructions passed and likewise the function(tx, error){} will hold the instructions of what to do if your SQL fails. In our case the error actions are just logging the error messages while the successes are dealing with figuring out if the user has been to the page before.&lt;br /&gt;&lt;br /&gt;We didn't get any deeper into the HTML5 database things, but being able to create databases and check for users on the fly was a fun and exciting find.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/234643770079039118-3643031040367586175?l=softwareapprenticetips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/3643031040367586175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=234643770079039118&amp;postID=3643031040367586175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/3643031040367586175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/3643031040367586175'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/2009/09/html5-databases-palm-pre-development.html' title='HTML5 Databases &amp; Palm Pre Development'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-234643770079039118.post-7463805426950309475</id><published>2009-04-24T06:47:00.000-07:00</published><updated>2009-04-24T06:55:18.569-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='mocking'/><category scheme='http://www.blogger.com/atom/ns#' term='mocha'/><title type='text'>Don't Mix Your Mocks!</title><content type='html'>Yesterday while pairing with&lt;a href="http://jakescruggs.blogspot.com/"&gt; Jake Scruggs&lt;/a&gt; we came across the strangest problem. We added in some tests for a new component that we were adding, and were going to check the new code in. And what do you do before you check in boys and girls? That's right! You run your specs. So we run the specs and all of a sudden there are two failing tests. Wait....what? Those tests aren't even near anything we changed&lt;br /&gt;&lt;br /&gt;So we did the poor man's roll back by  commenting out every line of code that we had changed, and ran the specs again. Still two failures. We did some rubber ducking with &lt;a href="http://nuts.redsquirrel.com/"&gt;Dave Hoover&lt;/a&gt;, who tried to just comment out the failing specs. We ran the tests again...Now there were 8 failures. What the What? Commented those back in....and now we have a total of 10 failures. We had everyone on the project get up to date and run the specs. Every single person had a different number of failing tests.&lt;br /&gt;&lt;br /&gt;It came down to the fact that somehow we had two different mocking frameworks in place. We had some rspec tests, and we had some mocha tests. They lived in harmony for a long time and then all of a sudden...KABOOOOM. The tests looked like they were trying to overwrite class methods and so I guess the two different fameworks started bumping heads. We moved everything to the rspec mocking model and everything was back to playing nice.&lt;br /&gt;&lt;br /&gt;So. In short. Make sure you keep an eye on what mocking framework is being used in your project and stick with it. Strange erros indeed!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/234643770079039118-7463805426950309475?l=softwareapprenticetips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/7463805426950309475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=234643770079039118&amp;postID=7463805426950309475' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/7463805426950309475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/7463805426950309475'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/2009/04/dont-mix-your-mocks.html' title='Don&apos;t Mix Your Mocks!'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-234643770079039118.post-3544956915670187653</id><published>2008-12-10T09:58:00.001-08:00</published><updated>2008-12-10T10:00:32.873-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><category scheme='http://www.blogger.com/atom/ns#' term='find'/><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><title type='text'>Find via Terminal</title><content type='html'>So you need to find a file quickly on your machine. If you are in the terminal do :&lt;br /&gt;&lt;blockquote style="font-weight: bold; font-style: italic;"&gt;mdfind&lt;span style="font-weight: normal;"&gt; file_name&lt;/span&gt;&lt;/blockquote&gt;It's like using &lt;span style="font-style: italic;"&gt;Spotlight&lt;/span&gt; but within the terminal. It's really fast and a nice way to find files that you need quickly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/234643770079039118-3544956915670187653?l=softwareapprenticetips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/3544956915670187653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=234643770079039118&amp;postID=3544956915670187653' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/3544956915670187653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/3544956915670187653'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/2008/12/find-via-terminal.html' title='Find via Terminal'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-234643770079039118.post-4882534338344908114</id><published>2008-12-05T06:48:00.000-08:00</published><updated>2008-12-05T06:58:40.535-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='script/generate'/><title type='text'>Oh...You're Using RSpec and not TestUnit?!?!</title><content type='html'>Oh no.....but then when you do&lt;br /&gt;&lt;blockquote style="font-weight: bold; font-style: italic;"&gt;script/generate controller NewController&lt;/blockquote&gt;you generate tests in the test unit folder and not the spec folder and it's a pain in the bottom as doing the generate thing is suppose to save you time and not waste it.&lt;br /&gt;&lt;br /&gt;But it's a simple fix and because it's Friday my tip isn't going to be that awesome. But now I remember it and that's all that matters...and thus it is awesome.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;script/generate rspec_controller NewController&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;This will then generate everything correctly for you and your bottom won't be in pain.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/234643770079039118-4882534338344908114?l=softwareapprenticetips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/4882534338344908114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=234643770079039118&amp;postID=4882534338344908114' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/4882534338344908114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/4882534338344908114'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/2008/12/ohyoure-using-rspec-and-not-testunit.html' title='Oh...You&apos;re Using RSpec and not TestUnit?!?!'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-234643770079039118.post-8738058334274503073</id><published>2008-12-04T07:24:00.001-08:00</published><updated>2008-12-04T07:33:31.189-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='stash'/><title type='text'>Git Stashes</title><content type='html'>You know you like your stash, who doesn't? But when you stash, the simple way &lt;span style="font-style: italic; font-weight: bold;"&gt;git stash&lt;/span&gt; it gives you these ridiculous titles so if you had more than one when you do &lt;span style="font-style: italic; font-weight: bold;"&gt;git stash list&lt;/span&gt; you would see things like:&lt;br /&gt;&lt;blockquote style="font-style: italic;"&gt;stash@{0}: WIP on branchname: 9cb5fe9... Merge branch 'branch' of git@github.com.....&lt;/blockquote&gt;What the hell is that? What is on that stash?&lt;br /&gt;&lt;br /&gt;If instead you did &lt;span style="font-weight: bold; font-style: italic;"&gt;git stash save "comments describing this stash"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;then when you did&lt;span style="font-weight: bold; font-style: italic;"&gt; git stash lis&lt;/span&gt;t you would see&lt;br /&gt;&lt;blockquote style="font-style: italic;"&gt;stash@{0}: On branchname: comments describing this stash&lt;/blockquote&gt;To get the stash off, and you do &lt;span style="font-style: italic; font-weight: bold;"&gt;git stash apply&lt;/span&gt;, it pulls off those changes but it leaves the stash in place so you would still see it if you did &lt;span style="font-weight: bold; font-style: italic;"&gt;git stash list&lt;/span&gt;. To get the stash off AND delete it do &lt;span style="font-style: italic; font-weight: bold;"&gt;git stash pop&lt;/span&gt; instead (think of it poping off the list of stashes).&lt;br /&gt;&lt;br /&gt;LeahC hasn't had to use mulitple stashes yet....so no word on how to take advantage of that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/234643770079039118-8738058334274503073?l=softwareapprenticetips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/8738058334274503073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=234643770079039118&amp;postID=8738058334274503073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/8738058334274503073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/8738058334274503073'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/2008/12/git-stashes.html' title='Git Stashes'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-234643770079039118.post-2584044124425340300</id><published>2008-12-03T08:44:00.000-08:00</published><updated>2008-12-03T09:08:36.321-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='migration'/><title type='text'>Importing SQL Databases</title><content type='html'>I was working on merging in a branch to our master branch and did rake db:migrate like you do when people have added in some migrations. My pair and I realized that the branch was not ready for merging as there were still a lot of failing tests and so decided to leave it to the person working on that branch to fix.&lt;br /&gt;&lt;br /&gt;So there's the pre-story. Now my database was all screwed up and so all the tests back in master were failing because things like "user_name" was changed to "user_firstname" and so on. So I did&lt;br /&gt;&lt;blockquote&gt;rake db:migrate:reset&lt;/blockquote&gt;This is a pretty strong reset and deletes everything....so know, "With great power comes great responsibility"&lt;br /&gt;&lt;br /&gt;To get my system back on track we did a sql dump of all the data that had been added and to add it back you do the following (one of many ways):&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download the sql dump file&lt;/li&gt;&lt;li&gt;Go to the folder where the file is&lt;/li&gt;&lt;li&gt;Go into mysql&lt;/li&gt;&lt;li&gt;show databases;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;use &lt;database&gt;database_name; (where &lt;database&gt; "database_name" is the one you want to repopulate)&lt;/database&gt;&lt;/database&gt;&lt;/li&gt;&lt;li&gt;source &lt;filename&gt;filename.sql; (where "filename.sql" is the sql dump)&lt;br /&gt;&lt;/filename&gt;&lt;/li&gt;&lt;/ol&gt;That's all there is to it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/234643770079039118-2584044124425340300?l=softwareapprenticetips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/2584044124425340300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=234643770079039118&amp;postID=2584044124425340300' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/2584044124425340300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/2584044124425340300'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/2008/12/importing-sql-databases.html' title='Importing SQL Databases'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-234643770079039118.post-7850944820776292119</id><published>2008-12-03T08:27:00.000-08:00</published><updated>2008-12-03T08:42:41.843-08:00</updated><title type='text'>Obligatory "Welcome" Post</title><content type='html'>I am a software apprentice at &lt;a href="http://obtiva.com"&gt;Obtiva&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I tend to not remember things unless I do them 800 times and thus need to keep going back to the master programmers to ask how to do the little things or spin my wheels for too long to do some little task.&lt;br /&gt;&lt;br /&gt;Hence&lt;br /&gt;&lt;br /&gt;"Tips From a Software Apprentice"&lt;br /&gt;&lt;br /&gt;...more like,&lt;br /&gt;&lt;br /&gt;"LeahC's notes to Self"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/234643770079039118-7850944820776292119?l=softwareapprenticetips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareapprenticetips.blogspot.com/feeds/7850944820776292119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=234643770079039118&amp;postID=7850944820776292119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/7850944820776292119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/234643770079039118/posts/default/7850944820776292119'/><link rel='alternate' type='text/html' href='http://softwareapprenticetips.blogspot.com/2008/12/obligatory-welcome-post.html' title='Obligatory &quot;Welcome&quot; Post'/><author><name>LeahC</name><uri>http://www.blogger.com/profile/01794788974263917472</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_VK1rcfCXlY0/STa7nSpvcfI/AAAAAAAAAxs/QtgHflDhAAQ/S220/Photo+1.jpg'/></author><thr:total>0</thr:total></entry></feed>
