I’m going to start a new series. I’m going to try to take a couple hours out of everyday to work on this new side project. I’m going to build an iOS application specifically for the iPad. This project will serve 3 purposes;
1. meet a need where the current manga applications on iPad don’t meet
2. to familiarize myself with iOS development
3. to keep my programming and technology fresh.

Purpose: Design and implement a iOS application that will allow a user to receive updates, download, and read Manga titles in a nice looking UI.

Target Audience: iPad only

Technology: Google App Engine (for backend), XCode (iOS development)

Now I’m kind of debating whether I should go with Sencha’s Touch framework, perhaps when I’m prototyping, I’ll use it to see some results.

High Level Flow

I’ve already got a basic architecture down. I’ll be creating a REST service on Google App Engine, which will do most of the heavy lifting. The iOS application will make calls to this service to receive updates about the manga the user is currently reading, if there are updates, and also how to grab the images for each chapter.

the smart way to do a redirect to something more permanent is not to do:

 
//standard re-direct
httpServletResponse.sendRedirect(newTargetUrl);

but do this instead:

//set to 301
httpServletResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
httpServletResponse.setHeader("Location", newTargetUrl);
httpServletResponse.setHeader("Connection", "close");

the difference is that instead of sending a default 302, we are sending a 301, which is more seo and bot friendly. i would suspect that you would only use this in a case where the origination url is always going to goto the new target url, otherwise keep using the regular way.

This is probably an old topic, but I still find others including myself making these mistakes, so I thought I would write about it.

Everyone should know what a singleton is, usually used when you need one instantiation of an object across the system.

The incorrect way

public class BadSingleton
{
	private static BadSingleton _instance;
	
	public static BadSingleton getInstance()
	{
		if(_instance==null)
		{
			_instance = new BadSingleton();
		}
		
		return _instance;
	}
	
	private BadSingleton()
	{
		//do initializations here
	}
}

The double checked locking way

This came about as an optimization for early JVMs, in the modern world – this is a bad practice.

public class VeryBadSingleton
{
	private static VeryBadSingleton _instance;
	
	public static VeryBadSingleton getInstance()
	{
		if(_instance==null)
		{
			synchronized(VeryBadSingleton.class)
			{
				if(_instance==null)
				{
					_instance = new VeryBadSingleton();
				}
			}
		}
		
		return _instance;
	}
	
	private VeryBadSingleton()
	{
		//do initializations here
	}
}

The correct way

public class CorrectSingleton
{
	private static CorrectSingleton _instance;
	
	public synchronized static CorrectSingleton getInstance()
	{
		if(_instance==null)
		{
			_instance = new CorrectSingleton();
		}
		
		return _instance;
	}
	
	private CorrectSingleton()
	{
		//do initializations here
	}
}

Is your gmail getting cluttered? are you nearing the upper echelon of capacity?

Some tips on getting rid of email

  1. Select a message from a sender that you consider to be “spam”
  2. Click More Actions > Filter messages like these
  3. Gmail now creates a nice preview of what kind of messages you have filtered. make sure that these are the ones you want to delete and click next step
  4. then select the delete it check box
  5. Make sure to also select the Also apply to xxx messages
  6. Create the filter, it will then go through and delete all the useless emails
  7. Now delete the filter so you can still receive these emails in the future
  8. Click on trash, which is under the your labels dropdown on the left
  9. Click Empty trash. thats it!

you should now have more valuable email space to store all sorts of goodness.

There are cookies that exist that are not part of the browser. Even if you do a clear cookies from your browser of choice, these cookies still persist. these are cookies managed by adobe flash.

In an article mentioned here, a bunch of companies are being sued because of Quantcast, who basically recreated cookies using the flash system so that they could track users interactions with some big named sites.

So how do we remove those “zombie” cookies? Adobe provides a help page, but the page looks like its a demo when in reality it is your browser’s flash that you are controlling. The page of note is the web privacy one. You can go here to check it out.

What you will want to do is just do a delete all websites to clear your flash cookie cache. now you are back to being an anonymous user.

I was looking at Newegg‘s checkout procedure and it had this cool check box where you could either check all or check none, and then when you clicked on a sub checkbox it would check or uncheck the check all checkbox if it didn’t meet that condition. I re-created the code in JQuery so I could use it on one of my projects.

The HTML markup:

Title
Trinity Mobile Bin Rack
Trinity Stainless Steel Work Table
Trinity NSF 5-Tier XL Heavy-Duty Commercial Chrome Shelving Rack

Ok, if you look at the markup, you’ll see that the table header has a checkbox with the id of ‘chkAll’. Then for all the items I have them with the class ‘chkbox’. It is important to note that the chkAll checkbox does NOT have the class ‘chkbox’.

The JQuery code:

 $(document).ready(function()
        {
			$("#chkAll").click(function()
			{
				var flag = $(this).is(':checked');
				$('input.chkbox').attr('checked',flag);
			});
			$('input.chkbox').click(function()
			{	
				var flag = true;
				$('input.chkbox').each(function()
				{
					flag = flag && $(this).is(':checked');
				});
				$("#chkAll").attr('checked',flag);
			});
        });

So how does it work? I make sure to call the functions only when the document is ready. Once that happens I attach a function to the clicking of the id ‘chkAll’. In this function I first check to see if the current chkAll checkbox is checked or not, if it is then I’m going to immediately make all the class ‘chkbox’ checkboxes to checked and vice versa.

The second function I have is if I happen to click one of the class ‘chkbox’ checkboxes, Again I attach a function to the click event. I use a JQuery expression .each- which is kinda like a foreach loop, which will loop through all the elements that satisfy my ‘chkbox’ class, I then create a variable that AND’s all the other element’s states. When it is done, I am able to determine if the chkAll checkbox should be checked or not.

See the demo

There might come a time where you’ll want to “backup” the song that you own and it happens only to be on youtube.com. A pretty decent solution for that is this site:

http://www.video2mp3.net/

the site is free, void of multiple annoying ads, occasionally it’ll have this one ad which takes up half the screen, but you can just close it, and it doesn’t require you to give away your email address.

Recently on my Macbook Pro, Vuze kept prompting me to update, but for some reason halfway through the install it would say:

Applications/.install4j/inst_jre.cfg
Could not create this file. Should I try again.

I had to search around and thought that it might be a permissions issue kinda like Windows where you run as Administrator. I also thought it was odd that it never asked me for my username/password.

Long story short, to make sure that it updates, you must delete that folder, I used console to delete it.

sudo rm -R .install4j/


Everyone knows that google has pacman, but did you know that if you hit insert coin twice, you can play 2 player?

1st player
arrows

2nd player
up – w
down – s
left – a
right – d