No Silver Bullet

So I started my next term at the Technical University of Denmark (DTU), which is the fourth, and I have got this very exciting class called Model Based System Engineering, where the teacher had us to read an article called No Silver Bullet, written by Frederick P. Brooks, Jr.
You may know this article already since it has been widely discussed and was published in 1987. It basically about how system engineering is very hard and disappointing, since it is not as easy as for example physics where you have laws, which apply to most things, which you can relate to and use everywhere, because there are none of them in system engineering.

If you like designing software systems I highly recommend reading this article (link below).

No Silver Bullet – Essence and Accidents of Software Engineering

There is also a Wikipedia page on this topic which sums it up pretty good (link below).

No Silver Bullet on Wikipedia

Delete all your temporary shit on Windows

So you might think, where did your 10 GB worth of disk space go? Did it disappear, what is using it? The answer is, temporary files and logs ate it! I found out that I had 15 GB worth of logs and other shit on my disk that I did not need. So I searched through it and made a small batch script deleting the stuff. You might say that you can use programs like ccleaner or so, but if you do not want to install these programs you will be served well with a small script running from time to time, deleting files ending with a specified extension. So here goes my script:

1
2
3
4
5
6
7
8
9
10
11
del /f /s /q %tmp%\.
rd /s/q %tmp%\
 
del /f /s /q %temp%\.
rd /s /q %temp%\
 
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\*.dmp
del /f /s /q %systemdrive%\*.tmp

You can of course specify more extensions if you want to… Have fun with the script!

Issuu – Read Magazines, Articles and other Publications online

I just discovered Issuu for Android through the Android Market, which is a pretty nice place to read magazines, newspapers, articles and lots and lots of other publications on your computer or your mobile phone. They have recently released a client for Android and a client for iPhone will soon be available for download.
The page and app are really easy to use, you have easy access to a lot of stuff and it is read easily through the browser. You can zoom and see pictures, subscribe to publications, rate stuff and lots and lots of other cool stuff. It is really recommended!

Scan the barcode to go to the application download for android.


Click on image for bigger version

Adding AdSense for Google Search on a Wordpress blog running on Lighttpd

So you might be running Wordpress on a Lighttpd server, which can be a bit problematic since it does not support slugs per default, and if you are using default permalink setup in Wordpress the search page that we are going to create in a minute will not work.

So first we need to do something about the permalinks. For this example I will use the permalink style: http://domainname.test/postname/ for this to work we need to add following lines in the lighttpd.com:

1
2
3
4
5
6
7
8
9
10
11
url.rewrite-final = (
 
    # Exclude some directories from rewriting
    "^/(wp-admin|wp-includes|wp-content|gallery2|stats|awstats|awstatsicons|awstatscss|kloxo|kloxononssl|cgi-bin)/(.*)" => "$0",
 
    # Exclude .php files at root from rewriting
    "^/(.*.php)" => "$0",
 
    # Handle permalinks and feeds
    "^/(.*)$" => "/index.php/$1"
)

Remember to reload lighttpd to append these changes.

In the Wordpress permalink settings you use the custom setting where you write: /%postname%/ this will result in links like we wanted.

Now we have to make a page where the AdSense for Google results will show. I’ve made a template called gsearch.php, which looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/*
Template Name: gsearch
*/
?>
<?php get_header(); ?>
        <div id="content" class="widecolumn">
                <!-- Google Search Result Snippet Begins -->
 
<div id="cse-search-results"></div>
<script type="text/javascript">
  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 500;
  var googleSearchDomain = "www.google.dk";
  var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
 
 
                <!-- Google Search Result Snippet Ends -->
        </div>
 
<?php get_sidebar(); ?>
 
<?php get_footer(); ?>

Put this template in your Wordpress theme folder, and go to your Dashboard and make a new Page. Call this whatever you want, but remember to choose the template gsearch, and do not write anything else on the page, only fill out the page name.

Now go to your AdSense account, and create a new AdSense for Google Search. In the Wizard where it says which sites you want to search across write your own, also remember to add some keywords, it helps showing ads directed at the content you want to have it showing. But the most important thing is to fill in the Opening for search results page, here you have to check Open results within my own site and then specify the URL for the page you just made with the gsearch template. Now finish up the wizard and have the code created. We will only need the search box code, since we already implemented the search result code.

Since I do not know how to make a new widget, we will just paste the code into the sidebar code for your theme directly. Which you can find under appearance and then press editor. Find the code for your sidebar, probably named sidebar.php.
Paste the generated code from google right after the <div id=”sidebar”> code, save and enjoy. You should now have a functioning AdSense for Google Search implemented on your blog.

You might want to remove the search widget, so it only show the Google Search one and also exclude the page from the pages widget.

Now with google search

I find the built in search function a bit lacking, so I decided to shift it out with Google AdSense Custom Search, which searches the webpage while showing some ads, which enables me to earn a bit money, since this page does not pay itself. Though you are not forced to click on the adds, though I’d like you to from time to time as a token of appreciation.

If you need help implementing this on your own wordpress weblog I will write up a blog post on how to do this very soon.