Keeping Screen on

When Android developer wants to keep screen on while application is running, it often ends up with him managing wake locks. Quite often this is not needed.

If only thing you want to do is to keep screen on while your application is running (e.g. video player) and you do not need more advanced power management control, you should just add another flag to existing window.

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 
    setContentView(...); 
    ...2
}

System itself will now ensure that screen is kept turned on while your application is visible. As soon as your application is in background, everything returns back to normal. Added benefit of this approach is that no additional permissions are required.

Icons

Illustration

As a programmer I do need a lot of icons. And since I am cheap bastard, I usually try to get free ones.

Company from which I got most freebie offers is definitely IconShock. Guys just can’t stop producing free icon sets. Latest is their Social icon set. It has image for any social site there is (both raster and vector). And best of all - these icons are FREE for COMMERCIAL use also.

Yes, they may not earn much money that way, but they will always have my eternal love for this. Who knows, maybe I will even stop being cheap and buy something from them finally.

In any case I do love these guys.

P.S. They do not sponsor me. This is spontaneous outburst of pure love.

Color of My Eyes

Illustration

As I went to subscribe to EETimes Europe, one form question did give me huge surprise. They were interested in color of my eyes.

I am not sure what surprises me more - their question or explanation for it. They say: “Normally you are asked to sign a registration card to validate your free subscription, but this is not possible on a web page. Instead we ask a qualifying question that must be answered:”.

At what time did naming of color became substitute for signature? Have I overslept that moment?

P.S. If someone is interested, they are brown. :)

P.P.S. Don’t steal my identity now!

Process Explorer in 64-Bit World

Illustration

Process Explorer is one of tools that get installed on any computer I get my hands on. One click on “Options”/“Replace Task Manager” and Ctrl+Esc shortcut becomes owned by it.

That is, it will replace task manager but only if you have 32-bit system. On 64-bit system it will seem to work until you exit it. As soon as you are out of program, system seems to forget that there is any task manager.

Using another great Sysinternals utility - Process Monitor - I found issue. Process Explorer hosts 64-bit version inside of it’s 32-bit process (procexp.exe). If it detects that it is running on 64-bit system it tries to unpacks procexp64.exe into current folder. If that folder is not writable, it extracts file to temporary folder and runs it from there. Process Explorer that you see is running from procexp64.exe.

When replacing task manager, it will point system to search for it’s currently executing copy. Unfortunately when you exit program it procexp.exe will delete that copy in attempt of cleaning after it self. Ctrl+Esc does not work since registry points to, freshly deleted, non-existing procexp64.exe file.

Solution that worked for me was to grant write rights to Process Explorer directory (to both Administrators and Users groups), start it and, while it is running, make copy of procexp64.exe. Once I secured copy of program, I went to “Options”/“Replace Task Manager”. All that is left to do then is exiting program (be sure it is not left in tray area).

Process Explorer will delete procexp64.exe upon exit. To overcome this I just rename program’s copy (made while Process Explorer was running) back to procexp64.exe. Now Ctrl+Esc can be used once more.

Slightly annoying aspect of this is fact that procexp.exe must not be started again to avoid triggering delete. You can solve this by deleting procexp.exe - procexp64.exe is all you need.

Slightly annoying fix, but it does work. And Process Explorer is easily worth all this trouble.