Tuesday, November 10, 2009

Hard drive failure

Today Windows XP refused to boot saying \windows\system32\config\system is corrupt or missing. Smartctl gave a lot of raw_read_error_rate on the drive and it failed the health status test. I managed to boot into recovery console of Windows XP and ran a chkdsk /R on the windows partition.

Sunday, November 8, 2009

Asterisk (PBX) and PAP2T

  1. hasexten=yes|no
    If the context for a peer sets hasexten=yes, Asterisk creates a hint for the user in the default context as shown below for a SIP peer 6000.
    CLI> dialplan show default
    [ Context 'default' created by 'pbx_config' ]
    '6000' => hint: SIP/6000 [pbx_config]
    1. Dial(${HINT}) [pbx_config]

    Therefore I can use Goto(default,6000,1) to ring it
  2. [general] user in users.conf
    It's set the default contexts for all other users. They can be overridden though. The following are in my [general] user (all my users are using SIP):
    fullname = My Name
    ;
    ; Starting point of allocation of extensions
    ;
    userbase = 6000
    ;
    ; Create SIP Peer
    ;
    hassip = yes
    ;
    ; Create IAX friend
    ;
    hasiax = no
    registeriax = no
    ;
    ; Create manager entry
    ;
    hasmanager = no
    callwaiting = yes
    threewaycalling = yes
    callwaitingcallerid = yes
    transfer = yes
    canpark = yes
    cancallforward = yes
    callreturn = yes
    call-limit = 100
    qualify = yes
    disallow = all
    allow = ulaw,alaw
    type = friend
  3. Asterisk directed call pickup
    I have two extensions: 6000 and 8888. Typically when there's a incoming call, only extension 6000 rings. I can pick up the call from extension 8888 by pressing the # key. Therefore I have the following in features.conf
    [general]
    pickupexten = #

    and the following in extensions.conf:
    [globals]
    voipbuster = SIP/voipbuster

    [CallingRule_pickup]
    exten = _#,1,Pickup(6000@default)
    exten = _#,n,Hangup()

    [DLPN_8888]
    include = CallingRule_pickup
    include = CallingRule_VBOut
    include = default

    [CallingRule_VBOut]
    exten = _00X.,1,Macro(trunkdial-failover-0.3,${voipbuster}/${EXTEN:0},,voipbuster,)

    I had to add the following to the Dial Plan of the line that will pickup the call in my PAP2T to pass # key directly to Asterisk: #S0
  4. Blind transfer
    I use the * key for Blind transfer. Therefore I have the following in features.conf
    [featuremap]
    blindxfer = *
    and the following in extensions.conf:
    [globals]
    DIALOPTIONS = tT

    [DLPN_6000]
    include = CallingRule_VBOut
    include = default
    include = parkedcalls
    include = conferences
    include = ringgroups
    include = voicemenus
    include = queues
    include = voicemailgroups
    include = directory
    include = pagegroups
    include = page_an_extension
    exten = _*,1,Transfer(8888)

    I had to add the following to the Dial Plan of the line that will initiate the transfer in my PAP2T to pass * key directly to Asterisk: *S0
  5. Connecting PAP2T to the telephone lines 1&2 in my house (T568A type socket): I cut one standard 2-wire RJ11 telephone cable assembly in half and connected them to Blue and Orange lines of the T568A. That will enable me to connect a phone onto the wall outlet at any room to my PAP2T.

Friday, October 30, 2009

Knowledgetree document management software

  • WebDAV:

    1. Don't rename the root folder. Otherwise access from WebDAV will be broken and the error says the folder is no longer available.
    2. No matter what name you give to the root folder, after turning on WebDAV Debug, the log shows KTWEBDAV [info] Root Folder is : Root Folder


  • Indexer Problem A: All documents are sitting in the quene to be indexed but none were indexed

    1. Change in config.ini to have loglevel=DEBUG
    2. Access forbidden error found in the log file at var/log after the following line
    3. DEBUG: call_page: calling http://dms/search2/indexing/bin/cronIndexer.php
    4. Modify the .htaccess file to allow access
    5. Enter the folder bin/luceneserver and edit KnowledgeTreeIndexer.properties to have the following contents:

      server.port=8875
      server.paranoid=true
      server.accept=127.0.0.1
      indexer.directory=../../var/indexes

    6. Indexer working


  •  Indexer problem B: File not indexed since it had the wrong extension
  1. Go to database dms table document_content_version
  2. Search for the known document_id that had indexing problem and write down its mime_id
  3. Search for this mime_id in the table mime_types: e.g. 167 has filetypes pptx but the file should have file type ppt (mime_id: 74)
  4. Update to the correct mime_id of the document in the table document_content_version
  • LDAP accounts import with uid set as default username
    Edit the file
    plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php
    locate the following line in functions _do_editUserFromSource() and _do_massCreateUsers()
    $sUserName = $aResults[$this->aAttributes[1]]
    change it to
    $sUserName = $aResults[$this->aAttributes[7]]
    Note the definition of the array aAttributes is
    var $aAttributes = array ('cn', 'samaccountname', 'givenname', 'sn', 'mail', 'mobile', 'userprincipalname', 'uid');

    In order to correct the behavior that Mass Import Search for users returns unwanted objectclasses, locate the following line in function searchUsers:
    $sFilter = !empty($sSearch) ? sprintf('(&(%s)(%s))', $sObjectClasses, $sSearchAttributes) : null;
    and change it to
    $sFilter = !empty($sSearch) ? sprintf('(&(%s)(%s))', $sObjectClasses, $sSearchAttributes) : '(objectClass=posixAccount)';
    Recently I found a need to customize the LDAP search filter, therefore now it looks like
    $sFilter = !empty($sSearch) ? sprintf('(&(%s)(%s)(!(employeeNumber=0)))', $sObjectClasses, $sSearchAttributes) : '(&(objectClass=posixAccount)(!(employeeNumber=0)))';
  • Increase Session Timeout:


    1. In Mandriva Linux, PHP Session Timeout is affected by the file /usr/lib/php/maxlifetime. Default is 1440 seconds (24 minutes). Updating the file /etc/php.d/47_session.ini to include the following: session.gc_maxlifetime = 30000 will increase the timeout to 500 minutes.
    2. The config_settings table is queryed and populated into the global variable $default in file lib/config/config.inc.php within function populateDefault()



Using the find command

  • In one case, I need to rename a bunch of files from upper case to title case (only the first letter of the file name is capitalized). For exmaple, AAA.C --> Aaa.c and ABC.C --> Abc.c

    This can be done with find and perl in the following manner:
    find . -maxdepth 1 -type f -execdir perl -e 'rename substr($_,2),ucfirst(lc(substr($_,2))) for @ARGV' '{}' \;

    Useful reference: How to rename to lowercase every file in a directory and its subdirectories?
  • How to check whether the contents of a directory is newer than 10-day old: I used the following command
    find /home/user -maxdepth 2 -mtime -10 -print -quit
    It will search the path /home/user and one level below that for anything that's newer than 10-day old and quit after a match is found.

Functions of MortScript

  1. Function to rename a directory/folder: just use Rename(oldDirName,newDirName,True) Although in the 4.1 manual it says Rename is for a file, it works for directories too.
  2. Function to enlarge the font size of Choice/ChoiceDefault: I use SetChoiceEntryFormat(45,36) when there are less than or equal to three choices to display on my 480x272 screen.

Sanyo NVM-4050 GPS

  1. Keep PNAShell.exe running for the Menu/Power button to work
  2. Kill MainPanel.exe before running Media player
  3. It can be wrapped in a MortScript to launch media player by the following command
    CallScript("MplayerLauncher.mscr", "\myflashdisk\programs\mediaplayer", "Player.exe")
    
    The content of the MplayerLauncher.mscr is shown below:
    ErrorLevel("warn")
    
    CWD = SystemPath("ScriptPath")
    
    appFolder = argv[1]
    appEXE = argv[2]
    
    If(FileExists(appFolder\appEXE))
    
    If(ProcExists("MainPanel.exe"))
    MainPanelRunning = "true"
    Kill("MainPanel.exe")
    EndIf
    
    RunWait(appFolder\appEXE)
    
    If(MainPanelRunning eq "true")
    Run("\ShellDisk\Shell\Communication\MainPanel.exe")
    Waitfor("MainPanel", 3)
    EndIf
    
    Else
    BigMessage(appFolder\appEXE&" was not found. Install the application to that path and try again.","Application not found")
    EndIf
    
  4. No native support by GAPI. Use emulator (GAPI to GDI wrapper) instead
  5. When a corrupted folder is detected in myflashdisk by the windows CE, open error checking from XP to check the flash drive
  6. CPU ARM920T S3C2443 (thanks to Checko), Windows CE 5.0 core, 480x272 screen
  7. Bootloader's menu (Sorry, not working yet)
    • Hold down the Menu button while powering it on or hard reset
    • Download the driver for SEC SOC USB Bulk IO Test Board Secbulk.* here
    • Connect the unit to PC via USB and install secbulk.inf
    • Download the USB/Serial Downloader DNW.exe here

Nintendo Wii

  1. My Wii was purchased as a bundle from Samsclub.com and has a serial number of LU 3086XXXXX. Its DVD drive chipset is GC2R-D2B.
  2. To open up the console, a special tool -- Tri-wing Screwdriver is needed. I got it from Play-asia.com for $3.99+$1.30 shipping (Air Economy Bubble). I also have a small philipps screwdriver for other screws.
  3. The Wii modchip I have is WiiKit, which is based on WiiKey with the extra feature of an optional wires installation. I got it from Divineo.com for $9.99+$8.49 shipping (Registered Air Mail).
  4. I followed this Guide to disassemble the Nintendo Wii (Video and Pictures).
  5. Since the WiiKit comes with the installation wires, all I need is a soldering iron with a sharp tip and solder. The soldering job is straightford according to this picutre.
  6. Download the latest Update and Config disc files from the official website of Wiikey and generate the ISO images according to the Readme.txt file after extracting them (using the fixsize.cmd and filechop.exe).
  7. I burned the image to a TEON 8X DVD-R at 4/8X speed and TDK 16X DVD+R at 6/16X speed with either a Toshiba or Optiarc burner.
  8. Insert the burned Update disc into Wii and it updated the firmware of the Wiikey to the latest version (two cycles: one test and one actual update). Insert the burned Config disc after rebooting, the Wiikey Setup Menu showed up. It confirmed the installation of the Wiikit is good. I don't have a gamecube controller, so I have to use the reset button on the console to access the Setup Menu as suggested in the Readme.txt file.
  9. Guide -- Wii Disc Backup
  10. WII ModChip Compatibility List
  11. Wii SoftMod guide for System Firmware 4.1 and below: No need to disassemble your wii or use a soldering iron. All you need is a SD card.
  12. USBLOADER GX GUIDE: Load and launch all your favorite game backups from a USB hard drive, which must contain a primary partition formatted as WBFS. Otherwise you'll be prompted to format it.
  13. How to add/import a WBF file on a PC hard drive into a WBFS partition: I was able to do it with the wbfs.exe (wbfs windows port build 'delta'. Mod v1.7 by flfl.) tool from the package wbfs中文管理器2.91. The syntax is wbfs n a filename.wbf (assuming n: is the drive letter for the WBFS partition and a for add.). After it's done, the games installed on the WBFS partition can be listed by wbfs n l (l for list). You may need the file wwbfs.exe in the same folder as wbfs.exe and the wbf file to make it work.
  14. Unofficial USB to Ethernet adaptes for Wii