It was a lot of fun to customize theme, window manager, fonts, workspaces and other stuff that can be customized without using command line too much. Now I feel myself rather comfortable with XFCE environment and know how to setup basic look'n'feel.
The most fun was trying various p2p network clients (my favourite network type is Direct Connect). I have tried few clients that come as source distributions - not able to compile no-one. Some problems with library dependencies - need more experience to compile Linux software. Then I have taken a look into Synaptic Package Manager, and the first client I have found - Valknut. I don't like it at all - it somehow takes a lot space on the screen displaying a little info at the same time and the overall impression after using it isn't very optimistic. My favourite RevConnect was much-much better :< The second one was MLDonkey which is absolute geek software - default way to use this piece of software is to execute this client as daemon, it runs a little web-server and you access it via your browser. It supports many p2p networks, and Direct Connect is amongst them, but I can't realize how to use it :<
Comments on todo's from #1:
-Add Cyrillic support
+it was very easy with XFCE Settings manager. However, I don't know how to add cyrillic outside of X Window system, but I don't need it.
-Learn how to install programs, the first candidate is Skype
+again, very easy - skype.com have skype .deb installation for Debian Linux derivatives (which xUbuntu is). Default way to install software here - via "apt" utility set or with GUI "apt" wrapper - Synaptic package manager. Some info about how you can install software in Linux
-Try to watch movies :> I'm watching House M.D. now
+Very easy, there is functionall poor but usable default multimedia app - Totem Movie Player, which downloaded all the needed codecs automatically.
-Install adequate Office program pack (Is it StarOffice?)
+OMG, forgot about this. It will be OpenOffice, I think no problem arise.
I'll continue to use xUbuntu, now time has come to do some programming stuff for my university (I'll need to setup Eclipse and all the Java-related stuff,Apache,MySQL etc.). Also I'll check what the opportunities exist to use my PC remotely. And of course - understand how can I use those geeky p2p clients.
Friday, October 17, 2008
Monday, October 6, 2008
Living with Linux, #1
Hi all!
I have decided that I should try Linux seriously, as primary and only operating system. There is UNIX course in my current Latvian University studying program which encouraged me to switch my mind to another alternative to Windows.
I have experimented with UNIX/Linux earlier, some five or six years ago - it was FreeBSD 4.x. I remember that it have taken me some time to customize and run X-window system successfully (as I remember it was KDE 1.x). My display was damaged due to somehow-badly customized refresh rates :D It have taken me some time to successfully recompile kernel to get sound card working :> Then I have never returned to UNIX/Linux world after this experiments with FreeBSD. It was very valuable experience - I have understood that Windows is very nice and comfortable operating system, not "must die" as many can say about it (and continue to using it).
So, I have chosen to try xUbuntu - it's Ubuntu lightweight derivative with XFCE as X-Window system. As I heard Ubuntu is very user-friendly, so it should be nice alternative to person who was working with Windows almost all the time.
First impressions - nice and cute system, very friendly. No problems with installation. Some useful software installed by default - Gimp, Firefox. No serial number :>
TODO for first time:
-Add Cyrillic support
-Learn how to install programs, the first candidate is Skype
-Try to watch movies :> I'm watching House M.D. now
-Install adequate Office program pack (Is it StarOffice?)
That's it.
I have decided that I should try Linux seriously, as primary and only operating system. There is UNIX course in my current Latvian University studying program which encouraged me to switch my mind to another alternative to Windows.
I have experimented with UNIX/Linux earlier, some five or six years ago - it was FreeBSD 4.x. I remember that it have taken me some time to customize and run X-window system successfully (as I remember it was KDE 1.x). My display was damaged due to somehow-badly customized refresh rates :D It have taken me some time to successfully recompile kernel to get sound card working :> Then I have never returned to UNIX/Linux world after this experiments with FreeBSD. It was very valuable experience - I have understood that Windows is very nice and comfortable operating system, not "must die" as many can say about it (and continue to using it).
So, I have chosen to try xUbuntu - it's Ubuntu lightweight derivative with XFCE as X-Window system. As I heard Ubuntu is very user-friendly, so it should be nice alternative to person who was working with Windows almost all the time.
First impressions - nice and cute system, very friendly. No problems with installation. Some useful software installed by default - Gimp, Firefox. No serial number :>
TODO for first time:
-Add Cyrillic support
-Learn how to install programs, the first candidate is Skype
-Try to watch movies :> I'm watching House M.D. now
-Install adequate Office program pack (Is it StarOffice?)
That's it.
Tuesday, August 26, 2008
Creating CHM
Today I were investigating how to create CHM help.
There is original Microsoft "compiler" - hhc.exe and simple IDE - HTML Help Workshop. Using this IDE and compiler you can do all the CHM-related affairs but it is not very convenient.
I have looked to some shareware utils - there 2 approaches to create CHM:
1) Create all the content using this util and then compile it to CHM. Very ugly and non-professional approach (not flexible + I had problems with Russian encodings in almost every tool I tried)
2) Create all the content (HTML, CSS and images) using your favorite tools and then feed the directory containing your prepared content to the util, make some customizations, save project for later usage and then compile it to CHM. Personally I found the second approach much more useful and professional. The most adequate tool for this I have found at the moment is Pocket CHM 4.3.
There is original Microsoft "compiler" - hhc.exe and simple IDE - HTML Help Workshop. Using this IDE and compiler you can do all the CHM-related affairs but it is not very convenient.
I have looked to some shareware utils - there 2 approaches to create CHM:
1) Create all the content using this util and then compile it to CHM. Very ugly and non-professional approach (not flexible + I had problems with Russian encodings in almost every tool I tried)
2) Create all the content (HTML, CSS and images) using your favorite tools and then feed the directory containing your prepared content to the util, make some customizations, save project for later usage and then compile it to CHM. Personally I found the second approach much more useful and professional. The most adequate tool for this I have found at the moment is Pocket CHM 4.3.
Monday, April 7, 2008
Quick way to convert table (CSV or any other shit) to SQL INSERT batch
Imagine, you have the following unending list of data:
You need to insert this data in new temporary table, to use this data in queries for analysing database. Now the best solution I know is to take any smart text editor (I use Notepad++) which can replace text using regular expressions.
So, search string will be
...
49826 447965543413
68428 447965595078
69731 447965596678
116149 447965640054
121889 447965644402
148077 447965666626
177127 447965696290
269990 447965791450
...
You need to insert this data in new temporary table, to use this data in queries for analysing database. Now the best solution I know is to take any smart text editor (I use Notepad++) which can replace text using regular expressions.
So, search string will be
^([0-9]*)[ \t]([0-9]*)$ and replace string will be INSERT INTO table_name (attribute1, attribute2) VALUES (\1, \2), where \1 and \2 means numbers of capturing group. That's all - nice and fast way to do such a work, don't need to programm anything. As the output you'll have something like this:
...
INSERT INTO table_name (attribute1, attribute2) VALUES (49826, 447965543413)
INSERT INTO table_name (attribute1, attribute2) VALUES (68428, 447965595078)
INSERT INTO table_name (attribute1, attribute2) VALUES (69731, 447965596678)
INSERT INTO table_name (attribute1, attribute2) VALUES (116149, 447965640054)
INSERT INTO table_name (attribute1, attribute2) VALUES (121889, 447965644402)
INSERT INTO table_name (attribute1, attribute2) VALUES (148077, 447965666626)
INSERT INTO table_name (attribute1, attribute2) VALUES (177127, 447965696290)
INSERT INTO table_name (attribute1, attribute2) VALUES (269990, 447965791450)
...
Wednesday, March 5, 2008
Extracting fragments from audio and video content
Yesterday my sweetheart asked me to help her with extracting fragments from video and audio content. I hadn't any tasks at my job today, so I begin my working day with searching for soft which can do this.
First of all, I want to mention that there is a nice tool which can do both of this tasks - Vidmex, but 1) a trial version can work with 3sec fragments 2) crack is very hard task to find - there are many cracks available but to download any of them you must register at crack site, which is not free.
I have chosen on 2 products (both are shareware but have trial period - 30 days. Easy workaround - before installing and running for the first time add a few years to current system time's year, after this set the valid time).
For video I have chosen Advanced X Video Converter 4.7.1
For audio - Acoustica 4.0 from Acon Digital Media
Telling the truth I have looked through the catalog of multimedia soft and simply choosed the first available soft which can help me to achieve my goals somehow, that's why both product names begin with 'A' :D
First of all, I want to mention that there is a nice tool which can do both of this tasks - Vidmex, but 1) a trial version can work with 3sec fragments 2) crack is very hard task to find - there are many cracks available but to download any of them you must register at crack site, which is not free.
I have chosen on 2 products (both are shareware but have trial period - 30 days. Easy workaround - before installing and running for the first time add a few years to current system time's year, after this set the valid time).
For video I have chosen Advanced X Video Converter 4.7.1
For audio - Acoustica 4.0 from Acon Digital Media
Telling the truth I have looked through the catalog of multimedia soft and simply choosed the first available soft which can help me to achieve my goals somehow, that's why both product names begin with 'A' :D
Labels:
audio,
extract,
fragment,
multimedia,
video
Tuesday, March 4, 2008
Turning monitor off - my WinAPI experience
Having some free-of-tasks time at my job I decided to create a simple utility which can turn off the my laptop display. I needed such a tool because sometimes display light is very annoying - for example when you are high and want just to listen for a music. It annoys me with ilumination even with "Blank screen" screensaver.
Of course there are plenty of such a soft available on the Internet (however it is all shareware), but as I already have said I had a free time at my job and strong interest to low-level programming (it is really low-level comparing to my everyday tasks).
Here is requirements for utility I need:
- It must turn off the display when launched
- It must turn it on back when ESC key is pressed
Very simple isn't it?
I have no problems with turning display on/off:
Btw, as the window handle you can pass any valid handle
The only problem I had was Windows hooks. Some experience gathered
- If you want to register global hook you MUST define its function in separate DLL
- When registering global hook (registration code can be in the hook DLL or in the calling process, it doesn't matter) use the following code:
- If you want to store any data in the DLL process namespace think if it must be shared between all your-DLL-and-process connections - because Windows allocates separate memory space for DLL data for each process that uses this DLL. For example, in my case, as DLL contained system-wide keyboard hook, it will have separate space
for data for each process where hook event occured. But, I need to store HWND variable for my utility hidden window - to send WM_DISPOSE event to it when user press ESC key (it is the best way I know to close application. May be there are better ways, simply I don't know them). So the solution will be to store this HWND value in shared DLL memory space - in this case it doesn't matter which process will "execute" the hook - HWND value will be the same for all the DLL instances.
Here is code example how to define shared-variable section:
And here is the hook function code:
And code which sets the hook:
Both functions are located at separate DLL, SetHook is marked as __declspec(dllexport) to be able to dynamically call it from dynamically loaded DLL library. I used Microsoft Visual Studio 2003 to work on this problem.
Of course there are plenty of such a soft available on the Internet (however it is all shareware), but as I already have said I had a free time at my job and strong interest to low-level programming (it is really low-level comparing to my everyday tasks).
Here is requirements for utility I need:
- It must turn off the display when launched
- It must turn it on back when ESC key is pressed
Very simple isn't it?
I have no problems with turning display on/off:
//Turn off
SendMessage(HWND_TOPMOST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
//Turn on
SendMessage(HWND_TOPMOST, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
Btw, as the window handle you can pass any valid handle
The only problem I had was Windows hooks. Some experience gathered
- If you want to register global hook you MUST define its function in separate DLL
- When registering global hook (registration code can be in the hook DLL or in the calling process, it doesn't matter) use the following code:
SetWindowsHookEx(WH_KEYBOARD, HookFunction, hDLLInstance, 0);- If you want to store any data in the DLL process namespace think if it must be shared between all your-DLL-and-process connections - because Windows allocates separate memory space for DLL data for each process that uses this DLL. For example, in my case, as DLL contained system-wide keyboard hook, it will have separate space
for data for each process where hook event occured. But, I need to store HWND variable for my utility hidden window - to send WM_DISPOSE event to it when user press ESC key (it is the best way I know to close application. May be there are better ways, simply I don't know them). So the solution will be to store this HWND value in shared DLL memory space - in this case it doesn't matter which process will "execute" the hook - HWND value will be the same for all the DLL instances.
Here is code example how to define shared-variable section:
//Will store main window handle at shared DLL memory space
#pragma data_seg(".SHARED")
HWND hWnd = NULL;
//hook management
HHOOK hhookKeyboardHook;
#pragma data_seg()
#pragma comment(linker, "/section:.SHARED,rws")
And here is the hook function code:
LRESULT __stdcall HookFunction(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode < 0){ // do not process message
return CallNextHookEx((HHOOK)HookFunction, nCode, wParam, lParam);
} else if (VK_ESCAPE == wParam){
//Turn on the monitor
SendMessage(HWND_TOPMOST, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
//Release hook
if(NULL != hhookKeyboardHook ){
UnhookWindowsHookEx(hhookKeyboardHook );
}
//Send message to close application
SendMessage(hWnd, WM_DESTROY, 0, 0);
}
//calling next hook which may exist
return CallNextHookEx((HHOOK)HookFunction, nCode, wParam, lParam);
}
And code which sets the hook:
__declspec(dllexport) void __stdcall SetHook(HWND windowHandle){
hWnd = windowHandle;
SendMessage(HWND_TOPMOST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
SetWindowsHookEx(WH_KEYBOARD, HookFunction, hInst, 0);
}
Both functions are located at separate DLL, SetHook is marked as __declspec(dllexport) to be able to dynamically call it from dynamically loaded DLL library. I used Microsoft Visual Studio 2003 to work on this problem.
Labels:
C/C++,
hardware,
Visual Studio,
WinAPI,
Windows
Subscribe to:
Comments (Atom)