"; */ ?>

software


10
Sep 07

Avant Window Navigator – Dual Monitor Hack

avant window navigator  Ok, so you have successfully configured dual monitor for you (Gnome/KDE) desktop, and now you have decided to take it even further and install and configure Avant Window Navigator – way to go!

    Although most of your installation/configuration will succeed by following one of the tutorials, in case if you have dual monitors, and/or you use Option  "MergedFB"  in "xorg.conf" to merge two monitors into a one screen, standard tutorials will not work. This will require additional hacking to get AWN to work right, and here is where this article comes in :)

    PROBLEM:    One of the problems that AWN has with multiple screens/monitors is to identify the position of where it needs to put its task bar. In case of two monitors merged into one big screen, it does not adjust to this new slightly larger "coordinate system", and fails to place its task bar to the right place on a screen (usually at the bottom of the bottom screen). This can be solved, of course ;)

    SOLUTION:   AWN stores monitor resolution info in a file called "%gconf.xml" which is located here:

          user@host:~/.gconf/apps/avant-window-navigator$ ll
          total 32
          drwx------ 2 user user 4096 2007-07-18 11:41 app
          drwx------ 4 user user 4096 2007-06-26 23:47 applets
          drwx------ 2 user user 4096 2007-08-06 21:52 bar
          -rw------- 1 user user 776 2007-09-10 09:52 %gconf.xml
          -rw------- 1 user user 776 2007-06-27 22:57 %gconf.xml.dual
          -rw------- 1 user user 776 2007-06-27 10:41 %gconf.xml.single
          drwx------ 2 user user 4096 2007-06-27 17:59 title
          drwx------ 2 user user 4096 2007-06-30 14:16 window_manager
          user@host:~/.gconf/apps/avant-window-navigator$

    "%gconf.xml" is an XML file that has several elements called "entry". The ones we are interested in would be:

 
        <entry name="monitor_height" mtime="1179886419" type="int" value="1024">
        </entry>
        <entry name="monitor_width" mtime="1179886419" type="int" value="1280">
        </entry>

    These values would work fine if we had a single 1280×1024 monitor, but if we have our (e.g.) bottom monitor as 1280×800, in order for AWN to display its task bar in a correct spot (the bottom of the bottom monitor), values have to change to:

 
        <entry name="monitor_height" mtime="1179886419" type="int" value="1824">
        </entry>
        <entry name="monitor_width" mtime="1179886419" type="int" value="1280">
        </entry>

    So what we did, we summed up Y-Positions of both monitors together: 1024 + 800 = 1824. Now when AWN is calculating its task bar’s Y-Pos offset, it will take 1824, as the Y-Pos max range, and will do the right thing!


30
Jun 07

iPhone: 20 Things It Does Not Have

 

 

Thinking on jumping on a new and "cool" iPhone? Think twice, it might be better to hold the thought for a month or too. And here is why…

  

  • Bluetooth is ONLY good for connecting a headset. That’s it.
  • There is no file browser on the device at all. Data must be organized (if at all) in the appropriate application.

  • The camera is a simple application that has ONE button: the shutter. Pictures come out okay on the device, but nothing too fancy on a monitor, especially if it was an attempt at a macro shot.

  • SIM card is damn near impossible to open, if at all. I didn’t look into it extensively.

  • Web browser is slow, even over WLAN. Even the simple OneList web app that was created takes around 20 seconds to load over WLAN. You can not highlight, cut, copy, or paste and text from a website, and you can not save any images you find from a website either. The only nice thing about it is the tabbed browsing, which crashed on me when I went to Engadget and YouTube on two tabs. This is the only application that allows you to use the keyboard in landscape mode.

  • The keyboard sucks. It gets slightly better after the iPhone "learns" you, as the employees said, but even then, it’s not a device you can use with one hand comfortably, much less without looking.

  • You can only send one picture at a time in an email.

  • No custom ringtones (yet, as we were being told) and the alert tones can not be changed whatsoever.

  • The default ringtones are incredibly lame.

  • The only form of customization outside of a lame default ringtone is the wallpaper, which you’ll only see when you need to unlock the device or when you get a phone call.

  • "Picture pinching" or using two fingers to zoom on any content is certainly fun to play with, but not practical whatsoever. This operation depends solely on using the device with two hands.

  • No document editor or native viewer. You can not store documents on the device to be viewed, they can only be viewed as attachments when they’re sent to your in an email.

  • Visual voicemail is laggy and reacts about the same way as pushing the fast forward and rewind buttons on traditional voicemail systems. The only advantage is for those that get that many voicemail messages a day that they need to sort them according to priority.

  • NO games. None.

  • No voice dialing.

  • No speed dialing (which can be made up by the "quick list", but getting to that quick list isn’t as fast as holding a single key on a real keypad).

  • No video.

  • No MMS.

  • It’s still <4GB for $500 and <8GB for $600

  • It only takes around 2 hours to explore every menu without any options for expandability except to scrounge around for new web apps that will load slowly and nowhere near as smoothly as the native apps.

    This device looks like it was aimed at the general consumer who has the money to spend on such a flashy device, but it leaves so many basic features behind that it’s almost impossible to consider it a success as a mainstream device. It encourages the advanced user to move away from MMS and into email to send images, but leaves out any advanced features advanced users would be accustomed to, and still retains a huge price tag on top of it.

    It’s certainly pretty and Americans will buy it because of that simple UI, but anyone who’s familiar with other operating systems would be appalled. This phone needs to be unlocked and cracked WIDE open to make much better use of the multi-touch system. That, or it needs an immediate update in iTunes to rework every feature.

source
   


13
Jun 07

Haptic Clock Beats The Time Into You

Haptic Java Mobile ClockHave a mobile phone that you do not want to look at? Is it that bad, or maybe it is awesome, but you are just annoyed to look at it to find out something as simple as current time? Then here is a very interesting Java Mobile application that is written by Che-Wei Wang and makes your phone to literally beat the time into you.

The Haptic Clock is a small clock program for Java powered mobile phones.  The clock conveys time through  a sequence of vibrations so you never have to pull the phone out of your pocket to tell time.

 

Haptic Java Mobile Clock

Long vibrations are the number of hours of the current time on a 12 hour clock, so 6pm and 6am are both 6 vibrations.  The shorter vibrations are the number of minutes divided by 5. So 4 vibrations is 20 minutes and 7 vibrations is 35 minutes.  Example: (3) long vibrations and (6) short vibrations means it’s 3:30.  Just in case you do want to see the time, the screen displays the time with tick marks for hours, minutes and seconds.

Instructions: Press ‘5′ to vibrate the current time. Press ‘0′ to exit program. UP and DOWN to control the speed of vibrations. Time alerts (vibrations) will occur automatically every 15 minutes on the hour.

Version:         0.06
Released:      5.24.2007
Creator:         Che-Wei Wang
License:         GNU Public License (source coming soon)

Download BetaHaptic-Clock.zip  (includes JAR and JAD)
                                    Beta means it may not work on your phone or worse, may break your phone. Install and use at your own risk.

Tested on:            Nokia E70
Issues:                  J2ME drains the batteries. Looking for ways around it, or a more efficient platform.


9
Jun 07

Convert Date to String in Java


Just an example on how “java.text.SimpleDateFormat” can be used to convert a java date object (java.util.Date) to a string (String, StringBuffer, StringBuilder, etc..).
The whole magic is done by SimpleDateFormat, the child of “java.text.DateFormat”, which, as its name suggests, formats the date by a provided template.

This template is very flexible and provided to the formatter as a string. Here are the values which are used by SimpleDateFormat’s template:

Letter

Date or Time Component

Presentation

Examples

G

Era designator

Text

AD

y

Year

Year

1996; 96

M

Month in year

Month

July; Jul; 07

w

Week in year

Number

27

W

Week in month

Number

2

D

Day in year

Number

189

d

Day in month

Number

10

F

Day of week in month

Number

2

E

Day in week

Text

Tuesday; Tue

a

Am/pm marker

Text

PM

H

Hour in day (0-23)

Number

0

k

Hour in day (1-24)

Number

24

K

Hour in am/pm (0-11)

Number

0

h

Hour in am/pm (1-12)

Number

12

m

Minute in hour

Number

30

s

Second in minute

Number

55

S

Millisecond

Number

978

z

Time zone

General time zone

Pacific Standard Time; PST; GMT-08:00

Z

Time zone

RFC 822 time zone

-0800

Below, I wrote an example on how to implement the conversion. Here I used two different templates: “yyyyMMdd” and “MMddyyyy” to show that several letters from the table above can be used in different sequence for the desired format:

import java.util.Date;
import java.text.SimpleDateFormat;
... ... ... ...
 
    public void testConvertDateToString()    {
 
        //   Allocates a Date object and initializes it so that it represents the time
        // at which it was allocated, measured to the nearest millisecond.
        Date dateNow = new Date ();
 
        SimpleDateFormat dateformatYYYYMMDD = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat dateformatMMDDYYYY = new SimpleDateFormat("MMddyyyy");
 
        StringBuilder nowYYYYMMDD = new StringBuilder( dateformatYYYYMMDD.format( dateNow ) );
        StringBuilder nowMMDDYYYY = new StringBuilder( dateformatMMDDYYYY.format( dateNow ) );
 
        System.out.println( "DEBUG: Today in YYYYMMDD: '" + nowYYYYMMDD + "'");
        System.out.println( "DEBUG: Today in MMDDYYYY: '" + nowMMDDYYYY + "'");
 
    }

Results:

DEBUG: Today in YYYYMMDD: ‘20070609’
DEBUG: Today in MMDDYYYY: ‘06092007’

You may also notice that in the example I used StringBuilder, and not String or StringBuffer. The reason is simple – “best practice – use the right tool for the right task”.

“String” is immutable, meaning it cannot be changed, every time you try to change it, new String object is created and the old one is released for garbage collection, therefore String can be perfect for something like constants e.g. { private static final String FORTY_TWO = “42”; }.

StringBuilder and StringBuffer can be changed (modified), and, in fact, they have exactly the same functionality with one distinct difference – StringBuffer is synchronized and StringBuilder is not. Therefore if the segment of code we are working on is not designed to be multi threaded (used by different threads in a same time), it is better to use StringBuilder, since it will work faster.

StringBuilder is available in Java 1.5.0 (Java 2 SE 5.0) and up.

KISS – Keep It Simple Stupid ;)


2
Jun 07

Switch Between Dual/Single Monitor on (Ubuntu) Linux

xorg logo ubuntuRecently I wrote a howto on dual monitor configuration, which works great for my setup. However one thing that is not that great is switching between two modes: dual and single monitor. At work I have an external monitor that I use (which means I use two monitors – my laptop’s and external one), but whenever I am not at work I only need to use my laptop’s. Since all the xorg configuration resides in xorg.conf file, and this file is a regular static text file that is used by X (window system – gdm, kdm, etc.) when it starts, it is nontrivial to change this configuration while running X without some X tools. Unfortunately, Ubuntu is not that fancy (yet) and does not provide these tools by default, so here is a way to do it (sort of) manually.

What we can do is to create two xorg.conf files – "xorg.conf.single" and "xorg.conf.dual". In "xorg.conf.single" just comment out the following line from ServerLayout section:

# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
.....
Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          0 "0 Screen"
        #Screen         1 "1 Screen" Above "0 Screen"   <-- comment out this line
        Option          "Xinerama" "on"
        Option          "Clone" "off"
.....
EndSection

Here is the listing of "xorg" files that I have:

user@host:/etc/X11$ ll xorg.conf*
-rw-r--r-- 1 root root 4457 2007-06-02 15:05 xorg.conf
-rw-r--r-- 1 root root 4456 2007-05-22 22:03 xorg.conf.dual
-rw-r--r-- 1 root root 4457 2007-05-22 22:04 xorg.conf.single

Now the idea is simple - before X (I use Gnome Desktop, but it can be any desktop environment) starts, we need to copy xorg file that we need (dual or single) to "xorg.conf", which will be picked and loaded by X.

In /home/user/ directory we have a .bashrc file that is loaded whenever the user logs in (if we use bash shell, which is a most popular shell anyway). Therefore we can leverage this file to define aliases that we would like to use once we login. Since alias can be anything we'd like, why not make a dual/single commands as aliases? Here is an example:

user@host:/etc/X11$ tail -5 /home/user/.bashrc
# restart gdm with dual monitor support
alias xdual='sudo cp /etc/X11/xorg.conf.dual /etc/X11/xorg.conf; sudo /etc/init.d/gdm restart'

# restart gdm with single monitor support
alias xsingle='sudo cp /etc/X11/xorg.conf.single /etc/X11/xorg.conf; sudo /etc/init.d/gdm restart'

Now when we need to switch between dual/single monitor, we can fire up shell (by pressing Ctrl+Alt+1, or gnome-terminal, or kterm, etc.) and type xsingle or xdual whichever we need.