PureLVSORT library : sorting ListIconGadgets (and more)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:I've got another idea: I write this updater.
Good idea :wink:
AND51 wrote:To detect a new update, I must find out, which lib version is currently installed.
Not necessarily. It would be more convenient to avoid using an ini file (I have to modify it and I could forget).
Possible solution : using the file dates.
Can you get the archive filedates on my site ? If yes your installer could store the current archive file date after an update in it's ini file, and check if the archive date on my web site is newer.
AND51 wrote:But I need help: I don't know, where to install the libs.
The installer is a ZIP SFX, so it can be opened with PureZIP for example and the files extracted to %Purebasic% (the subdirs are already in the ZIP) except the File_Id.Diz file used by the installer.
AND51 wrote:If you've got TeamSpeak, gnozal, we can talk about this topic instead of writing.
Sorry, no.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:Hey! This code 100% works on my machine. It manually makes use of PB-network commands. This makes it possible to write an updater also for mac+linux, not only for windows (no API being used).
Connection fails here ... proxy ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Why do all applications fail that want to pass your proxy... :(
I'm sitting behind a router and I've got no problems.

>Possible solution : using the file dates.
>Can you get the archive filedates on my site ?
Yes and no. With the code given above, (using HEAD) I get a response containing "Last-Modified". I don't know, if this date is correct. In my opinion, you cannot trust this information.

>It would be more convenient to avoid using an ini file (I have to modify it and I could forget).
OK, that's a good reason. But as I said, I cannot trust Freenet's last-modified (= last change) date! So it would be nice, if I can use
>the file dates.
Question: When I extract the ZIP files and I use GetFileAttribute(#PB_File_Modified) do I always get the correct date that I can store in my INI?

I've got a better idea and this idea would be 100% safe! When I extract the ZIP SFX and I run it with parameter XY, then you give me the compiler-date via console or ProgramExitCode(). If you use #PB_Compiler_Date, you don't have to write the date into the code manually each time!! What do you think about that?
PB 4.30

Code: Select all

onErrorGoto(?Fred)
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

I downloaded and extracted PureFILE. Right click on the LibInstaller.exe, then Properties.

This dialogue says the following: :shock:
PureFILE-Installer
Created: Today, 23/Nov/2006 20:39:14
Modified: Saturday, 27/May/2006 09:16:00
Last access: Today 23/Nov/2006 20:39:14
So, I recommend you to use the #PB_Compiler_Date function, please! You just have to include #PB_Compiler_Date only once into the LibInstaller-code and you never have to modify it again (so you cannot forget anything).
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:Why do all applications fail that want to pass your proxy... :(
I'm sitting behind a router and I've got no problems.
It's a corporate firewall, very restrictive.
AND51 wrote:>Possible solution : using the file dates.
>Can you get the archive filedates on my site ?
Yes and no. With the code given above, (using HEAD) I get a response containing "Last-Modified". I don't know, if this date is correct. In my opinion, you cannot trust this information.
It seems good to me when I use the freenet web interface.
What "Last-Modified" date do you get for PureCOLOR_.zip ? Correct date is OCT 30th 2006
AND51 wrote:Question: When I extract the ZIP files and I use GetFileAttribute(#PB_File_Modified) do I always get the correct date that I can store in my INI?
When using PureZIP, you can get the file date for each file in the archive.
AND51 wrote:I've got a better idea and this idea would be 100% safe! When I extract the ZIP SFX and I run it with parameter XY, then you give me the compiler-date via console or ProgramExitCode(). If you use #PB_Compiler_Date, you don't have to write the date into the code manually each time!! What do you think about that?
The installer is not compiled, it's simply a SFX stub (pre-compiled) + a ZIP file. No compile date here.
But I could add a creation date in the installer information (File_Id.Diz) in the ZIP, so with parameter XX it would print the date to console.
Or better you could get this information form the File_Id.Diz file in the archive.
AND51 wrote:I have downloaded and extracted PureFILE. Right click on the LibInstaller.exe, then Properties. This dialogue says the following...
This is correct. Yes, the PureFILE installer was created MAY 27th 2006. You see, it works !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

> What "Last-Modified" date do you get for PureCOLOR_.zip ? Correct date is OCT 30th 2006
With HEAD/Last-Modified I get "Mo, 30 OCT 2006 16:28:19 GMT".

I was not sure, if Freenet ALWAYS gives me the right the Last-Moified flag. Moreover, it seemed very unrealistic to me, that you cearted PureFile SFX on 27th May. May???? How should I use this date to compare with newer dates?!

This is the whole response I got with HEAD/PureColor:
HTTP/1.1 200 OK
Date: Fri, 24 Nov 2006 09:08:01 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.26
>Last-Modified: Mon, 30 Oct 2006 16:28:19 GMT
ETag: "25a42e3-26c6a-45462823"
Accept-Ranges: bytes
Content-Length: 158826
Connection: close
Content-Type: application/zip
This is for you, gnozal, so that you can see a server-response at least once in your life :wink:

> But I could add a creation date in the installer information (File_Id.Diz) in the ZIP, so with parameter XX it would print the date to console.
> Or better you could get this information form the File_Id.Diz file in the archive.
No matter to me. With PureZIP, I can handle both methods. But I got an other idea. Using the File_Diz method means to download the whole file :(
Although the files are quite small, I want an upter, that does not download the whole file to see that the current version is already installed. SO, there is only one possibility left: Using the HEAD/Last-Modified Method. :?

I have got a suggestion: When creating the updater, wouldn't it be better, if you rename all ZIP files to their versions? For xample, rename PureCOLOR_.zip to PureCOLOR_394.zip and PureCOLOR_400.zip, so that I can easyly use #PB_Compiler_Version! Oh no... If I compile the EXE with my PB version, the constant would 4.01, which wouldn'zt work with <4.01...

Have you got an idea, gnozal? An other idea would be asking the compiler: RunProgram("PBcompiler.exe /?")
But don't know, how to find out the compiler's path - all these are little problems, I need help for to solve. The things with HTTP, HEAD, GET, download and INI are no problem for me.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:> What "Last-Modified" date do you get for PureCOLOR_.zip ? Correct date is OCT 30th 2006
With HEAD/Last-Modified I get "Mo, 30 OCT 2006 16:28:19 GMT".
So this method works
AND51 wrote:I was not sure, if Freenet ALWAYS gives me the right the Last-Moified flag. Moreover, it seemed very unrealistic to me, that you cearted PureFile SFX on 27th May. May????
Yes, I haven't modified this lib since.
AND51 wrote: How should I use this date to compare with newer dates?!
You would have to download the file
AND51 wrote:SO, there is only one possibility left: Using the HEAD/Last-Modified Method. :?
Yes, that's what I proposed first.
AND51 wrote:I have got a suggestion: When creating the updater, wouldn't it be better, if you rename all ZIP files to their versions?
Well, it's already done : all PB3.94 libs are like PureLIB.ZIP, and all PB4.0x libs are like PureLIB_.ZIP

In conclusion, I propose using the HEAD/Last-Modified method :
1. Get HEAD/Last-Modified for lib
2. Compare with stored LastModifiedDate in IniFile
3. If HEAD/Last-Modified > LastModifiedDate in IniFile, then update the lib and LastModifiedDate = HEAD/Last-Modified.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

> So this method works
OK. I was unsure first, if this method is trustful. But now I will base my updater on this feature.

> Well, it's already done : all PB3.94 libs are like PureLIB.ZIP, and all PB4.0x libs are like PureLIB_.ZIP
I know what you mean. But I suggested you to explicitly append the version after the filename. What, if there is (example) PB 5? Then it would be better to have
PureColor_394.zip
PureColor_400.zip
PureColor_500.zip
You know what I am aiming at?

> If HEAD/Last-Modified > LastModifiedDate in IniFile, then update the lib and LastModifiedDate = HEAD/Last-Modified.
I know, what you mean. I will follow this idea. Now, I have got an additional question. How can I find out which Libs are installed? Or should I create a menu with all Pure* Libs, the user chooses which libs should be observed.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:How can I find out which Libs are installed? Or should I create a menu with all Pure* Libs, the user chooses which libs should be observed.
Look in %Purebasic%\PureLibraries\UserLibraries ?

Or use my magnificent PureLIB Manager :wink:
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

OK. I think, I will just support PB 4.00+. Question: How can I test my program? I assume, you won't give me the passwrd, so that I can edit a file on your webspace to test my program (this is not a trick to get your password / don't give it to me).

On the other hand, you can not change a file every day or several times each day, when I'm testing my program.

Any idea how to solve this?


I cmae to the conclusion, that if I find a newer version,, I will download the SFX, extract it and run it. I wll not hide it or install it automatiically, because many people have more than 1 PB version installled. Moreover, showing the GUI givs the user more control about the applications.

PB 4 gives my application (which will be included to IDE as a tool) some environment variables, such as compiler path, etc. Willl you need some of these varaibles? Just look into your help file.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:OK. I think, I will just support PB 4.00+. Question: How can I test my program? I assume, you won't give me the passwrd, so that I can edit a file on your webspace to test my program (this is not a trick to get your password / don't give it to me).

On the other hand, you can not change a file every day or several times each day, when I'm testing my program.

Any idea how to solve this?
Why change the files on my site ?
If you change your reference date and compare it to the site date you test it as well.
For your information (and to test your program), here are some lib dates on my site :
UserLibs Date on Freenet.de wrote:File Size Date
PureBriefLZ.zip 14167 31.05.05, 6:59:28
PureBriefLZ_.zip 58154 27.05.06, 9:33:30
PureCOLOR.zip 56636 30.10.06, 17:28:18
PureCOLOR_.zip 158826 30.10.06, 17:28:19
PureFILE.zip 41176 17.10.05, 14:19:05
PureFILE_.zip 87103 27.05.06, 9:33:30
PureLPRINT.zip 13081 27.12.04, 7:52:06
PureLPRINT_.zip 65201 28.10.06, 8:42:20
PureLVSORT.zip 52014 21.11.06, 16:42:58
PureLVSORT_.zip 150520 21.11.06, 16:42:59
PurePOP3.zip 28845 15.08.06, 13:54:50
PurePOP3_.zip 89306 15.08.06, 13:54:50
PureRESIZE.zip 19738 26.01.06, 9:58:08
PureRESIZE_.zip 78607 19.10.06, 11:35:37
PureSMTP.zip 21596 14.11.05, 12:14:46
PureSMTP_.zip 79094 25.11.06, 9:09:46
PureValid.zip 15964 28.10.04, 8:27:03
PureValid_.zip 63332 07.06.06, 15:30:29
PureZIP.zip 134280 21.11.06, 11:18:10
PureZIP_.zip 247112 21.11.06, 11:18:10
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Q*bert
User
User
Posts: 27
Joined: Sat Dec 30, 2006 12:17 am
Location: Milwaukee, WI USA

Post by Q*bert »

gnozal, Thanks for another great library and your patience with beggars like me. :D

I have a need for the filter functions of PureLVSort. It works well, but it confuses users when they can set one column filter, then also set another that doesn't clear or respect the first one they set.

Ideally, I would like to be able to set, retrieve, and clear each column's visible filter string.

Functions like:
PureLVSORT_GetFilterString(GadgetNumber.l, ListIconColumn.l)
PureLVSORT_SetFilterString(GadgetNumber.l, FilterString.s, ListIconColumn.l)
PureLVSORT_ClearFilterString(GadgetNumber.l, ListIconColumn.l)
would be perfect.

Do you think these might be of enough interest to others that they might be added?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update

Changes :
- new function PureLVSORT_GetFilterString()
- new function PureLVSORT_SetFilterString() [to clear the filter string use ""]
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Q*bert
User
User
Posts: 27
Joined: Sat Dec 30, 2006 12:17 am
Location: Milwaukee, WI USA

Post by Q*bert »

Thanks alot for get and set filter procedures as I can do some really great things with them.

One cosmetic problem though. When I clear a filter using set filter with "", the "Enter text here" message doesn't display any more.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Q*bert wrote:One cosmetic problem though. When I clear a filter using set filter with "", the "Enter text here" message doesn't display any more.
Should be fixed.
Please download again.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply