tag:blogger.com,1999:blog-88614707307005253702024-02-19T10:54:34.908-06:00Fifty OutsThis is the random ramblings of a programming geek, poker player, trumpet player, fast car nut, and billiards player.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.comBlogger64125tag:blogger.com,1999:blog-8861470730700525370.post-73440920524995307752012-05-03T22:04:00.000-05:002012-05-03T22:05:04.335-05:00Keep both view controllers in UISplitViewController portrait viewHooray! Apple has created a UISplitViewController delegate to choose whether the master view controller is hidden or not on orientation change.
If you start a project with the <b>Master Detail</b> application template, simple edit the [Project]DetailViewController.m file. At the bottom of this file you will find a <b>#pragma mark - Split view</b>, followed by all the delegate methods for the UISplitViewController. Simply add the following:
<code>
-(BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return NO;
}
</code>
That will force the first view controller to stay in view upon orientation change (namely, portrait view.)mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-66155177486338122682011-10-05T09:43:00.002-05:002011-10-05T09:44:14.243-05:00Why all the disappointment?I keep seeing all these blogs/threads about how Apple blew it by not putting out a iPhone 5. But honestly, what would the iPhone 5 consist of that the 4S does not already cover? I can think of one thing: some new spiffy form factor with a slightly bigger screen.<br /><br />As for form factor, the iPhone4 is already quite good. Is it just because we want something different, and not necessarily better? I don't think they could make things thinner with all the new guts they stuffed into the same case. A bigger screen, but same resolution... I'm not convinced that this would be all that much of an improvement. I certainly don't want a bigger phone, the iPhone 4 fits perfectly in the hand.<br /><br />We know LTE would not be in the cards. It just isn't ready yet, and Apple isn't big on adopting technologies preemptively (unless they are innovating it themselves.)<br /><br />So as for the 4S, let's list the highlights:<br /><br />* A5 chip, x7 graphics<br />* longer battery life<br />* new antenna design<br />* 2x data speed over 3G<br />* enhanced camera<br />* CDMA/GSM in same phone<br />* iOS5/iCloud<br />* Find my Friends / Cards<br />* iTunes Match<br />* Siri<br /><br />Ok, that is a pretty solid list of improvements. This really is a new phone, but just in the same form factor. Had we wrapped all this up in a new form factor and called it iPhone 5, would it suddenly get the praise and glory?<br /><br />I think it's mostly perception. As a matter of fact, if Steve Jobs would have been the one on stage, I think things would have been perceived differently. He has a way of wowing the audience. "We started from scratch. We took the already beautiful iPhone 4 form factor, gutted it, and replaced every single component with something better."<br /><br />[note] this is a copy of my post <a href="http://forums.macrumors.com/showthread.php?t=1240182">here</a>.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-60682093770473012212011-02-04T09:09:00.005-06:002011-02-04T09:32:49.709-06:00Objective-C Semi-Singleton ClassSometimes when building an iOS application, you will have a class you will want to access from anywhere. Such as, a controller with any number of child controllers (navigation, tab, etc.) and some of them need simple access back to the root controller.<br /><br />Apple provides their own solution to creating a full-blown singleton class, but this can be a daunting task for a simple need. A semi-singleton is much easier to create but has two caveats:<br /><br />1) semi-singletons only work if there is ever only one instance of the class<br />2) the singleton cannot be used to initialize itself<br /><br />So, here is how to make a simple "HelloWorld" class into a semi-singleton.<br /><br />In the HelloWorld.m file, create a static property to hold the singleton instance:<br /><br /><code><br />// put just after @implementation line<br />static HelloWorld* helloWorldInstance;<br /></code><br /><br />in the init method, assign the instance (self) to the static property:<br /><br /><code><br />-(id) init<br />{<br /> if ((self = [super init]))<br /> {<br /> // assign the semi-singleton<br /> helloWorldInstance = self;<br /> // do other init stuff here ...<br /> } <br /> return self;<br />}<br /></code><br /><br />create the shared static method for accessing the semi-singleton:<br /><br /><code><br />+(HelloWorld*) sharedInstance {<br /> return helloWorldInstance;<br />}<br /></code><br /><br />Lastly, be sure to dealloc the property to avoid crashes:<br /><br /><code><br />-(void) dealloc<br />{<br /> helloWorldInstance = nil;<br /> [super dealloc];<br />}<br /></code><br /><br />And now from any class, we can access a pointer to the instance:<br /><br /><code><br />#import HelloWorld.h<br /><br />HelloWorld *helloWorld = [HelloWorld sharedInstance];<br /></code><br /><br />And there you have it. Thanks to Steffen Itterheim and his book about cocos2d programming for the original tip!mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com1tag:blogger.com,1999:blog-8861470730700525370.post-13493630041648674712010-12-22T09:06:00.004-06:002010-12-22T09:23:24.288-06:00Apple TV: A perfect replacement for digital picture framesI never really liked the idea of digital picture frames. At first they were overpriced and very poor picture quality. Now they are getting better with higher resolution, more options for getting photos to them (SD card slot, USB, Wifi), but there is still a problem with them. They are single purpose devices, and Grandma doesn't want to fidget with loading images.<br /><br />Along comes the AppleTV (Gen 2) from Apple for $99. A black hockey puck with one HDMI cable, power cable, and very simple remote. Now here is a perfect replacement for digital picture frames. I have a MobileMe account where I keep all of my photo albums up to date. Now Grandma can flip on her AppleTV and view all the new photo albums I put onto MobileMe with no work on her part. The slideshow viewer is absolutely gorgeous, and quite configurable. Now Grandma can view the photos on her TV in a much larger format instead of a dinky digital picture frame, and I manage the albums.<br /><br />Not only is the AppleTV a good slideshow viewer, but you can watch Netflix, rent movies and tv shows, use airplay to push content to the TV from another iOS device, and you know an app store is in the works... but the picture viewer alone is worth the price to purchase for Grandma.<br /><br />Although MobileMe is $99 bucks a year, it's well worth it for the automated syncing of addresses, bookmarks, passwords, etc. between all your Mac devices. And of course, simple management of shared photo/video galleries for the family.<br /><br />So if you plan on getting a digital picture frame for a gift, spend the dollars on an AppleTV instead. It's a much better investment.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-13850746531917893452010-11-09T17:02:00.002-06:002010-11-09T17:05:10.637-06:00PHP5 References Explained VisuallyIf you are having trouble wrapping your head around PHP5 References, especially how objects are now handled, have a look at this handy guide.<div><br /></div><div><a href="http://www.phpinsider.com/download/PHP5RefsExplained.pdf">PHP 5 References Explained Visually</a></div>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com6tag:blogger.com,1999:blog-8861470730700525370.post-81122106458501310832010-09-08T15:48:00.003-05:002010-09-08T15:51:54.255-05:00Compress/GZip CSS the easy way with Apache and PHPSo you need a way to automatically compress CSS and GZIP to the browser without any complicated work on the development end? This script is for you.<div><br /></div><div><a href="http://www.ohrt.com/download/compress.php.txt">http://www.ohrt.com/download/compress.php.txt</a></div><div><br /></div><div>Just access the .css files from the browser as per usual.</div>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-30397122906810936912010-07-19T19:54:00.002-05:002010-07-19T20:01:43.800-05:00First thoughts on DroidSo my wife got a Droid. Not because she even wanted one, but because she was tired of messaging on her ancient Motorola Razor. She was going to get a non-droid phone on the cheapo data plan, but she eventually settled on a Droid, mainly for me to tinker with.<div><br /></div><div>Well, my first impressions are not so good. I've been using the iPhone for a few years, and the inconsistency on this phone just baffles me. The first thing I wanted to do was unlock the phone. I couldn't even figure that out, until I saw the sales guy slide his finger over the green button on the screen. There was absolutely no visual cue of how that worked. Then as I started browsing through the pages of icons, it really reminded me of the smartphones I tried before the iPhone was around: inconsistent and clumsy.</div><div><br /></div><div>I'm not even going to discuss features, because to me they really don't matter as much as the user experience. Bottom line, the user experience has to be good, and Apple has nailed that down. I could go on, but I found a good article that pretty much sums it all up.</div><div><br /></div><div><a href="http://scottworldblog.wordpress.com/2010/03/12/iphone-vs-droid/">http://scottworldblog.wordpress.com/2010/03/12/iphone-vs-droid/</a></div>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-21739873725592622402010-06-10T11:13:00.005-05:002010-06-10T11:18:07.893-05:00Remove the google background imageIt seems Google has decided to put a background image on its home page, without your consent. It will probably go away by tomorrow, but you can get rid of it by using the secure version of the google site (and consequently, get your search results securely.)<div><br /></div><div>Visit here: <a href="https://www.google.com/">https://www.google.com/</a></div><div><br /></div><div>That will get rid of the annoying background image, at least for now.</div>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-428944840651771432010-05-10T11:03:00.013-05:002010-05-10T17:00:24.818-05:00Everything-in-a-box MAME Arcade Cabinet<span class="Apple-style-span" style=" ;font-family:verdana, sans-serif;font-size:small;">This is a project started around 2004, and sat for 5 years, then I finally finished up the cabinet this past year. So what is it? MAME (Multi Arcade Machine Emulator) is an arcade emulation system. </span><span class="Apple-style-span" style=" ;font-family:verdana, sans-serif;">The machine can play over 6,000 old-school arcade games (Pac-Man, Donkey Kong, Centipede... yeah all of them) true to their original form, and also many retro game consoles such as Atari 2600, Nintendo, Super Nintendo, Nintendo 64, SEGA Genesis, Playstation, etc.</span><div><div><div><span class="Apple-style-span" style="font-family:verdana, sans-serif;"><br /></span></div><div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMIj_52Biq8yN3-Mmq3kDd2Ge1uF_lz9CwYdYzPm9B4R6mNo5n5W-yPDnbTPmqqexFmEH0OH4_eSLq8AyPeaYyi20LLnii21hULD1WZUkcxywxJNd8ybRqe2m_ixn9exqJQvBdTTbzglk/s1600/mame_cabinet.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 240px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMIj_52Biq8yN3-Mmq3kDd2Ge1uF_lz9CwYdYzPm9B4R6mNo5n5W-yPDnbTPmqqexFmEH0OH4_eSLq8AyPeaYyi20LLnii21hULD1WZUkcxywxJNd8ybRqe2m_ixn9exqJQvBdTTbzglk/s320/mame_cabinet.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469673088432322898" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAF_FycqNKN5fURh5YZMS1hUuTouXVU4FGbxflCf3HyZkvXMHXJE1IZn5WAO4xBL0_99f73mKZCBUazv1PZ_hnQ3NrsPFp24M4pKYthoqmRmmM1U6qixwtbDQ2DjE53mvzo-13W-FL-LM/s1600/under_cp_3.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAF_FycqNKN5fURh5YZMS1hUuTouXVU4FGbxflCf3HyZkvXMHXJE1IZn5WAO4xBL0_99f73mKZCBUazv1PZ_hnQ3NrsPFp24M4pKYthoqmRmmM1U6qixwtbDQ2DjE53mvzo-13W-FL-LM/s320/under_cp_3.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469673107522709122" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIR3vd2ASXHKTXDt8g31o90h29rTJOhUkfownGKWZ0t_B44Msy5utpVT4_QkLoYpYI8mBITLJ5bgvZz9QXpTLBkn-5ZLECHaNjeuC544SIEZEDpZk6fE9p67ActpUHxVqGuoI45D97XAw/s1600/under_cp_2.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIR3vd2ASXHKTXDt8g31o90h29rTJOhUkfownGKWZ0t_B44Msy5utpVT4_QkLoYpYI8mBITLJ5bgvZz9QXpTLBkn-5ZLECHaNjeuC544SIEZEDpZk6fE9p67ActpUHxVqGuoI45D97XAw/s320/under_cp_2.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469673101448842498" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1ihGwSbEXaM_42LJyxMv5CEmcTQhcFO81tusIOImqdLedozlbj1UIuVJGyjYvbHWFlRPXDzc4ho7FFbyQb6DIOWgtJbGnOQMzc5NQmrNn9D1wQ9QXoj2aVWKcdwuPIKjFSklVqM4BI5s/s1600/under_cp_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1ihGwSbEXaM_42LJyxMv5CEmcTQhcFO81tusIOImqdLedozlbj1UIuVJGyjYvbHWFlRPXDzc4ho7FFbyQb6DIOWgtJbGnOQMzc5NQmrNn9D1wQ9QXoj2aVWKcdwuPIKjFSklVqM4BI5s/s320/under_cp_1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469673091170205122" /></a><br /><div style="text-align: center;"><br /></div><div style="text-align: center;"><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh98Jb8wzCbwImx-nKc9VlculDYrXeYCo2ggu5spF3JPpDnzBug3Ke4X8ODHk3uszOEUJPmEu0N_t3pdalSoEdwmZwGScdPxz093VUTha7UrAPThPqQnIdD8n5Q_Xj_fFaP3XAKZqYFfko/s1600/DSCF0031.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh98Jb8wzCbwImx-nKc9VlculDYrXeYCo2ggu5spF3JPpDnzBug3Ke4X8ODHk3uszOEUJPmEu0N_t3pdalSoEdwmZwGScdPxz093VUTha7UrAPThPqQnIdD8n5Q_Xj_fFaP3XAKZqYFfko/s320/DSCF0031.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742987144524466" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG2MWMdSBr3oUFmtLvwm_BV_YZLA2d5MWEXIqjjvqMn5c6-uXjxIdoaqgUqIXIeaZHEBsxGDrnanrPa0l9ckfdZswiW18C4O80nNxGDjxDkg9uaBjyebq0JCSTukWKUKWk_pKiiwKAu6M/s1600/arcade+043.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG2MWMdSBr3oUFmtLvwm_BV_YZLA2d5MWEXIqjjvqMn5c6-uXjxIdoaqgUqIXIeaZHEBsxGDrnanrPa0l9ckfdZswiW18C4O80nNxGDjxDkg9uaBjyebq0JCSTukWKUKWk_pKiiwKAu6M/s320/arcade+043.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742982473202594" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQdIB_xgjX0Yoh6kuXMfdrTvBgYSJ0NMIhx4I-Iy97VzVTW2HPDUh33AY0XxVUxJRZbM4DNQ55a68pTZV0HhCBT2c3YV8_nNlKzWc8CE5fxhgHFp2GuwYPKOEGBiKPWFW_8umboGhjJ4Q/s1600/arcade+042.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQdIB_xgjX0Yoh6kuXMfdrTvBgYSJ0NMIhx4I-Iy97VzVTW2HPDUh33AY0XxVUxJRZbM4DNQ55a68pTZV0HhCBT2c3YV8_nNlKzWc8CE5fxhgHFp2GuwYPKOEGBiKPWFW_8umboGhjJ4Q/s320/arcade+042.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742975443594146" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx9qLFSsE4ErtkWe74Vj38iWeX9q6jqboXz3EviAOUW89tUHhyphenhyphenJIh6Ocn42FqtchfxFoCD4HWVcQepjWdcI5bU-bXlTxr5Fgff__mxQ20R4Dlb3K_tMRRlXCCj5Bc1zoht5JtXmHDyTws/s1600/arcade+041.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx9qLFSsE4ErtkWe74Vj38iWeX9q6jqboXz3EviAOUW89tUHhyphenhyphenJIh6Ocn42FqtchfxFoCD4HWVcQepjWdcI5bU-bXlTxr5Fgff__mxQ20R4Dlb3K_tMRRlXCCj5Bc1zoht5JtXmHDyTws/s320/arcade+041.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742963231291522" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivsw5NqJzW-PsgaqTq7gYJF_S7zVQJAj1hWA9qGosFQpN7C411mnf-nHHwgnUBwG494AwVm_EG0mp5dF4PGXs6ycBMPCSAdZQi66SNkHmt3c3nmd4YJDBed0RkEKT3NmaJOXnq6IT_3Lw/s1600/arcade+040.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivsw5NqJzW-PsgaqTq7gYJF_S7zVQJAj1hWA9qGosFQpN7C411mnf-nHHwgnUBwG494AwVm_EG0mp5dF4PGXs6ycBMPCSAdZQi66SNkHmt3c3nmd4YJDBed0RkEKT3NmaJOXnq6IT_3Lw/s320/arcade+040.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742766275374402" /></a><br /><div style="text-align: center;"><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8_4Pa6-NEeHqrNC9uRyYZ8VRSnk3CBpCqfiL20a5c8PWsHpJszyDMTmZ1JTJmMe8UxSl5e5dzsq2hQwesfHXS2wy_bsuuOGcUS-ZzI5FH9JP5ysvdHWKuuYoj58ML1b2jzSB1lESaOhQ/s1600/arcade+038.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8_4Pa6-NEeHqrNC9uRyYZ8VRSnk3CBpCqfiL20a5c8PWsHpJszyDMTmZ1JTJmMe8UxSl5e5dzsq2hQwesfHXS2wy_bsuuOGcUS-ZzI5FH9JP5ysvdHWKuuYoj58ML1b2jzSB1lESaOhQ/s320/arcade+038.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742748983559378" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq36dXkFjl3qtBrPzwrJbQZJZwMyeWWkvsBC0HqfcRf5ZQYigUNcUxAaS0leoEOLjwoaqKU8dUKdoqGHgoupcHQjolNhzQTC18RbWjarj49dnmATb3M-CA63pub2M6FF-Gap7zMZOqfB0/s1600/arcade+037.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq36dXkFjl3qtBrPzwrJbQZJZwMyeWWkvsBC0HqfcRf5ZQYigUNcUxAaS0leoEOLjwoaqKU8dUKdoqGHgoupcHQjolNhzQTC18RbWjarj49dnmATb3M-CA63pub2M6FF-Gap7zMZOqfB0/s320/arcade+037.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742738398420466" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiblIbXas5Iy7scyzffamXz3DI9cJlom_1325mTNVwi_v7aVksmoH6YH7N43NF8KzVw17aFl8QjG6T-lOg3SPXtW-AbEswtbj8LN221G15brUKl0HwS0HPxoFOrJJm8BwVYjVI4-P0-zH4/s1600/arcade+036.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiblIbXas5Iy7scyzffamXz3DI9cJlom_1325mTNVwi_v7aVksmoH6YH7N43NF8KzVw17aFl8QjG6T-lOg3SPXtW-AbEswtbj8LN221G15brUKl0HwS0HPxoFOrJJm8BwVYjVI4-P0-zH4/s320/arcade+036.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742692688580498" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkO7zzxS57cubiLqI0FpbWo9X0YIIVC5IGwXgEN51vCxjqTVDPwFCgUETGZ8MFxC25cdd9xsprdU1weaBl4hhweUpOGrrXpQtwljZuEPOvKKnfCeFr_jqQLM6bg_ioTVW7VsWLlwl8of4/s1600/arcade+035.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkO7zzxS57cubiLqI0FpbWo9X0YIIVC5IGwXgEN51vCxjqTVDPwFCgUETGZ8MFxC25cdd9xsprdU1weaBl4hhweUpOGrrXpQtwljZuEPOvKKnfCeFr_jqQLM6bg_ioTVW7VsWLlwl8of4/s320/arcade+035.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742507630293954" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL5prdbhcY6W85doiscGm_pgql3PlKtJOQd6T0YkBv1COsCBDk7EJTcEejfdeOB5QMLpo6yZQ3BYWxOv5_Jd6RmNq1cqHHFKQBpmJUgU_OpbOMN4QwnyN8d_peGgrDsOhvHpFTq84l7eg/s1600/arcade+034.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL5prdbhcY6W85doiscGm_pgql3PlKtJOQd6T0YkBv1COsCBDk7EJTcEejfdeOB5QMLpo6yZQ3BYWxOv5_Jd6RmNq1cqHHFKQBpmJUgU_OpbOMN4QwnyN8d_peGgrDsOhvHpFTq84l7eg/s320/arcade+034.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742504346060962" /></a><br /><div style="text-align: center;"><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikndxsJwrr0KacZN5hMSfwoT-MPSBeuAEtFDe2MuvC-0ldhqCFYL9Nwf1uQIOMoeVVzrB7Yzx7VcFvrlTZwxhIPDNVTSTQLmdzEGULyfXF87yBwetqIHkzgupmjYyXIJY2nC3Q497TFrI/s1600/arcade+032.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikndxsJwrr0KacZN5hMSfwoT-MPSBeuAEtFDe2MuvC-0ldhqCFYL9Nwf1uQIOMoeVVzrB7Yzx7VcFvrlTZwxhIPDNVTSTQLmdzEGULyfXF87yBwetqIHkzgupmjYyXIJY2nC3Q497TFrI/s320/arcade+032.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742480096561634" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilbB1tx6RiEynHH-8mfrzR-ba9Cmh7k_nqvDrsMCJ37ZFY1EpR4m5KULyfK7CN_X3fBHRD7WZci27yZEGE-NInEugAg6mMvt6PgVGygOD5aKQh8J5dopmVf7_BijH8-zBNkT4OItRtvV8/s1600/arcade+031.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilbB1tx6RiEynHH-8mfrzR-ba9Cmh7k_nqvDrsMCJ37ZFY1EpR4m5KULyfK7CN_X3fBHRD7WZci27yZEGE-NInEugAg6mMvt6PgVGygOD5aKQh8J5dopmVf7_BijH8-zBNkT4OItRtvV8/s320/arcade+031.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742471376888402" /></a><br /><div style="text-align: center;"><br /></div><div style="text-align: center;"><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVErJmdhd4a0-LOinnZQR_G0shgmHRc76kMPwIe2_ysmDWC6RBxOIQOxdjqB0zxH8CcyRfHAOizruh5Ytysj4H5RHPJjyIMQWVvJBUn6gzkurOhsmIHVRrZWm58Gjzqm-lds0ve3fzq88/s1600/arcade+028.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVErJmdhd4a0-LOinnZQR_G0shgmHRc76kMPwIe2_ysmDWC6RBxOIQOxdjqB0zxH8CcyRfHAOizruh5Ytysj4H5RHPJjyIMQWVvJBUn6gzkurOhsmIHVRrZWm58Gjzqm-lds0ve3fzq88/s320/arcade+028.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742170397100754" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDeYCl_LO_bMzl154QAGmvUgSIbYnxtJ9RO9jtjE0CyMzluojKBOzEvLxNaIO42hjpJY1tay4tiOoKPVMvvpCCTJ9qU1uHdy2kYeUyAGwRFve-f0vn7ArydfY_4u1r85hC1Xs78j_EWV4/s1600/arcade+027.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDeYCl_LO_bMzl154QAGmvUgSIbYnxtJ9RO9jtjE0CyMzluojKBOzEvLxNaIO42hjpJY1tay4tiOoKPVMvvpCCTJ9qU1uHdy2kYeUyAGwRFve-f0vn7ArydfY_4u1r85hC1Xs78j_EWV4/s320/arcade+027.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742162525309426" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Do3g7efV49IJMZGP3Jq92CauTcNtNLQ3JxF5C_HYQh8aiMfkoSFzPLzb_phqtZdJotPpbky7hxYj6mokRXssks4Wjopl88W9lzmRRj5N66Ws3ZiEvhqKuZZZBXp6AbJbOYWx0SHgfGE/s1600/arcade+026.jpg"></a></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Do3g7efV49IJMZGP3Jq92CauTcNtNLQ3JxF5C_HYQh8aiMfkoSFzPLzb_phqtZdJotPpbky7hxYj6mokRXssks4Wjopl88W9lzmRRj5N66Ws3ZiEvhqKuZZZBXp6AbJbOYWx0SHgfGE/s1600/arcade+026.jpg"><img style="text-align: left;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 320px; height: 240px; " src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Do3g7efV49IJMZGP3Jq92CauTcNtNLQ3JxF5C_HYQh8aiMfkoSFzPLzb_phqtZdJotPpbky7hxYj6mokRXssks4Wjopl88W9lzmRRj5N66Ws3ZiEvhqKuZZZBXp6AbJbOYWx0SHgfGE/s320/arcade+026.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5469742150111522034" /></a></div></div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style=" ;font-family:verdana, sans-serif;">This is a custom built cabinet (started with a plan found on the internet, I forget where) and custom design control panel. Wells Garner 27" monitor with VGA out, trackball/spinner, 4 8-way joys. Happ arcade controls, spinner, keyboard, trackball boards and Ultimarc Opti-PAC, ArcadeVGA, IPac 4 Interface, LED Harness, HAPP 3" trackball. The joy in the middle is 4-way, with asteroid button layout around it. Buttons on the sides for pinball simulators. It's a beast, and a blast to play. Panel disconnects with a couple latches. Everything starts up/shuts down with one button (computer, marquee, monitor, etc.)</span></div></div>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com2tag:blogger.com,1999:blog-8861470730700525370.post-89113526401242196392010-03-13T16:07:00.002-06:002010-03-14T22:06:52.606-05:00iPad sales on Amazon<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ00dYUMvfFy5WBFpwgEsv2eGry-r3Q1AS0jfPIAlyXew_Oux51qPPSP30lvIICJqr7hA4dErsnyvUBi_PZMqXdLonBodV3SsBbOaJ3UfxZspXCkredKccexNxL6Xq4fN4eQyyOEYu7qM/s1600-h/kindle_ipad.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 189px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ00dYUMvfFy5WBFpwgEsv2eGry-r3Q1AS0jfPIAlyXew_Oux51qPPSP30lvIICJqr7hA4dErsnyvUBi_PZMqXdLonBodV3SsBbOaJ3UfxZspXCkredKccexNxL6Xq4fN4eQyyOEYu7qM/s320/kindle_ipad.png" alt="" id="BLOGGER_PHOTO_ID_5448243675623307762" border="0" /></a><br /><br />So do you think we'll be seeing this? (take note of the text below the kindle)mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-29382636071403938122010-02-02T11:33:00.001-06:002010-02-02T11:34:29.771-06:00Where the iPad is goingI think this guy sums it up nicely.<br /><br /><a href="http://digg.com/d31HCrc">I need to talk to you about computers.</a>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-75415325149990531322010-01-28T10:59:00.009-06:002010-01-28T12:07:03.527-06:00Initial thoughts about the Apple iPadThe hype storm is over, the iPad has been introduced. In a nutshell, you can say it was underwhelming. We didn't see anything that we haven't seen before. Is the iPad as "magical" as they claim it to be? The gut reaction is no, but it may be more than you think.<br /><br />We can safely say that the iPhone stole the iPad thunder. The iPhone was the introduction of a GUI that was designed for touch-screen, and the iPad merely carried this idea over to a bigger device. If the iPhone had not existed before, the iPad would have had the same revolutionary first-impressions that the iPhone had. But there is another key ingredient to the whole concept of the iPad.<br /><br />For decades, desktop computers have had an interface that is designed for keyboards and mice. There are files and folders, and a pointing cursor that moves around the screen. You can have layers of windows running any number of processes. This is all fine and dandy when you have ample screen real-estate and processing power.<br /><br />Netbooks and PC tablets have not changed this concept one bit. The GUI is still based on keyboard-mouse entry. There have been attempts to marry the touch-screen idea to this GUI, but with limited success.<br /><br />Smartphones (before the iPhone) still tried to carry the same concept to the phones. Files, folders, windows, etc. The screen got so small they had to use a stylus to keep it functional. It was to say the least, difficult to use.<br /><br />The iPhone changed all of that. The notion of files and folders was thrown out. Visible layers of windows were also thrown out. Instead, a whole new GUI was designed with the fingers in mind. A single window is presented at any one time, with instinctive visual cues as you slid between them. The iPhone made it easy for anyone to pick up and use the phone, they "just got it."<br /><br />Now bring in the iPad. What the iPad accomplishes is mobile desktop power coupled with the iPhone touch-screen interface. Now that we have more screen real-estate we can do a few more things, such as split-pane views and fancier menus. But for the most part, the concepts are the same. Everything is designed with the fingers in mind. No stylus, no mouse or keyboard necessary. That makes specific tasks (email, web, video, etc.) quick and easy, on a device smaller than most netbooks.<br /><br />So what does that mean? I think this ushers in a new era of how we think about computing. There will always be a place for keyboard-mouse computing for more complicated tasks (ie. design/illustration, video editing, desktop publishing.) But for the everyday use and mobility, this is a big step toward a new way of thinking. My dad for instance, has never used a computer. He is just not interested in learning it all. However, I think he could pick up an iPad and "get it" very quickly. No files/folders/styles/keyboard/mice things to deal with. Just intuitive interactive elements that do what you expect when you touch them.<br /><br />You recall the funny tech-support stories about people trying to use the mouse as a foot pedal, or tapping the mouse against the screen trying to "click" on something. You laugh, but maybe this was a big clue into computing intuition, and how it should have worked in the first place. Now that we have the technology to do it, the iPad is simply leading the way.<br /><br />Of course, the first version of any device is always going to have shortcomings. It just takes time for things to work themselves out. I have no clue why Apple skipped out on a camera, but you can bet that iPad 2 will have one. You can also bet that iPhone OS 4.0 will have multitasking. These things just come with time.<br /><br />The importance of the iPad is an intuitive finger-controlled interface married to a mobile device with the power/size of a desktop, without the typical complexities of desktop computing as we know it.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-45679349145883247082010-01-26T14:20:00.002-06:002010-01-26T14:26:42.492-06:00One iPhone 4.0 wishI've seen a lot of feature wishes, but one I have not seen that would be really useful. That would be backup over Wi-Fi. But more precisely, give me the option to backup when I plug in the charger.<br /><br />My phone rarely gets backed up because I'm not in front of my Mac every day (it sits in the basement.) I typically use my iPhone or netbook upstairs for daily use. I do however, charge my iPhone every night.<br /><br />Backups over Wi-Fi would be a battery drainer, so it would be preferable to happen while plugged in. Therefore when I plug in the charger, it could pop up an option to backup the phone over Wi-Fi. Then the phone gets backed up and synced every night, without the hassle of visiting the dock.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-73416350543074118782010-01-24T11:56:00.018-06:002010-04-16T09:33:12.326-05:00Cocoa and DelegatesDelegates are probably one of the toughest concepts for iPhone/OSX developer newcomers to grasp. I'm going to try to keep it simple, and demonstrate how to build your own delegate protocol into your classes.<br /><br />A delegate is merely a design pattern in Objective-C. Simply put, it provides a way for objects to "listen" for interesting things happening in your object and act on them <i>without your object knowing anything about the object(s) listening</i>. Delegates are used heavily in the Cocoa environment. Most often you will see delegates used to trigger methods on a UIViewController, although they can be implemented on anything.<br /><br />Let's think for a moment what type of problem this solves. Let's say we have a UIViewController which has a UITableView in its view. When a table row is tapped, we want to slide a new view onto the screen. We don't want UITableView handling this task, so how do we accomplish this?<br /><br />The UIViewController needs to handle the new view (thus it's name.) So the UITableView needs to somehow inform the UIViewController that a row was tapped so it can take action. Therefore, the UIViewController needs to be the delegate of the UITableView. So we need to setup two things: We need to inform the UITableView what it's delegate object is, and we need to inform the delegate object what delegate protocol(s) it conforms to.<br /><br />We begin by setting the delegate property of the UITableView to the UIViewController object. If you are using Interface Builder, you can simply connect the delegate property of the UITableView to the UIViewController (typically the File's Owner.) Otherwise you might handle this in the viewDidLoad{} of the UIViewController, something like:<br /><br /><pre>self.tableView.delegate = self;</pre><br /><br />You will also want to tell the view controller that it understands the UITableViewDelegate protocol, so you would put this in the UIViewController .h interface declaration:<br /><br /><pre>@interface MyViewController : UIViewController<br /><UITableViewDelegate> {}</pre>(Note: if your view controller is an extension of UITableViewController, you will not need to declare the UITableViewDelegate protocol.)<br /><br />And you are set! Now when you implement a method of the UITableViewDelegate in the UIViewController, this method will trigger when something happens in the table view for that delegate method. So for instance, you put this in your UIViewController .m file:<br /><br /><pre><br />- (void)tableView:(UITableView *)tableView<br />didSelectRowAtIndexPath:(NSIndexPath *)indexPath {<br />// push the new view onto the stack here<br />}<br /></pre>When a row is selected in the table, this method will get triggered.<br /><br />So now begs the question, how do you add your own delegate protocol to your custom classes? Here is an example. Let's say you want to be able to trigger methods of other classes when interesting things happen in your class. The first thing you need to do is define what delegate methods are available to the delegate object. You would first put something like this at the top of your class .h file, above the implementation declaration:<br /><br /><pre><br />@protocol MyCustomClassDelegate <NSObject>;<br />- (void)didClickDone:(UIButton *)button;<br />@optional<br />-(void)didClickCancel:(UIButton *)button;<br />@end<br /></pre><br /><br />Where <span style="font-weight: bold;">MyCustomClassDelegate</span> is the name of your class delegate protocol (your class name appended with "Delegate"), and <span style="font-weight: bold;">didClickDone</span> and <span style="font-weight: bold;">didClickCancel</span> are the names of your two delegate methods. You can add as many methods as you wish. You not need to implement these methods in your class, that is up to the delegate to do. Notice the line with<span style="font-weight: bold;"> @optional</span>. This means that the following methods are optional for the delegate to implement.<br /><br />Now we need to setup the delegate property:<br /><br /><pre><br />@interface MyCustomClass : NSObject {<br />id <MyCustomClassDelegate> delegate;<br />}<br /><br />@property (nonatomic, assign)<br />id <MyCustomClassDelegate> delegate;<span style="font-family:Georgia,serif;"><br /></span></pre><br />And finally in the .m file, synthesize the delegate:<br /><br /><pre><br />@synthesize delegate;<br /></pre><br /><br />Note we do not need to release the delegate in the dealloc method, as this is not a retained object, it is just an assigned id.<br /><br />Ok, for the final part of your class, you need to fire off the delegate method when something interesting happens. For instance, someone clicks the done button. In your IBAction for the done button, you do just that:<br /><br /><pre><br />-(IBAction)done:(UIButton *)button {<br />[self.delegate didClickDone:button];<br />}<br /></pre><br /><br />And so on, for each delegate method. Ok, that is it for the class. Now, for the delegate class. To be the delegate of MyCustomClass, you need to declare that you implement the MyCustomClassDelegate protocol (.h file):<br /><br /><pre><br />@interface MyViewController:<br />UIViewController <MyCustomClassDelegate> { }<br /></pre><br /><br />And then, we implement the delegate methods (.m file):<br /><br /><pre><br />-(void)didClickDone:(UIButton *)button {<br />// do something here!<br />}<br /></pre><br /><br />One last thing to note, a class can be the delegate for several objects, just comma-separate the delegates:<br /><br /><pre><br />@interface MyViewController:<br />UIViewController <MyCustomClassDelegate,SomeOtherDelegate> { }<br /></pre><br /><br /><br />I hope that helps clear up delegates a bit! Please leave your comments below.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com10tag:blogger.com,1999:blog-8861470730700525370.post-19825391724416204562010-01-02T22:19:00.005-06:002010-01-02T23:29:49.060-06:00Winning one million from the casino, guaranteed (nearly)So you want to beat the casino for a cool million. Ok, here is a system on the roulette table. It's theoretical, it will take awhile, and you had better have some deep pockets. Here is how it works.<br /><br />1) bet $1 on red (or black, whatever you prefer)<br />2) if you lose, bet $2 on red/black<br />3) if you lose, bet $4 on red/black<br />... continue this pattern until you win...<br />4) you win $1. Start over on step 1.<br /><br />Continue the above step system 1,000,000 times. At the end, you should end up $1,000,000 ahead. Now there is a couple of things to consider. Although it is highly unlikely you will win/lose more than, say, 20 times in a row, it is quite possible to happen in 1,000,000 runs of the above system. In that case, you could be wagering a lot once in a while. In a computer simulation of running the system 1000 times, There was a bet of 134 million touched. That's quite a bit to hope for a dollar.<br /><br />So to be able to run this system, you have to have DEEP pockets. That, and find a casino that will let you play this way. Good luck with that :)<br /><br />From the simulation, here is the breakdown of wagers, # of times encountered, and % chances of happening:<br /><br /><pre><br />wager: $1 # of times: 47363291 (47.363291000%)<br />wager: $2 # of times: 24927507 (24.927507000%)<br />wager: $4 # of times: 13121947 (13.121947000%)<br />wager: $8 # of times: 6908653 (6.908653000%)<br />wager: $16 # of times: 3637176 (3.637176000%)<br />wager: $32 # of times: 1915725 (1.915725000%)<br />wager: $64 # of times: 1007786 (1.007786000%)<br />wager: $128 # of times: 528916 (0.528916000%)<br />wager: $256 # of times: 278835 (0.278835000%)<br />wager: $512 # of times: 147026 (0.147026000%)<br />wager: $1024 # of times: 77406 (0.077406000%)<br />wager: $2048 # of times: 40696 (0.040696000%)<br />wager: $4096 # of times: 21300 (0.021300000%)<br />wager: $8192 # of times: 11167 (0.011167000%)<br />wager: $16384 # of times: 5988 (0.005988000%)<br />wager: $32768 # of times: 3215 (0.003215000%)<br />wager: $65536 # of times: 1609 (0.001609000%)<br />wager: $131072 # of times: 840 (0.000840000%)<br />wager: $262144 # of times: 417 (0.000417000%)<br />wager: $524288 # of times: 246 (0.000246000%)<br />wager: $1048576 # of times: 126 (0.000126000%)<br />wager: $2097152 # of times: 67 (0.000067000%)<br />wager: $4194304 # of times: 35 (0.000035000%)<br />wager: $8388608 # of times: 13 (0.000013000%)<br />wager: $16777216 # of times: 7 (0.000007000%)<br />wager: $33554432 # of times: 6 (0.000006000%)<br />wager: $67108864 # of times: 4 (0.000004000%)<br />wager: $134217728 # of times: 1 (0.000001000%)<br /></pre>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-59544961554351672962009-12-17T10:38:00.003-06:002009-12-17T10:43:12.134-06:00What will happen in 2110?Here is a very interesting article posting predictions for year 2000 made in 1900. Many predictions were quite good!<br /><br /><a href="http://bunchofnerds.com/2008/10/retro/predictions-for-the-year-2000-from-the-year-1900/">http://bunchofnerds.com/2008/10/retro/predictions-for-the-year-2000-from-the-year-1900/</a><br /><br />So lets start a new prediction thread. What do YOU think the world will consist of in 2110? Comments will be open until the end of 2010.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com1tag:blogger.com,1999:blog-8861470730700525370.post-58354800624429193992009-11-12T11:08:00.009-06:002009-11-12T11:47:57.361-06:00AJAX and PHP sessionsOne thing that trips up AJAX development is how to persist your PHP session through your AJAX calls. In a browser, the session persists through a cookie that passes the session id upon each request. However with an AJAX call, the browser cookies are not passed and the session is lost.<br /><br />There are a couple of easy ways around this. First, if your AJAX library supports cookies, you can just set the PHP session id cookie before the call. If you don't have cookie support, then the following "manual" method works quite well.<br /><br />What you will want to do is pass the session id as a POST or GET variable in your AJAX request. We'll call our variable name "sid".<br /><br />Here is a jQuery example for passing the sid through as a POST value (in a PHP script):<br /><br /><code><code>$.post("test.php", { sid: "<?php echo session_id(); ?>" } );</code></code><br /><br />This will POST the current session id through the form. Next on the PHP side, you must set the session id with this posted value:<br /><br /><code><br /><?php<br />// set session to value from ajax post<br />session_id($_POST['sid']);<br />// we now have $_SESSION data!<br />?><br /></code><br />As for security, be aware that you don't have the same restrictions that come with cookies (domain, date, etc.) so once you pass the session id to javascript, be careful what can be manipulated through javascript code. It's pretty much the same as being aware of javascript getting/setting cookie values themselves.<br /><br />Hope that helps!mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com2tag:blogger.com,1999:blog-8861470730700525370.post-46885145388018427222009-10-24T15:04:00.005-05:002009-11-06T15:45:04.623-06:00Being a winning online poker playerYou know you are capable of playing great poker, but you continuously lose your bankroll playing online poker. How do you get over this hurdle? What is the secret? There are two important factors.<br /><br />Factor 1: Don't play on tilt<br /><br />Winning poker is not about focusing on how much you've won or lost. It's how you handle losing. How often do you get bad beat, then jump right back in and lose more and more? How often do you make a big win, only to lose it all over the course of days or weeks?<br /><br />So to overcome factor 1: If you get a bad beat or get on a losing streak, force yourself to take a break before playing again. How long or what this is depends on what it takes to get your mind free of the past. Maybe it's a nap. Maybe it's a walk around the house. Maybe it's a jog around the block. The important element is that you are not playing the next game with the predisposition of steaming. Get over it first, then continue playing.<br /><br />Factor 2: Bankroll management<br /><br />Losing is a fact of the game, it will happen. To stay alive, you must manage your bankroll. This sounds easy, but it can take a considerable amount of discipline. If you don't want to buy in again, you *must* manage your bankroll, no matter how good you are. A rule of thumb for sit-and-goes and MTTs: Take the buy-in multiplied by # of players. If that amount is greater than your bankroll, move down.<br /><br />If you get on a losing streak, just stick to the plan. Take a break, and move down in stakes until you can recover.<br /><br /><br />Follow these rules, and the only way you can lose is by playing bad poker. Hopefully you've gotten past that part :) Good Luck!mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-12247441281986957192009-08-09T16:12:00.004-05:002009-08-24T12:06:05.311-05:00Basecamp PHP APII needed a <span style="font-style:italic;">complete</span> PHP class for the Basecamp API with a project I'm working on at REBEL. Finding nothing that would fit the bill, I wrote one.<br /><br /><a href="http://code.google.com/p/basecamp-php-api/">http://code.google.com/p/basecamp-php-api/</a>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com1tag:blogger.com,1999:blog-8861470730700525370.post-51080901112532091252009-07-26T15:58:00.015-05:002009-07-26T16:27:31.795-05:00A rant on PHP, quotes and variablesHere are 3 ways to display some text with some PHP variables:<br /><br />single quotes interspersed with vars:<br /><br /><code>echo 'My name is ' . $user<br />. ' and I eat ' . $food['favorite'] . '.';</code><br /><br />double quotes interspersed with vars:<br /><br /><code>echo "My name is " . $user<br />. " and I eat " . $food['favorite'] . ".";</code><br /><br />double quotes with embedded vars:<br /><br /><code>echo "My name is {$user} and I eat {$food['favorite']}.";</code><br /><br />The vast majority of PHP code I come across uses the first two methods, breaking in and out of quotes for each variable. IMHO the third way much easier to read and maintain. Granted there are slight performance differences between them, but not enough to be concerned about. I think the reason that version 3 isn't so popular is because most PHP developers don't learn this type of curly-brace syntax (enabling you to embed complex variables into quoted strings) right away, and therefore rarely think to use it.<br /><br />Of course you can take things a step further with sprintf and really keep things tidy. Let's take a SQL query for a common example.<br /><br />Here is the "messy" way:<br /><br /><code>$sql = "select * from MYTABLE where id=" . (int)$info['id'] . " and firstname = '" . mysql_real_escape_string($info['firstname']) . "' limit " . (int)$limit;</code><br /><br />And the much cleaner way:<br /><br /><code>$sql = sprintf("select *<br /> from MYTABLE<br /> where id=%d<br /> and firstname = '%s'<br /> limit %d",<br /> (int)$info['id'],<br /> mysql_real_escape_string($info['firstname']),<br /> (int)$limit<br /> );</code><br /><br />I hope I brought some ideas to light, happy coding.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com0tag:blogger.com,1999:blog-8861470730700525370.post-70025868846669262692009-05-14T11:38:00.005-05:002009-05-14T11:45:58.019-05:00Camera image orientationI was having a confusing problem where images taken from the iPhone camera were being displayed in the wrong orientation. I would take a photo in portrait and save the data to disk. Later when I retrieved the photo it would show up rotated 90 degrees.<br /><br />The iPhone knows what orientation a photo is taken, and this orientation depends on how the camera is being held when you snap the photo. You can get the orientation value on a UIImage from the property imageOrientation.<br /><br />When you save the photo, it is possible that this information could get lost, depending on the way you save it. If it does get lost, the UIImageView will assume the photo was taken as a left-side landscape photo, and display it with that orientation.<br /><br />I ran into a problem when trying to save the camera image with UIImagePNGRepresentation(). For some reason this loses the orientation info. I switched to UIImageJPEGRepresentation() and all is well now.<br /><br />So basically if you run into the problem, you have 2 choices: Be sure you use a format that preserves orientation data, or rotate the UIImage data directly before saving it to a file.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com1tag:blogger.com,1999:blog-8861470730700525370.post-65928303707464262722009-05-13T20:46:00.008-05:002009-05-13T21:02:02.221-05:00Rotating view around arbitrary point the easy wayI have a UIImageView that I want to rotate around a given point. By default, the layer will rotate around the center of the UIImageView. Trying to change this anchor point involves a bit of work, either move at the beginning and reposition all the view elements, or translating the view, rotating, and translating back. The last option works fine, unless you are trying to use core animation to smoothly rotate the view.<br /><br />I found out a much easier solution to the whole problem. You could call it a workaround, but it works well without disturbing the view you want rotated.<br /><br />Basically, you create a new UIView. Place the center point where you want the rotation to occur. Change the size of the view so that the view you want rotated will fit inside. Make your view (you want rotated) a subview of the new view. Now, just rotate the new view, and your subview will be rotated correctly.<br /><br />Example: lets say we have a UIImageView that is 320x480 (the size of the whole iPhone screen). We want it to rotate from the bottom center instead of its middle. Create a new UIView that is 0,0,320,960. This is basically double the height of the screen, positioned so the bottom half is off the screen, which places the center point right where we want it. Now place your UIImageView inside the new UIView in the top half (visible on the screen.) Now when you rotate the UIView, it will pivot on the bottom center of the screen, and your UIImageView will rotate along with it, as expected.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com2tag:blogger.com,1999:blog-8861470730700525370.post-4798117302890310642009-05-01T09:55:00.005-05:002009-05-18T11:55:37.132-05:00OS X "burning" image to USB flash driveI recently downloaded an Ubuntu image for netbooks, and I needed to install this onto a USB flash drive so I could boot it. This is pretty simple with OS X and Disk Utility and dd from the command line. Be sure your flash drive is large enough to hold the disk image.<br /><br />* Plug the flash drive into a USB port and launch Disk Utility.<br />* Select the flash drive and press apple+i to bring up the info<br />* remember the device id, it will be diskN where N is a number, such as disk4<br />* select the volume (not the device) and click unmount.<br />* open a terminal window, and type:<br /><br /><code><br />sudo dd if=/path/to/file.img of=/dev/disk4 bs=1024<br /></code><br /><br />Be sure to use your path to the image file, and the device id you got from disk utility in place of "disk4". You can drag the .img file into the terminal window if you don't want to type the full path to it.<br /><br />Now wait a bit for the image to be written. When its done you will get something similar to this:<br /><br /><code><br />969568+0 records in<br />969568+0 records out<br />992837632 bytes transferred in 521.666371 secs (1903204 bytes/sec)<br /></code>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com2tag:blogger.com,1999:blog-8861470730700525370.post-91450264844467654192009-04-01T16:08:00.007-05:002009-04-01T17:00:21.893-05:00Prediction: First Consumer Petabyte Hard Drive?The first hard drive I owned came with my Amiga 1200, circa 1990. It held 40 megabytes of data, and I believe it was a $500 option. Yes, I said option. The computer happily ran on floppy disks alone, if you so desired. You had to load the OS off of floppy first, then load your programs from other disks. The A1200 came with 2MB of ram, but I loaded it up with an additional 16MB of RAM, costing a healthy $800. That is just sick.<br /><br />Back to the subject of hard drives. Here is a rough time line for the consumer hard drive. By "consumer", I mean something that fits in a desktop PC form factor that is in the price range for an average consumer.<br /><br /><code>1980 5MB ~$1,000.00<br />1992 1GB ~$1,000.00 (1 gigabyte ~ 1000 megabyte)<br />2007 1TB ~$300.00 (1 terabyte ~ 1000 gigabyte, or 1 million megabyte)<br />???? 1PB ???? (1 petabyte ~ 1000 terabyte, or 1 million gigabyte)<br />???? 1EB ???? (1 exabyte ~ 1000 petabyte, or 1 million terabyte)<br />???? 1ZB ???? (1 zetabyte ~ 1000 exabyte, or 1 million petabyte)<br />???? 1YB ???? (1 yottabyte ~ 1000 zetabyte, or 1 million exabyte)</code><br /><br />The timeline between 5MB and 1GB drives was 12 years.<br />The timeline between 1GB and 1TB drives was 15 years.<br />Notice the price drop!<br /><br />So let's hear the predictions. When will the first consumer-ready petabyte drive be available, and what will the average cost be? How aboute exabyte? Zetabyte? Yottabyte?<br /><br />A Yottabyte is a tough one to grasp. That is ONE TRILLION terabytes. Do you think storage space, or personal computing as we know it, will end at some point, long before these outrageous sizes are a reality?<br /><br />If history is any indication, the petabyte drive should arrive in 12-15 years, and average $300 or less. I think it will much sooner, cut that time down to about 8 years. The $300 price is probably close.<br /><br />I also think solid-state disk storage will become the norm, seeing hard drive platters die like the video tape did.mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com6tag:blogger.com,1999:blog-8861470730700525370.post-58926102347340534452009-03-29T19:14:00.002-05:002009-03-30T08:25:04.639-05:00iPhone 2.2.1 available fontsHere is a list of the fonts available to the iPhone as of SDK 2.2.1:<br /><br /><code><br />Family: Courier<br /> Font: Courier<br /> Font: Courier-BoldOblique<br /> Font: Courier-Oblique<br /> Font: Courier-Bold<br />Family: AppleGothic<br /> Font: AppleGothic<br />Family: Arial<br /> Font: ArialMT<br /> Font: Arial-BoldMT<br /> Font: Arial-BoldItalicMT<br /> Font: Arial-ItalicMT<br />Family: STHeiti TC<br /> Font: STHeitiTC-Light<br /> Font: STHeitiTC-Medium<br />Family: Hiragino Kaku Gothic ProN<br /> Font: HiraKakuProN-W6<br /> Font: HiraKakuProN-W3<br />Family: Courier New<br /> Font: CourierNewPS-BoldMT<br /> Font: CourierNewPS-ItalicMT<br /> Font: CourierNewPS-BoldItalicMT<br /> Font: CourierNewPSMT<br />Family: Zapfino<br /> Font: Zapfino<br />Family: Arial Unicode MS<br /> Font: ArialUnicodeMS<br />Family: STHeiti SC<br /> Font: STHeitiSC-Medium<br /> Font: STHeitiSC-Light<br />Family: American Typewriter<br /> Font: AmericanTypewriter<br /> Font: AmericanTypewriter-Bold<br />Family: Helvetica<br /> Font: Helvetica-Oblique<br /> Font: Helvetica-BoldOblique<br /> Font: Helvetica<br /> Font: Helvetica-Bold<br />Family: Marker Felt<br /> Font: MarkerFelt-Thin<br />Family: Helvetica Neue<br /> Font: HelveticaNeue<br /> Font: HelveticaNeue-Bold<br />Family: DB LCD Temp<br /> Font: DBLCDTempBlack<br />Family: Verdana<br /> Font: Verdana-Bold<br /> Font: Verdana-BoldItalic<br /> Font: Verdana<br /> Font: Verdana-Italic<br />Family: Times New Roman<br /> Font: TimesNewRomanPSMT<br /> Font: TimesNewRomanPS-BoldMT<br /> Font: TimesNewRomanPS-BoldItalicMT<br /> Font: TimesNewRomanPS-ItalicMT<br />Family: Georgia<br /> Font: Georgia-Bold<br /> Font: Georgia<br /> Font: Georgia-BoldItalic<br /> Font: Georgia-Italic<br />Family: STHeiti J<br /> Font: STHeitiJ-Medium<br /> Font: STHeitiJ-Light<br />Family: Arial Rounded MT Bold<br /> Font: ArialRoundedMTBold<br />Family: Trebuchet MS<br /> Font: TrebuchetMS-Italic<br /> Font: TrebuchetMS<br /> Font: Trebuchet-BoldItalic<br /> Font: TrebuchetMS-Bold<br />Family: STHeiti K<br /> Font: STHeitiK-Medium<br /> Font: STHeitiK-Light<br /></code>mohrthttp://www.blogger.com/profile/12160903071209543914noreply@blogger.com1