Wednesday, December 19, 2012

AnkhSVN doesn't work in VS2010

I'm a long time user of AnkhSVN, but suddenly it was gone in Visual Studio 2010, in VS2008 it stilled worked, bummer!
I tried to Repair the installation, remove and reinstall it but no sign of AnkhSVN in VS2010.

After a bit of searching, I found the answer.
Somehow the default 'Current source control plug-in' had been set to 'Visual Studio Team Foundation Server' instead of AnkhSVN.


Thursday, December 06, 2012

XML Special Characters

I always fail to keep track of what you can and cannot type in XML.
So here is a short list:

" replace with " or 
& replace with & or 
' replace with ' or 
<  replace with &lt; or &#003C;
> replace with &gt; or &#003E;

See more at http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

Example
<dummy comment="my 'special' char " >
You then convert it to
<dummy comment="my &apos;special&apos; char " >

Here is a code example converting:
    Private Function encodeXMLEntry(ByVal inData As String) As String
        Dim x As String = inData

        ' Replace special characters, start with & for obvious reasons.
        x = x.Replace("&", "&amp;")
        x = x.Replace("""", "&quot;")
        x = x.Replace("'", "&apos;")
        x = x.Replace("<", "&lt;")
        x = x.Replace(">", "&gt;")

        ' return the escaped string
        Return x
    End Function

Thursday, September 20, 2012

Apache Hostnamelookups problems.

I got a Ubuntu 12.04 apache2 server running. Suddenly there where hostnames instead of IP-addresses
in the logfiles. The directive Hostnamelookups was set to 'off' in all config files i could find. The server had previously logged using IP-addresses, what's up?

Problem found:
I add blocking of usually Chines client trying to hack the server by block the ISP range they comes from.
Normally I add 
deny from 123.123.123.0/24
to block out a certain range of IP's, but its not so fun to calculate ranges so I had added
deny from 123.123.123.0 - 123.123.123.255
instead.
Apache didn't complain so I though it was smart enough to interpret that as a range but it wasn't. Instead it tries to look it up as a hostname.
So now you know if you Apache server starts to log hostnames instead of IP-addresses, you screwed up.

Sunday, July 22, 2012

Raspberry Pi (Wheezy)

A new distribution is now available Debian-Wheezy for the Raspberry pi.
It has a startup configuration menu to make life easier to setup your RPI.

ssh problems:
But I screwed up when configuring ssh.
So after trying to get it to work, I got it running by
Uninstalling it (sudo apt-get remove openssh-server)
remove all files in /etc/ssh (where the encryption keys are stored)
Installed it again (sudo apt-get install openssh-server)

Samba Client:
Trying to connect to my samba server failed,
in filemanager smb://192.168.0.2/ gave an error 'Operation not supported'
Problem1 was that smbclient wasn't installed so (sudo apt-get install smbclient)
but problem is still there :(
Tried to reinstall cifs-utils that is used to connect to remote samba servers, but it didn't help.
I can use smbclient to connect to the samba server, but filemanager (pcmanfm) still complain when entering smb:// addresses.

Music Player:
The music player you got in Sqeezy wasn't installed as defalt so
(sudo apt-get install lxmusic) fixed that problem.


Wednesday, July 11, 2012

Raspberry Pi

I finally got my Raspberry Pi delivered.
Here are some good links I found:

 I'm using Debian Squeeze as my OS.

http://elinux.org/R-Pi_Hub where you find info about hardware and some troubleshooting tips.

Bug-fix: Root Application doesn't work: Run
gconftool-2 -\-type bool -\-set /apps/gksu/sudo-mode true
link 

Set DateTime: Run
date 07111533
This will set date to 11 July time 15:33 
or use 
sudo dpkg-reconfigure tzdata  link


Change keyboard language (I got a Swedish keyboard)
Edit /etc/default/keyboard as root
change XKBLAYOUT="gb" to your language, in my case XKBLAYOUT="se"
restart your RPI.

Enabling Sound (its default disabled in squeeze)
sudo apt-get install alsa-utils
sudo modprobe snd_bcm2835
 
enabling ssh
sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc 
 
Resizing partitions on the SD card:
Take out your SD card and put in in a SD reader on a Linux machine.
Open Gparted and select the SD card, move the swap partition to the end, then
re-size the / partion to fill up the empty space.

Quicker boot time:
After booting up and logged in run:
sudo setupcon
This make a much quicker boot next time.

How to access IO pins: link

Controlling I/O s from python
http://pypi.python.org/pypi/RPi.GPIO/0.3.0a 
(works great)

Tuesday, June 12, 2012

Sunday, June 03, 2012

StumbleUpon

If you don't have the add-on StumbleUpon in Firefox, get it.
Here are my favorite StumbleUpon's
http://cdn.stumble-upon.com/stumbler/malamsson/

Monday, May 28, 2012

Ping in VB.Net

I found two ways to Ping from vb.net.
A simple:
 Dim txt As String = Now + " - " + txtIPaddress.Text + " - "
 If My.Computer.Network.Ping(txtIPaddress.Text) Then
     Debug.Print(txt + "success")
 Else
     Debug.Print(txt + "no reply")
 End If

And a more thorough where you get more data back in PingReply:

   
  Dim txt As String = Now + " - " + txtIPaddress.Text + " - "
 Dim zz As System.Net.NetworkInformation.PingReply
 Dim xx As New System.Net.NetworkInformation.Ping
 zz = xx.Send(txtIPaddress.Text)
 Debug.Print(zz.Status.ToString)

Tuesday, February 28, 2012

How to list tables in a sqlite database.

the following query will list the tables in a sqlite database.
SELECT name FROM sqlite_master
WHERE type='table'
ORDER BY name;

Wednesday, January 11, 2012

Vb.net String.Split(vbCrLf) problem

You got a text that you want to split in rows at CrLf so you code the following:

Dim MyText as String = "bla bla" + vbCrLf + "more blabla" + vbCrLf +"stop blabla"
dim s() as String = MyText.split(vbCrLf)

You expect to get s(1)="more blabla" but you will get CrLf + 'more blabla'

The text got split BUT you also got a CrLf in the splits.
To avoid this Replace vbCrLf with
Dim CrLf() as char = {vbCr,vbLf}
So the split commando will be
dim s() as String = MyText.split(CrLf)
and now s(1) will be 'more blabla'

OR

Do as 'Anonymous' pointed out in the comments:
 Dim s() As String = MyText.Split(New String() {vbCrLf}, StringSplitOptions.None)

MySQL to MariaDB

 Here is a good description how to migrate to MariaDb MySQL to MariaDb Example of how to dump data from MySQL port=3307: mysqldump --user=ro...