Multi-touch Kindle

Friday, February 5th, 2010

With the launch of the iPad not far off. Amazon seems to be stirring. Amazon is said to have purchased Touchco. This is the multi touch company whose tech is based of NYUs Department of Computer Science and Technology UnMousepad worked on by Ken Perlin. Does the name ring a bell? You know, the guy that came up with Perlin noise. He has a interesting blog on all sorts of stuff.

Merge Touchco with the latest KDK Beta(Kindle Development Kit) and you might get a decent platform.  Looks like Amazon will be aiming at similar market as the iPad. Now the iPad obviously already has a massive back log of apps from the iPhone. The eBook deals and eBook cost seem to be weighted on Amazons side.

Only time will tell.

Nexus One 3G bug(O2 UK) and Wifi bug

Tuesday, February 2nd, 2010

I was totally stocked to get my Nexus One. When I got the N1 though, it did take some doing to get it working. Here are the issues I found and the solutions to the problems. Now you can find these solutions all over the net but I am just centralizing all the solutions please add any others you have found in the comments and I will update the post.

Problem:
Wifi not getting passed the “Obasdtaining IP” msg and not connecting even though the login details are correct.

Solution A:
This seems to be a temporary issue associated with the specific session of the wireless network. The easiest solution is to reset the router.
Problem:
No 3G or Edge signal at all(this does not mean flaky this means you never get any signal at all). This happened to me on O2.

Solution A:
Find your Carrier APN(Access Point Name) see O2 details below:

Name: mobile web
APN: mobile.o2.co.uk
Username: web
Password: password
MCC: 234
MNC: 10
APN Type: default

What ever details you dont see above leave blank. The settings in the N1 is Settings>>Wireless & network>>Mobile networks>>Access point names>>menu>>add>>ENTER YOUR APN DETAILS (O2 IS ABOVE )

Problem:
My 3G signal is poor. I have signal but its not very good.
Solution C:
Final solution from google fixes 3g signal bug and adds multitouch to all apps:

http://googlephoneblog.net/2010/02/03/force-update-your-nexus-ones-software-to-enable-multitouch/

this will be an over the air update at some point.

Solution B:
Settings>>Wireless & Netowrk>> Mobile networks>>Network operators>>Tap Automatically
The bottom of the screen should you should see Registered. Job done you should see improvements immediately.

Solution C:
Dial *#*#4636#*#*>>Phone Information>>Change ‘WCDMA preferred’ to ‘WCDMA only’ at the bottom of the page. WCDMA is 3G so this setting forces it to only use 3G which means when there is no 3G signal u will get no net coverage. When u make the switch and get your strong 3G signal switch it back to ‘WCDMA preferred’ and you should find that your are still on good signal.

Hope that helps.

Code Based Localisation

Friday, August 14th, 2009

Code Based Localisation in xCode 3.0+ SDK

Code based localisation focuses on any strings you may have in your code. Finding these strings and making them dynamic. This is a contrast to how localisation is done in say Flash where the localisation methods are normally set up by the developer. Kind of like Flex.

If you are after NIB Localisation checkout this post here

Abstract:
A localised project needs a local specific folder that follows a name convention made up of 2 parts. First is the language like “English”, “French” or “Japanese”. The second is the local project abbreviation “.lproj” putting them together you get folders by the name “English.lproj”, “French.lproj” or “Japanese.lproj”. All the local based copy and assets will end up in the respective local folder. You can create these folders manually but I like to get xCode to create them using the localisation functionality built into the IDE.

Basically any text that is set via code needs to be set using NSLocalizedString this takes 2 strings. The first is the the copy that needs localisation. The second string it takes is the comment that appears above the name value pair.  see example:

[c]//use this to set the default copy to "Please enter user name:" in English
self.userNameFeild.text = NSLocalizedString(@"Please Enter your user nsme;", @"user name subbmision copy");
//use this to set the default copy to "Please enter user name:" in french
self.userNameFeild.text = NSLocalizedString(@"Veuillez écrire le nom d’utilisateur:",@"Veuillez écrire le nom d’utilisateur");[/c]

Once you have written your code using NSLocalizedString with all the necessary default copy you will run a terminal script that will pull out the default strings strings to create a .strings file which you would then localise. “genstrings” is the command line tool used to interrogate your .m files to find what needs to be localised.

Once you have your localised .strings file you simply copy it to the different local folders updated the copy to the respective local and bobs  your uncle, its done.

Implementation:

  1. create a new project in xcode it should not matter what type but I will use an iPhone View-Based Application.
  2. add the bellow code to the viewControler of the newly created project to quickly add some uilabels
    [c]- (void)viewDidLoad {
    UILabel *uiLableFirstName =  [[UILabel alloc] initWithFrame:CGRectMake(50, 50, 150, 50)];
    uiLableFirstName.text = NSLocalizedString(@"First name:", @"first Name");
    [self.view addSubview:uiLableFirstName];

    UILabel *uiLableSurName =  [[UILabel alloc] initWithFrame:CGRectMake(50, 150, 150, 50)];
    uiLableSurName.text = NSLocalizedString(@"Last name:", @"sure Name to use");
    [self.view addSubview:uiLableSurName];

    [super viewDidLoad];
    }[/c]

  3. Open the terminal window and navigate too the root of you project folder. This is the folder that contains your Classes folder.
  4. Run “genstrings ./Classes/*.m” in the terminal which will scan every .m file in your Classes folder for any references to NSLocalizedString and added them to a Localizable.strings file which should appear in the root of your project folder.
  5. In the finder navigate to the root of the project folder and then drag and drop Localizable.strings from the Finder to the resource folder in XCode remembering to insure that the “Copy items into…” check box is unchecked. Also make sure that Text Encoding is set to UTF-16 to insure all languages are covered.
  6. Finally press add.
  7. Right-Click the newly added Localizable.strings then select “Get Info”.
  8. Select the General tab from the “Get Info” panel
  9. Click “Make file Localizable”
  10. Click back on the general tab
  11. Click “Add Localization”
  12. Enter your new Locals “French”(from the English name section of the link) and or see here for full list: http://www.loc.gov/standards/iso639-2/php/English_list.php
  13. Once you have added the Locals for Localizable.strings close the “Get Info” window
  14. Run your app go to the settings panel>>Genral>>International change your local and it should display your localised text.

NIB Localisation

Friday, August 7th, 2009

NIB Localisation xCode 3.0+ SDK

There are 2 ways to localizes iPhone application and regular OSX applications. The first is localizing the NIB file. This automatically hard codes the localized copy into a NIB file. This works as of iPhone SDK 3.0 should work on previouse versions and future versions but that was my version at the time.

You can also localise with code but that is not the focus of this point check back for Code based localisation maybe next week.

Abstract:
A localised project needs a local specific folder that follows a name convention made up of 2 parts. First is the Language, like “English”, “French” or “Japanese”. The second is the local project abbreviation lproj. Putting them together you get “English.lproj”, “French.lproj” or “Japanese.lproj”. All the local based copy and assets will end up in the respective local folder. You can create these folders manually but I like to get xCode to create them using the localisation functionality built into the IDE.

NIB localisation works by taking a NIB that was built for one local with all the copy hard-coded into the NIB then scanning the NIB with the command line tool ibtool. Extracting the copy to a strings file. The strings file is then copied and localised for each local. Then another script hard codes the localised strings into the respective NIBs. This process only uses the generated strings files once to get the NIBs localised. Once this is done the Strings files are no longer necessary.

Implementation:

  1. create a new project in xCode it should not matter what type but I will use an iPhone View-Based Application.
  2. open up the view controller NIB in interface builder add some labels and buttons add some copy to them
  3. save and close interface builder
  4. in xCode right click the view controller NIB and click “Get Info”
  5. make sure you are in the genral tab then click “Make file Localizable”
  6. select the “General” tab again as may change after clicking “Make file Localizable”
  7. click “Add Localization”
  8. Enter your new Locals like “French” from the English name section of the link see here for full list: http://www.loc.gov/standards/iso639-2/php/English_list.php
  9. close “Get Info” Panel
  10. open up terminal
  11. navigate to your xCode project folder in terminal
  12. [bash]ibtool –generate-strings-file NIBCopy.strings English.lpoj/LocalizationNIBViewController.xib[/bash]
    1. now we are going to run the command line script above to scan your nib file and generate a strings file below I have broken down the command so you can replace what u need
    2. I will use    ibtool –generate-strings-file NIBCopy.strings English.lpoj/LocalizationNIBViewController.xib
    3. ibtool is the command line tool called Interface builder tool that is installed by default when u install xCode
    4. –generate-strings-file   is the ibtool command that creates a strings file from a nib
    5. NIBCopy.strings is the name I  have chosen for my strings file u can  rename it if you want but maintain the .strings at the end
    6. English.lpoj/LocalizationNIBViewController.xib    is the path from the root of my xCode project folder to the NIB file i want to get scanned you must rename this to match the path and name of your NIB
    7. in your case you should only have to replace the NIB path from sub step 6
    8. so you should end up with something similar to ibtool –generate-strings-file NIBCopy.strings English.lpoj/LocalizationNIBViewController.xib
    9. it is likely that you will get the error “Unable to find either a loadable database or a Nodes.xml configuration file” i get it too don’t worry about it assuming your strings file was generated it will contain the name value pairs from the nib
    10. check to make sure your NIBCopy.strings is created if so move on else go back to sub step one and try again maybe type out the whole request manually in-case copy pasting messed it up a bit
  13. now copy the NIBCopy.strings to the French folder and any other locals folder you have created
  14. update and localise the NIBCopy.strings in the respective folders
  15. once again load up the terminal window
  16. navigate to the root of your project folder in the terminal
  17. [bash]ibtool –strings-file French.lproj/NIBCopy.strings –write French.lproj/LocalizationNIBViewController.xib English.lproj/LocalizationNIBViewController.xib[/bash]
    1. now we are going to run the command line script above to take your NIBCopy.strings that contains your localised copy and hard code it into your localised NIBs
    2. ibtool is the command line tool called Interface builder tool that is installed by default when you install xCode
    3. –strings-file the ibtool command that refers to a strings file
    4. French.lproj/NIBCopy.strings my french localised strings file
    5. –write the command that writes a NIB file based on a Strings file and a NIB file
    6. French.lproj/LocalizationNIBViewController.xib the NIB file that will be writen/updated with the localised copy
    7. English.lproj/LocalizationNIBViewController.xibthe NIB file that will be the template for the localised french NIB file above
    8. it is likely that you will get the error “Unable to find either a loadable database or a Nodes.xml configuration file” i get it too don’t worry about it in fact that is how i know it worked 😉
    9. repeat sub step 1 to 7 for each localised NIB file local
  18. to test this either open up the localised NIB in interface builder or run the app and change the language settings in the simulator or on your developer iPhone
  19. the strings files are no longer needed as the copy is now hard-coded into the NIB

Geocoding Service

Friday, July 31st, 2009

2D Maps, 3D Maps old maps, new maps, satellite maps and every other type of map we have out there. We are living in a time of massively heightened sense of geographic awareness. with this new found need to use and see maps geocoding and referencing is becoming more necessary.

Here is a nice look up database running under the creative commons licence http://www.geonames.org/.

Here is the documentations http://www.geonames.org/export/ws-overview.html the api supports xml and JASON so it should work with any web-enabled technology.

Silverlight Hosting/Streaming Free

Friday, July 24th, 2009

Well Silverlight 3 is here and wow they sure are kicking up fuss at Microsoft. In all fairness the progression made in the span of six to nine months between releases is  truly astounding. They have added an array of features like out of browser support, perspective 3D and graphics card support just to mention some of the headliners.

With every  release of Silverlight I have noticed one relatively unsung hero one could say. Now with H.264 HD video support in SL3 all more need for it. The biggest problem  with video is  the silly amount of money expected for hosting the files and the cost of bandwidth needed for hosting the files. Microsoft saw this problem and resolved it, at the very start of their Silverlight Quest with there FREE Silverlight Live service: https://silverlight.live.com/

The Silverligh Live service has been around since the beginning it address the biggest issue that people have with Flash video content. Simple premise you host your SL3 files on the live servers and you get 10GB of hosting space. 5TB of bandwidth a month at 1.4 Mb/s per stream. With those kinda numbers you should be more than capable of running a rich with media site built on Silverlight.

Whats odd is since its launch I have heard very little about the site. Wonder if a campain is up and coming?

Google Chrome OS

Monday, July 13th, 2009

Anouncment: here

So google are looking to notch up there OS. They have a success full Mobile OS and now they have there sites on something greater.

Google seems to be after the netbook market. Admittedly the netbook market is a bit on the slow side. Armed with knowledge that netbook users who have suffered to date with painfully slow experiences, Google are going to cut down Linux to a insta boot browser.

It is all well and good for the on the go surfer. Let’s hope they have not forgot that geeks also like to buy netbooks. With that in mind lets see if google let you have access to the main App repo and let us put back some of the things they would have removed to speed it up.

Don’t forget the new Nvidia Ion chips. They will bring netbooks on par with some laptops. Linux as a base OS is great because it lets the Geek in side some off us out. Lets hope google does not lock us in.

Extending(Subclassing) UIButton in Objective-C

Friday, July 10th, 2009

After playing around with UIButton class for a while I found Apple have been very sneaky with some  of their UI classes.

What it appears they have done is use the UIButton class as a sort of wrapper for a number of private button classes. “UIRoundedRectButton” is one of those classes.

“UIRoundedRectButton” is a private class so it can not be extended(subclassed). The initilizers normaly return an instance of self and if that self is not the class type trying to hold it there will be trouble. The problem is if you initialise UIButton with buttonWithType the class it returns is a private class. If you try and extended the UIButton once your custom class is initialized it returns a “UIRoundedRectButton” object which is private so you can not contain it.

If you try the code below which uses the description you can see the object description is not UIButton.

[c]UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
NSLog(@"myButton type: %@", [myButton description]);[/c]

In short you can not extend UIButton and initialize it with buttonWithType  in Objective C. On the other hand you can extened UIButton for a button in interface builder. If  you use interface builder you need to use initWithCoder as the initialiser. While interface builder does the private stuff.

Kodu the Visual Programming Language

Monday, July 6th, 2009

Here is an interesting product on XBox Live. Its a games Programing tool with out the coding. If this is a sign of things to come all use Developers will all be out of jobs 😉 Check out the Video!

More Kodu News & Previews

Get here if you want it:
http://marketplace.xbox.com/en-GB/games/media/66acd000-77fe-1000-9115-d8025855024c/

Stackoverflow Inspiration and Learning Event

Friday, July 3rd, 2009

The popular code question and answer site http://stackoverflow.com/ are having a few inspiration and learning events this year. I am keen to see what android and objective-c stuff will be on offer you can get tickets from: http://stackoverflow.carsonified.com/