2007-07-16

Problems with IMG html tag in Flash 8

In these days I am fighting with some bugs in Flash 8. So comes the problem: I want to create a text field in Flash 8, and change its properties to "dynamic text" with "multi-line", "selectable" and "render as HTML", then I connect the text field to some html contents. Everything is fine, until I try to show some pictures using the html tag img. The result: NO imgs are shown.

After long long time with try-error and searching in the net, finally I found the reason for such problems. There are some bugs with IMG html tag in Flash 8. My solution is: After the img tag, insert at least 8 <br /> tags.

To be careful: The support of img tag is only available from Flash v7 and ActionScript 2.0. So please pay attention to your publish settings too.

2007-07-14

Ajax RSS News Ticker

Today I want to introduce a very useful tool called "Advanced RSS Ticker"。 This tool uses a PHP class which can parse the RSS feed. The PHP class is Last RSS. Comparing to other PHP class, I think the most highlight is that it supports UTF-8. You may wonder, is there any RSS Parser which supports no UTF-8. Yes, there is ONE. I don't mention its name because it took me so many time to figure out that it is NOT UTF-8 compatible. :-)

You only need to download this and extract the zip into your web directory. Try the demo.htm within it, it is that easy!

There is also another PHP RSS News Parser. Since I didn't try it, I left it to you to compare this with the other two. ;-)

2007-07-09

Problem with Windows Time Update

Recently I always faced some strange problems. :-( Today I met a problem with Windows Time Update.

I tried to use the tab "Internet time" after clicking on the clock to select "Adjust Date / Time". When I selected the server "time.windows.com", then clicked "update now" on the right. Ok, error came! I got an error message "An error occurred while Windows was synchronizing with time.windows.com". Great, then I tried it with other time servers. Nothing different.

How to fix this up? Here are some steps I found in the internet.

1. Press Winkey+R, or select "Run..." from the start menu, and type "cmd" in the box;
2. After the command window shows up, type the following commands:

net stop w32time
w32tm /unregister [ignore error message]
w32tm /unregister [enter a second time]
w32tm /register
reg add hklm\system\currentcontrolset\services\w32time\parameters\ /v NtpServer /t reg_sz /d time.nist.gov /f
net start w32time


3. Try the "Internet time" update again. It should work now.

2007-07-05

strange problem with Node Template

Yesterday I mentioned that the strange problem with my Drupal module "Node Template": If I enable the "clean URLs" in Drupal, then clicking on the menu item "my node templates" will show the message "access denied" with the error 403.

After long long time with try-error, finally I found the cause of the problem. In the .htaccess which is in the root folder of Drupal, there are some lines looked like this:

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|install|module|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|
Repository|Root|Tag|Template)$">
Order deny,allow
Deny from all
</FilesMatch>

Since I used "/nodetemplate" as the path for the menu item "my node templates", then the server will block this path only because the path "/nodetemplate" ends with the string "template". That's really a dreadful setting! I cannot suggest all the users to change their .htaccess file, so I changed my path to "/nodetemplates". BOOM! Everything works like a charm now.

Indeed, such kind of FilesMatch settings are intended to protect the unauthorized access to those files. But, it has so many side-effects. For example, you cannot use any string which ends with "template" or "root", etc. to name your shortcuts as your path in Drupal. If you did this, you will get the strange problem too!

2007-07-04

New features in Node Template

It's really a happy thing to find out that there are already some people using my Drupal module "Node Template". Today I just caught some spare time, so I made some updates to the module.

New features include:
  1. Now automatic node creation is optional from version 1.3.
  2. Share template with others is possible from version 1.4.
Today I released v1.5 only to fix some bugs according to the issues. When there are still some problems, just try to use the dev release of the module.

The reason why I don't want to release v1.6 today is because a strange problem on my computer. if I enable the "clean URLs" in Drupal, clicking the menu item "my node templates" will cause a page that says "Access forbidden" with "error 403". I guess it can be some setting problems of my web server. Currently I am using xampp 1.6.2. When I figure out what happens, I'll release v.1.6 of the module "Node Template".

2007-07-03

Difference between German and Chinese

Found some very interesting art works from an Chinese artist in Germany that reflect the difference between German and Chinese.


Left (Blue): German & Right (Red): Chinese


Three Meals 一日三餐




Contacts 人际关系


Moods and Weather 心情和天气



Transport 交通工具


For more info of this series of works: http://www.yangliudesign.com

References 参考:http://www.uni-ulm.de/acssu/cgi-bin/topic.cgi?forum=18&topic=933

作者介绍:刘扬,一九七六年生于北京。十三岁随家人迁居德国。十七岁时被德国柏林艺术大学设计系录取,师从于霍尔格马蒂斯,获硕士及大师班学位。毕 业后曾先后在新加坡,伦敦,柏林,纽约工作及生活。零四年在柏林开始自己的设计工作室。曾任教于荷兰设计中心,中国中央美术学院设计系,英国格拉斯歌美术 学院,并在国际设计研讨会及博览会讲座。刘杨的作品曾多次在国际设计大赛中获重要奖项,作品被国际多家博物馆展览并收藏。

Yang Liu is born in 1976 in Beijing. She came to Germany with her family at the age of 13. She was 17 years old when she studied in the Art University of Berlin (Universitaet der Kuenste Berlin). After her study she made his career as a Designer in Singapur, London, Berlin and New York. In the year of 2004 she founded her own Design Studio. Besides Workshops and Lectures on international conferences she tought in the Central Academy of Fine Art Beijing and the Glasgow School of Art. Her works are presented in many international contests, worldwide can be seen in Musums and bought for collections.

2007-06-12

Tips for Multisite in Drupal

In last post I've reviewed the process to build a multisite. Here are some tips and tricks!

  1. If you want to use a new theme for the new site with the configuration, $conf =

    array('site_name' => 'My Drupal site',
    'theme_default' => 'pushbutton',
    'anonymous' => 'Visitor',);


    please be sure give the parameter "theme_default" a new name such as "newtheme". Then copy the whole folder of your current main theme as a new folder called "newtheme" under "/themes".

    This gives the grantee of the maximal compatibility of your new theme which is to be modified.


  2. Just remember to activate your "newtheme" in your main site, otherwise Drupal will not use the new theme.

2007-05-30

5 Steps to implement multisite in Drupal

There are already many use cases for multisite with one installation Drupal. The handbook of Drupal has some useful tips too. see: Multi-site installation and set-up

Here is just another typical one:

The customer needs two kinds of presentations of the same content, and such presentations should be decided by different URL.

More concretely, assumed that we have a domain named "http://www.example.com". This is the main site used for some people. At the same time, "http://www.example.com/show/" will be used for some other purpose, e.g. as a content provider with different front page.

Let's do it step by step:
  1. Find the configuration file httpd.conf of your Apache server. Add the following line at the end of the file.
    Alias /show "C:/Programme/xampp/htdocs/drupal/" #<- The path to your drupal directory. It can be "/var/www/htdocs/" on a linux server or alike.
    It maps the path to your drupal installation directory.

  2. Go to the /sites directory under the drupal installation directory. Copy the /default directory to a new directory with all the containing files. The new directory can be called "/www.example.com.show" or "/localhost.show". It depends on where you install your drupal.

  3. Make changes to the settings.php in the new directory.

    1. Since we use the same database and don't want to create new tables, we use:
      $db_url = 'mysql://name:password@localhost/drupal';
      $db_prefix = '';
    2. For the URL we use, change the base URL:
      $base_url = 'http://localhost/show'; // NO trailing slash!
    3. Something we want to change is the theme and front page, etc. It can be achieved by:
      $conf = array(
      'site_name' => 'My Drupal site',
      'theme_default' => 'pushbutton',
      'anonymous' => 'Visitor',
      );
  4. To get clean URL's with multi-site I added the following to the .htaccess file
    # rewrite commands for drupal dev sites
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/show/.*
    RewriteRule ^(.*)$ /show/index.php?q=$1 [L,QSA]

  5. restart the Apache server and go to the URL "http://www.example.com/show/" to see what happens.
There are some bugs on using another theme with the different URL. For example, the blocks in the Drupal will be not shown correctly. The only solution currently is copying the main theme to a new directory with a new name like "showme".This makes a new theme with different name in Drupal, then edit it to fit your requirements.

Another "internal error occured during: Initializing Java tooling"

In 2007-05-02 I've already post a blog entry called "An internal error occured during: Initializing Java tooling", now this notorious error comes again!

Today I wanted to help someone to install the jBPM Graphical Design plug-in for Eclipse. I used the same version Eclipse and the plug-in as those on my own computer. Everything is fine until I tried to import a project from a CVS server. Then comes the error "An internal error occured during: Initializing Java tooling". It really makes me frustrated after I tried again and again and made 100% sure that all the software version are the same.

So where is the problem?

The bad guy is the setting in Eclipse! After going to "Window"->"Preferences...", you can see the following dialog:


Click the option "JBoss jBPM", you will see your installation directory of jBPM library and the name of installation. If you give a new name, exactly saying, a different name from the original name which you gave in your previous Eclipse. BOOM, you got the error!

The reason: Eclipse saves every project settings in a file called .classpath. It's a xml file. You can find a line like this:
<classpathentry kind="con" path="JBPM/JBoss jBPM 3.1.2"></classpathentry>

See? The name which is used here is the convenient name! So if you change this name, Eclipse doesn't know where to find the library again.

Solution:
1. Keep using the same convenient name in the preferences settings.
2. Change the entry in the .classpath file to the name you used.

2007-05-29

Node Template has been updated!

Before a three-days camp in Rotenburg I submitted a Drupal module "Node Template". After coming back from the camp, I've found there is already an issue existed for my module. Wow, it makes me really happy. At least it means there are people using that module.

The issue is about the version for Drupal 5.x. Since I didn't make any test on Drupal 5, I didn't even know it doesn't work for Drupal 5. All I have done is doing a conversion or update of my module from version for 4.7.x to version for 5.x according to a page called "Converting 4.7.x modules to 5.x", but without test it doesn't even work!

So after looking at the completely new API of Drupal 5, I fixed all the strange problems. Best of all, it helps me a lot because I'll develop another module called "Version table" in the very near future.

And here is also a screenshot of the module:

2007-05-23

Node template in Drupal

Drupal is one of my favorite CMS. For a recent project I need a plug-in that can duplicate a page or a branch of book nodes. Even more I want to set them as node templates, so that I can use them for further actions.

I've looked at so many modules of Drupal, but none of them meets my requirements. So...sadly I must do it myself. The result is, I wrote a module called "node template", which can be found at http://drupal.org/project/node_template.

It's my first module project for Drupal. So I hope I have more free time to make it better. Although setting up a CVS release of that module cost me already 30 minutes to figure it out, finally is it there. :)

2007-05-15

Best tutorials on Sending Email from Flash using PHP

I've tried a lot of tutorials on the web, in order to make a working contact form in flash. Endly I found one: Sending Email from Flash using PHP

The best part of that tutorial is: it points out tons of tips which could drive man crazy without. For example, you'd better hide the send button in a Movie Clip, so that everything works. Why? because otherweise

Note: note that [ send ] is a Movie Clip with inside a button. This is useful for us while with the loadVariables() our vars to PHP without sending all _root variables...
Reading such kind of tutorials is really an enjoy. Keep going on, Alessandro Crugnola!

2007-05-14

Using the UIScrollBar component of Flash

In a recent project I tried to use the UIScrollBar component of Flash 8. There are already a lot of tutorials on the web:
  1. Creating a Flash Textbox Input
  2. Creating a Text Scroller
If you do that step by step, it works. BUT, if you create a new text box with the type of dynamic text, use LoadVars to load a text file on the fly and add a UIScrollBar component to it, then publish it, you will see a blank vertical bar on the right of the text box. So what's wrong?

There are also people writing comments on the Adobe livedocs. Such things cost me at least one hour to find what happens.

The key to the solution is: you must enter something long enough in the text box before loading anything into it! I guess the UIScrollBar component just caculates the behavior before it's published. The only size it knows is your text size in the design phase.

So, don't forget to paste some dummy text in your text box and give it an instance name before you use the UIScrollBar component!

2007-05-13

JavaScript based google customized search

Today I found a JavaScript based google customized search from JavaScript Kit.

The idea is: using the format of a search string with "site:"+"yousite.com"+" "+"query value"

With the form you can use the following:
<form action="http://www.google.com/search" method="get" onSubmit="jssearch(this)">

2007-05-03

Sending Email in Flash

Contact form is used widely on a website. If the website is powered by Flash, find a better way to build a flexible contact form is also very important.

There are probably 3 ways:

1. Use the "mailto:" protocol

Namely set a button event with

on (release) {
getURL("mailto:" + to + "?subject=" +subject+ "&body=" + body);
}
The three variables are self defined in Flash according to the form fields.  A tutorial can be found here.

The advantage of this method is that man doesn't need complex programming things. The flash will call the email client in the system to send the mail.

The shortcoming is also related to the advantage: If an email client isn't setup well or doesn't exist on the system, then we have a problem.

2. Use FLASH and PHP

It's used widely. So I don't want to talk more abut it. ;-) 

The principle is: Flash posts Variables to a PHP file, then the PHP sends email using mail() function and returns the result to flash.



A tutorial can be found at kirupa.com

3. Load a HTML into FLASH

The principle here is trying to load a html with contact form in Flash.

Firstly just use a textfield in Flash, set it to dynamic. Then click Render Text as HTML in properties or set the .html property to true. Then use Loadvars to load the html file and assign the variable into the textfield.htmlText property. Here's an example:
loadText = new LoadVars();
loadText.onLoad = function()
{
_root.helpText_txt.html = true;
_root.helpText_txt.htmlText = this.testText;
}
loadText.load("text.htm");
Just remember the following: You don't need all that header junk like tags and such. At the beginning of your html file, above everything else put something like:

testText =

where testText can be any variable name you choose. You can only use jpg and swf's for graphics embedded in the html. And the jpg's can't be progressive jpg's.

Finally anchors "<a href="http://www2.blogger.com/bla.html">" will work but won't show as a different color unless you use font tags around them and specify to change the color of the text. ie. "<span></a><a href="http://www.blogger.com/bla.html">Bla</a></span>"

More infos about "Formatting text with Cascading Style Sheets" can be found here.

P.S. According to this article, there are many ways to link a html in Flash.

2007-05-02

To use Firefox or not to, it's a question

It's very interesting to find this on the web. Since I am a fan of firefox (maybe you too), I find the conclusions here are not so easy to believe. ;-)

So start to face the facts of firefox!

Firefox Myths

Another word, I've been starting using opera for a long time.

An internal error occured during: Initializing Java tooling

Since I updated my jBPM plugin for eclipse, I get the error "An internal error occured during: Initializing Java tooling" everytime when I start eclipse. Sometimes it becomes even worse, I cannot commit changes to CVS server or do something else in eclipse.

The reason is that the new version has changed the file structures and didn't provide the coresponding convension tools. So here is endly the solution:

  1. Backup the whole workspace before upgrading;
  2. You can enable or disable a new version jBPM plugin under "help"->"software updates"->"manage configurations";
  3. After the new version is running, create a blank process project, then create a blank process definition;
  4. Close eclipse, find the folder where the new created process files are;
  5. Open gpd.xml and processdefiniton.xml of the new process and your old process in an editor;
  6. Just compare the difference between those files. Mostly the new version of jBPM changes the structure of gpd.xml;
  7. So change the xml structure manually and save them;
  8. Maybe the file .classpath should alse be compared and changed.
  9. Open it in eclipse. If you are lucky, you will never see the error message again.
Hope it helps.

2007-04-25

jBPM Process Designer Upgrade Problem

Today I've made so much struggle with the jBPM Eclipse plugin. It was really frustrated to know that the new version jbpm-jpdl-designer-3.1.0.alpha3 has changed the xml structure of the gdp.xml, which is used to describe the relationship between process image and process description.

After thousands of tries I've find this alpha version cannot convert the process files from old versions correctly. The result is, you will lost all transition lines on the process image. So just be careful to do the update!

The issue is here: http://jira.jboss.com/jira/browse/GPD-64

2005-02-03

It's a wondeful experince to use picasa with hello!

2004-03-02

一个很有趣的卡通形象:
小土豆