Recent

Author Topic: Online Package Manager  (Read 842494 times)

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: Online Package Manager
« Reply #390 on: December 04, 2016, 03:11:20 pm »
Hi, here it is the updated spanish translation for the external json editor.

Maybe we must upload it in a revision control? I have both accounts in sourceforge and github, we have also the new Lazarus CCR in GitHub, we can upload the first code in there.

minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Online Package Manager
« Reply #391 on: December 04, 2016, 03:28:22 pm »
Hi, here it is the updated spanish translation for the external json editor.

Maybe we must upload it in a revision control? I have both accounts in sourceforge and github, we have also the new Lazarus CCR in GitHub, we can upload the first code in there.
Thanks for the translation.  I have access to the SVN ccr repository (which I use for other components), so if I commit to there, the GitHub will mirror it OK?
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: Online Package Manager
« Reply #392 on: December 04, 2016, 03:42:35 pm »
Hi, here it is the updated spanish translation for the external json editor.

Maybe we must upload it in a revision control? I have both accounts in sourceforge and github, we have also the new Lazarus CCR in GitHub, we can upload the first code in there.
Thanks for the translation.  I have access to the SVN ccr repository (which I use for other components), so if I commit to there, the GitHub will mirror it OK?

If you can upload it in the SVN ccr is a good place. About the github mirror, I don't have a server to create the automatic mirroring, so is not available. But don't worry about that. The idea is that the source don't get lost :)

balazsszekely

  • Guest
Re: Online Package Manager
« Reply #393 on: December 04, 2016, 03:58:57 pm »
@minesadorada
1. Try to feed invalid JSONs to your application, then make sure the exceptions are handled properly(see attachment for invalid JSON). This is crucial for me(OPM), since the update process will run in a worker thread. Unhandled exceptions are not desired. I'm gonna use the same code base(more or less...I don't need the GUI part).
2. I noticed that you allow multiple lpk's with the same name. All package names must be unique.
Can you please fix this issues?

+1 for the revision conrol.

PS: I may add one or more fields in the future(objects to JSON), hope this is not a problem.
« Last Edit: December 04, 2016, 04:00:32 pm by GetMem »

minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Online Package Manager
« Reply #394 on: December 04, 2016, 04:15:48 pm »
@GetMem.  OK  - will do (not today, because its the UK Snooker Final, though I will get a gap in the mid-session interval) :)

Committed to CCR as V0.1.8.0
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

balazsszekely

  • Guest
Re: Online Package Manager
« Reply #395 on: December 04, 2016, 05:03:40 pm »
@minesadorada
Take your time, it's not urgent.

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: Online Package Manager
« Reply #396 on: December 04, 2016, 05:22:42 pm »
Well it's really simple to add the exception. You can do the same as SaveToFile(): boolean, change LoadFromFile to a function with a boolean.

I suggest to remove the ShowMessage from the exception code, and move it to the else part of the SaveToFile, so it looks like

if SaveToFile() then
  ShowMessage('ok')
else
  ShowMessage('not ok');

And with the Load the same.

if LoadFromFile() then
begin
 // Put everything in the controls
end
else
  // do nothing, just show an error message.

And the exception with no code will be usable by GetMem. But he must add a LoadFromURL or something like that.

minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Online Package Manager
« Reply #397 on: December 04, 2016, 06:51:07 pm »
All good suggestions lainz.

0.1.11.0 committed to ccr svn (https://svn.code.sf.net/p/lazarus-ccr/svn/applications/json_packager)
- Changes as suggested by lainz
- Error-check for duplicate .lpk entries implemented as requested

@GetMem - if you add any fields, can you specify any relevant error checks with them please?
« Last Edit: December 04, 2016, 07:35:05 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: Online Package Manager
« Reply #398 on: December 04, 2016, 09:57:05 pm »
Thanks for implementing the suggestions. I already implemented them when I wrote the message, but by some unknown reason I get the spanish translation broken, something about ANSI? And then every special character inside was broken. So I better let you made the changes, I don't know if was a problem with lazarus or with the po editor.

balazsszekely

  • Guest
Re: Online Package Manager
« Reply #399 on: December 05, 2016, 07:54:14 am »
@minesadorada
Quote
if you add any fields, can you specify any relevant error checks with them please?
You don't have to do any further error checks, it will work fine with the code suggested by @lainz, however please rename DownloadURL to DownloadZipURL(or something similar). I already have a DownloadURL, which now points to the "external JSON". To prevent confusion we should give a different, unique name.

PS: Today/tomorrow the update feature will be ready.
PS1: I also renamed a few class since I already have similar names. Please download the zip, and replace your main form. Other then a few names is the same unit.


« Last Edit: December 05, 2016, 09:39:09 am by GetMem »

minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Online Package Manager
« Reply #400 on: December 05, 2016, 09:58:31 am »
@minesadorada
Quote
if you add any fields, can you specify any relevant error checks with them please?
You don't have to do any further error checks, it will work fine with the code suggested by @lainz, however please rename DownloadURL to DownloadZipURL(or something similar). I already have a DownloadURL, which now points to the "external JSON". To prevent confusion we should give a different, unique name.

PS: Today/tomorrow the update feature will be ready.
PS1: I also renamed a few class since I already have similar names. Please download the zip, and replace your main form. Other then a few names is the same unit.



A global rename from DownloadURL -> DownloadZipURL seemed to do the trick.

- To V0.1.12.0 in svn ccr
- Updated .po files
- InnoSetup install updated

Updated test update: https://sourceforge.net/projects/lazautoupdate/files/otherpackages/update_cryptini.json to new fieldname
« Last Edit: December 05, 2016, 10:07:45 am by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

balazsszekely

  • Guest
Re: Online Package Manager
« Reply #401 on: December 05, 2016, 10:25:00 am »
@minesadorada

Apparently you missed PS1 from my previous post. I attach the zip again, since I changed something. Your project also have a memory leak somewhere:
Project Options-->Debugging-->Use HeapTrc unit.

Thank you!


minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Online Package Manager
« Reply #402 on: December 05, 2016, 11:01:46 am »
Hi Getmem,
Thank you for the review.
Have you got write access to the ccr svn?  I missed your attached zip because I assumed dev was now under version control lock/checkouts from the svn.

After a quick look,I see only 2 changes - can you confirm?
1- Commenting out in form.create
Code: Pascal  [Select][+][-]
  1. {  Self.AutoAdjustLayout(lapAutoAdjustForDPI, Self.DesignTimeDPI,
  2.     Screen.PixelsPerInch, Self.Width, ScaleX(Self.Width, Self.DesignTimeDPI));}
2- Changing fieldname from DownloadURL -> DownloadZipURL
If they are the only 2 changes, I can update the svn version with (1) easily enough.  It's a good idea to add to the Version History section in umain with any changes.

Re:Memory leak
It seems to come from this recursive procedure within Form.Create (which I'd like to keep)
Code: Pascal  [Select][+][-]
  1.  
  2. procedure TfrmMain.FormCreate(Sender: TObject);
  3. var
  4.   sLang, INIFilePath: string;
  5.  
  6.   procedure CreateUniqueINI(aCount: integer);
  7.   // Recursively loop until correct INI found, or new one created
  8.   begin
  9.     INIFilePath := GetAppConfigFile(False) + IntToStr(aCount);
  10.     CFG := TIniFile.Create(INIFilePath);
  11.     if CFG.ReadString('Options', 'AppPath', ProgramDirectory) <> ProgramDirectory then
  12.     begin
  13.       CFG.Free; // Ditch the old one
  14.       Inc(aCount);
  15.       CreateUniqueINI(aCount); // Make a new one
  16.     end;
  17.   end;
  18. //... more code
  19.  
Any suggestions to solve it? CFG is a private form member.

I'll hold fire until I see your thoughts.
« Last Edit: December 05, 2016, 11:17:23 am by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

balazsszekely

  • Guest
Re: Online Package Manager
« Reply #403 on: December 05, 2016, 11:17:33 am »
Quote
After a quick look,I see only 2 changes - can you confirm?
   TPackageFiles --> TUpdatePackageFiles
   TPackageData --> TUpdatePackageData
  etc...
I only changed names, since I already have TPackageFiles in OPM and it's very confusing. Compare the two files with WinMerge or whatever tool you use for comparing. SVN clients already have built in tools for that.

Quote
Have you got write access to the ccr svn?  I missed your attached zip because I assumed dev was now on lock/checkouts from the svn.
No.

Quote
It seems to come from this recursive procedure within Form.Create (which I'd like to keep)
I did not have time to check it, since I'm busy with OPM. I wil take a look later.
       

minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Online Package Manager
« Reply #404 on: December 05, 2016, 12:06:55 pm »
To:  0.1.13.0: Renamed TPackageData ->  TUpdatePackageData (GetMem)
            Renamed TPackageFiles -> TUpdatePackageFiles (GetMem)
            Comment out Self.AutoAdjustLayout line in Form.Create (GetMem)
            Removed StrUtils from uses (minesadorada)
            Fixed memory leaks with CFG and slErrorList (minesadorada)
            Moved inline procedure CreateUniqueINI to separate function (minesadorada)
            Added Const C_DEBUGMESSAGES=TRUE/FALSE (minesadorada)

Memory leaks were weird.  I had to manually free 2 form members (a TiniFile and TStringList) in the QueryClose method to fix them.  I'd assumed all owned TForm objects were automatically freed on exit. (Laz1.7/fpc3.1.1)
« Last Edit: December 05, 2016, 12:38:49 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

 

TinyPortal © 2005-2018