Friday, October 29, 2010

Configuring NetBeans for BlackBerry development







  • Install BB JDK.
  • Copy following to a file and make necessary changes. 
    <?xml version='1.0'?>
    <!DOCTYPE platform PUBLIC '-//NetBeans//DTD J2ME PlatformDefinition 1.0//EN' 
              'http://www.netbeans.org/dtds/j2me-platformdefinition-1_0.dtd'>
    <platform name="BlackBerry_JDE_421" 
              home="C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1" 
              type="CUSTOM" 
              displayname="BlackBerry JDE 421" 
              srcpath="" 
              docpath="${platform.home}/docs/api," 
              preverifycmd="&quot;{platformhome}{/}bin{/}preverify&quot; 
                            {classpath|-classpath &quot;{classpath}&quot;} 
                            -d &quot;{destdir}&quot; &quot;{srcdir}&quot;" 
              runcmd="cmd /C &quot;cd /D {platformhome}{/}simulator&amp;{device}&quot;" 
              debugcmd="cmd /C &quot;cd /D {platformhome}{/}bin&amp;jdwp&quot;">
        <device name="8800" description="8800">
            <optional name="JSR75" version="1.0" 
                      displayname="File Connection and PIM Optional Packages" 
                      classpath="${platform.home}/lib/net_rim_api.jar" 
                      dependencies="" default="true"/>
            <optional name="MMAPI" version="1.0" 
                      displayname="Mobile Media API" 
                      classpath="${platform.home}/lib/net_rim_api.jar" 
                      dependencies="" default="true"/>
            <configuration name="CLDC" version="1.1" 
                           displayname="Connected Limited Device Configuration" 
                           classpath="${platform.home}/lib/net_rim_api.jar" 
                           dependencies="" default="true"/>
            <optional name="OBEX" version="1.0" 
                      displayname="Object Exchange APIs" 
                      classpath="${platform.home}/lib/net_rim_api.jar" 
                      dependencies="" default="true"/>
            <optional name="JSR82" version="1.0" 
                      displayname="Java APIs for Bluetooth Wireless Technology" 
                      classpath="${platform.home}/lib/net_rim_api.jar" 
                      dependencies="" default="true"/>
            <optional name="WMA" version="1.1" 
                      displayname="Wireless Messaging API" 
                      classpath="${platform.home}/lib/net_rim_api.jar" 
                      dependencies="" default="true"/>
            <optional name="JSR179" version="1.0" 
                      displayname="Location Based APIs" 
                      classpath="${platform.home}/lib/net_rim_api.jar" 
                      dependencies="" default="true"/>
            <optional name="JSR177" version="1.0" 
                      displayname="Security and Trust Services APIs" 
                      classpath="${platform.home}/lib/net_rim_api.jar" 
                      dependencies="" default="true"/>
            <profile name="MIDP" version="2.0" 
                     displayname="Mobile Information Device Profile" 
                     classpath="${platform.home}/lib/net_rim_api.jar" 
                     dependencies="" default="true"/>
        </device>
    </platform>
  • Save it under - C:\Documents and Settings:
    .netbeans\6.x\config\Services\Platforms\org-netbeans-api-java-Platform 
    as  BlackBerry_JDE_421.xml.
  • Restart NetBeans. 
  • Open a Mobile project and add following to build.xml (just above </project> tag)

    <target name="do-preprocess">
            <fail unless="libs.ant-contrib.classpath">
         Classpath to Ant Contrib library (libs.ant-contrib.classpath property) is not set.
            </fail>
            <taskdef resource="net/sf/antcontrib/antlib.xml">
                <classpath>
                    <pathelement path="${libs.ant-contrib.classpath}">
                </pathelement></classpath>
            </taskdef>
            <available file="${platform.home}/bin/rapc.exe" property="do.rapc">
            <if>
                <isset property="do.rapc">
                <then>
                    <property name="jpda.port" value="8000">
                    <path id="antlib.classpath">
                        <fileset dir="${user.dir}/mobility8/modules/ext/" includes="ant-contrib-1.0b3.jar">
                    </fileset></path>
                    <mkdir dir="${dist.dir}">
                    <path id="src-files">
                        <fileset dir="${src.dir}" includes="**/*.*">
                    </fileset></path>
                    <property name="srcs" value="${toString:src-files}">
                    <for delimiter=";" list="${srcs}" param="file" trim="true">
                        <sequential>
                            <echo append="true" file="${src.dir}/${name}_build.files" message="@{file}${line.separator}">
                        </echo></sequential>
                    </for>
                    <touch file="${dist.dir}/${dist.jar}">
                    <nb-overrideproperty name="buildsystem.baton" value="${preprocessed.dir}">
                </nb-overrideproperty></touch></property></mkdir></property></then>
                <else>
                    <nb-overrideproperty name="buildsystem.baton" value="${src.dir}">
                    <antcall target="${name}-impl.do-preprocess">
                </antcall></nb-overrideproperty></else>
            </isset></if>
        </available></target>
        <target name="do-compile">
            <if>
                <isset property="do.rapc">
                <then>
                    <antcall target="create-jad">
                    <antcall target="update-jad">
                    <copy file="${dist.dir}/${dist.jad}" todir="${src.dir}">
                    <exec dir="${src.dir}" executable="${platform.home}/bin/rapc.exe" failonerror="true">
                        <arg value="-quiet">
                        <arg value="import=${platform.bootclasspath};${libs.classpath}">
                        <arg value="codename=${name}">
                        <arg value="-midlet">
                        <arg value="jad=${dist.jad}">
                        <arg value="@${name}_build.files">
                    </arg></arg></arg></arg></arg></arg></exec>
                    <delete file="${basedir}/${src.dir}/${name}_build.files">
                    <copy file="${name}.alx" todir="${dist.dir}">
                    <nb-overrideproperty name="buildsystem.baton" value="${build.classes.dir}">
                </nb-overrideproperty></copy></delete></copy></antcall></antcall></then>
                <else>
                    <nb-overrideproperty name="buildsystem.baton" value="${preprocessed.dir}">
                    <antcall target="${name}-impl.do-compile">
                </antcall></nb-overrideproperty></else>
            </isset></if>
        </target>
        <target name="pre-obfuscate">
            <nb-overrideproperty name="buildsystem.baton" value="${build.classes.dir}">
        </nb-overrideproperty></target>
        <target if="do.rapc" name="post-jar">
            <move todir="${dist.dir}">
                <fileset dir="${src.dir}">
                    <include name="**/${name}*.*">
                </include></fileset>
            </move>
            <copy todir="${platform.home}/simulator" verbose="true">
                <fileset dir="${dist.dir}">
                    <include name="**/${name}*.*">
                </include></fileset>
            </copy>
        </target>
        <target name="post-clean">
            <delete failonerror="false" includeemptydirs="true">
                <fileset dir="${platform.home}/simulator">
                    <include name="**/${name}*.*">
                </include></fileset>
                <fileset dir="${dist.dir}">
                    <include name="**/*.*">
                </include></fileset>
                <fileset dir="${src.dir}">
                    <include name="**/${name}*.*">
                </include></fileset>
            </delete>
        </target>
  • Create a file called [appname].alx in the project level and copy following to it.

    <loader version="1.0">
        <application id="MobileApplication1">
            <name>
               MobileApplication1
            </name>
            <description/>
            <version>
                1.0
            </version>
            <vendor>
            </vendor>
            <copyright>
            </copyright>
            <fileset Java="1.3">
                <directory/>
                <files>
                    MobileApplication1.cod
                </files>
            </fileset>
            <application id="MobileApplication1">
                <name/>
                <description/>
                <version>
                    1.0
                </version>
                <vendor>
                    Sun Microsystems Inc.
                </vendor>
                <copyright>
                    Copyright (c) 2008 Sun Microsystems Inc.
                </copyright>


            </application>
        </application>
    </loader>
  • That's it

  • Share Article : Configuring NetBeans for BlackBerry development
    Share/Save/Bookmark

    Sunday, October 17, 2010

    Android with NetBeans


    1.Installing Plugin  for NetBeans   
    - Go to Plugins and  add following update center  
    http://kenai.com/downloads/nbandroid/updates.xml.                                                                       
    Then Select and install Android plugin.

    2.Unzip android SDK and add it as a Java Platform for NetBeans.

    3.Then you must create an Android Virtual Device (AVD).
    An AVD defines the system image and device settings used by the emulator.
    To create an AVD, use the "android" tool provided in the Android SDK.
    Open a command prompt or terminal, navigate to the tools/ directory in the
    SDK package and execute:

    android create avd --target 2 --name my_avd


    Now it's all up to NetBeans
    [If RAM is full it will say "Device’s package manager not ready to install new packages" at
    the deployment time, close some app of PC and give some RAM]
                 

    Share Article : Android with NetBeans
    Share/Save/Bookmark

    Wednesday, October 13, 2010

    Oracle Jobs, user and privileges


    How Jobs Execute

    Jnnn processes execute jobs. To execute a job, the process creates a session to run the job. When a Jnnn process runs a job, the job is run in the same environment in which it was submitted and with the owner's default privileges. The owner must be explicitly granted the necessary object privileges for all objects referenced within the job definition.
    When you force a job to run using the procedure DBMS_JOB.RUN, the job is run by your user process and with your default privileges only. Privileges granted to you through roles are unavailable. You must be explicitly granted the necessary object privileges for all objects referenced within the job definition.

    Share Article : Oracle Jobs, user and privileges
    Share/Save/Bookmark