applications


On-screen clock/count down/counter (version 3, Java)

We ported the original watch from AutoHotKey to Java.

UPDATE: Click here  Watch v3 - Windows executable (178 downloads) to download the application with a Windows launcher.

You can download the Java Jar version from this link : Watch v3.0 Java (219 downloads)

It started being used in the 106th IEEE Region 8 Committee Meeting that was held at the Fairmont Monte Carlo in Monaco on 19-20 of March 2016.

Key features

  • You can change the icon that appears in the task bar by placing an gif file with the name watch.gif in the config directory of the executable
  • You can drag the watch to a more convenient place with the mouse
  • You can move the watch using the arrow keys. Using the shift key it makes the movement more precise. Using the control key it makes the movement faster.
  • Double clicking on the watch it will hide it
  • Double clicking on the tray menu icon of the watch it will toggle it’s visibility
  • From the menu on the task bar you can “Set it on top”, allow mouse to click through the clock, hide/show the gui
  • You can set the color of the Font and the Color of the background using a color picker
  • You can set the transparency of the GUI
  • The tool has two modes, it can operate as a clock that shows time in 24 hour mode or AM/PM and can operate as a count down tool (timer)
  • The timer mode allows you to pause (and continue), reset and stop the time, reset and continue the time (using lap) or zero the clock

Good willed feedback is always welcome


On-screen clock/count down/counter — AutoHotkey (AHK) Source Code

Below is the source code for the version that is used for IEEE Region 8 Committee meetings.

It is written using the AutoHotkey scripting language and you will need to download the compiler for it in order for you to use it.

AutoHotkey is a free, open-source custom scripting language for Microsoft Windows, initially aimed at providing easy keyboard shortcuts or hotkeys, fast macro-creation and software automation that allows users of most levels of computer skill to automate repetitive tasks in any Windows application. User interfaces can easily be extended or modified by AutoHotkey (for example, overriding the default Windows control key commands with their Emacs equivalents). The Autohotkey installation includes its own extensive help file with an always updated web based version.From Wikipedia

Download here watch.v2.ahk.zip (864 downloads)

#SingleInstance Force
#Persistent
#NoEnv
DetectHiddenWindows On
SetTitleMatchMode 2

st_Configuration_File := "watch.ini"
st_Configuration_Section := "Parameters"
st_Settings_Title := "Watch 2.0 - UI Settings"
st_Mode_Title := "Watch 2.0 - Mode Settings"

;ListVars
;http://www.autohotkey.com/docs/commands/ListVars.htm

;----------------------Check if Settings File Exists-----------------
;IniRead, OutputVar, Filename, Section, Key [, Default]
st_Clock_Width := "Clock_Width"
IniRead, var_Clock_Width, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Width%, 245
st_Clock_Height := "Clock_Height"
IniRead, var_Clock_Height, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Height%, 66
st_Lock_Position := "Lock_Position"
IniRead, var_Lock_Position, %st_Configuration_File%, %st_Configuration_Section%, %st_Lock_Position%, 0
st_Always_On_Top := "Always_On_Top"
IniRead, var_Always_On_Top, %st_Configuration_File%, %st_Configuration_Section%, %st_Always_On_Top%, 1
st_Position_X := "Position_X"
st_Default_Position_X := A_ScreenWidth - var_Clock_Width
IniRead, var_Position_X, %st_Configuration_File%, %st_Configuration_Section%, %st_Position_X%, %st_Default_Position_X%
st_Position_Y := "Position_Y"
st_Default_Position_Y := A_ScreenHeight - var_Clock_Height
IniRead, var_Position_Y, %st_Configuration_File%, %st_Configuration_Section%, %st_Position_Y%, %st_Default_Position_Y%
st_Click_Through_Clock := "Click_Through_Clock"
IniRead, var_Click_Through_Clock, %st_Configuration_File%, %st_Configuration_Section%, %st_Click_Through_Clock%, 0
st_Back_Color := "Back_Color"
IniRead, var_Back_Color, %st_Configuration_File%, %st_Configuration_Section%, %st_Back_Color%, 0x000000
st_Clock_Color := "Clock_Color"
IniRead, var_Clock_Color, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Color%, 0xECECEE
st_Clock_Font_Size := "Clock_Font_Size"
IniRead, var_Clock_Font_Size, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Font_Size%, 28
st_Clock_Mode := "Clock_Mode"
IniRead, var_Clock_Mode, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Mode%, 24Hour
st_Timer_Mode := "Timer_Mode"
IniRead, var_Timer_Mode, %st_Configuration_File%, %st_Configuration_Section%, %st_Timer_Mode%, FixedTime
st_Transparency := "Transparency"
IniRead, var_Transparency, %st_Configuration_File%, %st_Configuration_Section%, %st_Transparency%, 230
st_Watch_Mode := "Watch_Mode"
;IniRead, var_Watch_Mode, %st_Configuration_File%, %st_Configuration_Section%, %st_Watch_Mode%, Clock
;Xeirwn -- Hardcoded clock as default mode
var_Watch_Mode := "Clock"
SetTimer, fun_TicTac, 1000
;------------------------------------------------------------

Gui, 1:+ToolWindow -Caption
Gui, 1:Color, %var_Back_Color%, %var_Back_Color%
Gui, 1:Font, S%var_Clock_Font_Size%
Gui, 1:Font, C%var_Clock_Color%, bold, Arial
Gui, 1:Font, bold
Gui, 1:Font, Arial
FormatTime, var_Formatted_Time, , '  'HH:mm:ss
Gui, 1:Add, text, X5 Y5 W%var_Clock_Width% H%var_Clock_Height% GMove vElem_Clock, %var_Formatted_Time%
Gui, 1:Show, X%var_Position_X% Y%var_Position_Y% W%var_Clock_Width% H%var_Clock_Height%, elem_Watch_Window
WinSet, Region, 0-0 W%var_Clock_Width% H%var_Clock_Height% R6-6, elem_Watch_Window
;;WinSet, Region, 0-0 W%var_Clock_Width% H%var_Clock_Height% R6-6, elem_Watch_Window
WinSet, Transparent, %var_Transparency%, elem_Watch_Window

ifExist, watch.ico
{
	Menu, Tray, Icon, watch.ico
}
Menu, Tray, Tip, Watch 1.0
Menu, Tray, NoStandard
Menu, Tray, add, &Always On Top, fun_Set_Always_On_Top
Menu, Tray, add, Click &Through, fun_Click_Through
;Menu, Tray, add, &Lock Position, fun_Lock_Position
Menu, Tray, add, Clock &Colors, fun_Set_Clock_Colors
Menu, Tray, add, &Set Mode, fun_Set_Mode
Menu, Tray, add
Menu, Tray, add, &Quit Clock, ExitApp
Menu, Tray, add, Hide/&Show, fun_Toggle_Hide
Menu, Tray, add
Menu, Tray, add, About, fun_About
Menu, Tray, default, Hide/&Show

if (var_Click_Through_Clock = "1")
{
	Gui, 1:+E0x20
	Menu, Tray, Check, Click &Through
}

if (var_Always_On_Top = "1")
{
	WinSet, AlwaysOnTop, On, elem_Watch_Window
	Menu, Tray, Check, &Always On Top
}

if (var_Lock_Position = "1")
{
	;TODO -- XEIRWN -- REVIEW
	Gui, 1:-E0x10
	Menu, Tray, Check, &Lock Position
}

;----------------------Set Transparency Using the Alt Key--------------------
#ifWinActive, elem_Watch_Window
{
	!WheelUp::
	if (var_Transparency <= 230) { var_Transparency += 5 WinSet, Transparent, %var_Transparency%, elem_Watch_Window return } !WheelDown:: if (var_Transparency >= 15)
	{
		var_Transparency -= 5
		WinSet, Transparent, %var_Transparency%, elem_Watch_Window
		return
	}

	return
}
;------------------------------------------------------------
return

;;TODO -- XEIRWN -- REVIEW
;----------------------Enable Window Drag-------------------
Move:
	PostMessage, 0xA1, 2,,, A
	if A_GuiEvent = DoubleClick
	{
		GoSub, fun_Show_Hide
	}
return
;------------------------------------------------------------

;----------------------Clock Engine-----------------------
fun_TicTac:
	if (var_Watch_Mode = "Clock")
	{
		FormatTime, var_Formatted_Value, , '  'HH:mm:ss
		if (var_Clock_Mode = "AM/PM")
		{
			FormatTime, var_Formatted_Value, , hh:mm:ss tt
		}
	}
	else if (var_Watch_Mode = "Timer")
	{
		if (var_Timer_Mode = "FixedTime")
		{
			FormatTime, var_Seconds, %var_Set_FixedTime%, s
			FormatTime, var_Minutes, %var_Set_FixedTime%, m
			FormatTime, var_Hours, %var_Set_FixedTime%, H
			if (var_Seconds > "0" or var_Minutes > "0" or var_Hours > "0")
			{
				var_Set_FixedTime += -1, seconds
			}
			else
			{
				SetTimer, fun_TicTac, off
			}
			FormatTime, var_Formatted_Value, %var_Set_FixedTime%, '  'HH:mm:ss
		}
		else
		{
			;TODO Xeirwn -- Implement count to date time
			;http://www.autohotkey.com/docs/commands/EnvSub.htm
			;http://www.autohotkey.com/docs/commands/FormatTime.htm
			;http://www.autohotkey.com/docs/Variables.htm
		}
	}
	GuiControl,, Elem_Clock, %var_Formatted_Value%
	return
;------------------------------------------------------------

;----------------------Clock Engine Maintenance-----------------------
fun_TicTacToc:
	if (var_Watch_Mode = "Clock")
	{
	}
	else if (var_Watch_Mode = "Timer")
	{
		if (var_Timer_Mode = "FixedTime")
		{
			FormatTime, var_Formatted_Value, %var_Set_FixedTime%, '  'HH:mm:ss
		}
	}
	GuiControl,, Elem_Clock, %var_Formatted_Value%
	return
;------------------------------------------------------------

;---------------------Show Or Hide Clock---------------------
fun_Show_Hide:
fun_Toggle_Hide:
	var_Toggle := !var_Toggle
	if (var_Toggle = "1")
	{
		WinHide, elem_Watch_Window
	}
	else
	{
		WinShow, elem_Watch_Window
	}
return
;------------------------------------------------------------

;---------------------Don't Save Position--------------------
fun_Lock_Position:
	if (var_Lock_Position = "1")
	{
		;XEIRWN -- TODO -- REVIEW
		Gui, 1:-E0x10
	}
	else
	{
		;XEIRWN -- TODO -- REVIEW
		Gui, 1:+E0x10
	}
	var_Lock_Position := !var_Lock_Position
	Menu, tray, togglecheck, &Lock Position
	IniWrite, %var_Lock_Position%, %st_Configuration_File%, %st_Configuration_Section%, %st_Lock_Position%
return
;------------------------------------------------------------

;----------------------Set Clock Colors----------------------
fun_Set_Clock_Colors:
	SPosX := (A_ScreenWidth)/2 
	SPosY := (A_ScreenHeight)/2
	Gui, 2:Color, black
	Gui, 2:+ToolWindow +AlwaysOnTop -Caption
	Gui, 2:Font, S7 cwhite, Verdana
	Gui, 2:Add, Text, x6 y6 w130 h20 gMove, %st_Settings_Title%
	Gui, 2:Add, Text, x148 y6 w20 h20 gGui2Close, X
	Gui, 2:Add, GroupBox, x6 y25 w150 h75 , Colors
	Gui, 2:Add, Text, x16 y45 w80 h20 , Background:
	Gui, 2:Add, Button, x96 y45 w55 h17 vBack_Color_Btn gfun_Set_Back_Color, %var_Back_Color%
	Gui, 2:Add, Text, x16 y75 w100 h20 , Clock Color:
	Gui, 2:Add, Button, x96 y75 w55 h17 vClock_Color_Btn gfun_Set_Clock_Color, %var_Clock_Color%
	Gui, 2:Add, GroupBox, x6 y103 w150 h38 Right, Transparency
	Gui, 2:Add, Slider, x16 y118 w130 h18 Range15-230 gfun_Set_Transparency vTrans_Value, %var_Transparency%
	Gui, 2:Show, X%SPosX% Y%SPosY% W163 H152, %st_Settings_Title%
	WinSet, Region, 0-0 w163 h152 R10-10, elem_Colors_Window
	WinSet, Transparent, 237, elem_Colors_Window
return

;----------------------Control Mode----------------------
;TODO -- Check the variables and set the appropriate radio elements as checked
fun_Set_Mode:
	SPosX := (A_ScreenWidth)/2 
	SPosY := (A_ScreenHeight)/2
	Gui, 3:Color, black
	Gui, 3:+ToolWindow +AlwaysOnTop -Caption
	Gui, 3:Font, S7 cwhite, Verdana
	Gui, 3:Add, Text, x6 y6 w140 h20 gMove, %st_Mode_Title%
	Gui, 3:Add, Text, x180 y6 w20 h20 gGui3Close, X
	Gui, 3:Add, Radio, x16 y25 gfun_ClockMode Checked, Clock mode.
	Gui, 3:Add, Radio, x106 y25 gfun_TimerMode, Timer mode.
	;Xeirwn -- When selecting timer mode, set the content to something
	Gui, 3:Add, GroupBox, x6 y55 w177 h75 , Clock
	Gui, 3:Add, Radio, x16 y75 gfun_ClockMode24Hour Checked, 24 Hour mode.
	Gui, 3:Add, Radio, x16 y105 gfun_ClockModeAMPM, AM/PM mode.
	Gui, 3:Add, GroupBox, x6 y133 w177 h200 Right, Timer
	;Gui, 3:Add, Radio, x16 y153 gfun_TimerModeToDateTime, Count to datetime.
	Gui, 3:Add, Radio, x16 y223 gfun_TimerModeFixedTime Checked, Count fixed time.
	;Gui, 3:Add, DateTime, x16 y173 wp20 h20 vToDateTime, d/M/yy HH:mm:ss
	Gui, 3:Add, DateTime, x16 y243 wp20 h20 vFixedTime, HH:mm:ss
	;TODO -- Set Fixed Time to some other value other than the current
	Gui, 3:Add, Button, w55 gfun_Timer_Continue, &Continue
	;Xeirwn -- When pressing many times the continue, it delays the execution as it resets it
	;http://www.autohotkey.com/docs/commands/SetTimer.htm
	Gui, 3:Add, Button, xp55 wp gfun_TimerPause, &Pause
	Gui, 3:Add, Button, xp55 wp gfun_TimerLap Default, &Lap
	Gui, 3:Add, Button, x16 yp30 w55 gfun_TimerReset, &Reset
	Gui, 3:Add, Button, xp60 w55 gfun_TimerZero, &Zero
	Gui, 3:Show, X%SPosX% Y%SPosY% W193 H345, %st_Mode_Title%
	WinSet, Region, 0-0 w193 h345 R10-10, st_Mode_Title
	WinSet, Transparent, 237, Watch 1.0 - Mode Settings
return

;-----------------Continue Timer-----------------
fun_Timer_Continue:
	Gui, Submit, NoHide
	SetTimer, fun_TicTac, on
return

;-----------------Pause Timer-----------------
fun_TimerPause:
	Gui, Submit, NoHide
	SetTimer, fun_TicTac, off
return

;-----------------Timer Lap-----------------
fun_TimerLap:
	Gui, Submit, NoHide
	var_Set_FixedTime = %FixedTime%
	IniWrite, %FixedTime%, %st_Configuration_File%, %st_Configuration_Section%, FixedTime
	SetTimer, fun_TicTac, on
	SetTimer, fun_TicTacToc, -1
return

;-----------------Reset Timer-----------------
fun_TimerReset:
	Gui, Submit, NoHide
	var_Set_FixedTime = %FixedTime%
	IniWrite, %FixedTime%, %st_Configuration_File%, %st_Configuration_Section%, FixedTime
	SetTimer, fun_TicTac, off
	SetTimer, fun_TicTacToc, -1
return

;-----------------Zero Timer-----------------
fun_TimerZero:
	Gui, Submit, NoHide
	var_Set_FixedTime = 19700101000000
	SetTimer, fun_TicTac, off
	SetTimer, fun_TicTacToc, -1
return

;-----------------Set Clock Mode-----------------
fun_ClockMode:
	Gui, Submit, NoHide
	var_Watch_Mode := "Clock"
	IniWrite, %var_Watch_Mode%, %st_Configuration_File%, %st_Configuration_Section%, %st_Watch_Mode%
	SetTimer, fun_TicTac, on
return

;-----------------Set Timer Mode-----------------
fun_TimerMode:
	Gui, Submit, NoHide
	var_Watch_Mode := "Timer"
	IniWrite, %var_Watch_Mode%, %st_Configuration_File%, %st_Configuration_Section%, %st_Watch_Mode%
	SetTimer, fun_TicTac, off
return

;-----------------Set AM/PM Clock Mode-----------------
fun_ClockModeAMPM:
	Gui, Submit, NoHide
	var_Clock_Mode := "AM/PM"
	IniWrite, %var_Clock_Mode%, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Mode%
return

;-----------------Set 24Hour Clock Mode-----------------
fun_ClockMode24Hour:
	Gui, Submit, NoHide
	var_Clock_Mode := "24Hour"
	IniWrite, %var_Clock_Mode%, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Mode%
return

;-----------------Set To DateTime Timer Mode-----------------
fun_TimerModeToDateTime:
	Gui, Submit, NoHide
	var_Timer_Mode := "ToDateTime"
	IniWrite, %var_Timer_Mode%, %st_Configuration_File%, %st_Configuration_Section%, %st_Timer_Mode%
return

;-----------------Set To Fixed Time Timer Mode-----------------
fun_TimerModeFixedTime:
	Gui, Submit, NoHide
	var_Timer_Mode := "FixedTime"
	IniWrite, %var_Timer_Mode%, %st_Configuration_File%, %st_Configuration_Section%, %st_Timer_Mode%
return

;----------------------Close Settings Window----------------------
Gui2Close:
	Gui, 2:Destroy
return

;----------------------Close Settings Window----------------------
Gui3Close:
	Gui, 3:Destroy
return

;-----------------Set Clock Background Color-----------------
fun_Set_Back_Color:
	Gui, Submit, NoHide
	var_Back_Color := RGB(dlg_color(var_Clock_Color, hwnd))
	if var_Back_Color <>
	{
		Gui, 1:Color, %var_Back_Color%
		GuiControl, 2:, Back_Color_Btn, %var_Back_Color%
		IniWrite, %var_Back_Color%, %st_Configuration_File%, %st_Configuration_Section%, %st_Back_Color%
	}
return

;-----------------------Set Clock Color----------------------
fun_Set_Clock_Color:
	Gui, Submit, NoHide
	var_Clock_Color := RGB(dlg_color(var_Clock_Color, hwnd))
	if var_Clock_Color <>
	{
		IniWrite, %var_Clock_Color%, %st_Configuration_File%, %st_Configuration_Section%, %st_Clock_Color%
		Gui, 1:Font, c%var_Clock_Color%
		GuiControl, 1:Font, Elem_Clock
		GuiControl, 2:, Clock_Color_Btn, %var_Clock_Color%
	}
return
;------------------------------------------------------------

;-----------------------Set Transparency----------------------
fun_Set_Transparency:
	Gui, Submit, NoHide
	var_Transparency := Trans_Value
	WinSet, Transparent, %var_Transparency%, elem_Watch_Window
	IniWrite, %var_Transparency%, %st_Configuration_File%, %st_Configuration_Section%, %st_Transparency%
return
;------------------------------------------------------------

;-----------------------Set AlwaysOnTop----------------------
fun_Set_Always_On_Top:
	if (var_Always_On_Top = "1")
	{
		WinSet, AlwaysOnTop, Off, elem_Watch_Window
	}
	else
	{
		WinSet, AlwaysOnTop, On, elem_Watch_Window
	}
	var_Always_On_Top := !var_Always_On_Top
	Menu, tray, togglecheck, &Always On Top
	IniWrite, %var_Always_On_Top%, %st_Configuration_File%, %st_Configuration_Section%, %st_Always_On_Top%
return
;------------------------------------------------------------

;-----------------------Exit Application----------------------
ExitApp:
	GoSub, fun_Save_Position
	ExitApp
return

;---------------------Save Clock Position--------------------
fun_Save_Position:
	WinGetPos, %var_Position_X%, %var_Position_Y%,,, elem_Watch_Window
	IniWrite, %var_Position_X%, %st_Configuration_File%, %st_Configuration_Section%, %st_Position_X%
	IniWrite, %var_Position_Y%, %st_Configuration_File%, %st_Configuration_Section%, %st_Position_Y%
return
;------------------------------------------------------------

;------------------Click Through Clock Window-----------------
fun_Click_Through:
	var_Click_Through_Clock := !var_Click_Through_Clock
	if (var_Click_Through_Clock == "1")
	{
		Gui, 1: +E0x20
	} else {
		Gui, 1: -E0x20
	}
	Menu, tray, togglecheck, Click &Through
	IniWrite, %var_Click_Through_Clock%, %st_Configuration_File%, %st_Configuration_Section%, %st_Click_Through_Clock%
return
;------------------------------------------------------------

;http://www.autohotkey.com/board/topic/94083-ahk-11-font-and-color-dialogs/
Dlg_Color(Color,hwnd){
	static
	if !cc{
		VarSetCapacity(CUSTOM,16*A_PtrSize,0),cc:=1,size:=VarSetCapacity(CHOOSECOLOR,9*A_PtrSize,0)
		Loop,16{
			IniRead,col,color.ini,color,%A_Index%,0
			NumPut(col,CUSTOM,(A_Index-1)*4,"UInt")
		}
	}
	NumPut(size,CHOOSECOLOR,0,"UInt"),NumPut(hwnd,CHOOSECOLOR,A_PtrSize,"UPtr")
	,NumPut(Color,CHOOSECOLOR,3*A_PtrSize,"UInt"),NumPut(3,CHOOSECOLOR,5*A_PtrSize,"UInt")
	,NumPut(&CUSTOM,CHOOSECOLOR,4*A_PtrSize,"UPtr")
	ret:=DllCall("comdlg32\ChooseColor","UPtr",&CHOOSECOLOR,"UInt")
	if !ret
	exit
	Loop,16
	IniWrite,% NumGet(custom,(A_Index-1)*4,"UInt"),color.ini,color,%A_Index%
	IniWrite,% Color:=NumGet(CHOOSECOLOR,3*A_PtrSize,"UInt"),color.ini,default,color
	return Color
}

rgb(c){
	setformat,IntegerFast,H
	c:=(c&255)<<16|(c&65280)|(c>>16),c:=SubStr(c,1)
	SetFormat,IntegerFast,D
	return c
}

fun_About:
	applicationName=Watch
	Gui,99:Destroy
	Gui,99:Margin,20,20
	Gui,99:Add,Picture,xm Icon1,%applicationName%.exe
	Gui,99:Font,Bold
	Gui,99:Add,Text,x+10 yp+10,%applicationName% v1.0
	Gui,99:Font
	Gui,99:Add,Text,y+10,This application will create a widget that will have the functionality to show the time or operate as a countdown timer

	Gui,99:Add,Picture,xm y+20 Icon5,%applicationName%.exe
	Gui,99:Font,Bold
	Gui,99:Add,Text,x+10 yp+10,Software by George Michael
	Gui,99:Font
	Gui,99:Add,Text,y+10,For more tools and information, please visit 
	Gui,99:Font,CBlue Underline
	Gui,99:Add,Text,y+5 GBYTEFREAKSNET,www.bytefreaks.net
	Gui,99:Font

	Gui,99:Show,,%applicationName% fun_About
	hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
	OnMessage(0x200,"WM_MOUSEMOVE") 
	return

BYTEFREAKSNET:
	Run,http://www.bytefreaks.net,,UseErrorLevel
	return

Key features

  • You can change the ico that appears in the task bar by placing an ico file with the name watch.ico in the same directory as the executable (or the source)
  • You can drag the watch to a more convenient place
  • Double clicking on the watch it will hide it
  • Double clicking on the icon of the watch it will toggle it’s visibility
  • From the menu on the task bar you can “Set it on top”, allow mouse to click through the clock, hide/show the gui
  • You can set the color of the Font and the Color of the background using a color picker
  • You can set the transparency of the GUI
  • The tool has two modes, it can operate as a clock that shows time in 24 hour mode or AM/PM and can operate as a count down tool (timer)
  • The timer mode allows you to pause (and continue), reset and stop the time, reset and continue the time (using lap) or zero the clock

On-screen clock/count down/counter

This is the version that is used for IEEE Region 8 Committee meetings.

Watch (1529 downloads)

Update: Source code available here

Key features

  • You can change the ico that appears in the task bar by placing an ico file with the name watch.ico in the same directory as the executable (or the source)
  • You can drag the watch to a more convenient place
  • Double clicking on the watch it will hide it
  • Double clicking on the icon of the watch it will toggle it’s visibility
  • From the menu on the task bar you can “Set it on top”, allow mouse to click through the clock, hide/show the gui
  • You can set the color of the Font and the Color of the background using a color picker
  • You can set the transparency of the GUI
  • The tool has two modes, it can operate as a clock that shows time in 24 hour mode or AM/PM and can operate as a count down tool (timer)
  • The timer mode allows you to pause (and continue), reset and stop the time, reset and continue the time (using lap) or zero the clock

Create a sortable ‘Modified Date’ sortable column for posts and pages in wordpress admin area 6

2016-07-14: Post updated to support both pages and posts without redundant/useless code

Paste the following in the functions.php file of your theme:

// Register the column for modified date
function bf_post_modified_column_register( $columns ) {
    $columns['post_modified'] = __( 'Modified Date', 'mytextdomain' );
    return $columns;
}
add_filter( 'manage_edit-post_columns', 'bf_post_modified_column_register' );
add_filter( 'manage_edit-page_columns', 'bf_post_modified_column_register' );

// Display the modified date column content
function bf_post_modified_column_display( $column_name, $post_id ) {
    if ( 'post_modified' != $column_name ){
        return;
    }
    $post_modified = get_post_field('post_modified', $post_id);
    if ( !$post_modified ){
        $post_modified = '' . __( 'undefined', 'mytextdomain' ) . '';
    }
    echo $post_modified;
}
add_action( 'manage_posts_custom_column', 'bf_post_modified_column_display', 10, 2 );
add_action( 'manage_pages_custom_column', 'bf_post_modified_column_display', 10, 2 );

// Register the modified date column as sortable
function bf_post_modified_column_register_sortable( $columns ) {
    $columns['post_modified'] = 'post_modified';
    return $columns;
}
add_filter( 'manage_edit-post_sortable_columns', 'bf_post_modified_column_register_sortable' );
add_filter( 'manage_edit-page_sortable_columns', 'bf_post_modified_column_register_sortable' );

When you refresh http://<Your Domain>/wp-admin/edit.php or http://<Your Domain>/wp-admin/edit.php?post_type=page the ‘Modified Date’ column will be visible and sortable.


Ubuntu Linux: How to Resize and add Label to a many picture files 1

Lets say you have a ton of pictures or photos that you want to resize and add a semi-transparent label at the bottom of this bulk of files and even rename them using a pattern based on a unique number.

You can either do this manually or by using imagemagick. If you chose the second way follow these steps:

First of all install it, from bash/terminal call the following:

sudo apt-get install imagemagick

When that command is successfully completed, navigate to the location that the pictures are and once you are there:

In order to resize all pictures then issue the following command (in this example we make all pictures at most 1200px long or 1200px tall and keep the aspect ratio) :

mogrify -resize 1200 *

NOTE: It will affect the original files! So if you want to keep them make sure to copy them elsewhere BEFORE issuing the above command.

After the above is done, you can issue the following set of commands to:

  1. Get each file and find it’s dimensions (which later will be used for the label creation)
  2. Rename all pictures following the number based pattern
  3. Add a semitransparent label containing custom text at the bottom
counter=0; for i in *;
do let counter=counter+1;
width=`identify -format %w "$i"`;
convert -background '#0008' -fill white -gravity center -size ${width}x30 caption:" Some Arbitrary Text " "$i" +swap -gravity south -composite NewFileName.`printf %03d $counter`.jpeg;
done

This command will preserve the original files.
All together with printing the file that is being processed as debuging information:

mogrify -resize 1200 *; counter=0; for i in *; do let counter=counter+1; echo $i; width=`identify -format %w "$i"`; convert -background '#0008' -fill white -gravity center -size ${width}x30 caption:" Some Arbitrary Text " "$i" +swap -gravity south -composite NewFileName.`printf %03d $counter`.jpeg; done

Sample/Result Photos:

 


Ubuntu Linux: How to install Apache2 – MySQL – PHP (LAMP) phpMyAdmin and fix a few installation errors

We won’t give out pretty much any comments/descriptions for this post because we want to keep it small 🙂

First, install a bunch of stuff:

sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php5 libapache2-mod-php5 php5-mysql

Later, restart your apache so that it loads all modules (php, etc)

sudo /etc/init.d/apache2 restart

and if you get the following error:
“Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” resolve it by adding the line:

ServerName localhost

to the file /etc/apache2/httpd.conf and then try restarting again. (You need root access to edit, if you are not familiar with command line text editors line nano, try sudo gedit /etc/apache2/httpd.conf, gedit is usually available with all gnome installations).

After that, to install phpMyAdmin and make it available at http://localhost/phpmyadmin:

sudo apt-get install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www

(The default MySQL login username ‘root’ and the password is the one you entered during installation in the last step).

Happy developing, hope we helped 🙂


Ubuntu: How to compile STAN SPG Planning System (http://planning.cis.strath.ac.uk/STAN/) on Ubuntu 11.10

Recently we tried to compile the STAN SPG Planning System (http://planning.cis.strath.ac.uk/STAN/) under Ubuntu 11.10  Oneiric Ocelot which ended up in a failure.

After reviewing the source code of version 3 (http://planning.cis.strath.ac.uk/code/) we found out that there were many changes needed to be done that had to do with the age of the code itself. We believe that with an OS from1999 and the repsective g++ libraries there should be no problem compiling this application but who has one anyway ? (From the README file: “The code has been built and tested using Linux and UNIX (SunOS) with the g++ compiler.” )

Solution:

We realized that most of the errors are pretty much the same ones and had to do with C++ syntax. Following a synopsis of the changes we did:

    • Replaced
      #include <stream.h>

      with

      #include <iostream>
      using namespace std;

      Note on this, be sure to put using namespace std; after the rest of the includes to avoid conflicts and other issues that might arise.

    • Replaced
      #include <stream.h>

      with

      #include <fstream>
    • Replaced
      #include <new.h>

      with

      #include <new>
    • Added
      #include <cstring>
      #include <stdlib.h>

      wherever there was a call for string manipulation like (strcmp(),strlen(),strcpy(),..) or whenever there were commands like exit().

    • Replaced array assignments like:
      exvec = pl.exvec;

      to

      for(int i = 0;i<EXVECSIZE;i++)  {
        exvec[i] = pl.exvec[i];
      };

      The ranges of these arrays we were able to find them from the respective .h files.

    • In the makefile, we changed:
      pddl.yacc.tab.c: alldefs.h pddl.yacc lex.yy.c
          bison pddl.yacc

      to

      pddl.yacc.tab.c: alldefs.h pddl.yacc lex.yy.c
          bison pddl.yacc -o pddl.yacc.tab.c

      Or else the make will fail as it will not find the file pddl.yacc.tab.c.

In the next section you will find all changes we did to the files extensively (Hopefully we did not forget any or mess them up). The format is as follows (the changes do not necessarily imply that all changes should happen at the same place in file):

in <FILE>
line that was changed/deleted
line that was changed/deleted
-
line that was added
line that was added
line that was added
  1. in Makefile
    pddl.yacc.tab.c: alldefs.h pddl.yacc lex.yy.c
    bison pddl.yacc

    pddl.yacc.tab.c: alldefs.h pddl.yacc lex.yy.c
    bison pddl.yacc -o pddl.yacc.tab.c
  2. in BasicTim.h
    #include <stream.h>

    #include <iostream>
    using namespace std; // make sure it goes right after the includes (I believe it affects stdio.h)
  3. in SymTab.cc
    #include <stream.h>

    #include <iostream>
    #include <cstring>
    #include <stdlib.h>
    using namespace std;
  4. in BasicTim.cc
    #include <fstream.h>

    #include <fstream>
  5. in TimInterface.cc
    #include <fstream.h>

    #include <fstream>
  6. in globals.h
    #include <stream.h>
    #include <fstream.h>

    #include <fstream>
    #include <iostream>
    using namespace std;
  7. in stan.h
    #include <stream.h>

    #include <iostream>
    using namespace std;
  8. in facts.h
    #include “stream.h”

    #include <iostream>
    #include <cstring>
    using namespace std;
  9. in facts.cc
    #include <stream.h>

    #include <iostream>
    using namespace std;
  10. in facts.cc
    exvec = pl.exvec;

    for(int i = 0;i<EXVECSIZE;i++) {
    exvec[i] = pl.exvec[i];
    };
  11. in facts.cc
    domination = pl.domination;

    for(int i = 0;i<EXVECSIZE;i++)  {
    domination[i] = pl.domination[i];
    };
  12. in actions.cc
    exvec = pl.exvec;

    for(int i = 0;i<EXVECSIZE;i++)  {
    exvec[i] = pl.exvec[i];
    };
  13. in instantiation.cc
    #include <stream.h>

    #include <iostream>
    using namespace std;
  14. in candidates.h
    #include <stream.h>

    #include <iostream>
    using namespace std;
  15. in main.cc
    #include <stream.h>
    #include <fstream.h>
    #include <new.h>

    #include <iostream>
    #include <fstream>
    #include <new>
    #include <stdlib.h>
    using namespace std;

Soon we will add the modified version of the source code online that should be able to compile by just issuing make stan.


Ubuntu: How to compile PrecoSAT v.570 under ubuntu 11.10

By downloading PrecoSAT from http://fmv.jku.at/precosat/ and trying to install it on Ubuntu 11.10 32-bit (Oneiric Ocelot) by:

    • Decompressing the files
    • and calling ./configure && make

I got the following error at make:

g++ -O3 -m32 -static -Wall -Wextra -DNDEBUG -DNLOGPRECO -DNSTATSPRECO  -c precomain.cc
In file included from precomain.cc:23:0:
precosat.hh:164:31: error: ‘ptrdiff_t’ has not been declared
precosat.hh:270:13: error: ‘ptrdiff_t’ has not been declared
make: *** [precomain.o] Error 1

which can be resolved by adding

#include <cstddef>

at the includes in the file precosat.hh


Ubuntu 11.10 (Oneiric Ocelot): Installing KVM 2

Without any additional comments, we managed to install KVM over a fresh installation of Ubuntu 11.10 (Oneiric Ocelot).

To do this we installed the following packages from the repositories and added our user to the libvirtd group.

We called kvm-ok to make sure that our hardware supports KVM properly and thus having better performance.
Installation Commands:

sudo apt-get install kvm libvirt-bin
sudo adduser $USER libvirtd
sudo apt-get install virt-viewer
sudo apt-get install python-vm-builder
sudo apt-get install bridge-utils
sudo apt-get install virtinst #for cloning

After these we created a virtual machine with the following command:

sudo vmbuilder kvm ubuntu --suite oneiric --flavour virtual --arch amd64 --mem 1024 --cpus 2 -o --libvirt qemu:///system --ip 192.168.0.100 --hostname uranus --part vmbuilder.partition --user userName --name MyName MySurname --pass myPassword --addpkg unattended-upgrades --addpkg acpid --addpkg nano

where in general, what it does is, create an Ubuntu Oneiric Ocelot JeOS virtual machine that has an AMD64 architecture, 1GB of RAM, 2 Virtual CPUs, it’s name is uranus, has a user with the username userName, has pre-installed some applications like nano and enabled automatic updates for the system.