Blogs

Die neue Pseudomoraltrompete

Zur aktuellen Diskussion nochmal was aufgewärmtes aus dem Jahre 2004, natürlich kann man Zitate aus dem Kontext reissen und dadurch die Aussage inhaltlich verdrehen, aber liebe Süddeutsche, man kann natürlich auch genau die gleichen Zitate herausgreifen, noch ein bisschen Meinungsstuss drumherumschreiben, behaupten das war alles genau so gemeint und so schön von der anderen Seite  ins Propagandahorn blasen.

Auch eine Variante: Man schmeisst Nostalgie, Sozialismus, ostdeutsche Mentalität und diktatorische Herrschaft in einen Topf, stelle alles, was die DDR verunstaltet hat (inklusive Menschen) vor einen kulissenhaften Abgrund und heraus kommt eine selten doofe und substanziell dünnpfiffähnliche Systembeschönigung, bzw. TA vom 1.10.2004: "Im Gespräch mit dieser Zeitung warnte der DDR-Bürgerrechtler und einstige Bundesbeauftragte für die Stasi-Unterlagen, Joachim Gauck, vor einer wachsenden Sozialismus-Nostalgie in Ostdeutschland. 'Wer Jahrzehnte in einer Diktatur gelebt hat, neigt auch danach weiter dazu, nach oben zu blicken und auf Führung und Fürsorge zu hoffen', sagte er. Diese Mentalität sei 'tief verwurzelt', so Gauck, und wandele sich nur langsam. Seiner Ansicht nach schätzen zahlreiche Ostdeutsche die Freiheit, die sie 1989 errungen haben, nicht genug. Die oft anzutreffende Neigung zum Sozialismus entspringe einer 'romantischen Sehnsucht' nach einer geordneten, als gerecht empfundenen Welt."

Kleiner Tipp für die Moralpredigt zum Anfang, Herr Gauck: Freiheit, Demokratie, Menschenrechte. Sollten wirs geschafft haben, das in unserem Land für alle tatsächlich mal möglich zu machen, können wir ja gleichzeitig auch mal anfangen uns so zu verhalten, das auch der Rest der Welt was davon hat. Bitte dabei mal ganz wirklich an die Menschen denken und nicht den Zustand weiter manifestieren, den einer Ihrer Vorgänger schonmal in dieser Form beschrieb: "Meine Einschätzung ist aber, dass wir insgesamt auf dem Wege sind, doch auch in der Breite der Gesellschaft zu verstehen, dass ein Land unserer Größe mit dieser Außenhandelsorientierung und damit auch Außenhandelsabhängigkeit auch wissen muss, dass im Zweifel, im Notfall auch militärischer Einsatz notwendig ist, um unsere Interessen zu wahren, zum Beispiel freie Handelswege, zum Beispiel ganze regionale Instabilitäten zu verhindern, die mit Sicherheit dann auch auf unsere Chancen zurückschlagen - negativ durch Handel, Arbeitsplätze und Einkommen."

How To: Mix OpenLaszlo, Air and Javascript/HTML to create a desktop application with local file access

 

Doing some development on the apolmb project I thought about a way to make the local filesystem accessible to an OpenLaszlo application. Since the Flash Player version 10 seems only to be able to load and save local files, but not get directory listings, I installed Adobe Air 1.5.3 SDK and Runtime on my Ubuntu machine, integrated it with the help of Aptana in Eclipse, started a new Air HTML/JavaScript project and embedded the OpenLaszlo-compiled SWF inside.

It resulted in Air application, which prints the content of local files. The Air package is available here. The readLocalFile function will return the content of any file on your local disk (e.g. "/var/log/auth.log" or "C:/autoexec.bat")

Bridging Air and OpenLaszlo with Javascript

The HTML container inside the Air project provides access to the to the local filesystem through the AIR API. Embedding the SWF with OpenLaszlos lz.embed.swf function provided in the embed-compressed.js makes it possible to call the JS-functions in the HTML container with lz.Browser.callJS() and receive the return values. Heres the code:


Adobe Air HTML container code (airpolmb.html):


<html>
    <head>
        <title>OpenLaszlo App in Air Runtime / JavaScript Bridge</title>
        <script type="text/javascript" src="lib/air/AIRAliases.js"></script>
        <script type="text/javascript" src="lps/includes/embed-compressed.js"/>
        <script type="text/javascript">

            // reads the content of a local text file
            function readLocalFile(fpath){
                var f = air.File.applicationDirectory.resolvePath(fpath);
               
                var fs = new air.FileStream();
                fs.open(f, air.FileMode.READ);
                var content = fs.readUTFBytes(fs.bytesAvailable);
                fs.close();
               
                return content;
            }

        </script>
    </head>
    <body>
        <script type="text/javascript">
          lz.embed.swf({url: 'airtest.lzx.swf10.swf', allowfullscreen: 'false', bgcolor: '#ffffff', 
                        width: '100%', height: '100%', id: 'lzapp', accessible: 'false', 
                        cancelmousewheel: false});

          lz.embed.lzapp.onloadstatus = function loadstatus(p) {
            // called with a percentage (0-100) indicating load progress
          }

          lz.embed.lzapp.onload = function loaded() {
            // called when this application is done loading
          }
        </script>
    </body>
</html>

OpenLaszlo code (airtest.lzx):


<canvas height="100%" width="100%" title="Airtest" proxied="false">
    
    <method name="receivedFromJavaScript" args="data">
    <![CDATA[
        Debug.write("Response data: ");
        Debug.write(data);
        this.response.setAttribute("text", data);
    ]]>
    </method>

    <simplelayout axis="y" spacing="10" />
    
    <view height="10"></view>
    <view x="10">
        <simplelayout axis="x" spacing="10" />    
        <text>JS function: </text>
        <edittext name="func" width="220">readLocalFile</edittext>
        <text> argument: </text>
        <edittext name="arg" width="220">LocalFile.txt</edittext>        
        <button text="call"
                onclick="lz.Browser.callJS(parent.func.getValue(), 
                canvas.receivedFromJavaScript, parent.arg.getValue())"/>
    
    </view>
    <text x="10" text="Response data:"/>
    <text x="10" name="response" multiline="true" resize="true"/>
    
</canvas>

 

Alternative way without lz.embed

A different way leading to nearly the same results is to totally leave the lz.embed stuff out, directly import the class flash.external.ExternalInterface in the LZX code and go further using call and callback methods directly. In this case the response value is delivered by the callback function instead of being included in the return value.

airpolmb-alt.html:


<html>
	<head>
        <title>OpenLaszlo App in Air Runtime / JavaScript Bridge Alternative</title>
        <script type="text/javascript" src="lib/air/AIRAliases.js"></script>
        <script type="text/javascript">

		    // returns the SWF object node
			function thisMovie(movieName) {
		         if (navigator.appName.indexOf("Microsoft") != -1) {
		             return window[movieName];
		         } else {
		             return document[movieName];
		         }
		     }

            // reads the content of a local text file
            function readLocalFile(fpath){
                var f = air.File.applicationDirectory.resolvePath(fpath);
				
                var fs = new air.FileStream();
                fs.open(f, air.FileMode.READ);
                var content = fs.readUTFBytes(fs.bytesAvailable);
                fs.close();
                
				thisMovie("lzapp").getJSData(content);
				
                return content;
            }
			
        </script>
	</head>

    <body>
	<object id="lzapp" type="application/x-shockwave-flash" width="100%" height="100%"> 
   			<param name="movie" value="app:/airtest-alt.lzx.swf10.swf"/>
    		<param name="wmode" value="opaque"/>
		</object>
    </body>
</html>

airtest-alt.lzx:


<canvas height="100%" width="100%" title="Airtest-AS3" proxied="false">
	
	<method name="receivedFromJavaScript" args="data">
	<![CDATA[
		Debug.write("Response data: ");
		Debug.write(data);
		this.response.setAttribute("text", data);
	]]>
	</method>
	
	<class name="FlashUtil" extends="node" >
		
	    <passthrough>
	      import flash.external.ExternalInterface;
	    </passthrough>
	    
	    <method name="callJS" args="...rest" allocation="class" >
	      ExternalInterface.call.apply(ExternalInterface, rest);
	      Debug.write(ExternalInterface, rest);
	    </method>
	    
	    <method name="initJSCallback" args="...rest" allocation="class" >
	      ExternalInterface.addCallback.apply(ExternalInterface, rest);
	      Debug.write('Init callback');
	    </method>

	</class>
	
	<script>
		lz.FlashUtil.initJSCallback("getJSData", canvas.receivedFromJavaScript);
	</script>

	<simplelayout axis="y" spacing="10" />
	
	<view height="10"></view>
	<view x="10">
		
		<simplelayout axis="x" spacing="10" />	
		<text>JS function: </text>
		<edittext name="func" width="220">readLocalFile</edittext>	
		<text> argument: </text>	
		<edittext name="arg" width="220">LocalFile.txt</edittext>
		<button text="call" 
				onclick="lz.FlashUtil.callJS(parent.func.getValue(), parent.arg.getValue())"/>
	
	</view>
	<text  x="10" text="Response data:"/>
	<text  x="10" name="response" multiline="true" resize="true"/>
	
</canvas>

During my investigation this two posts in the OpenLaszlo forum helped me the most.

Thanks to everybody in the OpenLaszlo community and at Laszlo Systems for sharing this great framework and all the help and ideas with all of us.

General Tags: 
General category: 

How To: Upgrade ext3 to ext4 if your Ubuntu installation is inside of an encrypted LVM2 partition

In general you can use this guide for the basics, make sure that you are using grub2 as the boot manager (if you boot from the partion you're going to convert) and you have a backup of all important data. You need to boot from a Live-CD or a USB-installation of Ubuntu to do the changes to your boot partion from there. Theres one little trick about how to get access to an encrypted LUKS LVM2-container. If you setup such a thing (e.g. by using Ubuntus alternate installer) also take a look here.

General Tags: 
General category: 

How To: Fix your screen configuration when using ATI Catalyst™ Proprietary Linux Display Driver

The team play of Ubuntu and ATI graphic cards is something I wouldn't bet my shirt on. At some point it's still a mystery for me to configure it correctly, the effects of changes in xorg.conf, driver updates, use of aticonfig or Ubuntu's display configuration tool give a surprise every time and if suddenly things are working correctly I call it a miracle. Unfortunatly after having benefited from a miracle for quite some months, things stopped working again for no apparent reason.

At some point the driver seems to not listen to xorg.conf any way. It writes its own configuration into /etc/ati/amdpcsdb and this file gets messed up after some time. So at any start of trying a new configuration its seems wise to replace it with the /etc/ati/amdpcsdb.default file.

But still the xorg.conf file seems to have some influence on graphic settings. So for a fresh start also completely remove /etc/X11/xorg.conf and do a aticonfig --initial --force which will give you a completely new one based on the configuration this ATI tool detected.

After doing both of this still strange things were happening in my Ubuntu installation. Logging into GDM with my user profile gave unexpected and unwanted results in display configuration, logging in with another user profile worked perfectly well. The reason for that: user-dependent GNOME Display settings in the home directory in ~/.config/monitors.xml. Delete this file to prevent Display chaos.

So we can finally start adapting the new configuration now. This should be done in the CCC (Catalyst Control Centre). I hope things go well from here for you too. Good luck.

General Tags: 
General category: 

Started a new religion today, will be awesome

Starting into the week after a nice relaxing weekend felt somehow different today because just during breakfast I suddenly felt like starting a new religion is a good idea today. I immediately had a lot of nice ideas for this new religion, but couldn't start directly writing them down because I was busy. So one of the first but maybe less important rules for this religion is:

If you like to start a new religion go for it. There's no need to start immediatly. If you're busy with something else or just need some additional good ideas to start, start it any convenient time.

General Tags: 
General category: 

The dillout sound

Finally, for the first time in history mankind will be able to experience the dillout sound. The debut album of "zentrale für kompetenzüberschreitung" just left the non-existent studio and made its way directly to dillout.de. Look at / listen to / download / ignore it here.

 

Creative Commons License
zentrale für kompetenzüberschreitung by zentrale für kompetenzüberschreitung is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Germany License.

Do you like free music?
Find some more at
www.theblackriders.at/ and
dl.nin.com/theslip/

General category: 

Pages

Subscribe to RSS - blogs

ad ubuntu linux

Greenpeace Energy

www.lobbycontrol.de