June 29, 2011

Windows CE c# .Net An error message cannot be displayed because an optional resource assembly containing it cannot be found.

Copy this cab file to your CE device, double-click to install it on your CE device,and now you should have the detailed debug messages now.

If anyone is still having this issue the cab file you are looking for, for CF2 is actually in
"C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\Diagnostics"
I am running WM5 with messaing and security pack and the cab required was System_SR_ENU.CAB and not the System_SR_ENU_wm.CAB version

There is also a stack overflow question with the same answer

June 27, 2011

popular free http proxy software

1. Privoxy, block ads
2. polipo, fast light-weight proxy
3. squid, heavy-duty enterprise proxy
4. tinyproxy

All are Free and Open Source software

I use tinyproxy most of the time, and it works great.

June 20, 2011

How to use curl to upload a file

curl -F "myfile=@testfile.exe" http://123.45.5.6/test/upload.php

June 17, 2011

A fairly new comparison of openswan and strongswan

Openswan vs strongSwan


From the beginning of my VPN project, I knew about strongSwan... but I stuck to Openswan because that’s what is covered in the Openswan book I bought and read.

After perusing the strongSwan website for a few minutes, one thing became apparent: the strongSwan project has superior documentation. The comparison isn’t even close; most of the Openswan documentation hasn’t been updated in years; it often refers to Openswan 3.0 - a branch on which development has stopped for at least 3 years, if its git repository is accurate.

Additionally, when I looked at features, a few trends emerged:
  • Openswan moved in the direction of the networking industry
    • And as a result, supports aggressive mode (which the Openswan devs ask you not to use).
    • Openswan supports the legacy KLIPS IPsec kernel stack.
  • strongSwan is interested in authentication and security:
    • No surprise, given its originator provided the x.509 patch.
      • strongSwan has better support for authentication mechanisms in general
      • Supports EAP methods, including EAP-RADIUS
      • PKCS#11 smart cards
  • strongSwan only supports KLIPS on 2.4 linux kernels; if you’re running 2.6, they use the in-kernel NETKEY IPsec stack.
  • strongSwan also supports the new IKEv2 standard (and interoperates well with other IKEv2 implementations.
    • IKEv2 allows for automatic IP address assignment, DNS assignment, and routing.
    • IKEv2 is in its infancy in Openswan.
  • strongSwan aupports Mobility and Multihomed IKEv2 (also known as MOBIKE)
  • strongSwan supports additional ciphers, such as TwoFish, and elliptic curve crypto.
  • strongSwan is modular (vs. Openswan’s monolithic nature)
  • strongSwan also has IP address pools/assignment with IKEv1, which is not offered by Openswan.

With the data available to me, strongSwan looks like the clear winner. About the only thing I’ve heard about that Openswan does that strongSwan doesn’t are:
  • KLIPS/MAST on 2.6 kernels
    • This allows (with a patched & recompiled kernel) some NAT mapping that doesn’t work well with the NETKEY stack. Cases where NAT clients have the same “internal” IP address as the server, or each other have problems with NETKEY currently.
  • IKEv1 Aggressive mode: Which is something that even the Openswan developers suggest you avoid if at all possible.

June 10, 2011

Cross compile wget on Linux for Windows

GNU wget does not release binary on Windows, and it is not very straight-forward to compile for Windows, but it works great on Windows. I just compiled wget 1.12 for Windows. Please DOWNLOAD IT HERE

I did this on Debian 5.0, and I have the following mingw package installed (not https supported, shouldn't be hard to add if you want to compile the openssl):

dpkg -l | grep -i mingw
ii  mingw32                   4.2.1.dfsg-1                       Minimalist GNU win32 (cross) compiler
ii  mingw32-binutils          2.18.50-20080109-1                 Minimalist GNU win32 (cross) binutils
ii  mingw32-runtime           3.13-1                             Minimalist GNU win32 (cross) runtime

This is how to compile wget for Windows on a Linux host using the MingW32 for Linux tool chain

1. download the gnu wget source at http://www.gnu.org/software/wget/
2. tar zxvf wget-1.12.tgz;  cd wget-1.12; 
3. ./configure CC=i586-mingw32msvc-gcc AR=i586-mingw32msvc-ar RANLIB=i586-mingw32msvc-ranlib --disable-ipv6 --host=mingw32
4. change "src/config.h" to add 
           #define WINDOWS 1
           #define INHIBIT_WRAP 1
   and comment out these two lines:
           //#define HAVE_SYMLINK 1
           //#define HAVE_USLEEP 1
4.1 comment out "src/host.c" line 67
           //extern int h_errno;
5. vi src/Makefile, add "mswindows.o" to the end of the "am_wget_OBJECTS" assignment
6. search for "LIBS =", and append "-l ws2_32 -s"
7. Make

The wget.exe file is located in src/wget.exe

Enjoy!

June 8, 2011

vsftpd config file

anonymous_enable=YES
listen_port=34567
anon_root=/tmp/ftproot
run_as_launching_user=YES
pasv_promiscuous=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
dirmessage_enable=YES
xferlog_enable=NO
connect_from_port_20=YES
listen=YES

June 7, 2011

persistent ssh tunnel

MyEnTunnel

Work really well. It retries to connect after the ssh session is disconnected.

June 2, 2011

Windows CE static IP registry setting

; Enable static IP address for VMINI1
[HKEY_LOCAL_MACHINE\Comm\VMINI1\Parms\Tcpip]
"EnableDHCP"=dword:0 ; Disable the DHCP/ enable static IP
"IPAddress"="192.168.1.3"
"SubnetMask"="255.255.255.0"
Note : VMINI1 is the correct key path to point to the registry settings used by this driver.
VMINI is the adapter name

source: http://nicolasbesson.blogspot.com/2007/11/static-ip-address-for-kitl-vmini.html

May 31, 2011

hostapd madwifi in ap mode

If you are using hostapd, and hostpad is showing the following error:

ioctl[IEEE80211_IOCTL_DELKEY]: Invalid argument
ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument


Try to add :
wme_enabled=0
in hostapd.conf

This is documented in http://madwifi-project.org/ticket/1561 and it worked for me.

May 25, 2011

udp port forward

------
Option 1: user-application based udp port forwarding

Ivan Tikhonov wrote a simple udp_redirect.c program to do just this. I like it.

The link: http://brokestream.com/udp_redirect.html

-------------

Option 2 is to use iptables.

You will need to set the middle computer (Linux) to
1. NAT
2. port forward to the local computer

iptables -t nat -A POSTROUTING -j MASQUERADE -o eth0
iptables -t nat -A PREROUTING -p udp -i eth0 --dport 161  -j DNAT --to 192.168.1.10


Then set the local computer's default gateway to the middle computer:

route add default gw 192.168.1.100

------------
If you are looking for TCP port forwarding, I use and recommend the open source program rinetd. It works on both Windows and Linux, and supports multiple TCP connections, and is very stable. The link: http://www.boutell.com/rinetd/

php internal server error

If you just see a blank page instead of an error reporting and you have no server access so you can't edit php configuration files like php.ini try this:

- create a new file in which you include the faulty script:

<?php
 error_reporting
(E_ALL);
 
ini_set("display_errors", 1);
 include(
"file_with_errors.php");
?>

- execute this file instead of the faulty script file

now errors of your faulty script should be reported.
this works fine with me. hope it solves your problem as well!

May 20, 2011

Ubuntu Host, Windows 7 Guest, Raw disk, Virtual Box

Command in Ubuntu to create the win7 virtual machine using the raw disk Windows 7 partition that comes with the Dell computer.


This is tested on Virtual Box 4.0.4
Make sure you run everything as root
Make sure you use "IDE controller" type ICH6, otherwise the win7 will blue screen (BSOD)


This is based on the following blogs:
http://www.rajatarya.com/website/taming-windows-virtualbox-vm
http://www.researchut.com/site/virtualbox-native-partition

First install Virtualbox. I found it easier to install it using the "all platform" exectuable. Make sure you also download and install the Oracle Extension Package, which is installed using this command:
 VBoxManage extpack install Extention_file_name


Then do the following commands: make sure you are root, and you are at "/root".


----------------
VBoxManage createvm --name win7 --ostype Windows7_64 --register
 
VBoxManage modifyvm "win7" --memory 1024 --acpi on --boot1 disk --nic1 nat

 
VBoxManage storagectl "win7" --name "IDE Controller"   --add ide --controller ICH6

 
VBoxManage internalcommands createrawvmdk -filename /root/win7.vmdk -rawdisk /dev/sda -partitions 1,2,3 -mbr /root/vm.mbr -relative

 
VBoxManage storageattach win7 --storagectl "IDE Controller"  --port 0 --device 0 --type hdd --medium /root/win7.vmdk



------ Other useful commands------------

vboxmanage unregistervm win7 --delete

VBoxManage storageattach win7 --storagectl "IDE Controller"  --port 0 --device 1 --type dvddrive --medium "/root/Windows 7 64-bit Repair Disc.iso"

VBoxManage storageattach win7 --storagectl "IDE Controller"  --port 0 --device 1 --type dvddrive --medium /opt/VirtualBox/additions/VBoxGuestAdditions.iso


vboxmanage controlvm win7 reset


----If you still cannot boot your Windows 7, try to use the Windows 7 Rescue image to fix it. Use the above "vboxmanage" command to attach the repair disk ISO file and hit F12 when vbox boots to boot from CD, let it fixes it and then boot to regular Win7

May 19, 2011

boot Windows in Virtualbox

Use Xmount + Opengates, for MAC users, use openjobs

https://www.pinguin.lu/index.php

May 18, 2011

Headless Virtualbox on Ubuntu 10.04 LTS

Updated Scripts (06/07/2012):

VBoxManage createvm -name centos6 --ostype RedHat -register
VBoxManage modifyvm centos6 --memory 1024 --pae on --acpi on --boot1 dvd --nic1 nat --natpf1 "guestssh,tcp,,2222,,22"
VBoxManage modifyvm centos6 --natpf1 "www,tcp,,1888,,80"
VBoxManage storagectl centos6 --name IDE0 --add ide --controller ICH6
VBoxManage createhd -filename ~/centos6/sda.vdi -size 20000
VBoxManage storageattach centos6 --storagectl IDE0 --port 0 --device 0 --type hdd --medium ~/centos6/sda.vdi
VBoxManage storageattach centos6 --storagectl IDE0 --port 1 --device 0 --type dvddrive --medium ~/bigfiles/CentOS-6.2-i386-minimal.iso

To enable VRDE:


VBoxManage modifyvm centos6 --vrde on --vrdeport 3392

After installation is finished, boot hdd:
VBoxManage modifyvm centos6 --boot1 disk

To add hostonly interface:
# sudo tunctl -u $USER # add tap0 device
# sudo ifconfig tap0 192.168.100.1 netmask 255.255.255.0
VBoxManage modifyvm centos6 --nic2 hostonly --hostonlyadapter2 tap0

To add the second interface as bridged interface:

VBoxManage modifyvm centos6 --nic2 bridged --bridgeadapter2 eth0

Original Post:
http://tuxnetworks.blogspot.com/2010/05/howto-virtualbox-31-headless-on-lucid.html

That's it, Virtualbox should be installed and ready to go.
Now we can move on to creating a virtual machine
Create a machine named "io"

VBoxManage createvm -name io --ostype Ubuntu -register

Configure it with a nic bridged to eth0, 256Mb RAM, enable acpi and set to boot from DVD

VBoxManage modifyvm io --memory 256 --pae on --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0

Create a virtual IDE controller

VBoxManage storagectl io --name IDE0 --add ide

Create a virtual HDD

VBoxManage createvdi -filename ~/.VirtualBox/Machines/io/sda.vdi -size 48000 -register

Attach the virtual HDD

VBoxManage storageattach io --storagectl IDE0 --port 0 --device 0 --type hdd --medium ~/.VirtualBox/Machines/io/sda.vdi

Create and attach a virtual DVD drive to the controller and insert the DVD image

VBoxManage storageattach io --storagectl IDE0 --port 1 --device 0 --type dvddrive --medium /store/archive/ISO/ubuntu-10.04-server-i386.iso

The default vrdp port for machines is 3389, however, if you intend to run more than one guest then each one will need to listen on a different port. I use the 3xxx range with the xxx being the last octet of the machines IP address. For example, 192.168.0.1 would be 3001.

VBoxManage modifyvm io --vrdpport 3001

And thats it, your machine has been created. Time to start it up and give it a test drive!

Using the virtual machine

Start the machine

nohup VBoxHeadless -startvm io &

On a GUI workstation, establish a remote desktop connection to the machine. In my case, the host server is called "jupiter" so I type;

rdesktop -a 8 jupiter:3001

After you have installed the OS, you need to tell the machine to boot from the hdd.

VBoxManage modifyvm io --boot1 disk

You can also deregister the dvd image if you don't intend to use it again.

VBoxManage unregisterimage dvd /store/archive/ISO/ubuntu-10.04-server-i386.iso

To Stop VM/Hibernate/Save Sate:

vboxmanage controlvm centos6 savestate

To Power Off VM:
vboxmanage controlvm centos6 poweroff


Here are some other useful commands;

VBoxManage showvminfo io
VBoxManage list hdds
VBoxManage list runningvms
VBoxManage controlvm io poweroff
VBoxManage unregistervm io --delete
VBoxManage controlvm io savestate
VBoxManage closemedium disk UUID
VBoxManage modifyhd UUID --type immutable

May 17, 2011

Linux Command Line FTP/HTTP segemented download accelartor software

  1. aria2c

  2. axel

  3. lftp (use the "pget" command of lftp)

     

    ari2c and axel supports FTP, HTTP and HTTPS, while lftp supports more protocols such as FTPS, SFTP, etc.

May 16, 2011

/etc/hosts not working?

If you have a Linux machine and your /etc/hosts is not working, make sure you have a file called

/etc/nsswitch.conf 
 
with the following content: 
 
passwd:         files
group:          files
hosts:          files dns
networks:       files dns
services:       files
protocols:      files
netmasks:       files

May 13, 2011

Windows CE 5.0 QFE download

Microsoft has moved on to Windows CE 7 (Compact 7) and revamped their download site so that all the windows CE 5.0 downloads cannot be located anymore.

To patch your platform builder 5.0 to the latest, download the "rollup" files from here:

http://www.microsoft.com/windowsembedded/en-us/downloads/download-windows-embedded-ce-5.aspx

Once you installed any QFE, you will have a application called CEQFECHECK.exe  under C:\WINDOWS\system32\ceqfecheck. This application checks which QFE you have installed and did not install. Check it out.

April 18, 2011

jQuery TableSorter "o is undefined" problem

If you use jQuery TableSorter and see the "o is undefined" problem, it is the probably the case that you are using "<td>" inside the <thead> section instead of <th>. Use <th> and you will be good.