Wednesday, December 12, 2012

Git reference command listing

This post will be updated to reflect common used GIT command
Replace 'value' with yours.

# GIT clone repo
git clone 'git repo'

# GIT remote information
git remote -v

# GIT commit
git commit -m 'comment'

# GIT checkout
git checkout -b 'branchname'

# GIT checkout from remote
git checkout -b 'branchname' origin/'branchname'

# GIT checkout branch with tag
git checkout -b 'branchname' 'tag_name'

# GIT create branch
git branch 'branchname'

# GIT list branches
git branch

# GIT list tag
git tag

# GIT create tag
git tag -a 'tag number' -m 'comment'

# GIT remove local tag
git tag -d 'tag number'

# GIT remove remote tag
git push 'remote repo' :refs/tags/'tag number'

# GIT push
git push 'remote repo' 'local branch':'remote branch'

# GIT push tags to remote
git push 'remote repo' --tags //e.g., git push origin --tags

# GIT merge
git merge 'from branch'


If you want to revert changes made to your working copy, do this:
git checkout .
If you want to revert changes made to the index (i.e., that you have added), do this:
git reset
If you want to revert a change that you have committed, do this:
git revert ...
add changes including deletion, etc.
git add -u
Remove added changes
git rm -r --cached .
=================================================
Add command alias to git in '.gitconfig' file in your $HOME directory.
[alias]
  co = checkout
  ci = commit
  st = status
  br = branch
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  type = cat-file -t
  dump = cat-file -p

Getting hashes for the previous versions

git hist


$ git hist
* fa3c141 2011-03-09 | Added HTML header (HEAD, master) [Marina Pushkova]
* 8c32287 2011-03-09 | Added standard HTML page tags [Marina Pushkova]
* 43628f7 2011-03-09 | Added h1 tag [Marina Pushkova]
* 911e8c9 2011-03-09 | First Commit [Marina Pushkova]

git checkout  e.g., git checkout 911e8c9

Returning to the latest version in the master branch

RUN:


git checkout development


Sunday, September 9, 2012

Include external jar in Blackberry


1. Obfuscate the library jar using proguard. Somehow blackberry do not allow deep obfuscation (Crap). E.g.,

**********************************************************************************
-libraryjars WTK2.5.2\lib\midpapi21.jar;WTK2.5.2\lib\cldcapi11.jar
-forceprocessing
-useuniqueclassmembernames

-keepparameternames
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated, SourceFile,LineNumberTable,EnclosingMethod

# Keep - Library. Keep all public and protected classes, fields, and methods.

-keep public class com.* { public protected *; }
**********************************************************************************

2. Preverify the jar located in your blackberry simulator plugin.

**********************************************************************************
SET RIM_EMUL_DIR=eclipse\plugins\net.rim.ejde.componentpack4.5.0_4.5.0.30\components
%RIM_EMUL_DIR%\bin\preverify  -classpath %RIM_EMUL_DIR%\lib\net_rim_api.jar %OUTJAR% 

**********************************************************************************

3. Add the preverified jar(located in the output folder) to your blackberry project.

Wednesday, August 1, 2012

Developing J2ME on eclipse m2e with Bouncycastle LW library


Q: java.lang.NoClassDefFoundError: java/security/SecureRandom: Cannot create class in system package
A:


  1. Make sure the source folders and output folders are set to "src" and "bin" respectively. This is important: my habit is to use the project folder for both source and class files, but your built packages will have errors if you do this. EclipseME seems to put all the contents of the "source" directory (which, if it's the package directory, includes things like "deployed" and ".settings" and other stuff) in your jar, which causes problems.
    • Go to: Project -> Java Build Path -> Source. Click "Add Folder", and select "src" (create it if you need to). Remove the project folder from the build path.
    • Next, select "projectFolder/bin" as the default output folder.
    • Go to Window -> Preferences -> J2ME. Set "bin/deployed" as the deployment directory.
  2. Install and set up the BouncyCastle crypto library.
    • Download the bouncycastle j2me files from http://www.bouncycastle.org/latestreleases.html. The easiest way is to download the complete package (named something like "crypto-139.tar.gz"). Expand the archive, and look for the file "cldcclasses.zip". This is the library the J2ME apps will use.
    • Add the clcd_classes.zip library to your project: Project -> Properties -> Java Build Path -> Libraries.
    • Be sure to check "cldc_classes.zip" under "Order and Export" in Project -> Properties -> Java Build Path. It must be built with your package for obfuscation, etc. to work.
  3. Set up obfuscation. BouncyCastle includes some classes that are reimplementations of system classes (such as java.security.SecureRandom and java.lang.BigInteger). You will receive runtime security errors if your application tries to add these classes to the system. To avoid this, it is necessary to obfuscate the classes (which renames them, and places them in the default package).
    • Install ProGuard. Note that EclipseME doesn't seem to work right with proguard from the debian/ubuntu package repository, you probably have to download it manually from http://proguard.sourceforge.net. Extract the archive, and set up the ProGuard preferences in eclipse.
    • Go to: Window -> Preferences -> J2ME -> Packaging -> Obfuscation. Under "Proguard Root Directory", put the root directory of the proguard files downloaded from sourceforge (it should contain "lib", "src", "examples", "docs", etc). While there, also check the box so that the specified arguments include "-dontusemixedcaseclassnames -dontnote -defaultpackage ''". Ensure that "Proguard Keep Expressions" includes "public class * extends javax.microedition.midlet.MIDlet".
  4. Now you are ready to write your crypto code! But note that your development process and debugging are now different. Because bouncycastle depends on obfuscation for the code to run at all, and obfuscation only runs during the "packaging" stage, you can no longer simply run your emulated MIDlet with the WTK emulator to debug. Instead, you must use the following steps to test your program:
    • Right-click on the project folder, and select "J2ME -> Create Obfuscated Package".
    • Select "Run" from the "Run" menu (the first time, you can't just do "Run last launched" - you need to edit the configuration). Check the "Jad URL" radio button, and put in the path to the built JAD file (project/bin/deployed/yourJad.jad). Finally, click "Run", and you can run your project. The emulator will start listing the applications present in your JAD/JAR, and you have to launch one to test it.
Source: http://tirl.org/blogs/media-lab-blog/46/


Q: could not find jar tool executable
A: Configure the default Java to a JDK instead of JRE

Source: http://jclik.wordpress.com/2009/10/28/eclipse-could-not-find-jar-tool-executable-solution/

Tuesday, June 5, 2012

Fixing "Could not update ICEauthority file /var/lib/gdm/.ICEauthority"

> Press Crtl, Alt and F2 to get into CLI mode. > Login as Root > sudo chown -R gdm: /var/lib/gdm

How to reset a Root Password In Fedora

Entering Recovery Mode 1. While you system is starting up, hold down the Ctrl key or Esc to see the boot loader menu. After you see the menu: 2. Use the arrows to select the boot entry you want to modify. 3. Press e to edit the entry. 4. Use the arrows to go to kernel line. 5. Press a or e to append this entry. 6. At the end of the line add the word single or the number 1. 7. Press Enter to accept the changes. 8. Press b to boot this kernel. As root, changing password does not ask for your old password. Run the command: # passwd

Wednesday, March 28, 2012

VMWare extend boot partition

i. Open up a command prompt and issue the following command: vmware-vdiskmanager -x 12GB “Windows Server 2003 Standard Edition.vmdk” where 12GB is the desired size of the expanded volume.

ii. Mount harddisk with another image.

iii.

Wednesday, January 18, 2012

SVN Installation on Fedora

References:
http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/