Sep 18 2013

The repetitive programmer

Category: TechnicalIuliana @ 12:36

You know who you are. I know who you are. And I hate you. And I despise you. Every time I have to  work with your code my brain keeps screaming WHY? WHY?WHYYYYYYY?  and I begin to think you are retarded. Or maybe just not retarded, but maybe you learned to program on another planet, because no programmer from this Earth, not even a mediocre one would write code like you do and also be paid for it. I would not pay you for it, I would send you do dig holes or clean shit pipes or something that does not imply any brain power whatsoever. Because you have none!

Sample:

// [bla bla  bla - code that I won't put here]
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
	Document document = new Document(PageSize.A4);
	PdfWriter writer = PdfWriter.getInstance(document, bos);
        // [bla bla  bla - code that I won't put here]
	if (document != null) {
	    document.close();
	}
	if (writer != null) {
	    writer.close();
	}
        // [bla bla  bla - code that I won't put here]
        OutputStream outputStream = new FileOutputStream(attachmentURL);
	bos.writeTo(outputStream);
        // You might notice that the outputStream was not closed
} catch (MailException e) {
        if (log.isWarnEnabled()) {
                log.warn("Cannot send email for something " + something.getId(), e);
	}
	sendAdminMessage("Error sending email message to user", "Cannot send email for something nr "
			+ something.getId() + ". Message is = " + e.getMessage());
			return false;
} catch (MessagingException e) {
	if (log.isWarnEnabled()) {
		log.warn("Cannot send email of something " + something.getId(), e);
	}
	sendAdminMessage("Error sending email message to user", "Cannot send email for something nr "
			+ something.getId() + ". Message is = " + e.getMessage());
			return false;
} catch (IllegalArgumentException e) {
	if (log.isWarnEnabled()) {
		log.warn("Cannot send email ofsomething " + expressOrder.getId(), e);
	}
	sendAdminMessage("Error sending email message to user", "Cannot send email for something nr "
			+ something.getId() + ". Message is = " + e.getMessage());
			return false;
} catch (MalformedURLException e) {
	if (log.isWarnEnabled()) {
		log.warn("Cannot send email of express order " + something.getId(), e);
	}
	sendAdminMessage("Error sending email message to user", "Cannot send email for something nr "
			+ something.getId() + ". Message is = " + e.getMessage());
			return false;
} catch (IOException e) {
	if (log.isWarnEnabled()) {
		log.warn("Cannot send email of something " + something.getId(), e);
	}
	sendAdminMessage("Error sending email message to user", "Cannot send email for something nr "
			+ something.getId() + ". Message is = " + e.getMessage());
			return false;
} catch (DocumentException e) {
	if (log.isWarnEnabled()) {
		log.warn("Cannot send email of something " + something.getId(), e);
	}
	sendAdminMessage("Error sending email message to user", "Cannot send email for something nr "
			+ something.getId() + ". Message is = " + e.getMessage());
			return false;
}

So, 7 catch-es, for seven types of exceptions, we do the same thing for every type of exception, write the same code, because it looks good in the SVN if somebody looks, he will see that you wrote a lot of code. A lot of crap more like it. And why the hell do you not make sure all your streams are closed??
The person who wrote this code is payed a few thousand euros to write code like this. Yeah, I guess the recruitment department sucked ass when this person was hired.

So yeah, if you write code like this, quit programming now and look for another job. You clearly are not made for this and you are a despicable person.

Tags: ,


May 21 2013

Office war

Category: English posts,Funny,TechnicalIuliana @ 15:15

So… sometime in December I was assigned to a new project. The project was new for me, in fact it is about 6 years old, a few outsourcing teams worked on it and now me and my colleagues started working with the last team to … make it better. So these guys are sometimes doing rookie mistakes, and apparently nothing can convince them that it is not ok to break the build or commit sources that don’t compile and other small stuff like that.

So every time one of them does something that is shouldn’t I search for a Ryan Gosling picture on this site and sent the link on the main chat with a special dedication. But sometimes, the pictures available on the site are not enough. So these are my two creations for my colleagues, for now. But I intend to keep you updated. :)


May 08 2013

Intrebarea zilei la eMag

Category: Funny,Technicalhartz @ 14:50

Am fost si eu ca omul la eMag sa iau una, alta si in timp ce imi dadea tipul de acolo produsele alt tip isi cumparase un router si discuta cu tipul de la garantie.  Intreba cum se face, cum se instaleaza, daca are tot ce ii trebuie in limba romana (parea un tip de max 30 ani) dupa care vine intrebarea de 3122 puncte:

“Ca sa am semnal in casa, trebuie sa tin calculatorul pornit?”


Apr 13 2013

Linux: connect to VPN (complete)

Category: English posts,TechnicalIuliana @ 22:53

Some time ago at work, I was assigned to a new project. To be able to access client specific resources I needed to be able to connect to a VPN. I was given a domain, username, password and a gateway. All was simple in Windows and all resources were accessible. Among these resources there were some servers (testing, acceptance, stuff like that)  which had the application installed and were accessed through the browser via http. (Example: http://server1:8080/application). But when my request to work on Linux was approved, and I received a fresh Linux workstation to configure as I please, I stumbled across a few problems, because any tutorial on the internet  that explains to you how to set up a VPN connection in Linux is incomplete. So, what did I do?

The first step was to  get all the information from Windows that I could. So I clicked right on the VPN connection and made print-screens of all the properties  shown. Then I logged on to my Linux (Fedora 18 at work, Ubuntu 12.10 at home – I am mentioning this because the steps are identical) and proceeded to create my VPN connection according to the steps here, but always taking a look at the print-screens I took in Windows.  Just to make sure, I also asked my colleague who gave me the VPN details in the first place what type of VPN was it and he said:  “ it’s standard Windows VPN, PPTP. Port 1723″

So the steps I took were:

  1. Click right on Network Connections icon , select  VPN Connections, then click on Configure VPN
  2. In the dialogue window that appeared I clicked on the Add button
  3. A new dialogue window appeared asking me to select the type of the VPN connection. I selected PPTP and clicked on the Create… button.
  4. A new dialogue window appeared with two tabs: VPN and IPv4 Settings
  5. In the VPN tab there was an Advanced button. When clicked a new dialogue window appeared with advanced options to select. I checked everything that I found checked in the Windows print-screens and left unchecked everything that was unchecked in them. In my case I had to deselect all authentication methods but MSCHAPv2 and check everything else in the dialogue box except “Send PPP echo packets”.
  6. And now if you save everything, the connection will succeed. But if you need access to some application installed on some servers accessed via their host names, you will need something called DNS suffix which can be added in the “Additional search domains” textbox in the IPv4 tab.
  7. If you don’t know what value to put there, and your colleagues didn’t tell you,(mine did not) you can do the following. Log into Windows and  connect to the VPN.
  8. Open a Command Prompt terminal and execute the following command: nslookup hostname You should get an output similar to this:
  9.             Server:  hostname.somedomain
                Address:  xxx.xxx.xxx.xxx
               
  10. Now, copy somedomain in the IPv4 tab, in the “Additional search domains” textbox and save everything.
  11. If you need the same kind of access I needed, also take a look in Firefox and the proxy it uses. Even if I had a successful VPN connection and a correct DNS suffix, I could not connect to http://server1:8080/application because my Firefox was set by default to “Use system proxy settings“. When I set it to “Auto-detect proxy settings for this network” it worked like a charm.

So, these are the steps that I took. I asked a Linux guru friend (Rpx) for help in debugging the VPN settings, because I am not that good at networking and I thought the additional information I discovered with his help, might be useful to somebody else too and that’s why I wrote this post. I will appreciate any kind of feedback.

Tags: , , ,


Mar 14 2013

Why is Google giving up on Google Reader?

Category: English posts,TechnicalIuliana @ 9:32

This morning I started my day with a sad news: Google is shutting down Google Reader on July 1st, 2013. The reason for this is that, I quote: “usage of Google Reader has declined, and as a company we’re pouring all of our energy into fewer products.”

The fact is that I have no experience in statistics, I have no idea how many people actually use Google Reader on their computers or on their phones. On my phone, I don’t have any reader fo that matter. What I do know is that Google Reader is a practical, stable product which I have been using for free since 2007. There is no reason to give up a practical and stable project, at least not from my point of view. But considering the fact that Google is a huge company which offers hundreds of services and products, they might actually have some really logical reasons for this. Maybe they are preparing a different feed reader for us, maybe this move is just like taking candy from a baby to convince him to do his homework. Maybe by doing this to us Google is trying to convince us to pay for this wonderful service we have been using for years. And you know what? I have noting against it. I would pay a monthly fee for this service, because I like having all my stuff in the same place and because Google Reader is perfectly integrated with other Google services that I use.

I don’t think that Google is going to shut the reader down, most probably it would rebrand it and give back to us for a fee, or it will integrate it into some other service. But, I guess we’ll just have to wait for the 1st of July 2013 when their possibly “evil plot” will be revealed. :)


Mar 06 2013

Google can only do so much

Category: English posts,TechnicalIuliana @ 11:31

What do you do when you get a creepy Java exception telling you something that has nothing to do with what actually causes it? And how do you know that the cause is a different one.

This is one of those cases when Google can only do so much. A lot of developers with too much time on their hands might have written on their blogs how they solved that error, but it does not apply to your case. More than that, doing something similar on your project just caused a different problem.

So what can you do? Well, before there was Google, there was something everyone with more experience than you would tell you: RTFM = Read The Fucking Manual!!! When you have a problem Google cannot give you a fast solution for, you have to go deep in the details of your application. What does this mean? Take a look at what technologies you are using and check if you are using them right. If you are a lazy and comfortable programmer, like most of us are, you probably just copied the default settings from the official site or some blog where some other developer with too much time on his hands wrote how he used it. And most of the times, that information is not so recent and internally some changes have taken place that make that specific tool behave differently.

Don’t get me wrong, I am not a pioneer of reinventing the wheel! But sometimes instead of searching mindlessly on Google, is easier to try to understand the technologies you are using and work with them they way the manual says you should.

This is a the main difference between a mature developer an a young one. The young one thinks that everything he needs to write an application or solve a problem is one-click away. The mature one knows that understanding the technology can spare you a lot of … clicking time.


Dec 07 2012

Compiling, compiling … done.

Category: English posts,TechnicalIuliana @ 14:13

As you noticed from my previous post, a few days ago I started updating a Gentoo VitrtualBox machine.
Right after the update used:
#emerge -av –depclean
And
#revdep-rebuild

And that’s when all went to hell. Apparently a lot of my packages were considered unnecessary and were unmerged. Among them some dependencies for the VirtualBox modules which made my virtual machine forget about the graphical interface. The possibility of displaying a log on the five inch window to see what the problem was , was not an option so the first step was to fix the system a little so that I could at least have access to a bigger screen.

The solution was simple in my case, just emerge –sync and emerge world again . And surprise!! a new version of Kde was available, 4.9.4 and the system proceeded to installing it. So I said, what the hell let it do it! After a few hours of torture, during which I searched for a solution to make the VirtualBox modules work in order to be able to make my virtual machine interact friendly with the underlying OS, a Windows 7, I found a guy on a forum which had a similar problem and his solution was to upgrade the kernel. So I checked the version of kernel I was using. Indeed was an old one. A new one was not such a bad idea. So I downloaded the new sources and got to work taking the same steps specified by the manual. By the end of the night I had a fresh 3.5.7 kernel and the same problem with the VirtualBox modules. I unmerged them (virtualbox-guest-additions and virtualbox-modules), emerged them again. But the situation was the same. I was going out of my mind, not knowing what the problem was. So at the end of my patience, I asked an expert: Rpx. Based on a piece of message found in a log file in /var/log “vbox disagrees about version of symbol module_layout”, he concluded that my VirtualBox modules were compiled with a different kernel dependency. Well, that’s was all I needed.

I wend on and recompiled the kernel using:
#genkernel –menuconfig –bootloader=grub all
And when configuring it I took a look here and selected the options recommended for a VirtualBox machine. The kernel was compiled, I just unmerged and remerged the virtualbox stuff and instead of following the steps in the previous link I just followed the instructions displayed in the console at the end of the compilation for virtualbox-guest-additions.

I restarted the system and… voila! My virtual machine is up and running and interacting with Windows just fine.

Disclaimer:This is not a tutorial on how to fix a Gentoo VirtualBox Machine, it is just a post in which I brag about the fact that I can do it. :D You could take it as an advice to Read The Fucking Manual!, because that’s what helped me in the end.

Tags: , , ,