Yet another blog

Friday, December 23, 2011

In my BlackBerry Bengali texts were appearing as boxes. Other phones like iPhone or Android could show Bangla with some issues but at least you could make something out of it. So I was looking for a solution. So did some googling as usual.

The main thing is in order to see Bangla or East Asian language your phone need to have support for East Asian language and font support. And this is not easy to enable. You have to do it with BlackBerry Desktop manager software.

So first install the latest version of BlackBerry Desktop Manager in your pc or mac from here

Then start DM and connect your BB. After your BB is connected with DM you need to install the font support. Click on the Application button on the left panel like shown below


It will load all the applications installed in the device and show you a list of it. Now scroll below and you will see item called "East Asian Characters and Font Support". Click on the left + sign if it is not already expanded.

Here you will see an item called "Indic Characters and Font Support". Beside this item click on the "+" sign to install this item. If already installed it will have the text Installed like mine.


Now click on the Apply button at right bottom and it should start installing the necessary components for you. Give it a some time. Do not disconnect your BB during this time. Your device will reboot. And now you are done. Try to browse for any Bangla web site now.

You should be able to see Bangla now in Facebook app or in web browser. Love to see my language on BB.



Tuesday, May 17, 2011


Appworld is not available in all countries!!! Which is bad, very bad. they could have done it like only free apps are available for unsupported countries. But simply their app doesnt work.

And in different ways if you download appworld, after launching appworld shows that country is not supported. I tried various version of appworld and none were successful. So I had to try in hard way. This one is a bit techy, but you can try easily

This below instructions is for Windows 7 users with a laptop or wifi network adapter, for windows xp networking sharing is somewhat problematic, So try with Windows 7.

Step 1:
In order to overcome the country restrictions, you have to connect through a VPN which vpns global IP is something where appworld is supported, like USA or Canada.

As I did not had a VPN of my own so I had to search for free VPN, searching in Google gives you some healthy amount of results. Anyway, I downloaded proXPN to my computer. You can download from here
http://proxpn.com/

After installing, this one is fairly simple, create an account and press the connect button. Which will connect your pc to a VPN. Now you will see that your IP address is changed and its showing your ip address something of the country you selected. You can check your IP from http://whatismyipaddress.com/

Step2:
Now that you have a VPN setup and running and your IP is changed, thats good. But this is for your laptop. Not for the BlackBerry. So how to do that?
Simple, we need to share this network through Wireless and connect your BlackBerry PlayBook to that wireless network. Simple, is it?

In order to make things simpler, comes connectify, a nice little software which can turn your laptop into a wireless router. Download free WiFi hotspot software from http://connectify.me/
Install the software as instructed. After installation in the setup wizard you can share your network to wireless.

Step 3:
Sharing VPN connection using Connectify
When we installed ProXPN it created a new Local Area Connection in the computer. In your network connections you will see a new connection named something like "Local Area Connection x" where x can be 1,2 etc.

Now when using connectify, you have to select which network connection to share in wifi. Select the newly created local area connection, that was created by proxpn.
Give a password to network
And click on start hotspot.
Your wireless network should be up and running now.

In this step, if you see bluescreen when you press the start hotspot button, then this is because you are using an older version of your wifi adapter or your adapter is not supported by connectify. Please refer to supported adapter by connectify. I was seeing the bluescreen. then I had to update my wireless adapter driver and it was solved
http://www.connectify.me/support/index.php?act=article&code=view&id=13

Step 4:

Now your wireless network is up and running. Take the PlayBook or BlackBerry, look for the wifi you created. Connect to it. Start appworld and voila, you could see the apps and download them from appworld.

Happy Downloading!!!


Saturday, April 17, 2010

Many times, I was in search of building custom components for BlackBerry and tutorials on how to make great apps. Here are some of the links that I found interesting.

Tutorial:

Create a BlackBerry Game Tutorial








Custom Components:









Charting Tools





HTTP Connection for BlackBerry

BlackBerry http connection is very much problematic. For using different connection type you have to use different ways. It should be such that http connection is automatically handled. I don't understand why they don't make it easy for developers to use http connection. This http connection systems makes life hell, specifically for BIS






Application Permission Related:




GPS Tutorial:




Performance Issues:

http://www.thinkingblackberry.com/archives/144




BB MenuItems:




Storing data in persistent Storage:

BB OS 5.0 recently introduced SQLite. Previous OS only supports Persistent Store to store data in application.


Wednesday, September 30, 2009

You might need to preverify the jar file. This is how you can preverify a jar file

Go to your JDE installation folder, for Windows XP it is usually C:\Program Files\Research In Motion\BlackBerry JDE 4.3.0\bin. If you are using eclipse then you can also find the installation directory of BlackBerry plugin.
2. Copy your jar  file to bin folder.
3. Notice the preverify.exe file. This is the tool we'll use.
4. Now open your command prompt and change your current directory to your JDE installation directory.
5. execute the following command:
preverify -classpath "JDE_PATH_HERE\lib\net_rim_api.jar" "your_jar_filename"
6. Notice that in bin directory, another folder named output has been created. Preverified jar file resides here. Copy the preverified jar file with the same name that the non-preverified jar file has.
7. Now replace the non-preverified jar file with the verified one. Use this jar in next steps

Create a new Blackberry project with any name like LibProject.
   Right-click on the project and go to Properties.
   Go to Blackberry Project Properties. Click on the Application tab.
   Under Project Type, change to Library.
   Next, go to the Java Build Path.
  go to libraries and add the jar file as an external library.
  Go to Order and Export tab here, and mark your jar file as exportable
  Click OK.

Build the library project.

Now, create your main BlackBerry project
   Keep this projects type to as you wish it to be.
   Now go to the properties of this project, In the Java Build Path, add the LibProject project as a Project dependency.

You are pretty much ready to import the jar in your code. Try to import a class and see if it works.

Alternatively, what I think that we might skip the first works of creating a new project and try to add the jar directly to our app. I think that might also work. Though I did not try it yet. Let me know if anyone was successful doing it.

That’s all for now

Saturday, August 8, 2009

System.getProperty("browser.useragent")

Wednesday, July 22, 2009

 

public static String unescape(String s)

{
  StringBuffer sbuf = new StringBuffer () ;
  int l  = s.length() ;
  int ch = -1 ;
  int b, sumb = 0;
  for (int i = 0, more = -1 ; i < l ; i++) {
    /* Get next byte b from URL segment s */
    switch (ch = s.charAt(i)) {
      case '%':
        ch = s.charAt (++i) ;
        int hb = (Character.isDigit ((char) ch)
                  ? ch - '0'
                  : 10+Character.toLowerCase((char) ch) - 'a') & 0xF ;
        ch = s.charAt (++i) ;
        int lb = (Character.isDigit ((char) ch)
                  ? ch - '0'
                  : 10+Character.toLowerCase ((char) ch)-'a') & 0xF ;
        b = (hb << 4) | lb ;
        break ;
      case '+':
        b = ' ' ;
        break ;
      default:
        b = ch ;
    }
    /* Decode byte b as UTF-8, sumb collects incomplete chars */
    if ((b & 0xc0) == 0x80) {                 // 10xxxxxx (continuation byte)
      sumb = (sumb << 6) | (b & 0x3f) ;       // Add 6 bits to sumb
      if (--more == 0) sbuf.append((char) sumb) ; // Add char to sbuf
    } else if ((b & 0x80) == 0x00) {          // 0xxxxxxx (yields 7 bits)
      sbuf.append((char) b) ;                 // Store in sbuf
    } else if ((b & 0xe0) == 0xc0) {          // 110xxxxx (yields 5 bits)
      sumb = b & 0x1f;
      more = 1;                               // Expect 1 more byte
    } else if ((b & 0xf0) == 0xe0) {          // 1110xxxx (yields 4 bits)
      sumb = b & 0x0f;
      more = 2;                               // Expect 2 more bytes
    } else if ((b & 0xf8) == 0xf0) {          // 11110xxx (yields 3 bits)
      sumb = b & 0x07;
      more = 3;                               // Expect 3 more bytes
    } else if ((b & 0xfc) == 0xf8) {          // 111110xx (yields 2 bits)
      sumb = b & 0x03;
      more = 4;                               // Expect 4 more bytes
    } else /*if ((b & 0xfe) == 0xfc)*/ {      // 1111110x (yields 1 bit)
      sumb = b & 0x01;
      more = 5;                               // Expect 5 more bytes
    }
    /* We don't test if the UTF-8 encoding is well-formed */
  }
  return sbuf.toString() ;
}

Saturday, July 11, 2009

In order to show GIF images in Blackberry applications you have to disable exporting all images to png format. This can be done from JDE by right clicking the project and going to properties. In resources tab select “Don’t convert image files to png”.

dontpng

Now add the gif image in the project. And add this class with your project.



/*

* AnimatedGIFField.java
*
* © <your company here>, 2003-2008
* Confidential and proprietary.
*/

import net.rim.device.api.ui.UiApplication;

import net.rim.device.api.system.GIFEncodedImage;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.BitmapField;

//A field that displays an animated GIF.

public class AnimatedGIFField extends BitmapField
{
private GIFEncodedImage _image; //The image to draw.
private int _currentFrame; //The current frame in the animation sequence.
private int _width; //The width of the image (background frame).
private int _height; //The height of the image (background frame).
private AnimatorThread _animatorThread;

public AnimatedGIFField(GIFEncodedImage image)
{
this(image, 0);
}

public AnimatedGIFField(GIFEncodedImage image, long style)
{
//Call super to setup the field with the specified style.
//The image is passed in as well for the field to
//configure its required size.
super(image.getBitmap(), style);

//Store the image and it's dimensions.
_image = image;
_width = image.getWidth();
_height = image.getHeight();

//Start the animation thread.
_animatorThread = new AnimatorThread(this);
_animatorThread.start();
}

protected void paint(Graphics graphics)
{
//Call super.paint. This will draw the first background
//frame and handle any required focus drawing.
super.paint(graphics);

//Don't redraw the background if this is the first frame.
if (_currentFrame != 0)
{
//Draw the animation frame.
graphics.drawImage(_image.getFrameLeft(_currentFrame), _image.getFrameTop(_currentFrame),
_image.getFrameWidth(_currentFrame), _image.getFrameHeight(_currentFrame), _image, _currentFrame, 0, 0);
}
}

//Stop the animation thread when the screen the field is on is
//popped off of the display stack.
protected void onUndisplay()
{
_animatorThread.stop();
super.onUndisplay();
}

//A thread to handle the animation.
private class AnimatorThread extends Thread
{
private AnimatedGIFField _theField;
private boolean _keepGoing = true;
private int _totalFrames; //The total number of frames in the image.
private int _loopCount; //The number of times the animation has looped (completed).
private int _totalLoops; //The number of times the animation should loop (set in the image).

public AnimatorThread(AnimatedGIFField theField)
{
_theField = theField;
_totalFrames = _image.getFrameCount();
_totalLoops = _image.getIterations();

}

public synchronized void stop()
{
_keepGoing = false;
}

public void run()
{
while(_keepGoing)
{
//Invalidate the field so that it is redrawn.
UiApplication.getUiApplication().invokeAndWait(new Runnable()
{
public void run()
{
_theField.invalidate();
}
});

try
{
//Sleep for the current frame delay before
//the next frame is drawn.
sleep(_image.getFrameDelay(_currentFrame) * 10);
}
catch (InterruptedException iex)
{} //Couldn't sleep.

//Increment the frame.
++_currentFrame;

if (_currentFrame == _totalFrames)
{
//Reset back to frame 0 if we have reached the end.
_currentFrame = 0;

++_loopCount;

//Check if the animation should continue.
if (_loopCount == _totalLoops)
{
_keepGoing = false;
}
}
}
}
}
}

This class will create a custom field type object. You can add it with a Screen type objects.

The following code will add a GIF image with a Screen type object



AnimatedGIFField testanimated= new AnimatedGIFField((GIFEncodedImage)(GIFEncodedImage.getEncodedImageResource( "loading2.gif" )),AnimatedGIFField.FIELD_LEFT);
//add(answer);
add(testanimated);


You are done. Let me know if you found any difficulties adding it.

9530