Wednesday, May 19, 2010

PowerShell – Windows

Thought it will be interesting to share with you all , these steps involved in certifying PowerShell scripts.
I tried it on Windows 7. So here it is.
Go to C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin>
Run the command
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin>makecert.exe -n "CN=PowerShell Local Certificate Root" -a sha1 -eku 1.3.6.1.5.5.7.3.3 -r -sv root.pvk root.cer -ss Root -sr localMachine
You will be prompted to create PrivateKey Password
Following which you will be required to enter the Private Key to successfully create the certificate.
type mmc, and in the console, add (Ctrl+M) Certificate
image
Under trusted root certifications you should be able to see the PowerShell Certificate you created for code signing.
image
now run this command
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin>makecert -pe -n "CN=PowerShell User" -ss MY -a sha1 -eku 1.3.6.1.5.5.7.3.3 -iv root.pvk -ic root.cer
and you will be prompted to enter your password again.
image
Now in PowerShell to verify your certificate type the following command , and you should see some thing like this.
image
Here is the final fun.. that uve been waiting for.
in my case I had a simple ps1 file which needed to be signed, and I signed it using the command
image
you need not be in a specific directory to sign your code. Its your option of where ever u wana be, like in Starbucks etc.

Sunday, May 9, 2010

Android – Simple Layout creation method

You can create such layouts easily as a first step towards developing android apps, by using Eclipse IDE with the SDK.
image
XML File / Code associated with the above Layout
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" >
     <LinearLayout
    android:id="@+id/LinearLayout02"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:background="#3D3D3D"
    android:layout_weight="4">
        <TextView
        android:text="Header"
        android:textSize="15pt"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_weight="1"></TextView>
    </LinearLayout>
    <LinearLayout
    android:id="@+id/LinearLayout03"
    android:layout_height="fill_parent"
    android:background="#ffffff"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_weight="1">
    <TextView
    android:text="red"
    android:id="@+id/TextView01"
    android:layout_width="wrap_conent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:gravity="center_horizontal" android:background="#aa0000"></TextView>
    <TextView
    android:text="blue"
    android:id="@+id/TextView01"
    android:layout_width="wrap_conent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:gravity="center_horizontal" android:background="#0000aa"></TextView>
    <TextView
    android:text="green"
    android:id="@+id/TextView01"
    android:layout_width="wrap_conent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:gravity="center_horizontal" android:background="#00aa00"></TextView>
    </LinearLayout>
    <LinearLayout
    android:id="@+id/LinearLayout04"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:background="#3D3D3D"
    android:layout_weight="4">
        <TextView
        android:text="Footer"
        android:textSize="15pt"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_weight="1"></TextView>
    </LinearLayout>
</LinearLayout>
-----
You should also be able to find more examples on http://developer.android.com

Saturday, May 8, 2010

Activity Management in Android

image

When you first start an application by clicking on a icon. Android starts the Task (Lets say Task1). For an example lets say the task 1 was an Web Browser Task. Initially there will be only 1 Activity(Activity1) and that is the Web Browser. In the Web site, if you had a link which will possibly be a Number of the xxx-xxx-xxxx format. Then When you click it, it will call the specific number that you clicked. It has to call via the Phone Application. Instead of creating New Task 2, It will call in the Phone Application and launch it as activity 2. So, one Activity can call another, and all those Activities get stacked up in the Parent Task which was created when we launched the Browser.

While working on a sets of Activities in the Task, if you were to click on Back Button, it will remove the Activity

from the top of the stack and display the lower task. In other words, going back to the Activity which you removed recently by hitting Back Button is not possible. Each hit on Back button unloads the top most Activity in the Stack. When there is the last Activity, and when you click Back Button you end up going to the Home Screen.

While having a Task / Stack with Set of Activities running in them, if you go back to the Home Screen, and choose a different application, a new Task is created. Which is on top of previous task. And inside this Current task you can create a set of Activities… which run on top of one another. Going back to the Previous Task (Task 1) is very simple. Go back to Home Screen, and click the Icon for Task 1(in this case, as we discussed above we launched Task 1 by clicking the Web Browser, so click that).

One Drawback is: Unloading Activity is not reversible. From a better perspective this should be possible in future, because undo should always be an option. The reason is one Activity can collect good amount of data.., and if you just loose all those by clicking Back.., it doesn't serve the purpose..

State diagram for an Android activity lifecycle. 

del.icio.us Tags: ,,

English and Japanese Keyboard in Android AVD

Problem: Some times while working on Android AVD, it might switch to Japanese Keyboard. Even modifying the settings on Menu will not work.

Way out: Keep pressing the ALT Key at the left bottom corner to switch back to English.

Friday, May 7, 2010

Did you know – Nexus One Details – For AVD

OS: Android 2.1 API 7

Resolution: 480 x 800 – (WVGA800)

Valid & Invalid SD Memory Size:

Invalid SD Size : 0-8,2047-4104,6144-8200
Valid SD Size:9-2047,4105-6143,8201

LCD Density: 240

Nut:When you create an AVD on a 1Ghz Windows machine, the time to create AVD will approximately be the same time as it will take for a Nexus One to boot.

Setting Up Android Development Environment

Download - Java 5.0 SDK – From Oracle’s Sun Download website. (look for previous versions. because you might see only Java 6.0 SDK

Install SDK

If you downloaded J2EE, then Settings might be required, but does not really matter what ever you might give.

User Name: admin

Password: ******

Admin Port: 4848

HTTP: 8080

HTTPS: 8181

Unzip – Eclipse and Move to Program Files Folder

Unzip – Android and Move to My Documents (You want to move it in here because of some permission issues which you might hit, if you place it in Program Files Folder – Windows Might hit you back hard which will

prevent you form updating the Android SDK updates that are sent over web)

Configure System Environment Variable Path: With the value of directory path to Tools folder of Android SDK.

Path: ……<Currently Existing Path values>…. ; C:\<My Document Folder>\android-sdk-windows\tools

Open Eclipse.exe

Update the software if required

Click on Help> Install Software

Click on Add

Name: Android Plugin

Location: http://dl-ssl.google.com/android/eclipse

Click OK, and Install the Plugin.

Read – and once you AGREE to Terms and Conditions accept it, and continue

Installation Progress window appears wait for it to complete.

You might possibly try going to

Help > Android SDK and AVD Manager

Choose Available Packages

And if any available to your interest you can select those and install those packages.

You are now all set for Android Application Development using Eclipse as IDE.

As of Publishing date I had these packages were available

image

del.icio.us Tags: ,,