Archive for October, 2008
Oracle – Change the behavior of ORDER BY
There are times when you would like to order the results of a query in such a way that it cannot be accomplished by the default behavior of the order by clause. For example, let’s look at the following table:
tbl_families
| FirstName | LastName | FamilyMember |
|---|---|---|
| Mark | Smith | child |
| John | Smith | husband |
| Susan | Smith | wife |
| Sophia | Dice | child |
| Craig | Dice | husband |
| Maria | Dice | wife |
Let’s say you need to order this table in such a way, so that you get all the husbands first, then the wives and the children at the end. Obviously, descending or ascending ordering by the FamilyMember field will not do the job. The solution is to combine the order by clause with the Oracle’s decode clause. Here is the result:
SELECT FirstName, LastName, FamilyMember
FROM tbl_families
ORDER BY DECODE (FamilyMember, 'husband', 'A', 'wife', 'B', 'child', 'C', 'Z');
Ubuntu – revert to an older version of a package
If you just try to install an older version of a package that you already have installed you most likely will be unable to do so without having to make some tweaks. In this case, normally aptitude will complain with a message that you already have the latest version of the package.
There is a way to get around this problem. To do so, create a file called preferences in /etc/apt. The file should contain 3 lines per each package that you want to revet to an older version. These 3 lines need to specify the package name, the version that you would like to “pin” and the priority. For example, if I wanted to revert the package libbz2-1.0_1.0.5-0.1_i386.deb to libbz2-1.0_1.0.4-2ubuntu4_i386.deb, I would put the following in the preferences file:
Package: libbz2
Pin: version 1.0_1.0.4-2
Pin-Priority: 1001
Note, that the Pin-Priority has to be over 1000 if you are going back to an older version of a package.
After I am done with this, all I have to do is execute sudo apt-get install libbz2 and I will get the older version installed.
Keep in mind that this package version will be “pinned” and no future updates to that package will be picked up by the update manager. For further information on this subject look at the man pages for apt_preferences.
Biketoberfest
| I am ready to take on any excuse to hop on my bike and do a little out-of-town ride. And this weekend’s excuse was Biketoberfest. Seeing so many motorcycles around gets your blood pumping and it suddenly dawned on me. What is better than having one motorcycle?… and… The answer is: Having two motorcycles of course. May be I should look into it. |
SSHMenu – it is good to find things that make your life a bit easier
In my everyday job I have to constantly ssh to a lot of different servers and up until several days ago I used to make a different launcher for every server in order to avoid typing constantly ssh user@server. It kind of even got me to appreciate some ssh clients for Windows (shame on me) like Putty. All this, until a few days back, when I finally had enough of it and decided to find something better for my Linux to ease up my life.
It did not take me long to come upon the SSHMenu app. It lets you keep all your ssh connections “withing a single mouse click” and is very flexible. For example, you can organize your connections in groups and subgroups, you can prepend or append commands to the connection strings (for dynamic port forwarding, X sessions, etc.) and use the profiles from your terminal to customize the looks of each and every one of them. I am sure that there are a lot of other apps that address this issue as well, but I don’t have to look any further. SSHMenu does everything I needed and even more. It is funny how things so simple can make (or break) your day.
I have no idea why this functionality is not built streight into Gnome or KDE.
There is no silver bullet
So… I moved to the dark side.
I have always developed web applications mostly from scratch- I create the databases, write the code and make the design. But today, as you can see, I started a personal blog. And rather than making the site from scratch I resorted to using a popular blog/cms solution.
I should have known what to expect. After all I used to do web development on a MS CMS 2001 platform at some point in my life, but it still caught me be surprise. I had forgotten how clumsy things can be. On the one hand you still have to program any customizations you have in ASP, PHP, Java or whatever the case might be, and on the other you have to get familiarized with the API of the new CMS solution to accomplish even the simplest tasks.
I guess there is no silver bullet… I gained some by not having to do the simple things myself- the design, the programming of the standard features that I would need for a blogging site but I also lost some, by having now to get used to this new environment that feels like a suffocating wrap around me.
There is always some learning curve… even for the smallest things.
Search
Recent Comments
- Olivier on Dynamic Port Forwarding with SOCKS over SSH
- Ld7 on How to connect your Android phone to Ubuntu to do development, testing, installations or tethering
- get more Info on How to get Picasa images using the Image Picker on Android devices running any OS version
- Casper on How to detect a user pan/touch/drag on Android Map v2
- Install SSH as socks proxy for dynamic port forwarding | Steve Constine on Dynamic Port Forwarding with SOCKS over SSH
Categories
Blogroll
Online Tools
Other
BLOG ARCHIVE
- April 2013 (1)
- November 2012 (2)
- August 2012 (1)
- May 2012 (1)
- March 2012 (1)
- November 2011 (1)
- August 2011 (1)
- April 2011 (1)
- January 2011 (2)
- September 2010 (1)
- August 2010 (2)
- July 2010 (2)
- June 2010 (2)
- May 2010 (1)
- January 2010 (2)
- December 2009 (2)
- November 2009 (3)
- October 2009 (1)
- September 2009 (3)
- July 2009 (1)
- May 2009 (1)
- March 2009 (1)
- February 2009 (2)
- January 2009 (2)
- December 2008 (1)
- November 2008 (4)
- October 2008 (5)
