U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » UppHub » More new functions
More new functions [message #18804] Wed, 22 October 2008 23:25 Go to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

I propose you some new functions tested in GNU/Linux Ubuntu (Gnome), XP and Vista.
Please give me your feedback and feel free to fix everything:

String GetExtExecutable(const char *ext);

// GetExtExecutable("pdf") will return the name of the program
// that by default open pdf files.
// In XP/Vista it will return the program with the full path


bool LaunchFile(const String& file);

// LaunchFile("Sheet.xls") will open the file with the
// program asigned by default to open xls files


int LaunchCommand(const char *cmd, void (*readCallBack)(String &));

// LaunchCommand("mplayer myclip.avi", MyCallback) will launch
// the command line program with args without opening a window, and
// all the output will be sent to MyCallback(String &) function


int LaunchCommand(const char *cmd, String &ret);

// LaunchCommand("mplayer myclip.avi",str) will do the same
// but sending the output to String str


String GetDesktopFolder();
String GetProgramsFolder();
String GetAppDataFolder();
String GetMusicFolder();
String GetPicturesFolder();
String GetVideoFolder();
String GetPersonalFolder();
String GetTemplatesFolder();
String GetDownloadFolder();

// These functions return the folder assigned for Desktop,
// Program Files, etc.
// (from now please do not do this:
// AppendFileName(GetHomeFolder(), "Desktop");
// to refer to the Desktop folder or using
// "C:\\Program Files" ...
// in many languages is wrong
// It does not handle firefox download folder as it has been
// impossible for me to know where it is (until now)


bool FileCat(const char *file, const char *appendFile);

// FileCat("FirstFile", "SecondFile") just append SecondFile
// from the end of FirstFile


As you may see some of them use in Linux Portland XdgUtils in the background.
I think it is a strong portable widespread source of information.

If somebody is interested I have a small class that works like
LaunchCommand but opening a command window that handles \r and
\n properly (to be used for example with mencoder).


Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #18808 is a reply to message #18804] Thu, 23 October 2008 07:35 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Interesting functions!
Thanks!
Re: More new functions [message #18815 is a reply to message #18804] Fri, 24 October 2008 01:22 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
These are great; really good functionality. Are they being added to core? or maybe we can add them as a utility package in bazar if not.
Re: More new functions [message #18817 is a reply to message #18804] Fri, 24 October 2008 08:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Thank you. About how to integrate them in Upp is a matter to be decided by the main developers.

Just to say that I have ready to post in few days a new version that supports firefox (if firefox is the by default web browser, GetDownloadFolder() returns the folder where the downloads go by default).

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #18819 is a reply to message #18817] Fri, 24 October 2008 14:05 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
Can you explain this line to me?
int LaunchCommand(const char *cmd, void (*readCallBack)(String &))
Particularly the readCallBack part.

Also, if you're not using a GUI (CtrlCore), what will happen with this line:
Ctrl::ProcessEvents();
Re: More new functions [message #18821 is a reply to message #18819] Fri, 24 October 2008 15:28 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
captainc wrote on Fri, 24 October 2008 13:05

Can you explain this line to me?
int LaunchCommand(const char *cmd, void (*readCallBack)(String &))
Particularly the readCallBack part.

Shouldn't this be:
int LaunchCommand(const char *cmd, Callback1<String> readCallBack)


captainc wrote on Fri, 24 October 2008 13:05

Also, if you're not using a GUI (CtrlCore), what will happen with this line:
Ctrl::ProcessEvents();


I haven't tried, but presumably it won't compile. I'm also not sure if it's safe to call ProcessEvents from outside the GUI thread, but I'm guessing not.

Perhaps you could replace ProcessEvents with Sleep? If somebody wants to update a GUI then they should use the Callback version of LaunchCommand and do it themselves. I think it could then be run in a thread, which would be more useful for command line apps IMO.

[Updated on: Fri, 24 October 2008 15:44]

Report message to a moderator

Re: More new functions [message #18834 is a reply to message #18804] Sun, 26 October 2008 01:19 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

Thank you for the feedback. First I inclose you a screengrab of a program I am doing that uses these functions. It is very preliminary but it runs:

index.php?t=getfile&id=1462&private=0

With this program I drag-drop movie clips in a main track that I convert in DVD format mpg files:
- With LaunchCommand(const char *cmd, String &ret); I get the video images you see in the center-left side column using mplayer
- With LaunchCommand(const char *cmd, void (*readCallBack)(String &)); I get the final .mpg DVD compatible file using mencoder. All the mencoder output goes to a function that sends it to a window (in the screengrab). If the window is closed, it kills the process before.

Coming to the comments:
- You are right: I have to change LaunchCommand in case of non GUI program to not call Ctrl::ProcessEvents();
- Ctrl::ProcessEvents(); lets the main GUI program to follow doing other things and being responsive to user without stoping the process. The command runs in another thread and the main GUI program only gets its output.
It is not perfect multithread, but it works well.
- In LaunchCommand, for example, to join to files, I would do LaunchCommand("mencoder a.avi b.avo -oac copy -ovc copy - ab.avi", myfun);
a basic myfun would be like:
void myfun(String &s)
{
     MySendStrToCommandWindow(s);
     MyParseStrToMoveProgressBar(s);
}

About the functions, I have prepared more but before finishing them I would like to ask you if putting them in different functions or declaring them into classes like:

class SysFolders          // Special folders
	String GetDesktop();
	String GetPrograms();
	String GetAppData();
	String GetMusic();
	String GetPictures();
	String GetVideo();
	String GetPersonal();
	String GetTemplates();
	String GetDownload();

	String GetRoot();  // New
	String GetTemp();  // New
        Possible new functions to change folders

class SysOS          // OS info. Samples after //
	String GetName();	// Windows  Linux
	String GetCode();	// 6.0	    2.6.8-1.523
	String GetVersion();	// Vista    Ubuntu
	String GetRelease();	// Home Premium Edition	8.04
	String GetSize();	// 64-bit   32-bit

class SysCPU          //CPU info
	String GetIdentifier();
	String GetLevel();
	String GetRevision();
	String GetArchitecture;
	String GetSpeed();
	String GetNumber();
        Possible new functions to get more details

class SysProcesses          //Current processes info. 
	bool Update();      // Gets processes info
	bool GetFirst(int processId, String pName);
	vool GetNext(int processId, String pName);
        Possible new functions to kill processes or change priority


I have seen in Upp that it tends to not create new classes with grouped static functions inside, but doing alone functions. What do you prefer ?

Best regards
Koldo



Best regards
Iñaki
Re: More new functions [message #18835 is a reply to message #18834] Sun, 26 October 2008 02:03 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
Quote:

I have seen in Upp that it tends to not create new classes with grouped static functions inside, but doing alone functions.

This is a good point. I think it would be helpful to have functions grouped in some way. I have learned about the global function by just going one by one down the auto-complete assist++ list and reading the code on what those functions do. Some are self-explanatory, others are not. Most of them have simple intuitive names, but sometimes you need to do a search through all the functions to find the one you are looking for because assist++ matches from the beginning of the name. Though, in some ways, all those global functions have been very helpful because they were right there for me to scroll to. I think the problem is going to come in as we keep adding more and more to global.

[Updated on: Sun, 26 October 2008 02:04]

Report message to a moderator

Re: More new functions [message #18840 is a reply to message #18804] Sun, 26 October 2008 10:19 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello captainc

Thats it. In some cases is more than grouping functions indeed.
For example in the "SysCPU" functions related with the CPU info, the program gets all the information in one time so, for String GetSpeed() it will get all information for just getting the speed. As this information does not change while the program is running (CPU make, number, speed, etc), the class would gather all the info one time so the function would be like this:

SysCPU::GetSpeed() {return speed;};

In "SysProcesses" functions it is a little different as the processes info is something changing so we could have at the same cost two focus:
- class SysProcesses //Current processes info.
bool Update(); // Gets processes info
bool GetFirst(int &processId, String &pName);
vool GetNext(int &processId, String &pName);

or
- bool GetProcessesList(Array<int>&pid, Array<String>&name);

Best regards
Koldo

(P.D. Class and function names are just a proposal that you could change)


Best regards
Iñaki

[Updated on: Sun, 26 October 2008 10:20]

Report message to a moderator

Re: More new functions [message #18880 is a reply to message #18804] Thu, 30 October 2008 08:24 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

Sorry for the delay. Now I am waiting for luzr final feedback about the structure of these functions.

After that I plan to have them ready (functions, a guy test and a text test) and tested for XP, Vista, Ubuntu 32 and 64 bits in two weeks.

In the second phase of about a month I want to test them with these free (as free beer) distros: Mandriva, Open Suse, Gentoo and Knoppix, 32/64 bits, Intel/AMD64, Gnome/Kde/Xfce desktops.
This is because some of these functions have to identify the system accurately so they have to be tested with as many systems as possible.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #18902 is a reply to message #18804] Fri, 31 October 2008 10:44 Go to previous messageGo to next message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
I have a little question.

We are always speaking about xp, vista ubuntu 32 & 64 but what about xp and vista 64 ?
Does upp works well on these paltforms ?
Re: More new functions [message #18903 is a reply to message #18804] Fri, 31 October 2008 13:25 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello cocob

Sorry but I cannot answer you as I do not have access to them.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #18904 is a reply to message #18880] Fri, 31 October 2008 13:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
koldo wrote on Thu, 30 October 2008 03:24

Hello all

Sorry for the delay. Now I am waiting for luzr final feedback about the structure of these functions.



class SysFolders          // Special folders
	String GetDesktop();
	String GetPrograms();
	String GetAppData();
	String GetMusic();
	String GetPictures();
	String GetVideo();
	String GetPersonal();
	String GetTemplates();
	String GetDownload();

	String GetRoot();  // New
	String GetTemp();  // New
        Possible new functions to change folders


I think these should be in App.h, as global functions appended with "Path" or "Folder".

class SysOS          // OS info. Samples after //
	String GetName();	// Windows  Linux


I am not quite sure the merit of above.

	String GetCode();	// 6.0	    2.6.8-1.523


IMO we need something more comparable there. Maybe like puttint it into int64 as 4 16-bit fields or something like that? Or maybe just introduce "CompareVersion" function?

CompareVersion("2.4.5", "2.5.2") < 0

	String GetSize();	// 64-bit   32-bit


What for?

class SysCPU          //CPU info
	String GetIdentifier();
	String GetLevel();
	String GetRevision();
	String GetArchitecture;
	String GetSpeed();
	String GetNumber();
        Possible new functions to get more details


Well, maybe... Anyway, I have a hard time imagining what are these good for beyond some fancy about box.

Still, not a bad idea to have it implemented.

class SysProcesses          //Current processes info. 
	bool Update();      // Gets processes info
	bool GetFirst(int processId, String pName);
	vool GetNext(int processId, String pName);
        Possible new functions to kill processes or change priority


Yes, class for this one... The question is whether this belongs to Core. Most apps will not need this. But perhaps yes still.

Mirek
Re: More new functions [message #18916 is a reply to message #18804] Fri, 31 October 2008 15:51 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello luzr

I agree. I begin to work.

About SysOS and SysCPU:
-
String GetName();	// Windows  Linux
Well... touché!

- I agree with your code:
CompareVersion("2.4.5", "2.5.2") < 0

- I will also include distro identification

Somebody could say that the user do know the OS, desktop, distro, cpu, etc. as it is his/her computer. But:
- Some info is interesting for the program itself, as knowing which desktop is installed
- In case of errors the program can do accurate reports to be sent to the developers.

But for SysCPU, I will reduce the number of functions...

I will also include this functions:

// I do not like this name. Perhaps:
// GetExtProgram() or GetProgramFromExtension()
String GetExtExecutable(const char *ext);
bool LaunchFile(const String& file);

int LaunchCommand(const char *cmd, void (*readCallBack)(String &));
int LaunchCommand(const char *cmd, String &ret);

bool FileCat(const char *file, const char *appendFile);

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #18917 is a reply to message #18916] Fri, 31 October 2008 16:03 Go to previous messageGo to next message
bytefield is currently offline  bytefield
Messages: 210
Registered: December 2007
Experienced Member
Instead of having these functions parted or just some of them i suggest to make a Sys package on bazaar and put in it all stuff that is related to, so who want to use CPU/OS/Version/etc may use that package easy and who doesn't need these functions doesn't have to worry about "bloating" his code... I think that's why Upp have a modular design, no? And that's why bazaar exist...

cdabbd745f1234c2751ee1f932d1dd75
Re: More new functions [message #19117 is a reply to message #18804] Thu, 13 November 2008 09:15 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

I follow working hard in this.
Now It is 100% tested in Windows and 80% in Linux.
I expect to show you the results in few days.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #19193 is a reply to message #19117] Wed, 19 November 2008 08:09 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

I will post tomorrow the functions tested in XP and Vista (MinGW and MSC), Ubuntu 32-64 8.04, Kubuntu and Xfce 8.10 and Fedora 9.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #19200 is a reply to message #18804] Wed, 19 November 2008 17:44 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Here it is!

I enclose you two folders:
- SysInfo: The package
---- SysInfo.cpp
---- SysInfo.h
---- SysInfo.upp
- SysInfo demo non-gui: A command line sample
---- main.cpp: The sample
---- SysInfo demo non-gui.upp

Finally I have included much more functions. Just run the demo program and play with it.

There are "SysInfo" functions and others, mainly because they were necessary. Please tell me the best way to organize them to be enclosed some in bazaar and some in other packages.

The next steps will be in addition to do a gui demo and to test the commands in more distros and OS as FreeBSD, OpenSolaris, Slackware and Knoppix. And of course to fix bugs and include more things if you want.

Best regards
Koldo

PD. I enclose you part of the program output as a sample:


Introduce enter or (l) to log off, (r) to reboot or (s) to shutdown
Introduce number of test cycles or just type enter to run it once:
SysInfo functions demo

Special folders
Desktop: /home/aupa/Escritorio
Programs: /usr/bin
Application Data: /home/aupa
Music: /home/aupa/Escritorio
Pictures: /home/aupa/Escritorio
Video: /home/aupa/Escritorio
Personal: /home/aupa/Escritorio
Templates: /home/aupa/Escritorio
Download: /home/aupa/Escritorio
Temp: /home/aupa
Os: /bin
System:

System info:
System manufacturer 'TOSHIBA', product name 'Satellite A300',
version 'PSWJ0E-21403CE', number of processors: 2
Real CPU Speed: 1.830 GHz
Battery info
Working with battery: yes, Percentage: 85%, Remaining; 151 min
Bios version 'V2.70 ',
release date '04/14/2008'
Processor #0: Vendor 'GenuineIntel',
identifier 'Intel(R) Core(TM)2 Duo CPU T5550 @ 1.83GHz',
architecture 'i686
Family 6 Model 15 Stepping 13', speed 1833 MHz
Processor #1: Vendor 'GenuineIntel',
identifier 'Intel(R) Core(TM)2 Duo CPU T5550 @ 1.83GHz',
architecture 'i686
Family 6 Model 15 Stepping 13', speed 1833 MHz

Press enter to continue...

Memory info:
Percent of memory in use: 75%
Total physical memory: 2116001792 bytes (2.0Gb)
Free physical memory: 518352896 bytes (494.3Mb)
Total paging file: 729112576 bytes (695.3Mb)
Free paging file: 0 bytes (0b)
Total virtual memory: 4721266688 bytes (4.4Gb)
Free virtual memory: 4721266688 bytes (4.4Gb)

Os info:
Kernel: Linux, version: 2.6.24-21-generic #1 SMP Tue Oct 21 23:43:45 UTC 2008,
architecture: i686

Distro: ubuntu, version: 8.04
Desktop: gnome, version: 2.22.3

Program compiled with gnuc version 40103. Compilation date: Nov 19 2008

Default exes info:
Default program for 'html' is 'firefox.desktop'
Default program for 'doc' is 'ooo-writer.desktop'
Default program for 'png' is 'eog.desktop'
Default program for 'pdf' is 'evince.desktop'
Default program for 'txt' is 'gedit.desktop'
Default program for 'xyz' is ''

Drives list:
Drive path:'/'
Type: 'Hard', Volume: 'Linux',
MaxName: 255, File System: ext3
Free Bytes User: 46895562752 (43.7Gb)
Total Bytes User: 54519554048 (50.8Gb), Total Free Bytes: 46895562752 (43.7Gb)
Drive path:'/home'
Type: 'Hard', Volume: 'Shared drive',
MaxName: 255, File System: ext3
Free Bytes User: 71834021888 (66.9Gb)
Total Bytes User: 130094362624 (121.2Gb), Total Free Bytes: 71834021888 (66.9Gb)

Other Info:
Process Id: 17248
Process name: 'demo'
Process file name: '/home/exe/demo'
Process priority is: 5
Now changed to high priority: No
Process priority is: 5

Launch file 'test.txt':

If modify 'test.txt' it will ask you to save or not the file
If you answer Yes or No the program will be terminated
If you answer Cancel or wait more than 5 seconds the program will be killed

Press enter to terminate 'test.txt'
Process terminated

Windows list:
Window hwnd: 41943086, processId: 6154, Name: gdesklets-daemon
File name: /usr/bin/python2.5
Window caption: 'gdesklets-daemon '
Window hwnd: 16821977, processId: 5995, Name: nautilus
File name: /usr/bin/nautilus
Window caption: 'SysInfo demo non-gui - Navegador de archivos '
Window hwnd: 35654762, processId: 0, Name: theide-svn
File name:
Window caption: 'SysInfo demo non-gui - - TheIDE - [/home/SysInfo/SysInfo.cpp UTF-8] { MyApps } '

Process list:
Id 5898: Priority: 5, Program: /usr/bin/gnome-session
Id 5948: Priority: 5, Program: /usr/lib/libgconf2-4/gconfd-2
Id 5956: Priority: 5, Program: /usr/bin/seahorse-agent
Id 17071: Priority: 5, Program: /usr/bin/theide-svn
  • Attachment: SysInfo.7z
    (Size: 17.96KB, Downloaded 469 times)


Best regards
Iñaki
Re: More new functions [message #19204 is a reply to message #19200] Thu, 20 November 2008 10:35 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Quote:

C:\MyApps\SysInfo\SysInfo.cpp(30) : fatal error C1083: Cannot open include file: 'usvn/SlaveProcess.cpp': No such file or directory
Re: More new functions [message #19210 is a reply to message #18804] Thu, 20 November 2008 14:18 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello Ion

Look to your upp/uppsrc folder. Inside there has to be a usvn folder with SlaveProcess.cpp file inside.

If not try to look for that file and include it in the project.

Please tell if you found it and where for fixing if something is wrong from me.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #19220 is a reply to message #19210] Fri, 21 November 2008 07:40 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

I have not found file "SlaveProcess.cpp" in usvn folder from uppsrc folder (updated by svn).
From where can o get this file?
In package organizer is not added usvn package. this is not a problem. I can add this!

[Updated on: Fri, 21 November 2008 07:42]

Report message to a moderator

Re: More new functions [message #19221 is a reply to message #19220] Fri, 21 November 2008 08:17 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello Ion

Here they are SlaveProcess.cpp and SlaveProcess.h.

Best regards
Koldo
  • Attachment: usvn.rar
    (Size: 4.00KB, Downloaded 428 times)


Best regards
Iñaki
Re: More new functions [message #19222 is a reply to message #19221] Fri, 21 November 2008 13:25 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

koldo wrote on Fri, 21 November 2008 09:17

Hello Ion

Here they are SlaveProcess.cpp and SlaveProcess.h.

Best regards
Koldo


Hello Koldo

The class LocalProcess is redefinition. May be you used a old svn version?

The class LocalProcess is create in core/LocalProcess.h

[Updated on: Fri, 21 November 2008 13:26]

Report message to a moderator

Re: More new functions [message #19226 is a reply to message #19222] Fri, 21 November 2008 16:13 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello Ion

Yes, that's right... it has been moved to core 5 days ago!.
Today I will post the update.

Best regards
Iñaki


Best regards
Iñaki
Re: More new functions [message #19229 is a reply to message #18804] Fri, 21 November 2008 22:24 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

Here it is the updated version.

Best regards
Koldo
  • Attachment: SysInfo.7z
    (Size: 17.74KB, Downloaded 387 times)


Best regards
Iñaki
Re: More new functions [message #19232 is a reply to message #19229] Sat, 22 November 2008 08:32 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Hello Coldo!
There is a mistake:

Quote:


#if defined(PLATFORM_WIN32)
#if defined(__MINGW32__)

#define PRODUCT_UNDEFINED 0x00000000

#define PRODUCT_ULTIMATE 0x00000001
#define PRODUCT_HOME_BASIC 0x00000002
#define PRODUCT_HOME_PREMIUM 0x00000003
#define PRODUCT_ENTERPRISE 0x00000004
#define PRODUCT_HOME_BASIC_N 0x00000005
#define PRODUCT_BUSINESS 0x00000006
#define PRODUCT_STANDARD_SERVER 0x00000007
#define PRODUCT_DATACENTER_SERVER 0x00000008
#define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
#define PRODUCT_ENTERPRISE_SERVER 0x0000000A
#define PRODUCT_STARTER 0x0000000B
#define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
#define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
#define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
#define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
#define PRODUCT_BUSINESS_N 0x00000010
#define PRODUCT_WEB_SERVER 0x00000011
#define PRODUCT_CLUSTER_SERVER 0x00000012
#define PRODUCT_HOME_SERVER 0x00000013
#define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
#define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
#define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
#define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
#define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019

#define PRODUCT_UNLICENSED 0xABCDABCD
#endif
...
#endif



you have defined only for mingw32 build but not and for msc8, or msc9!
Re: More new functions [message #19244 is a reply to message #19232] Sat, 22 November 2008 23:24 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello Ion

I have seen that MSC9 includes those constants but at least the MinGW version included in Ultimate does not, so I have included them only for MinGW.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #19248 is a reply to message #19244] Sun, 23 November 2008 07:58 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

koldo wrote on Sun, 23 November 2008 00:24

Hello Ion

I have seen that MSC9 includes those constants but at least the MinGW version included in Ultimate does not, so I have included them only for MinGW.

Best regards
Koldo

Hello Coldo. With MSC8 is not included.
Re: More new functions [message #19250 is a reply to message #19244] Sun, 23 November 2008 10:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
koldo wrote on Sat, 22 November 2008 17:24

Hello Ion

I have seen that MSC9 includes those constants but at least the MinGW version included in Ultimate does not, so I have included them only for MinGW.

Best regards
Koldo


#ifdef?

Mirek
Re: More new functions [message #19255 is a reply to message #19250] Sun, 23 November 2008 16:20 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
As you like!

In this case both #if defined(__MINGW32__) and #ifdef __MINGW32__ are equivalent.

If you prefer I will change all the #if defined to #ifdef.

The second is shorter but the first is a little richer. For example I think #if defined(x) || defined(y) is not possible with #ifdef.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #19258 is a reply to message #19255] Sun, 23 November 2008 18:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Sorry, I meant

#ifndef PRODUCT_UNDEFINED

Mirek
Re: More new functions [message #19264 is a reply to message #19258] Sun, 23 November 2008 20:08 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello luzr

Really PRODUCT_UNDEFINED and some others are not used inside the code, but I will do what you indicate me.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #19277 is a reply to message #18804] Mon, 24 November 2008 00:28 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

Here I enclose you an update with a fix to a problem in Kde that has been very hard for me to solve: in certain situations Kde console demo got an Xlib exception in situations covered by the program. This did not happened in Gnome or Xfce.

The solution has been as simple as including a dummy X11 error handler, as the program by itself manages the errors properly. As usual the solution came analyzing the Upp code.

Thank you for your comments. Please give me some feedback if the program works right and in which environments.

Best regards
Koldo

  • Attachment: SysInfo.7z
    (Size: 17.82KB, Downloaded 386 times)


Best regards
Iñaki
Re: More new functions [message #19424 is a reply to message #18804] Wed, 03 December 2008 09:30 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

I am very happy to show you the SysInfo testing results (see inclosed spreadsheet for details).
- If Smile the distro is tested and all or almost all the functions run properly
- If Sad I did not found a live CD to test the distro or I have had problems when running it that avoided me to test the SysInfo console demo

DISTROS AND O.S.
BSD
Sad Freesbie
GNU/Linux
Smile Fedora
Sad Fluxbox
Sad Gentoo
Sad Knoppix
Smile Kubuntu
Smile Mandriva
Smile Opengeu
Smile OpenSuse
Sad Slackware
Smile Slax (Slackware)
Smile Ubuntu (32 & 64 bits)
Smile Xubuntu
Windows
Smile Vista
Smile XP

DESKTOPS
Smile Gnome
Smile Kde
Smile Xfce
Smile Enlightenment
Sad Fluxbox

In the inclosed SysInfo.zip you can find the source, the demo and the testing results including the log files and a spreadsheet table with the detailed results per distro.

For now the functions documentation is in the SysInfo.h file

SysInfo functions give information about:
- Special folders (Desktop, Download, Music, ...)
- System Info
- Memory Info
- Os Info
- Distro Info
- Default Exes
- Drives Info
- Launch File
- Find and Kill Window
- Windows List
- Process List

This functions do not require:
- To install additional programs. They do not have dependencies
- Super user permissions

If you want to use SysInfo and your distro/kernel is not in the list please try it. If some of the functions do not work please send me a post and I will try to solve it.

I will try to put this in Bazaar (now I do not know how)

In another post I will include new SysInfo functions I want to do. Ideas are acknowledged.

Best regards
Koldo

  • Attachment: SysInfo.zip
    (Size: 65.06KB, Downloaded 387 times)


Best regards
Iñaki
Re: More new functions [message #19554 is a reply to message #19424] Mon, 15 December 2008 10:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
koldo wrote on Wed, 03 December 2008 03:30


- If Smile the distro is tested and all or almost all the functions run properly
- If Sad I did not found a live CD to test the distro or I have had problems when running it that avoided me to test the SysInfo console demo



IMO, using Smile / Sad was not a best idea Smile Also, mixing "not found a live CD" vs "problems" is not a good idea either...

I think we should have 3 lists - where it works, where it does not and where it was not tested.

Mirek
Re: More new functions [message #19570 is a reply to message #19554] Wed, 17 December 2008 08:33 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Ok

I will update it in next December release to be done in Bazaar.

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #19783 is a reply to message #18804] Sat, 17 January 2009 22:32 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello all

Added SysInfo and Automation libraries and samples in Bazaar (post http://www.ultimatepp.org/forum/index.php?t=msg&goto=197 76&#msg_19776).

Best regards
Koldo


Best regards
Iñaki
Re: More new functions [message #30288 is a reply to message #19783] Wed, 22 December 2010 07:49 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

It looks like GetAppDataFolder() returns empty string in some cases on Windows 7 (especially when run under debugger). Inner tracing shows that SHGetFolderPathW() returns <void>, and I don't know if it is good.
More of that, GetHomeDirectory() is more stable but returns poorly encoded value under Windows 7. In such cases, ToSystemCharset(GetHomeDirectory()) returns right value.
App encoding is UTF8, Win version is Win7 Ultimate Russian. User name is in russian characters. Local folders are default.

[Updated on: Wed, 22 December 2010 09:48]

Report message to a moderator

Re: More new functions [message #30334 is a reply to message #30288] Sat, 25 December 2010 10:05 Go to previous message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Hello Mindtraveller

In fact SHGetFolderPathW seems to be deprecated.


Best regards
Iñaki
Previous Topic: Simple app-wide "macros"
Next Topic: Grid helper
Goto Forum:
  


Current Time: Sun Apr 26 17:02:28 GMT+2 2026

Total time taken to generate the page: 0.01735 seconds