Wednesday, October 17, 2012

Pre-Exam Warm Up

It's been a while since I have blogged! A lot has happened to me in last year. I was admitted into Goethe Universitaet Frankfurt to Master's program in Wirtschaftsinformatik (Business informatics), with extreme luck I'd say, since they did not see that I don't have required DSH. Then I had to learn German, and eventually got DSH 3. And I also went and still going through legal troubles to get German passport.

Last semester went pretty tough for me. Not that I managed to switch from full-time job to part-time job only in the middle of the semester, due to possibility of losing work permit and consequently ability to apply for German passport, but I also had to pass all the preparatory economics courses during that semester (because of a mistake of my academic adviser, not telling me that I have to be done with them in first 2 semesters). Oh, and all of that was in German, which I still had troubles with.

But it all went pretty well. In the beginning of June I finally got permanent residence, which enabled me to switch to part-time job, and then after a short vacation I was day and night in the library, when not at work or in the lectures. I knew I had to work hard: first, I had to catch up with the material, second, I had to spend more time on material, because it was in German, and third, I had to pass all the exams not to be kicked out. And since usually in German universities the grade for the course comes from a single final exam at the end of the semester, I also needed concentration during finals' period. So I came up with something I call the pre-exam warm-up technique.

Most of exams in Uni Frankfurt last 1.5 hours, which is pretty short, so you don't want to loose any time. What I noticed before from exams, is that when you go in, it may take up to 10 minutes until your brain becomes fully focused on material. It's like the warm-up phase that athletes need to catch their "second wind". In 1.5 hour exam that is a lot of time, it's most likely the time you don't want to loose. So I did what I learned in Thai Boxing, that when you have a fight, you warm-up BEFORE entering the ring, so that in the ring your body is already warm and on its top performance. I warmed up my brain BEFORE entering the exam, so that I start the exam with my brain fully concentrated on the subject. I usually did this by coming around half an hour earlier to university, and repeating exam material, either by last-minute memorization, or just solving/skimming over practice problems. If the exam is early in the morning, I have to mention the importance of right sleeping: it's best if the night before the exam you sleep and then wake up 1-2 hours earlier than usual. The only break that you get is when you have to remove your books/materials right before the exam, but that is negligible, your brain is already awake enough to be on its top performance, but still has energy for 1.5 hours of exam.

This especially helped me a lot with one exam, where there are a lot of question, and there is barely time to finish them all. I finished it in the last minute right before I had to give it in, and consequently not only passed, but also got a pretty good grade from it. Overall, I passed all the exams in last semester, even thought not all of them with good grades, but I still feel good about it :) A month after the finals were over, I had to take DSH exam, which I also passed, so now I can continue my master's studies without any hindrance.

A new semester started now, and I am really looking forward it, I have a lot of interesting courses this semester. Good luck to all fellow students! :)

Wednesday, July 18, 2012

Transferring Glassfish 2.1 Server

I needed to set-up a new Glassfish server, but because it was heavily customized and configured because of the project I am working on, it was better to transfer it - that is to pack it in old location, and unpack in new one. After a bit of tweaking, I made it run, however it would not start due to following error:

[#|2012-07-18T17:19:52.818+0200|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=10;_ThreadName=main;_RequestID=e0307780-d207-48c1-81ba-0be61d2f1037;|java.lang.RuntimeException: EMBEDDED Broker start failure:code = 1

This happened because the Glassfish on the other computer was packed while running, thus some lock file was there. ( Lesson for the future: shut down the server before transferring)

So what you have to do is remove the following file {domain_folder}\imq\instances\imqbroker\lock, and the server will work just fine.

Source: http://old.nabble.com/Glassfish-V2-failed-to-start,-broker%3Dembedded,-failure:code-%3D-1-td17728741.html

Friday, May 4, 2012

Recursively deleting .svn folders.

In Windows, create a clearSvn.cmd file and put following contents in it:


for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (
    rd /s /q "%%i"
)

Running it should do the job. Alternatively .cvs or any other recursively occurring folders can be deleted by this script.

For MacOS, Linux and other Unix-compatible systems, the command would be even simpler:
rm -rf `find . -type d -name .svn`


However when you check out the project for the first time and want to later delete svn dependencies, it is better to use svn export.

Thursday, April 19, 2012

Removing Glassfish 3 Windows Service

I've recently tried removing the Glassfish 3.1 server that I had installed long ago, and came into the problem that even after uninstalling the Glassfish from the system, there was still a windows service that was starting the server on startup. So I needed to get rid of the windows service. Its a pretty straightforward task, achieved simply by the command

sc delete <service_name>

run in the command prompt with administrator right (right-click -> "Run as Administrator"). However its pretty much irreversible, which means you have to be sure that you will not want it anytime soon. I am managing my application server runtimes through eclipse anyway, so its not the desired way of things for me.

The Glassfish server is usually stored under the name glassfish, so executing sc delete glassfish should do the task. However to be sure, you can open the list of services, and find the Glassfish service, and copy the value from "Service Name" (do not confuse with "Display Name").

Thursday, January 19, 2012

Think Business

Its not a new discovery that priorities in commercial and scientific/academic software development are different.   For example, if you need to delete an arbitrary record, but keep its data in the database, you just add "delete" attribute to the record, and set it to true when the record has been deleted. Straightforward, right?

Not really - believe it or not, most likely a deleted or cancelled record will want to have at least a "comment" and a "timestamp" section. Maybe also the username of the one, who deleted/cancelled the record. It may not be in the specification, so many programmers are likely to apply YAGNI principle, however sooner or later the change request is likely to come in any more or less serious project, especially if it is an agile project, with no hard-written specification. The last time I had such an issue, we decided to go with "deleted flag" option, and the change request came in 2 weeks.

So this was my small experience to "incorporate changes". I guess that is where the "industrial experience" is about: being able to correctly predict the changes, and thinking about business value of a feature from the user perspective. 

Tuesday, December 13, 2011

Calling a JMX Bean method in JBoss with an example of clearing JMS Queue

I needed to empty one JMS (Java Message Service) queue in JBoss 4.2.2, but I found out that JMS does not have a standard way to delete messages and empty the queue, and emptying a queue is provider-dependent operation. So I figured out that in JBoss 4.2.2 I will need to call removeAllMessages() method from Management Bean (MBean) that is associated with the queue that we want to empty. So here are the steps:

Tuesday, August 23, 2011

@Override annotation in Java 5 vs 6

I was porting a Java 6 project to Java 5 today due to requirements, and I came up with a feature difference that I was not aware of before. @Override annotation was introduced in Java 5 to mark methods that have to override methods from superclass, and to give compiler error when such overrides do not occur. However only since Java 6 you can use @Override in order to mark methods that implement the methods from interface, thus putting @Override in a method that implements method of the interface, will result in compile error in Java 5. It was somehow forgotten to be put in Java SE 6 API documentation, but was promised to be fixed in Java 7 API documentation. Blog entry from Oracle: http://blogs.oracle.com/ahe/entry/override_snafu