Saturday, December 4, 2010

Solution to the Lenovo G530 Display flickering problem

I've been using a Lenovo G530 laptop for more than an year now. Recently it started having some display problems. The display started to flicker at random intervals, especially when playing videos. Initially it was not irritating as it occurred only rarely until the last week. However during the last few days it occurred so frequently that I just couldn't watch any videos, so I was trying to diagnose the problem.

I was a bit disappointed as the symptoms suggested that the problem can most probably be with the video adapter, which requires replacing of the main-board.

I found a solution to a similar issue posted as a comment to a review here, which says that the problem occurs when the video cable running from main-board to the display loosens. However, I was not quite sure whether it is the same problem my laptop was having, since the problem often occurred only when playing full-screen videos. So to figure out where the problem was, I plugged an external monitor to the laptop and tried playing a video. The monitor was displaying it smoothly while the laptop's display was continuously flickering. Obviously, the problem was not with the video adapter, but with either the LCD display or the video cable running from main-board to the display.

The video cable starts from underneath the keyboard, so I disassembled the power-board, key-board and reseated the display cable and tested whether the problem is still there... Luckily, it was no longer there and now it is working without any problems!

I found that many G530 users are having this problem and many of the forum posts asking this question don't have the correct solution mentioned. If you've also faced such an issue, you'll find this forum post really useful.

Tuesday, April 6, 2010

Moving to Airtel HSPA

I've had a Dialog Mobile Broadband (HSPA) connection for an year now. I don't have much to complain about its connectivity issues like most of the others do. But definitely I'm not satisfied with their service....It's too costly for what they offer.

They have a very unreal fair usage policy - After the downloads exceed 5GB, the speed goes down to 384kbps and then after 6GB....it becomes 64kbps! That's totally useless stone-age connection and it always remembers me how I went online in 2002 with a dial-up modem. What can you accomplish with a 64kbps dial-up like connection?

I waited for some time thinking that they will change their FUP to be more practical, but it never seemed to happen. Now that the time has come for a change and today I bought an Airtel HSPA connection. Here are the speeds they promise they are offering:

Downloads upto 10 GB -> 1.8 Mbps downlink (384 kbps uplink)
10 GB - 40 GB -> 512 kbps downlink
40 GB onwards -> 256 kbps downlink

This looks to be a much more usable connection compared to the Dialog's one. Both connections have the same tariff rates. I haven't tested the connection yet.... But hope this will produce a better Mobile Broadband experience.

Monday, March 15, 2010

Simple stuff missing in .NET and Visual Studio

I'm a Java programmer, but today I had to deal with C#.NET to create a simple Windows Forms application which had some mathematical and algorithmic stuff.

I've heard a lot of positive comments about Visual Studio, but what I experienced today was not up to the level of usual praises it gets from a lot of developers. Compared to IntelliJ IDEA, which is my favorite IDE, there are several stuff missing in Visual Studio (2008 edition). First thing was auto-complete. Of course it does have a reasonable auto-complete facility, but it's partial (at least with the default settings - I don't know whether there's a way to change it). Whenever a method name is completed, we have to manually code '(' and ')' parts of the method call, which I found a bit inconvenient. The same seems to be the case with strings, once I open a double-quote, the IDE doesn't automatically close it - it's inconvenient when there's a lot of such coding to be done.

Second noticeable thing was that most often it doesn't automatically point out the coding errors unless we build it manually, this is troublesome when there's a lot of coding to be done. Then there was no way of altering editor's background color - it's set to bright white by default and can be really troublesome for the eyes in the long run.

Finally, the most weird part, I wanted to use a Hashtable to have access to some values using keys. I defined one and then wrote code to add a lot of stuff. Then when I was looking for a method to retrieve them based on keys......there was no such simple method retrieve elements like in Java's Hashtables. (there was a method to check whether an item exists, but can't fetch it directly - how terrible is it?) After a Google search, I found a lot of articles teaching how to fetch an item in C# Hashtable - iterate through all elements....! This is really useless and a terrible hashtable implementation I've ever seen. Of course they might have written efficient methods to put stuff (I assume at least those Add methods are efficient), but there was no efficient or an easy way of retrieving them back. For algorithms which have a lot of get calls rather than inserting elements, this will cause unnecessary overhead.

Although I have no idea of moving to .NET, hope these will be fixed in upcoming Visual Studio 2010 edition.

Sunday, February 14, 2010

Is 'private' really 'private'?

I've got the following Java class with private methods.

class ClassX {

private void methodX() {
System.out.println("methodX: this is private.");
}

private void methodY() {
System.out.println("methodY: this is private.");
}
}


How to invoke these methods from an outside class without modifying this code?
If you've studied Java, you might have learnt that it's impossible.

Truth is, you can access anything from anywhere.
Just use Reflection.

class Main {
public static void main(String[] args) throws Exception {
ClassX cx = new ClassX();
Method method = ClassX.class.getDeclaredMethod("methodX", null);
method.setAccessible(true);
method.invoke(cx, null);
}
}

All you have to do is to take the method using 'getDeclaredMethod', then set it as 'accessible' (previously it was not accessible since it was private). Now you can do any damn thing with it. How simple is it?

Still not enough? You can iterate through all declared methods in a class. (in case it is a compiled one and you don't already know what private methods are there)

Method[] ms = ClassX.class.getDeclaredMethods();
for (Method m: ms) {
System.out.println(m.toString()); // see what it is.
m.setAccessible(true);
m.invoke(cx, null); // invoking each method.
}

You can do the same thing for variables as well.

Is 'private' really 'private'? No.
Then how to make something really 'private'? Who knows?
That's not the important point here. If you don't know about reflection, then go ahead and learn it. Reflection is what enables real 'dependency injection' in Java.