<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A blog just like many others.</title>
	<atom:link href="http://blog.bigpixel.ro/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bigpixel.ro</link>
	<description>I&#039;m an angel. I can&#039;t fly. I&#039;m not to trust. I don&#039;t lie.I&#039;m not an angel. I can fall. I&#039;m a demon. I can cry. I&#039;m just a mirror.Or just the Time.To help your soul cry.Or shine..</description>
	<lastBuildDate>Sun, 11 Dec 2011 23:59:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Syncronizing Redmine &amp; BitBucket repositories</title>
		<link>http://blog.bigpixel.ro/2011/12/syncronizing-redmine-bitbucket-repositories/</link>
		<comments>http://blog.bigpixel.ro/2011/12/syncronizing-redmine-bitbucket-repositories/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 23:53:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[BitBucket]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Redmine]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=443</guid>
		<description><![CDATA[So, you have a Redmine installed somewhere, and also using BitBucket for hosting your repositories and tring to find a way to synchronize your BitBucket repository with your Redmine one? This is how can be done (same applies for GitHub, actually we&#8217;re using the very same redmine plugin which was originally written for GitHub. Regardless [...]]]></description>
			<content:encoded><![CDATA[<p>So, you have a Redmine installed somewhere, and also using BitBucket for hosting your repositories and tring to find a way to synchronize your BitBucket repository with your Redmine one? This is how can be done (same applies for GitHub, actually we&#8217;re using the very same <a href="https://github.com/koppen/redmine_github_hook/">redmine plugin</a> which was originally written for GitHub. Regardless of being actually made for GitHub, works great for BitBucket too <img src='http://blog.bigpixel.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>First, you need to install the json gem for ruby, as the plugin requires it:</p>
<blockquote><p>gem install json</p></blockquote>
<p>then you need to setup the redmine plugin. For this you have to go to your redmine install folder, and then from here head to vendor/plugins folder. Once there, clone the <a href="https://github.com/koppen/redmine_github_hook/">redmine github hook</a> plugin:</p>
<blockquote><p>git clone https://github.com/koppen/redmine_github_hook.git</p></blockquote>
<p>then do the usual plugin installation thingies to install the plugin into redmine:</p>
<blockquote><p>rake db:migrate:plugin NAME=redmine_github_hook RAILS_ENV=production</p></blockquote>
<p>and then restart your Redmine. Now you&#8217;re set on Redmine site.</p>
<p>Your git repository need to be have as remote origin your BitBucket repository, so you&#8217;ll want to run something like:</p>
<blockquote><p>git &#8211;git-dir=&#8217;your_repositories/your_repository.git&#8217; remote add origin <span class="mh-email">g<a href='http://www.google.com/recaptcha/mailhide/d?k=01vxZyDkcuj66e6P6Hvc4KzA==&amp;c=c3YbjUIlhfIiSqQEwwrQG0GArCNvdBxylEQCrS4cHo4=' onclick="window.open('http://www.google.com/recaptcha/mailhide/d?k=01vxZyDkcuj66e6P6Hvc4KzA==&amp;c=c3YbjUIlhfIiSqQEwwrQG0GArCNvdBxylEQCrS4cHo4=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@bitbucket.org</span>:your_user/your_repository.git</p></blockquote>
<p>This completes your server side setup. In your BitBucket account, you&#8217;ll need to setup a POST service which will notify your Redmine to update it&#8217;s repository. For this you&#8217;ll have to go to your repository admin page, then select services on the right menu. Then in the drop-down select POST and for the URL enter your an URL like this:</p>
<blockquote><p>http://your redmine web address/github_hook?project_id=your redmine project name</p></blockquote>
<p>That&#8217;s it. Now each time you do a commit in your BitBucket repository, your Redmine repository will get updated accordingly (and everything else depending on this, like activity,etc).</p>
<p>P.S. These steps can be applied also to your GitHub account, should work without any problem.</p>
<p>Happy commiting <img src='http://blog.bigpixel.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/12/syncronizing-redmine-bitbucket-repositories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validating XML node against a XSD schema</title>
		<link>http://blog.bigpixel.ro/2011/08/validating-xml-node-against-a-xsd-schema/</link>
		<comments>http://blog.bigpixel.ro/2011/08/validating-xml-node-against-a-xsd-schema/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 09:24:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Validation]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XSD]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=430</guid>
		<description><![CDATA[Sometimes you need to make sure a part of the xml document (more precisely a node and all node&#8217;s children)  are valid according to a given schema. So how this can be done, as XML validators tend to work on document basis (there seems to be something called XML fragments, but haven&#8217;t yet found a [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to make sure a part of the xml document (more precisely a node and all node&#8217;s children)  are valid according to a given schema. So how this can be done, as XML validators tend to work on document basis (there seems to be something called XML fragments, but haven&#8217;t yet found a way to validate the nodes using xml fragments) ?</p>
<p>The workflow is simple:</p>
<ol>
<li>load the xsd file we want to validate against. For this I&#8217;ll use the <a href="http://blog.bigpixel.ro/2011/07/413/">handy class</a> which searches the classpath for the given resource.</li>
<li>transform the node into xml document.</li>
<li>validate the document against the schema.</li>
</ol>
<div>For transforming the xml node to document, first we&#8217;ll transform it into a string, with this handy method found <a href="http://www.coderanch.com/how-to/java/DocumentToString">here</a>:</div>
<pre>public static String xmlToString(Node node)
    {
        try
        {
            Source source = new DOMSource(node);
            StringWriter stringWriter = new StringWriter();
            Result result = new StreamResult(stringWriter);
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            transformer.transform(source, result);
            return stringWriter.getBuffer().toString();
        }
        catch (TransformerConfigurationException e)
        {
            e.printStackTrace();
        }
        catch (TransformerException e)
        {
            e.printStackTrace();
        }

        return null;
    }</pre>
<p>then we&#8217;ll use this string as a stream to create the document from and validate against the schema as bellow:</p>
<pre>StringReader r = new StringReader(xmlToString(node));
validator.validate(new StreamSource(r));</pre>
<p>The entire code is attached <a href="http://blog.bigpixel.ro/wp-content/uploads/2011/08/XmlUtils.java_.txt">here</a> (as example only, in production you&#8217;ll probably have to close the open input streams returned by the ClassPathSearcher class)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/08/validating-xml-node-against-a-xsd-schema/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regexp searching resources in web app classpath</title>
		<link>http://blog.bigpixel.ro/2011/07/413/</link>
		<comments>http://blog.bigpixel.ro/2011/07/413/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 13:32:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Regexp]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Web App]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=413</guid>
		<description><![CDATA[Couple of times by now I had to solve the issue of finding and loading some files which are embedded in jar files in a web application, and each time had to find a solution. This time, however made a post on the blog, so next time I&#8217;m confronted with the same problem, the solution [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Couple of times by now I had to solve the issue of finding and loading some files which are embedded in jar files in a web application, and each time had to find a solution. This time, however made a post on the blog, so next time I&#8217;m confronted with the same problem, the solution would be handy.</p>
<p style="text-align: justify;">So, let&#8217;s assume we have couple of property files, or xml files or whatever, which could be possibly embedded in the jar files of the web application located in WEB-INF/libs folder. So, how can we retrieve the list of them, as we aren&#8217;t even aware of the jar files which could be in the libs folder?</p>
<p style="text-align: justify;">By searching the net, I found <a href="http://www.coderanch.com/t/278514/Streams/java/Reading-files-classpath-searching-pattern">this</a> thread discussing the issue, however seems like the code fails to work in Tomcat 6. After a bit of debugging the code and tweaking it, turned out the issue was related to the way the <span style="font-family: monospace;">ClassLoader</span>  was retrieved. The code which should be used (at least in case of Tomcat 6) is:</p>
<pre>ClassLoader applicationClassLoader = Thread.currentThread()
                .getContextClassLoader();</pre>
<p>After a bit more tweaking around and fixing some small issue, I ended up with a handy singleton which is really easy to be used:</p>
<pre>package some.package;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * Adapted source from
 * http://www.coderanch.com/t/278514/Streams/java/Reading-files-classpath-searching-pattern
 */
public class ClassPathSearcher
{
    static ClassPathSearcher instance = null;
    Set&lt;String&gt; classPathSet = new HashSet&lt;String&gt;();
    static final Logger log = Logger.getLogger(
            ClassPathSearcher.class.getName());

    private ClassPathSearcher()
    {
    }

    public static ClassPathSearcher getInstance()
    {
        if (instance == null)
        {
            instance = new ClassPathSearcher();
            instance.init();
            log.log(Level.INFO, "ClassPathSearcher initialized");
        }

        return instance;
    }

    private void init()
    {
        ClassLoader applicationClassLoader = Thread.currentThread()
                .getContextClassLoader();

        URL[] urls = ((URLClassLoader) applicationClassLoader).getURLs();

        for (URL url : urls)
        {
            String urlStr = url.getPath();
            if (urlStr.startsWith("file:"))
            {
                urlStr = urlStr.substring(5);
            }

            if (urlStr.endsWith("!/"))
            {
                urlStr = urlStr.substring(0,urlStr.length() - 2);
            }

            classPathSet.add(urlStr);
        }

        String classPath = System.getProperty("java.class.path");

        String[] pathElements = classPath.split(
                System.getProperty("path.separator"));

        for (String el : pathElements)
        {
            classPathSet.add(el);
        }
    }

    public Map&lt;String, InputStream&gt; findFilesInClassPath(String fileNamePattern)
    {
        Map&lt;String, InputStream&gt; result = new TreeMap&lt;String, InputStream&gt;();

        for (String element : classPathSet)
        {
            try
            {
                File newFile = new File(element);

                if (newFile.isDirectory())
                {
                    result.putAll(findResourceInDirectory(newFile,
                            fileNamePattern));
                }
                else
                {
                    result.putAll(findResourceInFile(newFile, fileNamePattern));
                }
            }
            catch (IOException e)
            {
                log.log(Level.WARNING, "Exception:"+ e);
            }
        }

        return result;
    }

    private Map&lt;String, InputStream&gt; findResourceInFile(File resourceFile,
            String fileNamePattern)
            throws IOException
    {
        Map&lt;String, InputStream&gt; result = new TreeMap&lt;String, InputStream&gt;();

        if (resourceFile.canRead() &amp;&amp;
                resourceFile.getAbsolutePath().endsWith(".jar"))
        {
            JarFile jarFile = new JarFile(resourceFile);

            Enumeration&lt;JarEntry&gt; entries = jarFile.entries();

            while (entries.hasMoreElements())
            {
                JarEntry singleEntry = entries.nextElement();

                if (singleEntry.getName().matches(fileNamePattern))
                {
                    result.put(jarFile.getName() + "/" + singleEntry.getName(),
                            jarFile.getInputStream(singleEntry));
                }
            }
        }
        return result;
    }

    private Map&lt;String, InputStream&gt; findResourceInDirectory(File directory,
            String fileNamePattern)
        throws IOException
    {
        Map&lt;String, InputStream&gt; result = new TreeMap&lt;String, InputStream&gt;();

        File[] files = directory.listFiles();

        for (File currentFile : files)
        {
            if (currentFile.getAbsolutePath().matches(fileNamePattern))
            {
                result.put(currentFile.getAbsolutePath(), new FileInputStream(
                        currentFile));
            }
            else if (currentFile.isDirectory())
            {
                result.putAll(findResourceInDirectory(currentFile,
                        fileNamePattern));
            }
            else
            {
                result.putAll(findResourceInFile(currentFile, fileNamePattern));
            }
        }

        return result;
    }
}</pre>
<p>Using it is really easy:</p>
<pre>Map&lt;String, InputStream&gt; files = ClassPathSearcher.
                getInstance().findFilesInClassPath("&lt;your pattern here&gt;");</pre>
<p>Sources can be found here: <a href="http://blog.bigpixel.ro/wp-content/uploads/2011/07/ClassPathSearcher.java_.txt">ClassPathSearcher.java</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/07/413/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nightstand Music Alarm Free</title>
		<link>http://blog.bigpixel.ro/2011/06/nightstand-music-alarm-free/</link>
		<comments>http://blog.bigpixel.ro/2011/06/nightstand-music-alarm-free/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 10:06:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[Alarm]]></category>
		<category><![CDATA[Clock]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=372</guid>
		<description><![CDATA[This  utility application developed by a colleague of mine and is a very good replacement of the build in alarm, or as a night clock. It will display a big digital clock on the screen, and information like actual date and when next alarm will sound. As features, this application include: Multiple alarms. Day by day alarm [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignleft" src="http://media.share.ovi.com/m1/s/2955/35bbc652f6a6418a96d2240bc0da4b88.jpg" alt="" width="128" height="72" />This  utility application developed by a colleague of mine and is a very good replacement of the build in alarm, or as a night clock.<br />
It will display a big digital clock on the screen, and information like actual date and when next alarm will sound. As features, this application include:</p>
<ul>
<li>Multiple alarms.</li>
<li>Day by day alarm selection (not just weekdays/weekend&#8230;.)</li>
<li>Internet radio as alarm or sleep music.</li>
<li style="text-align: justify;">Playlist for sleep &amp; wake up -possibility to choose between multiple text/background colors.</li>
</ul>
<p style="text-align: justify;">This application is featuring in a Qt developers contest, so if you feel like want to give to developer your vote, feel free to do it <a href="http://www.webcampaign.ro/_qtdevelopers/?page=castigatori">here</a> by voting the &#8220;Night stand music alarm&#8221; application.</p>
<p>Some screen shots of the application:</p>
<p><img class="alignnone" src="http://media.share.ovi.com/m1/s/2955/6389e7c4ce6142a7a26f2bd9ecf67a61.jpg" alt="" width="384" height="216" /></p>
<p><img class="alignnone" style="border-style: initial; border-color: initial;" src="http://media.share.ovi.com/m1/s/2955/4537ec467a994d7ea53b373de715ae86.jpg" alt="" width="384" height="216" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/06/nightstand-music-alarm-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We are in a new home</title>
		<link>http://blog.bigpixel.ro/2011/04/we-are-in-a-new-home/</link>
		<comments>http://blog.bigpixel.ro/2011/04/we-are-in-a-new-home/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 17:44:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=365</guid>
		<description><![CDATA[Blog was successfully moved to it&#8217;s new home. If anybody experiences any issues related to this, let us known.]]></description>
			<content:encoded><![CDATA[<p>Blog was successfully moved to it&#8217;s new home.</p>
<p>If anybody experiences any issues related to this, let us known.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/04/we-are-in-a-new-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email address validation in java using regexp</title>
		<link>http://blog.bigpixel.ro/2011/03/email-address-validation-in-java-using-regexp/</link>
		<comments>http://blog.bigpixel.ro/2011/03/email-address-validation-in-java-using-regexp/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 11:18:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Regexp]]></category>
		<category><![CDATA[RFC 822]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=354</guid>
		<description><![CDATA[One would think validating an email address is an easy task. Turns out however that is not that trivial, the grammar is quite complex. While many people use regexp to validate email addresses, most of them are way to simple to be able to correctly validate according to the grammar (does it allow + in [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">One would think validating an email address is an easy task. Turns out however that is not that trivial, the grammar is quite complex. While many people use regexp to validate email addresses, most of them are way to simple to be able to correctly validate according to the grammar (does it allow + in name? does it check for .. in domain name? and so on)</p>
<p style="text-align: justify;">One regexp which fits the bill quite ok is in the Perl module  found at this address: http://ex-parrot.com/~pdw/Mail-RFC822-Address.html which validates against to RFC 822 grammar.</p>
<p style="text-align: justify;">A utility class with the regexp from the perl module can be downloaded from here: <a href="http://blog.bigpixel.ro/wp-content/uploads/2011/03/EmailAddressUtil.txt">EmailAddressUtil</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/03/email-address-validation-in-java-using-regexp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working easier with DataSources in SmartGWT, part II &#8211; server side</title>
		<link>http://blog.bigpixel.ro/2011/03/working-easier-with-datasources-in-smartgwt-part-ii-server-side/</link>
		<comments>http://blog.bigpixel.ro/2011/03/working-easier-with-datasources-in-smartgwt-part-ii-server-side/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 00:09:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SmartGWT]]></category>
		<category><![CDATA[DataSource]]></category>
		<category><![CDATA[DMI]]></category>
		<category><![CDATA[SmartGWT EE]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=335</guid>
		<description><![CDATA[So far we have a way to generate the DataSource code based on a XML file describing the DataSource, making declaration of DataSources on client side (almost) a breeze. Now we need a way to either generate the server side code which is called by the DataSource or to create a generic one which can [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a title="Working easier with DataSources in SmartGWT" href="http://blog.bigpixel.ro/2011/03/09/working-easier-with-datasources-in-smartgwt/">So far</a> we have a way to generate the DataSource code based on a XML file describing the DataSource, making declaration of DataSources on client side (almost) a breeze. Now we need a way to either generate the server side code which is called by the DataSource or to create a generic one which can be used for all DataSources.</p>
<p style="text-align: justify;">Our generated code is using <span style="font-family: monospace;">RestDataSource</span> on client side, which implements the 4 core DataSource operations (<span style="font-family: monospace;">add</span>, <span style="font-family: monospace;">remove</span>, <span style="font-family: monospace;">update</span>, <span style="font-family: monospace;">fetch</span>) using a simple protocol of XML or JSON requests and responses sent over HTTP. This being completed already, let&#8217;s turn to server side and see how can we make things a bit better when generating the response XMLs we need to return when these operations are called on server side.</p>
<p style="text-align: justify;">The server provided with smartclient handles all DataSource communication using a servlet called <span style="font-family: monospace;">IDACall</span>. The server will instantiate a server side object which will take care of retriving the data (from datasource, computing it, etc) and returning it back to servlet.Then it will serialize it and will send it to the client side DataSource object.</p>
<p style="text-align: justify;">Checking the examples of smartgwt ee and smartclient enterprise and checking the provided java docs, seems like the servlet will create a <span style="font-family: monospace;">DSRequest</span> object which will be handled to the method called for <span style="font-family: monospace;">fetch</span>, <span style="font-family: monospace;">add</span>, <span style="font-family: monospace;">remove</span>, <span style="font-family: monospace;">update</span>. The response will be returned as a <span style="font-family: monospace;">DSResponse</span> object.</p>
<p style="text-align: justify;">We&#8217;ll recreate these objects on server and we&#8217;ll try to write a servlet which will try to successfully replace the one provided with the smartclient server when working with DataSources, not functionally, but maybe as how easy requests can be processed on server side.</p>
<p>Let&#8217;s get first some information about the client side RestDataSource.</p>
<ul>
<li style="text-align: justify;">The format of data sent to the server is determined by the <span style="font-family: monospace;">dataProtocol</span> specified for the operation. Request data is sent as parameters if the format is specified as <span style="font-family: monospace;">&#8220;getParams&#8221;</span> or <span style="font-family: monospace;">&#8220;postParams&#8221;</span>. We already set this in the DataSource which is extended by the client side DataSource we generate with generator as described in previous post.</li>
</ul>
<ul>
<li style="text-align: justify;">There is a standardized way to send back the answer. For example for <span style="font-family: monospace;">fetch</span> it looks like the following:
<pre>&lt;response&gt;
	&lt;status&gt;0&lt;/status&gt;
	&lt;startRow&gt;start row number&lt;/startRow&gt;
        &lt;endRow&gt;the end row number&lt;/endRow&gt;
        &lt;totalRows&gt;total number of rows&lt;/totalRows&gt;
        &lt;data&gt;
		&lt;record&gt;
			&lt;field1&gt;value&lt;/field1&gt;
			&lt;field2&gt;value&lt;/field2&gt;
		&lt;/record&gt;
		&lt;record&gt;
			&lt;field1&gt;value&lt;/field1&gt;
			&lt;field2&gt;value&lt;/field2&gt;
		&lt;/record&gt;
               ... 75 total records ... 
       &lt;/data&gt;
&lt;/response&gt;</pre>
</li>
</ul>
<p style="text-align: justify;">considering this and the information provided in javadocs <span style="font-family: monospace;">DSRequest</span> should at least contain , the DataSource id of DataSource which makes the request on client side, start row, end row, what kind of operation is requested, the field after which the sort is made, and a hash map with field value pair as a criteria of the request. For easy handling, we also include <span style="font-family: monospace;">HttpServletRequest</span>, <span style="font-family: monospace;">HTTPServletResponse</span> and <span style="font-family: monospace;">HTTPSession</span> objects of the servlet. We end up with something pretty much like:</p>
<pre>import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class DSRequest
{
	HttpSession session;
	HttpServletResponse response;
	HttpServletRequest request;

	private static String OPERATION_FETCH = "fetch";
	private static String OPERATION_UPDATE = "update";
	private static String OPERATION_REMOVE = "remove";
	private static String OPERATION_ADD = "add";

	String dataSourceName;
	String operationType;

	HashMap criteria;

	int startRow;
	int endRow;
	boolean paged;

	String sortBy;

	public DSRequest(String dataSourceName, String opType)
	{
		this.dataSourceName = dataSourceName;
		this.operationType = opType;
		endRow = -1;
		startRow = -1;
		paged = true;
	}

	public HttpSession getSession()
	{
		return session;
	}

	public void setSession(HttpSession session)
	{
		this.session = session;
	}

	public HttpServletResponse getResponse()
	{
		return response;
	}

	public void setResponse(HttpServletResponse response)
	{
		this.response = response;
	}

	public HttpServletRequest getRequest()
	{
		return request;
	}

	public void setRequest(HttpServletRequest request)
	{
		this.request = request;
	}

	public String getDataSourceName()
	{
		return dataSourceName;
	}

	public void setDataSourceName(String dataSourceName)
	{
		this.dataSourceName = dataSourceName;
	}

	public String getOperationType()
	{
		return operationType;
	}

	public void setOperationType(String operationType)
	{
		this.operationType = operationType;
	}

	public HashMap getCriteria()
	{
		return criteria;
	}

	public void setCriteria(HashMap criteria)
	{
		this.criteria = criteria;
	}

	public int getStartRow()
	{
		return startRow;
	}

	public void setStartRow(int startRow)
	{
		this.startRow = startRow;
	}

	public int getEndRow()
	{
		return endRow;
	}

	public void setEndRow(int endRow)
	{
		this.endRow = endRow;
	}

	public boolean isPaged()
	{
		return paged;
	}

	public void setPaged(boolean paged)
	{
		this.paged = paged;
	}

	public String getSortBy()
	{
		return sortBy;
	}

	public void setSortBy(String sortBy)
	{
		this.sortBy = sortBy;
	}

	public boolean isAdd()
	{
		return OPERATION_ADD.equals(operationType);
	}

	public boolean isRemove()
	{
		return OPERATION_REMOVE.equals(operationType);
	}

	public boolean isUpdate()
	{
		return OPERATION_UPDATE.equals(operationType);
	}

	public boolean isFetch()
	{
		return OPERATION_FETCH.equals(operationType);
	}
}</pre>
<p style="text-align: justify;">The DMI invocation passes the result back to the servlet wrapped in a <span style="font-family: monospace;">DSResponse</span> object. This <span style="font-family: monospace;">DSResponse</span> object should contain at least status of the response, start row, end row, total rows, data itself and a list of errors. Wrapping up, we get something pretty much like:</p>
<pre>import java.util.ArrayList;
import java.util.List;

public class DSResponse
{
	public static int STATUS_FAILURE = -1;
	public static int STATUS_LOGIN_INCORRECT = -5;
	public static int STATUS_LOGIN_REQUIRED = -7;
	public static int STATUS_LOGIN_SUCCESS = -8;
	public static int STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED = -6;
	public static int STATUS_SERVER_TIMEOUT = -100;
	public static int STATUS_SUCCESS = 0;
	public static int STATUS_TRANSPORT_ERROR = -90;
	public static int STATUS_VALIDATION_ERROR = -4;

	int status;
	long startRow;
	long endRow;
	long totalRows;
	Object data;
	List errors;

	public int getStatus()
	{
		return status;
	}

	public void setStatus(int status)
	{
		this.status = status;
	}

	public long getStartRow()
	{
		return startRow;
	}

	public void setStartRow(long startRow)
	{
		this.startRow = startRow;
	}

	public long getEndRow()
	{
		return endRow;
	}

	public void setEndRow(long endRow)
	{
		this.endRow = endRow;
	}

	public long getTotalRows()
	{
		return totalRows;
	}

	public void setTotalRows(long totalRows)
	{
		this.totalRows = totalRows;
	}

	public Object getData()
	{
		return data;
	}

	public void setData(Object data)
	{
		this.data = data;
	}

	public List getErrors()
	{
		return errors;
	}

	public void setErrors(List errors)
	{
		this.errors = errors;
	}

	public DSResponse()
	{
		status = STATUS_SUCCESS;

		errors = new ArrayList();
       		startRow = 0;
        	endRow = 0;
        	totalRows = -1;
	}

	public DSResponse(int status)
	{
		this.status = status;

		errors = new ArrayList();
        	startRow = 0;
        	endRow = 0;
        	totalRows = -1;
	}
}</pre>
<p style="text-align: justify;">The DMI object will return it&#8217;s answer in form of <span style="font-family: monospace;">DSResponse</span> object. The data member will contain the data part of the answer &#8211; the record or the records &#8211; returned to the client side DataSource while the additional fields of the <span style="font-family: monospace;">DSResponse</span> help the servlet build the REST response required by the client side DataSource.</p>
<p style="text-align: justify;">Having these set up, now we need a servlet which gets the request from the DataSource, creates a <span style="font-family: monospace;">DSRequest</span> object and fills it with information passed in parameter of the request / post parameters by the client side DataSource object, identifies the XML describing the DataSource, instantiate the class defined in the DataSource as responsible for DMI operations, then using reflection calls one of <span style="font-family: monospace;">add()</span>, <span style="font-family: monospace;">remove()</span>, <span style="font-family: monospace;">fetch()</span>, <span style="font-family: monospace;">update()</span> methods of the instantiated object, which will return a <span style="font-family: monospace;">DSResponse</span> object to the servlet. Using this <span style="font-family: monospace;">DSResponse</span> object, the servlet builds the XML response using the information from the object and also using reflection to generate the data part. If written carefully, we can reuse the code we used in DataSource generator to load DataSources and their fields, except in this case probably the best would be to load them at server startup and maybe create a mapping between the id of the DataSource and the DataSource object itself, for easier and faster referencing.</p>
<p style="text-align: justify;">The steps of doing this are:</p>
<ol>
<li style="text-align: justify;"> First we need to make a servlet and map it to the URL we declared in the generator (&#8220;/DMI&#8221; or anything else). This servlet will be used for all our DataSources.</li>
<li style="text-align: justify;">When servlet initializes, it should go over the defined DataSource xmls and should load them one by one, and create a mapping between the DataSource object and its id, which would make real fast lookup of DataSource by its ID.</li>
<li style="text-align: justify;">On incoming request, should parse the request and get all <span style="font-family: monospace;">_dataSource</span>, <span style="font-family: monospace;">_operationType</span>, <span style="font-family: monospace;">_startRow</span>, <span style="font-family: monospace;">_endRow</span>, <span style="font-family: monospace;">_sort_by</span> parameters and use these to build the <span style="font-family: monospace;"> DSRequest</span> object. Then should get all the other parameter value fields and cross-check them against the datasource fields, and if they are found,create a HashMap with their name / value as criteria of the operation, and store it also in the <span style="font-family: monospace;">DSRequest</span> object.</li>
<li style="text-align: justify;">Handle the operation &#8211; instantiate the DMI object and call the operation method (<span style="font-family: monospace;">add()</span>, <span style="font-family: monospace;">fetch()</span>, <span style="font-family: monospace;">remove()</span>, <span style="font-family: monospace;">update()</span> ) and get back the <span style="font-family: monospace;">DSResponse</span> object.</li>
<li style="text-align: justify;">Build the XML response according to the operation and information stored in <span style="font-family: monospace;">DSResponse</span>, and serialize the data part of the <span style="font-family: monospace;">DSResponse</span> using a generic XML serializer based on reflection, cross-referencing the name of fields with the fields declared in the DataSource xml.</li>
<li style="text-align: justify;">Send back the answer to DataSource.</li>
</ol>
<p style="text-align: justify;">Some notes on building the response:</p>
<ul>
<li style="text-align: justify;"> it will be easier if you write a generic XML serializer which can chew any kind of object (using reflection to get the object&#8217;s fields) and throw out the fields of the object in form of XML.</li>
<li style="text-align: justify;">make sure you can serialize both simple object and a collection of objects. By doing this, <span style="font-family: monospace;">DSResponse</span> won&#8217;t change, and there is no much difference in a DMI object related to returning a record or a list of records to DataSource. If a collection is returned, simply serialize each member of the collection using the serializer I&#8217;ve discussed about.</li>
<li style="text-align: justify;">do take in consideration the status flag of <span style="font-family: monospace;">DSResponse</span>. There are couple of standard values predefined as constants. In case of failure and success serialise the objects normally with status field and so (however on error there is no reason to serialize the data itself) but in case of authorization errors, instead of returning the status response, return the various markers defined by smartclient. The server side will detect them and will automatically trigger relogin flow. There will be a next article with more detail about implementing the relogin flow using SmartGWT.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/03/working-easier-with-datasources-in-smartgwt-part-ii-server-side/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working easier with DataSources in SmartGWT</title>
		<link>http://blog.bigpixel.ro/2011/03/working-easier-with-datasources-in-smartgwt/</link>
		<comments>http://blog.bigpixel.ro/2011/03/working-easier-with-datasources-in-smartgwt/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 14:26:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SmartGWT]]></category>
		<category><![CDATA[DMI]]></category>
		<category><![CDATA[Generator]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=301</guid>
		<description><![CDATA[While using the SmartGWT library makes easy to develop applications for smartclient,making some really interesting widgets available to user, together with databinding and various other goodies,  there are still some areas where things could be improved to make development even more easy. While some of these improvements are already made, they are not available in [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">While using the SmartGWT library makes easy to develop applications for smartclient,making some really interesting widgets available to user, together with databinding and various other goodies,  there are still some areas where things could be improved to make development even more easy. While some of these improvements are already made, they are not available in the LGPL package.</p>
<p style="text-align: justify;">One of things which can make development faster is the way DataSources are created.<br />
Currently you have to define the DataSource class in java file in the client package (which gets compiled / translated to javascript) or alternatively you have to declare it in javascript. You have to manually create each of the DataSource fields, and add it manually to the DataSource itself. Also, DataSources themselves arent really useful without back-end support so you need to somehow get the data from server. For this there are various possibilities, like Web Services, REST, simple XML, etc.</p>
<p style="text-align: justify;">There is however a better way to do this. The smartclient server allows you (next to some other things) to define the DataSource in XML. Then this is used to actually generate the DataSource based on what information is in the XML (fields, field names, titles, length, and various other fields). Also it allows defining a so called DMI object, which is the server side part of the DataSource, tightly integrated with it. The server itself offers a hierarchy of classes and a servlet which basically allows one to define a class which provides the data to the DataSource. This class is actually a simple object wich provides <span style="font-family: monospace;">fetch()</span>, <span style="font-family: monospace;">add()</span>, <span style="font-family: monospace;">update()</span> and <span style="font-family: monospace;">delete()</span> methods, and return the information in a standardised way. The server takes care of processing this and sending it back to the DataSource who requested the information.</p>
<p style="text-align: justify;">These two functionalities allow shorter development time, and also centralize the place where datasource information is stored. In the server-less approach you have to specify the structure of the DataSource when you define the DataSource and also you have to know the structure of that DataSource at least in the places where you send back the information requested by <span style="font-family: monospace;">fetch()</span>, <span style="font-family: monospace;">add()</span>, <span style="font-family: monospace;">update()</span> and <span style="font-family: monospace;">delete()</span>.And also, you have to take care of serializing the data.<br />
In the smartclient server, all this is handled automatically. You just need to create the XML for DataSource, and the DMI object which has the role of returning the (list / collection) of objects. More easy. Much cleaner.</p>
<p style="text-align: justify;">So, let&#8217;s take them in order.</p>
<p>First, let&#8217;s see how can we improve working with DataSource.</p>
<p style="text-align: justify;">Creating a DataSource would mean creating a new class which extends DataSource, then set up it&#8217;s fields, the place where the data is retrieved, it&#8217;s id, etc. Something like the code bellow (class declaration omitted, only the initialisation itself is shown):</p>
<pre>setID(id);
setRecordXPath("/List/country");
DataSourceField countryNameField = new DataSourceField("countryName", FieldType.TEXT, "Country");
DataSourceField countryCodeField = new DataSourceField("countryCode", FieldType.TEXT, "Code");
DataSourceField independenceField = new DataSourceField("independence", FieldType.DATE, "Independence");
DataSourceField populationField = new DataSourceField("population", FieldType.INTEGER, "Population");
DataSourceField gdpField = new DataSourceField("gdp", FieldType.FLOAT, "GDP ($B)");

setFields(countryNameField, countryCodeField, independenceField, populationField, gdpField);
setDataURL("ds/test_data/country.data.xml");</pre>
<p style="text-align: justify;">Having this kind of code written for each DataSource we define is tiresome and unnecessary, if we can define a generator which does this for us, based on a XML specifying the information to be generated.</p>
<p>The DataSource declaration could be something like:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;DataSource ID="DataSourceId"&gt;
&lt;fields&gt;
&lt;field title="ID" name="id" type="text" required="true" primaryKey="true"/&gt;
&lt;field title="Creator" name="creator" type="text" valueXPath="creator/displayName"/&gt;
&lt;field title="Name" name="name" type="text"/&gt;
&lt;field title="Description" name="description" type="text"/&gt;
&lt;field title="Bla Bla" name="blabla" type="text"/&gt;
&lt;/fields&gt;
&lt;serverObject className="DMIPackage.DMIHandler"/&gt;
&lt;/DataSource&gt;</pre>
<p style="text-align: justify;">Because later we need to identify the DataSource on server side also (to retrieve the DMI object) we need to store this somewhere in a package which is not compiled to Javascript. Also, for that purpose we added the <span style="font-family: monospace;">serverObject</span> tag. But our front-end is Javascript, we need a way to create some code based on this XML, code which ends up running on the client side. For this we can use a GWT generator.</p>
<p style="text-align: justify;">First, we need to define an interface which will trigger the generator itself (somewhere in the client package). Something like:</p>
<pre>public interface IDataSource
{
public void initFields();
}</pre>
<p style="text-align: justify;">is a good place to start. In <span style="font-family: monospace;">initFields() </span> we will generate the boilerplate code. We need to configure the module to trigger the generator for this interface. For this we need to edit the module XML file and add something like</p>
<pre>&lt;generate-with&gt;
&lt;when-type-assignable /&gt;
&lt;/generate-with&gt;</pre>
<p style="text-align: justify;">In order to trigger the generator for a given DataSource, we need to create a interface for that DataSource and extend it from our IDataSource interface. Each time code like this is encountered:</p>
<pre>IDataSource aDS = (IDataSource) GWT.create(ADataSource.class);</pre>
<p style="text-align: justify;">where <span style="font-family: monospace;">ADataSource </span> is a interface extending our <span style="font-family: monospace;">IDataSource </span> interface, our generator will be called to generate the source of that class. I won&#8217;t go in detail about how one writes a code generator for GWT, there is already lot if info about this subject available on Internet. Still, some clarifications are required:</p>
<ul>
<li style="text-align: justify;">the file name of the XML is generated from the class name to be generated. This can be made in various ways, this was easier to implement (alternatively we could add a tag in XML file to specify for which datasource provides information, load all the DataSource XMLs and search the one we need)</li>
<li>resources can be retrieved using ResourceOracle:
<pre>ResourceOracle oracle = context.getResourcesOracle();
Map&lt;String, Resource&gt; map = oracle.getResourceMap();
Resource res = map.get(resourceName);

// find our resource</pre>
</li>
<li style="text-align: justify;">In order to make things easier and to reduce the quantity of code generated, the class we generate extends a base class. This base class extends REST DataSource and set up the <span style="font-family: monospace;">add()</span> <span style="font-family: monospace;">fetch()</span> <span style="font-family: monospace;">remove()</span> <span style="font-family: monospace;"> update()</span>URLs to point to our servlet which simulates DMI, something like (the constructor is shown):
<pre>public BaseDataSource()
{
setID(id);
setFetchDataURL("/DMI");
setAddDataURL("/DMI");
setRemoveDataURL("/DMI");
setUpdateDataURL("/DMI");

OperationBinding fetch = new OperationBinding();
fetch.setOperationType(DSOperationType.FETCH);
fetch.setDataProtocol(DSProtocol.POSTPARAMS);

OperationBinding add = new OperationBinding();
add.setOperationType(DSOperationType.ADD);
add.setDataProtocol(DSProtocol.POSTPARAMS);

OperationBinding update = new OperationBinding();
update.setOperationType(DSOperationType.UPDATE);
update.setDataProtocol(DSProtocol.POSTPARAMS);

OperationBinding remove = new OperationBinding();
remove.setOperationType(DSOperationType.REMOVE);
remove.setDataProtocol(DSProtocol.POSTPARAMS);
setOperationBindings(fetch, add, update, remove);

initFields();
}</pre>
</li>
</ul>
<p style="text-align: justify;">All left now is to generate the code which set up the fields and add them to DataSource. I wont go in detail of this either. It&#8217;s as easy as getting all the fields, checking their type, and based on their type write the code which create the fields, set them up according to the information in XML and at the end add those fields to the DataSource. That&#8217;s all.</p>
<p style="text-align: justify;">Handling server side of DataSources will be in a separate post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2011/03/working-easier-with-datasources-in-smartgwt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenGL extensions supported by Galaxy S</title>
		<link>http://blog.bigpixel.ro/2010/11/opengl-extensions-supported-by-galaxy-s/</link>
		<comments>http://blog.bigpixel.ro/2010/11/opengl-extensions-supported-by-galaxy-s/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 20:14:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[NDK]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Extensions]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=296</guid>
		<description><![CDATA[Bellow is the list of OpenGL extensions returned by glGetString(GL_EXTENSIONS) (linked with the opengl ES 1.1 library): GL_OES_byte_coordinates &#160; GL_OES_fixed_point &#160; GL_OES_single_precision &#160; GL_OES_matrix_get &#160; GL_OES_read_format &#160; GL_OES_compressed_paletted_texture &#160; GL_OES_point_sprite &#160; GL_OES_point_size_array &#160; GL_OES_matrix_palette &#160; GL_OES_draw_texture &#160; GL_OES_query_matrix &#160; GL_OES_texture_env_crossbar &#160; GL_OES_texture_mirrored_repeat &#160; GL_OES_texture_cube_map &#160; GL_OES_blend_subtract &#160; GL_OES_blend_func_separate &#160; GL_OES_blend_equation_separate &#160; GL_OES_stencil_wrap &#160; GL_OES_extended_matrix_palette &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Bellow is the list of OpenGL extensions returned by <span style="font-family: monospace;">glGetString(GL_EXTENSIONS)</span> (linked with the opengl ES 1.1 library):</p>
<ul>
<ul>GL_OES_byte_coordinates</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_fixed_point</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_single_precision</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_matrix_get</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_read_format</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_compressed_paletted_texture</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_point_sprite</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_point_size_array</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_matrix_palette</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_draw_texture</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_query_matrix</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_texture_env_crossbar</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_texture_mirrored_repeat</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_texture_cube_map</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_blend_subtract</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_blend_func_separate</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_blend_equation_separate</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_stencil_wrap</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_extended_matrix_palette</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_framebuffer_object</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_rgb8_rgba8</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_depth24</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_stencil8</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_compressed_ETC1_RGB8_texture</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_mapbuffer</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_EGL_image</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_EXT_multi_draw_arrays</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_OES_required_internalformat</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_IMG_read_format</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_IMG_texture_compression_pvrtc</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_IMG_texture_format_BGRA8888</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_EXT_texture_format_BGRA8888</ul>
</ul>
<p>&nbsp;</p>
<ul>
<ul>GL_IMG_texture_stream</ul>
</ul>
<p>&nbsp;</p>
<ul>GL_IMG_vertex_program</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2010/11/opengl-extensions-supported-by-galaxy-s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring NDK with Eclipse (II)</title>
		<link>http://blog.bigpixel.ro/2010/11/configuring-ndk-with-eclipse-ii/</link>
		<comments>http://blog.bigpixel.ro/2010/11/configuring-ndk-with-eclipse-ii/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 20:22:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[NDK]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://blog.bigpixel.ro/?p=288</guid>
		<description><![CDATA[Since the Android NDK r4 it&#8217;s delivered with a script file helping the build (appropriatelly called ndk-build), I was interested how this can be integrated in the Eclipse&#8217;s build system. The purpose of this is is to have both the C++ and the Java code in same project folder (for easier handing with version control [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Since the Android NDK r4 it&#8217;s delivered with a script file helping the build (appropriatelly called <span style="font-family: monospace;">ndk-build</span>), I was interested how this can be integrated in the Eclipse&#8217;s build system. The purpose of this is is to have both the C++ and the Java code in same project folder (for easier handing with version control system) and to allow building the application from inside the Eclipse, without reverting to command line.</p>
<p style="text-align: justify;">The most of the steps are the same as in the previous post about integrating NDK with Eclipse.</p>
<p style="text-align: justify;">First, we need to convert the project to C++ project:</p>
<ul>
<li>right click on project root,then select New Project -&gt; Other -&gt; C++ -&gt; Convert to C++</li>
<li>check C++ project, choose Makefile and for toolchain choose other.</li>
<li>accept to open the C++ perspective.</li>
</ul>
<p style="text-align: justify;">Until this, the project was converted to C++ project. We now need to set up the input and output folders for C++ build:</p>
<ul>
<li style="text-align: justify;">create the <span style="font-family: monospace;">libs</span>, <span style="font-family: monospace;">jni</span> and <span style="font-family: monospace;">obj</span> folders. Set the output folders to <span style="font-family: monospace;">libs</span> and <span style="font-family: monospace;">obj</span>, then set the source folder to <span style="font-family: monospace;">jni</span> (in project properties, C++ General)</li>
</ul>
<p>And finally we need to set up a new builder:</p>
<ul>
<li style="text-align: justify;">while in C++ perspective, open project properties and choose builders, then uncheck everything related to CDT builder.</li>
<li style="text-align: justify;">create a new builder of type program.</li>
<li style="text-align: justify;">in the window with builder properties: first text field contains the ndk-build script location, second text field contains project location and the last one should contain <span style="font-family: monospace;">-C ${build_project}</span></li>
</ul>
<p style="text-align: justify;">And that&#8217;s it. You should be able to build your project, Clean and eclipse will run the required builders in order to build both java and C++ code and finally create the APK file.<br />
Before first build it is possible there will be some errors, but those will disappear after the build.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigpixel.ro/2010/11/configuring-ndk-with-eclipse-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

