When iBooks first came out, I had an iPad and an iPhone. But, I didn't buy an iBooks because I couldn't access them on my computer like I could my Kindle books. At some point, my husband took over my iPad, and I got an Android phone. Now, with Mavericks, Apple allows us to read iBooks on our computers.
But, I'm still not buying any. Amazon lets me view my books just about anywhere and always has. Android phone? Check. Apple iOS device? Check. Computer? Check. Web browser? Check. And, most importantly, on my beloved Kindle 2.
Maybe if Apple had allowed me to view my books on the computer when they first came out, I would have been tempted. But now? Nope. Sorry, Apple. I'm sticking with Amazon.
Friday, October 25, 2013
Monday, July 29, 2013
Framework Free
I've come to the conclusion that frameworks are making me lazy - and worse yet, stupid. Because I use abstractions all the time, I am completely unfamiliar with some very basic things. So, I'm working to fix this.
A friend asked me to write a little app that allows her to create questions about her life and track the responses. I could probably hack this thing out with CakePHP in a very short time, but I'm forgoing a framework. I'm doing this completely from scratch and using BDD to guide the development and refactoring.
In order to get more bang for my buck, I'm using this little app as my final project for Coursera's Startup Engineering class. This means, the race is on to get this thing finished and deployed so that I can compete for glory.
This little project is all about doing things I've never done before. I'm using Codeception, Composer, and the Facebook PHP SDK. I'm throwing in some AngularJS, and working on securing a REST API. And, to keep myself honest, I'll be sharing the little project on Github.
A friend asked me to write a little app that allows her to create questions about her life and track the responses. I could probably hack this thing out with CakePHP in a very short time, but I'm forgoing a framework. I'm doing this completely from scratch and using BDD to guide the development and refactoring.
In order to get more bang for my buck, I'm using this little app as my final project for Coursera's Startup Engineering class. This means, the race is on to get this thing finished and deployed so that I can compete for glory.
This little project is all about doing things I've never done before. I'm using Codeception, Composer, and the Facebook PHP SDK. I'm throwing in some AngularJS, and working on securing a REST API. And, to keep myself honest, I'll be sharing the little project on Github.
Thursday, May 31, 2012
In Defense of Programming Puzzles
A few days ago, I read an article on Hacker News, Spare me your puny little coding contest, earthling!
that panned programming puzzles as being a waste of time. The author, Adrian Scott, said he would rather be working on real-world projects that people will use. While I'm a huge fan of creating software with a purpose and an audience, I do think programming puzzles have their place. And, I recently used a programming puzzle with great success while recruiting a new junior programmer for LabRetriever.
Hiring junior developers can be tricky. You don't generally need a lot of prior experience for junior developers. And, you may not necessarily care if they have a degree. But, you do want people who have an aptitude for programming and problem-solving. In cases like this, a programming puzzle is a good gate-keeper to help find people who can think logically and use the basics of your language of interest. Once they get past the puzzle, you can bring them in for a personality and technical interview and see how things go from there.
In our small company, HR doesn't screen resumes from applicants. So, every email I receive from a recruiting company, an unqualified person, or somebody who is filling out applications to meet an unemployment quota is a waste of my time. Recently, I posted an ad on Craigslist seeking a junior programmer. Initially, I tried a standard ad. I listed our benefits, the job requirements, etc.. I didn't get many quality responses, but quite a bit of spam from freelancers and recruiters. So, I pulled that ad and replaced it with the following puzzle:
I didn't include an email address for a response. Within a day or two, the applications started coming in. Every resume was from a viable applicant who could do enough basic PHP to reason out the email address. I received no spam at all. I did receive a few submissions from people who didn't want the job, but thought the puzzle was fun. We got quite a kick out of those around the office. So, programming puzzles may not be for everybody. But, I loved how well one worked for us.
Hiring junior developers can be tricky. You don't generally need a lot of prior experience for junior developers. And, you may not necessarily care if they have a degree. But, you do want people who have an aptitude for programming and problem-solving. In cases like this, a programming puzzle is a good gate-keeper to help find people who can think logically and use the basics of your language of interest. Once they get past the puzzle, you can bring them in for a personality and technical interview and see how things go from there.
In our small company, HR doesn't screen resumes from applicants. So, every email I receive from a recruiting company, an unqualified person, or somebody who is filling out applications to meet an unemployment quota is a waste of my time. Recently, I posted an ad on Craigslist seeking a junior programmer. Initially, I tried a standard ad. I listed our benefits, the job requirements, etc.. I didn't get many quality responses, but quite a bit of spam from freelancers and recruiters. So, I pulled that ad and replaced it with the following puzzle:
/****************************************************************************/
/* I need a full-time junior web application developer who can work on-site */
/* in the Philadelphia subburbs. Recruiters have been driving me batty by */
/* responding to previous ads even though I politely ask them not to. So, */
/* in an effort to speak directly to my people - I am posing this ad as a */
/* programming problem. I would very much like to hear from entry-level */
/* applicants who are looking for a job where your brains and creative */
/* problem solving skills are admired and respected. */
/****************************************************************************/
function who_are_you(){
// We are a small company that provides specialized, web-based medical software
// to our growing list of clients. We offer flex-time, health insurance,
// and a casual work environment. You can contact us at:
$cache = array();
$web_site = how_do_i_apply($cache);
$pay_rate = what_are_you_willing_to_pay($cache);
}
function what_are_you_willing_to_pay($cache){
// We are willing to pay up to :
return (typical_college_recursive_function(10,$cache) + 15) * 1000;
// for the right person
}
function what_are_the_job_requirements(){
//1. You should be able to write a basic web application in either php, python, ruby or node js.
//2. We use php and MySQL, but are willing to train the right person.
//3. You need to be a competent writer. We will expect you to document your work clearly.
//4. You need to be authorized to work in the United States. We do not offer any Visa sponsorship
//5. Until you are fully trained, you'll need to work in the office every day. After that, we are open to telecommuting once a week.
//6. To show give us a hint of your skills, we are going to ask you to post the answer to this problem
//7. Along with your resume, at the specified location
}
function how_do_i_apply($cache){
// Calculate the email address that you need to mail your resume and the source code for your solution to.
$key = typical_college_recursive_function(6,$cache);
$key += 25 + (5%6) + 3 - 28;
$code = "ue@fyrrcrk.pbz";
return(give_me_the_email_address($key, $code));
}
function typical_college_recursive_function($n,$cache){
if($n <=2){
return 1;
}else{
if(isset($cache[$n])){
return $cache[$n];
}else{
$cache[$n] = typical_college_recursive_function($n-1,$cache) + typical_college_recursive_function($n-2,$cache);
return($cache[$n]);
}
}
}
function give_me_the_email_address($key, $code){
// Ok. Here is where you come in. This function should decipher the code using the key we provide.
// It's a basic Caesar cipher that shifts the letters of the alphabet based on the value of the key.
// Example: For a key 3 , A = D, C = F, R = U. The decrypted cipher will be the email address that you need.
}
who_are_you();
I didn't include an email address for a response. Within a day or two, the applications started coming in. Every resume was from a viable applicant who could do enough basic PHP to reason out the email address. I received no spam at all. I did receive a few submissions from people who didn't want the job, but thought the puzzle was fun. We got quite a kick out of those around the office. So, programming puzzles may not be for everybody. But, I loved how well one worked for us.
Sunday, January 29, 2012
The Case of the Missing "Close" Button on a JQuery Tools Overlay
I have a button on a page that may or may not be there. When I clicked the button, I wanted a JQuery Tools Overlay to pop up with some information and links. Because the button may or may not be there, I had to create the overlay programatically.
I found information on doing so here: http://flowplayer.org/tools/demos/overlay/trigger.html
So, on my page, I created a div for the overlay as such:
And, in the function called by the button's on click event, I added this:
$('#interp_pool_div').html(doctor_selection);
$('#interp_pool_div').overlay({
oneInstance: false,
mask: '#dcdcdc',
effect: 'apple',
});
$("#interp_pool_div").overlay().load();
This worked well, except for one thing - the close button didn't appear the second time that I opened the overlay. Also, I was a but worried about memory leaks caused by repeatedly creating the overlay. It turns out that because I was putting the data directly in the overlay div, the second time it ran, it was overwriting the html for the close button. So, the answer was to put a second div inside the overlay div and then load the content into that one. I also but a simple check around the code that creates the overlay to avoid creating it a second time. So, the final working code appears as such:
In the HTML:
In the JavaScript, outside the onclick function:
var overlay_exists = false;In the function called by the button click:
$('#interp_data').html(doctor_selection);
if(overlay_exists === false){
$('#interp_pool_div').overlay({
oneInstance: false,
mask: '#dcdcdc',
effect: 'apple',
});
overlay_exists = true;
}
$("#interp_pool_div").overlay().load();
Thursday, September 8, 2011
A MySQL Query to Replace a Character in a String
I wrote an import script for our old application to the new application database recently. While testing the import today, I noticed that a certain field used comma delimiters in the old database, but used ||| in the new, and my conversion script hadn't taken that into account. I needed a quick way to replace all the commas that came over in the input with pipes.
Here is the query that did it for me:
UPDATE `table` SET fieldname = REPLACE(fieldname,',','|||');Worked like a charm.
Friday, August 26, 2011
Unit Testing in Cake PHP 2.0
I had some trouble getting Unit Testing working with Cake PHP 2.0. But, after quite a bit of time of tinkering, I got it working.
1. The first step is to get PHP Unit installed. I used Pear, which worked with no problems. These Instructions worked for me on Windows.
2. I am using the latest version of Cake PHP 2.0 from git. Setting that up is essentially the same as setting up Cake PHP 1.3.x
3. I added a simple User model with the following table structure:
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` char(50) DEFAULT NULL,
`password` char(40) DEFAULT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
4. My goal for this first unit test was simple - get a unit test running and make it assert some trivial truth. I grabbed an example unit test from Cake PHP 1.3.x and tweaked it. And, this test should hopefully work for you as well to help establish that you have your environment working and so you can see the new naming conventions and directory structure.
In app/Test/Fixture, I created a file UserFixture.php with the following contents:
5. In app/Test/Case/Model I created the file UserTest.php with the following contents:
6. Running the test was as simple as in Cake 1.3.x - Go to your application and call test.php. Select App/Tests and run your User Test Case.
1. The first step is to get PHP Unit installed. I used Pear, which worked with no problems. These Instructions worked for me on Windows.
2. I am using the latest version of Cake PHP 2.0 from git. Setting that up is essentially the same as setting up Cake PHP 1.3.x
3. I added a simple User model with the following table structure:
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` char(50) DEFAULT NULL,
`password` char(40) DEFAULT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
4. My goal for this first unit test was simple - get a unit test running and make it assert some trivial truth. I grabbed an example unit test from Cake PHP 1.3.x and tweaked it. And, this test should hopefully work for you as well to help establish that you have your environment working and so you can see the new naming conventions and directory structure.
In app/Test/Fixture, I created a file UserFixture.php with the following contents:
<?php
class UserFixture extends CakeTestFixture {
/**
* name property
*
* @var string 'User'
* @access public
*/
public $name = 'User';
/**
* fields property
*
* @var array
* @access public
*/
public $fields = array(
'id' => array('type' => 'integer', 'key' => 'primary'),
'username' => array('type' => 'string', 'null' => false),
'password' => array('type' => 'string', 'null' => false),
'created' => 'datetime',
'updated' => 'datetime'
);
/**
* records property
*
* @var array
* @access public
*/
public $records = array(
array('username' => 'mariano', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
array('username' => 'nate', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
array('username' => 'larry', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:20:23', 'updated' => '2007-03-17 01:22:31'),
array('username' => 'garrett', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:22:23', 'updated' => '2007-03-17 01:24:31'),
);
}
5. In app/Test/Case/Model I created the file UserTest.php with the following contents:
<?php
App::import('Model', 'User');
class UserTestCase extends CakeTestCase
{
public $fixtures = array('user');
public $User;
public function setUp()
{
$this->User =& ClassRegistry::init('User');
}
public function testGetInstance()
{
$created = $this->User->field('created', array('User.username' => 'mariano'));
$this->assertEquals($created, '2007-03-17 01:16:23', 'Created Date');
}
}
?>
6. Running the test was as simple as in Cake 1.3.x - Go to your application and call test.php. Select App/Tests and run your User Test Case.
Tuesday, October 6, 2009
I Spent How Much at the App Store?!!!
Just learned about an Mac application that shows me how much I have spent at the iPhone app store. The free App Store Expense Monitor puts an item in my menu displaying the total amount I've spent. $269.21. I'm stunned. Those little 99-cent apps add up.
Of course, I've got a couple of big-ticket items in there too. $30 for a log-me-in app that I never use being the most lamentable.
The expense monitor also was kind enough to export a csv file of all my app store purchases - including free apps. Maybe this tangible evidence will curtail some of my impulse purchases.
Subscribe to:
Comments (Atom)