10.11.09

Protected: Ticking Watches

Posted in Miscellaneous at 4:33 pm by

This post is password protected. To view it please enter your password below:


01.27.09

Max packet size

Posted in Miscellaneous, windows at 2:04 pm by

When you send a large amount of data over the internet that data is being split up into smaller packets and is reassembled on the receiver side. The maximum size of such an individual packet is called Maximum Transmission Unit (MTU), and refers to the size (in bytes) of the largest packet or frame that a given layer of a communications protocol can pass onwards.

If somewhere on your network a MTU value is changed this can cause havoc for your communications. You could end up with a dead vpn tunnel. A quick way to determine what the largest packet is you can send to an ip is to use ping.

PING google.be -f -l 1472

-f Set Don’t Fragment flag in packet.
-l size Send buffer size.

When you packet size is to big you will get:

Packet needs to be fragmented but DF set.

When the packet size is not to big, it will just ping.

Once you know what the MTU should be you can config this on the application/protocol which is having issues.

05.20.08

Enabling ssl on your apache2 with debian etch

Posted in Debian, Linux at 11:08 pm by

This is in now way the definitive guide to getting ssl to work on your host. This is what worked for me.

First you need to get openssl

apt-get install openssl ssl-cert

Generate a self signed cert. This will protect your traffic however it will give warning in the browser of the user.

If you don’t want these warnings you will have to get a cert from a trusted certificate authority.

openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem

It will ask some questions, you can fill in what you want on most of them, however

Common Name (eg, YOUR name) []: *.yoursite.com

Make sure you give the name of your top level domain there.

Give the pem file the right permissions:

chmod 600 /etc/apache2/apache.pem

You want the server to listen on the ssl port, so you change /etc/apache2/ports.conf to

Listen 80
Listen 443

You add the Listen 443 line.

Now you want have to edit the default file

vi /etc/apache2/sites-available/default

Change
NameVirtualHost *
To
NameVirtualHost *:80
NameVirtualHost *:443

I looked long for this part, for some reason I have to add this to my default file, else ssl doesn’t work on my

other virtual hosts.


SSLCertificateFile /etc/apache2/apache.pem
SSLEngine On

Then you have to
add

SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem

to the definition of your host which you want to run with ssl.

sample:

ServerName sample.com

#other directives

SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem
SSLCertificateKeyFile /etc/apache2/apache.pem

/etc/init.d/apache2 restart
That’s it.

05.18.08

GIT Version system tutorial

Posted in Debian, Linux, Miscellaneous, windows at 3:53 pm by

GIT Version system

Git is a distributed file versioning system. It was initially created by Linus Torvalds. Linus is better known for the creation of linux.

This is some quick guide on getting started with GIT for people with a windows desktop and a linux server.

Download the windows GUI version of git from http://code.google.com/p/msysgit/downloads/list

Install it.

To create a new repository, only needed if you are starting a new project. If you are going to contribute to a existing project skip to the next section

Open a command line. navigate to the place where you want to start a new repository. Create a new directory for the repo.

sample:
md init_repo
cd init_repo
git init
cd ..

git clone –bare init_repo repo.git

Now upload the repo.git directory to your webserver. I do this with winscp, but you can use whatever way you like.

SSH into your server. Install git

example:
apt-get install git-core

To get a existing git repo.

Open a command line.
Navigate to the directory where you want to have the repo.

git clone ssh://username@host.com/path_to_git_repo

I’m using ssh instead of the daemon as I don’t really see an option to password protect the repo.

04.01.08

Recursively removing .svn directories

Posted in Linux, Miscellaneous at 12:13 pm by

Use this command
find . -name .svn -print0 | xargs -0 rm -rf
You could also use “svn export”…

03.31.08

Time synchronizing in windows

Posted in Miscellaneous, windows at 4:28 pm by

You can check the current time on your domain by typing in the following

net time

This gives me: Current time at \\s-dc1.mydomain.local is 3/31/2008 1:56 PM

To setup Time synchroniziation type in:

>net time /SETSNTP:\\s-dc1.mydomain.local

s-dc1.mydomain.local Local should be replaced with the servername where your time service is running. Now to check check what time server your pc uses type:

net time /QUERYSNTP

Voila.

ASP_0131 Disallowed_Parent_Path

Posted in Miscellaneous, windows at 3:38 pm by

IIS 6 has by default parent paths disallowed. These settings are required to use relative paths in virtual includes.

Parent paths allow you to use ‘..’ when browsing directories and MapPaths etc enabling files in the parent directory to be used.

To enable parent paths:

• Start the Internet Services Manager (Start - Programs - Administrative Tools - Internet Services Manager)
• Right click on the web site and select properties
• Select the ‘Home Directory’ tab
• Click the ‘Configuration’ button under the Application Settings
• Select the ‘App Options’ tab
• Check the ‘Enable parent paths’ box and click Apply

You don’t need to restart the service for the change to take effect.

03.25.08

Mass update sql job owners

Posted in DBA, Microsoft Sql server, TSQL at 12:20 pm by

After a domain migration you might find yourself in a position where you have a whole bunch of jobs with dead domain accounts. Then you could use sql server management studio to update the job ownership one by one. Or you could make a script which updates it for you. The next script gives you a the basics to script this. Just change the OLD_ACCOUNT by the account you want to replace and the NEW_ACCOUNT by the account you want to replace it with.
SELECT ‘EXEC MSDB.dbo.sp_update_job ‘ + char(13) +
‘@job_name = ‘ + char(39) + j.[Name] + char(39) + ‘,’ + char(13) +
‘@owner_login_name = ‘ + char(39) + ‘NEW_ACCOUNT’ + char(39) + char(13) + char(13)
FROM MSDB.dbo.sysjobs j
INNER JOIN Master.dbo.syslogins l
ON j.owner_sid = l.sid
WHERE l.[name] = ‘OLD_ACCOUNT’
ORDER BY j.[name]

The output of this script should copy paste and run in the sql server management console.

10.12.07

Deleting huge amounts of records

Posted in DBA, Microsoft Sql server, TSQL at 11:41 am by

When you have to delete a whole bunch of records from a table which has to stay in use. Then you could do it with a cursor. but you can also do it with the following approach. Use top to limit the amount of records deleted and put the deletion in a loop.

Sample code: 

DECLARE @p as int;

DELETE [dbo].[Klanthistoriek]
FROM (SELECT TOP 50000 klh_id
FROM
[GKA].[dbo].[Klanthistoriek]
WHERE
KLH_CreatieDatum between ‘2007-09-18 10:47:40.820′ and ‘2007-09-20 15:29:32.663′ ) as temptable
Where [dbo].[Klanthistoriek].klh_id = temptable.klh_id;

SET @p= @@rowcount;
WHILE @p <> 0
BEGIN
DELETE [dbo].[Klanthistoriek]
FROM (SELECT TOP 50000 klh_id
FROM
[GKA].[dbo].[Klanthistoriek]
WHERE
KLH_CreatieDatum between ‘2007-09-18 10:47:40.820′ and ‘2007-09-20 15:29:32.663′ ) as temptable
Where [dbo].[Klanthistoriek].klh_id = temptable.klh_id;

SET @p = @@rowcount;
PRINT @p;
END

Job from removed maintenance plan

Posted in DBA, Microsoft Sql server, TSQL at 11:36 am by

You removed a maintenance plan and it didn’t delete the job. You got the following error:

The DELETE statement conflicted with the REFERENCE constraint “FK_subplan_job_id”. The conflict occurred in database “msdb”, table “dbo.sysmaintplan_subplans”, column ‘job_id’.
The statement has been terminated. (.Net SqlClient Data Provider)

You can remove the job by executing the following code:

– Set @job_name to the job name you want to delete

USE [msdb]
DECLARE @job_name varchar(100)
SET @job_name = ‘job name’

–Delete the logs for the plan

DELETE
sysmaintplan_log
FROM
sysmaintplan_subplans AS subplans
INNER JOIN sysjobs_view AS syjobs ON
subplans.job_id = syjobs.job_id
INNER JOIN sysmaintplan_log ON
subplans.subplan_id = sysmaintplan_log.subplan_id
WHERE
syjobs.name = @job_name;

–Delete the subplan

DELETE
sysmaintplan_subplans
FROM
sysmaintplan_subplans AS subplans
INNER JOIN sysjobs_view AS syjobs ON
subplans.job_id = syjobs.job_id
WHERE
syjobs.name = @job_name;

–delete the job

DELETE FROM
msdb.dbo.sysjobs_view
WHERE
name = @job_name;

« Previous entries