Saturday, June 11, 2011

Solved: Maximum execution time exceeded file.inc on line 934

Some people at Harvard University have greeted a template extension on the basic Drupal installation named OpenScholar. OpenScholar is intended to provide people with a Drupal installation which can be used to host a website for professors and research groups primarily. Looking at the templates they have build I wanted to give it a go. The installation is basically the same as that of standard Drupal. During installation of OpenScholar I encountered a issue which is also in some cases seen when you install Drupal itself. After the first installation page your webserver comes back with a empty page, looking at the HTML source code of the "empty" page it turns out the following error message is thrown:

Fatal error: Maximum execution time of 65 seconds exceeded in /public_html/includes/file.inc on line 934

The maximum exception time is set in your PHP configuration, this indicates the amount of seconds that a script can take to complete its task. You can resolve this by simply changing the value to something higher. Issue with this is that if you are on a hosted environment, like at a hosting provider, you will not have the option to change this value as it is set for all users on that webserver. Some options are available to you however. First is, you can add a setting to your local .htaccess file where you can change it for that specific directory. You have to add a php_value max_execution_time to this file. Secondly you can initiate a override in your PHP code itself. 

However, most hosting providers will have set a setting preventing such overrides in their main PHP configuration. This is a simple and good approach from a hosting provider point of view. This is preventing certain user to consume all CPU power with bad code. For most users those options will not be valid as was in my case as I installed it not on my own server and was trying to install it on a server at a hosting provider.

Meaning we have to look into other options to resolve this issue. Looking at the code we found that the issue is coming from a part of the code that is checking the files on the file system to verify that all files needed for the installation are present. This scanning of the filesystem in some cases take more time than the time set for the max execution time. With some help from Sam Adams and his postings on acquia.com forums I found that you can prevent this scan from happening by hacking the install.inc file. What you have to do is open the file in VI and change the following line:

$installs = drupal_get_install_files($module_list);

into this:

$installs = array();

This will populate the variable $installs with a empty array and it will not call drupal_get_install_files with a list of modules to be checked. After making this change the installation go's without any issue. 

Posted via Johan Louwers his Posterous page to his blogger page.

Thursday, June 09, 2011

Solved: oracle XE web-interface not working

I recently installed Oracle XE on a laptop to play around with. I installed the latest version of Oracle Linux and downloaded the Oracle XE database. After installation all was working fine, including the web-interface you get when you install Oracle XE.

After shutting down the laptop and starting it again the next day for some reason the web interface was not working. Connecting to http://localhost:8080 was resulting in a 404 error page meaning the page could not be found.

After some looking into my listening ports I found that no service was listening on port 8080. Checking the Oracle database listener gave the first clue:
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 09-JUN-2011 11:10:25
Uptime 0 days 0 hr. 12 min. 30 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

the status command within lsnrctl stated clearly that PLSExtProc was having some trouble. Issue is that if you configure your machine to make use of DHCP and do not state a hostname and you come to a network where the DHCP server will provide you with a hostname the hostname is not matching with the hostname set during the installation of the Oracle XE database.

Solution to this is to state a hostname and do not let your DHCP server push one towards you. After changing this you have to change the content of listener.ora and tnsnames.ora to make sure the hostname matches with the newly entered hostname. When done do a force-reload (or stop and start) of /etc/init.d/oracle-xe.

When you have done those steps you can request the status again via lsnrctl and you will see something like the below outcome. You can also open a browser and connect to localhost:8080 and you should see the web-interface. a.k.a. Problem solved.

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 09-JUN-2011 11:28:44
Uptime 0 days 0 hr. 0 min. 9 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=johanlinux.capgemini.nl)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
Service "XE_XPT" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>

Tuesday, June 07, 2011

Create structure with microdata

Already some time ago HTML was created to be able to provide a structured way of creating content for the web. HTML makes sense to your browser and enable you as a user to view the website in a way the developer of the site intended to (or at least that is the intention of the developer. Having a structured way to create documents is great and needed to enable all browsers to show the data in (almost) the same way. On the other hand companies who run search engines, for example Google Search and Microsoft Bing, deploy index robots who crawl all the websites on the web to index what is on it and store this is the datastores which they use to query.

Both, browsers and crawl robots need structured data. In the current version of HTML their is enough structure to display the content in a browser, however for a crawl robot it is in some cases not enough. For example, if you create a image gallery you will most likely state where it is taken, who is on it, and when it is taken. This will be in a simple way that you as a user understand it when it is rendered by your browser from the HTML code. However for a crawl robot and the algorithm used to search the index created by the search robots this can be quite hard to figure this out.

An other example, if you have a store which sells hardware supplies you will most likely a page which states where your shop is and when it is open. It would be ideal for a search engine if you clearly state in a structured way which data on this page is talking about your location, which part about the time you are open and some parts about what kind of a store you are. The good part about modern websites is that most of the websites are rendered based upon data which is in a structured data, for example a database of XML files. However when we display this data to the users on the web via HTML this structure is sadly abandoned.

Putting back this structure enables applications and search engines to benefits greatly. For this reason Microsoft, Google and Yahoo have created schema.org which can be used as a vocabulary for the microdata format. This format enables you to structure the data in such a way that search engines will be able to index your site better and by doing so provide it higher in the results when someone searches for it. Using the microdata format and the vocabulary of schema.org will provide you the best result while keeping the way your data is shown in a browser the same.

Currently the schema.org hierarchy is not completed and will most likely never be completed however it is providing a first draft on how you could structure your data. For example coming back on the picture with the text I stated at the beginning of this page. In html it should most likely look a bit like this:

<html>
<body>
<img src="some_image.png">
<br><b>Description : </b>Johan Louwers inspecting the place before takeoff
<br><b>Location : </b>Hilversum airfield
<br><b>Date : </b>07-MAY-2011
</body>
</html>

This is providing a very simple page showing a picture and telling you who is on this picture, where it is taken and when it is taken. For a human this is no problem to interpret. For a algorithm this can be a little harder. specially for this the microdata can be used with the information from schema.org to make sure you are consistent. To make sure a search index knows what is what and also that it is related to the picture you can also use the code below. The result in your browser will be exactly the same however the indexing and the resulting position within a search engine can be completely different.

<html>
<body>
<div itemscope itemtype="schema.org/ImageObject">
<img src="some_image.png">
<br><b>Description : </b><span itemprop="description"><span itemprop="name">Johan Louwers</span> inspecting the place before takeoff</span>
<br><b>Location : </b><span itemprop="contentLocation">Hilversum airfield</span>
<br><b>Date : </b><time itemprop="publishDate" datetime="2011-05-07">07-MAY-2011</time>
</div>
</body>
</html>

If you look closely at the code you can see that we have placed most of the HTML code within a div;

<div itemscope itemtype="schema.org/ImageObject">

<div>

As you can see we make use of itemscope to tell that this is a div for starting the scope of the item (within the div) and we state that the itemtype we are making use of is a image object as is defined by schema.org . to be precise we are making use of a itemtype defined at schema.org/ImageObject. If you check this web location you will find more detailed information of what the options are you can use to describe an ImageObject.

The description we have change to the following line:

<br><b>Description : </b><span itemprop="description"><span itemprop="name">Johan Louwers</span> inspecting the place before takeoff</span>

In this we nest to things, first we create a itemproperty for the description which is "johan Louwers inspecting the place before takeoff" which is correct, however the "Johan Louwers" part is a person so to inform the interpreter of our microcode that this part of the description is a person we place a itemprop(erty) for person within the itemprop(erty) for description.

The current location is defined as below by using a itemprop(arty) contentLocation which is telling the search engine where the picture is taken. The great part of this is that more and data is getting location aware. By adding a proper location format to your code you will add to this and when someone is searching for for example pictures with the following search string "Hilversum Airfield 2011" your image is more likely to come up with your picture.

<br><b>Location : </b><span itemprop="contentLocation">Hilversum airfield</span>

To make sure that the time when this picture is also indexed correctly we can add the correct time (without having to thing about what date format you want to display and could be used to search on) using the following option:

<br><b>Date : </b><time itemprop="publishDate" datetime="2011-05-07">07-MAY-2011</time>

A lot more options can be displayed or not be displayed and only used to inform the interpreter of your microcode. For example, I think the picture is quite family friendly and nothing inappropriate is shown on it. So I would like to inform the world this is familyfriendly which can be done with the itemprop isFamilyFriendly which is a boolean value, I do however not want to show this explicitly. By using the below code I only make it available in the source of my page however the user will not have anything displayed on his screen

</span isFamilyFriendly="true"/>

Now you can argue that this, and taking into consideration all the other options you can use in your microdata are not really useful for some home build image gallery where you show your holiday pictures. On the other hand, why would you not like to turn up when someone is looking for the pictures of that great vacation you told him about, is that not the soul reason you place them online. If you are not willing to enable all this kind of microdata that is perfectly fine. If you are running a business this is however a whole other point. As a business being found on the internet is currently the difference between survival or not and this will become more and more the case. If someone is looking for something, interested in buying a product, it is most likely this person will go online first and then come to your shop. If he is unable to find your shop online he is very unlikely to find your store and make a purchase. Meaning, if you want to stay ahead of the rest it is very important that you take a good look into microdata or you might find that the competition is winning.

Sunday, June 05, 2011

MongoDB architecture

As already stated in some previous blogposts the MongoDB is somewhat different than the databases you are might used to. The concept a schema, a table and a record is something that is not used within the MongoDB setup. When you are used to work databases like a Oracle database this might come a little strange to you at first however due to the nature of MongoDB you will get the hang of it quite quick.

To visualize the way MongoDB is working you can see the below chart;

Database;
within MongoDB you will be able to create separate databases. A database will use its own users, store it own data and will be its own datafile on your servers filesystem. As a good practice you can keep the rule that evert application should have its own database. a example of how to create a database you can see in this previous blogpost.

Collection;
As stated MongoDB is not using the concept of a table, if you would like to make a reference between MongoDB and a "normal DB" you can state that a collection is a table. A collection holds one or more documents. lets say you want to add the following document to your database {"shipping_number" : "1046", "receivedate" : "12-FEB-2011"} you will have to place this in a collection. You can state that the document in this case is the record (or row). To insert this in the collection shipping you can enter the use the following command;

db.shipping.insert({"shipping_number" : "1046", "receivedate" : "12-FEB-2011"})

One more option is to mention when we are talking about collections, sub-collections. You have the option to logically group collections in a sub-collection. This is not having any technical implication, it is just a handy feature which can make you development and administration a little more easy. For example if you have a lot of collections regarding shipping in your database, for example data on shipments, trucks, locations of warehouses, authorized personal, average loading times, etc etc etc. You might want to group all those collections in a logical way so that people who work on developing code for your shipping module know where to find this this code. If you want to insert the above line however now you would like to make use of sub-collections (for example the sub-collection "ship" you should use the following command:

db.ship.shipping.insert({"shipping_number" : "1046", "receivedate" : "12-FEB-2011"})

Documents;
we already touched the subject of documents, a document can be seen as the record (or row) in your table. In MongoDB this is a document in a collection. meaning that your document which you inserted in the previous example is in essence; {"shipping_number" : "1046", "receivedate" : "12-FEB-2011"}

Key-value pair:
the key value pair can be compared the best with the column and the value of a record. For example {"shipping_number" : "1046", "receivedate" : "12-FEB-2011"} in this document (record) we have 2 key-value pairs (columns), the shipping_number column and the receivedate column. In this example the shipping_number key has the value 1046 and the key receivedate has the value 12-FEB-2011.

If you take this comparison as a guideline this might help you to translate your idea from a standard DB into a MongoDB way of thinking.

Wednesday, June 01, 2011

Creating a new database in MongoDB

When you start with MongoDB it might be beneficial to not have any experience with databases in some cases as MongoDB is just handling things and approaching things in a different way. Within for example Oracle we are used to having schema, a table, records and columns. Within MongoDB you have to forget all of this as they are not working with a schema or a table. The best you can describe a schema within MongoDB is the concept of a "database" in mongo in which you will store things.

So when you are working with MongoDB you have to learn how you can work with databases, create them and switch between the different databases. When you login to a MongoDB you most likely would like to know which databases are currently in MongoDB. To get a list of all databases you can use "show dbs"

> show dbs
admin (empty)
callreg 0.0625GB
local (empty)
test 0.0625GB
>

local, test and admin are installed by default, the callreg database is something I created to do some testing. If you want to switch between one database and another you can use the command "use " for example if we want to switch to the callreg database you can use the command "use callreg".

> use callreg
switched to db callreg
>

Now lets say we want to create a new database specially for handling shipping data, we will name it shipping. Basically you do not create a database within MongoDB as such. you can just switch to the (not yet existing) database by using the command "use shipping". This will bring you to the database shipping. Now if we insert data into this database it will be directly created. In the below example you see that we switch to the shipping database (which is not existing yet) and insert a document.

> use shipping
switched to db shipping
>
>
> db.shipping.insert({"shipping_number" : "1045", "receivedate" : "12-FEB-2011"})
>

if we nog check the list of databases using the "show dbs" command you will see that the database is created.

> show dbs
admin (empty)
callreg 0.0625GB
local (empty)
shipping 0.0625GB
test 0.0625GB
>

This is how you quickly create a new database, switch to the database (even if is not yet existing) and insert something into the database.

Monday, May 30, 2011

Solved: REST is not enabled

When you open the MongoDB web console (typically running on your local machine on port 28017) and you select for example the commands link (http://localhost:28017/_commands) you might run into a error page stating "REST is not enabled. use --rest to turn on."

Reason for this is that you started the database without the --rest option. To do this you can start the database from your MongoDB bin directory like "./mongod --rest". This will solve the issue. It is however not explaining what --rest is doing.

According to Wikipedia REST is nothing more than Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation.Fielding is one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification versions 1.0 and 1.1. Conforming to the REST constraints is referred to as being ‘RESTful’.

When adding the --rest when starting MongoDB will enable you to do a lot more and interact in more ways to your MongoDB database from your webinterface. This however means that also other people can connect and do more than without the --rest option. For this reason it is good to take into consideration if you want the --rest option activated and if so how you want to secure access to it. You can for example think about having a firewall rule (local or in your network) which states that only certain machines can access the web interface port.

Render XML into DIV using AJAX and XSL

while trying and playing with some div layers in html and handling XML XSL translations I found out that when you load a XML file containing a link to a XSL file to transform it to HTML in the browser it works fine. However if you juts load it via a standard javascript in a div layer this is not working. you can use javascript to load (pure) html in a DIV a display it within your page, if you load XML it will however not being rendered as one should expect.

For this you will need a small java script. I build the below example. This example is showing how you can load dynamically a XML file in combination with a XSL file, have it transformed into HTML and display it in a DIV element in your page. The nice thing about this approach is that you only have to create your XML file and have the rendering done on your clients workstation. If you update the content of the XML your page will automatically contain new information the next time a user requests the page. A second benefit is that if you want to change the layout of your page you have to only update you XSL style sheet. The example I provide below is quite simple where I use AJAX in combination with XML and XSL to dynamically rendered HTML content of a CD catalog on a page when clicked on a link. The example is not really useful as a page/application however it is showing how you can use the script.

The example contains 2 XML files, 1 XSL file and a HTML file. If you place them all in the same location and open test.html you will see how it is working.

test.html

<html>
<head>
<script>
function loadXMLDoc(dname) {
if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest();
} else {
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET", dname, false);
xhttp.send("");
return xhttp.responseXML;
}

function displayResult(source,styledoc) {
xml = loadXMLDoc(source);
xsl = loadXMLDoc(styledoc);
//set a &nbsp to make prevent FF to append the text by double click
document.getElementById("mydiv").innerHTML = "&nbsp;";
// code for IE
if (window.ActiveXObject) {
ex = xml.transformNode(xsl);
document.getElementById("mydiv").innerHTML = ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument) {
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml, document);
document.getElementById("mydiv").appendChild(resultDocument);
}
}
</script>
</head>
<body>
<a onclick="displayResult('cdcatalog.xml','cdcatalog.xsl')" href="javascript:void(0);">catalog 1</a>
<a onclick="displayResult('cdcatalog2.xml','cdcatalog.xsl')" href="javascript:void(0);">catalog 2</a>
<div id="mydiv">
</div>
</body>
</html>

cdcatalog.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Di.</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
</catalog>

cdcatalog2.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
<title>Some title </title>
<artist>Some artist</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Some othertitle </title>
<artist>The artist</artist>
<country>USA</country>
<company>Columbia</company>
<price>11.40</price>
<year>1985</year>
</cd>
</catalog>

cdcatalog.xsl

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="artist" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Friday, May 27, 2011

Running MongoDB on a mac

In a previous blogpost I stated that I found out about MongoDB, a database type I never heard of before. I have downloaded it and "installed" it on my macbook air. As I come from a Oracle background and work with Oracle databases primarily I was surprised by the ease of installation and getting things up and running. Up and running without the tuning.

I a couple of simple steps you can get a working copy of MongoDB on your local mac workstation. If you follow these steps you will be set to start exploring MongoDB

1) Go to the mongodb.org website and download the needed .tgz file.

2) Unpack the file and copy the files to a location where you want to have your MongoDB binary files.

3) Create a directory /data/db this is the default location where your data will be stored, you have to create this manually.

4) Go to your MongoDB bin directory and start mongod

5) Open a second terminal and execute in the MongoDB bin directory the mongo command.

Step 5 will put you in the MongoDB shell and you are ready to go and explore the options of MongoDB. This is all you need to start exploring MongoDB.

As a example below you can see the output of the mongod command on my local workstation:

Johan-Louwerss-MacBook-Air:bin suntac$ ./mongod
./mongod --help for help and startup options
Fri May 27 14:48:50 [initandlisten] MongoDB starting : pid=17438 port=27017 dbpath=/data/db/ 32-bit

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
** see http://blog.mongodb.org/post/137788967/32-bit-limitations
** with --dur, the limit is lower

Fri May 27 14:48:50 [initandlisten] db version v1.8.1, pdfile version 4.5
Fri May 27 14:48:50 [initandlisten] git version: a429cd4f535b2499cc4130b06ff7c26f41c00f04
Fri May 27 14:48:50 [initandlisten] build sys info: Darwin broadway.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Fri May 27 14:48:50 [initandlisten] waiting for connections on port 27017
Fri May 27 14:48:50 [websvr] web admin interface listening on port 28017

Wednesday, May 25, 2011

MongoDB with BJSON, How could I have missed it

Every now and then you have the feeling "how could I have missed this". In my case this came today when I was looking for a quick to deploy and easy to use database platform. I am currently working on a little project to automate some of my tasks at home and for this I am in need to store information. One options was storing it in XML files on the filesystem. However, due to the fact I am a Oracle guy I tend to look for a database solution first. Having a Oracle database running for the storing of this information is a little overkill and I wanted it to be standalone so using one of my already running Oracle databases for this was not an option.

MySql, PostgreSQL and some other things came to mind however when doing some fun google work I came to a database type I did never heard of before and looking at it the phrase "how could I have missed this" came to mind.

MongoDB is a easy to deploy database and has some great options. Maybe not for this little project but for a lot of other projects this can come in handy. MongoDB is not having schema's such as most databases and documents are stored as BJSON (Binary JavaScript Object Notation)

If you look at he way how to interact and query a MongoDB it somehow comes very naturally if you play with it. Below you can find some information from youtube from a Google User Group meeting where Will Shulman, founder and CEO of MongoLabs, give us an excellent overview on how to persist our mobile app data in the cloud using the super-scalable and amazingly developer-friendly MongoDB back-end.

Part 1:

Part 2:

Posted via Johan Louwers his Posterous page to his blogger page.

Solved: android tab layout example

When you are starting with Android development you will most likely start with looking at some of the examples provided by Google. Within the Google development guide you will find some examples. I have already touched the "hello world" example in a previous blogpost where I was discussing the boot speed of the Android Emulator. After you have completed the "hello world" example you most likely would like to pickup some of your development work. A good example you can follow to get some understanding of building a Android layout is the "Tab Layout" example.

I have been completing the "Tab Layout" example and ran into some error's and found that more people are having difficulty completing the "Tab Layout" example. Reason for this is that the google example is a example and not a step by step guide on how to program for Android. As I found some well discussed issues with this example I found that a lot of people have difficulties with this example.

To help those people you can find the source of the example I build. The main issue I personally encountered in this example is the content of the androidmanifest.xml file. I hope this post will give you some more insight in how to develop a tab layout and will help you understand how to work with the example given by Google.

AlbumsActivity.java
package com.terminalCult.helloTab;
//import some stuff we need to get the example code running
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

// starting the class
public class AlbumsActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
//show some text to state which tab this is
textview.setText("This is the albums tab");
setContentView(textview);
}
}

ArtistsActivity.java
package com.terminalCult.helloTab;
//import some stuff we need to get the example code running
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

// starting the class
public class ArtistsActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

TextView textview = new TextView(this);
//show some text to state which tab this is
textview.setText("This is the Artists tab");
setContentView(textview);
}
}

SongsActivity.java
package com.terminalCult.helloTab;
//import some stuff we need to get the example code running
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

// starting the class
public class SongsActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

TextView textview = new TextView(this);
//show some text to state which tab this is
textview.setText("This is the songs tab");
setContentView(textview);
}
}

helloTab.java
package com.terminalCult.helloTab;
import android.os.Bundle;
import android.app.TabActivity;
import android.content.*;
import android.content.res.*;
import android.widget.*;


public class helloTab extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab

// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, ArtistsActivity.class);

// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("artists").setIndicator("Artists",
res.getDrawable(R.drawable.ic_tab_artists))
.setContent(intent);
tabHost.addTab(spec);

// Do the same for the other tabs
intent = new Intent().setClass(this, AlbumsActivity.class);
spec = tabHost.newTabSpec("albums").setIndicator("Albums",
res.getDrawable(R.drawable.ic_tab_albums))
.setContent(intent);
tabHost.addTab(spec);

intent = new Intent().setClass(this, SongsActivity.class);
spec = tabHost.newTabSpec("songs").setIndicator("Songs",
res.getDrawable(R.drawable.ic_tab_songs))
.setContent(intent);
tabHost.addTab(spec);

tabHost.setCurrentTab(2);
}
}

ic_tab_albums.xml










ic_tab_artists.xml








ic_tab_songs.xml








main.xml








AndroidManifest.xml


































Monday, May 23, 2011

Solved; Android Emulator not starting

Android_boot

When you start working with the Android development tools to develop your first Android Application you will, most likely, be using the Eclipse tools provided and you will most likely start with a HelloWorld example. HelloWorld examples are used in almost every programming guide to show you a "Hello World" text. It is considered the most simple application of showing something on the screen. Google has also provided a Hello World example which will show you how to work with eclipse plugin and how the emulator is working. If you are following the steps in the development guide from Oracle you have to run your application at some point. This is however a point I feel a lot of people will drop it if they are not really determine. The reason is not that it is complex, the reason is that you have to wait and you are not warn that you have to wait.

When you run a example the first time you expect it to be on the screen directly. However when you run your HelloWorld example you see the Android Emulator coming up with on the word "ANDROID" in a black screen and not the expected "Hello World" text. Reason for this is quite simple as is the solution. When you click run for the first time the entire emulator has to be started and the "ANDROID" message is the first stage of the boot screen. Solution; wait. After some time you will see the android splash screen coming up and short after that your application. Now you also have a complete Android device and the basic Android OS you can use and play with.

Meaning, if you only see "ANDROID" in your screen when you run your application for the first time, do not be afraid, you most likely did not make a mistake you simply have to wait for one or two minutes for the emulator to boot completely. After that you can go back to your development environment and change whatever you like. If you click run the second time and you have closed down your emulator only the new code will be loaded into the emulator and it will not have to be rebooted.

Posted via Johan Louwers his Posterous page to his blogger page.

Oracle Complete Positioning Versus Competetion

During the "Oracle Day 2011" organized by the Oracle User Group in Estonia OUGE a talk was given by Shahin Taromsari on the subject "Complete Positioning Versus Competetion". Shahin is given a very nice view on the Oracle strategy for the upcoming time in a relaxed way and providing a insight in what it will mean in the upcoming time for your company or what it can mean in the upcoming time. After the merger with Sun Microsystems they have now the option to build the entire stack in one company. They can build the hardware and the software which enables Oracle to create the best solutions in the market. Even do they are able to do so, in my opinion, Oracle is still a software vendor playing to be a hardware vendor. They have a hard time to make the shift to also think like hardware vendors think. This process will take some time however I do have a feeling that in the end they will succeed. A long way however has to be taken before it will become the success that it could be. I already understand from a lot of people that some frustration is raising within the relationship with the new Sun Microsystems part of the company and clients as former Sun employees now have to confirm to the way of working as set by Oracle. This way of working is a software vendor way of working and not a hardware vendor way of working.

I am confident that Oracle is having a lot of smart people working on this culture issue and will come with a solution, I only hope this will come quick and that they understand that change is needed on both the software side as the hardware side. People of research and development departments tend to work already together in a great way and started engineering new products that work together in a better way now the rest of the company will have to follow.

 

Posted via Johan Louwers his Posterous page to his blogger page.

Thursday, May 19, 2011

Installing a Android dev environment

When you want to start developing applications for the android platform you will need to setup your development platform. In my case this will be my macbook so you might find some references to the mac platform however for Linux it will be quite the same I guess. The android development platform consists out of two major parts. the first is the Android Software Development Kit (SDK) and the second part is the Eclipse plugin.

Downloading the SDK can be done from the google android developers page. Just download the zip file and unpack it somewhere on your machine where you think it is appropriate to store it.

The second part is to install the eclipse plugin. For some reason it is also possible to download all the parts of the SDK from the eclipse plugin option. In my case it was even needed as for some reason I was unable to associate the downloaded SDK with the eclipse plugin.

To install the eclipse plugin you go to "help" -> "Install new software". here you can add the location where Google is storing the eclipse plugin; https://dl-ssl.google.com/android/eclipse/

This will enable you to download the plugin. After downloading the plugin eclipse would like to restart the application. After you have restarted the application you will find a new menu item under "window" named "Android SDK and AVD Manager". when you select this you will be able to activate, update and download more parts of the eclipse plugin for Android development.

In my case I had to look under "installed Packages" and do a "update all" for some reason as it was unable to associate the downloaded SDK with the eclipse plugin.
After this action my "installed packages" section looked like the screenshot which you can see above here and all was set to start working on Android applications.

Wednesday, May 18, 2011

Using Oracle Business Process Management

I was recently asked to help some people with looking into the processes and procedures of one of our clients at Capgemini. I was involved at this customer due to the fact that they have a large Oracle landscape which is used across the EMEA region and as I am already familiar with the customer and I have done already work in setting up processes and procedures to connect demand organizations within the Capgemini rightshore model I started looking into the situation. The question was how can we advise the customer to change some of the processes and procedures concerning Incident management so the service towards the end users is faster and more cost effective.

After some time of whiteboard sessions a couple of models came to my mind. The difficulty however with those kind of models is to find out which one will work best in a realtime situation and where will we find bottlenecks. I installed the Oracle BPM part of Oracle jDeveloper a couple of months ago however did not had the option to play with it. It turned out that we where able to create all the scenario's within the BPM tool and simulate all kind of situations. By using Oracle BPM I was able to quickly model the different scenarios and play situations on them. By doing so we could simulate a realtime situation and change the processes and procedures in our final advise so the customer can implement them.

If you are ever in the need of simulating business processes you should give Oracle BPM a look. Below you will find a youtube movie and a presentation which give you some more info on the subject and will show how to model a test situation.

The below video is made by Marcus Davies from Integrella which shows you quickly how you can model a simulation within Oracle jDeveloper.

Posted via Johan Louwers his Posterous page to his blogger page.

Monday, May 16, 2011

Oracle Roadmap to Enterprise Cloud Computing

As some of you might know I have been busy developing the new Capgemini Cloud Computing strategy and solutions the past half year for Oracle products. Due to this I have been talking to Oracle a lot and we both Capgemini and Oracle have been working together the past half year to get things in both a business as a technology way up and running. We are at the doorstep of launching this new platform so from time to time I am already allowed to slip some information to the outside world.

It is interesting to watch that the combination Capgemini and Oracle have a strong research and development partnership during the build of our new cloud platform. It is also nice to see that Oracle is running their own roadmap which includes quite some of the same viewpoints as we are having within the team inside Capgemini. This is not very surprising as we are developing this together with Oracle.

To me personally and to Capgemini it comes as a no-brainer that cloud computing is the future and the road we should take and which we are taking. However a lot of different opinions within do exist within the IT world on what cloud computing is, which way we should go and what the best way is to create a cloud computing platform. I am not diving into this discussion at this moment. Some very good mailing lists do exist on the future and the roadmap of cloud computing and if you are interested in discussing on the future of cloud computing I would invite you to join one of them.

Within this post I would like to share a presentation from Oracle which is given by Rex Wang who is vice president and is sharing the Oracle roadmap and vision on cloud computing. A very interesting presentation to watch if you are interested in the cloud computing topic. This presentation is on enterprise cloud computing so it is not touching public cloud computing. In my personal opinion we will see a lot of things happening in the field of private and enterprise cloud computing as companies do tend to prefer having data inside their own network and are getting more and more data to process and the need for more and more on-demand computing power.

Posted via email from Johan Louwers posterous page