Archive

Archive for June, 2009

Android + Firefox = awesome

June 29th, 2009 No comments

Right now Android apps are written in Java and run on the Android virtual machine.. but now Google has released another SDK (called the NDK) that lets developers write “native” apps in C or C++! This has advantages as the code could be significantly faster, etc.

So this could mean Firefox on Android sometime soon… see here.

Categories: Android, Mobile Tags:

More Android!

June 24th, 2009 No comments

*** UPDATE ***

Hands on with this phone plus some great pictures here.

This thing looks great, and notice at the end of the article… flash player comes standard!

*** ***

HTC announced another Android handset today – the “Hero”

See specs here

A couple of big things jump out at me:

1) Flash support in the web browser
2) 5mp camera with auto focus and video capture
3) The “Hero” OS overlay from HTC.
4) Finally HTC puts in a headphone jack that doesn’t need a dongle

There are plenty of videos on youtube, etc, that show the Hero UI update for Android. This looks pretty slick, nice widgets like real time streaming stock quotes. Plus the look and feel are a bit more polished than the standard Android.

The other standard Android specs are here – Qualcomm 528Mhz proc, HSDPA, wifi, but then they also say “multitouch” screen. That is interesting. There is a custom Cupcake build out there that supposedly enables multitouch, but I haven’t tried it. That would be a nice addition.

I didn’t see price info and there is no official announcement from T-Mo, but the pics on engadget show “T-Mobile” on the screen, so I assume it will be coming. Good news for Android fans, more choices!

Simple UDP

June 23rd, 2009 No comments

There are many reasons why you might need to send data or messages between devices on your network. Maybe you want to control a remote box, or you have a small linux setup running somewhere remotely and you want to sent and receive data. There are obviously several ways to do this, and one is using sockets and UDP.

This code came about when I needed to talk to an embeded CPU in a Xilinx FPGA. I have ethernet on the card as well, and the CPU is setup to handle it. I wanted to send control commands to the CPU from my Linux workstation to verify some functionality. To do this, I have two pieces of code: (1) a “server” that spins on the FPGA and receives the incoming messages, and a “client” app that can send a command to the “server”. This is a trvial example and the code is basic, but you can see how easy it would be to expand as needed.

The Client:

#include 
#include 
#include 
#include 
#include 

void die(char* msg) { perror(msg); exit(1); }

int main(int argc, char *argv[]) {
	int sock;
	struct sockaddr_in server;
	unsigned short int serverPort = 9999;

	sock= socket(AF_INET, SOCK_DGRAM, 0);
	if(sock < 0 ) die("failed to create socket");

	server.sin_family = AF_INET;
	server.sin_addr.s_addr = inet_addr("127.0.0.1");
	server.sin_port = serverPort; .

	char msg[] = "Hello World. ";
	printf("We will send the message: \"%s\" to the server. \n", msg);

	if (sendto(socketDescriptor, msg, strlen(msg), 0, (struct sockaddr *) &server, sizeof(server)) < 0) {
                   die("failed to send message");
	}

	return 0;
}

And now the Server:

#include 
#include 
#include 
#include 
#include 
#include 

#define BUFFSIZE 255
void Die(char* msg) { perror(msg); exit(1); }

int main(int argc, char* argv[]){
	int sock;
	struct sockaddr_in echoserver;
	struct sockaddr_in echoclient;

	char buffer[BUFFSIZE];
	unsigned int echolen, serverlen, clientlen;
	int rec = 0;

	if(argc != 2){
		fprintf(stderr, "USAGE: %s
\n", argv[0]);
		exit(1);
	}

	/* create UDP socket */
	if((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0){
		Die("failed to create socket");
	}

	memset(&echoserver, 0, sizeof(echoserver));
	echoserver.sin_family = AF_INET;
	echoserver.sin_addr.s_addr = htonl(INADDR_ANY);
	echoserver.sin_port = htons(atoi(argv[1]));

	serverlen = sizeof(echoserver);
	if(bind(sock, (struct sockaddr *) &echoserver, serverlen) < 0) {
		Die("failed to bind.");
	}

	while(1){

		clientlen = sizeof(echoclient);
		if((rec = recvfrom(sock, buffer, BUFFSIZE, 0, (struct sockaddr*)&echoclient, &clientlen)) < 0){
			Die("failed to rec mesg");
		}
		printf("client connected: %s\nData: %s\n\n", inet_ntoa(echoclient.sin_addr),buffer);

	}
}
Categories: C, Code, Embedded, Uncategorized, Xilinx Tags: , , , ,

More Power

June 22nd, 2009 No comments

Get ready for insane power in your smart phone… coming soon from Qualcomm:

The future Qualcomm QSD8672 will be a dual-core Snapdragon that features two CPU computing cores and will include HSPA+, up to 28Mbps download speeds, 1080p high-definition video, Wi-Fi, mobile TV, and GPS. The graphics core is based on Advanced Micro Devices’ ATI unit’s technology.

Snapdragon cores currently run at 1Ghz with 1.3 planned and then eventually 1.5. Two of those plus at least one QDSP along with all the other features, in a single chip. Remember that Qualcomm bought the mobile graphics division of ATI, so the new gfx core will something like an entry level mobile computing chip. Someone needs to build a device with the form factor of the Toshiba G01 for a nice big screen and you would have a killer mobile device.

Categories: Qualcomm Tags: ,

BingTones

June 22nd, 2009 1 comment
Categories: Microsoft Tags: ,

New Android Phone!

June 22nd, 2009 No comments

So it’s official, the HTC “Magic” is coming to T-Mobile. Pre sales start July 8th.

I’m pretty excited about this. Mostly because the phone looks SOO much better than the current G1. No info on pricing yet – hopefully the upgrade price isn’t ridiculous. But I’ll definitely be upgrading.

Specs look nice too, running a 7k series Qualcomm MSM with a 528MHz CPU + DSP, 3.2 inch screen, HSPA data, autofocus 3.2 MP camera with video.

The Tale of the 3GS

June 21st, 2009 2 comments

So after ranting about the iPhone 3GS last night, I did something rather funny – I bought an iPhone and ported my number over from T-Mobile and my Android G1.

Here was the deal.. I had an iPod Touch that I was using at work and the gym and all that. It was great for listening to music, pandora, and the slingbox app is killer. I have wifi at work, and my gym as free wifi as well, so I was pretty much set. Oh and I bought the Myst game port because thats just awesome. And then I used my Android for calls and email and all.

Well I was thinking, the Touch cost me $220 and I could just get an iPhone 3GS for $199. The plans were about the same cost, and I figured I could sell my G1 on CraigsList and try to cover most of my contract break fee.

So its been about half a day with the new iPhone and I have to say I’m not completely happy. The apps are great, and I have my pandora and Myst and all that. But I think the big surprise for me is how much it feels like the iPhone is sub par on the messaging and communications aspects than Android. Obviously there is no comparison with the quality and variety of the apps on iPhone, but here are the reasons why I think Android wins for Email/IM/Texting.

1) Exchange. My office mail is exchange and Android does not have native support. However, for $25 there is a very nice app (Moxier Mail) that is active sync capable for push and what not. Its just about as pretty as the iPhone mail app too.

2) PUSH gmail. I didnt think about this much until I started not getting gmail on the iPhone as often as my laptop would notify me that a mail was ready. On Android Gmail notification is faster than having Gmail open on your laptop. On the iPhone the only option is polling, and the shortest interval is 15min. And then you have to worry about batt life if you are goign out and polling Gmail that often all day.

3) IM on Android is great. There is a native gChat app and a native IM app that supports AIM, Yahoo, and Windows Live. The iPhone has no native IM app but there are a few in the app store obviously. The real problem is that none of them can run in the background. There is a free app that will keep you connected when you shut down the app on the phone, and it will send you an email notification when you get a message. but here is the problem with that… I can only poll my gmail account every 15min, so that makes for a lousy IM conversation if I have to wait some amount of time between 0 and 15min to get the next msg. I could use my work address and then have the notification pushed to my phone, but then I’m sending tons of mail through my work address all the time. Abnd then when I open up the mail app I might have a bunch of random emails to delete from notifications. That doesnt sound great. Of course when the Apple Notification enabled IM apps are out things should get better as you get a push notify and can just go open the app. Although even in that case, you have to re-open the app, wait for it to launch, and then wait for it to connect and all that. On Android I dont even have to open the chat program to view the message. An icon appears in the notification area, and I can slide the notification tray open and read the message, and if I click it it opens the IM app and I could respond. I like this method a LOT better.

4) Gmail acts in interesting ways on iPhone. When I compose a new message and start typing a name, the phone doesn’t seem to be aware of my Gmail contacts, it does however give me options from my work Exchange account. This seems really weird. Why would I want to send a mail to a work contact from my non-work email account? Shouldnt the mail app know which account I’m composing from? We have about 15000 employees plus many more mailing lists, and each conference room in every office in the world has an email address. When I started typing my friends name, the suggestion window showed a list of conference rooms as the only suggestions. Android on the other hand is aware of my Gmail contacts and when I start typing “Ma” it suggests “Markis”. This is nice. Also, the iPhone mail app does not group Gmail into conversations like the Gmail web app (which is such a nice feature). The Android Gmail app does. My mail looks exactly the same on the web client or the phone app.

5) Widgets. These are new in Android 1.5. I only use a couple, but I found myself missing them quickly. Widgets are little apps that run directly on your home screen and can do things when clicked or just display info. For example on my main home screen I have a calendar widget that displays the next meeting I have upcoming, the time and the location. If I click the widget it launches the calendar. On another screen I have the google widget. It has a box where I can type a search and then a browser window will come up. And finally I have a weather widget. Its small (the size of 2 iPhone app icons in a row) and it just sits on my home screen and shows me the current conditions.

Also, I have widgets that enable/disable WiFi and Bluetooth. This is super nice. When I’m not at work or the gym or home I dont need WiFi enabled and looking for networks. I can click the widget and turn WiFi off. This is a several click procedure on the iPhone. Ditto for Bluetooth.

6) Also, generally the iPhone OS feels more “dead” than Android. In Android notifications pop up, I can move though programs and swtich between things. On the iPhone, I do one thing with one app… hit the home button to close and then go do something else. Android has this concept of application stacks. If I’m working in one app, and I open another for whatever reason, a message comes in or an email, when I hit the back button the top app screen slides off and I’m back at the last app I was working with.

And then on top of that, I don’t like how some apps have their settings located in the main settings app. For example, weather bug. If I go to settings and scroll down there are the options for configuring it. But I can’t get to the settings when I’m in the app. So if I want to change from F to C temperatures, I have to close the app, go find settings, scroll around, change stuff, go back to the home screen and then launch weather bug again. Urbanspoon, snaptell, and others do this as well. I find it odd.

So here is my great dilemma for the evening. What do I do? The iPhone is vastly superior in the areas of music, games, and nifty apps. But Android is superior in how it handles email, IM, and other communictions.

My thought right now is that I think I would prefer better communication on my phone, and would use the games and nifty apps more when I’m not driving or out running around town. So I;m coming back to the 2 device solution as the winner for me right now. I have the iPod touch at the office so I can listen to music, watch slingbox, etc etc when im in the lab, and then have my G1 for calls and email.

Obviously this isnt an idea solution, and I wish it could be fixed. Apple needs to revamp the look and feel of the iPhone soon or more people might catch on to how out of date it seems to feel compared to Android or Palm’s WebOS. For example, the way icons are arranged on the iPhone is limited. They are in a grid and you can just move them around, but they auto fill up and to the left… Android is also a grid style layout, but I can put any icon anywhere and have blank spaces wherever I want. AND I dont have to have all my app icons out on my home screens. There is a tray tab at the bottom that you can pull up to show all icons and all apps installed. I can drag any that I want to my home screens if I want faster access. This makes even more sense when you can actually have a background image that you see for more than the 3.5 seconds it takes to unlock the iPhone. The black background needs to go…

I actually like the Palm Pre way of doing things even more. You have a task bar along the bottom, and then can open a tray in an Android fashion to apps you dont have in the task bar. And you get a nice clean desktop… and if you have any apps open, they appear as cards that you can swipe between or close. This is one area Android needs to add – an easy way to kill apps, not having to wait for the garbage collection system to kill it off to recover resources. UPDATE: I got a demo Pre from a Sprint store today and used it for about 30min. While it is an impressive device and has a lot going for it, I still prefer Android for now. Mainly because of the lack of apps, but also, the version 1 software seems to be a bit slow. Even though the Pre has the same Cortex CPU as the new 3GS, the system hesitates when launching apps and that was annoying. Also, after 30 min of email, txt, and web surfing I can’t say I’m a big fan of the keyboard, its just a bit too cramped, and there is no option to use a soft keyboard. Although, given how small the device is an on screen keyboard may not work well at all. So, for now, in my book Android is still the winner.

Oh, and one point about the screens between the two devices. I think the iPhone has a slightly better screen, but it look more pixelated due to being the same resolution, but larger physically. Its hard to say if I have a preference. I guess the G1 looks a bit smoother, but the iPhone seems to be a bit brighter and just looks better for some reason (except the pixels).

Another thing about Android are the context menus. Hold your finger down over an item or icon or the background of the home screen and a menu will appear with options. This makes it easy to do quite a few thigns.. and I found myself missing them on the iPhone.

For example, in Android, if I click and hold on a mail item or IM convo or txt message thread, a menu pops up and I can delete the thread. On the iPhone I have to click “edit” and then click the little red icon thing next to the thread and then a delete button appears on the other side and then I click that.

Or, if I’m viewing a txt thread, on the iPhone I have to scroll all the way to the top of the convo to find the “call” button. On Android, I just click and hold any message in the thread from the other person and a menu pops up and I can click call.

If I want to change my background image on my home screen, I just click and hold on the background and a menu pops up with options… one of them is change background. On the iPhone I have to find the settings app icon and launch that then select background.

Right now I’m leaning towards going back to my 2 device solution tomorrow and just deal with the fact that the iPhone doesnt cut it in terms of notifications, IM and email, but it rocks for fun apps and media. And reactivate my G1 so I can have the goodness that is Android for communications.

Setting up an automated workflow to convert files for Apple TV on OS X

June 19th, 2009 7 comments

With the arrival of my Apple TV yesterday I needed a solution to get my Xvix/WMV/Divx files converted and imported into iTunes so that I can watch them. I already have Quicktime Pro, which with the recent release added the ability to “Export to Apple TV”. Since I have a lot of files, and no desire to sit around and convert these one at a time, it seemed like a perfect job for automator. I figured someone out there at some point had to have done something similar so I did a bit of google searching and found the required automator actions. Using the actions I found combined with the sample workflow they have already created for you, it is trivial to set-up a workflow that will convert to the Apple TV format and then import the file into your iTunes library. With a slight modification you can set it up a plug-in and attach it to a folder action. Now I have a simple drop folder on my desktop that launches quicktime pro and converts the file to an Apple TV viewable format, imports the file into iTunes, and cleans up after itself.

Here is a simple step-by-step guide to walk you through what I did:

1) Install xvid, divx, and wmv codecs.

These can be found here:

Divx
Xvid
WMV

2) Install the automator actions for compressing and importing into iTunes.

Download Quick Time Compression Actions and Workflow

3) Once installed you will have a directory on your desktop called “QuickTime Compression Workflow resources”. In this folder you will find a sample automator workflow called “Convert videos and add to iTunes”. Open this workflow in automator.

4) Delete the first step of the workflow which is “Ask for Finder Items”. Instead of being prompted for which items to convert, we want to setup a folder action that will automatically convert the files dropped in our folder.

5) Add a new first step to the workflow called “Get Selected Finder Items”. This action can be found under the “Finder” application.

6) Under the “Compress QuickTime Using Most Recent Settings” step change “Choose directory for converted files” to the desktop (or any other temporary folder you want to use).

7) Create a new folder on your desktop. This will be your drop folder, so call it something relevant. I called mine “Convert to AppleTV”.

8 ) Back in automator, click on file and choose “Save as plug-in”, choose “Folder Actions” from the “plug-in for” drop down. Give the plug-in the same name as your folder. Select your newly created folder for the “Attached to folder” option. Click save.

9) Since the script will convert whatever file you drop in your conversion folder using the last settings you used in QuickTime you’ll need to launch QuickTime with a test file and then choose “Export” from the file menu. Assuming you have the most recent version of QuickTime Pro you should have an option “Export Movie to Apple TV”.

10) That’s it!!! Now just close out of everything and drop your files into your new folder and watch as they are converted and imported to iTunes. It works great to leave your Mac on and then drop a bunch of files in the folder before you go to bed. When you get to your PC in the morning everything should be all ready to go.

To find out more about folder actions, check this page out:

Folder Actions

Categories: Apple, Apple TV, Automator Tags: ,

Automatically backup your Mac to Amazon S3

June 19th, 2009 8 comments

With the new version of OS X (Leopard) Apple has included some great functionality in Time Machine. Your Mac will automatically backup to an external drive every hour. It includes the ability to recover deleted files in a timeline. The one downside to the Time Machine approach is that the data isn’t remotely stored. A couple years ago my wife and I had a house fire where most of our things were destroyed. Fortunately the fire was extinguished before it spread to where our computers were so we didn’t lose any data. If it had been elsewhere in the house it could have been a serious situation for us if we lost all of our digital files.

After the fire I have followed a manual process of backing up our files on an external drive that I store in our fire safe. The problem with this is it requires me to actually do the work, which I often put-off. When Amazon S3 was introduced I immediately saw the potential to use it as an automatic remote backup source. I hadn’t invested much time in it up until now, but I just got a new computer (MacBook Air!!) and while setting it up I thought it would be a good opportunity to get my backup situation in order.

There are some great tools already in existence that can do most of the heavy lifting for you. The primary tool for doing remote directory syncs is called s3sync which is a script written in Ruby. Lucky for us OS X comes with Ruby pre-installed so there isn’t much work to get it working.

Here is my step-by-step guide to getting your machine setup to do automatic daily backups to Amazon. I developed these steps on my MacBook Air running Leopard however they should work for previous versions of OS X as well.

Step 1) First off, your going to need and Amazon Web Services account. Head over to http://aws.amazon.com/ and sign-up for an account to use S3. The prices are very cheap ($0.15/GB/Month). Once you have your account setup you will need two things to use Amazon S3. Your Amazon access key and your secret key. These are what s3sync will use to authenticate you to Amazon.

Step 2) I’ve packaged together a zip file with all the files you are going to need to get this setup along with SSL. Download the file at http://vallery.net/s3backup.zip. You can go to http://s3sync.net/ to see if a newer version if you like but you’ll need to figure some of this out on your own.

Step 3) You need to create a “bucket” in amazon to store your files. A bucket is similar to a folder, however it is globally uniquely named across all Amazon S3 users. In order to create the bucket you are going to need one of the S3 GUI applications that exist. I have included in the zip file the one I have used called “S3 Browser”. You can find the latest version at http://people.no-distance.net/ol/software/s3/. Once you launch S3 browser click on “connection” then “new connection”. You’ll need to provide the access details you got from Amazon in step 1. Once you have connected click the “Add” button which will allow you to create a new bucket. Because the name has to be globally unique I used “vallery-macbookair-backup” where vallery is my last name. Keep track of this bucket name because you need it in the next step.

s3browser.png

Step 4) Once you have the zip file I created downloaded it should automatically extract itself into your downloads folder creating a new folder called “s3backup”. Within the s3backup folder are all the files and scripts you will need in order to get this working. There is one key file that needs to be edited in order to make this all work which is called “backup.sh”. Open the file “backup.sh” and replace the place holder access key, secret key, bucket name with the ones you obtained form Amazon and step 3.

backupsh.png

Step 5) Now that you have all the files ready to go you need to select a place to store them. The application will run as root at the system level in order to prevent file access issues, therefore I recommend storing the entire s3backup folder in your /Library folder. You should copy the entire folder using finder to /Library. There are a few other paths in “backup.sh” that will need to be updated if you choose to store the file elsewhere.

Step 6) You need to setup your Mac to automatically run the backup shell script on a regular interval. There are a couple ways to do this. Since I am Unix guy I immediately started looking at cron. I discovered however that Apple recommends you use launchd for scheduled tasks. It is fairly complex to setup a scheduled task using launchd but thankfully someone has already created a simple GUI that will let you do it. The application Lingon can be used for this. I’ve included the latest version at the time of writing this in the s3backup directory but you can always obtain the latest version from http://lingon.sourceforge.net/. Once you have launched Lingon you need provide some information. Click the “New” button to start a new agent. Choose “Users Daemons” so that the script will run as root and have access to all of the users on your Mac. Once you have created your new daemon you need to give it a name. I recommend something like com.vallery.s3backup where vallery is your name. You need to give the command line action for what to execute. Again, this assumes that you have stored the s3backup folder in /Library. Enter: “/bin/bash /Library/s3backup/backup.sh > /dev/null”. Lastly you need to give it a schedule as to when to run. I have mine setup to “At a specific date” with “Every day” selected and the time set to 4:00am. This is great if your leave your Mac on all the time. You might select a different option so that you can make sure your Mac isn’t in use when it is doing the backup. Click the “Save” button. It will require you to type in your admin password and then restart your computer.

lingon.png

That is it, your system should run the first backup as schedule. It will take a long time initially as the upload speed is limited to your internet connection. Once the initial upload has taken place it will only upload files that are new or have changed going forward. The script is setup to backup everything in the /Users folder. If you would like to limit what is being backed up you can change this to something else.

In the unfortunate event you actually need to get data out of the s3 store there are a number of applications that you can use to do this. Initially I have been using Panic’s Transmit however it seems to have problems with the way s3sync is storing the data. I found another great free app called “S3 Browser” which has worked well for me. You can also use the Firefox plugin S3 Fox.

Categories: Amazon, Apple Tags:

Compare Apple TV shows in standard and high definition

June 19th, 2009 1 comment

With all the news today from Apple, I think one of the most overlooked announcements was that TV shows are available now in HD. HD is sort of a vague term though and just really means higher resolution (more pixels) than a standard NTSC broadcast. They failed to tell us what resolution the new TV shows are actually provided in. Because the target delivery device for the HD content is the Apple TV and it has been documented to have a hard limit of 1280 x 720, we can assume that the resolution is at least less than or equal to this for the new content. The standard resolutions which are used by broadcasters are:

1080p or 1920 x 1080 (progressive)
1080i or 1920 x 1080 (interlaced, which means only have the picture is displayed at a time)
720p or 1280 x 720
480i/p or 640 x 480 in 4:3 mode or 854 x 480 in 16:9

Anything less than 720p and you really can’t call it HD, it is just “enhanced definition” TV.

Here is a handy chart showing the various resolutions in comparison (taken from Wikipedia).

I pulled some screenshots from my iMac playing back an episode of the office. Here is a comparison between the standard definition and the high definition versions of the same scene. The first shot is the standard definition, and the second is the high definition. Click the thumbnail to view the full-size image.

 

If you look in iTunes at the info for “The Office” video files, it is reporting that the resolution of the “Standard Definition” version is 853 x 480 (or 480p) and that the resolution of the “High Definition” version is 1280 x 720 (or 720p). You can see some improvement, specifically around the text on the milk carton, but I don’t really see enough to justify the extra $1.00 per episode.

I’d really have liked to see Apple step up and offer content in 1080p. If they are going to lure me away from my DirecTV service and my DVR, they need to offer me something more compelling. I already get my shows in 1080i and will be getting them soon in 1080p form DirecTV. If they had come out and started offering 1080p content I would be buying all my TV shows from iTunes. As it is I can get higher resolution content for an arguably cheaper price from DirecTV service. Until they can get the massive amount of content, all available in 1080i or greater, I think I’ll stick to my current solution.

Categories: Apple, Apple TV Tags: ,