Redwan's Blog

About Me

My Photo
Dhaka, Bangladesh
I am B.S.C Engineer,CSE,SUST and Ex-Cadet of Mirzapur Cadet College.

Wednesday, March 31, 2010

Test Environment Set Up and Deployment steps for an iPhone Application


Part 0: http://www.youtube.com/watch?v=JQ3APll05Rg

Wednesday, April 8, 2009

Create a system folder in My Computer with C#

I found a article to create a system folder in "My Computer" in http://www.technospot.net/blogs/how-to-create-a-system-folder-in-my-computer/.

However, I have successfully done it with a Console app of C# for my own purpose.:)

Also, I have redirected it to open up a particular page with OS default browser.

Steps(Manual):

Step 1: 

Create a Unique Key Open registry with “regedit” command on run window.
Navigate to HKEY_CLASSES_ROOT\CLSID\. Then right click and create a new key with value as {FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}

Now set the default value of this key to the folder name you want to use. Now your path will look like ( I will call this as parent key throughout the discussion) HKEY_CLASSES_ROOT\CLSID\{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}

Step 2: 
Add Custom Icon to the folder 
Now create a sub key under parent key.
Name it as “DefaultIcon”.
Set the default value of this to the path of the icon image you want to use.
If you dont specify your icon, system will take default icon.

Step 3: 
Adding attributes Under parent key 
create another key with name as “InprocServer32″
Set the default value as “shell32.dll”
Again at the same level create another folder as “ThreadingModel” and set its value as “Apartment”
 Same way create another key (under parent level) at the same level with structure as \Shell\My Folder\Command
 Set the default value here as “explorer /root,c:\Blog Data”
 This has to be same which you gave when you created the first key.
  
 Step 4 
Adding Handlers
Under parent key, create another key as \ShellEx\PropertySheetHandlers\ {FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}
Similar way another key is to added to parent key as “Shell Folder”
In this right click and create new binary value called as “Attributes” with value as 00 00 00 00.
 
Step 5: 
Settings to place in My Computer
Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
Then to \CurrentVersion\Explorer\MyComputer\NameSpace\
Add the parent key which in this case is {FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}











CODE:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
//Step1
/*
Create a Unique Key Open registry with “regedit” command on run window.
Navigate to HKEY_CLASSES_ROOT\CLSID\. Then right click and create a new key with value as {FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}
*/
            
    Microsoft.Win32.RegistryKey RootKey;
            RootKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("CLSID", true);
            
            Microsoft.Win32.RegistryKey FolderKey = RootKey.CreateSubKey("{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12341}");
            FolderKey.SetValue("", "PrologLive NetSpace(1GB Space)",Microsoft.Win32.RegistryValueKind.String);
            
            FolderKey.Flush();

            
            
            //Step2
            /*
             * Add Custom Icon to the folder.
                Now create a sub key under parent key.
                Name it as “DefaultIcon”.
                Set the default value of this to the path of the icon image you want to use.
             * */
          

            Microsoft.Win32.RegistryKey DefaultIconKey = FolderKey.CreateSubKey("DefaultIcon");
            DefaultIconKey.SetValue("", "/Resources/Bitmap1.bmp");
            DefaultIconKey.SetValue("","logo.ico");

            //Step3
            /*
             * Under parent key create another key with name as “InprocServer32″
                Set the default value as “shell32.dll”
             * */

            Microsoft.Win32.RegistryKey InprocServer32Key = FolderKey.CreateSubKey("InprocServer32");
            InprocServer32Key.SetValue("", "shell32.dll");

            /*
             * Again at the same level create another folder as “ThreadingModel” and set its value as “Apartment”
             * */

            Microsoft.Win32.RegistryKey ThreadingModelKey = FolderKey.CreateSubKey("ThreadingModel");
            ThreadingModelKey.SetValue("", "Apartment");

            /*
             * Same way create another key (under parent level) at the same level with structure as 
             * \Shell\My Folder\Command
                Set the default value here as “explorer /root,c:\Blog Data”
             * */
            Microsoft.Win32.RegistryKey ShellKey = FolderKey.CreateSubKey("Shell");
            


            

            Microsoft.Win32.RegistryKey MyFolderKey = ShellKey.CreateSubKey("MyFolder");
            
            

            Microsoft.Win32.RegistryKey CommandKey = MyFolderKey.CreateSubKey("Command");
            CommandKey.SetValue("","explorer /root, http://www.prologinc.com/");

            
            


            /*
             * Step 4 Adding Handlers
                Under parent key, create another key as \ShellEx\PropertySheetHandlers\ {FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}
                
             * */


            Microsoft.Win32.RegistryKey ShellExKey = FolderKey.CreateSubKey("ShellEx");

            

            Microsoft.Win32.RegistryKey PropertySheetHandlersKey = ShellExKey.CreateSubKey("PropertySheetHandlers");

            

            Microsoft.Win32.RegistryKey FinalFolderKey = PropertySheetHandlersKey.CreateSubKey("{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12341}");

            /*
             Similar way another key is to added to parent key as “Shell Folder”
                In this right click and create new binary value called as “Attributes” with value as 00 00 00 00.
             */
            Microsoft.Win32.RegistryKey ShellFolderKey = FolderKey.CreateSubKey("Shell Folder");


            

            ShellFolderKey.SetValue("Attributes", new byte[] {00, 00, 00, 00},  Microsoft.Win32.RegistryValueKind.Binary);
            

            /*
             * Step 5: Settings to place in My Computer
                Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
                Then to \CurrentVersion\Explorer\MyComputer\NameSpace\
                Add the parent key which in this case is {FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}
             */


            Microsoft.Win32.RegistryKey RootForMicroSoftKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software",true);
            Microsoft.Win32.RegistryKey RootForWindowsKey = RootForMicroSoftKey.OpenSubKey("Microsoft", true);
            Microsoft.Win32.RegistryKey RootForCurrentVersionKey = RootForWindowsKey.OpenSubKey("Windows", true);

            Microsoft.Win32.RegistryKey CurrentVersionKey = RootForCurrentVersionKey.CreateSubKey("CurrentVersion");

            
            Microsoft.Win32.RegistryKey ExplorerKey = CurrentVersionKey.CreateSubKey("Explorer");

            
            Microsoft.Win32.RegistryKey MyComputerKey = ExplorerKey.CreateSubKey("MyComputer");

          
            Microsoft.Win32.RegistryKey NameSpaceKey = MyComputerKey.CreateSubKey("NameSpace");

          
            Microsoft.Win32.RegistryKey MainFolderKey = NameSpaceKey.CreateSubKey("{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12341}");


            /*
             * Close All Key
             */

            FolderKey.Close();
            RootKey.Close();
            MainFolderKey.Close();
            NameSpaceKey.Close();
            MyComputerKey.Close();
            ExplorerKey.Close();
            CurrentVersionKey.Close();
            RootForCurrentVersionKey.Close();
            RootForWindowsKey.Close();
            RootForMicroSoftKey.Close();
            ShellFolderKey.Close();
            FinalFolderKey.Close();
            PropertySheetHandlersKey.Close();
            ShellExKey.Close();
            CommandKey.Close();
            MyFolderKey.Close();
            ShellKey.Close();
            ThreadingModelKey.Close();
            InprocServer32Key.Close();
            DefaultIconKey.Close();
        }
    }
}

Tuesday, February 17, 2009

iPhone Devepolment Perlimenaries

I was in dark, when I decided that I will start IPhone application development. I was Novice. So, It was pretty difficult to set up an environment for development. I faced the following question at that time and I found those pieces by UTFS(Using the fucking search engin). I think you eill find these question and answers pretty useful

My first question was "Do I need a MAC book to start development?"

Answer: No, You can install a MAC OS in intel PC, if the processor have sse2 and sse3 support.

"How do I confirm, if there is any SSE2/SSE3 in my processor?"

Ans: You can check list of processors that support SSE2/SSE3 in following links. Also, there is some freeware software that will show your processor information. You can also determine it from there.
1. http://en.wikipedia.org/wiki/SSE2
2. http://en.wikipedia.org/wiki/SSE3

"Can I make a dual boot system at my PC, so that I can run both Windows and MAC OS X ?"

Ans: Therotically, You can. But I failed. But, at least you have to spare one HDD for MAC, It will make your life easier.

"Which version of MAC OS X I should Install?"

Ans: Iphone SDK needs MAC Lepord OSX 10.5.5. What you can do, install lower version and install SDK and your MAC OS will automatically install components that the SDK needs. Other wise it will be a huge download for you 4 GB almost.

"Where can I get MAC OSX DVD?"

Ans: You can buy from local market. There is a possibility to not getting it from market.You can download it torrent sites (you might want to consider typing in "Kalyway 10.5.5" and use the torrent program of your choice to download it.) and burn it into a DVD.

"What are the accessories and things need to have before I start?"

Ans:

  • High Speed Internet Connection (Useful if you want the disk image before the end of time)
  • Blank DVD-R
  • Nero, or some other program that allows the burning of disk images to blank media
  • A BitTorrent program such as BitComet or Transmission
  • A computer with the following attributes:
    • Processor with either SSE2, SSE3, or SSE2/3 capabilities.
    • at least 512 MB RAM
    • at least 9 GB of free disk space
    • A DVD drive for installation
"What is the procedure of installation?"

Ans: follow the instruction step by step from the following links.

http://tgrounds.blogspot.com/2008/03/osx-leopard-1051-on-pc.html

and http://wiki.osx86project.org/wiki/index.php/Installation_Guides

"Where can I get IPhone SDK?"

Ans: GO to developer.apple.com and you will get the SDK there. download it.

"Do I need an apple ID?"

Ans: Yes. If you want to get development resources from apple site you need to create an apple ID.

"What is the compiler name?"

Ans: XCode

"Is there any GUI desigener ?"

Ans: Yes. Its name is Interface builder, and independent component from XCode.

"What is the language?"

Ans: Objective C.

"What is the best helping site I found? "

Ans: Awsome site for beginners. http://icodeblog.com/

Surely, It will lead you to developing some sample applications pretty easily.

CAB(installer) for Windows Mobile

CAB file is the installer file for windows mobile application.If you want to release a windows mobile application/Games, you have to create a CAB(Installer) for windows mobile.

You can create a CAB file manually from command prompt, which is a bit complicated. So, You can do it in a lot easier manner. I am describing it step by step.

1. First Build your project in release mode.
2. Create a new solution(Smart Device CAB Project) under the same solution.
3. Right Click on the newly created solution and add project output. You will find the project name that you a window built earlier, select primary output and click OK.
4. Right click on File System on Target Machine - Add Special Folder - Programs Folder.
5. And now, select Programs Folder on the File System tree, and right click on the empty panel at right and select Create New Shortcut and And select Application Folder - Primary output from AppName (Active) and press OK.
6. Press the Registry Editor button And add the string value "HKLM\Software\Mobile Practices\AppName\Version". You need to create the path key by key, and the add the string value on the right panel.
7. Build the total solution and you will get the cab file in debug/release folder

Reference:

http://www.mobilepractices.com/2008/02/how-to-create-windows-mobile-smart.html

Monday, January 26, 2009

Set up network/SIM in windows mobile 6.0 emulator












1. Open cellular emlator (All Programs->Windows Mobile6 SDK->Tools->Cellular Emulator) and at configuration Tab, show the SIM file according to you directory .

For Example: 
D:\Program Files\Tools\Cellular Emulator\USim.xml

2. Start WM 6.0 professional emulator

3. Go to File->Configure

4. Select Peripheral Tab and configure COM port according to cellular emulator. See Image

5. Perform Soft reset

6. File->Save State and Exit


Fake GPS on windows mobile emulator









  1. Install FakeGPS on the emulator PPC (CAB file)
    C:\Program Files\Windows Mobile 6 SDK\Tools\GPS

How to install/uninstall apps on emulators? 

 One way is to configure a shared drive for the emulator.   
 1.  Under the emulator menu options File->Configure   
 2.  Map a shared folder under the General tab.   
 3.  Place your cab file in the mapped shared folder.   
 4.  Use the emulator's file explorer to navigate to the Storage Card  directory.
 5.  Click on your cab file and follow the install procedure.
  1. Launch the application FakeGPS with a simple text file containing a list of GPS NMEA messages, an example is provided : fakegpsdata.txt

  2. Launch the example code from VS2005 : the projet GPSSample
    C:\Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CS\GPS

Tuesday, December 16, 2008

Parsing a XML file(JAVA)

Java File(FileParser.java):

import java.io.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;

public class FileParser
{
String fileName;
/** Creates a new instance of FileParser */
public FileParser(String name)
{
this.fileName= name;
File f = new File(fileName);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try
{
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(f);
read(doc);
}
catch(Exception e)
{
e.printStackTrace();
}


}

public void read(Document doc)
{
Element root = doc.getDocumentElement();
NodeList list = doc.getElementsByTagName("campagn");
for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; NodeList nodelist = element.getElementsByTagName("name"); Element element1 = (Element) nodelist.item(0); NodeList fstNm = element1.getChildNodes(); System.out.println("Name : " + (fstNm.item(0)).getNodeValue()); NodeList nodelist1 = element.getElementsByTagName("beginningdate"); Element element2 = (Element) nodelist1.item(0); NodeList beginningdate = element2.getChildNodes(); System.out.println("beginningdate : " + (beginningdate.item(0)).getNodeValue()); NodeList nodelist2 = element.getElementsByTagName("endingdate"); Element element3 = (Element) nodelist2.item(0); NodeList endingdate = element3.getChildNodes(); System.out.println("endingdate : " + (endingdate.item(0)).getNodeValue()); NodeList nodelist3 = element.getElementsByTagName("file"); Element element4 = (Element) nodelist3.item(0); NodeList file = element4.getChildNodes(); System.out.println("file : " + (file.item(0)).getNodeValue()); } } } } ------------------------==============------------------------ XML File(campagn.xml):



nike
22/05/08
29/05/08
ftp://www.myminimarks.com/campagn/file/abc.txt



addidas
11/11/08
12/12/09
ftp://www.myminimarks.com/campagn/file/def.txt


Loading...