Wednesday, August 6, 2014

How to save to a text file in Python

Saving to a text file can be very useful when database access is restricted and data needs to be saved.

In Python, this can be accomplished with just a few lines of code.

file = open('MyText.txt','w')
file.write("Name\nAddress\n")
file.close()


Now, if you check the file directory, your file will be there.

Check out my car app for iPhone in the iTunes App Store

Thursday, July 31, 2014

Orientation tutorial with JQuery

Detecting a device's orientation change is very useful when an image has to change or other event is necessary when designing a mobile site or building an app.

All that is necessary is just a few lines of code.

$(window).bind('orientationchange',function(e) {

    switch(window.orientation) {

         case 0:
              alert("device rotated");
         break;
         case 90:
              alert("device rotated again");
         break;
         case -90:
              alert("device rotated yet again");
         break;


}


});


Check out my new car app for iPhone in the iTunes App Store

Tuesday, July 29, 2014

How to open email program within iPhone app

Sometimes within an iPhone application, it might be necessary to open the phone's default email client.

In order to do this, all you need are just a few lines of code.

First, create your method in the header file.

-(IBACTION)openEmail;

Next, build it out in the implementation file.

-(IBACTION)openEmail {

[[UIApplication sharedApplication]openURL;[NSURL URLWithString:@"mailto:test@test.com"]];


}

That's it.

Check out my car app for iPhone in the iTunes App Store

Saturday, July 26, 2014

How to change UIButton text for iPhone app

Although it's very simple, most developers new to the iPhone SDK wonders how to change the UIButton text with Xcode and not just in interface builder.

Well, I will show you how below.

In your header file create an instance of UIButton.

@property(nonatomic,retain)IBOutlet UIButton *button1;

Next, go to your implementation file.

@synthesize button1;

With the viewDidLoad method the text can be changed with the following code:

[button setTitle:@"About Us" forState:UIControlStateNormal];

I hope this helps. Have a great weekend!

If you get a chance, please check out my car app for iPhone in the iTunes App Store.

Friday, July 25, 2014

How to set a cookie in PHP

Setting a cookie in PHP is very easy and takes just a few lines of code.

If you are authenticating a username, you could use this code below to set a cookie.

<?php

$username = $_POST["username"];

if ($username == "test") {

setCookie("cookietest");
echo "You are logged in";

} else {

echo "Please try again";

}

?>

I hope this helps your general knowledge of how to set a cookie in PHP

Check out my car information app if you get a chance


Tuesday, July 22, 2014

Duck hunting game for iPhone

Duck season is now year round! At least, it is for those who download Bayou Duck Hunter. This exciting game tests your preparation, timing and shooting skills along beautiful landscapes. Bayou Duck Hunter contains multiple levels for those skilled enough to move past the beginner stage. Bayou Duck Hunter also uses terrific sound effects to enhance the user hunting experience. After completing the bonus round, see how your score ranks against other players. Download today and make every day a part of hunting season!

Duck hunting game for iPhone in the iTunes App Store

Monday, July 21, 2014

PHP functions tutorial

Below is a brief tutorial on how to use PHP functions. The purpose of functions is to run a series of statements without having to duplicate the code several times. This makes your program neater and easier to interpret.

Here is an example:

<?php

class test {

public function hello() {

echo "hello world";

}

}

$test1 = new test;

$test1->hello();

?>

Your browser should read 'hello world'.

Check out my car info app in the iTunes App Store