Entries Tagged 'How to' ↓
September 1st, 2009 — How to, iPhone Development
Below is the code to call a number within a function.
NSURL *phoneNumberURL
= [NSURL URLWithString
:@"tel:3053729787"];
[[UIApplication sharedApplication
] openURL
:phoneNumberURL
];
I've tested this call function on both the iphone and ipod. The iphone opens a UIAlert and prompts the user to call or cancel. The ipod ignores the call without causing a crash (same as the simulator)
August 26th, 2009 — How to, UINavigationBar, iPhone Apps, iPhone Development
A quite useful button for a navigation controller with a deep stack would be a home button. It is simple to add.
In your RootViewController viewDidLoad Function
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *homeButton = [[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Home", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(goHome:)] autorelease];
self.navigationItem.rightBarButtonItem = homeButton;
}
That will add a home button in to top right of your navigation controller
Create a function called go home in your rootViewController
// return to root view
- (void)goHome:(id) sender {
[self.navigationController popToRootViewControllerAnimated:YES];
}
This function will pop your view controller to its root view
April 9th, 2008 — CSS, How to, Web Development
This post teaches you how to replace CSS text links with an image and an image hover state.
An example can bee seen here (the icons above the main image)
Before doing this it is a good idea to preload your images with javascript to avoid the get lag that occurs when mouses over the link for the first time.
First lets set up the HTML
<p id="icons">
<a href="#" class="enlarge">enlarge</a>
<a href="#" class="avatarit">avatar it</a>
<a href="#" class="dolike">i like it</a>
<a href="#" class="dontlike">don't like it</a>
<a href="#" class="favorite">favorite</a>
</p>
Note that we gave the paragraph an ID and each anchor tag has its own specific class
Lets move onto the CSS
p#icons a{width: 67px; height:21px; text-indent:-9000px; display:block; float:left; margin-right:4px; margin-bottom:4px; }
p#icons a.enlarge{ background:url(http://kilroylives.com/images/buttons/enlarge.gif) top left no-repeat; }
p#icons a.dolike{ background:url(http://kilroylives.com/images/buttons/likeit.gif) top left no-repeat; }
p#icons a.dontlike{ background:url(http://kilroylives.com/images/buttons/dontlike.gif) top left no-repeat; }
p#icons a.avatarit{ background:url(http://kilroylives.com/images/buttons/avatar.gif) top left no-repeat; }
p#icons a.favorite{ background:url(http://kilroylives.com/images/buttons/favorite.gif) top left no-repeat; }
p#icons a.enlarge:hover { background:url(http://kilroylives.com/images/buttons/enlarge-over.gif) top left no-repeat; }
p#icons a.dolike:hover { background:url(http://kilroylives.com/images/buttons/likeit-over.gif) top left no-repeat; }
p#icons a.dontlike:hover { background:url(http://kilroylives.com/images/buttons/dontlike-over.gif) top left no-repeat; }
p#icons a.avatarit:hover { background:url(http://kilroylives.com/images/buttons/avatar-over.gif) top left no-repeat; }
p#icons a.favorite:hover { background:url(http://kilroylives.com/images/buttons/favorite-over.gif) top left no-repeat; }
Notice the first line of CSS I set all the anchor tags in the paragraph to a certain height and width. I did this because all my icons were the same. If you images vary, use individual height and width sizes in the individual link classes. Most likely all your images will have the same height, so use that first line to shave some code.
Also in that first link I set display to block. Doing this allows me to have the text I wrote in the anchor tags to be negative indented so it isn't seen by the common user. Doing so make it legible to the seeing impaired which is Section 508 compliant and good in general for search engines!
Setting display to block forces each link to break down, so float is set to left to have them show up on the same line.
Each anchor class has a background field, this is where you put the image you want to load. under the anchor classes :hover state, put in the hover image. If you wish not to have a hover image remove the :hover line.
It is good to preload the images you use because there will be lag from the CSS loading the image for the first time. Learn to preload with javascript here.
March 15th, 2008 — Hacks, How to



So I understand this may deviate from the usual geekdom found here but we’re car nerds too and well this applies. I drive a 2004 Subaru WRX. It comes with a turbo’ed 4 cylinder boxer engine with 227 HP and 217 TQ at the crank. So I purchased a Cobb Accessport for my 2 liter engine. http://cobbtuning.com/products/?id=3264 This is an ECU map loader and reprogrammer. On a stock WRX it promises 30HP and 43TQ on a 2004 WRX. This is a huge difference and while you get more power most people have reported smoother acceleration and actual better gas mileage under normal use. The device isn’t cheap at $695 but the build quality and service that comes along with it are excellent.
Using the Accessport is unbelievably simple. There are two green plugs under the driver’s side dash that you need to connect to enable “Test Mode”, then using the supplied jumper connect one more plug. The accessport plugs into the OBDII port on the car and then fires up. The accessport automatically backs up your current ECU configuration and then allows flashing of a new map. It comes preloaded with a few maps and then there are many more on Cobb’s site that are available, and can be loaded via USB.
The list of features for this device is crazy, not only can it load maps and flash the ECU, it has maps for high gas mileage, valet mode (i.e. no power) , theft mode (where the car won’t start) , Performance calculations for 0-60 and ¼ mile times, live data including --- boost, RPM, Coolant Temp, Intake Air Temp, MAF sensor, Ignition Timing, MPH, and many more I’m probably forgetting. Another great feature is the ability to view and clear CEL codes for the car. This saves a trip to the dealership/AutoZone and also is indispensable when modding a car, just to see if you screwed up.
I flashed the Stage 1 map for 93 octane and the entire process took under 10 minutes. Immediately when I started it up it idled really rough so I let it run for 15 minutes or so and it seemed to even out. There was a definite performance difference and I could tell this was well worth the money. After a few days of driving it continued to improve and the car runs better, shifts cleaner under heavy acceleration, and accelerates faster. I’ll check back in after a week or so because it is supposed to continue to improve and relearn the fuel curves as I drive.
Pics-
Accessport
Accessport In box
Accessport In box 2
Accessport - Wiring This picture shows the underside of the drivers side dash. The bright green connector you see on the right is the connector that needs to be plugged in to enter "Test Mode" and the black connector you see right next to it is the one that needs to be jumped in order to flash the ECU.
Accessport - OBDII This is the Cobb connector plugged into the OBDII port, you can see the mini-usb plug on the bottom for connecting to the unit.
Accessport - Flashing This shows the Accessport all plugged in to the OBDII port using the connector in the last pic. You can see the change map screen to choose what gets flashed to the unit.
Accessport - Live Data Here you can see the live data view. Leaving the Accessport plugged in while driving allows you to monitor a wide variety of stats through the ECU. Here you can se the Air/Fuel ratio as I'm sitting idling.
February 27th, 2008 — How to, PHP
Striping the file extension is valuable on many levels. If i could have a nickel for every time I need to strip the file extension I'd have close to 3 bucks. One method to achieve stripped extensions is the PHP substr(), which takes in the String, Starting point, Ending point. To start from the end of the string use negative values. i.e. substr("my chicken", 0, -2) would make it "my chick", perfect
<?php
$my_file = "foobar.jpg";
$my_file= substr($my_file, 0 , -4);
echo $my_file;
?>
Result: foobar
Note: Spaces count, so count them!
December 25th, 2007 — Electronics, Hacks, How to, Mods, PC, Windows XP, software
So running the calibration tool is pretty easy, just follow the included directions but note, on a dual monitor setup run it on your primary monitor first. The one marked “1” in the display settings. After the tool completes its going to install an application that runs on startup and makes sure the correct profile is loaded. This profile will be put in the directory I stated above. Now after this is done, go into that directory and rename the profile. I renamed mine from Spyder2Express.icm to Spyder2Express_right.icm and when I do the left monitor I will rename that one ‘_left’.
After this you’ll want to take your monitors and switch the primary monitor to your secondary. This way you can run the software on the other monitor now. Restart the machine and once the new primary monitor is set run the Spyder2Express
again. This profile will be in that same directory with the default name again. Rename this one to something, i.e. “_left”. And you’re done with the calibration tool.
Now after this I go into our color control software, be it Vista’s built in software or our downloaded applet for XP, and I select one of the monitors listed (if you have different makes and models this will be easy, if they are the same it’s a bit of guesswork) and associate it with one of the profiles made, either the _right or the _left profile. Now select the other monitor and associate with the other profile. After applying these changes restart your machine. When the Spyder2Express
Software loads up you *should* see a message on each screen where it is loading up the color profile. Now in the silly case where you have two of the same monitor and the color profiles have switched ( you see the _left profile loading on the right) go back into the applet and switch the profiles.
TADA…your done ....email me or post comments on any problems/questions
December 25th, 2007 — Electronics, Hacks, How to, Mods, PC, Windows XP, software
After buying a second 22”Samsung LCD 226BW
. I bought the first one around a year ago, right in the middle of the big panel debate (if you don’t know what I’m talking about search for that model monitor and “S panel”.) Basically Samsung outsourced its panels to a few other manufacturers and while they weren’t “bad” monitors, the Samsung made panels were far better. I got lucky and my original monitor turned out to be a S panel and I have been insanely happy with it.
Flash forward to now, I order a second monitor and receive an “A panel”. While the monitor is very good quality, no stuck pixels, etc there is one problem. The monitor has a SEVERE blue tint to it under normal setup. Using the built in color adjustment I robbed the monitor of almost all blue color, from a setting of “50” to a setting of “5” and there was still a pronounced blue tint. Doing what any normal person would do I decided to spend more money and get a monitor color calibrator.
I wasn’t aware they had dropped so greatly in price, and after searching Amazon.com I ordered this Spyder2Express
.
Now after ordering I noticed a serious problem, this product only works on a single monitor. You need the $160 device to support dual monitors. So after a little searching and a little playing I figured out there are ways around it. So here I’m going to outline how to use this with dual monitors on Windows Vista and XP.
PreReq’s :
Windows Vista comes with a built in utility to manage color profiles where as Windows XP does not. Usually color profiles end with a *.icm file extension. These are stored in x:\WINDOWS\System32\Spool\drivers\Color on both a Vista machine and an XP machine.
So if you have windows XP grab the “Microsoft Color Control Applet”, it can be found here Microsoft Color Control Applet and its provided straight from Microsoft. With this applet you get the same control that they now built into Vista. This applet gets installed into the Control Panel. So before you go and run a Spyder2Express there are some things you should know. First uninstall Adobe Gamma, or any type of color profile management software. Including the monitors software i.e. Samsung. After this you’re ready to run the color calibrator.