Writing your first Android App

October 29th, 2010 admin Posted in Android, Java | No Comments »

Android is an exciting platform. Developing application for Android is as easy as it gets, but obviously with every new platform comes it challenges too. This article will show from a typical development process for Android mobiles.

Basically you will need Android SDK, Eclipse IDE (minimum version 3.5) and an emulator for testing. Once application has been confirmed in the emulator, it can be easily ported to the actual mobile device. You will need JDK version 5 or 6 in addition.

You may download Eclipse IDE from http://www.eclipse.org/downloads/.

Read more about Android SDK from http://developer.android.com/sdk/index.html.
Read the rest of this entry »

Tags: , , , ,


Changing the drag cursor in C#

October 13th, 2009 admin Posted in .NET, C | No Comments »

While implementing drag and drop operation, it might be necessary to change the drag cursor. There could be several reasons for doing so. For example, you might want to have different cursors for different categories of nodes dragged from a tree. Similarly, you might want different cursors in the different regions of the same target component.

The most important thing that should be understood while doing so is that, it is always the source component/control that is responsible for changing the drag cursor. Many programmers do not know this fact, and try to write the cursor changing code based on the drop target control. However, for the source to change the cursor, it needs some instructions/conditions which the target control can provide. Of course, in the absence of explicit instruction from target, there is always a default provision that governs the cursor.
Read the rest of this entry »

Tags: , , ,


Handling System Commands in C#

October 9th, 2009 admin Posted in .NET, C | No Comments »

Recently, at my work, I had to trap few system commands in C#. I had to disable the movement of Form and few other basic operations such as minimize, maximize, close while the buttons for them still kept visible.

Doing this is very simple. All you need to do is ‘override’ the ‘WndProc’ method inside the Form class.
Read the rest of this entry »

Tags: , ,


Why Comment your code?

October 1st, 2009 admin Posted in Others | 1 Comment »

Perhaps, the answer might be hidding in following cartoon.

Why Comment?

Why Comment?


Read the rest of this entry »

Tags: ,


Hide properties inherited from Base class in the PropertyGrid

September 30th, 2009 admin Posted in .NET, C | 5 Comments »

PropertyGrid is a very useful control in C# that displays the properties of the specified control and allows to change them during the runtime. When a control is specified to the PropertyGrid, it displays all the properties, even those inherited from the base class of that control. However, at many times, you may not want to display those properties as they do not make sense or are irrelevant. Alternatively, you may want to display some of the inherited ones but not all of them. So, basically what you need is a filtering tool that filters the properties out of the PropertyGrid.

Implementing such a filter mechanism is quiet simple. An example of doing so is provided by Bob Powell and is available from the following location.

http://www.devnewsgroups.net/windowsforms/t4152-how-hide-objects-inherited-properties.aspx
Read the rest of this entry »

Tags: , , ,


Rubber Band / Marquee Selection tool in C#

September 29th, 2009 admin Posted in .NET, C | 1 Comment »

Rubber Band/Marquee Selection tool is an approach of drawing an object as the user drags the mouse pointer. Usually, this object is a dashed rectangle. But, this could be anything else too. Rubber band tool is used by many applications for different purposes. A drawing application may use to provide a kind of preview of what is about to be drawn as the user drags the mouse. For example, user selects a rectangle tool in drawing application; and as the user drags the mouse in drawing pane, it draws a dashed rectangle until the mouse is released.

Implementing rubber band is relative easy. With C#, it is even easier.
Read the rest of this entry »

Tags: ,


A Simple "Print Preview" and "Print" approach in .NET and Java

January 28th, 2009 admin Posted in .NET, Java | No Comments »

Quiet often, we come across the same old problem. Few days ago, a colleague of mine also came across this problem. Yes, I am talking about a print preview and print control that is customized to your application’s need. Unless, you are ready to spend some money, it can be hard to write a complete print preview and print control yourself. But there is a simple way around and the one preferred by many developers. In fact, if you use it properly, you can display and print just about any type of documents.

This simple way around is generating your document as HTML and using web browser control to display it and also to print it. In fact, you can use some CSS to make it look even better. Read the rest of this entry »


How to put combo-boxes into toolbars in Eclipse RCP/Plugin ?

September 14th, 2008 admin Posted in Eclipse, Java | 1 Comment »

It is straight forward to add buttons into the toolbars. But, it can be a bit tricky to add other components, such as combo boxes. Again just adding the controls is not enough, because you will have to handle the events to make them useful. To add combo boxes or any other controls, one easy way is to create a custom control.

In this article, I will show a way to add combo boxes to toolbars by creating a custom control. With this approach, you can put just anything in the toolbars.
Read the rest of this entry »

Tags: , , , , ,


Alternative to StringBufferInputStream

July 23rd, 2008 admin Posted in Java | 3 Comments »

StringBufferInputStream has been deprecated; the documentation recommends you use StringReader instead. Yet, many stream-related methods in other classes (often those that predate the deprecation) will only accept an InputStream. So, how to send an InputStream that came from an in-memory string?

One easy alternative is to use ByteArrayInputStream.
Read the rest of this entry »

Tags: ,


How to deal with annoying Server Busy dialog box ?

July 22nd, 2008 admin Posted in C, COM | 1 Comment »

While programming for COM, you must have encountered this annoying “Server Busy” dialog box. This happens when the MFC COM Client is calling some method in the COM Server, that takes a long time to process. Until the method returns, nothing can be done in the client side and this dialog box pops up.

To deal with it, first step is to call AfxOleInit() to initialize COM. According to MSDN, AfxOleInit() also initializes and registers a COleMessageFilter data member in the CWinApp.
Read the rest of this entry »

Tags: , , ,