Tuesday, December 29, 2009

BlackBerry Security Permissions

If you are eager to find out about BlackBerry security permissions and ways to handle prompts following video from BlackBerry will help you in understanding the basics of it.

http://www.blackberry.com/DevMediaLibrary/view.do?name=SecurityPrompts

Further more if you are seeking ways to change application permissions using code, following link will help you to get more details of the Application Permissions class from RIM device API.

http://docs.blackberry.com/en/developers/deliverables/6022/net/rim/device/api/applicationcontrol/ApplicationPermissions.html#PERMISSION_INPUT_SIMULATION

Monday, December 28, 2009

Disabling Date-Time Changes

Do you know that you can programmatically stop the user changing the date and time of a Pocket PC device?

This is useful if your applications need to take time accurately for some reason from the device.

The following code will disable the user from accessing the date time changing settings using his Windows Mobile powered device.





  1. private void btnDisableClock_Click(object sender, EventArgs e)
  2. {
  3.     RegistryKey hklm = Registry.LocalMachine;
  4.     hklm = hklm.OpenSubKey(@"\Software\Microsoft\Clock\", true);
  5.     System.Byte[] offValue = new byte[1];
  6.     offValue[0] = 0x30;
  7.     hklm.SetValue("AppState", offValue);
  8.     lblTitle.Text = "Change Clock Status - Disabled";
  9. }




 

If you want to re-enable the setting, to make the user able to change the data and time use the below code.





  1. private void btnEnableClock_Click(object sender, EventArgs e)
  2. {
  3.     RegistryKey hklm = Registry.LocalMachine;
  4.     hklm = hklm.OpenSubKey(@"\Software\Microsoft\Clock\", true);
  5.     System.Byte[] offValue = new byte[1];
  6.     offValue[0] = 0x11;
  7.     hklm.SetValue("AppState", offValue);
  8.     lblTitle.Text = "Change Clock Status - Enabled";
  9. }




Saturday, December 19, 2009

Boeing 787 - DreamLiner

Boeing's newest plane 787 DreamLiner had made its first flight. As of Boeing this is a great achievement and a history changer.
View the video and lots of other details at New Air Plane and Boeing.

Sunday, December 13, 2009

Disabling Right Click

To disable right click context menu you can use one of the following methods.


Method 1 – Using attribute oncontextmenu attribute of the body tag.
By using this you can block the right click action and the context menu without using JavaScript.





  1. <body oncontextmenu="return false">




This will be useless if you need to do some action on the click. In such a case use the Method 2.

 

Method 2 – Using JavaScript.

Place the following JavaScript and modify the script as you need. This will just show a popup window to the user saying that Right clicking is disabled.





  1. <script language="javascript">
  2.     document.onmousedown = disableRightClick;
  3.     function disableRightClick(e) {
  4.         if (event.button == 2) {
  5.             alert("Right click is disabled.");
  6.             return false;
  7.         }
  8.     }
  9. </script>




Tuesday, December 08, 2009

Finding the Image Format

Here is a small code that I wrote to find the image format of an image.

This code will check for the raw image format of the image you select and will display in a pop up window.

Hope this helps.





  1. using System.Drawing.Imaging;








  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3.     openFileDialog1.ShowDialog();
  4.     Image img = Image.FromFile(openFileDialog1.FileName);
  5.     ImageFormat imgfmt = img.RawFormat;
  6.     if (imgfmt.Equals(ImageFormat.Bmp))
  7.         MessageBox.Show(ImageFormat.Bmp.ToString());
  8.     else if (imgfmt.Equals(ImageFormat.Jpeg))
  9.         MessageBox.Show(ImageFormat.Jpeg.ToString());
  10.     else if (imgfmt.Equals(ImageFormat.Tiff))
  11.         MessageBox.Show(ImageFormat.Tiff.ToString());
  12.     else if (imgfmt.Equals(ImageFormat.Wmf))
  13.         MessageBox.Show(ImageFormat.Wmf.ToString());
  14.     else if (imgfmt.Equals(ImageFormat.Icon))
  15.         MessageBox.Show(ImageFormat.Icon.ToString());
  16.     else if (imgfmt.Equals(ImageFormat.Png))
  17.         MessageBox.Show(ImageFormat.Png.ToString());
  18.     else if (imgfmt.Equals(ImageFormat.Gif))
  19.         MessageBox.Show(ImageFormat.Gif.ToString());
  20. }




Saturday, December 05, 2009

Rapping Flight Attendant

If you have flown in aircraft's you may definitely have heard of the in flight safety announcements made by the flight attendants. But have you paid enough attention to it?
Anyway I bet that you have never listened to anything like this before.

This is David Holmes, a flight attendant of Southwest Airlines who is known as rapping flight attendant who came up with a nice idea.
Enjoy.
http://www.youtube.com/watch?v=rhMOnr0GxU8&feature=related
http://www.youtube.com/watch?v=yiXGm_TiRVQ&feature=related
http://www.youtube.com/watch?v=7P2-vEtXSug&feature=related

Tuesday, December 01, 2009

Remember the Old Days

Thought to add the following photos in remembrance of AirLanka which was Sri Lankas national carrier before being renamed to SriLankan.