Friday, July 30, 2010

KrzYoptimizer v1.15-pre #build 15



[Update 1.08.2010, 1:37AM GMT+1]
Adding files in selected directory is now possible. Fixed uncompressed file size detection while reading GZ archive.


[Original]
This time more time passed ;P
I was busy with my rl work - was developing some program to help myself get some phone lines comparison (yea mainly I'm in charge of telephone lines and network connections at work. There are also computers used to sell tickets, but it's new thing that I got almost year ago.)
Anyway let's follow topic, This version mainly speed up Array reogranising when deleting items from list. What does that mean to You anyway? Let's put it simple. In older versions (1.12-) deleting items from list was quite fast, but following version 1.13 it slowed down. You may have noticed me mentioning in previous posts that 2x 2 dimensional arrays were added to prevent work corruption on Item List corruption (like that's going to happen but anyway) and speed up program a bit. You won't probably notice that it's faster bacause nowadays computers are fast enough to GET_ITEM from list almost as fast as from 2-dimensional array. Said so, It's still better to use a variable that belongs to program itself than trusting some other window (yea, listview is a window, button is also a window, every control in windows is a window).This version includes more logic into deleting items from array. Previously I was lazy to program it so it worked like this: You deleted items from list, it wiped data from corresponding array, (it checked if array number is empty and moved data one array up)x repeat number of items deleted. WOW! That's like doing uneccessary work, especially when most users select items by having SHIFT key pressed, not like everyone does CTRL or SHIFT+CTRL selection. New algorithm is based on simple selection range detector. While it deletes items from list it counts how many items were deleted consequently (You select items: 5-10, then it starts counting items from 10th to 5th) and runs function that reorganises array by moving it by number of items selected, up, for every selection range. This picture may show it better:




If You press delete now, programs will start checking all filles if they are selected (from the end of list to the beginning) as it did in previous versions. Note that there are around 15000 items but it works quite fast ;). When it goes up to 14th item it starts counting, so there goes 1 for 14th, 2 for 13th and then program notices 12th is not selected so it lunches array reorganising that moves data by 2 places up again from the end to the beginning of list, 15000=>14998 and so on. Next it continues searching for next selections. There is 11th, 10th and 9th item selected so it counts to 3 and runs array reorganising again. It may be kind of waste to run it everytime on selection range but it's still better than running it on each item, especially that You normally don't select items like on this screenshot. Better would be to (by looking at the example): detect that 14th number is last selected item (since it scans list from end to the beginning anyway) and then just move item 6 to 0, 8 to 1, 12 to 2 and detected the space between 2 and 15 and run array rearranging or something similar. In other words do some small reorganising in small area first then just move everything down by total number of selections. I'll most likely program it later ;)

That's it for this version:

Changelog


Download

Monday, July 26, 2010

KrzYoptimizer v1.14 is out to download

What this version is up to? As stated in post about v1.14-pre, I'm trying to convert a lot of things to direct WinAPI calls. That means creating windows/controls directly by calling Windows' DLL files. This saves some resources and makes program run faster because it will no longer need to read OCX (ActiveX) files that resides in memory and steal your precious system resources.

Controls that are already converted to WinAPI:
- Listview
- Statusbar
- Two progressbars

What needs to be done in order to release msctls:
- convert Options' Tabs
- convert Options' sliders

These two things mentioned will let the application unload (NOT load) msctls OCX and work a bit faster using less memory. I hope to ahieve it in next version ;)




Download


Changelog

Sunday, July 25, 2010

KrzYoptimizer v1.14-pre

Update [15:45pm GMT+1]
- VB status bar converted to msctls_statusbar32. Wow! That even decreased file a bit. Show that VB control are unoptimized...

Update [12:10pm GMT+1]:
- I added Clear list and Delete selected items file submenus (respectivelly CTRL+L and SHIFT+DEL shortcuts). First one clears list. 2nd one deletes selected files simillary to previous DEL on listview. PLEASE NOTE! This is beta stage of deleteting items in list because there is database array that needs to be erased acordingly so PROBLEMS may appear (as far as i Debugged it worked fine). PLEASE TEST IT!

Testers needed! This version has migrated Visual Basic Listview to API call (user32) SysListView32. This features column rearranging, File database multiarray (previously listview was used as a database - malicious users could corrupt data in listview then making program work incorrectly).

There is a con to it for now: you can't delete items from Listview by pressing delete button (I most likely will work it out later ;)

Download

Saturday, July 24, 2010

KrzYoptimizer v1.13.2 finally

This time I'm trying to use API calls instead of built in VB componennts/objects. I managed to get rid of comdlg32.ocx requirement. What does that mean? Less memory, more performance, faster. Sometimes I noticed lag when opening a file when api WAS NOT USED (version 1.12 and less)! This time the dialog opens incredibly fast and also no ocx resides in memory this time. The DLL is called only when needed.

Adding PNG/JPG files was fixed, PK->ExtPK was flagging directories a compressed with maximum compression (shouldn't be, fixed; actually nothing really bad happened, except some few programs reporting directories as errors but they were decompressed successfully) Last file had wrong name after ExtPK->PK conversion, FIXED. New ZIPtoGZ algorithm used in Menu Convert, now also used after optimization. Removed requirement for MSSTDFMT.DLL (accidentally added in v1.12, sry about that).

Download
Changelog

Open Dialog api call I'm using:


Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Public Function BrowseFile$(BF_FILTER$, Optional BF_MULTI& = 0)

Dim iStrip%
Dim lR&
Dim ofn As OPENFILENAME

ofn.lStructSize = Len(ofn)
ofn.hwndOwner = frmZipSlim.hwnd
ofn.hInstance = App.hInstance
ofn.lpstrFilter = BF_FILTER + vbNullChar
ofn.nFilterIndex = 1
ofn.lpstrFile = String$(257, 0)
ofn.nMaxFile = Len(ofn.lpstrFile) - 1
ofn.lpstrFileTitle = ofn.lpstrFile
ofn.nMaxFileTitle = ofn.nMaxFile
If FIRST_TIME_OPEN = 0 Then
ofn.lpstrInitialDir = App.Path
FIRST_TIME_OPEN = 1
End If
ofn.lpstrTitle = "Select File"
ofn.flags = &H80000 Or (&H200 * BF_MULTI)
lR = GetOpenFileName(ofn)
If lR <> 0 Then
iStrip = InStr(1, ofn.lpstrFile, vbNullChar + vbNullChar) - 1
If iStrip = 0 Then iStrip = ofn.nMaxFile
BrowseFile = Left(ofn.lpstrFile, iStrip)
End If
End Function

Wednesday, July 21, 2010

KrzYoptimizer v1.12.2

And yeah! Another 48h passed (Not rly 48h, I think that's 36-40h ;P) and there is another version up! This time some cool Conversions were added support for Extended local headers (!!!).


What does that mean? You can now easly convert first file found in ZIP file to GZ. So if for example ZIP archive contains 10 files and they are in myprograms\ directory and files are 1.exe ... 10.exe then first file found in ZIP data (not always first one when sorted by name), in this example it can be myprograms\1.exe will be converted to GZ as 1.exe - directories are excluded because they shouldn't exist in GZ anyway.
Extended local headers are sometimes used in JAR files (maybe in ZIP too). By default ZIP programs DON'T use them to compress data, because they increase file size by number of files*16 bytes and they store CRC, file size, compressed file size that can be stored as well in File local headers. This time you can easly convert those file by picking ExtPK->PK and vice versa - if you really want your file to contain Extended local headers you can pick PK->ExtPK options.

Quick fix to prevent Settings window from unloading from memory in revision 2.


Changelog
Download

Monday, July 19, 2010

KrzYoptimizer v1.11 is out

You want to REDUCE SIZE of your PNG or JPG files to reduce traffic on your website? Maybe you just want your banners or other images to open faster on slow connections?
This program is for you!



There we go. Another version in no time. Fixes few bugs (one reported by rokko): Cancel in options was crashing program, missing " at the end parsed file to shell command and zipmix not optymizing certain files. More PNGslim options were added along with a small test option that sometimes could provide better results than original PNGslim batch when selected:




Changelog
Download

ShellandWait VB6 used in KrzYoptimizer

Shell and wait used in KrzYoptimizer looks like this (v1.11):


Private Declare Function OpenProcess Lib "Kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long
Private Declare Function GetExitCodeProcess Lib "Kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Function CloseHandle Lib "Kernel32" (ByVal hObject As Long) As Long
Private PROCESS_HANDLE As Long


Public Function shellAndWait(ByVal PROGRAM_NAME As String, Optional ByVal WINDOW_STYLE As VbAppWinStyle = vbNormalFocus, Optional ByVal MAX_WAIT_SECONDS As Long = 0, Optional ByVal DO_I_CHECK As Byte = 0) As Integer

Dim PROCESS_ID As Long
Dim ERRORLEVEL_CODE As Long
Dim TIME_STARTED As Date

Const PROCESS_QUERY_INFORMATION As Long = &H400
Const STILL_ACTIVE As Long = &H103
Const PROCESS_TERMINATE As Long = &H1

' Start the program.
On Error GoTo ShellError
PROCESS_ID = Shell(PROGRAM_NAME, WINDOW_STYLE)
On Error GoTo 0

DoEvents

' Wait for the program to finish.
' Get the process handle.
PROCESS_HANDLE = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_TERMINATE, 0, PROCESS_ID) ' Or PROCESS_TERMINATE
If PROCESS_HANDLE <> 0 Then
TIME_STARTED = Now

Do
GetExitCodeProcess PROCESS_HANDLE, ERRORLEVEL_CODE
DoEvents
Sleep DELAY_ERRORCODE_CHECK
Loop While ERRORLEVEL_CODE = STILL_ACTIVE

CloseHandle PROCESS_HANDLE
PROCESS_ID = 0
shellAndWait = ERRORLEVEL_CODE
ElseIf DO_I_CHECK = 1 Then
Sleep DELAY_ERRORCODE_CHECK
shellAndWait = shellAndWait(PROGRAM_NAME, WINDOW_STYLE, MAX_WAIT_SECONDS, 1)
End If
Exit Function

ShellError:
stbStatus.Panels(1).text = "ERROR: " + PROGRAM_NAME + " won't run!"
End Function

Private Sub Form_QueryUnload(cancel As Integer, unloadmode As Integer)

If PROCESS_HANDLE <> 0 Then
Dim cool As Integer
Do While TerminateProcess(PROCESS_HANDLE, 0&) <> 0
cool = cool + 1
DoEvents
stbStatus.Panels(1).text = "Terminating process... " + CStr(cool)
Loop
End If
End
End Sub




Please note that it's only a part of program code.
There is still MAX_WAIT_SECONDS variable in shellandwait function. It was used to prevent program from getting stuck but it seems like those programs don't get stuck. At least as far as i tested.

This shell and wait is based on GetExitCodeProcess to check if program is still running and just incase allow program to Terminate process if user closes program when BIIIG file is being recompressed. When user interacts with GUI too much (like menu or listview scrolling) and this function is in DO_I_CHECK mode (1) - means that WE NEED error code [variable or if in other sub] - then program will be restarted as long as proper error code is returned.

Sunday, July 18, 2010

KrzYoptimizer v1.10 finally out

You want to REDUCE SIZE of your PNG or JPG files to reduce traffic on your website? Maybe you just want your banners or other images to open faster on slow connections?
This program is for you!


All in one Optimizer for PNG, JPG, JAR, ZIP and GZ files.




Another version of KrzYoptimizer is out! This time a lot of changes were made that should make the program easier to use and have better functionality. Changelog:
- Totally rewritten working on files:
* Now only one file from zip is extracted at a time
* ZIP archive is optimized file per file
* Program can read compressed file size from loaded archive
- Added new icon
- Added Deflate file subitem
- Added ability to process multiple ZIP/JAR/GZ files
- Added ability to mix ZIPfiles with standalone PNG/JPG images
- Added: DELETE key on selected items in list deletes them from list
(good incase you don't want to optimize 0 byte files in zip archive - waste of time)
- Added DiffB (Difference bytes) that shows how many bytes were saved per file
- Added terminating of running Shell process to avoid errors on deleting temporary files
- Removed Save, Save As and Close menu items (they are no longer necessary because
program now bases on listview items and updates files dynamically)
- Deleted Debug Code (will be back later, was unfinished anyway)
- Changed Open ZIP/JAR/GZ file to Add ZIP/JAR/GZ file
- Changed quit message
- Code optimization (filesize greatly reduced)

So now program works mainly on Listview... Almost all data it needs to properly process files is there. In previous versions it was only to show how much of data was processed. Now it's really program's database, since it processes file by file as they would be loaded separatelly. Even every file in ZIP is done separatelly.
What does that mean? You can easly delete files you don't want to process in zipfile at runtime (as long as the file wasn't or is not being optimized) and Deflate Archive is reducing its size everytime a file inside is optimized. Program doesn't require [extraced_archive_size]b of disk space anymore. It extracts one file at a time then deletes it from temp directory when optimization ends.

As there is new feature to delete not yet processed files anytime, 'DELETE' key and multiselect functionality were added to ListView.

This version fixes bug when not all of temporary files were deleted when program was closing. This time it forces all running shell processes to terminate before getting rid of all work data.

You can now load multiple ZIP files and even mix them with JPG/PNG files being outside of archive as long as it's before You press START button.

That's all the features. Program does not yet support resuming function as ZIPslim does (even though a lot of time passed and versions were released already), but it's easy to skip already processed files (as long as You remember which one was last processed) by simply, selecting them on list and then pressing 'DELETE' key (maybe I will add some logfile in next version to help You to find out which file it stopped processing at).

Download:
KrzYoptimizer Version 1.10

Website:
http://freya.neostrada.pl

Thursday, July 15, 2010

KrzYoptimizer v1.09 and v1.10-pre !!!

You want to REDUCE SIZE of your PNG or JPG files to reduce traffic on your website? Maybe you just want your banners or other images to open faster on slow connections?
This program is for you!


All in one Optimizer for PNG, JPG, JAR, ZIP and GZ files.


This version has been up for 2 days but I didn't have enough time to post it here (sorry busy with rl)... Anyway version 1.09 changelog:

- Fixed, blocked Listview editing that could corrupt results
- Added forcing of first block search range (some files don't want to reduce size at
1-16)
- Added some additional checks to loading config file
- Changed Open PNG/JPG files... to Add PNG/JPG files that dynamically adds new files
to already populated list view...
- Clearing list question when adding files to a list that contains already optimized files




STARTING FROM VERSION 1.10 ZIP OPTYMIZATION ALGORITHM IS REWRITTEN A BIT, benefits:
- required space to run optimization reduced from [extracted_archive_size] to [extracted_file_to_optimize_size]
- archive is updated everytime file in list optimization is done
- 'd' key on selected item in list can easly remove file (incase some of them are already optimized and you don't want to waste time on them)
- smaller exe (less code)
- more


Version 1.10-pre changelog:
- Totally rewritten working on files:
* Now only one file from zip is extracted at a time
* ZIP archive is optymized file per file
* Program can read compressed file size from loaded archive
- Added: DELETE key on selected list item deletes file from list
(good incase you don't want to optimize 0 byte files in zip archive - waste of time)
- Added DiffB (Difference bytes) that shows how many bytes were saved per file
- Added terminating of running Shell process to avoid errors on deleting temporary files
- Changed quit message

Download:
Version 1.09
Version 1.10-pre (alpha)

Homepage

Sunday, July 11, 2010

Youtube Surfer ScreenSaver v1.03

Always wanted to have your own Youtube Surfer ScreenSaver?
Try it, it's FREE!

YoutubeSurfer is a ScreenSaver that opens Youtube movie from the address you type in settings. It runs Internet Explorer object to load Youtube webpages.

After successfully playing a movie for the time of 10-60 seconds (whatever you set in settings) it changes video to one of 10 first related videos and so on. It automatically switches to full screen (as long as you type proper X and Y cordinates in settings).

It can be downloaded directly from here or by going to my website: http://freya.neostrada.pl

Just run it and it will install itself into your system directory and open ScreenSaver Personalisation for you to select it from list.


As you can see there is setting for changing video, youtube movie address and to set fullscreen mode automatically by double-clicking video. Everything should be easy to understand beside last option... Well, just observe the dot in square. It shows where the Screen Saver will try to doubleclick to change to full screen. PLEASE SET WITH CARE because you may break something if you set improper cordinates.

Saturday, July 10, 2010

KrzYoptimizer v1.08 and v1.09-pre !!!

You want to REDUCE SIZE of your PNG or JPG files to reduce traffic on your website? Maybe you just want your banners or other images to open faster on slow connections?
This program is for you!

All in one Optimizer for PNG, JPG, JAR, ZIP and GZ files.

One day has passed and another version is out. This time a lot of things were changed/added/fixed. Mainly GUI is a bit different now as you can see on the picture below:



Few crash errors were fixed. You can download and use it and write feedback here as a comment. This will help me a lot. List of changes till now: Changelog. All files can downloaded here.

If you don't want to navigate away from this blog, you can directly download:
- KrzYoptimizer v1.08 as ZIP
- KrzYoptimizer v1.09-pre as EXE

Friday, July 9, 2010

KrzYoptimize v1.07

All programs can be found here

This time it took a while... whew... Not really that much of work needed to be done to take this much of time, but I got somewhat busy with real life (no time to work on it at work - other project at work was priority, even though nobody asked me to do, I did it for myself for easier telephon numbers listing). There were also other projects running there like String2chr or NEW (not yet up) String to 6BH, this one is still in beta stage and works only on text-boxes, not real files although it would be capable to (not yet converting backwards but I already worked out all mathematic here).

Now let's get back to the thing I should be writing about.



What's in this version? Check the pricture, you can notice new List view that looks muuuuuuch nicer than old one. Anyway, list of changes:

- Changed how zipslim works:
* 7-zip now recompresses all files in normal method
* each file is now recompressed with 7-zip (mfb=258, pass=32) before K-zip
- Added ListView Box instead of plain ListBox:
* File - file path+name
* Size - uncompressed or unoptimized/original file size (incase of JPG/PNGslim)
* Compressed - compressed or optimized file size
* Ratio - Compression Ratio (compressed size/original size * 100%)
* S - State: D, P (D - Done, P - Processing
- Added ability to download/update program's CRC file
- Added CRC textboxes and CRC button - click to check if program CRC matches
- Added resize ability
- change to Total progress:
* don't update progress and label when restarting Random Huffman, just fix it to old value
(less computations and not going ahead of operation progress)
- Code organising

All programs can be found here

Monday, July 5, 2010

String2chr and KrzYopti v1.06

I released new tool. It's called String2chr, it converts any text in textbox into chr(number)+chr(number)+<...>+chr(number)... If you write Visual Basic Scripts or program in Visual Basic you may find this tool useful... It's sometimes good to hide text inside vbscript or EXE. YES, You are right, string made by chr()'s is not visible if somebody views your VBscript or EXE! Took me 30 min to script, it allows You to resize or even maximize window by resizing all contols at the same time!

All programs available on http://freya.neostrada.pl


Also KrzYopti v1.06 is out:
v1.06 5-June-2010
- Added 2nd progress bar [Total work] - Total progress per file
- Fixed pngslim crashing program in zip mode (forgot to add txt->variables, sry
about that - too much code =D)
- Added more tooltips
- Code organising

v1.05 rev2 4-June-2010
- Quick fix for jar files (crash on Save)
- Fix for PAUSING (didn't work due to Assume no Aliasing turned on)

v1.05 4-June-2010
- Changed how program checks if file exists - fixes bug when path started with disk drive letter
[again proves that VB6 is stupid]
- Added debug mode (not fully complete yet but working ;)
- Fixed not working pause button
- Fixed bug when PNG is unsupported format - didn't delete backup file
- Added ability to pause work in PNGslim
- Added option to use PNGslim while optimizing zip
- Added Program Executables for PNGslim (and included in Download & Install module)
- Code optimization in Download & Install module
- Fixed bug when file opened was on other drive than program (sorry about that VB6
is stupid sometimes)

Sunday, July 4, 2010

KrzYoptimizer v1.04 revision 2

Again there is another release of KrzYoptimizer. Since last post I added:
- Added PNGslim (alpha):
* works only on external files
* WRITES FILE TO DISK while optimizing
* doesn't fully interact with gui
- Menu
- Now you need to File->Open file
- After optimization you need to File->Save (As) file
- Added Preconfigured modes:
* Fast: Max Blocks Limit = 16, Random = 10
* Medium - 128 and 100
* Extreme - 2048 and 1000
* Custom - confgured in settings.

Some v1.03 screenshot, interface is the same in v1.04.2: