EeePC & OS X: W-Lan (Hackintosh)

Written on April 27th 2009, 09:04 by sYnie

I installed OS X on my little EeePC 900a. After using some different Images and also trying to Install my original copy of Leopard, I ended up with iATKOS 5i. Most of the Hardware worked out of the box. Even hotplug, what didn’t work before.
There are some things that didn’t work:

  • Display resolution
  • Ethernet
  • WiFi
  • Sound

I got it managed to make them work, by now. Well, almost ;-)
As soon as I’m finished with this OS X on EeePC, I’ll post all the things I had to do to get them running. But before this, I want to share my experience with the built in Atheros WiFi card.
Vendor ID: [168c:001c]
Subsystem: [1a3b:1026]

Different OS’ display this device with different names. But as far as I know, it’s an AR5007EG. There are various tutorials out there to get this card working. Well, at least in some way.
Have a look at this discussion:
http://www.insanelymac.com/forum/index.php?showtopic=138351
18 Pages – all about this card and different types of it. There are some ways, that really work. But you’ll need Kismac to make this device see wireless networks after every reboot. It works like this:

  • Before you shutdown your EeePC, you must turn the Airport off.
  • After booting, turn it on.
  • Run Kismac and scan for wirelless networks with Airport Extreme Passive Drivers.
  • Now your Airport will notice all the new networks.

And if you get Kernel Panics:

  • Remove Extensions.mkext* before every shutdown.

And believe me – it’s not nice to do this every boot/shutdown. I wrote scripts, that do exactly this. I still need Kismac for making the Airport notice the networks, but I’m on it. Kismac replaces the Airport drivers during scan to use it in monitor mode. I’m still finding out how everything works, and so on. But have a look into the Resources directory within Kismac. It provides all the kext files. Also there is a driver called “viha” which uses the WLanDriver.kext. Viha is an Airport driver and W-Lan utility, which also provides a shell based network stumbler. I think this is the way to go … But I’m still experimenting.

If you’re annoyed by turning on/off the Airport, removing the Extensions.kext and firing up Kismac, then use these scripts. They work for me:

1. Preparing
Open System Preferences and go to Network. Write down your Location at the top. Mine is called AON, but usually yours is named “Automatic”. Create a new one and call it “AOFF”. Within “AOFF” you’ll have to remove Airport from the list on the right side. Add another (unused) service, if you can’t remove Airport. Switch back to “Automatic”, apply and close it.
AOFF will be used to switch off the Airport. You can’t do this via shell, but you can switch those network profiles via shell. If you switch to a profile, that has no Airport service, it’ll be turned off. You can try this by switching between these networks, applying them, and looking for what happens with your Airport symbol on the top of your screen.

2. Login-/LogoutHooks:
Create two files, somewhere (Mine are located in /Library) which will be used for Airport and Extensions. I’ve called them wlankickstart and wlankickstop ;-)

wlankickstart looks like this:

#!/bin/bash
scselect Automatic

Replace “Automatic” with your default network Location, or leave it, if you’re not sure.

wlankickstop looks like this:

#!/bin/bash
scselect AOFF
rm /System/Library/Extensions.mkext*

If you don’t have random kernel panics during boot time, then remove the last line, because it causes an annoying system message during shutdown.

Make those files executable (chmod a+x filename) and store them somewhere.
Now we’re gonna make them executed while login/logout:
sudo defaults write com.apple.loginwindow LoginHook “/path/to/wlankickstart”
sudo defaults write com.apple.loginwindow LogoutHook “/path/to/wlankickstop”

Now Extensions.mkext will be beleted and Airport will be turned on/off during boot/shutdown.

3. Kismac
If you don’t have it, download and install it. Open Script Editor from /Applications/AppleScript and write a new script:

tell application “KisMAC”
activate
startScan
delay 5
stopScan
quit
end tell

Try it. It’ll run Kismac, scan for 5 secs and turn it off. Make sure, Kismac uses the Airport Extreme Passive Driver. Compile this script and save it as an Applications (without “Startup Screen”). Now Open up System Preferences, go to Accounts, select your user, go to Login Items and add the previous compiled application.

You’re done. Reboot and enjoy. Now you’ll only have to select your W-Lan Network after a reboot instead of doing this process by your own.
It works? Give me a comment ;-)

Sockets/IRC using Flash/Openlaszlo without server side proxy

Written on January 22nd 2009, 02:01 by sYnie

some weeks ago I’ve been playing around with the possibility of flash of using sockets. I tried to connect to various services, but unless there is any crossdomain.xml on the server it is just impossible. Well, there is a way to use a server side proxy to create such connections, as it’s allowed to open sockets from the flash client to the same domain, but this isn’t always the best solution. For example if you want to connect to an IRC server, you will be limited to a few connections. Besides that, not everybody has the possibility to run a proxy server for such services.
After some hours of experiments, I got a solution. It’s not very nice and it’s questionable whether this could ever be used in productive environments – but it’s pretty nice to play with ;-)

In this example I used OpenLaszlo to do the flash part – but it can be easily reproduced with actionscript. Furthermore I decided to explain it with an IRC network and as for that (to keep it simple) I used a library to do the protocol stuff. But you can extend this to any service, that uses network connections.
It’s pretty simple:

  • First we create a Java Applet, which does all the socket stuff
  • This Applet will be signed to be able to open connections outside of its sandbox
  • Then the Flash Client will be designed
  • And after all that, a small set of Javascript Functions are needed to make them communicate

This is the example. It’s quick’n'dirty, but it works. You have to accept the Certificate. If you don’t the network connections won’t work.

Keep on reading for examples …
Read more…

OpenLaszlo and Full Screen / Kiosk Mode

Written on November 12th 2008, 17:11 by sYnie

I read about OpenLaszlo and full screen mode at the Laszlo forums. So I thought to publish a very small demo of how to create a solo app, that uses this feature. Here is a demo:

It’s pretty easy, as you can access the AS objects directly with OpenLaszlo:

<canvas>
<script>
Stage.scaleMode = "noScale";
Stage.align = "TL";
function toggleFullScreen() {
if (Stage["displayState"] == "normal") {
Stage["displayState"] = "fullScreen";
} else {
Stage["displayState"] = "normal";
}
}
</script>
<button text="Toggle Fullscreen" onclick="toggleFullScreen()" x="${parent.width/2-this.width/2}" y="${parent.height/2-this.height/2}"/>
</canvas>

Deploy it as a solo app and integrate it into your website like this:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" width="200" height="200">
<param name="allowFullScreen" value="true" />
<param name="movie" value="fullscreen.swf" />
<embed src="fullscreen.swf" allowFullScreen="true" width="200" height="200" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

There it is. Your very own full screen app ;-)
There are some restrictions (like for keyboard input) and I haven’t tried to use it in a server deployment, yet. So feel free to experiment …

This method is outdated. With 4.4 there’s a built-in method. Have a look at:
http://openfuture.rajubitter.com/2009/07/01/openlaszlo-44-released-video-components-improved-full-screen-support-for-swfx/

Hibernate on EeePC 900A

Written on October 18th 2008, 00:10 by sYnie

Before I start to talk about hibernate, I want to mention a very strange behavior of the 900A. The internal SSD is named sda OR sdb, depending on whether there is a card in the card reader at the system startup. So if there is a card plugged in, the internal SSD will be flagged as sdb. If there is no card, it will be sda. WTF? I really have no idea what this is caused by. But I think this causes a problem with hibernation.

At first, I didn’t even realize, that the internal SSD changes its device name. I use Ubuntu eee and during the installation, the fstab and menu.lst were filled with UUID’s instead of the device names – So there is no problem with booting and mounting them.

Anyway, I tried to get hibernation aka suspend to disk to work using this tutorial:
http://www.ubuntu-eee.com/wiki/index.php5?title=Fix:_hibernate

Everything seemed to work. s2disk caused the notebook to hibernate (as long as i didn’t insert/remove a card), but the wakeup ended in a ordinary boot, without resuming the written image. After hours, I got it work. Just do exactly the same, as it’s described in the tutorial, except for one step.
When you’re asked to change the /etc/uswsusp.conf, don’t use any device names in it. Do it, as Ubuntu did it during the installation: Use UUID’s.
To get to know the UUID of the internal SSD, we have to find out, how it’s labeled:

mount

This will return something like this:

/dev/sdb1 on / type ext3 (rw,noatime,errors=remount-ro)
proc on /pro....

Now, we know our SSD is /dev/sdXX (sdb1 in my case), because it’s mounted to /. In the next step, we’ll get to know the UUID:

sudo vol_id /dev/sdXX |grep UUID=

This will return the UUID. In my case:

ID_FS_UUID=16fa07c8-8416-5f10-85c6-a8410fad510

And now we’ll use this UUID instead of the device name in /etc/uswsusp.conf:

# /etc/uswsusp.conf(8) -- Configuration file for s2disk/s2both
resume device = /dev/disk/by-uuid/16fa07c8-8416-5f10-85c6-a8410fad510
compress = y
early writeout = y
image size = 0
RSA key file = /etc/uswsusp.key
shutdown method = platform
resume offset = XXX

If you’ve found this site after you already tried the tutorial mentioned above, then just do the changes and run this at the end:

sudo update-initramfs -k `uname -r` -u

Otherwise hibernate will create the image but it won’t be booted.

And now, for me, it works *woohoo*
I hope this will help ;-)

Slideshow with OpenLaszlo as a “Widget”

Written on October 8th 2008, 20:10 by sYnie

Hey,

I want to introduce you the previous posted Slideshow created with OpenLaszlo, but this time, you can use it without any knowledge of OpenLaszlo. Just download it and use a simple HTML-embed object, to tell the SWF, which pictures you want to use. This is an Example:


(enlarge)

You can also use your mouse to navigate between the pictures and to start/stop the autmatical slide show.

The code which I used to embed it is:

<object width="400" height="300">
<param name="movie" value="visualslider/visualslider.swf">
<embed src="visualslider/visualslider.swf?vspic1=res/1.jpg&vspic1w=300&vspic1h=200&vspic2=res/2.jpg&vspic2w=300&vspic2h=200&vspic3=res/3.jpg&vspic3w=300&vspic3h=200&vspic4=res/4.jpg&vspic4w=300&vspic4h=200&vspic5=res/5.jpg&vspic5w=300&vspic5h=200&vspic6=res/6.jpg&vspic6w=300&vspic6h=200&vspic7=res/7.jpg&vspic7w=300&vspic7h=200" width="500" height="300">
</embed>
</object>

It’s quite simple. You just have to include the SWF file into your HTML document and give it some parameters about which pictures you want to use in the slideshow.
This is the URL to the SWF file I used:

visualslider/visualslider.swf?vspic1=res/1.jpg&vspic1w=300&vspic1h=200&vspic2=res/2.jpg&vspic2w=300&vspic2h=200&vspic3=res/3.jpg&vspic3w=300&vspic3h=200&vspic4=res/4.jpg&vspic4w=300&vspic4h=200&vspic5=res/5.jpg&vspic5w=300&vspic5h=200&vspic6=res/6.jpg&vspic6w=300&vspic6h=200&vspic7=res/7.jpg&vspic7w=300&vspic7h=200

  • “visualslider/visualslider.swf” is the place, where visualslider.swf is located.
  • “?vspic1=” is the parameter to tell the SWF, which picture (”res/1.jpg”) to use.
  • “&vspic1w=” to define the width (”300″).
  • “&vspic1h=” to define the height (”200″).
  • After that, I pass the next parameter for the second picture (”&vspic2=”), and so on.
  • You can also define “&vsms=” to tell the SWF, how fast it should change the picture. Default is set to 5000.

The SWF: visualslider.tar (2009-07-06)
The sourcecode: main.lzx (2009-07-06), visualslider.lzx (2009-07-06) (GPL’ed)
Click here to see the fully documented Visualslider component.
I hope it’s useful for you.

Slideshow for OpenLaszlo

Written on July 5th 2008, 19:07 by sYnie

I had to create a Presentation some days ago. As we needed a little slideshow of pictures, within that presentation, I decided to create a little Sliteshow with OpenLaszlo. Maybe it’s useful for you, so you can use it under the terms of the GPL.

Here is a little Example, created with “Visualslider”:
Visualslider.swf

And this one ist quite the same, but with Slides sliding “circles”:
Visualslider_c.swf

You can click on the Slides, to navigate through them. Also you can use the cursor keys, to do the same. With the key “t” you can toggle between automatical sliding and manual sliding.

And here is the source code:
visualslider.lzx (2009-07-06)

A little Documentation:

<visualslider>

  • Description:
    The container view
  • Attributes:
    currentslide – (readonly) returns the selected slide
    slideduration – the time in ms for the slide-animation
    circular – boolean for circular-sliding
    timerms – the time in ms for automatical sliding
    istimerstarted – (readonly) returns a boolean whether automatical sliding is started or not
  • Methods:
    slideUp() – select next slide
    slideDown() – select previous slide
    slideTo(n) – select the nth slide
    startTimer() – start automatical sliding
    stopTimer() – stop automatical sliding

<visualsliderview>

  • Description:
    A slider-view. Must be placed in <visualslider>
  • Attributes:
    originalwidth – the 100%-width of the view
    originalheight – the 100%-height of the view
    currentslide – (readonly) returns a boolean whether this visualsliderview is selected or not
    shadow – boolean to display a shadow under the visualsliderview
    factor – (readonly) returns a scale-factor with reference to originalwidth and originalheight (useful to scale subviews)
    slidenumber – (readonly) returns the number of the slider
  • Events:
    onstop – Fires when the animation is finished
    onstart – Fires when the animation is started

Here you can find the zipped source code of the example. This may be helpful to create your own slideshow:
visualslider.tar (2009-07-06)

OpenLaszlo + Red5 = Voice chat

Written on May 9th 2008, 03:05 by sYnie

I have been working a long time with OpenLaszlo and Red5. As my commercial projects take months over moths to be developed, the last two days I just did something really basic. A small voice chat using OpenLaszlo and Red5. It’s for a freetime project and it’s planned to be integrated into Joomla. So maybe I will release this little app as a Joomla extention, later.
But now, I just want to show you, what you can do with OpenLaszlo and Red5 in a really short time:
Click here to visit the voice chat.

Features are so far:

  • Voice chat
  • Text chat
  • User management
  • Hardware selection
  • Nice look and feel
  • And so on …

Let me know, what you think about it. I hope I can show you the application integrated into Joomla as soon as possible.

AESCryptLz strikes back ;-)

Written on April 4th 2008, 13:04 by sYnie

My last post about AESCryptLz got real good feedback. As I’m trying out a lot of different encryption algorithms, there is the next one. But this is only a pre-version of the upcoming pack of AESCryptLz. It doesn’t include an example for Java and it’s not really commented. But you can use it anyway, because it’s doing its job.

To be done:

  • Java backend example
  • Better documentation
  • Implementation of MD5 checksums to provide encoding via password
  • Bug fixes (?)

The new Version of AESCryptLz is based on the set of JavaScript functions developed by Chris Veness and it’s released under the LGPL. Thanks a lot to him, for his great work.

In detail, it uses the AES/CTR algorithm without padding. The class generates encrypted byte-arrays and also needs byte-arrays to decrypt them. I’m not using HEX-Strings anymore, because it’s much faster, when I’m doing this calculations without any converting. As I’m using Red5 for the backend, it’s really easy to send and get byte-arrays. But I’ll explain how, next week.
Also I’ve implemented a way to encrypt using LzIdle. So you can use it to en-/decrypt things in backgrund. The used vector is stored in the first 8 bytes of the generated byte-array. The following bytes are the encrypted text. So it also needs the used vector in the first 8 byte, if you want to decrypt a byte-array, generated by other algorythms.

Here are the files:

I think I am on a good way with this class. It’s faster and much smaller than the last one.
So stay tuned for any updates.

AESCryptLz: OpenLaszlo & AES encryption

Written on March 19th 2008, 19:03 by sYnie

Some days ago, I started to search for a usefull code-snipet to de- and encrypt files or strings in OpenLaszlo. Everything I found were some posts about hash creation. So I started to search for JavaScript solutions to port them to OpenLaszlo. Mixing this with some hash creation algorithms and an own class to handle all those functions is compiled together to “AESCryptLz”. It can be used to de- and encrypt everything you want.
The used algorithm de-/encrypts via AES/ECB without Padding. You can de-/encrypt with a 128 bit key only. To do so, you can either use a 128 bit hex string or an ASCII string as “password”. If you use the ASCII key, then AESCryptLz will generate a MD5 hash out of it, to use it as a 128 bit hex key. All the encrypted data will be returned as a hex string. Also the data you, want to encrypt, needs to be a hex string.
Sounds a bit confusing, but it’s explained at the top of the source code.

To create this little set of classes, I ported a JavaScript library created by Eugene Styer. He allowed me to use his source code under the GPL. Thanks a lot!
I also used an OpenLaszlo class, ported by Userfriendly and former developed by Paul Johnston, released under the BSD licence. Thanks a lot, you too.

I created an own class, modified the mentioned classes and linked them all together. So you can use it under the GPL. Here you can find a little example that makes use of AESCryptLz.

The Sourcecode:

The first one is the AESCryptLz source code. The second one is the code of the shown example. And the third one is a little, quick and dirty Java source code, that shows, how to handle AESCryptLz-encrypted data. This may be usefull for a Java backend.

I’m looking forward to your feedback.

Kind regards,
Mario

Ps.: To see if it works, try to decode the following message, using the example application with the ASCII key “synie”:

1e af f3 90 83 02 50 90 a4 9c bc bc 7e 05 d3 78 50 79 ac aa 0f 0d ad 28 98 a7 46 13 b1 49 d7 e2 b9 d1 d9 c7 7a f0 01 0e 88 0d 95 a3 7f b2 52 92 2f 9e 5b 61 e7 67 8a 93 19 d0 5c c0 0c 78 64 e3 e0 f2 4c 4f b5 64 e9 d8 43 89 9d 8e fb 07 d8 e7 b8 ea 07 49 69 fd a7 b3 8d c3 8b 04 19 92 7a be

GTBot Source

Written on March 13th 2008, 16:03 by sYnie

A lot of people asked for the source code of GTBot. It’s a C++-based bot for GTChat, which I wrote some years ago. You can download it under the terms of GPL:

Beware! The source code is years old. It’s from times when I started to learn C++. So it’s really messed up and absolutely not nice. Better use it as a compilation of some functions for the GTChat, than using the bot in productive use. Everyone is welcome to go through the code, give it a nice OOP structure and send it back to me.