avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • January 17, 2018, 12:13 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - vixay [ switch to compact view ]

Pages: [1] 2 3 4 5 6next
Thank you, vixay,

Looks complicated. Hmmm, where could I find this python script?

Many thanks again


You could replace the commands to add the file to zip in the python script (see below) with your own python commands to create the file in the destination folder?
Replace these lines
zfAddNullFile(zf, f, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec))

zfAddNullFile(zf, dp, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec), 16)
with where you prepend your destination to both f & dp. e.g. f = target + f
open(f, "a").close()
Though you would have to google on setting the timestamps accurately. see here   and here

or use zerozipper by skwire and choose your temp directory to be the destination where you want the structure, but to prevent deletion you would have to ask skwire for the changes or the code

Hello Mouser!

 I still use AHK daily! I'm even thinking of setting up a good phrase expander that the entire team can use ( with hints and prompts, because basically people forget it exists, like keyrocket).

Anyway it's good to see that you are still active! I guess mouser's predication of micropayments came true, now it's available everywhere and people use it on a daily basis!

I love the dc community especially the great helpful people here. I still use many tools and it's my goto site for some coding snacks.

Live  life and enjoy!

This is the first time I'm reading about mouser's motivations so it's heartening to see you follow the dream! Live the idea brother!

Anyway if you are ever travelling abroad in asia, look me up and we should meet.

Look's great. I wonder what should be the minimum starting age? 5 is good enough, how about 10?

the only addition that I can think of would be to set the images to close after a given period
-pilgrim-online (June 16, 2011, 04:24 AM)

This functionality would be very easy to add.

skwire, what did you use to write frameless?

It's written in AHK and it's really not much more than simply reading in the command-line parameters and creating a very simple GUI using a standard picture control.

I see, that's what I'd guessed. btw, are you not sharing your source code on the website? Somehow I thought that handling pictures was a lot more complicated than that, because of various formats and types ...etc. you make it look easy though! So why do all they image viewers cost a bunch and stuff?
I guess that would be because or writing native decoding algorithms versus using libraries.
Still good job on this.

In a previous thread I started on this forum it was pointed out to me that what I was trying to do at that time was already available in the OS but if it had not been pointed out to me, like now, I would probably never have found it. :-[
Always did prefer mechanical things, at least you can take them apart and see how they work.
-pilgrim-online (June 18, 2011, 07:04 AM)

It's the same with computers it's just it follows a different set of rules, and the basics are the code, which can be hidden. I guess you need training with it just like you need some basic understand of physics (which can be intuitive) to deal with mechanical things.

General Software Discussion / Re: Fold
« on: June 20, 2011, 01:11 AM »
File managers with quad windows may be a solution but I haven't found a free one that seemed stable and predictable.
Have you tried Q-Dir ? It's free and seems to work well.

oh see this http://www.donationc....msg162996#msg162996
I forgot that it had gone payware later. Anyway I am glad it worked out for you.

skwire, what did you use to write frameless? I don't see any source in the bundle or link on the website, I'd thought you'd done it in AHK and was curious to look at the code.

Living Room / Re: Wiki software with authentication
« on: June 16, 2011, 03:18 AM »
compare at

further i use dekiwiki the free version ( with ldap authentication.
You can have permissions and restrict pages ...etc.

how about maxview by faststone? You'll have to see the documentation for the commandline parameters

Also for scripts, if you are using win7 and up, I'd recommend use powershell. If this is only for your computer you could also use other scripting languages by installing their runtime, python, ruby ...etc, they would be overkill but would work well and expand even better. This is if you know programming languages already.

skwire would recommend ahk as well as that is what he used to create the app. 

as for examples, first link on google is this which looks good.

Living Room / Re: I'm Confused
« on: February 01, 2011, 11:14 PM »
Imagine a Microsoft car! Takes 15 minutes to start  :Thmbsup:

Then again, I'd rather have that than the Apple car, where you can only fill up at Apple gas stations...

Hahahah~! :D

I suppose gas for Linux cars is free, but you need to refine it yourself...

And allow anybody else who wanted to use it to do so.  :P

No, anyone who wanted to clone it to do so :), you get to keep your copy. And if you come up with a wicked new navigation or nitro system, you have to share its specs so others can clone it :)

Living Room / Re: I have a very hard announcement to make
« on: October 14, 2010, 06:55 AM »
First, what you have accomplished can be seen as an example for many young people here. It is more than what many have done.

I don't often think about how some members are so older than me here. When reading posts I automatically assume they are around my age... bizarre huh? Or maybe I just follow the logic of the post and not try to reconstruct a real person behind those thoughts as you would do face to face.

I don't know why you'd say that you are not where you need to be as a programmer as your applications have clearly shown that you possess enough to solve various computer problems. But then your goals might have been a lot bigger, and that is what I want to know. Since I hardly have any goals of mine, I like to spy on other people's goals ! :)
What level would you need to get a permanent employment near where you leave? Do you have an objective way to measure that?

so Archivarius + Total Commander + File System for Tranglos

I find myself in a similar boat, I end up mostly using the file system, naming conventions and a search engine. I was hoping to get a package that would force good habits and be an all in one package, and for something that would be portable, as I do still using windows. Does arvhivarius show formatted code?

I need some advise/tips on organizing one's source code. Since so many of you are developers here I wanted to know how you guys manage your code as well. (A code library with low overhead I guess).
I am taking this step now, as I am switching my main pc to ubuntu and wanted to reorganize my professional and personal life in terms of documents on there.

There are several key concepts that I use to think about the problem so please understand those first.

high maintainence - high feature set (versioning, quick search and indexing, rapid updates and deployment, secure offsite backups, notes/documentation)

low maintainence - low feature set (versioning, throwaway scripts, testing)

Features I wanted for my solution:

- version control (git? or something with multiple project support)
- quick search within contents (???)
- backup (dropbox? mozy? rsync? simple-backup?)
- browseable, ie. must be organized/tagged. Is there a good tagging architecture?
- maintain documentation for all scripts/programs as well (PAD? wiki? txt files with a program? dokuwiki?)

So what do you guys do? and any ideas?

/edit: other discussions similar to this (nothing exactly like this though)

Living Room / Re: How to manage large clipart collections?
« on: August 15, 2010, 11:25 PM »
I had a similar problem but not as extensive as yours. Since this was a work related issue, i assigned one graphic designer to create thumbnails in PNG for all AI files (in retrospect should have chosen jpeg for the metadata, don't know if png has a widely supported metadata structure). Then I used Gallery Server Pro to read the folder structure and serve it on a different pc. So now the collection is accessible via the network, easily searchable, and easy to add to as well. It actually takes care of a lot of these problems.
I also tried to use imagemagick to convert ai files automatically, but for that to work, the AI needs to be saved with the PDF option enabled, else it won't work. I am sure it can convert the .eps files directly though. So this might be a start.

I have a similar requirement, but it needs to be cross-platform. I've looked at jabber, but haven't found a decent cross-platform client yet. It's a mess to try and use them. Do you know of any program that doesn't require user registration/passwords ...etc. Just use the hostname?

Found Deals and Discounts / Re: Take Command Console LE from JPSoft
« on: August 06, 2010, 07:54 AM »
I just heard about another free console enhancer:  Console
Pretty unstable, though - and it's relatively laggy as well, unless you bump down the update timeout and burn CPU cycles. And has problems with some "fullscreen console apps" (like hexit and hiew).
It's stable enough here.  I have tabs configured to run CMD.EXE, Windows Powershell, TCC LE, Cygwin bash, and MinGW zsh.  I can also run things like Eric Meyer's VDE editor and Necromancer's DOS Navigator.  I had problems with alpha-blending and transparency, and simply turned that off.  Transparency is eye-candy I don't need in daily use.

And I load Kris Sweger's ANSIPlus in CONFIG.NT for ANSI support in DOS apps, and Jason Hood's ANSICON in CMD.EXE/TCC LE sessions for ANSI support there.  It all works fine in Console 2 tabs.  I haven't found a need to diddle the update settings.

Console 2 doesn't do full screen, but I wouldn't want to.  I have a 19" monitor in 1600x1200 resolution, and prefer everything in a window.

That sounds awesome... I had just discovered TCC LE today and set it up in console 2 and while I was at it, i added powershell, and thought that I should probably add bash/cygwin or msys to it (though portable versions of it) and i soon got lost on researching those solutions rather than getting it done. So I would be very happy if you could tell me how you have set it up, and if your setup is portable.  (posting your console.xml would be cool as well)

And just FYI, TCC le wouldn't work with console 2 for me, until i updated it to the latest version 146 (had 144 earlier).

 :Thmbsup: :Thmbsup: for console2 from me as well.

sorry, my bad. I assumed the screenshot was excel. No as far as i know it shouldn't  work in openoffice, but hmm that gives me an opportunity to try macros in open office :)
As for stand alone... I don't have enough time for that, though I do have one flash application lying about which did something similar. I'll see if i can find it.

since you are already using excel... here's a simple module for it, i've tested it and it works well enough.

just put your active cell within your table and run the macro StartRandomizer()

'Module by Vixay for DonationCoder
Option Explicit
'API for windows sleep
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub StartRandomizer()
'Moves a shape along the cells, and changes color of the final cell
' No exclusivity for now
'30 ms = fast
'100 ms = slow
'150 ms = stop
Dim shpActive As Shape
Dim rCell As Range
Dim lSpeed As Long
Dim lSpeedMax As Long
Dim lWinner As Long
Dim lCount As Long

lSpeed = 30
lSpeedMax = 150
lWinner = SelectWinner()
Debug.Print "to be winner:" & lWinner
'get the shape we will use ( must exist or will cause an error )
If ActiveSheet.Shapes.Count > 1 Then
    Set shpActive = ActiveSheet.Shapes(1)
    Set shpActive = ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle, 10, 10, 10, 10)
    shpActive.Fill.Transparency = 0.8
End If

For lSpeed = 30 To lSpeedMax Step 20
    lCount = 0
    For Each rCell In ListArea.Cells
        lCount = lCount + 1
        AlignShapeTo shpActive, rCell
        'Debug.Print rCell.Address
        'Application.ScreenUpdating = True
        Sleep lSpeed
        'slow down speed randomly with a low probability
        ' i.e. continue through all cells most of the time at the current speed
        ' except no random slowdowns on the last stage
        If Rnd >= 0.95 And lSpeed < 130 Then
        'can tweak the number here to change how often we randomly switch speeds
            lSpeed = lSpeed + 20
            Debug.Print "random speed slowdown:" & lSpeed
        End If
        'if at winner cell, and at final slowdown stage
        If lSpeed >= lSpeedMax And lCount = lWinner Then
            Debug.Print "Found our winner"
            rCell.Interior.Color = vbRed
            Exit For 'stop here
        End If
        'Debug.Print lSpeed
    Next rCell
    Debug.Print "next slowdown:" & lSpeed
Next lSpeed

End Sub

Sub AlignShapeTo(ByRef shpObj As Shape, rCell As Range)
shpObj.Top = rCell.Top
shpObj.Left = rCell.Left
shpObj.Height = rCell.Height
shpObj.Width = rCell.Width
End Sub

Function ListArea() As Range
'Change this function to suit your needs or just make sure your
' active cell is within your table range
Set ListArea = ActiveCell.CurrentRegion
'Set ListArea = Selection
End Function

Function SelectWinner() As Long
'Randomly choose a cell amongst all the cells
Dim lCellCount As Long
lCellCount = ListArea.Count
SelectWinner = Rnd * lCellCount + 1
Debug.Print SelectWinner & " / " & lCellCount
End Function

Sub ClearBackgrounds()
ActiveCell.CurrentRegion.Interior.ColorIndex = xlColorIndexNone
End Sub

Let me know what you think.
Should be easy for you to customize colors and all.


Log Monitor
I've used it in the past to watch directories. seems to work well enough.

Alright fellas,

2 hours spent trying to fix the script and here are the results for the python script!
08:25:33 PM
08:25:46 PM
a grand total of 13 seconds!!!

Zipfile about 12 MB. with 54827 files (created a few files since last count)

Things I had to fix:
 modified time errors
 path length exceeded errors

 #set time to unix epoch 0 = 'Thu Jan 01 07:00:00 1970'
so there will be some files with incorrect timestamps in the zipfile

I hope this helps everyone... though I still got some warnings while running the script... probably due to windows handling of files and or paths... DeprecationWarning: struct integer overflow masking is deprecated
  zf.fp.write(zinfo.FileHeader()) DeprecationWarning: 'H' format requires 0 <= number <= 65535
  zf.fp.write(zinfo.FileHeader()) DeprecationWarning: struct integer overflow masking is deprecated
  zf.close() DeprecationWarning: 'H' format requires 0 <= number <= 65535

Here's the final code so far
Code: Python [Select]
  1. #!/usr/bin/python
  2. import os, sys, zipfile, optparse, zlib, fnmatch, time
  4. optp=optparse.OptionParser(usage="%prog [options] <target-zip> <source-dir> [<source-dir...>]")
  5. optp.add_option("-x", help="exclude mask", action="append", dest="exclude", default=[])
  6. optp.add_option("-q", help="be quiet", action="store_true", dest="quiet", default=False)
  7. optp.add_option("-e", help="omit empty directories", action="store_true", dest="omit_empty", default=False)
  8. err=optp.error
  10. options, args = optp.parse_args()
  12. if len(args)<2:
  13.   optp.print_usage()
  14.   sys.exit(1)
  16. zf=zipfile.ZipFile(args[0], "w")
  18. def zfAddNullFile(zf, arcname, date_time, extattr=0):
  19.   """ Adapted from the method in zipfile """
  20.   arcname = os.path.normpath(os.path.splitdrive(arcname)[1])
  21.   arcname = arcname.lstrip(os.sep + (os.altsep or ""))
  22.   zinfo = zipfile.ZipInfo(arcname, date_time)
  23.   zinfo.external_attr = extattr
  24.   zinfo.compress_type = zf.compression
  25.   zinfo.file_size = 0
  26.   zinfo.flag_bits = 0x00
  27.   zinfo.header_offset = zf.fp.tell()    # Start of header bytes
  28.   zf._writecheck(zinfo)
  29.   zf._didModify = True
  30.   zinfo.CRC = CRC = zlib.crc32("")
  31.   zinfo.compress_size = 0
  32.   zinfo.file_size = 0
  33.   zf.fp.write(zinfo.FileHeader())
  34.   zf.filelist.append(zinfo)
  35.   zf.NameToInfo[zinfo.filename] = zinfo
  37. def printFilename(f, msg=None):
  38.   if not options.quiet:
  39.     if msg:
  40.       print msg,
  42.     try:
  43.       print f
  44.     except:
  45.       print f.encode("charmap", "replace")
  47. for sourceDir in args[1:]:
  48.   try:
  49.     sourceDir=sourceDir.decode("latin-1")
  50.   except:
  51.     print sourceDir
  52.     print "Exception while trying to process directory"
  53.   for dp, dn, fn in os.walk(sourceDir):
  54.     if fn:
  55.       for f in fn:
  56.         f=os.path.join(dp, f)
  57.         ok=True
  58.         for xmask in options.exclude:
  59.           if fnmatch.fnmatch(f, xmask):
  60.             ok=False
  61.             break
  62.         if ok:
  63.           try:
  64.             mtime=time.localtime(os.stat(f).st_mtime)
  65.           except ValueError:
  66.             print "Error: Modified time out of range."
  67.             printFilename(f)
  68.             print os.stat(f).st_mtime
  69.             mtime=time.localtime(0) #set time to unix epoch 0 = 'Thu Jan 01 07:00:00 1970'
  70.           except WindowsError:
  71.             print "Error: Can't find file due to windows limitations."
  72.             printFilename(f)
  73.             mtime=time.localtime(0) #set time to unix epoch 0 = 'Thu Jan 01 07:00:00 1970'
  75.           zfAddNullFile(zf, f, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec))
  76.     elif not options.omit_empty:
  77.       mtime=time.localtime(os.stat(dp).st_mtime)
  78.       #printFilename(dp, "(empty directory)")
  79.       zfAddNullFile(zf, dp, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec), 16)
  81. zf.close()
  82. print "All Done."

I hope you all enjoy this. I'll attach the exe as well, though I can't make any guarantees for it.

Ok I needed to use the utility again and decided to do the speed comparison.

I ran it on A folder with
67.8 GB (72,906,108,928 bytes)
54,824 Files, 5,364 Folders

Here's ZeroZipper
Start - 06:29:44 PM
End - 06:36:41 PM
It took 7 minutes!! Out of which 5 minutes was spent just recreating the 0-byte structure! 1 minute to delete files and <1 to create the zip.
So this method is definitely not good for large folders.
And I think I found a bug. For the zip I didn't put a path just a name "", the zip was created in the temp correctly but then it didn't move it to the same location as the zerozipper... it was strange... and the zip was then deleted! so I didn't get any output after waiting for so long!

I then had high hopes for the python version, as it would avoid the slow Disk I/O. So
 i finally used the py2exe and converted the code to an exe and tried that (rather than the script just to make a fair comparison).
It died again on unicode filenames :(. I did use the new version too this time!
Traceback (most recent call last):
  File "", line 61, in <module>
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'J:\\Share\\Categorized Appz\\Compression Utilities\\Just Extractor\\??-readme.txt'

Can someone help with this problem? It seems like the filenames which contain unrecognizable characters are converted to ?? and then we we use them again it crashes... how do we retain the filenames in the original format? regardless of whether it contains Legible/illegible unicode?

After this i tried running the script directly and it seemed to work but then
I encountered another mysterious error
Traceback (most recent call last):
  File "", line 63, in <module>
ValueError: (22, 'Invalid argument')

I tried debugging this the value for st_mtime was 1189361328.0 i converted that using time.localtime() and it worked, so i can't figure out exactly what is causing this error.

Actually the file in question have a modified date of
Tuesday, September 25, 3427, 10:40:30 PM
so i can see how python would choke on that. how can i resolve this issue?

Living Room / Re: Desktop Icons
« on: March 08, 2010, 11:55 PM »
some autohotkey code i use for this functionality
;function to return toggled values
;first call returns true
toggle() {
 static t
 t := !t
 Return, t
  ;relies on having DetectHiddenWindows OFF
  if toggle()
    WinShow,Program Manager
    WinHide,Program Manager

#`::EnableDisableDesktopIcons() ;;Enable/disable desktop icons (shortcut key Win+`)

Doesn't work with fences installed though, but you can then use fences, ESC key to toggle it.

General Software Discussion / Re: virtual display utility
« on: March 08, 2010, 11:48 PM »
How about setting a resolution higher than what is allowed?

Sometimes this is what happens: You see only a part of the screen (i.e. your native resolution) but if you move your mouse in any direction, the screen scrolls and shows that part... and voila your screen acts like a window for a larger screen!

This is happened to me when playing games ...etc and the switch back to the desktop was not made correctly, i don't know if it's possible to induce this behavior!

Living Room / Re: Blog Essay: In Praise of Online Obscurity
« on: March 08, 2010, 11:02 PM »

The theoretical hard limit on how many social connections we can actively maintain.

About 150.

The discussion reminded me about this.

Pages: [1] 2 3 4 5 6next