Skip to main content

Posts

How to save server certificate to blackberry key store

First you have to download the certificate file manually. To do this open your Firefox browser and type the URL which enables SSL. Then you can see a Padlock bottom of the browser. Double click the pad clock . then you can see the certificate window. Click View Certificate button. In the certificate viewer window select Details Tab and select Export button. Then Save your Certificate as X.509 (PEM) format.  You will get this kind of file. Open eclipse and Create new Blackberry Project. Copy Certificate file in to the same package that class created. (In here I'm writing my code in Main.java class thus i copied the certificate file in to Main package.) Following shows code sample public Certificate ReadFile() { try { Class classs = Class.forName( "com.ironone.main.Main" ); InputStream is = classs.getResourceAsStream( "/DigiCertEVRootCA.crt" ); // Certificate File Name :DigiCertEVRootCA.crt byte [] data = new byte [is.available()]; is.read(dat...

How to Create Folder/Directory in C# with Folder Hidden Attribute

DirectoryInfo Dif = new DirectoryInfo( @"C:\SampleDir" ); Dif.Create(); Dif.Attributes = FileAttributes.Hidden; You may also apply following attributes as well ReadOnly,Hidden,System,Directory,Archive Device ,Normal , Temporary , parseFile, ReparsePoint, Compressed , Offline ,NotContentIndexed,Encrypted

How to use list.Sum<> in System.Collections.Generic

List.Sum<> This will return the summation of named attribute. List<Item> listItem = new List<Item>();   Item T1 = new Item() { Name = "A" , Amount = 100 }; Item T2 = new Item() { Name = "B" , Amount = 600 }; Item T3 = new Item() { Name = "C" , Amount = 100 }; Item T4 = new Item() { Name = "D" , Amount = 150 }; Item T5 = new Item() { Name = "E" , Amount = 200 };   listItem.Add(T1); listItem.Add(T2); listItem.Add(T3); listItem.Add(T4); listItem.Add(T5);   Decimal D = listItem.Sum(P=>P.Amount); // sum of Amount Conditional Sum Assume that you want to get the summation of Amount lager than 100 Decimal D = listItem.Where(P=>P.Amount>100).Sum(P=>P.Amount); List.Sum() This will return the summation of the list. List< int > intList = new List< int >();   intList.Add(2); intList.Add(3); intList.Add(4);   int sum = intList.Sum(); // sum of Amount

How to use list.find<> and list.findall<> in System.Collections.Generic

List.find<> This will return first matched item from the list. List. FindAll<> This will return all matching items from the list. Item Class Code class Item { public int Amount; public string Name; } List<Item> listItem = new List<Item>();   Item T1 = new Item() { Name = "A" , Amount = 100 }; Item T2 = new Item() { Name = "B" , Amount = 600 }; Item T3 = new Item() { Name = "C" , Amount = 100 }; Item T4 = new Item() { Name = "D" , Amount = 150 }; Item T5 = new Item() { Name = "E" , Amount = 200 };   listItem.Add(T1); listItem.Add(T2); listItem.Add(T3); listItem.Add(T4); listItem.Add(T5); Method 1 Item Result= listItem.Find(P=>P.Name== "A" ); // item having "A" as it's item name   Item Result= listItem.Find(P=>(P.Name== "A" & P.Amount==100)); // item having "A" as it's item name and Amount as 100   Item Result= listItem.FindAll(P=>P.Amoun...

Open Form (Push Form) in side a timer task in Blackberry

I tried several times to figure out how to push a form to a sreen inside a timer task. but meantime it gave me errors. but ultimately i found a way to do it. The solusion is invokelater(). To run a UI we have to run our code in event-dispatching thred.    class RemindTask1 extends TimerTask   {       public void run()        { Runnable NextScreen = new Runnable() {    public void run()          {           UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen()); UiApplication.getUiApplication().pushScreen(new frmComplite());    }    };             UiApplication.getUiApplication().invokeLater(NextScreen);      } }

Convert FAT32 to NTFS with out formating your harddisk

this is a simple nice command available in DOS commands. I had use this method in several occations with out any worries.  You can convert your FAT32 hard disk to NTFS with out formating or with out damaging your data. goto Run ---->type cmd (or any how get theh commant prompt) type convert c: /FS:NTFS (this will convert your C: drive to NTFS)

Public Key Cryptography in Windows Mobile Using RSA

Here shows how you can do public key cryptography encryption and decryption in windows mobile 6.0. In here stored the encrypted message and decrypt it using    private key. public partial class frmRSA : Form {           byte [] encMsg;         RSAParameters publickey;         RSAParameters privatekey;      private void menuKeyGen_Click( object sender, EventArgs e)    {        // 384 bits to 16384 bits in increments of 8 bits      // Create Public & Private Key and store..      RSACryptoServiceProvider RSAC = new RSACryptoServiceProvider (392);      publickey = RSAC.ExportParameters( false );      privatekey = RSAC.ExportParameters( true );       }      private void menuItem_Enc_Click( object sender, EventArgs e)    {         RSACryptoServiceProvider rs = new RSACryptoServiceProvider ();         rs.ImportParameters(publickey);         encMsg = rs.Encrypt( Encoding .ASCII.GetBytes(txttoEnc.Text), false );         txtEnc.Text...