Pages

Monday, May 25, 2009

Virtual social 3D World

Today, I take a look on SecondLife and its competitors.

http://en.wikipedia.org/wiki/SecondLife


I notice 2 things related to business in this article:

"In September 2008, over 15 million accounts were registered" => this is a good community and good place for business.

 

"In 2007, Brazil became the first country to have its own independently-run portal to Second Life, operated by an intermediary—although the actual Second Life grid accessed through the Brazilian portal is the same as that used by the rest of the worldwide customer base" => Localizaiton is one of trends in SecondLife

 

Below is  the list of competitor with SecondLife:

 

Virtual social 3D World is one of trends in the future and going to be a rich land for business. Why don't we start something with it from now?

Friday, May 22, 2009

Ubuntu 9.0.4 shutdown dialog - who wants?

In previous version (Ubuntu 8.10), when you shutdown your computer - no dialog appears. I am happy with this. I think many users also like this - same to me. In Windows, if you shutdown - it asks you for confirmation. It makes us confuse a lot and take time for an action to choose OK - I REALLY WANT TO SHUTDOWN - BECAUSE I FEEL SO TIRED - I WANT TO LEAVE MY COMPUTER AS SOON AS POSSIBLE.


To improve it, MS Vista and Windows 7 do not show this dialog any more. Why Ubuntu 9.0.4 does a backward thing? Why they don't research common behavior of end user? I don't know. It's quite difficult to understand.

Wednesday, May 20, 2009

Augmented reality - do you want to take a photo with a real dinosaur?

Augmented reality (AR) is a field of computer research which deals with the combination of real-world and computer-generated data (virtual reality), where computer graphics objects are blended into real footage in real time.

At present, most AR research is concerned with the use of live video imagery which is digitally processed and "augmented" by the addition of computer-generated graphics. Advanced research includes the use of motion-tracking data, fiducial markers recognition using machine vision, and the construction of controlled environments containing any number of sensors and actuators.
From wikipedia

And this is what we use with this technology in R&D division:

Take a photo qwith a real dinosaur
 


If you want to take a photo with this nice dinosaur, contact me!

Install Magento on Ubuntu - problems and solutions

Magento is one of best open source e-commerce systems at this time. So, I decide to install and play around with it to understand deeply its business concepts and the system architecture behind.

When install Magento on my Ubuntu, I met several problems. To save your time - if you want to play with magento, I share to you my experience to solve them here.

Problem 1: curl module loading error
You will meet this problem at beginning steps of installation. The root cause is: you haven't installed curl module for php. To solve this, please install php curl module.
I am using PHP5, so the easiest way to solve this for my case is: install php5-curl by apt-get

sudo apt-get install php5-curl
Restart apache and try again.

Problem 2: Can not login to both backend and front end with localhost
The problem occurs because magneto could not store cookies. We run it as localhost and localhost is not true domain but to store cookies we need a domain. That’s why login stops without saying any word.

There are 2 solutions to solve this
1. Use 127.0.0.1 instead of localhost: you can choose this if you just want to play with Magento - not deploying on production. Actually, this error never happens on live site (because on live site, we use true domain)
2. Go to magento/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.

-Find the code,
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);
-Replace above code by,
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

Problem 3: Can not rewrite url
Solution: load rewrite module in apache2. You can do this by add this line into /etc/apache2/apache2.conf at the end of file
LoadModule rewrite_module modules/mod_rewrite.so

Hope this helps.

Tuesday, May 19, 2009

Setup TWiki 4.3.1 on Ubuntu for newbie

Today, I have to setup a demo version of TWiki for R&D devision. It is used as a new channel for centralizing information of all technical staff.

I choose the latest TWiki version (4.3.1) to deploy. Actually, I am very disappointed with the configuration guideline on this version. I follow up all steps there but it takes to many problems.

After solving all of them, I decide to write another installation guide version here (for newbie and stupid one - like me).
My environment:
+ Ubuntu 9.0.4
+ Apache 2.2
+ Perl 5.0

TWiki is developed in Perl. However, you do not need to install Perl on Ubuntu 9.0.4 because it has a built-in installation of Perl there.

Step 1: install Apache Perl mod
You need to install the following package
sudo aptitude install libapache2-mod-perl2

After this, restart Apache: service apache2 restart (this command is only used in Ubuntu 9.0.4)

Step 2: Download TWiki and copy to installation folder

+ Download TWiki (4.3.1)
+ Unzip it and rename it to twiki
+ Copy to /var/www/twiki folder. Actually, you can change the location, but please follow this because it helps us reduce complexity in later steps


Step 3: Change configuration files on TWiki
+ Go to /var/www/twiki copy twiki_httpd_conf.txt to /etc/apache2/ (I installed Apache in this location). Rename this file to: twiki.conf
+ Open twiki.conf, go to this section:

AllowOverride None
Order Allow,Deny
Allow from all
Deny from env=blockAccess

Options ExecCGI FollowSymLinks
SetHandler cgi-script

# Password file for TWiki users
AuthUserFile /var/www/twiki/data/.htpasswd
AuthName 'trandangkhoa'
AuthType Basic
...

Change AuthName value by a username in your .htpasswd file. To create this file, please use htpasswd command on Ububtu.

Go to another section:

SetHandler cgi-script
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 192.168.1.10
Require user trandangkhoa
Satisfy Any


Change value of Require user with the name same as above step.

+ Open: /etc/apache2/apache2.conf and add below line into the end of this file:
Include /etc/apache2/twiki.conf

After this, restart Apache: service apache2 restart

Step 4: Create the file LocalLib.cfg located as twiki/bin/LocalLib.cfg

+ There is a template for this file in twiki/bin/LocalLib.cfg.txt. Simply copy LocalLib .cfg.txt to LocalLib .cfg. Make sure the ownership and access rights of the copy are the same as LocalLib .cfg.txt

+ The file twiki/bin/LocalLib.cfg must contain a setting for $twikiLibPath, which must point to the absolute file path of your twiki/lib e.g. /var/www/twiki/lib.

Step 5: Fix TWiki error with Unicode path
Open /var/www/twiki/lib/TWiki/Render.pm file:(you must change the mode of this file to edit - it is read-only by default)
1. Remove this line:
use Unicode::String qw(utf8 latin1 utf16be);
2. Replace the following two lines:
my $utf8AnchorName = Unicode::String->new($anchorName);
    $anchorName = $utf8AnchorName->substr(0, 32);
with this line:
$anchorName =~ s/^(.{32})(.*)$/$1/; # limit to 32 char

Step 6: Change access mode for files/folders in twiki

+ Change owner for the twiki folder:
chown -R www-data:www-data /path/to/twiki 
(Note: in order to see www-data you may need to modify root's /apps/gnome-system-tools/users/showall GConf setting; see GConfEditor)

+ Change access mode (this step is VERY IMPORTANT)
cd /var/www/twiki


find . -type d -print -exec chmod -v 755 {} \;
find data -name '*.txt' -type f -exec chmod -v 644 {} \;
find data pub -name '*,v' -type f -exec chmod -v 444 {} \;
find lib -type f -exec chmod -v 444 {} \;
find locale -type f -exec chmod -v 444 {} \;
find pub -type f -exec chmod -v 644 {} \;
find bin -type f -exec chmod -v 555 {} \;
find bin/logos -type f -exec chmod -v 444 {} \;
find templates -type f -exec chmod -v 444 {} \;
find tools -type f -exec chmod -v 555 {} \;
chmod -v 644 lib/LocalSite.cfg
chmod -v 644 data/.htpasswd
chmod -v 644 data/mime.types
chmod -v 644 bin/LocalLib.cfg.txt bin/.htaccess.txt
chmod -v 444 bin/setlib.cfg
chmod -v 444 tools/extender.pl
chmod -v 444 working/tmp/README working/README working/registration_approvals/README working/work_areas/README
chmod -v 660 working/.htaccess
chmod -v 444 AUTHORS COPYING COPYRIGHT index.html INSTALL.html LICENSE pub-htaccess.txt readme.txt robots.txt root-htaccess.txt subdir-htaccess.txt TWikiHistory.html twiki_httpd_conf.txt TWikiReleaseNotes04x02.html

Step 7: Setup TWiki settings
Open this link on your web browser http://localhost/twiki/bin/configure




In the Store Settings section, choose: RCSLite for StoreImpl

At the next step, TWiki will ask you to type password for doing configuring in the future.





After this step, you can go to the home page of TWiki:
http://localhost/twiki/bin/login/Main/WebHome

Done!
All above steps are just the fundamental steps that you can set up TWiki in an easiest way.

If you want to do more thing, please read its manual document.

It takes me over 2 hours to fix all problems with TWiki deployment. I hope this helps you also.

Monday, May 18, 2009

ASP NET MVC - Print excel file using aspx template

My friend met a problem with creating excel report using ASPX as view in ASP.NET MVC. He already built an action to view printer friendly report and wanted to make use of that view for excel output.
To do that, he decide to get string output from the printer friendly action (by combine model + aspx view) and return the output content as binary with a little bit change in content type ("application/vnd.ms-excel")

Unfortunately, ASP NET MVC does not provide any official way to build string content from a View + Model data.

To support him, I read many articles and found a helpful one on Stackoverflow:

http://stackoverflow.com/questions/483091/render-a-view-as-a-string

However, solutions there are not good ways. Why? Actually, they try to use current context to render the view+model. After that, if you try to Redirect or return a FileContentResult or StreamContentResult, you will meet this exception:

Server cannot set content type after HTTP headers have been sent

Or

Server cannot redirect to action after HTTP headers have been sent

So, how to solve this issue? Finally, I found a very stupid but simple solution:

1. Create 2 actions: 1 action for returning Stream content, 1 action to return HTML content from aspx page + model
2. In the returning Stream action, create a HTTP request to the URL of the action that render the HTML for report by System.Net.WebClient => get return HTML
2. Using the return HTML to create the stream + set content type and return to browser

Below is the code

[AcceptVerbs("GET", "POST")]
public ActionResult ViewExcelReport(int? month, int? year)
{
   string excelFileStringContent = DownloadReportHTMLContent(month.Value, 
                                   year.Value);
   byte[] excelFileBytesContent = this.Response.ContentEncoding.GetBytes (excelFileStringContent);
   FileContentResult excelFileContentResult = new FileContentResult(
                                        excelFileBytesContent,
                                       "application/vnd.ms-excel");
   return excelFileContentResult;
}
        
[AcceptVerbs("GET", "POST")]
public ActionResult ViewHTMLReport(int? month, int? year) {
   PrepareReportData(month.Value, year.Value);
   return View();
}

private string DownloadReportHTMLContent(int month, int year)
{
    string linkFormat = Url.Action("ViewHTMLReport", 
                                   "MyReport", 
                                    null, 
                                   "http");
   linkFormat += "?month={0}&year={1}";
   System.Net.WebClient webClient = new System.Net.WebClient();
   webClient.Encoding = Encoding.UTF8;
   return webClient.DownloadString(string.Format(linkFormat, month, year));
}

Is that simple?

Wednesday, May 13, 2009

iPhone - Android - Limo

iPhone SDK

The iPhone OS is an OS for iPhone device. It provides developer a platform to develop application on iPhone. The operating system takes less than half a gigabyte (GB) of the device's total memory storage.

LiMO platform

Limo



















The LiMo Foundation Platform is being developed to enable the design, development and deployment of mobile phone devices based on a modular, plug-in architecture built around an open operating system with a secure run-time environment for the support of downloaded applications.



Android


Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications that run on Android-powered devices.


Comparision

iPhone OS and Android









Android vs Limo





Reference links

iPhone vs Android

LiMO vs Android

Monday, May 11, 2009

Every build you break

"Every Build You Break" - a funny song that Roy Osherove performed the geek classic at Microsoft TechEd 2008 event. He composed this song from the original "Every breath you take". Now, enjoy "Every build you break".



“Every Build You break
Or Refactoring You make
Every Mock you Fake
You little Snake

I’ll be watching you

Every Stand Up meeting
I believe You’re cheating
Every Unit Test
Pains my chest

I’ll be stopping you

Oh Can’t you see?
This is scaring me
It would be so strange
If my job will change

Every Iteration
Continuous Integration
Now the client’s here
Everything he hears

Man it bothers me

Oh can’t you see
Nothing comes for free
Every test you write
Is a waste of bytes

Every class you make
Every build you break
Every mock you fake

I’ll be watching you

Every class you make
Every build you break
Every mock you fake

I’ll be watching you”
- Roy Osherove

Friday, May 8, 2009

Make your blog entry more attractive with Zemanta

When you write a blog entry, you often take time to search image, referenced links, definitions from wikipedia, related articles .... to insert into the entry content. You do that because you know that rich content will make your reader more excited and inspire them to visit your blog more often. Zemanta is a tool to help you do that easily.

I know this tool when I developed a web 2.0 site for blogger community 1 year ago.

Have a look on an entry content decorated with Zemanta:




Zemanta currently get the decorated content from 20 different sources: Wikipedia, Flickr, Youtube, ... and supports integration with most blogging platforms.


To use this tool, you can choose below options:
1. Install a plugin for browser (currently it supports plugin for Internet Explorer and Firefox)
2. If you use Windows Live Writer, it also has a plugin for you.
3. If you develop a blogging service or host your own blog with Wordpress, Drupal, it has some server side plugins for you.

How to use this tool: just try a demo here