Ultimate++ forum - RDF feed https://www.ultimatepp.org/forums/ <![CDATA[Re: Memory leaks ?]]> 10682 51768 51767 Memory leaks ? 89 34388 2019-05-20T12:14:54-00:00

instead of

Does it mean Upp::FileCopy is not working as intended or don't clean is memory allocation properly ?

Thanks for you responses.

Best Regard.]]>
<![CDATA[Memory leaks ?]]> 10682 51767 0 89 34388 2019-05-20T11:49:38-00:00
Today I write a simple piece of code :
	if(argc >0 && Upp::String(argv[0]).Find("@" ) != -1 ){
		Upp::String arg = Upp::String(argv[0])  ;
		arg.Replace("@"," ");
		Upp::String exeToLaunch = arg.Left(arg.Find(";"));
		Upp::String WhereToGet =arg.Right(arg.GetCount()-(arg.Find(";")+1)); //Here I got my both path
			    STARTUPINFO si;
			    ZeroMemory( &si, sizeof(si) );
			    si.cb = sizeof(si);
			    ZeroMemory( &pi, sizeof(pi) );
			    // Start the child process. */
			    std::cout << "process creation ! \n";
				if( CreateProcess(exeToLaunch.ToStd().c_str(),   // No module name (use command line)
							       	NULL,        // Command line
							        NULL,           // Process handle not inheritable
							        NULL,           // Thread handle not inheritable
							        FALSE,          // Set handle inheritance to FALSE
							        0,              // No creation flags
							        NULL,           // Use parent's environment block
							        NULL,           // Use parent's starting directory 
							        &si,            // Pointer to STARTUPINFO structure
							        &pi )           // Pointer to PROCESS_INFORMATION structure
					cout << "succes !" <<"\n";
					cout <<"error"<<"\n";

this code work like a charm but at the end of it I have this thing : https://img.raymond.cc/blog/wp-content/uploads/2009/08/stopped_working_no_WER.png
Seems to be a memory leak but I really don't see from what it come.

After few tests I figured out that it could come from this :

Someone with more experience than me could help ? Very Happy

Thanks in advance

have a good day !
<![CDATA[Re: [Feature request] Gap in line at NaN values]]> 10678 51766 51762 Re: [Feature request] Gap in line at NaN values 93 34444 2019-05-20T08:09:15-00:00 <![CDATA[Re: postgresql mingw]]> 10680 51765 51763 postgresql mingw 24 932 2019-05-20T00:25:17-00:00 So I thought while I am trying to figure out what in the world is going on with PostgreSQL with mingw in U++ I had another idea. Everyone knows that mingw can be used with other frameworks so I tried to fire up libpqxx. Here is my printout:

checking for pkg-config... /mingw64/bin/pkg-config
configure: using PostgreSQL headers at c:/pgsql/include
configure: using PostgreSQL libraries at c:/pgsql/lib
checking c:/pgsql/include/libpq-fe.h usability... yes
checking c:/pgsql/include/libpq-fe.h presence... yes
checking for c:/pgsql/include/libpq-fe.h... yes
checking for ability to compile source files using libpq... yes

So everything was going great until with my bright idea tried to use the version 12 development branch and that is newer than the libpqxx on GitHub.

Well, I need pgsql to work so I will try to compile a different version of postgres with mingw.

I had to do some nifty configuring to get that to work. It (libpqxx configure script) couldn't find libraries or headers so I made one of these files (libpq.pc):

Name: postgresql
Description: DB
Version: 12.0
Libs: -Lc:/pgsql/lib
Cflags: -Ic:/pgsql/include

I hope that helps anyone wanting to get into SWIG with U++ and libpqxx. That way you can use tkinter with python and C++ or just Tk and C++ all with postgres.

I will return at a little later time once I get another version set up and see what I can't figure out about why I couldn't get U++ up and running with postgres on mingw.

Hope you are having a cool weekend. I am on a 3 day weekend. It has been fun.

later - Roboloki]]>
<![CDATA[MATLAB .mat files handling]]> 10681 51764 0 62 648 2019-05-19T18:43:07-00:00 BEMRosetta required to handle MATLAB .mat files.

Then, a great colleague told me that an advantage of python in scientific computing is that they have link to those files just out of the box.

Well, now U++ has that advantage too.

Bazaar/plugin/matio includes a basic and simple to use C++ wrapper to matio library. Matio license is simplified BSD.
Bazaar/Matio_demo includes a demo to handle it.

Scientifics, engineers..., enjoy!

The code is changing fast. If somebody requires more features, just ask.]]>
<![CDATA[postgresql mingw]]> 10680 51763 0 24 932 2019-05-19T05:05:33-00:00
I am fooling around tonight on my 3 day vacation.

I built PostgreSQL with mingw. I built is so it would generate .a and .dll files too.

However, to simplify things I left the path, lib, include all configured like:
C:\Ultimate++\upp\bin/pgsql/x86/bin for instance.

Basically, I said to myself, what is the way that Ultimate++ is right out of the box.
Then I ran the PostgreSQL tutorial code, and I get the error listed in the topic description.
So my question is, why when I didn't change any of the configuration settings to point anywhere else can I not get it to link?
I disabled my paths in environment variables for my mingw that exist outside of the boxed environment for U++.

I have a PostgreSQL server running but can't get it to link anyway. I've been in PostgreSQL and created the schema for the
tutorial test db. I found that when I run conemu from mintty I can use it to run psql.

I tried on static only and shared too. Nothing seems to work.

One final curiosity is that there is a libpq.lib file. I didn't think mingw liked that.

Well, out of the box it doesn't see to run. Not sure why. I am able to run dialogs in the examples, so I know it is
a linker with PostgreSQL problem and not anything to do with the dialogs.

I am running version 13068.

Thanks for any comment.

I am off to get refreshments. Be back to check in on things in a bit.
thnx. Roboloki

<![CDATA[Re: [Feature request] Gap in line at NaN values]]> 10678 51762 51758 [Feature request] Gap in line at NaN values 93 648 2019-05-17T15:40:56-00:00
For now, the Null value is used a as gap in the Scatter series. It summarizes the possible lack of data or the invalid numbers, like NaN and Inf.

What I advise if you take data from a raw source is to filter before saving it, detecting holes or any kind of abnormal situation, and replacing it with Nulls.]]>
<![CDATA[uword table and ctrl+a (bug)]]> 10679 51761 0 52 1784 2019-05-17T11:02:41-00:00
i found a strange behaviour when selecting all (ctrl+a) in the uword editor so that just the top subtable gets selected.

Here an example file:
[ $$0,0#00000000000000000000000000000000:Default]
[ {{10000 [ {{5000:5000 [s0;%% test1]
:: [s0;%% test2]}}]
:: [ {{5000:5000 [s0;%% test3]
:: [s0;%% test4]}}]
:: [ {{5000:5000 [s0;%% test5]
:: [s0;%% test6]}}]}}]]

I could not pinpoint the exact cause of the issue, but it goes as deep as the part (not detecting the initial table properly?)
const RichTxt& txt = GetConstText(anchor);

in the function of the TextData.cpp
int  RichText::AdjustCursor(int anchor, int cursor) const

However, when i add breaklines before and after the main table it works just fine (file like this):
[ $$0,0#00000000000000000000000000000000:Default]
[s0; &]
[ {{10000 [ {{5000:5000 [s0; test1]
:: [s0; test2]}}]
:: [ {{5000:5000 [s0; test3]
:: [s0; test4]}}]
:: [ {{5000:5000 [s0; test5]
:: [s0; test6]}}]}}&]
[s0; ]]


<![CDATA[Re: Is it possible ? ]]> 10677 51760 51757 Is it possible ? 10 34388 2019-05-17T07:08:24-00:00
thanks for your reply.

Under modern OS the processes have virtual address space, separated by from each other

I did not know that.

I will write of simple file. Gonna be easier Embarassed

<![CDATA[Re: Is it possible ? ]]> 10677 51759 51757 Is it possible ? 10 21 2019-05-16T19:19:56-00:00
You can do some IPC (inter process communication) to do it like this, but I'm not sure why.

If you are only interested in version value, I would probably rather include that in some resource file, and use resource reading to read values from your current exe, and from the other exe and compare those, then you don't need to run the other exe at all to figure out if you need update.

Is there some other requirement forcing you to actually put the value into code?

If yes, you can still do this in simple way, supporting in `main` function extra command line option like `--getversion`, which will return version value as exit code (if values 1..255 are enough for you), or you can output it to STDOUT and execute the other exe in such way, that you will collect all STDOUT in first exe, but this is getting somewhat over-complicated.

As you are writing something about text file, it sounds to me like you can add the version value straight into resources (actually if we are talking about Windows .exe files, those already have some kind of meta data - check properties on exe files, there's often various info who's author, version numbers, etc.. = that's all meta data specified in some resource/manifest file, and you can read those somehow also in code, just by reading the .exe file as data, no need to execute it.]]>
<![CDATA[[Feature request] Gap in line at NaN values]]> 10678 51758 0 93 34444 2019-05-16T15:34:09-00:00
Would it be possible for a series (drawn with a Stroke) to have gaps at NaN values?

This would be highly useful for an application I have now, where it has to plot measured timeseries that sometimes have gaps in the measurements.

Alternatively, is there a workaround I could do?

<![CDATA[Is it possible ? ]]> 10677 51757 0 10 34388 2019-05-16T11:55:42-00:00
Today I asked myself a question:

Here is part on code on my "OldVersion.exe"
    const int VERSION = 1; 
    std::string s = std::to_string(VERSION);
    bool needAnUpdate=false;
    s << " " << &needAnUpdate;
    char* cmd =(char*) s.c_str();
    BOOL result = CreateProcess( "C:\\Upp\\upp\\out\\MyApps\\MINGW.Debug.Debug_Full.Noblitz\\newVersion.exe", //New Version const int is 2 
                   cmd, NULL, NULL, // here we past version of current .exe
                   NULL, NULL, NULL, NULL,
	if (result)
			//Then my soft need to update itself.	

As you can see, this old version have const int VERSION = 1.

here is NewVersion.exe :
	const int VERSION =2;
	if(argc > 1){
		Upp::String arg(argv[1]); //transform args to string
		Upp::String version = arg.Left(arg.Find(" ") -1); //here I get version
		pp::String addrBool = arg.Right(arg.GetCount() - arg.Find(" ")); //Here I got adresse of my Boolean at string format
		int versionToTest = std::stoi(version.ToStd());
		if (VERSION > versionToTest){
			// Here I cast my addrBool (string) to bool*  (I dont know how to do it :/ )	
		//Here I end the programme 

with this "methode" I should be able to know if oldVersion is outdated.

But it's possible ? It's a good idea to do those "stranges" things ? Maybe I should just use a textFile holding current version of newVersion.exe ?

Thanks for taking time to read and respond my Strange question.

Best Regard,

<![CDATA[Remove the transparent area around the image (sprite optimization)]]> 10676 51756 0 68 34446 2019-05-16T08:51:06-00:00
I looked at examples of working with images, but have not yet understood which approaches are most effective in terms of performance. Tell me, please, what controls and classes can I use to remove the transparent area around the sprite?

My sprites are stored in PNG files (32 bits, RGBA).
I need:
1. open sprite image from file.
2. calculate the rectangle bounding the opaque area of the sprite.
2. remove the transparent area around.
3. save the result to a PNG file.


p.s. U++ is amazing!Smile]]> 5843 20826 18