Tuesday, April 23, 2013

IIS7.5 Handler mapping issues and 502 errors

Recently, I turned on IIS components feature in the add/remove components under the Add/remove programs feature on a brand new windows 7 box.

The new windows 7 was stock and had the latest .NET frameworks available, but IIS was not configured.

I attempted to published a WCF service to my local host, after jumping through a few hoops, I was able to publish the WCF service to my local host.

Then, I saw that none of the handler mappings were installed nor the modules nor the default modules for .aspx or .svc files.  No wonder, my wcf service was not running.

After some research on the net, thanks to google. I found that that TURNING ON IIS COMPONENTS IN THE ADD/REMOVE PROGRAMS does not install or register the ASP.NET components. I had assumed all of them would automatically be installed, but not.

So, it was a simple matter of navigating to c:\windows\microsoft.net\framework\version\and running aspnet_regiis.exe -i.

That was it, my WCF service started working.

Enjoy, hope this titbit helped others.

Monday, February 11, 2013

iOS app - Junior Math published

Apple approved my latest app for Kids.

I had designed and developed an app for kids to learn math in a fun way.

Junior Math:-

The app comes in two flavours.
Junior Math Free with ads - Download it on the App store

Junior Math Paid with no ads

Saturday, December 29, 2012

Apple Mountain lion - how to find users directory

I had to navigate to the Users directory on my Apple Mountain Lion OS. 
I saw that the users directory was hidden and was not accessible.

After some googling, i found it to be easy.

1.) Simply open up finder
2.) Press  < shift > + < command >  + G
3.) This will open a open folder dialog box and you can key in the name of the folder.


Friday, December 28, 2012

iOS Attaching a text file to email

Continuing my previous post about creating a text file iOS.
Refer to the post here.

Now that the file is created, you want to read the file and send it as an attachment.

NSString *fileName = @"yourfile.txt";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

//your app directory will be always be the first one
NSString *directory = [paths objectAtIndex:0];
NSString *path = [directory stringByAppendingPathComponent:fileName];

//now get the data here.
//Not sure, if this is a good idea. Especially if the data is //huge
//better idea might be to open a file handle and read it line by //line
NSData *myData = [NSData dataWithContentsOfFile:path];

//email component
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];

[mailer addAttachmentData:myData mimeType:@"text/plain",filename:fileName];

//that should be it.

iOS: Appending to an existing text file

I wanted to make an update to one of my iOS Apps.
iOS Book Organizer

Many users have asked me the ability to export all the saved book data in the app. I started researching into how to write data to a text file and then email the file.

I found that it is not that straightforward to append to a text file on iOS. Most examples I read told me to write the data in one swoop.  

I am hesitant in reading all the data to memory and then attempt to write the data in one big swoop. After due research, I think, I have an answer to this problem.

>> read data from your sqllite database or from the ui.
>> if there is multiple records in your database, loop through the data.

>> Before you loop through, create the file

//get the documents path
NSArray *documentsPath = NSSearchPathForDirectoriesInDomain(NSDocumentDirectory, NSUserDomainMask,YES);

//your document folder is the first one in the array list
NSString *yourDirectory = [documentsPath objectAtIndex:0];

//create your file here.
NSString *yourfile = [yourDirectory stringByAppendingPathComponent:@"booklist.txt"];

//create a file handle
NSFileHandle *yourHandle = [NSFileHandle fileHandleForUpdatingAtPath:yourFile];

//loop through ur data
//for every iteration

[yourHandle seekToEndOfFile];
[yourHandle writeData:[yourString dataUsinigEncoding:NSUTF8StringEncoding];

//keep writing.
//after all the data is written.

[yourHandle closeFile];

Your text file is now created with your data.

Next post: How to read from this file and attach it to an email.

Wednesday, September 29, 2010

Enable remote connection to Sql Server 2008

Recently, I had helped install a new instance of Sql server 2008 on a windows 2008 server.
The install went fine. However, I noticed that the sa account is disabled by default. This is a new feature in sql server 2008. 

You will have to login to the server as an administrator not as user with administrator rights, but as an administrator to make any changes to the sql server configuration. Once the necessary changes are made, any users with administrative rights can login and make other changes.

By default, all the ports are closed. So, you will have to go to windows firewall, add a new role to open the port for 1433. Name the rule as sql server port. Once the port is enabled, remote clients can make connections to the sql server 2008.

Port 1433 is not opened by default, even if an active instance of sql server 2008 is running on the server, it has to be manually opened via the firewall.

Thats my tip for the day.

Wednesday, September 22, 2010

iPhone SDK: MoreNavigationController

For those of you, who have more than 5 tab bar items in an iPhone Tab bar controller app. You will have noticed that the SDK automatically adds a More Tab bar item and adds all the subsequent views to a table controller.  And if you click on the More Tab, you will get the options to Configure and Edit.

This is ok for the most part. However, if your views have a custom Navigation bar item at the top of the view, having a More Navigation bar at the top and your navigation bar below it can prove to be annoying and does not lead to a nice user experience.

You can customize the More Navigation controller by the following. In your app delegate file, 
add the following lines of code in the method

-(bool) application.....didFinishLaunchingWithOptions: (NSDictionary *)......

//this hides the more navigation bar, you will have to write your own logic to navigate back to the previous view.
tabBarController.moreNavigationController.navigationBar.hidden = YES;

[window addSubView: tabBarController.view];
[window makeKeyAndVisible];


iPhone SDK : viewWillAppear

iPhone View management is really interesting. For instance, if you have a tab bar controller application and you have multiple tab bar items.

iPhone on launch of the app will automatically parse & compile all the ViewDidLoad methods across all the tab bar items. 

However, based on certain user input in one tab bar item, you might want to change the content of the another tab item, iPhone by default does not allow it. Because the ViewDidLoad method fires only once and if your code to change the content is in the ViewDidLoad method, it will never get fired till the user closes and re-opens the app. With the new iPhone 4.0, all the applications remain in the background. So even if the user closes the application by pressing the home button. The view does not get refreshed at all. More about that at a later point.

You can always force the view to refresh itself by adding your code to the method
-(void)viewWillAppear:(bool) animated
/*write your code to refresh your content*/

viewWillAppear is guaranteed to fire everytime, the view appears. 

Example: In one of my apps, I had an option to change certain items in the configuration view, all of my other views in the tab bar controller would not get refreshed to read the changed items in the configuration view unless i had a button to refresh the view content. Putting my refresh code in viewWillAppear did the trick. Now all my views get refreshed in real Time.

For those of you, who want to see this in action, download my app at

Have fun folks.

Friday, September 17, 2010

Ashtothram -- my first iPhone app and the most popular of all my apps


As per Hindu mythology, it is considered auspicious to pray to a specific God on each of the week days. There are 7 days in a week, hence 7 Gods. Each of the Gods have 108 sanskrit names (ashtothram). The app displays all the 108 names for each of the Hindu Gods. The users can simply pick day of the week and read/scroll through all the 108 names.  

Transformer Calculations -- iPhone App

my iPhone app to calculate transformer values

Wiki Xfmr is an app for basic calculations related to transformer. It has five options. 1) Ratio 2) Current 3) No Load Loss Conversion 4) LoadLoss Conversion 5) Efficiency Calculator 
1)Ratio Calculate ratio of the transformer for nominal voltage and for all the taps by entering the primary and secondary voltage of a transformer.Enter the number of plus side taps, minus side taps and the taps percentage. For example - primary of 12470 with +2-2 Taps at 5% apart. will have 4 taps 2 above 2470 and 2 below 12470. Tap the ratio button to calculate the ratio with standard 0.5% tolerance. 

2)Current Calculate the rated amperes, and short circuit capability of the transformer by entering primary voltage,secondary voltage,kva and percent impedance. 

3) Load Loss Convert the loadloss from one temperature To to a new temperature by entering individual winding losses and stray losses . Select the material of the winding for accuracy. 

4)Noload loss Convert noloadloss from one temperature to another using this screen. 

5) Efficiency Efficiency of the transformer can be calculated by entering kva,losses, power factor and load factor. For 50% load choose 0.5. Please send us your comments, so we can refine the application. Use the application at your own discretion. We are not responsible for any consequences related to the usage of the formulas.
An Email and clear option exist for all the screens. Users can now email the calculated results. They can also clear the results. The app will compose an email message containing the input values and the result values and prepare a email draft. More features coming soon.