Tuesday, May 21, 2013

My takeaways from JavaOne 2013

This year I attended the JavaOne at Novotel HICC Hyderabad. I attended mainly the sessions on Java. J2EE, and JavaFX, with a bit of extremely innovative enhancements to Oracle DB sessions. Here's the main takeaways from the sessions I attended:

1. Lambda operator and closure coming to JDK8. This is an outright change, a change to all the 4k+ classes in the java libraries. Code will become simpler, neater, and also improve in performance. This is not just a cosmetic sugar coating change, there have been performance improvements as well with these new features.

2. Going by their philosophy of less boiler plate code (which also includes the closure introduction), they have introduced simpler ways to code and work with various J2EE components like the JMS2.0, etc.

3. JavaFX can now be programmed from any of the languages that run on JVM, such as Groovy, Scala, Clojure, etc. I was amazed by the language Groovy! even learning it our of my own interest :)

4. A brand new JavaScript engine coming in JDK8 (I guess) which will be called NashHorn (replaces the earlier Mozilla engine 'Rhino').
This will have feature to launch the JS engine from within Java code, run a JS file from the commandline, and use Java libraries much more easier from within JS!

4. MapReduce functionality will be supported in Oracle RDBMS 12c, and will be exposed via 2 interfaces - a) the already present way of Java Stored Procedure (this will run the same M/R code that runs on Hadoop), and
b) an SQL interface - no need for SQL/PlSQL programmers to learn Java and M/R. They can leverage the newly introduced SQL constructs to run mapper and reducer jobs using SQL queries.

5. Oracle RDBMS 12c (I guess) will support Data Sockets that will pull data from any data source, be it another RDBMS, or NoSQL DBs!

Note: The above mentioned information is solely my personal opinion and updates from what I understood from the sessions I attended. These should not be considered to be the word of truth or official updates.

Sunday, February 3, 2013

My experiements with rooting wildfire!



Method 1: Only unrevoked3
Steps followed: http://forum.xda-developers.com/showthread.php?t=788776
Result: Failure

First I tried with unrevoked3

It didn't work out.
The reflash_package.exe program gave the message "Error: unable to get root. Is your firmware too new?"
The same issue is mentioned in comments to this page. I saw it after I got the error :(



Method 2: Revolutionary (also uses GoldCard and unrevoked3)
Steps followed: http://forum.xda-developers.com/showthread.php?t=1145035
and http://www.aritrasen.com/2011/09/17/how-to-root-htc-wildfire-2-2-1-and-install-cyanogenmod/

Result: Success!

Revolutionary does not work with HBOOT 1.02.0000 that my Wildfire has. I need to downgrade it to HBOOT 1.01.0001 :(

Followed mainly the link (http://www.aritrasen.com/2011/09/17/how-to-root-htc-wildfire-2-2-1-and-install-cyanogenmod/) and was able to do these:
a) Downgrade HBOOT from 1.02.0000 to 1.01.0001
b) Getting S-OFF

One note here: The above links may tell you to format your SD card before proceeding with the GoldCard generation. But that is not required! I was able to proceed without any formatting with all my SD card data intact.

There can be little scare sometimes, such as when a particular step gets stuck. But do not be afraid. Just google it out. There is good help over the net! One thing, ensure that USB debugging is always turned on.

While running step2.bat of buzzdowngrade, the script exited with an error for me:
FAILED (remote: 90 hboot pre-update! please flush image again immediately)
*** Rom downgrade finished, rebooting to bootloader. ***
rebooting into bootloader... FAILED (status read failed (Too many links))


I opened up step2.bat. Found these lines:
echo *** Starting the ROM downgrade ***
fastboot flash zip rom.zip

echo *** Rom downgrade finished, rebooting to bootloader. ***
fastboot reboot-bootloader


Surely the script's error was asking me to re-run the command "fastboot flash zip rom.zip".
It succeeded! Then I ran the last command from the step2.bat: "fastboot reboot-bootloader ".
Bingo! Done! :)

Specially, after your HBOOT is downgraded, it took quite sometime for the phone to boot (with the HTC white screen showing for long). But eventually it booted. But since, HBOOT was downgraded or perhaps because of running GoldCard, all settings and accounts on my phone were gone. Never mind, I had already backed my contact, messages, apps :P

Downgrade to Eclair

Now the next step is to downgrade OS to Eclair (Android 2.1) and then install Unrevoked3. I think after this, Unrevoked should succeed. (It does not work on Wildfire on Froyo (Android 2.1)).

Oh yeah, it did!

Now, my Wildfire has Eclair (Android 2.1), S-OFF, and rooted. Since my phone is rooted, I can see SuperUser app in my app drawer. :)

Install Gingerbread


Now I need to install Cyanogenmod 7 (Gingerbread).
I downloaded the cm-7.2.0-buzz.zip from http://download.cyanogenmod.org/?type=stable&device=buzz, instead of the older update-cm-7.0.3-buzz-signed.zip mentioned on the blog I followed.
I have chosen to go for unsigned archive. Finger crossed! Lets see if this works...

Yayy!! I have Gingerbread now on my Wildfire! :)

--------------------------------------------------------------------------

Install Google Apps

Now I am missing the Google's propitiatory apps, such as gmail, play, etc. I am also unable to add my gmail account :(
Found that I need to install gapps separately using the gapps-gb-20110828-signed.zip.
Following this page , I was able to flash the gapps image.

When I rebooted, the phone asked me to add a gmail account. Once I did that, it took me to Market Place (which soon got updated to Google Play Store) :)

Yahoo!

---------------------------------------------------------------------------

Screenshots finally! (ADW launcher on top of Cyanogenmod 7.2 (Gingerbread fork))



 

Monday, January 7, 2013

Install Hiccups - Tips for Linux!



1. X11 Login issue on Fedora


Ever encountered a login problem on Fedora? The graphical login screen gets stuck, refreshes, and always comes back to the login screen, even when you entered the correct credentials?

If yes, then you might also be facing an issue same as I faced, on my fully setup, customized Fedora 17 XFCE spin!

I tried my luck many times. The command line login session (Ctrl+Alt+F# key) works flawlessly though. The issue is only with the graphical login.

I got an error once when my repeated trials:
Could not create ICE listening socket: Cannot establish any listening sockets"
Fedora Bug: https://bugzilla.redhat.com/show_bug.cgi?id=829324

Solution:
Try login in to the command line session (press Ctrl+Alt+F3 Key for example).
Clear the X11 graphics lock
rm -r /tmp/.X11-unix /tmp/.ICE-unix /tmp/.X0-lock 
 
But, this might not work! It did not work for me. I have posted a comment on the above open redhat bug.

Update: My Fedora 17 XFCE's graphical login started working after approx 1 month.
 
 
 

2. Ubuntu does not recognise the Fedora's LVM partitions! 


lvm might not be installed on your Ubuntu!
sudo -i
apt-get install lvm2
modprobe dm-mod
vgchange -a y


[source: http://www.linuxquestions.org/questions/fedora-35/how-can-i-mount-lvm-partition-in-ubuntu-569507/]

Still this may not work. You may need to mount the file system manually.

See if the lvm file system is readable:
lvdisplay

Once you see the lvm file system, add the command to mount it to an existing directory in /etc/fstab :
/dev/vg_aanondodhara/lv_root /fedora_root  ext4    defaults        0      0


3. Title bar of windows disappeared (Fedora 17 xfce)

Most probable cause is that the window manager in XFCE (xfwm4) might have stopped.

Check if xfwm4 is running:
ps -eF | grep xfwm

If not, start xfwm4 from a terminal
xfwm4

This worked for me.

Wednesday, December 19, 2012

Part-time courses from IIIT Hyderabad

Let me paste here some details of the PGSSP course offered by IIIT-H for the working professionals in Hyderabad, and on the future route that one may wish to take (either a MTech, MS, or PhD). I had written this to one friend who was interested in PhD, but I feel that the same should give anyone (a working professional, looking for a part-time course) a good idea about the PGSSP programme, and a later MTech/MS, as well.

[Disclaimer: The information and the opinion presented here are based on my personal opinion and experience. While I have tried to be as correct and unbiased as possible, the following can not be taken as the ultimate or the final word or information for the part-time courses offered by IIIT Hyderabad. For official information, please go to iiit.ac.in and also enquire from IIIT-H's admission office before taking any decision.]

Q. The offer says that u have to enroll in few courses max of two per semester. Does this course offer a degree of Master? If yes, then how many course we need to take in Total?

>> Part time students can take a minimum of 1 course per sem, or a max of 2 courses per sem. PGSSP is kind of a probation period for professionals willing to enter the masters/doctorate. You get 1 year (2 sems) to prove your worth to your (possible) guide or college.

If it is MTech, it has to be 64 credits. Each course is normally of 4 credits. And you can take a max of 2 courses i.e., 8 credits in sem.
Similarly, MS is 48 credits (24 credits for subjects, and 24 credits for thesis)

Q. Can u tell us about the classes which happens in IIIT, the duration and  time of classes.

>> Each subject will have biweekly classes, each of 90 mins duration. You can check the timetable for this semester to get an idea.

Q. How is your experience with PGSSP program & with faculties? Also please provide some insight on overall pressure.

>> PGSSP is quite good from the learning perspective, but tough when done along with your office load. The faculties are very well qualified, proficient in their areas.
As far as study load is concerned, you can take a min of 1 course, and a max of 2 courses per sem in PGSSP. [each course can have 4 to 6 credits. I have always taken 4 credit courses :P )
Each course will have 2 classes a week (1 1/2 hours) and you might have to jump off the office in between work days to attend the classes (there are grades on the attendance)
Each course can have a max of 3 written exams, 2 projects, and weekly assignments. The particular faculty may relax the rules, to either 2 exams, 1 project, or no exam at all.

As per as I have seen, the 1st year is the toughest! You will feel to drop out many times! Only the passion for research and learning can help you continue!

Q. How flexible is IIIT in research topic, are there any fixed research topics which institute insist on, or we are free to choose research topic of our interest?

>> This is based on your previous Academic and Work Experience. Based on this, and on your planned future research interests, the professor will suggest specific courses.
Once you are formally into the research (either MS or PhD), you are free to choose your subjects. But it is good to chart your path at IIIT, right from the first sem at PGSSP. You need to talk to a professor under whom you feel you can do research in your area of interest.

In my case, I wanted to do a specialization in "Semantic Search" area, so the subjects I took (as my professor/guide suggested) were Cloud Computing, Pattern Recognition, NLP, IR, etc.) and their credits got migrated to my MS credit, when I upgraded my PGSSP to an MS by Research!

Q. Is there any mandatory minimum attendance? In my case this will be deciding criteria as my role requires me to travel based on business need.

>> Yes! For all subject courses, attendance forms a part of your grades. Every research course, MS or PhD, half of the credits are given to subjects, and half to research/thesis.

Q. Is there any entrance exam for PGSSP as well?

>> No. PGSSP is for working professionals. You can show your work and academic experience through a Statement of Purpose (SOP) when you fill your admission form. You might need a recommendation letter from your company, and a statement that your company is okay to allow you study along side your work ... something of this sort.

Q. I'm aware of the process but seems there are exceptions and exemptions, it is mentioned that some students may not require entrance exam or may be exempted from some course as they might already have relevant course in their previous degree, do you have any such experience or know someone who was given any exemption?

>> Correct, it all depends on your earlier academic/work experience in the research area / lab you are planning to work on. The particular professor's decision also matters.
I got into PGSSP through a recommendation letter from my company, and I needed no entrance exams. As far as I know, there is no entrances for PGSSP for certain.

Q. Will be grateful if you could provide details about your journey, will definitely inspire and motivate me :)  

If you plan to continue a part-time course, then starting with PGSSP is the best option available. This first year will give you an indication how you cope with the load, and whether you can sustain working and studying side-by-side.
For me it was hard, but the passion of learning and and the excitement of doing research in my interest areas, have guided me and helped me pass over the difficult first phase of PGSSP (1 year). You need a min CGPA of 7 to get upgraded to an MS/MTech, and a CGPA of 8 for a PhD approval.
I learned to know and work with latest Search and IR processes and technologies, and cloud infrastructures. The feel of getting into a research mode in a research oriented institute / lab is great! But I should warn you, it is tough to do both - work and study/research. You will need to be at the top of your time and priority management skills.

Tuesday, November 27, 2012

Useful commands and howtos at your finger tips

Useful commands and howtos at your finger tips

linux|unix|dos|windows|mac
jdk|regex|...

1. How to find files and operate some command on that file list

Example (a) Find all files updated within the last 11 minutes, and copy them to another directory:
find . -mmin 11 -exec cp '{}' /home/temp/ \;



2. How to read a file line by line through a unix/linux shell script

http://www.bashguru.com/2010/05/how-to-read-file-line-by-line-in-shell.html

3. How to extract only the file names after you have figured out which files from the ls -ltr listing

Assume filelist.txt contains the ls- ltr output redirected
cat filelist.lst
-rw-r-----  1 oraxxxx emsxxxx     2119 Dec  5 02:50 sid_ora_5565.trc
-rw-r-----  1 oraxxxx emsxxxx    11591 Dec  5 02:50 sid_ora_24464_TEST.trm
-rw-r-----  1 oraxxxx emsxxxx   469796 Dec  5 02:50 sid_ora_5565_TEST.trc
-rw-r-----  1 oraxxxx emsxxxx   698558 Dec  5 02:51 sid_lgwr_6551.trc
-rw-r-----  1 oraxxxx emsxxxx     5855 Dec  5 02:52 sid_ora_31733_TEST.trm
-rw-r-----  1 oraxxxx emsxxxx    12321 Dec  5 02:52 sid_ora_29474_TEST.trm

cat filelist.txt | cut -d ":" -f 2 | cut -d  " " -f 2 > fileslist.txt

Now fileslist.txt will have only the filenames

cat fileslist.tst
sid_ora_5565.trc
sid_ora_24464_TEST.trm
sid_ora_5565_TEST.trc
sid_lgwr_6551.trc
sid_ora_31733_TEST.trm
sid_ora_29474_TEST.trm


4. How to convert from postscript to pdf format


Ensure you have ghostscript installed
Then use the ps2pdf command

ps2pdf -dEmbedAllFonts=true -dOptimize=true -dUseFlateCompression=true myfile.ps

This will create a pdf file with the same name as the .ps file, in the current working directory.

[This page gives a detailed overview of the ps2pdf command.]


5. How to generate a keystore


JDK ships with a keytool program, that can be used to generate one keystore:

keytool -genkey -v -keystore filename.keystore -alias keyaliasname -keyalg RSA -keysize 2048 -validity 10000

6. How to list all files within a given directory in DOS/Windows

Use the following DOS command in the command window:
dir /b /s /a:-D

[Source: http://superuser.com/questions/653860/list-files-recursively-showing-only-full-path-and-file-size-from-windows-command]



7. Howzzat RegEx ?

7.1. How to get the file name only, from a list of full path names ?


For example, we have a file that has list of full path names, like as shown below:

D:\lib\SCEMDT-lib\xmlparserV2\xml.jar
D:\lib\SCEMDT-lib\xmlparserV2\xmlparserv2.jar
D:\lib\SCEMDT-lib\jdev-rt.jar
D:\lib\SCEMDT-lib\ant-launcher.jar

How do we get only the filenames then?

Answer: 
Use regex (.*?)(\\(?=[^\\]*$))(.*?$) as the matching pattern.
and then replace with \3

Explanation:
The second part of the regex i.e., (\\(?=[^\\]*$)) says to match a literal backslash \ and then asserts ((?=) is positive lookahead) that no other character up to the end of the string is a backslash \. 
The first part and the third part of the regex is plain and simple: the first part (.*?) points to the string before the last backslash \; and the second part (.*?$) points to the string after the last backslash \ till the end of the line.

The replacement pattern is \3 , which means the third part (i.e., the string after the last backslash \ till the end of the line)




8. Closing a session after running a blocking command line script

After you have started a blocking command line script (such as the startWebLogic.sh), you can not close the session from which you started the script. Because, if you close the session, then the script too closes.

One option is to use nohup & . But this can work when the script does not ask for any console input, such as credentials, etc.

For scripts like startWebLogic.sh that asks for console inputs, we still have a way:

Follow the following sequence of steps to detach the running startWeblogic.sh process after the weblogic has been started.
Pause: ^z
Send to background: bg
Check background jobs: jobs
Detach from session: disown
Verify if really detached: jobs



9. mactips - Tips & Howtos for your first mac

(esp. if this is the first time, you have moved to a Mac from a Windows or a Linux)

9.1. Setting environment variables that are available to all applications

Put the setenv statements in the file /etc/launchd.conf
It requires superuser permissions.

sudo vi /etc/launchd.conf

setenv JAVA_VERSION 1.6
setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
setenv GROOVY_HOME /Applications/Dev/groovy
Save the file, and reboot the mac. Or, run the following command, and relaunch the required applications:
grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl

Courtesy: Setting environment variables in OS X?

Later on, even after restarting, the env variable settings sometimes vanish. I added the above command into the ~/.bash_profile file.

9.2 Setting PATH on mac

By any of the following methods:
  1. $HOME/.bash_profile file using export syntax.
  2. /etc/paths.d directory.

9.3 Copy Path of a folder in mac

  • Open Automator.
  • Select the Service template.
  • Set options at the top to Service receives selected Files or Folders in Finder.
  • Drag over “Copy to Clipboard.”
  • Save the service with a name like “Copy Path as text
Now, in the right-click context menu for any folder in finder, you will see a new menu item "Copy Path as text"

The service can also be assigned a keyboard shortcut, from the System Preferences -> Keyboard -> Shortcuts

Courtesy: http://stationinthemetro.com/2014/06/04/copy-file-path-as-text-in-mac-os-x


...to be continued...

Monday, November 28, 2011

Not a bye, but an additional home

I recently bought a domain for myself at bhaskarghosh.in, and created my first wordpress driven blog cum site there.
I have been, since then, fighting with my wits, to stop duplicatability of efforts and naturally of posts and resources. But, I can simply not leave the beautiful look and feel of Google's Blogger, even when wordpress.org gives me much more control.
Please visit my new blog. I am not stopping my love for first house, but I have decided to share it with a new home.

Musical Poet

bhaskarghosh.in

Saturday, May 7, 2011

Sync Facebook events with Google Calendar?

Ever missed events on Facebook, because there is no app that reminds you of your Facebook events?

Almost all Android phones are very well integrated with Google Calendar. So if we sync up the Facebook events with Google Calendar, our problem is solved!!!

Go to Facebook events
Select Export events
Facebook pops up a dialog where it displays an URL. Copy that URL.

Now go to Google Calendar.
Add a new Calendar (Select Add by URL)
Paste the URL copied earlier... And BANG!

All Facebook events are imported and always synced with the Google's Calendar!

Courtesy: How to Sync Facebook Events with Google Calendar