Worldwide Smartphone Sales (Based on internet resources)

Worldwide Smartphone Sales to End Users in 2008/2009 (Thousands of Units)

                                                                            

Company                                Sales      Market Share(%)          Sales         Market Share (%)

Nokia                                14,991.2                    41.2           14,588.6                         45.1

Research In Motion              7,233.6                    19.9            4,311.8                         13.3

Apple                                  3,938.8                   10.8             1,725.3                          5.3

HTC                                     1,957.3                   5.4              1,276.9                         4.0

Fujitsu                                 1,387.0                   3.8              1,317.5                          4.1

Others                                 6,896.4                  18.8              9,094.8                        28.1

TOTAL                               36,404.4               100.0           32,314.9                    100.0

Zoom images when you go to zoom button-JavaScript

 

<script language="JavaScript1.2">
var zoomfactor=0.05 //Enter factor (0.05=5%)
function zoomhelper()
{
if (parseInt(whatcache.style.width)>10&&parseInt(whatcache.style.height)>10&&parseInt(whatcache.style.width)<555)
{
whatcache.style.width=parseInt(whatcache.style.width)+parseInt(whatcache.style.width)*zoomfactor*prefix
whatcache.style.height=parseInt(whatcache.style.height)+parseInt(whatcache.style.height)*zoomfactor*prefix
}
}

function zoom(originalW, originalH, what, state)
{

if (!document.all&&!document.getElementById)
return
whatcache=eval("document.images."+what)
prefix=(state=="in")? 1 : -1

if (whatcache.style.width==""||state=="restore")
{
whatcache.style.width=originalW+"px"
whatcache.style.height=originalH+"px"

if (state=="restore")
return
}

else
{
zoomhelper()
}
beginzoom=setInterval("zoomhelper()",10)
}

function clearzoom()
{
if (window.beginzoom)
clearInterval(beginzoom)
}
</script>

 

CHANGE 500 to your image width, 375to image height, and "img.jpg" to your image's name

<a href="#" onmouseover="zoom(500,375,'myimage','in')" onmouseout="clearzoom()">Zoom In</a> | <a href="#" onmouseover="zoom(99,100,'myimage','restore')">Normal</a> | <a href="#" onmouseover="zoom(120,60,'myimage','out')" onmouseout="clearzoom()">Zoom Out</a>
<div style="position:relative;width:99;height:100"><div style="position:absolute">
<img name="myimage" src="img.jpg">

This code taken from web and works fine for me.so i put it here

How to use Record Management Store in BlackBerry-Add new records delete them and retrieve data when need

 

The RMS is a persistent storage API in Java® ME.I found code in blackberry site and develop to store the name of record and value that need to store

This class creates object that holds data values

package rms;
import java.io.*;
public final class datastor
{
    private String name;
    private String value;
    private String fullData;
    private static final short NameD = 0;
    private static final short valueD = 1;

    public datastor(byte[] data) throws java.io.IOException
    {
        fromByteArray(data);
    }   
    datastor(String name1, String value1)
    {
        name = name1;
        value = value1;
        fullData = name + ": " + value;
    }   
    public String toString()
    {
        return fullData;
    }   
    String getName()
    {
        return name;
    }   
    String getvalue()
    {
        return value;
    }   
    byte[] toByteArray() throws java.io.IOException
    {
        byte[] data;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        dos.writeShort(NameD);
        dos.writeUTF(name);
        dos.writeShort(valueD);
        dos.writeUTF(value);
        data = baos.toByteArray();   
        return data;
    }   

    private void fromByteArray(byte[] array) throws java.io.IOException
    {
        ByteArrayInputStream bais = new ByteArrayInputStream(array);
        DataInputStream dis = new DataInputStream(bais);
        short tag;          
        try
        { 
            while(true)
            {
                tag = dis.readShort();
                if (tag == NameD)
                {
                    name = dis.readUTF();
                }
                else if (tag == valueD)
                {
                    value = dis.readUTF();
                }
                else
                {
                    dis.readUTF();
                }
            }    
        }
        catch(EOFException e)
        {
            fullData = name + ": " + value;
        }
    }
}

This class use to perform the actions such as create delete data records in rms and also use to create datastore objecs

package rms;
import java.io.*;
import javax.microedition.rms.*;

public final class dataStorAcc
{
    RecordStore _rs;

    public dataStorAcc(String name) throws RecordStoreException, java.io.IOException
    {
        _rs = RecordStore.openRecordStore(name, true, RecordStore.AUTHMODE_ANY, false);
    }   

    public dataStorAcc(String recordStoreName, String vendorName, String suiteName) throws RecordStoreException, java.io.IOException
    {
        _rs = RecordStore.openRecordStore( recordStoreName, vendorName, suiteName );
    }    

    public synchronized int add(String name, String value) throws java.io.IOException, RecordStoreNotOpenException, RecordStoreException
    {
        datastor cd = new datastor(name, value);
        //Creates object
        byte[] data = cd.toByteArray();     
        //converts to byte
        return _rs.addRecord(data, 0, data.length);
        //add to record store
    }

    public synchronized void edit(int index, String artist, String title) throws java.io.IOException, RecordStoreNotOpenException, RecordStoreException
    {
        datastor cd = new datastor(artist, title);
        byte[] data = cd.toByteArray();       
        _rs.setRecord(index, data, 0, data.length);
    }

    public datastor getDataobj(int recordID) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, java.io.IOException
    {
        byte[] data = _rs.getRecord(recordID);
        return new datastor(data);
    }    

    public synchronized void delete(int recordId) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
    {
        _rs.deleteRecord(recordId);
    }

    RecordEnumeration enumerate() throws RecordStoreNotOpenException
    {
        return _rs.enumerateRecords(null, null, true);
    }
}

This is how we can use this within our application

01)Declare DataStorAcc object

dataStorAcc _db;      // RMS reference
RecordEnumeration _enum;

_db = new dataStorAcc("My Music");//Creates new Datastore named My Music
_enum = _db.enumerate(); //Creates enumerator

02)Add new record to rms

_db.add(“name”,”value”);

03)Delete from rms

_db.delete(tecordID);

04)Retrive data

recordId = _enum.nextRecordId();
String data=getDataobj(recordId).toString();

Display progressing bar in BlackBerry/Run and stop thread from 2 different classes/Use of volatile threads

 

 

package com.ironone.thread;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.GaugeField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.DialogFieldManager;
import net.rim.device.api.ui.container.PopupScreen;

public class service implements Runnable
{
    private volatile Thread service;
    private int maximum, timeout;
    private boolean useful;
    private PopupScreen popup;
    private GaugeField gaugeField;
    public service(int maximum, int timeout,String title)
    {
            this.maximum = maximum;
            this.timeout = timeout;
            DialogFieldManager manager = new DialogFieldManager();
            popup = new PopupScreen(manager);
            gaugeField = new GaugeField(null, 1, maximum, 1, GaugeField.NO_TEXT);
            manager.addCustomField(new LabelField(title));
            manager.addCustomField(gaugeField);       
            service = new Thread(this);
            service.start();
    }
    public void run()
    {
        Thread thisThread = Thread.currentThread();
        while ( service == thisThread )
        {            useful = true;
            UiApplication.getUiApplication().invokeLater(new Runnable()
            {
                public void run()
                {
                    UiApplication.getUiApplication().pushScreen(popup);
                }
            });
            int iterations = 0;
            while (useful)
            {
                try
                {
                    Thread.sleep(timeout);
                }
                catch (Exception e)
                {
                }
                if (++iterations > maximum)
                {
                    useful =false;
                    iterations = 1;
                }
                gaugeField.setValue(iterations);
            }

            if (popup.isDisplayed())
            {
                UiApplication.getUiApplication().invokeLater(new Runnable()
                {
                    public void run()
                    {
                        UiApplication.getUiApplication().popScreen(popup);
                    }
                });
            }
        }
    }

    public synchronized void serviceResume()
    {
        service = new Thread(this);
        service.start();
    }
    public synchronized void serviceSuspend()
    {
        service = null;
    }

}

Create class to use thread

package com.ironone.thread;
import com.ironone.thread.service;

public class dta
{
    public boolean temp=true;
    public service eeeeee=null;//new service(10,10,"Display name");
    public void dta()
    {
        eeeeee=new service(50,50,"Sending");
    }
    public void sss()
    {
        this.eeeeee.serviceSuspend();
    }
}

 

Create a global variable of dta in main class

public static dta ss=new dta();

refer that variable from anywhere and start run

Main.ss.dta();

stop it from some other location or class

Main.ss.sss();

Post method in java

public String postObject(String url,String object)
       {

          String resultsPage="";
         try{
              String urlStr=url;
              String val=object;
              URL postURL = new URL( urlStr );
              HttpURLConnection con = (HttpURLConnection) postURL.openConnection();
              con.setUseCaches(false);      
              con.setDoOutput(true);        
              con.setDoInput(true);         
              con.setRequestMethod("POST");  
              PrintWriter out = new PrintWriter(con.getOutputStream());
              String postStr = "link="+URLEncoder.encode(val);
              out.println(postStr); 
              out.close();
              String inputLine="";
        BufferedReader in=new BufferedReader(new InputStreamReader(con.getInputStream()));
              while ((inputLine = in.readLine()) != null)
                   resultsPage+=inputLine;
              in.close();
              System.out.println(resultsPage); //Final output
          }
         catch(Exception ex)
          {
             System.out.println(ex);
          }

      return resultsPage;
       }

Get properties of Image programmatically / Make bitmap image from file located in any location -BlackBerry Development

Create Bitmap image as follows then

Bitmap _bitmap;
_bitmap=getBitmap("file:///SDCard/image.jpg");
int h=_bitmap.getHeight();
int w=_bitmap.getWidth();
Dialog.alert("height"+Integer.toString(h)+"width"+Integer.toString(w));

getBitmap image will be like this

public Bitmap getBitmap(String filepath)
{
    Bitmap bkBitmap = null;
    try {
             FileConnection fconn = (FileConnection)Connector.open(filepath );
             InputStream input = null;
             input = fconn.openInputStream();     
             int available = 0;
             available = input.available();
             int fSz = (int)fconn.fileSize();
             byte[] data = new byte[fSz];            
             input.read(data, 0, fSz);
             EncodedImage image = EncodedImage.createEncodedImage(data,0,data.length);
             bkBitmap = image.getBitmap();               
        }
    catch(Exception e)
        {
        }
    return bkBitmap;
}

“Some of the projects in the active BlackBerry configuration contain errors. Project MobileRDM contains errors (Please check the Problems view). “ or “running the rapc utility error” Errors in eclipse Blackberry development when try to add jar file

There few ways to fix this problem here i have mentioned the method that works for me

01)Select project folder and make sure that is not read only.if it is read only remove

      the read only property

02)In the eclipse project explorer window select project then go to >build path

    >Configure Build path > Then go to > libraries and add the necessary jar files

    from add jars then order and export menu select the added jar file then press ok

Then problem will be ok

Cannot find jar error2 when building BlackBerry Application in eclipse

 

We can see sometimes above error in console

Go to my computer->properties –>Advanced System properties

->Environmental variables->System variables

find path then add “;your java bin path”

Then problem will not occur again.this works for me

Create folder in BlackBerry device memory or Memory card-(How to avoid “FileIOException: File system error”)

Creates Folder inside the BlackBerry device programmatically

try
    {
FileConnection fc=(FileConnection)Connector.open

("file:///store/home/user/themes/",Connector.READ_WRITE);

//Give your path as need above path for device memory

//for Memory Card give as file:///SDCard/Themes/

//Do not forget to “/” at the end of name
           if (!fc.exists())
            {
             fc.mkdir();
             Dialog.alert("Created Folder");
            }
    }
    catch(Exception e)
    {
        Dialog.alert("ERROR");
    }

Download image or any file from URL to specific file path-BlackBerry Development

Give url and downloaad location very simple

public boolean downloadImage(String url,String path)
{
    if(saveImage(getImage(url),path))
    {
    return true;
    }
    else
    {
        return false;
    }
}
public static String getImage(String url)
{
String response = "";
try {
HttpConnection conn = (HttpConnection)Connector.open(url, Connector.READ_WRITE);
InputStream input =conn.openInputStream();
byte[] data = new byte[256];
int len = 0;
StringBuffer raw = new StringBuffer();
while( -1 != (len = input.read(data)))
{
raw.append(new String(data, 0, len));
}
response = raw.toString();
input.close();
} catch(Exception e)
{
Dialog.alert("Error");
}
return response;
}
public boolean saveImage(String txt,String path1)
    {
        boolean str = false;
        try {
            FileConnection fc1 = (FileConnection)Connector.open(path1, Connector.READ_WRITE);
            if(!fc1.exists())
            {
            fc1.create();
            }
            fc1.setWritable(true);
                byte[] size1=txt.getBytes();
                OutputStream os=fc1.openOutputStream();
                os.write(size1);
                os.close();
                return true;        
        }
        catch (Exception ioe)
        {
            System.out.println("File Sys Error"+ioe.getMessage());
        }
        return str;
    }

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...