{Notes to self, programming, technology, linux, windows, git} U {Papers, reviews, games, coffee, tabletennis, ramblings} = {things worth saving}

Tuesday, October 13, 2009

Re-flashing and setting up NSLU2 on Arch Linux

Get upslug2 PKGBUILD file from Arch AUR repo: http://aur.archlinux.org/packages.php?ID=11481

$ pkgbuild -s (not as sudo - for automatic dependency handling)
$ pacman -U upslug2-41-2-i686.pkg.tar.gz

- Get NSLU2 in upgrade mode (Turn NSLU2 on while reset button is held in for 10 secs. Orange will turn to red => RELEASE! Toggles between red and green now and is in upgrade mode, ready to receive new firmware)

- Connect NSLU2 directly to ethernet port with RJ45 cable.

$ sudo ifconfig ethx 192.168.1.2 netmask 255.255.255.0 up
$ sudo upslug2 --device ethx
NSLU2 00:1a:70:99:60:c7 Product ID: 1 Protocol ID: 0 Firmware Version: R23V63 [0x2363]

$ sudo upslug2 --image /home/zrrbite/stuff/NSLU2_V23R63.bin (linksys default firmware)
Upgrading LKG9960C7 00:1a:70:99:60:c7
. original flash contents * packet timed out
! being erased - erased
u being upgraded U upgraded
v being verified V verified

Display:
+
Status:
* timeout occurred + sequence error detected

7fffff+000000 ...VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Rebooting... done


- Set the network protocol with the web interface before doing anything else, since this is what the NSLU2 will use when using the installer from various distros.

If you accidentally set the network settings to DHCP, use arp -a (works on both linux and windows) or a program like angry ip scanner, to locate the slug on the network segment.

Debian: http://www.cyrius.com/debian/nslu2/install.html

NSLU2 linux wiki: http://www.nslu2-linux.org/wiki/Main/HomePage

Add to sources.list to get unrar package:
deb http://http.us.debian.org/debian/ sarge main non-free contrib

apt-get update
apt-get install hellanzb
apt-get install unrar

edit /etc/hellanzb.conf PREFIX / usenet server and start daemon with "hellanzb"
dump nzb files in QUEUE dir with PSFTP (cd /home/mk/hellanzb/nzb/daemon.queue/ )

MT-DAAPD
(Firefly Media Server)

$apt-get install mt-daapd
$mkdir /home/media/music (dump music here)
$vim /etc/mt-daapd.conf
enable logging, change servername if you want, change port if needed, etc.
change runas user to someone with proper privilges (Root? :D)

$chmod o+r -R /home/media/music
$ /etc/init.d/mt-daapd restart

Repeat bold steps everytime music is added. Start iTunes. The server should show up in the left hand side under "Shared". a restart of the daemon will make the entry disappear and reappear on the fly.

Updating the songlist from cmd line may cause problems. Full system scan @ Web admin - http://192.168.1.xxx:3689/ will fix. Reload in iTunes.

Streaming 1 mp3 : 1,6% CPU, ~13% Memory.

TWONKY on Debian Lenny
Twonky supply these embedded (NAS) versions, as is, unsupported.

http://www.twonkyforum.com/unsupported/4.4.18/

Twonky arm little endian release is built against old glibc not supported by Lenny. Suggested to use the uclibc version. And download old uclibc tool chain.
http://www.twonkyforum.com/viewtopic.php?f=8&t=6086 -

http://www.uclibc.org/downloads/


Other Links:

http://www.cyrius.com/debian/nslu2/linux-on-flash.html

http://www.nslu2-linux.org/wiki/DebianSlug/OpenDebianSlug



Friday, October 09, 2009

Possible fixes to apt-get host resolution problems

/etc/nsswitch.conf :

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

Replace it with :

hosts: files dns

Restart network:

sudo /etc/init.d/networking restart

if !work , add to /etc/hosts :

91.189.88.46 ca.archive.ubuntu.com

Restart network again



---------

Check your "/etc/resolv.conf" file. It should have the name servers mentioned


nameserver 208.67.222.222
nameserver 208.67.220.220


That is all you need apart from configuring IP address on your machine.

To check if it works do the following. Type 'nslookup' and press enter:

> server


-------
ping -c2 74.125.45.100
route -nee

Wednesday, October 07, 2009

VMWare networking explained

http://www.extremetech.com/article2/0,2845,1156371,00.asp

Laptop dual-monitor on Linux

xorg.conf:

Extend the appropriate "Display" subsection with the resulting resolution of the two connecting screensizes

Virtual 3360 1050 ((2 x 1680) x 1050)

Restart X server - (Ctrl+alt+backspace)

Run xrandr to check which displays are present. VGA represents external screen. LVDS represents laptop.

xrandr --output VGA-0 --left-of LVDS
xrandr –output VGA-0 –mode 1680×1050

(Distro: Arch Linux)

Links:
http://bbs.archlinux.org/viewtopic.php?id=43138
http://intellinuxgraphics.org/dualhead.html
http://www.linuxquestions.org/questions/linux-general-1/xrandr-screen-cannot-be-larger-than-...-595649/

Wednesday, July 08, 2009

Building tomcat applications in Luntbuild

General:

Since luntbuild will execute any build scripts relative to it's own path in it's own execution environment, environment variables specified in windows won't be considered. You might want to reference these, to allow the script to be run manually without having to manage application locations.


$property environment="env"/$
$property file="tomcat.properties" prefix="tomcat"/$
(tomcat.properties specifies the entry: home=${env.CATALINA_HOME} )

In my case, tomcat.home will point to "C:\Program Files\Apache Software Foundation\Tomcat 5.5" when running the build script manually, and the same when i run it with luntbuild, because i inject CATALINA_HOME = "C:\Program Files\Apache Software Foundation\Tomcat 5.5" into the buildscript.

You could inject this as a value, but i like using environment variables for decoupling.

Also note that specifying a schedule that includes space seems to convince luntbuilt to look for a target in the script named the tail word of the schedule name?


Tomcat specifics:


Luntbuild specifies it's own servlet.api which contains the javax namespace. (Anything to do with servlets and Http). Builds will usually fail if you include tomcat's own servlet api since there will be a collission of jar's, as luntbuild imports it's own.

Inject a "mode" value into the buildscript through luntbuild and use ant conditions to check which jar to include. Both servlet api's work fine when building applications depending on these, manually.

Links
http://blog.exis.com/colin/archives/2005/08/23/i-put-a-spell-on-you-because-youre-mine-aka-why-is-tomcat-holding-onto-jars/
http://www.velocityreviews.com/forums/t139757-anyone-have-problems-with-tomcat-554-undeploy-ant-task.html
http://raibledesigns.com/wiki/Wiki.jsp?page=TomcatAntTasks

Monday, June 22, 2009

spine - note to self on discovery and tdma

RadioControllerP.nc optimization:

uint32_t LISTEN_TIMER = 40;

#define TDMA_FRAME_PERIOD 1024



spineapp Makefile: PFLAGS += -DTOSH_DATA_LENGTH=114 #set max datalength. 48 samples.
Basestation makefile: PFLAGS += -DTOSH_DATA_LENGTH=114


Inject ID into image: tos-set-symbols --target ihex main.ihex main_ID.ihex TOS_NODE_ID=ID ActiveMessageAddressC\$addr=ID


on 15.4:

The full standard 15.4 MAC/PHY protocol includes csma/ca and would work finebut spine does not sit on top of any 15.4 SW implementation and the 15.4 HW is not enough to guarantee the radio access.

Friday, May 22, 2009

Flash spine network of shimmer nodes + simple test app

* make shimmer install bsl, /dev/ttyUSB0 (/apps/BaseStation, /contrib/apps/SpineApp - as many sensors as required)

synchronize channel in makefiles:

#radio channel for TX-RX (spine default so change in BS)
PFLAGS += -DCC2420_DEF_CHANNEL=12


* Run tinyos software listener manually:
$ java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:shimmer

(you need to build libgetenv and libtoscomm from your tinyos before you can install and run any SPINE application.
cd $TOSROOT/support/sdk/java && make (if its not already built?)
sudo tos-install-jni ) - what spine doc means is that tos-install-jni will do the above for you, install libtoscomm in your java JRE

sometimes lobtoscomm-32.so and libgetenv.so aren't build.

If you have not installed the tools RPM and are working directly from the TinyOS CVS repository, you can manually install the tos-locate-jre script. Go to tinyos-2.x/tools/tinyos/java. If the directory has a Makefile in it, type make and (again, on Linux, as superuser) make install. If the directory does not have a Makefile, go to tinyos-2.x/tools and type:

$ ./Bootstrap
$ ./configure
$ make
$ make install

notice where the .so files get copied, and notice how they're named, and where the tos-install-jni script expects them to be. (search and edit)

finally do --- tos-install-jni

Now you can start the listeners

http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder#Cannot_find_JNI_error

)

tells Listen to use the serial port /dev/ttyS0 (on a UNIX machine) at the correct speed for a shimmer mote.

in general:   serial@*PORT*:*SPEED*

PORT depends on your platform and where you have plugged the mote in. For Windows/Cygwin platforms, it is COMN, where N is the port number. For Linux/UNIX machines, it is /dev/ttySN for a built-in serial port, or one of /dev/ttyUSBN or /dev/usb/tts/N for a serial-over-USB port. Additionally as we saw in lesson 1, on Linux you will typically need to make this serial port world writeable. As superuser, execute the following command:

chmod 666 serialport

*

One problem with directly using the serial port is that only one PC program can interact with the mote. Additionally, it requires you to run the application on the PC which is physically connected to the mote. The SerialForwarder tool is a simple way to remove both of these limitations.

Most generally, the SerialForwarder program opens a packet source and lets many applications connect to it over a TCP/IP stream in order to use that source. For example, you can run a SerialForwarder whose packet source is the serial port; instead of connecting to the serial port directly, applications connect to the SerialForwarder, which acts as a proxy to read and write packets. Since applications connect to SerialForwarder over TCP/IP, applications can connect over the Internet.

SerialForwarder is the second kind of packet source. A SerialForwarder source has this syntax:

sf@HOST:PORT

The first step is to run a SerialForwarder; since it takes one packet source and exports it as an sf source, it takes a packet source parameter just like the other tools we've used so far: you can pass a -comm parameter, use MOTECOM, or just rely on the default. Close your MsgReader application so that it no longer uses the serial port, and run a SerialForwarder:

java net.tinyos.sf.SerialForwarder (GUI)
set motecom to serial@/dev/ttyUSB0:shimmer

or

java net.tinyos.sf.SerialForwarder -port 9003 -comm sf@localhost:9002 (this last part is the source)
This command opens a second SerialForwarder, whose source is the first SerialForwarder. You'll see that the client count of the first one has increased to one. It's rare that you'd ever want to do this, but it demonstrates that in the message support libraries you can use a variety of packet sources.


(http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder)
* Spine_serverSide/defaults.properties :
MOTECOM=sf@127.0.0.1:9002 (supply this to tinyos )
LocalNodeAdapter_ClassName=spine.communication.tinyos.SFLocalNodeAdapter

* Run Spine_serverSide/test/SPINETest.java to test!


* VMWARE player - dhcp router? then set Ethernet to NAT and enable network. (eth1)


* Installation tips: http://docs.tinyos.net/index.php/Boomerang_Tmote_Linux_install

Monday, May 11, 2009

Coffee roast May 2009

4 new beans to try.

Rwanda : Horizon Nyamyumba
"Soft and delicious coffee with a good acidity. Lots of fruit - citrus & blackberry aswell as caramel"

Roast #1: A very small bean. Gave the roast 11 minutes at 220. It seemed to go very fast, but it turned out pretty light still. Alot of shells still attached to the beans. Roast#2 will be darker. Interesting to note that no crust formed on the surface. Tastes as advertised, altho the caramel is the most pungent flavor. Maybe a slight darker roast will bring out the rest.

Roast #2: This roast was 15 minutes. There's nothing to be nervous about. The bean can take it. Apparently, this is the reason why there was no crust on roast #1. A light roast is too heavy. Around 14 minutes, the bean started expulsing it's oils and a nice crust has been formed. The coffee is ALOT softer and the flavors are more apparent. A darker roast definately suits this bean. Delicious!

Roast #3+ : ^

Bolivia Primera : Asipai biolatina

"Good sweetness, creamy, pure citrussy with lots of chocolate"

Roast #1:
Roast #2:

Guatemala: Huehuetenango SHB
"Good body with lang, soft aftertaste of flowers and chocolate"

Roasted same day as the Kenya. I took it to the max, got the oils after second crack. Whole thing took about 14 minutes. I thought i'd made it too dark. Day 1 taste was... relatively tasteless, same as Kenya. Maybe dark roasts need to be cultivated longer.


Kenya: Gethubwini AA+

"Large, rich body with classic and wellbalanced acidity. Wonderful sweetness and the classic taste of blackberry anf flowery essence (roses)"

Roast #1: A bit inconsistent. Roasting took longer than expected. Ended up around 15 minutes
Roast #2: Very consistent. Upped the heat some to 230 degrees. First crack at 5-6, second at 10-11.

Taste: After day 1, i wasn't quite sure about this bean. I thought i'd roasted the fuck out of it, but after 3 days, the flavors have come out nicely!

Sunday, May 10, 2009

SHIMMER sensors in SPINE 1.2 on TinyOS

Quicknotes for Cygwin installation:
(TODO: Edit to be something remotely usable in the near future!)

* install cygwin

* install appropriate tinyOS rpm's ($ cd /cygdrive/*drive*/*packageloc* )
* tinyos-tools-1.3.0-1.cygwin.i386.rpm seems to install and compile javatooling for TinyOS including running "tos-install-jni"which installs 32-bit java JNI code into the appropriate JRE.
* The SHIMMER platform requires the TI MSP430 Tool packages. install them with the command 'rpm -ivh --ignoreos '. Without --ignoreos rpm tells you that the package was intended for a cygwin_nt5.1 OS. Warning: installing the gcc package on cygwin, you'll get an error if the current user isn't "TinyOS", and it'll revert to using "root". Unsure of the effect of this sofar.

* Setup permissions and environment
$chown -R /opt/tinyos-2.x
$chmod 666 /dev/ for all necessary devices

* Add to ~/.bashrc:
export TOSROOT=/opt/tinyos-2.x
export TOSDIR=$TOSROOT/tos
export CLASSPATH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar`
#export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:. (linux)
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:$PATH
export CLASSPATH="$CLASSPATH;."

* Check environment setup:
$ tos-check-env *

* Create a /contrib/ folder in $TOSHOME. Copy Spine_nodes from the Spine 1.2 dist into tinyos-2.x-contrib folder
* Compile application through a-d. (SENSORBOARD=*boardtype* make *platform*)

At this time, platforms supported by SPINE1.2 are
a. Telosb motes with spine sensor board
SENSORBOARD=spine make telosb
b. Telosb motes with biosensor sensor board
SENSORBOARD=biosensor make telosb
c. Micaz motes with mts300 board
SENSORBOARD=mts300 make micaz
d. shimmer motes
SENSORBOARD=shimmer make shimmer

Without SENSORBOARD defined, make gives you "error: SENSORBOARD not defined"

* Appropriate compilation units are compiled to "contrib\apps\SPINEApp\build\shimmer"
* app.c
* ident_flags.txt
* main.exe
* main.ihex
* tos_image.xml

* Spine app is defined by the following interface / module:
(detailed information about the tinyos app files http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS)


configuration SPINEApp_AppC {
}

implementation {
components MainC, SPINEApp_C;

components RadioControllerC;
components PacketManagerC;
components SpineStartPktC;
components SpineSetupSensorPktC;
components SpineFunctionReqPktC;
components SpineSetupFunctionPktC;

components new TimerMilliC() as Annce_timer;

components SensorsRegistryC;
components SensorBoardControllerC;

components FunctionManagerC;

SPINEApp_C.Boot -> MainC.Boot;

SPINEApp_C.RadioController -> RadioControllerC;
SPINEApp_C.PacketManager -> PacketManagerC;
SPINEApp_C.SpineStartPkt -> SpineStartPktC;
SPINEApp_C.SpineSetupSensorPkt -> SpineSetupSensorPktC;
SPINEApp_C.SpineFunctionReqPkt -> SpineFunctionReqPktC;
SPINEApp_C.SpineSetupFunctionPkt -> SpineSetupFunctionPktC;

SPINEApp_C.SensorsRegistry -> SensorsRegistryC;
SPINEApp_C.SensorBoardController -> SensorBoardControllerC;

SPINEApp_C.FunctionManager -> FunctionManagerC;

SPINEApp_C.Annce_timer -> Annce_timer;

}



* SERVER SIDE (JAva)

java coordinator applicationss implement the SPINEListener interface. Contains:

void dataReceived(int nodeID, Data data)
void discoveryCompleted(java.util.Vector activeNodes)
void newNodeDiscovered(Node newNode)
void serviceMessageReceived(int nodeID, ServiceMessage msg)


Then, the application can use any APIs exposed by the SPINEManager (see some doc somewhere!)


* Create documentation : SENSORBOARD=shimmer make shimmer docs
* docs will be placed in : contrib\doc\nesdoc\shimmer as html documentation
* docs makes use of Graphviz for generating a componentgraph. If it's not found "sh: dot : command not found". Install package from (http://www.graphviz.org/Download..php). But which one?


Compiling SPINE_ServerApp:
Copy $TOSROOT/support/sdk/java/tinyos.jar to /SPINE_ServerApp/ext-lib/
run "Ant"

If appropriate COMport isn't defined, following error is produced:

run:
[java] serial@COM65:115200 died - exiting (java.io.IOException: Could not open COM65: TOSComm JNI library runtime error: Error 2.
[java] The system cannot find the file specified.
[java] in NativeSerialPort.CreateFile)
[java] Exception in thread "Thread-1" org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
[java] at org.apache.tools.ant.types.Permissions$MySM.checkExit(Permissions.java:196)
[java] at java.lang.Runtime.exit(Runtime.java:88)
[java] at java.lang.System.exit(System.java:906)
[java] at net.tinyos.packet.PhoenixSource.error(PhoenixSource.java:221)
[java] at net.tinyos.packet.PhoenixSource.run(PhoenixSource.java:174)

* SIMULATION (TOSSIM)

* run "make micaz sim" from tinyos /apps folders (like Blink) (micaz is the only platform supported by TOSSIM currently). Might requires some of the other native compilers. and definately JAVA (1.5). Exports a python interface.

Links:

http://www.physionet.org/physiotools/cygwin/
http://docs.tinyos.net/index.php/Installing_TinyOS_2.1#Manual_installation_on_your_host_OS_with_RPMs (2.1.0)
http://www.tinyos.net/tinyos-2.x/doc/html/install-tinyos.html (2.0.2)
http://ragemaster.livejournal.com/112000.html
http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2007-February/022355.html
https://www.millennium.berkeley.edu/pipermail/tinyos-help/
http://docs.tinyos.net/index.php/TOSSIM

http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder

Saturday, May 02, 2009

Python: svn pre-commit hook

I put together a python svn pre-commit hook that does 2 things.

* Checks commit message syntax {, orphan} {baseline, tag, integrate}. If syntax does not comply with standards, commit is rejected.
* If syntax contains an activity-id, a ticket repository is checked to locate that specific id. Commit fails if id is not found. If repository connection fails (which shouldn't ever happen), commit is let through regardless.


__doc__ = """
iw_check_commit_messages.py
Utility for doing svn stuff.
"""

import os, string, sys, re, pg
from iw_connect import get_activity_ids #import connect method from iw_connect

SVNLOOK = 'C:\\Program Files\\svn-win32-1.4.5\\bin\\svnlook.exe' #location of SVNlook.exe
authors = {"mk" : "Martin Kjeldsen", "sas" : "Soren Ahm Sorensen", "jo": "Jens Olsen" } #list of fullname authors

syntax_ok = '^(ID|id):(\d+|orphan|baseline|activity|integrate)$' #regexp "tasks"
specifies_activity = '^(ID|id):(\d+)'

def do_lookup(repo,txn, cmd):
cmd = '"%s" %s -t %s %s' % (SVNLOOK, cmd, txn, repo)
result = os.popen(cmd, 'r').readline().rstrip('\n')
return result

def run_reg_exp_task(text, exp, mode):
expression = re.compile(exp)
if mode == "eval":
return expression.search(text) != None
elif mode == "getval":
return expression.search(text)

def parse_commit(repo, txn):
"""
This method parses the log assosiated with transaction txn and takes appropriate action
"""
author = do_lookup(repo,txn, "author") #Determine author
author_fullname = "".join([ v for k,v in authors.items() if k==author]) #if authors fullname isn't in authors dictionary, author is empty.
log_msg = do_lookup(repo,txn, "log") #determine log message

if(run_reg_exp_task(log_msg, syntax_ok, "eval")): #eval TASK: is syntax okay?
if not run_reg_exp_task(log_msg, specifies_activity, "eval"): #eval TASK: does it specify an activity?
sys.exit(0) #exit normally if syntax is okay and we're not dealing with activity id's.
else:
#activity_id = get_activity_id(log_msg) #check database for ID. extract it using a regular exp after it's been approven by the first.
activity_id = run_reg_exp_task(log_msg, specifies_activity, "getval").groups()[1] #get the id from the regexp result
ticket_repository = get_activity_ids() #get ticket repository
if ticket_repository == None: #NONE if connection fails. just commit it. Nothing else we can do. It already passed first test.
sys.exit(0)
elif activity_id in ticket_repository: #is log message activity id present?
sys.exit(0)
else: #reject revision
sys.stderr.write("Dear %s, your revision was rejected. You're trying to commit to an activity that doesn't exist (ID:%s). \n" % (author_fullname, activity_id))
sys.exit(1)
else:
sys.stderr.write("Dear %s, your revision was rejected. Syntax: \nLine 1: {ID|id}:{|orphan|baseline|tag|integrate}\nLine 2+:{Optional: Additional information about activity}" % (author_fullname))
sys.exit(1) #reject revision

if __name__ == "__main__":
print __doc__
if len(sys.argv) <>




__doc__ = """
iw_connect.py
Utility for connecting to a postgresdb using pygresql interface
"""

import os, string, sys, pg

iw_database = 'removed'
iw_host = 'removed'
iw_user = 'removed'
iw_passwd = 'removed'

iw_query = "removed"

def connect():
con = pg.connect(dbname=iw_database, host=iw_host, user=iw_user, passwd=iw_passwd)
return con

def get_activity_ids():
try:
con = connect() #connect to db: details specified in iw_connect.py
query = con.query(iw_query) #Run query to get id's to check in. refactor
ids = [str(v[0]) for v in query.getresult()] #convert result to set of strings
return ids
except pg.InternalError: #if connection fails, just commit it. Nothing else we can do. It already passed first test.
return None

Python: Postgres module import failure

 Traceback (most recent call last):
File "
", line 1, in
import pg
File "C:\Python26\Lib\site-packages\pg.py", line 21, in -toplevel-
from _pg import *
ImportError: DLL load failed: The specified module could not be found.


Solution:
Make sure the PostgreSQL C interface (libpq.dll) is installed or
its directory (\Postgresql\bin) is on PATH.

Thursday, March 26, 2009

On cubing: Quick notes on Edge Orientation (Incl. advanced setup)

1,3 = (M U M U M) U2 (M' U M' U M') U2

1,2,3,4 = (M'UM'UM'UM'U)(MUMUMUMU)

1,2,3,4, 8, 11 = (lUl'U)(lUl'U)(lUl'U)(lUl'U)(lUl'U)

1,3, 5, 6, 7, 8, 9, 11 = (dDrR)(dDrR)(dDrR)

Depending on the amount of flipped edges, it can pay off to apply an alg that fixes a great amount of edges and then fix the damage caused afterwards. This requires rememorization. Sometimes it can also pay off to create layers with 4 unfixed edges and do the necessary setup moves, if they are easy.

It also helps to look ahead when Using the layout 2,3,4,5,6,9 you could flip all U edges, which would now leave edge 1 unsolved but in return creates an entire F surface that can be fixed. Algorithms suting this scenario are shown below. If the layout of your cube is too far off the setups might become too complex, but the scenarios below are not unlikely.

2,3,4,5,6,9 : (M'UM'UM'UM'U)(MUMUMUMU) x (M'UM'UM'UM'U)(MUMUMUMU) x'

More mirror algs based on the above concept:

1,2,4,7,8,11: (M'UM'UM'UM'U)(MUMUMUMU) x' ( M'UM'UM'UM'U)(MUMUMUMU) x
1,2,3,5,8,12: (M'UM'UM'UM'U)(MUMUMUMU) z ( M'UM'UM'UM'U)(MUMUMUMU) z'
1,2,4,6,7,10: (M'UM'UM'UM'U)(MUMUMUMU) z' ( M'UM'UM'UM'U)(MUMUMUMU) z

Wednesday, March 25, 2009

On security: Authenticity

Problem

Two solutions can be employed in order for users to send requests R to a database for data and receive said data. Users have a private RSA key skA, and also know the public key of the database pkD. But one of these solutions has a security problem. Which?

  • The first solution involves the user encrypting R under D’s public key, appending his signature on the encrypted request (RSA = public key system = digital signature), and then appending his username A.
  • The second solution involves the user appending his signature on the request, encrypting this under D’s public key, and appending his username A.

Solution

First method

Using the first method the signature of the message is not encrypted with D’s public key, only the R. Since a User ID is also added to the message, unencrypted, a user B is able to intercept the message, sign it with his own signature, replace the existing User ID with his own, and send it to D. The database now takes A’s request, looks up B’s public key, encrypts the response and sends it to B instead of A. This was not supposed to happen.

Second method

The second method avoids this by encrypting everything with D’s public key and by doing so we maintain authenticity. We can therefore conclude that the second method is the most secure.

(solution to old assignment from dSik)

On security: One-time pads

Problem

We’re trying to compromise a One-Time Pad by applying facts we have about the original message. Bits 0-20 (LSB first) contain salary information. What we’re trying to do is to get the recipient of the salary an extra mill. A message will be mentioned as m, a key will be mentioned as k and a ciphertext will be mentioned as c.

Solution

What do we know? We know that the salary is encoded in m in bits 0-20, and we know that we get paid less than a million per month. This is enough information to manipulate m encoded with a One-Time pad! In binary 1 million has MSB 1, using our own encoded notation. We know
that the one-time pad uses XOR to generate c using k. Knowing the location of the MSB in the encoded message, and knowing what it should be, to get an extra million (1), we can change the original message to our liking. For example, if the bit corresponding to our salary MSB bit in c is 0, and we know that we do NOT get paid a million or more, then the corresponding bit in m should also be 0, which means the corresponding bit in k is 0 aswell. Now we can change the bit in c to our liking, 1, which adds a million to our salary.

One-time pad security

The only reason we have been able to compromise the One-Time Pad is because we have enough knowledge about m, to make certain changes. If we did not know anything about the original message, c would be total jibberish.

(solution to old assignment from dSik)

On Xfiles: Paper Clip

When Mulder and Scully, in the episode "Paper clip", go to the mining facility in west virginia and find all those medical records in what Mulder refers to as a "mountain vault", Scully makes a comment about the tissue sample boxes from 1955 being "old".

Having been abducted in 1994, her own medical records are on file, but with a newer tissue sample box made of plastic. She refers to the sample as having been taken "recently", judging by the tissue sample box, cementing the fact that it couldn't have been instated very long ago.

Now... When they check Samantha Mulders file, the tissue sample box is also a newer. Mulder was born in 1961, and Samantha was abducted when he was 12, meaning she was abducted in 1973.

18 years passed from 1955 to Samanthas abduction, and 21 years passed from Samanthas abduction to Scullys abduction. Either 21 years prior to her own abduction is "recent", according to Scully, or... they were keeping recent tissue samples of Samantha.

I was sure Fox Mulder would've noticed it this time, but he never does.

On Tabletennis : Review - Nittaku Narucross Ex Hard 2.2mm

In this micro-review, i'll be comparing the Nittaku Narucross Ex Hard 2.2mm to Joola Express Two 2.0mm, as FH rubbers.

Background:

For a while now, i've been playing with Express, on both sides of my blade. I feel that Express 1, on an all wood blade like W-6, serves me best as a BH rubber, and i still feel this way. Blocking and counter-hitting is a breeze, and sharp/flat loops down the BH line have become so much easier.

The Express 2, in the FH, also provided me with incredible stability in terms of blocking and counter-hitting. Express is by far the best rubber i've tried for this, no doubt. Both rubbers are incredible for short-play because of their hardness.

However, when being forced around the court, to the point where you need to stretch yourself to your limits to reach a ball, i was finding it hard to perform FH loops that weren't simply acts of desperation, but would allow me to get back into the point with a decent trajectory and lots of spin. Because of the speed/elasticity/hardness of the express, performing loops from that angle became extremely hard. So i began looking for something else that would allow me to improve that part of my game, well knowing that i'd be sacrificing some consistency in blocking/counter-hitting.

Nittaku Narucross Ex Hard 2.2mm:

I'm usually not a big fan of 2,2mm sponges, but i found this lying around at my local TT-store, and i couldn't stand for it lying there by it's lonesome. (I also got a sheet of Renaros Bright 2.2mm, that i'll be testing at some point).

Initial impressions

Topsheet - excellent quality. The tackiest new-tech rubber i've tried/seen. The nittaku protective sheet almost appeared to be wet, when i applied it to the rubber.

Rolling the ball around on the surface, you can feel the friction. Bouncing the ball, you can feel the crispy innards begging to come into play. Even at 2,2mm, you sense that it's somewhat slower than the Express 2 2mm, but the Express is by nature more explosive. Didn't come as a surprise to me.

Hardness - It feels about the same as the Express 2.

How does it play?

Blocking/counterhitting - The first thing i wanted to do, was to test it against the Express 2, because it's so brilliant at 2mm. The narucross seemed to lack the same crisp and consistent bounce, but it's by no means shabby. It keeps you on your toes because of the 2.2mm sponge combined with the hardness. You need to be a bit more active in your strokes which begs precision in execution. It's still a great blocking/counter-hitting rubber, and i'm definately going to keep it for further testing.

Looping - This is where it gets interesting. Brush looping is easier due to the tackier topsheet and slightly slower speed. Getting some crazy spinny angles on your FH loops is easier aswell, because of the exact same criteria. It seems to prefer a chinese style of looping. I was able to squeezy some power out of my loops that i didn't have the confidence to do with the Express, which isn't as forgiving. Narucross now offers me some increased stability in that department.

When chasing those balls at crazy angles, as i mentioned was one of my goals for this rubber, i was able , in full stretch, to put the ball back on the table with lots of spin and low trajectory, allowing me time to get back into the points. Big thumbs up.

Counter-looping - Excellent. There's alot of control in this rubber away from the table, i feel. Decent speed coupled with great spin and control will have you putting balls on the table for a long time. Counter-looping away from the table is mostly about keeping the ball in play, and the narucross offered some great improvements over the Express Two, i felt. Close to the table, i still feel the Express Two has the edge.

Smashing - As i've said earlier, it's a bit slower than the express, but it still packs quite a punch. I do prefer to twiddle my blade and smash with the more seemingly more powerful Express 1.

Conclusion

This one i'm keeping. On an all wood blade it provides some excellent play in every aspect of the game, while not being overly fast/bouncy. Adjusting to a more chinese style of looping, i felt it provided me with faster loops than ever. On odd angles, it provided me with a weapon to get back into the points. Hardness/speed allows for spinny and short services. I'll have to do some more testing, but right now i have nothing negative to say about it. Since it's made in germany, there may be durability issues but i'll get to that.

It didn't quite stack up to Express 2 in terms of blocking/counter hitting, but what's the difference between brilliant and more brilliant? It's not much.

On tabletennis : Review - Joola Express One

Joola Express One is like a good steak - Seemingly dull on the outside, packed with juice and an explosion of flavor on the inside.

Background

I'd been playing with TBS / Tenergy 05 for a while. Being a semi-EJ, i wasn't satisfied that something could play that good, and that i was to settle down with a blade and a rubber for more than a month. So, i placed an order for some Galaxy blades, in particular, the W-6, in order to explore the lower end of the speed scale of blades with massive amounts of control.

Let me just say that, for me, Tenergy and W-6 do not work together at all. The high throw of the rubber combined with the slow wooden blade was a poor combo for a powerlooper.

It just so happened that Joola Express was being sold at a, what seemed to be universal, discount. ~35% off. No way was i going to pass that up! I picked up a sheet of Joola Express One 2.0, still trying to maintain that control over speed.

Looks can be deceiving

The topsheet is very special. Unlike any other new-gen rubber. It's almost like it's glazed, and even after several practices/games, it's keeping that glaze which most of all reminds you of a metallic sort of varnish you'd expect to see on a car right out of the factory.

It didn't feel tacky at all, but you could almost sense the secrets lurking below the topsheet, in the green-power enabled sponge which is more or less white in color. With it's 47 degrees of hardness, simply bouncing a ball off the rubber gave an amazingly crisp sound on a wooden blade. I got fairly excited at this point. Too bad it was almost midnight and i was unable to go hit a few balls with it. I sensed alot of explosion begging to be let loose.


All aboard the Express train

First hit with the W-6 / Express One. You know that very first hit? You can always sense if something is sh*t, or if something has potential. I immediately got a good vibe from the Express One.

Having tried Tenergy / W-6 for a while, it took a while to get used to the lower throw, but once i did, i started realizing why some of the pro's played the Express One.

Here you have a rubber that's really hard, which is not only fast and spinny, but plays an extremely good short game and to top it off, is an amazing loopers rubber in all aspects. Brush loops are very controlled with low arches, faster controlled loops are the same, and finally, power drives are incredible spinny and fast. I've never had so many "winners" before, not even with the tenergy. The low throw, and topspin sends the ball zooming past your opponent at an incredible speed. It was hard for me to contain my joy at times.

Express vs Tenergy

As i mentioned, the throw is lower than Tenergy. It's faster and probably a bit less spinny. Control is about the same. Both play a brilliant short game. But where the difference is, is in the explosion. In all aspects of play, the Express one seems to be so controllable, with a consistent low throw that will keep your returns in check, not giving away any radicl opening chances.

Express train to victory

The first hit with the Express One that i mentioned earlier, was a christmas tourney at my club. I rode the express train straight to victory after an initial loss in the group-stage where i couldn't quite get used to the throw, and ended up winning the whole thing.

The Express One is an amazingly interesting rubber. I was quite surprised to find that a rubber could play this offensively on an ALL wood blade, but even more surprised to

For all you powerloopers outthere, check this sheet of glory out, you won't regret it.


Secret ingredient - Pure Green Power

I finally got the chance to get a few real practice sessions in with the Joola Express One @ TBS. Let me sum it up for you: This is an absolutely amazing combo. The first thing that struck me, and keeps striking me, is the similarity with a rubber like Joola Mambo Green Power.

Now i know what's lurking beneath the surface... it's the "Green Power", no doubt. The amount of control in the rubber on a carbon blade is astounding, just like what the mambo gives you. But not only do you get that control, you get explosive speed, spin and a low ball trajectory. It was an absolutely devestating combination. Power loops were easily controllable with either alot of power, and/or alot of spin. More focus on spin would actually put the ball close to the net, with great speed, but spinning out over the side of the table at an incredible angle. Absolutely incredible.

Flat hits are possible from anywhere, even from mid/far distance due to the high amount of control. I'm actually having a hard time describing the potential of this rubber - I'm really excited now that i've paired it with my TBS. And while i might sound like a bad ITTF commercial, there simply isn't much else to say, other than : Go try it out. Don't like it? Hey, you'd probably spend that money on beer anyway, and you're an experience wiser. There's a good chance you might end up with a really lethal weapon.

Final conclusions? This rubber is not a one trick pony. My experiments have been limited, but i've tried it at both ends of the speed scale, and it's performed admirably in both cases. Pure Green Power - and it's light. I've found my new best friend.

Goodbye Tenergy05, i hardly knew ye.

Monday, March 16, 2009

On CORBA : ORB Comparison - Orbix vs TAO

Introduction

This post describes installation, configuration guides for the CORBA ORBs IONA ORBIX Java ORB and PrismTech OpenFusion TAO C++ ORB. Test-programs using the client/server paradigm have been implemented for each ORB where a client calls a method on a servant 1000 times. In each case the duration of these calls were timed and the results are concluded upon at the end. Test-implementation of Java IDL as well as MiddCor C# ORB were used for comparison with no guides provided.

ORBIX Java ORB

Features

  • Interoperable CORBA Naming Service and load balancing extensions
  • CORBA 2.6-compliant (w. early support of CORBA 3.0 features)
  • Bidirectional GIOP for server callbacks
  • CORBA Reflection and dynamic type support


Installation and configuration

The installation and configuration procedure for the ORBIX Java Orb includes the following two steps:

  1. Installation of the ORB and services (optional) via the supplied GUI.
  2. Configuration of a domain which includes setting up ports, load balancing etc.
Before you start, you will need to download the ORB itself from IONA (http://www.iona.com) (registration is required), as well as request a license-key, which will be sent by email immediately.

  1. Go to IONA and create an account.
  2. Go to downloads and select ”Standard Orb”.
  3. Accept Terms. In the right column titled ”Obtain License” select ”Get your license”, new window will open, close it after mail has been sent.
  4. Select OS of choice from ”Download kit” column. Save the ORB!
  5. Unzip content to folder of choice.

A short and precise step-by-step installation and configuration guide can be found at IONA (http://www.iona.com/support/docs/orbix/6.3/install guide/index.htm). Installation is completed by following the steps in the sections ”Launching the installer” and ”Installing with the GUI”. Configuration is completed by following the steps in the section ”Configuring your environment”.

Example use

After installing and configuring your environment, the installer will have generated a script that sets up necessary environment variables. This script is located in /IONA/etc/bin and named _env.bat.

If you chose it during the installation, the installer also generated a script in the same directory that allows you to start selected services through a script. ORBIX includes some useful utilities for generating code that, by hand, can be tedious and error-prone. The utility idlgen uses what IONA calls ”genies”, and will from an IDL file, generate client/server skeletons as well as an ant-build file used by IONAs own ant utility : itant.

By running the idlgen command: idlgen java poa genie.tcl -all -jP my_package hello.idl. The -all parameter will ensure that idlgen generates server/client/ant-buildscript. No stubs have been generated for the IDL just yet. This is done by running itant build_all in the base-dir where you ran idlgen. This will call the idl enterpreter and generate stubs and also modify the build-script to include tasks that will start both server and client.

This example use is simplified, and through the idlgen command it is possible to configure the generated code to support certain POA policies, use of naming server, among other things.

Running the test code

  1. Extract the file orbix test.zip somewhere.
  2. In a command prompt, execute the environment script generated by the ORBIX installerfor your domain.
  3. In a command prompt, traverse to the extraction dir and type itant build all. Then type itant runserver.
  4. In a new command prompt, traverse to the extraction dir and type itant runclient.



OpenFusion TAO ORB

Orb installation

Sign up for an account at PrismTech (http://www.prismtech.com) before proceeding. This is necessary in order to download the Orb. When this is done follow these steps in order to install the orb successfully:

  1. Download the OpenFusion TAO orb for the windows XP platform.
  2. Unzip the orb files in a directory of your choice, eg. C:\Orbs\TAO.
  3. In order for the orb to operate correctly three environment variables must be set. First enter the environment variables configuration by right clicking ”My Computer” and selecting properties. Then switch to the ”Advanced” tab and select ”Environment variables”.
  4. Create a new variable called ACE ROOT and set the value to the install dir of the orb, in this case C:\Orbs\TAO
  5. Create another variable called TAO ROOT and set the value to the install dir of the orb, also C:\Orbs\TAO
  6. The last variable is called TAO IDL and this must point to the tao idl.exe file in the bin directory of the orb installation, in this case C:\Orbs\TAO\bin\tao idl.exe
  7. Lastly expand the PATH variable to include the bin and the lib directory of orb installation. The path would then look like this: ;C:\Orbs\TAO\bin;C:\Orbs\TAO\lib
The orbs should now be installed and be ready for use in any VC++ 6.0 solution. Note that the above installation guide assumes the target OS is a Windows OS. If this however is not the case, refer to the accompanying orb documentation.

Issues

It is important to know that this release of the OpenFusion TAO orb only supports Microsoft Visual Studio C++ 6.0. It was not possible to get it working under the newer release Visual Studio 2005. The reason for this is probably that the compilers from these two release are somewhat different. Since the release of Visual Studio 6.0 .Net framework support has been added to the compilers and this might have some effect when linking with the orb libraries. It was also not possible to get a debug version running with the TAO orb, since the release we were able to acquire only contained the release libraries and not the debug libraries.

Running the test code

The supplied test code performs a simple test. It transmits a short string from a client to a server and then back again 1000 times and calculates the amount of time this took. It is primarily to determine if the orb is working and if it is, how fast it is to get some comparison data. The following steps will explain how to perform the test. Beware that the supplied code will only work if compiled with the VC++ 6.0 compiler.

  1. Open the solution file in VC++ 6.0 and compile a release version of the server and the client.
  2. Open a command prompt and navigate to where the server executable is located and type in ”server -o registry.ior”.
  3. Open another command prompt and navigate to where the client executable is located and type in ”client -f registry.ior”.
  4. The test runs and the client prints out how long it took to perform the 1000 calls.
  5. Terminate the server.


Conclusions

The clients send and receive simple and the tests were executed 7 times and a mean value of the resulting execution times was found.

MiddCor : 319.7 ms
ORBIX : 553.8 ms
JAVA IDL : 1583.8 ms
TAO: 348.6ms

In the cases of the Java based ORBs, the first executions of the test resulted in high execution times possibly due to something VM related. In the cases of the C++ and C# based ORBs, execution times were somewhat steady through all executions

Thursday, February 26, 2009

Friday, January 30, 2009

Terminal server stuff

http://technet.microsoft.com/en-us/library/cc783401.aspx ( Licensing overview)

Terminal Server has its own method for licensing clients that log on to terminal servers, separate from the licensing method for Microsoft® Windows Server 2003 family operating system clients. When a client connects to a terminal server, the terminal server determines if a client access license (CAL) is needed. The terminal server then requests a CAL from the Terminal Server license server, and then the CAL is issued to the client by the terminal server. Although Terminal Server provides a licensing grace period during which no license server is required, after the grace period ends, clients must receive a valid CAL issued by a license server before they can log on to a terminal server.

Guidelines : http://www.microsoft.com/windowsserver2003/techinfo/overview/quickstart.mspx:

http://technet.microsoft.com/en-us/library/cc758069.aspx : How to install

http://support.microsoft.com/kb/823313 : Licensing issues

http://technet.microsoft.com/en-us/library/cc727929.aspx : Program multisession compatibility.

http://technet.microsoft.com/en-us/library/cc781487.aspx : Make your local printer available in a session

http://technet.microsoft.com/en-us/library/cc786890.aspx: Configuring terminal services with group policy


Terminal Services Configuration

http://technet.microsoft.com/en-us/library/cc787078.aspx

You can configure new connections for Terminal Services, modify the settings of existing connections, and delete connections by using the Terminal Services Configuration tool (TSCC.msc) or Group Policy (gpedit.msc).

Tuesday, January 20, 2009

Remote desktop stuff

http://www.microsoft.com/windowsxp/using/mobility/getstarted/remoteintro.mspx

Multiple RD machines on a simple NAT router:
  • HKEY_LOCAL_MACHINE
  • System
  • CurrentControlSet
  • Control
  • TerminalServer
  • WinStations
  • RDP-TCP (Change port to whatever: 3389 -> 3xxx )
- Remember to port forward each port to their designated LAN IP's.
- Connect using that particular port: x.x.x.x:3390 -> 3xxx
- Allow new ports in firewall.

Followers