This site is no longer updated but kept as it still get lots of traffic. You can find more updated information about me at jenswedin.com.



13
Dec 08

Access a local Mac server from Windows in Parallels

I work on a mac, both at home and at work. When I work on my site chwisgi.com I work locally on a local webserver (MAMP). This is great as I can work on the site without the need to access the net, I can work off-line you could say. When done something I upload all may changes to the the net (production server). I use Coda which works nicely for my coding needs. To check that everything works I mostly see that it works in FireFox and Safari on Mac. When I want to check how the site behave in Windows and Explorer I have Parallels where I have installed Windows. The problem I had with Parallels was that I could not access the local webserver (MAMP) that I used on the Mac. So if I wanted to see how the site looked in Windows I had to publish my changes to the production server and then check it in Explorer. That is not good.

Let’s see if we can fix this! First some information about my network. The Mac is on the 192.168.1.x network range and the IP is 192.168.1.143. The Virtual Windows is on the 10.211.55.x network range which is default when installing Windows in Parallels. The local webserver (MAMP) is running on localhost and port 8888.

When I say that I cannot access the local web server it’s not really correct. It worked if I hit http://192.168.1.143:8888 in Explorer on Windows and look at static HTML pages. But when I have a more dynamic site it didn’t work. The thing is that my dynamic site uses the ‘localhost’ as the DNS name, so when I hit http://192.168.1.143:8888 it was directed to localhost:8888 which isn’t the correct place in Windows (but is on the Mac).

I tried to use the HOST file on Windows to map the 192.168.1.143:8888 to localhost:8888 but this didnt’t work. I tried to create an alias on my Mac in MAMP, this didn’t work for me either. I searched on the net and finally found a solution.

The solution is to setup a Port Redirection in Windows, this sound kind of geeky and probably is.

1. First download the Windows version of the modified version of Rinetd

2. Take the two files and put them in a folder like ‘rinetd’ and put the folder in the root of C:

3. Open up the rinetd.conf file and change the IP numbers to 127.0.0.1 8888 192.168.1.143 8888

The first number is the local IP number on the mac where you have your have your site running. This should not be changed.
The second is the port. If you are running the MAMP the default port is 8888, change if you have something else.
The third is the IP number of the mac. Open up your Network tools on mac note the IP number, for me it’s 192.168.1.143.
The fourth is the port number on the mac, just use the same as the first port number.

4. Now we just need to start the Rinetd server. What I did was to start a dos window by Start > Run > cmd

5. Drag the rinetd.exe file into the dos window and add -c for custom path to the conf file.

6. Drag the rinetd.conf to the dos window, you should now have something like:

C:\rinetd\rinetd.exe -c C:\rinetd\rinetd.conf

7. Hit enter, if it works the cursor just blinks, no success message here. Just leave the dos window open as long as your are testing.

8. Start Internet Explorer and hit http://localhost:8888 and your site on the mac will should be shown.

Here is a shot of Firefox in Mac, IE, FireFox and Chrome in Windows side by side.

Mission accomplished!


07
Dec 08

Greasemonkey & Nordea

I was really impressed by the Helveticareader project, a Gresemonkey script that transforms the Google Reader into something that looks more nice. I’ve never used Greasemonkey scripts or userscripts as they also are called. Just to try it out I did some hacking on my own bank site, Nordea which I use quiet often.

The nice thing with user scripts is that you can insert your own code inte to the live site as you are using it. In my script I add a new CSS file (that are on my site). From the CSS file I can add a new design and layout of the Nordea site. As you can add stuff to the code I also added some HTML to the frontpage just to try it out. The welcome text is inserted by the userscript.

Userscripts are just normal javascript so if you are a javascript hacker this will be easy stuff for you. As this is my first shot don’t shot me. I’ve added some resources below if you find this interesting.

To use userscript you need

1. Download Firefox if you don’t already have it.

2. Install Greasemonkey plugin

3. Install my userscript

4. Visit nordea.se

So what do my userscript do with the Nordea site?

1. User a grid width of 960px instead of 740px

2. Use Helvetica (you need this installed on your computer)

3. Removes much of the visual clutter (head, navigation, search, related content, banners etc)

4. Maximize the width of the content.

5. Moves all your money to my account :) I wish, this script only works for the open public pages, not the eBanking service. Check the code if you don’t trust me.

Example of before and after

Resources about Greasemonkey / userscripts

1. http://helvetireader.com/

2. Greasemonkey tutorial

3. Userscripts.org


03
Dec 08

url(data:image/jpg;base64…)

This cool stuff. Check out the CSS code below. Here they have added an image to the CSS file by encoding (base64) it directly into the CSS. This code was CTRL + C from the Helvetireader project. Believe that this works in most browsers except the infamous IE. There is some work done to fix this, check Dean Edwards site below. The good thing is that the images are in the same file as the CSS, no more broken images. The CSS can be gzipped so it should not be any bigger than separate files.  The bad is that whenever you noeed to change the image you need to convert the new image. I’m not sure if there is any image programs like Photoshop that can save base64 file right away. Let me know if have any more information to this.

body {background: URL(data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/
2wBDAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwMDAwMEAwODxAPDgwTExQUExM
cGxsbHCAgICAgICAgICD/2wBDAQcHBw0MDRgQEBgaFREVGiAgICAgICAgICAgICAgICA
gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICD/wAARCAFKABsDAREAAhEBAx
EB/8QAGQABAQEBAQEAAAAAAAAAAAAAAAECBAMI/8QAFxABAQEBAAAAAAAAAAAAAAAA
ABESE//EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/
9oADAMBAAIRAxEAPwD6pAAAAAAABAAAASgUCgUEAAABAAAASgUCgUAAAAGQAAAKBQ
KBQQAAAEAAABAAAASgUCgUEAAABAAAASgUCgUEAAABAAAAQAAAEoFAoFBAAAAQAAA
EoFAoFAAAABkAAACgUCgUEAAABAAAAQAAAEoFAoFBAAAAQAAAEoFAoFBAAAAQAAAEAA
AB47A2BsDYOboB0A6AdAc3QDoB0A6A5tgbA2BsGQAAAf/Z) left bottom
repeat-x !important;}

Here is example of my own picture that has been translated into base64, should work in most browsers except IE.

Elvis


11
Nov 08

SIME08

Tomorrow and Thursday is conference day. I’m having the opportunity to attend to the SIME08 conference that starts tomorrow. I have high hopes that it will be fun and inspiring. There are some big names that will be great to listen to like

* Michael J. Wolf (Author, former President MTV Networks)
* David Sifry (Founder of Technorati)
* Hans Rosling (Founder of Gapminder, professor at Karolinska Institutet)
* Joi Ito (CEO of Creative Commons, Chairman of Six Apart Japan etc.)
* Pelle Törnberg (former CEO Metro, former CEO MTG.)
* Lena K Samuelsson (Editor in Chief at Svenska Dagbladet)
* Net Jacobsson (Director of International Business Development at Facebook)

Hopefully it will be two nice days.


23
Oct 08

Just passed 100k of spam

Just amazing to see that Akismet (my spamfilter) has caught over 100k of spam. Check out the graph of the past months.


16
Sep 08

Chwisgi.com is released

This is going to be a short one, it’s late and my latest project is out in the wild. Just check out the post on the project blog and you will see what it is.

http://blog.chwisgi.com/2008/09/16/hooray-first-release/