Wednesday, 26 May 2010

How to lock & unlock the KDE4 screensaver from command line

Here are two DBUS commands you can use to start or stop the KDE4 screensaver (previously known as kscreensaver or kscreenlock) from the command line.
Enter one of the following two commands into your linux shell (bash):

Lock:
dbus-send --type=method_call --dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.Lock

Unlock without password:
dbus-send --type=method_call --dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SetActive boolean:false

Both these commands work with the latest KDE 4.3.5

Friday, 14 May 2010

HOW TO Install MetaTrader 4 on Linux

How to run Meta Trader 4 on Linux using WINE.
  1. Sign up for an account at a forex broker, and download their MT4 installer. I used Easy-Forex, but this procedure should work for any version of Meta Trader 4.x.
  2. Install wine on your linux machine (I used wine 1.1.44 on an openSuSE 11.2 machine). Also download winetricks (used to install additional libraries required by MetaTrader).
  3. If you haven't used wine before, run 'winecfg' to create your installation directory. You can then click 'OK' to exit the dialog, or have a look around at the options (I used the defaults).
  4. Start up a Windows computer, and copy all the files in C:\WINDOWS\Fonts into the wine directory (/home/username/.wine/drive_c/windows/Fonts)
  5. Run winetricks to install mfc40 and mfc42:
      sh ./winetricks mfc40 mfc42
  6. Run the MetaTrader installer executable.
       wine ./mt4setup.exe
That's it! You should now be able to run MetaTrader4 by clicking on the icon on the desktop, or running the following command in your Linux shell:

wine /home/username/.wine/drive_c/Program\ Files/yourmt4installdirectory/terminal.exe

If you have any more problems or questions, please contact me by leaving a comment. MetaTrader is running fine for me under openSuSE 11.2 with the latest WINE from the repositories, once MFC40, MFC42 and the correct fonts had been installed.

More information:
http://appdb.winehq.org/objectManager.php?sClass=version&iId=2893
http://www.aboutcurrency.com/university/metatrader/installing_metatrader4_under_linux.shtml
http://easyforextrading4u.com/metatrader-linux/

Appendix:
When you first start MetaTrader4, it might take a while to initialise. You'll see something like the following in the shell output:

fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.

Exp file "Z:\home\david\.wine\drive_c\Program Files\MT4 at easy-forex\experts\MACD Sample.ex4" produced - 0 error(s), 0 warning(s)
Xlib: extension "Generic Event Extension" missing on display ":1000.0".
fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.

Exp file "Z:\home\david\.wine\drive_c\Program Files\MT4 at easy-forex\experts\Moving Average.ex4" produced - 0 error(s), 0 warning(s)
Xlib: extension "Generic Event Extension" missing on display ":1000.0".
fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.

Exp file "Z:\home\david\.wine\drive_c\Program Files\MT4 at easy-forex\experts\indicators\Accumulation.ex4" produced - 0 error(s), 0 warning(s)
Xlib: extension "Generic Event Extension" missing on display ":1000.0".
fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.


Some errors I was encountering before installing the mfc40 and mfc42 libraries:

err:module:import_dll Library KERNELBASE.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Debug-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-ErrorHandling-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-File-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Handle-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Interlocked-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-LibraryLoader-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Localization-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-LocalRegistry-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Memory-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Misc-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-ProcessEnvironment-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-ProcessThreads-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Profile-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-String-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Synch-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-SysInfo-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library MFC42.DLL (which is needed by L"Z:\\home\\david\\.wine\\drive_c\\Program Files\\MT4 at easy-forex\\MetaEditor.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\home\\david\\.wine\\drive_c\\Program Files\\MT4 at easy-forex\\MetaEditor.exe" failed, status c0000135