tag:blogger.com,1999:blog-50158902156633905862024-03-08T07:26:15.186+01:00M0KBL0KProgramming, Gadgets and moreAdam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-5015890215663390586.post-12638318450684543252010-01-07T18:24:00.002+01:002010-01-07T18:54:43.241+01:00Android and XMLAs mentioned in an earlier post, the goal is to run an 8-Puzzle game on Android and let Prolog agents analyze the moves. The communication between Prolog and Android should be achieved by using the SQLSpaces. If you want to read more about SQLSpaces go <a href="http://sqlspaces.collide.info/">here</a> or more general <a href="http://en.wikipedia.org/wiki/Tuplespace">here</a>. The SQLSpaces communication is using a XML protocol over sockets. The server is implemented in Java and client libraries exist in Java (of course), Prolog, C#, PHP and ruby.<p></p><p class="MsoNormal"><span style="" lang="EN-US"> The first though was, hey, client lib is in Java, so most probably it should work on Android! Unfortunately not! The problems was, that the latter versions of the SQLSpaces client have used StAX for parsing the incoming XML messages and DOM to generate XML for requests to the server. However, StAX is not supported on Androids - <span style="font-style: italic;">javax.xml.stream.*</span> is not provided by the Android API. Yet DOM is only implemented in level 2! The result was, that we had change the SQLSpaces client to use DOM level 2 only and extract the XML parsing and make it adaptable. The first issue was not a big deal. We only had to remove some convenient access methods to Text nodes and some minor issues. The parsing was a bigger story!<o:p></o:p></span></p> <p class="MsoNormal"><span style="" lang="EN-US">Android supports two ways of parsing XML: SAX and XMLPull (of course you can also use DOM but this comes as always with a huge memory overhead)! It is recommended to use the SAX parser over XMLPull parser, as the latter one is slower. Actually, the decision depends on what you need: Speed vs. a simple way for parsing XML. You can find a very nice example presenting Android and all kinds of XML processing at <a href="http://www.ibm.com/developerworks/opensource/library/x-android/index.html">IBM</a>.</span></p><p class="MsoNormal">Finally, we have now a very nice mechanism for the SQLSpaces that will choose the best suited XML parser on the Desktop and on Android. We haven't compared speed yet, we are first happy that it is working at all and in a very short time.</p>Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-61419719640609757182010-01-03T20:38:00.004+01:002010-01-04T07:15:22.753+01:00AndREight-Puzzle on Kenai<span class="blsp-spelling-error" id="SPELLING_ERROR_0">The</span> 8-Puzzle <span class="blsp-spelling-error" id="SPELLING_ERROR_1">game</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_2">for</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_3">Android</span>, <span class="blsp-spelling-error" id="SPELLING_ERROR_4">now</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_5">named</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_6">AndREight</span>-Puzzle, <span class="blsp-spelling-error" id="SPELLING_ERROR_7">is</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_8">proceeding</span>. I <span class="blsp-spelling-error" id="SPELLING_ERROR_9">have</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_10">created</span> a <span class="blsp-spelling-error" id="SPELLING_ERROR_11">project</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_12">on</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_13">Kenai</span>.<span class="blsp-spelling-error" id="SPELLING_ERROR_14">com</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_15">and</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_16">commited</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_17">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_18">sources</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_19">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_20">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_21">SVN</span>.<br /><br /><a href="http://kenai.com/projects/andreight-puzzle">http://kenai.com/projects/andreight-puzzle</a><br /><br /><span class="blsp-spelling-error" id="SPELLING_ERROR_22">Before</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_23">being</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_24">able</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_25">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_26">commit</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_27">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_28">sources</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_29">from</span> a <span class="blsp-spelling-error" id="SPELLING_ERROR_30">fresh</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_31">Eclipse</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_32">installation</span>, I <span class="blsp-spelling-error" id="SPELLING_ERROR_33">had</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_34">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_35">install</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_36">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_37">SVN</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_38">plugin</span> - <span class="blsp-spelling-error" id="SPELLING_ERROR_39">standard</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_40">for</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_41">Eclipse</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_42">is</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_43">now</span> Subversive. I <span class="blsp-spelling-error" id="SPELLING_ERROR_44">remembered</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_45">from</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_46">old</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_47">days</span>, <span class="blsp-spelling-error" id="SPELLING_ERROR_48">that</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_49">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_50">had</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_51">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_52">add</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_53">lots</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_54">of</span> update <span class="blsp-spelling-error" id="SPELLING_ERROR_55">sites</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_56">manually</span>. <span class="blsp-spelling-error" id="SPELLING_ERROR_57">Now</span> - in 3.5 - <span class="blsp-spelling-error" id="SPELLING_ERROR_58">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_59">can</span> just <span class="blsp-spelling-error" id="SPELLING_ERROR_60">activate</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_61">the</span> update <span class="blsp-spelling-error" id="SPELLING_ERROR_62">site</span>, <span class="blsp-spelling-error" id="SPELLING_ERROR_63">install</span> Subversive <span class="blsp-spelling-error" id="SPELLING_ERROR_64">and</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_65">on</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_66">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_67">next</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_68">restart</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_69">of</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_70">Eclipse</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_71">it</span> will <span class="blsp-spelling-error" id="SPELLING_ERROR_72">pop</span>-<span class="blsp-spelling-error" id="SPELLING_ERROR_73">up</span> a <span class="blsp-spelling-error" id="SPELLING_ERROR_74">dialog</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_75">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_76">install</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_77">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_78">connectors</span>. <span class="blsp-spelling-error" id="SPELLING_ERROR_79">Very</span> elegant!Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-49898916085119048102009-12-30T23:08:00.003+01:002009-12-30T23:20:30.847+01:00Android programming is fun!<span class="blsp-spelling-error" id="SPELLING_ERROR_0">It</span>'s <span class="blsp-spelling-error" id="SPELLING_ERROR_1">been</span> a <span class="blsp-spelling-error" id="SPELLING_ERROR_2">long</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_3">time</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_4">since</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_5">my</span> last <span class="blsp-spelling-error" id="SPELLING_ERROR_6">post</span>. <span class="blsp-spelling-error" id="SPELLING_ERROR_7">Much</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_8">happend</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_9">and</span> I <span class="blsp-spelling-error" id="SPELLING_ERROR_10">had</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_11">few</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_12">time</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_13">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_14">post</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_15">some</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_16">stuff</span>. <span class="blsp-spelling-error" id="SPELLING_ERROR_17">But</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_18">new</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_19">fun</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_20">is</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_21">on</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_22">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_23">horizon</span>. <span class="blsp-spelling-error" id="SPELLING_ERROR_24">We</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_25">have</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_26">ordered</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_27">some</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_28">Android</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_29">phones</span> (<span class="blsp-spelling-error" id="SPELLING_ERROR_30">HTC</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_31">Magic</span>) <span class="blsp-spelling-error" id="SPELLING_ERROR_32">and</span> I <span class="blsp-spelling-error" id="SPELLING_ERROR_33">started</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_34">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_35">develop</span> a <span class="blsp-spelling-error" id="SPELLING_ERROR_36">new</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_37">application</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_38">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_39">proof</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_40">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_41">concept</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_42">of</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_43">heterogeneous </span>programming languages and devices in one system.<br /><br />The target is to program the 8-Puzzle game (http://www.8puzzle.com/) as an Android app and connect it through SQLSpaces (http://sqlspaces.collide.info) to Prolog agents, that will analyse the moves and provide feedback.<br /><br />I already started with the UI and postet some screenshots on flickR:<br /><span class="status-body"><span class="entry-content"> <a href="http://tinyurl.com/yh4qv9z" class="tweet-url web" rel="nofollow" target="_blank">http://tinyurl.com/yh4qv9z</a><br /><a href="http://tinyurl.com/yjnnyof" class="tweet-url web" rel="nofollow" target="_blank">http://tinyurl.com/yjnnyof</a><span style="text-decoration: underline;"><br /></span><a href="http://tinyurl.com/yfscd23" class="tweet-url web" rel="nofollow" target="_blank">http://tinyurl.com/yfscd23</a></span></span><br /><br />Next year (I could also say next weekend) I will continue on the connection to SQLSpaces and some game logic...Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-2310692693632696612009-07-24T14:35:00.002+02:002009-07-24T14:38:31.037+02:00Update: Create an image of an invisible Swing componentIn a recent <a href="http://mokblok.blogspot.com/2009/06/create-image-of-invisible-swing.html">post</a> I have described the way how to print a invisible (better say, not yet added) component. It seams that we were not the only ones with this problem. Here is a second solution (in German, but code still in Java):<br /><a href="http://www.java-blog-buch.de/d-gui-objekte-als-bild-speichern/"><br />http://www.java-blog-buch.de/d-gui-objekte-als-bild-speichern/</a>Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-75270217434226752642009-06-29T19:54:00.005+02:002009-06-29T20:07:54.857+02:00NetBeans 6.7 is out - without JavaFX!As already mentioned in my last <a href="http://mokblok.blogspot.com/2009/06/galileo-is-approaching.html">post</a>, the new release of NetBeans was scheduled for end of June. And today, as June is quite at its end, NetBeans 6.7 is out. The new outstanding features are the tight integration with Kenai and the integration of a new build system, namely maven! These two features really rock! You can connect your Kenai project, access the issue tracker directly from NetBeans as well as check out the source and more! With the integration of maven, the main build system based on ant has a tough competitor. A new view has been integrated to visualize the dependencies of modules, which helps a lot if you have many.<br /><br />There is one very big issue for me about the latest NetBeans release: JavaFX support is missing! Again: JavaFX support is missing! How could they do that? JavaFX was the main reason to use NetBeans! Now I have also used the new Kenai feature with the last milestones. I wanted to switch immediately to the new release, but without JavaFX support I still have to stick with the predecessor 6.5.1. We'll see when the support will be out!<br /><br />Overall, as I said, good times in the Java eco system :DAdam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com1tag:blogger.com,1999:blog-5015890215663390586.post-90275086172103358902009-06-23T22:33:00.002+02:002009-06-23T22:44:35.764+02:00Galileo is approachingFew hours left until <a href="http://www.eclipse.org/galileo/">Galileo</a> is finally released. Plan for tomorrow afternoon: Download, install, install plugins, migrate workspaces, have fun :D<br /><br />All in all a very nice month for Java developers. Tomorrow Eclipse 3.5, later this month Netbeans 6.7 (see their <a href="http://www.netbeans.org/community/releases/roadmap.html">roadmap</a>). I just want to get good JavaFX support, either for Eclipse or for Netbeans. Currently Netbeans has better support for JavaFX, but still not as good as for "pure" Java. We'll see what the future will bring...Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-49964007953875820162009-06-21T13:57:00.003+02:002009-06-21T14:02:27.550+02:00iPhone finally jailbrokenThe Dev-Team has finally released the Pwanage Tool for OS 3.0 (and meanwhile even a second tool called redsn0w) to jailbreak updated devices. First I had some problems with error 1600 and 1604, but after some search I have finally solved them and everything is fine! An iPhone without Winterboard just sucks.<br /><br />One thing I really hate about the new update is that the "old" iPhone (2G or Classic) does not provide all the new cool features that were announced for this release. No MMS, no Stereo Bluetooth profile, no tethering, and so forth. In the end you will get a voice recording tool and copy & paste. Wow! Thanks Apple!Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-4729079025689531062009-06-19T12:26:00.002+02:002009-06-19T16:49:23.543+02:00iPhone Classic @ OS 3.0<div style="text-align: left;">Still iPhone-Dev team has not release the new Pwanage Tool on their <a href="http://blog.iphone-dev.org/">blog</a>, but as always I could not wait so I was looking for any chance to update my (SIM-) unlocked phone before they will release the update. And as always there is a way, described <a href="http://iclarified.com/entry/index.php?enid=4261">here</a>! The most important thing is that your iPhone has been unlocked using the Pwanage Tool, <span style="font-weight: bold;">not</span> QuickPwn! As I could not remember anymore I have just re-unlocked my iPhone with the Pwanage Tool and OS 2.2.1 and then updated to OS 3.0. And I can finally say, it works! One drawback now is that the phone is not jailbroken, not yet. I really have to admit that an original iPhone just sucks :D The whole look is so old school. Well, hopefully next days...<br /></div>Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-68411456381377625952009-06-19T08:44:00.003+02:002009-06-19T08:49:42.953+02:00Simyo FTWIch hab es ja schon immer gesagt: Simyo <a href="http://de.wikipedia.org/wiki/FTW#F">FTW</a>! Alle Anbieter denken darüber nach, wie viel sie für die Tethering-Funtkion the iPhones nehmen sollen und Simyo nimmt <span style="font-weight: bold;">nichts</span>! Tethering bei Simyo ist <span style="font-weight: bold;">kostenlos</span>! Es wird nur empfohlen die 1 GB "Flatrate" zu buchen! Ich sage es einfach noch einmal: <span style="font-weight: bold; font-style: italic;">Simyo FTW</span>!<br /><br />Nachzulesen im Simyo <a href="http://simyostatic.de/blog/2009/06/17/iphone-tethering-und-mms-bei-simyo/">Blog</a>!Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-40532592966315980692009-06-18T16:09:00.002+02:002009-06-18T16:23:05.074+02:00Create an image of an invisible Swing componentYesterday we have tried to write an image of an invisible, better say, a component that has not yet been added to an already visible component on the screen. In other words, we have created an instance of a JPanel, added different stuff to it and wanted to create an PNG image out of it, without added the panel to the main application window. After several trials we have finally asked Google and found a nice solution (<a href="http://forums.java.net/jive/thread.jspa?messageID=267548&tstart=0">link</a>):<br /><br /> <span style="font-size:85%;"><span style="font-family:courier new;">public static BufferedImage</span><br /><span style="font-family:courier new;"> createImage(JComponent component, int imageType) {</span><br /><span style="font-family:courier new;"> Dimension componentSize = component.getPreferredSize();</span><br /><span style="font-family:courier new;"> component.setDoubleBuffered(false);</span><br /><span style="font-family:courier new;"> component.setSize(componentSize);</span><br /><span style="font-family:courier new;"> component.addNotify();</span><br /><span style="font-family:courier new;"> component.validate();</span><br /><br /><span style="font-family:courier new;"> BufferedImage img = GraphicsEnvironment</span><br /><span style="font-family:courier new;"> .getLocalGraphicsEnvironment()</span><br /><span style="font-family:courier new;"> .getDefaultScreenDevice().getDefaultConfiguration()</span><br /><span style="font-family:courier new;"> .createCompatibleImage(component.getSize().width,</span><br /><span style="font-family:courier new;"> component.getSize().height);</span><br /><span style="font-family:courier new;"> Graphics2D grap = img.createGraphics();</span><br /><span style="font-family:courier new;"> grap.setColor(Color.WHITE);</span><br /><span style="font-family:courier new;"> grap.fillRect(0, 0, img.getWidth(), img.getHeight());</span><br /><span style="font-family:courier new;"> component.print(grap);</span><br /><span style="font-family:courier new;"> grap.dispose();</span><br /><span style="font-family:courier new;"> return img;</span><br /><span style="font-family:courier new;"> }</span></span><br /><br />You can now call this method like this:<br /><br /><span style="font-size:85%;"><span style="font-family:courier new;">BufferedImage image = createImage(p, BufferedImage.TYPE_INT_RGB);</span><br /><span style="font-family:courier new;">ImageIO.write(image, "png", new File("/Users/giemza/Component.png"));</span></span><br /><br />One thing that we have found out is that if you are working on a remote X11 connection the compatible image is a X11RemoteOffScreenImage. If you try to write this image with ImageIO under Java 1.5.0, the application will crash without any exceptions. Just no reaction. We could not reproduce this behaviour with Java 1.6.0.Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0tag:blogger.com,1999:blog-5015890215663390586.post-41873107139669824322009-06-18T12:55:00.003+02:002009-06-18T16:23:48.201+02:00Yata!The first question I have while starting the blog is: "Will anybody read it?" But after some time on twitter and some issues that I have found during my journeys through the internet, programming, gadgeting and so forth, I feel it is the time to share it with you! So maybe you will find something useful here, otherwise have a good day...Adam Giemzahttp://www.blogger.com/profile/15197562741391871893noreply@blogger.com0