Tuesday, August 24, 2021

Converting animated GIF to animated BPG

 The batch file below converts animated GIF to animated BPG. The main point to note is that when extracting frames from the animated GIF, transparency must be removed and the frames must have the same color type, otherwise BpgEnc will crash. Hence PNG24 must be specified to force removal of transparency and ensure the same color type.

@echo off

@Echo %~n0 converts animated GIF to BPG

md ~temp

if not '%1==' call :gif2bpg %*

if '%1==' For %%v in (*.gif) do if not exist "%%~nv.bpg" call :Gif2Bpg "%%v"

if '%1==' For %%v in (*.jpg *.png) do C:\PUB\bpg\bpgenc.exe "%%v" -o "%%~nv.bpg"

rd ~temp

goto :Eof


:Gif2Bpg

:: Coalesce and adjoin is needed to extract individual full frames from animated gif 

:: Extracted PNG must have same color type and without transparency otherwise BPGEnc will crash

Echo Using GraphicsMagick to extract PNG frames from %1 with same color depth, without transparency and coalescing previous frames

"C:\Program Files\GraphicsMagick-1.3.34-Q16\gm.exe" convert -coalesce +adjoin %1 PNG24:"~temp\%~n1_%%03d.png"


Echo Using GraphicsMagick to retrieve animation frame info from %1 and saving it to %~n1.anim

"C:\Program Files\GraphicsMagick-1.3.34-Q16\gm.exe" identify -format "%%T\n" %1 > "~temp\%~n1.anim"


Echo Using BpgEnc to convert extracted PNG frames to %~n1.bpg

bpgenc.exe -a "~temp\%~n1_%%3d.png" -fps 25 -loop 0 -delayfile "~temp\%~n1.anim" -o "%~n1.bpg"


del ~temp\%~n1*.*


Sunday, July 29, 2018

Enabling IE9 rendering of HTMLHelp (chm) files

Chm files are rendered in IE7 mode by default. This is a problem if you want to use CSS3 features such as box-shadow and rounded corners. To enable compatibility with CSS3, add

<meta http-equiv="X-UA-Compatible" content="IE=9" />

right after the tag <head>, e.g.
e.g. <html><head><meta http-equiv="X-UA-Compatible" content="IE=9" />

As a bonus, here is a simple batch file to quickly create a very basic .chm file. This batch file can be used to convert a webpage that is saved using Save Complete in your browser into a standalone chm file. If the resulting chm file does not display properly, try adding
<meta http-equiv="X-UA-Compatible" content="IE=9" />
to the source html file.

::@echo off
if "%HH%"=="" set HH=C:\Program Files\HTML Help Workshop\HHC.EXE
if not exist "%HH%" set HH=C:\Program Files (x86)\HTML Help Workshop\HHC.EXE
if "%~1"=="" goto default
if %1==/? goto help
if exist "%~1\*" goto dir
if exist %1 goto %~x1
exit

:help
echo HHC
echo     Attempt to make a chm out of current directory
echo HHC x.htm
echo    Attempt to make a chm out of x.htm
echo HHC x.hhp
echo    Compiles x.hhp
echo.
echo Uses environment variable HH to compile chm
echo Default for HH is: C:\Program Files\HTML Help Workshop\HHC.EXE

:dir
set d=%~1
set f=%d:~-6%
set d=%d:~0,-6%
if "%f%"=="_files" if exist "%d%.htm" %0 "%d%.htm"
if not exist "%~1\*.hhp" call :hhp %1
for %%v in ("%~1\*.hhp") do "%HH%" "%%v"
exit

:default
if not exist *.hhp call :hhp "%CD%"
for %%v in (*.hhp) do "%HH%" "%%v"
exit

:hhp
for %%v in (index.html index.htm main.html main.htm %~nx1.htm *.htm) do if exist "%%v" (set SRC=%%v) & goto :make
echo Error: No Html files found
exit

:make
set DEST="%tmp%\%~nx1.hhp"
>%DEST% echo [OPTIONS]
::if not exist index.hhk >>%DEST% echo Auto Index=Yes
::if not exist toc.hhc >>%DEST% echo Auto TOC=9
::>>%DEST% echo Binary TOC=Yes
>>%DEST% echo Compatibility=1.1 or later
>>%DEST% echo Compiled file="%~nx1.chm"
::>>%DEST% echo Contents file=toc.hhc
>>%DEST% echo Default topic=%SRC%
::>>%DEST% echo Default Window=Main
>>%DEST% echo Display compile progress=No
if exist index.hhk >>%DEST% echo Index file=Index.hhk
>>%DEST% echo Language=0x409 English (United States)
>>%DEST% echo Title=%~n1
::>>%DEST% echo.
::>>%DEST% echo [WINDOWS]
::if exist index.hhk >>%DEST% echo echo Main="%~n1",toc.hhc,index.hhk,"%SRC%","%SRC%",,,,,0x3520,,0x60384e,,,,,,,,0
::>>%DEST% echo Main="%~n1",toc.hhc,,"%SRC%","%SRC%",,,,,0x3520,,0x60384e,,,,,,,,0
>>%DEST% echo.
>>%DEST% echo [FILES]
>>%DEST% dir /b /s /a-d %1
::>>%DEST% echo.
::>>%DEST% echo [INFOTYPES]
move "%tmp%\%~nx1.hhp" %1
goto :eof

:.htm
:.html
set SRC=%1
set DEST="%tmp%\%~n1.hhp"
>%DEST% echo [OPTIONS]
>>%DEST% echo Compatibility=1.1 or later
>>%DEST% echo Compiled file=%~nx1.chm
>>%DEST% echo Default topic=%~1
>>%DEST% echo Display compile progress=No
>>%DEST% echo Language=0x409 English (United States)
>>%DEST% echo Title=%~n1
>>%DEST% echo.
>>%DEST% echo [FILES]
>>%DEST% echo %~1
>>%DEST% dir /b /s /a-d "%~n1%_files"
move "%tmp%\%~n1.hhp" .
"%HH%" "%~n1.hhp"
goto :eof

:.hhp
"%HH%" %1
goto :eof

Wednesday, August 31, 2016

80x86 snippets

Here are some branchless routines in 80x86 assembly:

Here is a simple routine to get the absolute difference between AL & BL
AL, DL destroyed, absolute difference in AL
sub al, bl ; AL to BL ; positive difference negative differencesbb dl, dl ; DL=0  DL=-1 xor al, dl ; AL xor 0 = AL AL xor -1 = not ALsub al, dl ; AL - 0 = AL not AL --1 = neg AL

Instead of sbb, one can also use cbw (sign extend AL into AH), cwd (sign extend AX into DX) and cdq (sign extend EAX into EDX). See below:
cdq ; sign extend EAX into EDX ( = -1 if EAX negative)
xor eax, edx
sub eax, edx
The last 2 lines can also be re-arranged so:
cdq
add eax, edx
xor eax, edx

 For maximum of 2 numbers, one can use
; AL = max(AH, AL)  ; AL > AH AL < AH
sub ah, al ; AH = AH - AL
cmc
sbb dl, dl ; DL = 0 DL = AH - AL
and dl, ah
add al, dl ; AL = AL AL = AL + AH - AL
For minimum of 2 numbers, one can use
sub     ebx,eax
sbb     edx,edx
and     edx,ebx
add     eax,edx

Monday, November 30, 2015

Installing drivers for Kodak All-In-One printers in Windows

Had to recently re-install drivers for a Kodak AIO printer after removing the re-image adware. However, despite detecting the printer, the driver installation always fails, even after removing the previous drivers. Eventually I figured out it was because Windows automatically tries to install the device as a scanner, thus preventing the device from being installed as an AIO printer. The solution: Disable automatic device detection first before installing the driver.

Sunday, August 30, 2015

Far Manager Multiarc custom.ini for zpaq, nanozip

ZPAQ.EXE lacks delete and extract without path functionality, so those don't work

[zpaq]    ;For zpaq v7.05 journaling archiver, compiled Apr 17 2015
ID=37 6B 53 74 A0 31 83 D3 8C B2 28 B0 D3
IDPos=0
Extension=zpaq
Description="ZPAQ archiver"
Start=" MB"
Format0="  yyyy tt dd hh mm ss  zzzzzzzzzzz aaaaa nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
End=" files) shown"
Extract=zpaq.exe x %%AQ %%FQ
ExtractWithoutPath=zpaq.exe e %%AQ %%FQ -to %%FQ
Test=zpaq.exe t %%AQ {-key %%P}
Delete=zpaq.exe d %%AQ %%FQ {-key %%P}
List=zpaq.exe l %%AQ
Add=zpaq.exe a %%AQ %%FQ -method 5 {-key %%P}
AllFilesMask="*.*"

[NANOZIP]
TypeName=Nanozip
Extension=nz
ID=AE 01 4E 61
Start="^checksum"
End="^Total of "
Format0="rrrrrrrr yyyy-TTT-dd hh:mm:ss zz zzz zzz zzz  nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
List=nz.exe l -v %%AQ
ExtractWithoutPath=nz.exe x -sp %%AQ %%FQ
Extract=nz.exe x %%AQ %%FQ
Test=nz.exe t %%AQ
Add=nz.exe a %%AQ %%FQ
AllFilesMask="*"

Saturday, August 30, 2014

Setting default audio & subtitle in MKV files using a batch file.

Matroska (mkv) files are video files that can contain multiple tracks, allowing for multiple subtitles and audios, and one can set a default audio & subtitle for those.

mkvtoolnix is a collection of tools (mkvmerge, mkvmerge gui [mmg], mkvinfo, mkvextract, and mkvpropedit) for matroska (mkv) files.

The batch file below allows one to view the default flag for the tracks in a mkv file and then toggle the default flag on/off. Copy the text block below and save it to a batch file, say MKV.BAT and put that bat file somewhere in your path (e.g. C:\WINDOWS).

@echo off
if '%1==' goto ?
::change code page to utf8 (mkvinfo always writes utf8 when redirected)
set track=
set mkvtoolnix=%ProgramFiles%\mkvtoolnix
%windir%\system32\chcp 65001>nul
"%mkvtoolnix%\mkvinfo.exe" %1>%temp%\mkvinfo.txt
if '%2==' goto info

set flag=unknown
for /f "tokens=3-9,11*" %%a in (%temp%\mkvinfo.txt) do call :flag %2 %%a %%b %%c %%d %%e %%f %%g %%h %%i
echo Track %2 (%name% %type%) default flag is %flag%
if %flag%==1 goto unset
echo Now setting flag to 1
"%mkvtoolnix%\mkvpropedit.exe" %1 --edit track:%2 --set flag-default=1
"%mkvtoolnix%\mkvinfo.exe" %1>%temp%\mkvinfo.txt
goto info

:unset
echo Now setting flag to 0
"%mkvtoolnix%\mkvpropedit.exe" %1 --edit track:%2 --set flag-default=0
"%mkvtoolnix%\mkvinfo.exe" %1>%temp%\mkvinfo.txt

:info
for /f "tokens=3-9,11*" %%a in (%temp%\mkvinfo.txt) do call :filter %%a %%b %%c %%d %%e %%f %%g %%h %%i
if not "%track%"=="" echo %track%
goto :eof

:filter
if '%2==' goto :eof
for %%v in (Content A Pixel Display (size: Lacing CodecPrivate size head Timecode Muxing Writing Segment Sampling Channels version: read maximum type type: Duration: Date: MinCache: Video Audio Algorithm: Max Order: Scope: Type: Interlaced: Enabled: Forced) do if %1==%%v goto :eof
for %%v in (EbmlVoid Chapters EditionEntry EditionFlagHidden: EditionFlagDefault: EditionUID: ChapterAtom ChapterUID: ChapterTimeStart: ChapterFlagHidden: ChapterFlagEnabled: ChapterDisplay ChapterString: ChapterLanguage: Cluster) do if %1==%%v goto :eof
for %%v in (UID: duration: decode) do if %2==%%v goto :eof
if %2==number: goto :track
if "%track%"=="" goto :eof
if %2==type: (set track=%track% %3) & goto :eof
if %2==ID: (set track=%track%, %3) & goto :eof
set track=%track%, %*
goto :eof

:track
if not "%track%"=="" echo %track%
if %3 LSS 10 (set track=Track %3: ) else set track=Track %3:
goto :eof

:flag
if '%3==' goto :eof
if %3==number: if '%1=='%4 (set track=1) else set track=
if '%track%==' goto :eof
if %2==Name: set name=%3
if %2==Default if %3==flag: set flag=%4
if %2==Track if %3==type: set type=%4
goto :eof

:?
echo MKV mkvfile [track number]
echo.
echo If track number not specified, the tracks will be listed
echo.
echo If track number specified, the default flag will be toggled for that track.

You will need to set the path to mkvtoolnix appropriately (edit the line set mkvtoolnix=...) to point to the mkvtoolnix folder.

Remember if you set a default flag on for one audio track, remember to unset the default flag for any other audio track that had the default flag on.

Monday, July 14, 2014

Compiling swftools on Windows

Compiling swftools on Windows...

1. Download swftools-master.zip

2. Download mingw-get-setup.exe from www.mingw.org, run it and install base, msys & c++ to C:\MINGW

3. Download from http://gnuwin32.sourceforge.net/packages.html and install to C:\MINGW\GNUWIN32:
bison-2.4.1-setup.exe
flex-2.5.4a-1.exe
freetype-2.3.5-1-setup.exe
gettext-0.14.4.exe
giflib-4.1.4-1.exe
jpeg-6b-4.exe
libgw32c-0.4.exe
libiconv-1.9.2-1.exe
libpng-1.2.37-setup.exe
pdflib-lite-6.0.2.exe
t1lib-5.1.0.exe
yasm-1.1.0-win32.exe
zlib-1.2.3.exe

4. Download and compile lame

5. Download  fontconfig-2.2.2-20040412.zip,   fontconfig-dev-2.2.2-20040412.zip
    and extract to c:\mingw\fontconfig

6. Create C:\MinGW\msys\1.0\etc\fstab and put the following lines in:
c:\mingw /mingw
c:\mingw\gnuwin32 /gw32
c:\mingw\fontconfig /fc

7. Extract swftools to C:\MinGW\msys\1.0\home\

8. Run msys
cd ..
cd swftools
.\configure
make

8. If gcc complains about ..
- #define boolean int  in config.h -- just comment out that line
- not found -- copy lib\pdf\aconf.h to lib\pdf\xpdf directory and edit the line 
   #include "../../config.h" in xpdf\aconf.h into #include "../../../config.h"
- "cmyk.h" not found -- edit GfxState.cc and change "cmyk.h" to "../cmyk.h"
- extern "C" int unlink(char *filename); definition conflict in stream.cc -- comment out that line

9. To compile gfx2gfx (exampel usage: gfx2gfx infile.swf -o outfile.pdf)
- edit swftools\src\gfx2gfx.c and insert the line       out->setparameter(out, "maxdpi", "0");
   below the line           gfxdevice_pdf_init(out);
- edit swftools\src\makefile and append gfx2gfx$(E) to the end of the line
   programs = $(install_programs) swfbytes$(E) ttftool$(E)
- run make again

note: pdf2pdf also accepts swf input and sends to pdf output

References: 
http://lists.gnu.org/archive/html/swftools-common/2005-02/msg00023.html
http://sudofixit.blogspot.com/2014/02/guide-convert-book-style-swfs-to-pdfs.html
http://go.kblog.us/2009/08/mingw-to-compile-lame-for-windows.html

Other:
If you want to build pdflib lite, and get
1) DWORD errors: add to pc_util.c
    typedef unsigned int DWORD;
2) png dereferencing errors: change #include "png.h" in p_image.h to
   #include "..\png\png.h"
(this error is caused by gcc reading a different (newer) version of libpng that may be installed elsewhere)
and similarly search and replace #include "tiffio.h" to #include "..\tiff\tiffio.h"
and #include "zlib.h" to #include "..\flate\zlib.h"

Tuesday, August 20, 2013

Wartune mage guide

[last update 10 Dec 2013]

Wartune is a "free" mulitplayer online game. Many items in Wartune are available for free, but it is much easier to get those items by spending money (called "Balens" in game). If you do not plan to spend a lot of money on the game, be prepared for extremely hard fights and dundgeons at high character levels.

You can play Wartune either via Facebook, directly from www.wartune.com or from other websites that hosts Wartune e.g. www.r2games.com.

Facebook accounts are locked to your Facebook identity. Started normally it will run in a frame from within Facebook with a sidebar of ads. It can be ran as a standalone frame (open frame in new window) without the ads sidebar to give you more game screen space, but if you need to purchase Balens or VIP subscription it must be ran in the Facebook frame. If you find the Facebook popup messages troublesome, you can either use Maxthon which allows you to pop out your flash game in a separate window, use an ad-blocker, or use the Wartune mini-client exe ( http://www.wartune.com/news/wartune-news_news-wartune-mini-client.html ).

About the Mage

Archers are essential for high level dundgeons due to their ability to slow ("deep freeze"), debuff ("scatter shot") and do massive critical damage. If you are starting up, rather choose to be an archer. And if you are not an archer, make sure you have a lot of high level archer friends. Mages are nevertheless interesting to play because they excel at healing and mass damage, making them a good team member for most occasions. I think knights are hard to play because they have to tank and so have to be really strong (i.e. they probably require more cash then others).

Balens

A lot of players spend considerable amounts of money constantly. If your funds are limited, consider only buying items only when they are at a discount e.g. in events, shop specials, or mystery shop. Every 1-2 month or so you can buy clothing x 3 for 895 & wings for 1395; and VIP cards at a slight discount (be cautious when buying VIP cards because you might not play this game for very long). If a recharge event comes up, which is actually quite a rare event, make good use of it because it's amazing how quickly balens disappear.

Try not to buy fashion cores because you can get fashion shard/cores from Spire dundgeon runs. You can also get clothing, cores and charms from events. Delay upgrading your clothing until there's an event (which seem to come around every 1-2 months, coinciding with the clothing discounts at shops) that rewards you for upgrading your clothing. Because cores are free, try to use fashion cores to upgrade level 1-2 clothing and lv1 wings (lv1 wings need 5 cores). When upgrading level 2 clothing with fashion cores be prepared for multiple failures to upgrade. It is excessively expensive to upgrade wings above lv2 because there is a risk of failure if you don't use charms (causing you to lose your lv2 wing). If you use charms, 5 charms are required to upgrade lv2 wings to lv3 wings (and 10 charms to upgrade lv3 wings ....).

Try to save up soul crystals, whips, and refinement crystals as you can use them in some of the events. Save the socket rods for high levels (lv55 arena gear or legendary sets). Don't use crypt keys unless you can complete level 100 of the catacomb. Save up as much crypt tokens and insignia as you can. You will need a lot of them to get high level equipment. It may be a good idea to skip the lv50 or lv60 rings and amulets because it doesn't take long to get from lv40 to lv70. It might be a good idea to get the crypt mount first before you exchange your crypt tokens for rings & amulets because in the long run the lower level rings and amulets will become useless. Save some tokens because you will need to exchange crypt tokens for scrolls when class wars come up. Also save up the high level potions for class wars.

For lv6 gems, you only need to buy one lv6 MATK transposer scroll. After you synthesize a lv6 MATK gem, you can convert it to other types of lv6 gems in Blacksmith. Same for lv7 gems. Unfortunately lv6+ scrolls are not free but they can be bought with bound balens.

Levelling

It is a difficult decision whether to level fast or not. Initially try to level fast as much as possible to level 40 or so. AFter that, the less cash you have, the slower you should level so that you can build yourself up with astrals and excel in battleground and arenas. The high levels (50+) are populated by super-boosted cashers with extraordinary looks ("aliens"), so rather get as much honor as you can before you reach lv50. Strategies to avoid levelling including not doing bounty quests and avoiding staying during the guild's Tree of Ancient events.

Etiquette

Players are humans with feelings, and most players play to win. While some would help, one should not ask the higher level characters for help in Spires (and to a lesser degree Tower of Kings), because they get less rewards when they team with a lower level character. Rather team with characters of similar level. The higher levels also receive very little reward for doing a low level multiplayer dundgeon. If high level characters do help out, please send them roses as a token of appreciation.

In the long run, rather try get a team of friends that you can do dundgeons regularly with than try to rely on high level characters to help. Remember that high friendship levels give a lot of bonuses in dundgeons, so it is extremely helpful to have a regular team that you can build up friendship levesl with. If you do have a team, after a while, when you got to know them well, consider having a way to contact one (or more) of the team members in real life (e.g. via whatsapp) as a backup to schedule times for dundgeons. This reduces frustrations and helps the team to last.

If you leave a guild to go to another guild, always inform the guildmaster and have the guildmaster kick you rather than their assistant guildmasters. Note that if you attend guild battles where you face your old guild mates you can be blacklisted by some (particularly if you beat the crap out of them...).

In a multiplayer dundgeon, if you have to go afk (away from keyboard) or refresh during a dundgeon run, let your team mates know and ask them to wait. After you finished with a boss, wait for others to pick up boss loot before moving to next level.

Try not to plunder the same players repeatedly. Try to plunder either inactive players or find a partner to swap plunders with. Arrange a time with him where you can take turns plundering each other. Use up all your gold, remove your troops and gear and let your partner know that you are ready to be plundered. After you have been plundered you can click on the protection buff icon to make it disappear so he can plunder you again. Both of you should be able to get all your plunder attempts done in about 10 minutes or less.

In battleground it is considered courteous to let lower BR folk mine first before you attack them. If you need 3 battleground kills for event quest, you can try swap kills if you find it difficult to get kills. The top right and top left corners are usually relatively secluded and are good places to exchange kills.

Skills 

Early PvP (player vs player / little monsters) skills are Rain of Fire & Meteoric Destroyer. You will only need Thunderer from level 60 (for Moonevil dundgeon). Damnation can be useful in Tower of Kings, Spire, and some dundgeon bosses (e.g. Uranus and Yaros) but is not essential.

PvE (player vs environment) also known as PvM (player vs monster [boss]) skills are Suntoria, Restoration, Purification, Blessed Light


You can purchase double skill tree for separate PvP tree and PvE tree if you want to maximize your PvP & PvE skills early. However, by level 60 you can get most PVP & PVM skills, so it is not an absolute must. However, it is really convenient to have a second skill tree for switching skill sets. If you can't afford a second skill tree you can always switch skills by dragging the individual skill to the skill hotbar.


Dundgeon Strategy

Catacombs
If you don't have money for crypt keys, don't use them until you can beat lv100. If you have difficulty beating Fearful Faye (the "eye" boss), build rage to 100, use PvE gear (e.g. bender set), heal skills, and intelligence potions before fighting the eye. Charm, defense (MDEF, aegis) and hp astrals also help.


Summoner
Try save up as much skeleton keys as possible so you can do the summoner, preferably in nightmare dundgeons, because then you will get legendary stones as well as crystalloids. An easy way to beat the summoned clones is to start with only 1 hp (don't use hp potions when your hp runs out) and cast rain/meteor right at the start. If a team member cannot start with 1 hp (convenant or has lots of hp), he/she should tank and drop his defense and hp as much as possible (remove rings, helmet, armor, brooch, medallion, hp astral and defense astrals) while preserving attack, whereas the other members that have an hp of 1 should start fully equipped and use mass damage attack right at the start.

If you need to refresh, collect all your chests first, otherwise they will disappear after refresh. If they do disappear, check in your mailbox, and hope that they appear there.

Tarraton's Lair
Formation: 2 strongest players in front
Boss 1:  Lightning, Sun, Restore, Purification (to remove bleeds), Blessed Light (boss does AOE)
Boss 2:  Lightning, Sun, Restore, AOE, blessed light
Boss 3: Lightning, Sun, Restore, Purification (to remove AOE bleed), Blessed Light
Boss 3 casts AOE bleed that kills very quickly, so after ~3 lightnings stop using lightning and be prepared to use purification followed by blessed light.The tanks should use heal rune or shield skill if possible otherwise the boss can take them down in the next attack.

Moonevil Den - Recommended BR for party: 40k+ (normal), 60k+ (nightmare)
Formation: 1 superstrong tank or 2-3 strongest players in front
Teams: 1 mage/2 archers/1 knight (best combination for nightmare); 2 mages/2 archers; 2 mages/1 archer/1 tank (will probably fail in last boss in nightmare unless the archer has PvE set); 3 knights/1 archer (if you are desperate, you can do this in normal)
Boss 1: Lightning, Suntoria, Restore, Purification (to remove bleeds), Rain or Meteor, Heal rune
Boss 2: Lightning, Suntoria, Restore, Thunderer, Damnation, Bleed rune, Brutality rune
            Need archer to use slow & Delphic.
Boss 3: Lightning, Sun, Restore, Puri (to remove defense downs), Blessed Light, Bleed rune, Heal rune
            Need archer to use slow & scatter shot (debuff). Need 2 tanks in front, preferably knights with Apollo's shield.


Boss 1 starts with critters (that causes bleed) and will summon 4 critters usually every few rounds. So for boss 1 start with AOE (area of effect [mass damage]) spell such as rain or meteor, then cast suntoria, and if needed purification & restoration. Try to anticipate when the boss might summon the bugs and be prepared to cast aoe spells as soon as the boss summons the critters. The critters need to be killed within one round before the boss casts shield on the critters (one archers can equip scatter shot to remove the shield).

Boss 2 casts PATK buff at fixed time intervals on himself. The buff cannot be debuffed, so kill him ASAP before he buff himself up 3 times, so the archers should cast slow and delphic, the mage as many thunderers as much as he/she can, and the knight delphic as much as possible ("Delphic to the death"). Usually a suntoria at round 2-3 would suffice for the rest of the party. A good starting sequence would be to start with damnation, followed by brutality rune, 2 thunderers, and a bleed rune.

Boss 3 hits hard, aoe often, buffs herself up, and casts defense down on the team. Start the fight immediately with suntoria, and heal as much as you can. Try to have 2 tanks in front to share the damage. The knight should use Apollo's shield if available (preferably around round 3 when the boss starts to do damage to the healers & archers at the back). The archer will have to slow and debuff throughout.

Archers are absolutely necessary.  They are so essential that their br can be lower then everyone else. If the mage has PvE set (e.g. legendary lv40 set) it is possible to do nightmare moonevil with say a br 60k knight, br 65k mage, br 55k archer, and br 47k archer.

Temple of Evil - Recommended BR for party: 60k+ (normal), 70k+ (nightmare)
Formation: 1 superstrong tank or 2-3 strongest players in front
Team: 2 archers + 1  mage + 1 tank, 1 archer (with PvE set) + 2 mages + 1 tank
Boss 1:  Lightning, Sun, Restore, Purification, Blessed Light
             Need archer to use slow & scatter shot (debuff)
Boss 2:  Lightning, Sun, Restore, Thunderer, Blessed Light
             Boss goes berserk (cannot be debuffed) near last bar (so brutality + delphi at end)
             Slow & incendiary shot helps
             Need Br to be 50k+
Boss 3:  Lightning, Sun, Restore, Purification (to remove attack downs), Blessed Light
             Need archer to use slow at all costs & scatter shot (debuff) when boss is buffed to 4
             Need Br to be minimum of 55k+ (a team of 60k, 60k, 54k, 52k could do it with luck).

There's a summoner after boss 1. It is possible to get past first boss in nightmare with say a br 70k+ mage (arena set), 65k+ mage (PvE set), 65k archer (with PvE set) and a 57k knight. The strategy is:
1) Exchange mdef astral for hp or defense astral
2) Exchange mdef gems for hp / pdef gems
3) Knight should start with shield (boss does front row attack x2), followed by apollo after 2nd attack (boss will do aoe attack on 3rd round), and repeat the same sequence
4) Mages should do alternate restorations e.g. mage 1 cast suntoria right at start, mage 2 cast restoration after boss 1st attack, then mage 1 cast restoration after boss 2nd attack etc. Blessed light when needed. Purification is not really needed.
5) Archer do deep freeze with scatter shot when required

Lych's Lair - Recommended BR for party: 70k+ (normal)
Team: Any team with a mage, a knight, and two archer should do. Archers are very helpful but not essential if you have 2 strong knights (br 80k+) or 3 mages.
Boss 1: Lightning, suntoria, restoration, blessed light
Boss 2: Lightning, suntoria, restoration, purification, blessed light
Boss 3: Lightning, suntoria, restoration, thunderer, blessed light

Boss 1 casts 50% damage reflect which can be a bit nasty without scatter shot.

Boss 2 casts group bleed (-10k hp x 3 rouns) starting from about round 3 so purification is fairly essential. This boss can cast bleed rather often so deep freeze is helpful to reduce this frequency.

Boss 3 have 3 phases. The first phase she does single and aoe attacks. When her first bar of hp is gone, she will stun the team for 2 rounds and go into second phase, where she casts aoe constantly. During this second phase her aoe attacks also instantly restores rage and removes cool downs for skills that were cast in the second phase. This allows blessed lights to be cast continuously. However, blessed light need to be cast early in the first phase so that you can cast it immediately at the start of the  second phase. If possible, try to cast thunderer as well. Because if boss 3 is not  killed within a set number of turns, she will go into the third phase, where she beserks and kills everyone in one shot.

Spire

Remind your team mates to check skills, astrals, and equip before starting spire. Crit astrals are helpful for the heal mage. Strategy varies depending on battle rating. Boss 3,4,5 cast irresistible +40% damage debuff and Boss 7 slow debuff at last bar of health, so try to kill them in one shot before they reach last bar of life.

Formation: 1 or 2 or 3 strongest player in front, mages should equip suntoria, restoration, light, and one aoe (if you can't get to boss 9). If you can get to boss 9+ (br 60k+) equip purification instead of aoe. Archer should equip scatter host if the team can get to boss 8.
Boss 1: build rage
Boss 2: build rage, aoe for lizards, if low br can vulcan at end to aoe boss 3 at start
Boss 3: aoe at very beginning (use shield if the team cannot bring the little worms down with aoe in 1 round)
            slow attack, let the archer delphi the boss when the boss is below 1 bar (before half bar)
Boss 4: slow attack, let the archer delphi the boss when the boss is just above 1 bar
Boss 5: Boss starts with a regular attack. On his second turn, he unleashes an extremely strong single player attack. Then he does another normal attack, a very strong two player attack, two more normal attacks, before doing the extremely strong single player attack again. So tank should use shield if needed after 1st attack. Use vulcan (if low br) and help the the archer delphi the boss when the boss is just above 1 bar
Boss 6: use shield after boss' 2nd attack (if low br)
Boss 7: use shield after boss' 1st attack (if low br)
            Can do vulcan near last bar to help finish boss in one shot
Boss 8: Does an extremely strong AoE on her second turn and every 4th turn after that.
            Can do vulcan at end to hit boss 9 at start.
Boss 9 (Archer): Scatter shot at round 3 and every 2-3 rounds to remove the reflect shield.
Boss 10: Boss attack sequence: Single attack, Bleed attack (-12000 hp), Single attack,  Aoe attack. So do purification after attacks 1, 5, 9...
Boss 11 (Eye): Boss attack sequence: Single attack, Aoe+Debuff (mdef- attack-), Single. So do purification after attacks 1,4,7...
Boss 12: Boss sequence: Single, Single random, Pierce + Bleed attack. So do purification after attacks 2,5,8... Boss beserks after a set number of turns so shield once he beserks and try to kill this boss (vulcan) before he beserks.

Tower of Kings

Will destroyer is a good astral here.
Formation: Weakest player in front to take intercept or knight in front to do intercept. Mages rear.

Gears

PvE set gears from lv40 onwards give you +10 rage per action and are good for dundgeon runs. Arena set gear give you ignore MDEF and are good for PvP fights. The highest arena gear is lv55. Try to get legendary lv40 set gear. It will last a long time for dundgeon runs. You only need to make the lv40 clothing legendary, because it's easy to get lv50/lv60 rings and amulets, which are more effective than legendary lv40 rings and amulets, whereas it is much more difficult to get lv50 set gear. If you have lv40 set, you can skip the lv50 set and concentrate on getting the lv60 set, otherwise try to get the lv50 set.

Astrals

Mages can go either will destroyer route or critical route. Will destroyer saves you one astral slot and is more effective in duels (e.g. Tower of kings) and in the occasional instance where the mage has to tank, but does not increase healing and is less effective in fighting the world boss. Critical route need at least 3k+ crit, 2 astrals (Sniper & Determination), legendary PvE set (extra slot for crit gem), and refining gears to get crit bonus.


Friday, April 6, 2012

Microsoft access tips

Many to many relationships / junction tables e.g. books & authors
The steps below allow the user to enter details about a book and details about the authors of the book all on one form.

1. Create table "Books" with "bookid" as autonumber & primary key
2. Create table "Authors" with "authorid" as autonumber & primary key, and surname, firstname etc as text other fields
3. Create table "BookAuthors" with "bookid" and "authorid" as numbers & non-primary keys
4. Relationships - add tables Books, Authors, BookAuthors - link bookid to bookid and authorid to authorid with referential integrity ticked
5. Form wizard - add tables Books, Authors, BookAuthors, include bookid from Books and authorid from BookAuthors and leave out other -ids as well as the surname from authors, use Books as main form and rest as subform
6. Form design - select subform, cut, goto design ribbon, choose tab control, draw tab control on form, select a tab control page, paste
7a. Select authorid (in the subform), change to combo box, click the "..." by properties-data-row source to create query, inside the query design add table Authors, add authorid as first field, and any other fields to sort by and display (e.g. surname of author), exit and save the query
7b. Properties-format - change column count to match number of columns used in the query, change column widths (use 0 for the first column so it won't be displayed e.g. 0;2.5cm;... ) and change list width to the total width of the column widths
7c. Properties-data-Limit to list - change to Yes (so not in list event can be triggered)
7d. Properites-Event-On Not in List - [Event Procedure] build -
Private Sub AuthorID_NotInList(NewData As String, Response As Integer)
strSQL = "Insert Into Authors ([Surname]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
End Sub
8. Right click on bookid on main form and set properties-all-visible to No

Explanations:
Steps 1-4: Junction table is useful for Many to many relationships. The BookAuthors table links books to authors and allow one book to have many authors

Step 5-8: This creates the main form based on Books and a subform for storing the authors of each book, bookid from Books must be present on mainform so the BookAuthors subform can link to it, bookid can be set to hidden or grayed out etc later on (e.g. in step 8), and authorid from BookAuthors must be included so the other fields on Authors (included in the subform) can link to it. The subform has BookAuthors so user can select the appropriate author from the Authors table. The subform also has other fields from Authors so user can update the author details as well. The surname field is left out because authorid (steps 7a-d) will be setup to substitute for the surname field (7a 7b displays surname and 7c 7d allow user to input new surname)

Other tips
  1. #name? error: if a "string" is used in assignment use """string""" (three double quotes) instead.
  2. if you change the name of a control, be sure to update the name in the vba module as well
  3. if the form uses more than one tables and you can't set one of the keys to null (3162 error "You tried to assign the Null value to a variable that is not a Variant data type.") then check the record source and change INNER JOIN to RIGHT JOIN. (see http://objectmix.com/ado-dao-rdo-rds/212806-you-tried-assign-null-value.html )
  4. if the combobox is based on a query and shows #deleted after records got deleted then setup the OnEnter event to requery the combobox e.g.
    Private Sub PatientID_Enter()
    Me.PatientID.Requery
    End Sub

Saturday, August 13, 2011

Relinking URLs

Relink.exe (wu, fs)
Relink [options] html_file [local paths to scan]

Converts hrefs to local urls
Html file backed up with .orig extension

Options:
-c list conversions
-u list unconverted urls
-n no conversion (-u -n lists all hrefs)
-d leave URIs decoded in the html source (converts %##)
This 3kb command line tool converts/fixes the url links in an html or hhc file to local links if the file exists locally. It treats anything that comes after href=, src= or value= as urls. It scans the xxx_files\ folder and the source folder of the html file. Additional paths to scan can be specified. e.g. relink abc\index.html img src will relink urls in index.html to use existing local files in the following folders: img\, src\, abc\index_html\, and abc\

It can only convert one file at a time but this is easily remedied using the recursive for command e.g. for /r %f in (*.html) do relink "%f". It is free, portable, uses very little memory (~110kb) while running, and does not modify any registry entries. Virustotal report 0/43. Download links: wu, fs

Friday, August 12, 2011

File repository

This is my temporary file repository. Currently it uses Wupload, Filesonic, and Megaupload.

HTML Tools
Relink.exe (wu, fs): Tool to convert urls in html files to link to existing local files

Saturday, August 6, 2011

Batch recursion

Here are 3 short scripts to demonstrate directory recursion
Script 1
@echo off
::demonstrates relative directory recursion
::does not detect hidden files

:main
for %%v in (*.*) do echo %%v
for /d %%v in (*.*) do call :sub "%%v"
goto :eof

:sub
for %%f in ("%~1\*.*") do echo %%f
for /d %%d in ("%~1\*.*") do call :sub "%%d"
goto :eof
Script 2
@echo off
::demonstrates directory recursion
::does detect hidden files but outputs fullpath
for /r %%v in (*.*) do echo %%v
Script 3
@echo off
::demonstrates directory recursion
::detects hidden files & outputs relative path

setlocal enabledelayedexpansion
for /r %%v in (*.*) do set n=%%v&echo !n:%CD%\=!

Sunday, July 3, 2011

Right click lock for Dungeon Siege III

This is an autohotkey script for people who don't like to hold the right mouse button down all the time to move the character. It basically enables right clicklock. The current duration to hold the right mouse key down to activate click lock is 350ms but can obviously be modified to something that is not 350. I've noted that sometimes the game can crash and the right click can remain locked (left click should clear it but may not always work), so use this script at your own caution and make sure you don't have any vital program running before you run this script.
; Right click lock (Rt mouse button will be kept held down with a long click -- short clicks allowed for short movements)

#IfWinActive, Dungeon Siege III
#MaxThreadsPerHotkey 3

; Force the keyboard hook to be used, which as a side-effect prevents the Send command from triggering hotkeys.
#UseHook

~Lbutton::HoldRMB = 0

~Rbutton::
TC := A_TickCount
KeyWait, RButton ;wait for right mouse button to be released
If HoldRMB || (A_TickCount-TC) < 350
{
HoldRMB = 0
Return
}
HoldRMB = 1
Loop {
Send {RButton down}
Sleep 40
if !HoldRMB
break
}
Send {RButton up}
HoldRMB = 0
return
To have this script execute automatically, you can create a batch file in the game directory
start c:\progra~1\AutoHotkey\AutoHotkey.exe /r "ds3.ahk"
start "Dungeon Siege III" "Dungeon Siege III.exe"
exit
and point the Dungeon Siege III play shortcut to it (instead of the executable)

Saturday, June 18, 2011

Getting password in batch file

This batch script gets the password without displaying user input. Tested only in XP. Vbs script is required.
@echo off
echo wscript.echo CreateObject("ScriptPW.Password").GetPassword()>%temp%\getpwd.vbs
set pwd=Password: <nul
for /f "delims=" %%i in ('cscript /nologo %temp%\GetPwd.vbs') do set pwd=%%i
echo.
echo "%pwd%"
The last line shows the user password for testing purposes. Note that password must be enclosed in double quotes to prevent bad inputs that contains &.

Saturday, February 26, 2011

Pathology Quiz Websites

Pathorama: Lung cytology, urinary cytology, serrated polyps, EIN
John Hopkins: Surgical Pathology, GIT Pathology, Cytology
Bethesda

Tuesday, January 25, 2011

Adding favicon to Firefox bookmarklets on the bookmarks bar

This bookmarklet loads a PubMed search into UCT's e-journal search engine. It also has a favicon using the technique from Restafarian.org » Adding an Icon to Your Bookmarklet. To create the bookmarklet, first create a bookmark on the Firefox bookmark toolbar. Right click the bookmark, select Properties, and change URL to:
javascript:if(window.location.href.indexOf('file:///C:/')==0){'%3Chtml%3E%3Clink%20rel="icon"%20href="http://www.ncbi.nlm.nih.gov/favicon.ico"%3E';}else{metaTags=document.getElementsByName('ncbi_uidlist');i=metaTags.length;if(i>0){location='http://uctsfx.hosted.exlibrisgroup.com.ezproxy.uct.ac.za/uct?rft_id=info:pmid/'+metaTags[0].content}else{location.href='http://www.ncbi.nlm.nih.gov/pubmed'}}

Afterwards go to C drive and click on bookmarklet to load the icon. Thereafter you can go to any site (other than C drive) and the bookmarklet will execute the javascript. You can change the icon location to e.g. file:///C:/pub/firefox/favicons/pubmed.ico. The javascript for the actual bookmarklet function can also be changed and is located inside the else {} statement.

Thursday, December 23, 2010

ASCII: American Standard Code for Information Interchange


Dec Oct Hex Binary Asc Char
0 000 00 00000000
NUL
1 001 01 00000001 ☺ SOH
2 002 02 00000010 ☻ STX
3 003 03 00000011 ♥ ETX
4 004 04 00000100 ♦ EOT
5 005 05 00000101 ♣ ENQ
6 006 06 00000110 ♠ ACK
7 007 07 00000111 ● BELL
8 010 08 00001000 ◘ BS
9 011 09 00001001 ○ TAB
10 012 0A 00001010 ◙ LF
11 013 0B 00001011 ♂ VT
12 014 0C 00001100 ♀ FF
13 015 0D 00001101 ♪ CR
14 016 0E 00001110 ♬ SO
15 017 0F 00001111 ☼ SI
16 020 10 00010000 ► DLE
17 021 11 00010001 ◄ DC1
18 022 12 00010010 ↕ DC2
19 023 13 00010011 ‼ DC3
20 024 14 00010100 DC4
21 025 15 00010101 § NAK
22 026 16 00010110 ▃ SYN
23 027 17 00010111 ETB
24 030 18 00011000 ↑ CAN
25 031 19 00011001 ↓ EM
26 032 1A 00011010 → SUB
27 033 1B 00011011 ← ESC
28 034 1C 00011100 ∟ FS
29 035 1D 00011101 ↔ GS
30 036 1E 00011110 ▲ RS
31 037 1F 00011111 ▼ US
32 040 20 00100000
SP
33 041 21 00100001 !
34 042 22 00100010 "
35 043 23 00100011 #
36 044 24 00100100 $
37 045 25 00100101 %
38 046 26 00100110 &
39 047 27 00100111 '
40 050 28 00101000 (
41 051 29 00101001 )
42 052 2A 00101010 *
43 053 2B 00101011 +
44 054 2C 00101100 ,
45 055 2D 00101101 -
46 056 2E 00101110 .
47 057 2F 00101111 /
48 060 30 00110000 0
49 061 31 00110001 1
50 062 32 00110010 2
51 063 33 00110011 3
52 064 34 00110100 4
53 065 35 00110101 5
54 066 36 00110110 6
55 067 37 00110111 7
56 070 38 00111000 8
57 071 39 00111001 9
58 072 3A 00111010 :
59 073 3B 00111011 ;
60 074 3C 00111100 <
61 075 3D 00111101 =
62 076 3E 00111110 >
63 077 3F 00111111 ?

Dec Oct Hex Binary Asc
64 100 40 01000000 @
65 101 41 01000001 A
66 102 42 01000010 B
67 103 43 01000011 C
68 104 44 01000100 D
69 105 45 01000101 E
70 106 46 01000110 F
71 107 47 01000111 G
72 110 48 01001000 H
73 111 49 01001001 I
74 112 4A 01001010 J
75 113 4B 01001011 K
76 114 4C 01001100 L
77 115 4D 01001101 M
78 116 4E 01001110 N
79 117 4F 01001111 O
80 120 50 01010000 P
81 121 51 01010001 Q
82 122 52 01010010 R
83 123 53 01010011 S
84 124 54 01010100 T
85 125 55 01010101 U
86 126 56 01010110 V
87 127 57 01010111 W
88 130 58 01011000 X
89 131 59 01011001 Y
90 132 5A 01011010 Z
91 133 5B 01011011 [
92 134 5C 01011100 \
93 135 5D 01011101 ]
94 136 5E 01011110 ^
95 137 5F 01011111 _
96 140 60 01100000 `
97 141 61 01100001 a
98 142 62 01100010 b
99 143 63 01100011 c
100 144 64 01100100 d
101 145 65 01100101 e
102 146 66 01100110 f
103 147 67 01100111 g
104 150 68 01101000 h
105 151 69 01101001 i
106 152 6A 01101010 j
107 153 6B 01101011 k
108 154 6C 01101100 l
109 155 6D 01101101 m
110 156 6E 01101110 n
111 157 6F 01101111 o
112 160 70 01110000 p
113 161 71 01110001 q
114 162 72 01110010 r
115 163 73 01110011 s
116 164 74 01110100 t
117 165 75 01110101 u
118 166 76 01110110 v
119 167 77 01110111 w
120 170 78 01111000 x
121 171 79 01111001 y
122 172 7A 01111010 z
123 173 7B 01111011 {
124 174 7C 01111100 |
125 175 7D 01111101 }
126 176 7E 01111110 ~
127 177 7F 01111111 ⌂

Dec Oct Hex Binary Asc
128 200 80 10000000 Ç
129 201 81 10000001 ü
130 202 82 10000010 é
131 203 83 10000011 â
132 204 84 10000100 ä
133 205 85 10000101 à
134 206 86 10000110 å
135 207 87 10000111 ç
136 210 88 10001000 ê
137 211 89 10001001 ë
138 212 8A 10001010 è
139 213 8B 10001011 ï
140 214 8C 10001100 î
141 215 8D 10001101 ì
142 216 8E 10001110 Ä
143 217 8F 10001111 Å
144 220 90 10010000 É
145 221 91 10010001 æ
146 222 92 10010010 Æ
147 223 93 10010011 ô
148 224 94 10010100 ö
149 225 95 10010101 ò
150 226 96 10010110 û
151 227 97 10010111 ù
152 230 98 10011000 ÿ
153 231 99 10011001 Ö
154 232 9A 10011010 Ü
155 233 9B 10011011 ¢
156 234 9C 10011100 £
157 235 9D 10011101 ¥
158 236 9E 10011110 ₧
159 237 9F 10011111 ƒ
160 240 A0 10100000 á
161 241 A1 10100001 í
162 242 A2 10100010 ó
163 243 A3 10100011 ú
164 244 A4 10100100 ñ
165 245 A5 10100101 Ñ
166 246 A6 10100110 ª
167 247 A7 10100111 º
168 250 A8 10101000 ¿
169 251 A9 10101001 ⌐
170 252 AA 10101010 ¬
171 253 AB 10101011 ½
172 254 AC 10101100 ¼
173 255 AD 10101101 ¡
174 256 AE 10101110 «
175 257 AF 10101111 »
176 260 B0 10110000 ░
177 261 B1 10110001 ▒
178 262 B2 10110010 ▓
179 263 B3 10110011 │
180 264 B4 10110100 ┤
181 265 B5 10110101 ╡
182 266 B6 10110110 ╢
183 267 B7 10110111 ╖
184 270 B8 10111000 ╕
185 271 B9 10111001 ╣
186 272 BA 10111010 ║
187 273 BB 10111011 ╗
188 274 BC 10111100 ╝
189 275 BD 10111101 ╜
190 276 BE 10111110 ╛
191 277 BF 10111111 ┐

Dec Oct Hex Binary Asc
192 300 C0 11000000 └
193 301 C1 11000001 ┴
194 302 C2 11000010 ┬
195 303 C3 11000011 ├
196 304 C4 11000100 ─
197 305 C5 11000101 ┼
198 306 C6 11000110 ╞
199 307 C7 11000111 ╟
200 310 C8 11001000 ╚
201 311 C9 11001001 ╔
202 312 CA 11001010 ╩
203 313 CB 11001011 ╦
204 314 CC 11001100 ╠
205 315 CD 11001101 ═
206 316 CE 11001110 ╬
207 317 CF 11001111 ╧
208 320 D0 11010000 ╨
209 321 D1 11010001 ╤
210 322 D2 11010010 ╥
211 323 D3 11010011 ╙
212 324 D4 11010100 ╘
213 325 D5 11010101 ╒
214 326 D6 11010110 ╓
215 327 D7 11010111 ╫
216 330 D8 11011000 ╪
217 331 D9 11011001 ┘
218 332 DA 11011010 ┌
219 333 DB 11011011 █
220 334 DC 11011100 ▄
221 335 DD 11011101 ▌
222 336 DE 11011110 ▐
223 337 DF 11011111 ▀
224 340 E0 11100000 α
225 341 E1 11100001 ß
226 342 E2 11100010 Γ
227 343 E3 11100011 π
228 344 E4 11100100 Σ
229 345 E5 11100101 σ
230 346 E6 11100110 µ
231 347 E7 11100111 τ
232 350 E8 11101000 Φ
233 351 E9 11101001 Θ
234 352 EA 11101010 Ω
235 353 EB 11101011 δ
236 354 EC 11101100 ∞
237 355 ED 11101101 φ
238 356 EE 11101110 ε
239 357 EF 11101111 ∩
240 360 F0 11110000 ≡
241 361 F1 11110001 ±
242 362 F2 11110010 ≧
243 363 F3 11110011 ≦
244 364 F4 11110100 ⌠
245 365 F5 11110101 ⌡
246 366 F6 11110110 ÷
247 367 F7 11110111 ≒
248 370 F8 11111000 °
249 371 F9 11111001 •
250 372 FA 11111010 ·
251 373 FB 11111011 √
252 374 FC 11111100 ⁿ
253 375 FD 11111101 ²
254 376 FE 11111110 ■
255 377 FF 11111111



SOH start of headingACK acknowledgeVT vertical tabDLE data link escapeNAK neg. acknowledgeSUB substitution
US unit separatorSTX start of textBEL audible bellFF formfeedDC1 device control 1SYN synchronous idle
ESC escapeSP blank spaceETX end of textBS backspaceCR carriage returnDC2 device control 2
ETB end trans. blockFS file separatorEOT end of transmitHT horizontal tabSO shift outDC3 device control 3
CAN cancelGS group separatorENQ enquiryLF linefeedSI shift inDC4 device control 4
EM end of mediumRS record separator

Friday, September 24, 2010

Mplayer & displaying traditional Chinese subtitles

in mplayer\config:

Font=c:\xp\fonts\arialuni.ttf
Subcp=cp950
sub-fuzziness=1

For smplayer:
Preferences > Subtitles > Default subtitle encoding - BIG5 and Font Arial Unicode
Preferences > Advanced > Untick pass short filename


make sure the srt file is in UTF-8 and not unicode
pass the long file name to MPlayer and not the short filename

Monday, December 28, 2009

Using Far Manager under Chinese XP

Far manager is an excellent orthodox file manager (aka Norton Commander clone for people who still remember DOS), the unicode version of which is open source. However, because it uses the console as the output, it suffers from text alignment and border display problems with Chinese, and presumably other DBCS, systems. Here are 2 methods to make it display properly:

Method 1: This is for v1.75 builds
Use a hex editor, open Far.exe, scan through it visually and patch the box characters to plain characters + - = |
The address of the box characters are unfortunately version dependent.
Install the addon FileCopyEx. Use this instead of Far's internal copy routine because Far's internal copy routine cannot handle certain Chinese names.
Create a shortcut for Far.exe and now right click on it to open the property tab of the shortcut. Now change the code page (Options tab) to Chinese, and add the /8 command line switch.
The example patch below works for v1.75 2616x86
Comparing files Far_original.exe and Far_patched.exe
000CA8C4: C5 2B
000CA8C5: B3 7C
000CA8C6: B3 7C
000CA8C7: B3 7C
000CA8C8: CF 2B
000CA8CC: D1 2B
000CA8CD: B3 7C
000CA8CE: B3 7C
000CA8CF: C1 2B
000D6F3C: B3 7C
000D6F3D: BA 7C
000D6F40: CD 3D
000D6F41: CD 3D
000D6F42: CD 3D
000D6F44: FB 3E
000D7050: C7 2B
000D7051: B6 2B
000D7052: C4 2D
000D7054: BA 7C
000D7055: BA 7C
000D7056: C4 2D
000D7058: C3 2B
000D7059: B4 2B
000D705A: C4 2D
000D705C: C3 2B
000D705D: B4 2B
000D705E: C4 2D
000D7060: CC 2B
000D7061: B9 2B
000D7062: CD 3D
000D7064: CC 2B
000D7065: B9 2B
000D7066: CD 3D
000D706A: B3 7C
000D706E: B3 7C
000D7070: D1 2B
000D7071: CF 2B
000D7072: B3 7C
000D7074: CD 3D
000D7075: CD 3D
000D7076: B3 7C
000D7078: C2 2B
000D7079: C1 2B
000D707A: B3 7C
000D707C: C2 2B
000D707D: C1 2B
000D707E: B3 7C
000D7080: CB 2B
000D7081: CA 2B
000D7082: BA 7C
000D7084: CB 2B
000D7085: CA 2B
000D7086: BA 7C
000D7088: C4 2D
000D7089: C4 2D
000D708A: C4 2D
000D708C: C4 2D
000D708D: C4 2D
000D708E: C4 2D
000D7090: CD 3D
000D7091: CD 3D
000D7092: CD 3D
000D7094: CD 3D
000D7095: CD 3D
000D7096: CD 3D
000D7098: B3 7C
000D7099: B3 7C
000D709A: B3 7C
000D709C: B3 7C
000D709D: B3 7C
000D709E: B3 7C
000D70A0: BA 7C
000D70A1: BA 7C
000D70A2: BA 7C
000D70A4: BA 7C
000D70A5: BA 7C
000D70A6: BA 7C
000D7309: B3 7C
000D730A: DA 2B
000D730B: C0 2B
000D730C: D9 2B
000D730D: BF 2B
000D730E: CD 3D
000D730F: BA 7C
000D7310: C9 2B
000D7311: C8 2B
000D7312: BC 2B
000D7313: BB 2B


Method 2: This is for v2.0 builds
Cut & paste lines below into a registry file e.g. boxchar.reg and import it
REGEDIT4

[HKEY_CURRENT_USER\Software\Far2\System]
"BoxSymbols"=hex:\
2E,00,6F,00,4F,00,7C,00,2B,00,2B,00,7C,00,2B,00,\
2B,00,2B,00,7C,00,2B,00,2B,00,2B,00,2B,00,2B,00,\
2B,00,2B,00,2B,00,2B,00,2D,00,2B,00,2B,00,7C,00,\
2B,00,2B,00,2B,00,2B,00,2B,00,3D,00,2B,00,3D,00,\
2B,00,2B,00,2B,00,59,00,58,00,52,00,53,00,6B,00,\
6A,00,18,00,0C,00,88,00,84,00,8C,00,90,00,80,00
Create a shortcut for Far.exe and now right click on it to open the property tab of the shortcut. Now change the code page (Options tab) to Chinese, and change the Font to a true type font (細明體). Start Far now and under options > File mode > Full mode untick Align file extensions and use the following values:
Column types: T,D,S,N
Column widths: 5,8,8,0
Status line column types: S,NR
Status line column widths: 23,0

Method 3: This is for v2.0 builds
Download conemu from http://code.google.com/p/conemu-maximus5/
Install conemu into same folder as far so conemu.exe is in the same folder as far.exe
Change Far's shortcut e.g. from c:\far2\far.exe to c:\far2\conemu.exe
Start Far (using the shortcut), right click and select settings
Change Font to 細明體
Change Charset to ANSI
C:0
Untick Monospace
Tick Fix FAR borders
And underneath it use Lucida Console, x0

Additional enhancements: conman can be used to start Far.exe (e.g. C:\Far\conman.exe C:\Far\Far.exe /8 /co -new_console_wx=170wy=50 ) to provide a scrollback buffer using the alternate console with the following registry file:
REGEDIT4

; registry settings for commands for console manager via Win+Key combination
; uncomment values which you want :)

[HKEY_CURRENT_USER\Software\HoopoePG_2x]
"Console1" = hex:5b,31 ;win + 1
"Console2" = hex:5b,32 ;win + 2
"Console3" = hex:5b,33 ;win + 3
"Console4" = hex:5b,34 ;win + 4
"Console5" = hex:5b,35 ;win + 5
"Console6" = hex:5b,36 ;win + 6
"Console7" = hex:5b,37 ;win + 7
"Console8" = hex:5b,38 ;win + 8
"Console9" = hex:5b,39 ;win + 9
"Console10" = hex:5b,30 ;win + 0
;"Console11" = hex:5b,7a ;win + F11
;"Console12" = hex:5b,7b ;win + F12
"NewConsole" = hex:5b,57 ;win + w
;"ComSpec" = hex:5b,43 ;win + c
"Next" = hex:5b,51 ;win + q
"Prev" = hex:10,5b,51 ;shift + win + q
;"VertInc" = hex:5b,28 ;win + Down
;"VertDec" = hex:5b,26 ;win + Up
;"HorInc" = hex:5b,27 ;win + Right
;"HorDec" = hex:5b,25 ;win + Left

;"TerminateConsole" = hex:5b,2e ; Win + Del
;"MaximizeWindow" = hex:5b,78 ; Win + F9
;"MinimizeToTray" = hex:5b,22 ; Win + PgDn

"AlternativeConsole" = hex:5b,41 ; Win + A
"AlternativeConsoleUp" = hex:28
"AlternativeConsoleDn" = hex:26
"AlternativeConsolePgUp" = hex:22
"AlternativeConsolePgDn" = hex:21
"AlternativeConsoleHome" = hex:24
"AlternativeConsoleEnd" = hex:23
"AlternativeConsoleClear" = hex:2e
"AlternativeConsoleCopyAll" = hex:0x11,0x43 ;Ctrl+C
;"CloseAlternativeConsole" = hex:1b


;"TerminateAll" = hex:5b,11,44 ;Ctrl+Win+D ;by default not mapped

Method 4: This is for Far v3.0 builds

For Chinese filename display in Far v3.0 I do the following:
- Use Consolas (or other true type) font for Far Manager shortcut: this is so you can display Chinese
- Far > Options > File panel mode > Full mode: untick Align file extensions.
- Options > Colors > Panel > Border: change foreground or background color to a color scheme that differs from Normal text.
- Options > Panel Settings: untick Highlight column separators
- Options > Interface settings: tick ClearType friendly redraw