Wednesday, June 25, 2014

Trigger Jenkins build on SVN commit with push notification

The continuous integration server Hudson knows several ways to trigger a build. If you’d like Hudson to build your project when the source-base changes and you don’t want to let him poll your Subversion periodically let Subversion trigger the build upon commit. To do that, you need to execute few steps

Jenkins / Hudson configuration

Configure your job in Hudson (Job -> Configure -> Build Triggers) with “Trigger builds remotely (e.g., from scripts)” (”uDoo” is the job name, so replace it with your job name):


hudson_build_trigger

Configure a post-commit hook in your Subversion repository

In the repository directory of your Subversion-server, a directory hook exists. In this directory you may already have a file post-commit with 744 permissions. If not, a file post-commit.tmpl exists. In that case, copy the file and change the permissions:
$ cd path/to/your/repository/hook
$ cp post-commit.tmpl post-commit
$ chmod 744 post-commit
To trigger the build via Subversion, just put the following line at the end of the post-commit file.
wget -b http://HUDSON_URL/job/JOB_NAME/build?token=my_automated_build > /dev/null
That’s it.


This is cached version of this.
To trigger build with password-protected jenkins, you could check this great article.

Friday, June 13, 2014

"Thread stuck in device driver" for Dell with Windows 8.1 - solved

You get "THREAD STUCK IN DEVICE DRIVER" after every sleep / hibernate in Dell Inspiron 15R notebook after upgrading Windows 8 to Windows 8.1. Restoring previous state before sleep was not possible and a restart os Windows was forced. I give the solution, which helped me (copy-past-ed):

I have been reading through many, many forums to have this annoying message disappear. For 3 month I was pulling my hair because of this silly message! I also have a Dell Inspiron 15R and when I turn it on, it showed this blue message saying THREAD STUCK IN DEVICE DRIVER, it then reboots itself followed by 5-10seconds of black screen. This issue only began after I updated from Windows 8 to Windows 8.1. I kept records of what I read through many forums to fix this and hopefully this will work for you.

1. I went to the Dell website and re-installed the BIOS. I believe after upgrading from Win 8 to Win 8.1, the BIOS does get a little messed up. Find out your BIOS version by pressing the Windows key + R, and type msinfo32 then and go to Dell website then reinstall it. In my case, I went to the Dell UK website and reinstalled it.
2. I went to the Intel website and installed the Intel Update Tool below. http://supportkb.intel.com/wireless/wireless-display/templates/selfservice/intelwidi/#portal/1026/article/16168.
3. I uninstalled the AMD drivers which were currently installed via Control Panel, then I restarted the laptop.
4. After logging in, I downloaded the AMD Clean Install Utility from the AMD website below.
http://support.amd.com/en-us/kb-articles/Pages/AMD-Clean-Uninstall-Utility.aspx
5. I then installed the latest AMD Catalyst Suite from the AMD website below. In my case, it’s the 64bit AMD.
http://support.amd.com/en-us/download/desktop?os=Windows+7+-+64
6. Finally from the AMD website, I installed the AMD Auto Driver Detector from the below.
http://support.amd.com/en-us/download/auto-detect-tool
7. Back to the Intel website, I clicked on the “Check Your System For Updates” link. This detected all the Intel Drivers and showed me which ones needed updating. In my case, it detected that I needed to download 3 separate drivers.
http://www.intel.com/p/en_US/support/detect
Finally, I restarted my laptop. I did them all in this order and this worked for me like a charm.

This is solution from J.King Jr which helped me. It is posted here in Microsoft's forum.

The key was to Update BIOS, and after that to make a clean install of ATI driver. I tried to skip some steps of provided how-to, but the issue continue to persist.

Wednesday, June 11, 2014

Windows 8: Start menu location & Startup folder location

There is no direct way of accessing Start menu location & Startup folder location, so you have to open them manually in Windows Explorer. The locations are:

Start menu

C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
C:\ProgramData\Microsoft\Windows\Start Menu\Programs

Startup folder

C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

Utility software

This program provides access to all Windows special folders in an easy way:

Saturday, June 7, 2014

Developers' jokes

Some people, when confronted with a problem, think, 'I know, I'll use threads' - and then two they hav erpoblesms.

A programmer is told to "go to hell", he finds the worst part of that statement is the "go to"

"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." - Nathaniel Borenstein

"I've got a really good UDP joke to tell you, but I absolutely don't care, whether you'll get it"

"What's the best part about TCP jokes? I get to keep telling them until you get them."

A SEO expert walks into a bar, pub, public house, inn, restaurant, club.

How many SEO engineers does it take to change a light bulb, lightbulb, globe, lamp, sex, xxx

99 little bugs in the code
99 bugs in the code
patch one down, compile it around
117 bugs in the code

A group of computer science geeks were listening to a lecture about Java programming at a university.
After the lecture, one of the men leaned over and grabbed a woman’s breast.
Woman: Hey! That’s private OK ?
The man hesitated for a second looking confused.
Man: But I thought we were in the same class.

In order to understand recursion you must first understand recursion.

A man flying in a hot air balloon suddenly realizes he’s lost. He reduces height and spots a man down below. He lowers the balloon further and shouts to get directions, "Excuse me, can you tell me where I am?"
The man below says: "Yes. You're in a hot air balloon, hovering 30 feet above this field."
"You must work in Information Technology," says the balloonist.
"I do" replies the man. "How did you know?"
"Well," says the balloonist, "everything you have told me is technically correct, but It's of no use to anyone."
The man below replies, "You must work in management."
"I do," replies the balloonist, "But how'd you know?"*
"Well", says the man, "you don’t know where you are or where you’re going, but you expect me to be able to help. You’re in the same position you were before we met, but now it’s my fault."

Programming is like sex. Make one mistake and you end up supporting it for the rest of your life.


Why do programmers confuse halloween and christmas? Because Oct 31 = Dec 25.

Source - reddit.com

Thursday, June 5, 2014

Catching low-level controller exceptions in Jackson

This is useful code, that could be used in controllers to catch exception while parsing json data by jackson.

    @ExceptionHandler({org.springframework.http.converter.HttpMessageNotReadableException.class})
    @ResponseBody
    public String resolveException(Exception e) throws Exception{
        throw e;
    }

It catches all exception thrown by this class members.

Examples of join and other queries for Hibernate (HQL)

Examples of usage of Hibernate query language. Could be used in repositories with @Query annotation.

Join:
1. select night.id nid, night.night_duration, night.night_date, area.id aid, night.area_id, area.name from Night night, Area area where night.area_id = area.id

2. from Bid bid left join fetch bid.item left join fetch bid.bidder where bid.amount > 100

3. from Book book inner join book.chapters chapter where chapter.title like '%hibernate%'

4. from com.package.Venue venue inner join venue.name.translations t WHERE t.string = :name
Double join table

5. select cont from Continent cont join fetch cont.countries where cont.name = 'Europe'



Basic:
1. select p from Plane p

2. select n from Night n where n.date >= :date


Docs:
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-joins Join queries in HQL