Few Elegant solutions from Apple (present and future)

Looking at the various patents and products from apple I believe they are most innovative people in the world (of computers& devices).

(Note:Click images to explore more)

iPod Shuffle's VoiceOver SolutioniPod shuffle with VoiceOver icon.
VoiceOver solution provides, a voice based menu to the iPod listeners. Solution looks quite great and you might end up thinking that iPod shuffle has TextToSpeech functionality. But answer is NO. iPod shuffle is still a device which can just play an audio file. The menu items come from the another audio-file which has been synced into your device thru PC. Today your PC is capable of TextToSpeech, iTunes will use this to get the small audio file, which will be the sound of SongName, Artist and etc. (textual information resides in your mp3 file).

 

Movement-Aware Interfaces for iPhones


Isn't It Great to make your icons bigger, when you are jumping or running while using your iPhone. I think  YES,  iPhone will use accelerometer to resize its menu and  other UI elements. 

USB device ejection touch sensor


How annoying is it to do several click on your PC, just to eject your USB device? Its solved!! Apple's USB devices will be having a small sensor to know that when you are going to hold your USB device and probably your intension is to plug-out.

Haptic Feedback for touch screen


Touch screen helped us to utilize the same physical space for different functions. awesome!! But reality is, user never sees what he is going to touch. This is not a problem in hardware keys, because they are embossed and they can be felt. Many other companies have brought the haptic feedback already, but that's actually a joke, they actually vibrates the phone's vibrator when you will tap(or touch). Here is a patent from apple which is going to materialize the haptic feedback in real sense.

Device Settings In smart Headsets


Don't your think EQ (equalizer) settings are more related to your output device than your iPod. YES,  then Apple has made it simple, now there will be smart headsets which can store EQ settings.

2 Steps to make your (blogger based) blog translatable.

Here are the 2 step to make you blog translatable, Like this.

STEP-1
Grab This code
<script src='http://www.google.com/jsapi' type='text/javascript'></script>
<script type='text/javascript'>
google.load("jquery", "1.3.2");
google.load("language", "1");
</script>
<script src='http://jugad.googlecode.com/files/translate.js' type='text/javascript'> </script>

STEP-2
Go to blogger, and "Edit Layout" Section, and choose "Edit HTML".
In Head Section just paste the above code, Save and exit.

Optionally You can also add a title less Gadget of type "HTML/JavaScript" and paste the above code. But it might not work all the time.


Please feel free to leave comment if its not working with you.

For the advanced Users:
I have created a Unobtrusive JavaScript code, Here
This requires Google Language API & jQuery.
First two script block above is to bring jQuery in your blog and then my script to produce a translate "combo box", which can be used to translate your blog.

Demo: Click Here
Source: Click Here

Quick and Dirty Way of Buffer Serialization in C#

This article will tell you to get raw buffer from the c# structure. Basically C# is a TypeSafe language, it never lets you to access byte-stream of any managed object. But You can still make a raw buffer using Marshal.StructureToPtr Method . Today, In this article I will introduce you to new serialization format called QP-Encoding(Quoted-Printable Encoding). QP-Encoding is old encoding style, but known to very little people. Its very simple to understand.
Its a string formed from Raw buffer, whose every byte is represented by '=XX' way. In QP every byte is represented by =and followed by the 2 character of Hex which tells you the value of that byte. BUT if byte is printable it will be printed as it is.

For Example: a buffer whose byte sequence is 41,4A,4F,08 Then QP could be =41=4A=4F=08 but since 41 4A and 4F is printable character you can also write as ")JO=08" (as a better QP)

Using marshalling technique here you can transform any(almost any) c# managed object into QP string using following function
static public string SerializeBuffer(object obj, ref int size)
{
size = Marshal.SizeOf(obj.GetType());
IntPtr ptr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(obj, ptr, true);
byte[] byteArray = new byte[size];
string encode_qp = "";
for (int i = 0; i < size; ++i)
{
byte b = (byte)Marshal.ReadByte(ptr, i);
encode_qp += "=" + b.ToString("X2");
}
Marshal.FreeHGlobal(ptr);
return encode_qp;
}
This is How you can DeSerialize
static public void GetDeSerializedBuffer(ref object Obj, ref string QPData)
{
int size = Marshal.SizeOf(Obj.GetType());
IntPtr ptr = Marshal.AllocHGlobal(size);
for (int i = 0; i < size; i++)
{
Marshal.WriteByte(ptr, i, ReadByteFromQPString(ref QPData));
}
Obj = Marshal.PtrToStructure(ptr, Obj.GetType());
Marshal.FreeHGlobal(ptr);
}