Change location of My documents with regedit

By Nisse Pettersson at May 17, 2010 11:18
Filed Under: Technical
Share on Facebook

This is something that i've came across alot of times and I think it's about time I wrote a blog post on this. It's a verry easy fix but just a tip. Use a policy if you have the ability. This is for Windows XP

In regedit change the following key.
HKEY_LOCAL_MACHINE / Software / Microsoft / Windows / Current Version / Explorer / DocFolderPaths
There is a key with the path to the folder. Change that and reboot.

That should do the trick!



How to Vyatta firewall

By Nisse Pettersson at March 16, 2010 11:13
Filed Under: Technical
Share on Facebook

When ever i'm in need of a software firewall / router I use Vyatta.  A advanced firewall and still rather easy to setup. I'm going to have my latest setup as an example. I'm setting up a development enviroment for deployment of Windows7 and WindowsXP. I'm using the latest version of VmWare vsphere 4.

Setup

Download the ISO from the download section. Then you need to create a new virtual machine and give it some diskspace and ram. I gave it 200mb of disk and 128mb of RAM. This is up to you and what type of load is expected. Remember to add two network interfaces and set the type to e1000. One for outside and one for inside.

Start the machine and mount the ISO you downloaded.

When the system boots you will be greeted with the text

vyatta login:

Logon as root and with vyatta as password.

We now need to install vyatta on the diskdrive instead of the ISO. So type the following.

install-system

 Follow the instructions on the screen. Now the fun parts starts. Now we need to go in configuration mode(ie. enable in Cisco CLI) Write the following.

vyatta@vyatta:~$ configure
[edit]
vyatta@vyatta# set interfaces ethernet eth0 address 192.168.1.81/24
[edit]
vyatta@vyatta# commit
[edit]
vyatta@vyatta# exit
exit
vyatta@vyatta:~$

This will set the first network interface(eth0) to have address 192.168.1.81 with netmask 255.255.255.0
Then commit will save this to the running configuration. Exit will leave the configuration mode.
We now need to set up the inside interface. Use the syntax above but change the IP and eth0 to eth1.
Vyatta firewall should now respond to pings from computers on the same network and in the same subnet.

NAT

set service nat rule 1 outbound-interface eth0
set service nat rule 1 source address 10.1.1.0/24
set service nat rule 1 type masquerade

This will is a generic NAT route that sends all traffic that's outbound(not in the same subnet) to the outbound-interface. And we tell it that outside interface is eth0. This will only apply if the source network is 10.1.1.0/24(our inside network)
I like PuTTy and SSH in general so I will add a second NAT rule for SSH.

set service nat rule 2
set service nat rule 2 type destination
set service nat rule 2 inbound-interface eth0
set service nat rule 2 protocol tcp
set service nat rule 2 destination address 0.0.0.0/0
set service nat rule 2 destination port ssh
set service nat rule 2 source address 0.0.0.0/0
set service nat rule 2 inside-address address 10.1.1.1

Don't forget to save you changes to the running configuration.

commit

 

Then you need to save this to the statup config, this is done with the following command.

save
Saing configuration to '/opt/vyatta/etc/config/config.boot' ...
Done

 

You now have a vyatta firewall running as a router. There is a lot of things you can do with this so I suggest you read the documentation as I do. Will return to this topic when I have something interesting to write about.

Technorati-taggar: ,,,


How to connect Outlook 2003 to a domino mail account

By Nisse Pettersson at February 22, 2010 09:42
Filed Under: Technical
Share on Facebook

I'm not a big fan of Notes and I wish to use Outlook at my new job. So I did some google search and found a connector and a registry hack that you need to do before installation.

Step 1.
Modify the registry
[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\O utlook\Options\General]
"UnknownRowsSortOrder"=dword:00000001

Step 2.
Go to http://www.microsoft.com/downloads/details.aspx?FamilyId=8EBBBA59-5F17-4E52-8980-C4F0DFA92D65&displaylang=en
download and install.

Step 3.
Start your Notes client and then start outlook. Create  a new account and choose "Additional Server Types". Then choose "Microsoft Office Outlook Connector for IBM Lotus Domino". Click finish and then you are ready to use Outlook instead of Notes



Ringtones to your Iphone

By Nisse Pettersson at February 19, 2010 08:53
Filed Under: Technical
Share on Facebook

I'm one of those who got a new Iphone for my self as a present when I got a new job. The thing is that i'm a fan of spotify and not of Itunes so I don't pay for my mp3 songs. The issue here is that you can't take a song from your itunes library and make it the ringtone. You need to buy that song from Itunes.

I found a webbsite called audiko.net where you can make your own songs or download songs already made by other users.

Download the songs form audiko.net and then open them in Itunes. Sync with your Iphone and voilá!



Clear all connections to a Micrsoft SQL Server(MSSQL)

By Nisse Pettersson at February 17, 2010 04:32
Filed Under: Technical
Share on Facebook

Sometimes you need to clear allt he connections to the database in order to make som changes to it. I guess that there is a lot of way doing this but this one suites me.

USE master;
GO
ALTER DATABASE [databaseName]
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [databaseName]
SET MULTI_USER;
GO

 

Found it on this site



Incremental Linux backup to FTP-server

By Nisse Pettersson at January 30, 2010 04:16
Filed Under: Technical
Share on Facebook

I’m running a Macedonian e-date site (www.ergeni.com.mk) as a small project just for fun and it’s running on Ubuntu Machine. I need backup offcourse and found a nice script. I’m not the author of this script and i’m not interested in taking credit for it. It works fine and is fast. Just edit the variables and run the script.

#!/bin/sh
# System + MySQL backup script
# Full backup day - Sun (rest of the day do incremental backup)
# Copyright (c) 2005-2006 nixCraft <http://www.cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# Automatically generated by http://bash.cyberciti.biz/backup/wizard-ftp-script.php
# ---------------------------------------------------------------------
### System Setup ###
DIRS="/home /etc /var/www"
BACKUP=/tmp/backup.$$
NOW=$(date +"%y-%m-%d")
INCFILE="/root/tar-inc-backup.dat"
DAY=$(date +"%a")
FULLBACKUP="Sun"
### MySQL Setup ###
MUSER="mysql-user"
MPASS="mysql-password"
MHOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
GZIP="$(which gzip)"
### FTP server Setup ###
FTPD="/ergeni"
FTPU="ftp-username"
FTPP="ftp-password"
FTPS="ftp-hostname"
NCFTP="$(which ncftpput)"
### Other stuff ###
EMAILID="nisse@nissesblog.se"
### Start Backup for file system ###
[ ! -d $BACKUP ] && mkdir -p $BACKUP || :
### See if we want to make a full backup ###
if [ "$DAY" == "$FULLBACKUP" ]; then
  FTPD="/home/vivek/full"
  FILE="fs-full-$NOW.tar.gz"
  tar -zcvf $BACKUP/$FILE $DIRS
else
  i=$(date +"%Hh%Mm%Ss")
  FILE="fs-i-$NOW-$i.tar.gz"
  tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS
fi
### Start MySQL Backup ###
# Get all databases name
DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
for db in $DBS
do
 FILE=$BACKUP/mysql-$db.$NOW-$(date +"%T").gz
 $MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
done
### Dump backup using FTP ###
#Start FTP backup using ncftp
ncftp -u"$FTPU" -p"$FTPP" $FTPS<<EOF
mkdir $FTPD
mkdir $FTPD/$NOW
cd $FTPD/$NOW
lcd $BACKUP
mput *
quit
EOF
### Find out if ftp backup failed or not ###
if [ "$?" == "0" ]; then
 rm -f $BACKUP/*
else
 T=/tmp/backup.fail
 echo "Date: $(date)">$T
 echo "Hostname: $(hostname)" >>$T
 echo "Backup failed" >>$T
 mail  -s "BACKUP FAILED" "$EMAILID" <$T
 rm -f $T
fi

 

Then you need to add this job to crontab. Run the following command.

crontab –e

 

Add a new line to run the file at midnight.

@midnight /path/to/script.sh >/dev/null 2>&1

 

And there you go, a fully working backup system. To restor all you need to do is to extract the files from the ftp server to the same location.
Download the document below and edit.

backup-job.txt (1,97 kb)



Send e-mail with telnet

By Nisse Pettersson at January 18, 2010 06:05
Filed Under: Technical
Share on Facebook

For troubbleshooting it could come in handy to send an e-mail with telnet. It's easy as pie.

Start with running telnet and connecting to a smtp-server.

telnet smtp.microsoft.com 25

Then you get some text back "220 ESMTP". You need to present yourself to the server. You need to give the server the domain of the email adress you are using as a sender.

HELO nissesblog.se

Start typing your from email

MAIL FROM:nisse@nissesblog.se

then the recipient.

RCPT TO:bill.gates@microsoft.com

Now we need to add som text to the message. you can also add a subject.

DATA
Hey Bill, could I have some of your money?
.
// note the single dot, it's needed to tell the server that this is the end of the message

Then all you need to do is to leave with:

QUIT


Uninstall button missing in Windows Vista

By Nisse Pettersson at January 03, 2010 07:44
Filed Under: Technical
Share on Facebook

When you click the application you wish to uninstall in Add/remove programs under control panel you need to reset the folder views in vista. Follow these steps.

  1. Open RegEdit
  2. Browse to HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\
  3. Remove Bags registry key
  4. Remove BagMRU registry key
  5. Close RegEdit
  6. Log off, restart
  7. Login and go to folder options, make sure remember each folder's view settings
  8. Restart computer.

This 8 steps is quite simple. I found the solution on this blog.



Solution for error: BlogEngine is not defined

By Nisse Pettersson at December 31, 2009 11:41
Filed Under: Technical, Code
Share on Facebook

I've upgraded my blog to BlogEngine 1.5.0.7 and then I got a Java Error saing BlogEngine is not defined. The solution is the following.

Download the latest version from codeplex.
Extract blog.js and open it in your favorite editor and look at the code.

// global object
BlogEngine = {
    $: function(id) {
        return document.getElementById(id);
    }

 

The first row is to be deleted, so the start of the file will look like this.

BlogEngine = {
    $: function(id) {
        return document.getElementById(id);
    }

 

Upload the file and restart your .NET application. Edit your Web.Config to get the server to recompile the site.

Technorati-taggar: ,


32-bit ODBC in Windows 2008 64-bit Enviroment

By Nisse Pettersson at December 21, 2009 00:29
Filed Under: Technical
Share on Facebook

I'm installing a new database server and the application is using the 32bit ODBC-connections and the server is a 64-bit SQL. To configure 32-bit ODBC connections hit run and paste the following command.

%windir%\SysWOW64\odbcad32.exe