VrrtepCLI

Started by Tirea Aean, May 22, 2011, 03:40:58 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Swoka Ikran

#40
Quote from: Kä'eng on May 23, 2011, 04:40:46 PM
It has to be lower case: "__file__", not "__FILE__"
It is, I just typed it in uppercase here for readability...

My lines look like: filename = os.path.join(os.path.dirname(__file__), "naviwords.txt") and give that undefined error when compiled with Py2EXE.

Quote from: Kä'eng on May 23, 2011, 04:40:46 PM
Another possibility is to use sys.argv[0], which should work even in py2exe. That's the path to the main script, not to the current module, but as long as they're all in the same directory there's no difference.
Trying that now...

EDIT: Works even when compiled. :D :D I'll include it in the upcoming version. Irayo for this! :). Let's hope it works on Linux...
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Tirea Aean

I'll test it on linux upon linkage.

Swoka Ikran

Quote from: Tirea Aean on May 23, 2011, 04:57:30 PM
I'll test it on linux upon linkage.
This is a Windows version, but the Python files should work on Linux:

Changes that should be in here (testing needed!):
* Path support. If you install it, you can run it by opening CMD and running vrrtepcli. No more messing with the CD command. :)
* Installation on Windows now requires administrator rights. If you don't have them, you won't get the Path support above, and you'll have to CD "%userprofile%\.vrrtepcli" as you did with the old versions.
* Kä'engä fix for movability. You can use it without installing if you don't mind using CD to switch to wherever you extracted the program.

Both standalone EXE and .py version are included:
http://swokaikran.skxawng.lu/files/vcli_path_movable.zip
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Kä'eng

Quote from: Sir. Haxalot on May 23, 2011, 03:27:10 PM
The best way would ba changing the PATH variable to include the application directory. Or the mory ugly way; putting binaries in C:\Windows\system32
Oh dear god no. It is an utter abomination for an ordinary user-level program to make system-wide changes like modifying C:\Windows. It opens up the door for inexplicable conflicts between different programs (the most common kind, incompatible DLLs, even has a name: "DLL hell"). Even if you're absolutely sure you won't have any adverse effects, e.g. because you're creating a file with a name you "know" is unique, don't do it anyway, because some impressionable young programmers might see it and think it's acceptable.
Ma evi, ke'u ke lu prrte' to fwa sim tuteot ayawne.
Slä txo tuteo fmi 'ivampi ngat ro seng, fu nìfya'o, a 'eykefu ngati vä', tsakem ke lu sìltsan.
Tsaw lu ngeyä tokx! Kawtu ke tsun nìmuiä 'ivampi ngat txo ngal ke new tsakemit.
Ha kempe si nga? Nì'awve, nga plltxe san kehe. Tsakrr, ngal tsatsengti hum!

Swoka Ikran

Quote from: Kä'eng on May 23, 2011, 05:45:26 PM
Oh dear god no. It is an utter abomination for an ordinary user-level program to make system-wide changes like modifying C:\Windows. It opens up the door for inexplicable conflicts between different programs (the most common kind, incompatible DLLs, even has a name: "DLL hell"). Even if you're absolutely sure you won't have any adverse effects, e.g. because you're creating a file with a name you "know" is unique, don't do it anyway, because some impressionable young programmers might see it and think it's acceptable.
I put one file in there: vrrtepcli.cmd, so the system can see vrrtepCLI. That CMD file calls the rest of program, which is still kept in %userprofile%\.vrrtepcli The (even worse) alternative was messing with the system-wide PATH value. There's no per-user PATH on WinXP (not sure about Vista/7)...

Putting the entire application in system32 would be silly for the reasons you mentioned (incompatibility, conflicts, and other such issues)

As for DLL hell...that brings back memories of Win9x. :P
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Tirea Aean

It works. You just forgot to import sys in the scramble module so that sys.argv can be used.

Swoka Ikran

#46
Quote from: Tirea Aean on May 23, 2011, 07:01:24 PM
It works. You just forgot to import sys in the scramble module so that sys.argv can be used.
Oops.  :-[

Will fix and recompile. :)

EDIT: Fixed source and standalone EXE: http://swokaikran.skxawng.lu/files/vcli_path_movable.zip
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Kä'eng

Quote from: Swoka Ikran on May 23, 2011, 06:24:40 PM
I put one file in there: vrrtepcli.cmd, so the system can see vrrtepCLI. That CMD file calls the rest of program, which is still kept in %userprofile%\.vrrtepcli
I see that right now the uninstaller just leaves it there, polluting system32 forever, slightly slowing down everything that needs to look up DLLs from there (you may not think it's a big effect, but imagine if every program you had ever installed did this). And if the file were deleted upon uninstallation, that would be a problem if multiple users had vrrtepCLI installed (once one user uninstalls, the others can no longer use the program).

QuoteThe (even worse) alternative was messing with the system-wide PATH value. There's no per-user PATH on WinXP (not sure about Vista/7)...
You can create one - registry key HKEY_CURRENT_USER\Environment, value PATH. I do this myself for the command-line programs I use the most. Although to make it take effect without rebooting, you have to broadcast a WM_SETTINGCHANGE message.

But honestly I think the best way to make this program "user-friendly" would be to make it so it doesn't have to be started from the command line at all - make it possible to change settings from within the program, don't exit after the first word queried, etc. Command line aficionados such as me can set PATH ourselves. :)
Ma evi, ke'u ke lu prrte' to fwa sim tuteot ayawne.
Slä txo tuteo fmi 'ivampi ngat ro seng, fu nìfya'o, a 'eykefu ngati vä', tsakem ke lu sìltsan.
Tsaw lu ngeyä tokx! Kawtu ke tsun nìmuiä 'ivampi ngat txo ngal ke new tsakemit.
Ha kempe si nga? Nì'awve, nga plltxe san kehe. Tsakrr, ngal tsatsengti hum!

Swoka Ikran

#48
Quote from: Kä'eng on May 23, 2011, 07:27:57 PM
And if the file were deleted upon uninstallation, that would be a problem if multiple users had vrrtepCLI installed (once one user uninstalls, the others can no longer use the program).
The file was left there for exactly this reason.

Quote from: Kä'eng on May 23, 2011, 07:27:57 PM
You can create one - registry key HKEY_CURRENT_USER\Environment, value PATH. I do this myself for the command-line programs I use the most. Although to make it take effect without rebooting, you have to broadcast a WM_SETTINGCHANGE message.
So you CAN do this on XP. :) I always just added my apps to the end of the global path...

Is there a good way to make a batch append registry values? I can do: REG ADD "HKCU\Environment" /v "PATH" /d "%PATH%;%userprofile%\.vrrtepCLI" /f but then the entire global path also gets copied into the user's path...not good. Also, any idea how to do a WM_SETTINGCHANGE from a batch file?

I'm doing this to learn, so if there's a good way to do both of the above in batch, I'm interested. :) Otherwise I'm going to have to write a CLI path updater in Autoit.


EDIT: Did it in Autoit. Works beautifully :) No more files in the system32 folder.

Quote from: Kä'eng on May 23, 2011, 07:27:57 PM
But honestly I think the best way to make this program "user-friendly" would be to make it so it doesn't have to be started from the command line at all - make it possible to change settings from within the program, don't exit after the first word queried, etc.
I agree. TA should add an interactive mode. The program's current mode of operation works wonders when you want to check something quickly (or use the output in another program), but if you want to look up several words...running it several times makes no sense.
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Tirea Aean

actually you can use numbers in the na'vi->local translation direction to dictate how many consecutive times you get prompted OR how many words it will take in the command line and iterate over them. The games ie scramble and quiz loop seemingly forever until quit.

for example, try doing vrrtepcli 50
it will literally prompt you for 50 na'vi words to translate, one by one. The problem is, I can't get this to work in the opposite direction... ie local language -> na'vi

Swoka Ikran

Quote from: Tirea Aean on May 23, 2011, 08:35:38 PM
for example, try doing vrrtepcli 50
it will literally prompt you for 50 na'vi words to translate, one by one. The problem is, I can't get this to work in the opposite direction... ie local language -> na'vi
Doesn't work on Windows. The program runs and gives "Not Found". IIRC, the loop code was in the .SH. The CMD version lacks said code because it's not easily done.

I'll look at re-implementing it...need to research.

Also, quoting myself ;D:
Quote from: Swoka Ikran on May 23, 2011, 08:24:50 PMOtherwise I'm going to have to write a CLI path updater in Autoit.
Just tried this...works fine, and no reboot needed :) Whether I'll include this in place of the System32 file is TBD...
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Tirea Aean

Ahh. of course. I didn't realize you didn't translate that part.

perhaps it might be smart to svn? got  a lot of versions floating around. I've been trying my best to keep organized.

Swoka Ikran

#52
Quote from: Tirea Aean on May 23, 2011, 09:19:22 PM
Ahh. of course. I didn't realize you didn't translate that part.
Working to re-implement it...may be easier than I think. (See edit.) I don't work with batch often anymore, so I forget stuff like this. My main languages now are Autoit and PHP...I'm always up for (re-)learning something though :)

Quote from: Tirea Aean on May 23, 2011, 09:19:22 PM
perhaps it might be smart to svn? got  a lot of versions floating around. I've been trying my best to keep organized.
Let's see: 4 copies in folders on my VM's desktop :o : vcli_win, vcli_win_standalone, vcli_win_nosystem32, vcli_win_pathcli_nosystem32_loop...

I think it'd be a good idea. :) I don't really know how to use it as a dev though (my programs are typically closed-source)...I've only ever downloaded source with it :-\

EDIT: Loop function re-implemented...and it works the other way around! vrrtepcli 4 -l lets you type 4 english words and get Na'vi for them.
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Tirea Aean

really? when I tried to do that, it repeats the same result x times...

Swoka Ikran

#54
Quote from: Tirea Aean on May 23, 2011, 10:06:03 PM
really? when I tried to do that, it repeats the same result x times...
Sran. See below:


And for the record:

Note the bold in the installer output. I also got the new path method Kä'eng suggested working. No more files in system32, and no admin privileges needed to install :D (Now the question is: Does it work on 64-bit OSes?)

Also, I wanted to ask: Would you mind if I put an extra line in the header in the output to credit myself?

Currently it's:
Vrrtep CLI v1.7 by Tirea Aean. run 'vrrtepcli -h' for usage.
Python Version

I was thinking:

Vrrtep CLI v1.7 by Tirea Aean. run 'vrrtepcli -h' for usage.
Windows port by Swoka Ikran
Python Version
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Kemaweyan

Oeru txoa livu, oel fmayu tsat trray, set ke tsun :) Oe lu Linuksìyä saryu ulte oer prrte' livu fwa tsari tsivun oe srung sivi ngar ;)
Nìrangal frapo tsirvun pivlltxe nìNa'vi :D

Seze

Quote from: Tirea Aean on May 23, 2011, 09:19:22 PM
Ahh. of course. I didn't realize you didn't translate that part.

perhaps it might be smart to svn? got  a lot of versions floating around. I've been trying my best to keep organized.

SVN is your friend.  Its my source control system of choice ;)


Learn Na'vi Mobile App - Now Available

Tirea Aean

#57
Quote from: Swoka Ikran

Also, I wanted to ask: Would you mind if I put an extra line in the header in the output to credit myself?

Currently it's:
Vrrtep CLI v1.7 by Tirea Aean. run 'vrrtepcli -h' for usage.
Python Version

I was thinking:

Vrrtep CLI v1.7 by Tirea Aean. run 'vrrtepcli -h' for usage.
Windows port by Swoka Ikran
Python Version


By all means. I actually was just thinking of a way to do that anyway. I credited you on the site where I host the download and in my version of the ChangeLog already as well.

so do you have a final product for a new release?

Ma Kemaweyan zola'u niprrte'. I am soon about to update the whole set. see Post #1 for download site.

Swoka Ikran

Quote from: Tirea Aean on May 23, 2011, 10:41:45 PM
By all means. I actually was just thinking of a way to do that anyway. I credited you on the site where I host the download and in my version of the ChangeLog already as well.

so do you have a final product for a new release?
Coming up in a few minutes. :)
2010 was the year of the Na'vi.Vivar 'ivong Na'vi!


 
Avatray | NWOTD Sigbars | Sacred's Sigbar Tool | My collection of Avatar merchandise

Tirea Aean

I'm on windows now so I think while I'm here on this partition I will take care of the formatting issues on the windows version so the Readme, license and all are readable and not one,two, or three-liners. I hate that.