Unity compilation error: Expression expected after yield return

Today I'm trying to use coroutine to do the animation for Renderer's alpha value (fade effect), it's a lot simpler than modifying the alpha value in Update method.

Using the code from Unity Coroutine documentation will cause following error message:

Expression expected after yield return

Modifying yield return to yield return null will solve this problem. So the correct code should be like:

Make a Controller method non-action in Play framework 1.2

We create action method for Controller by using public static void

Whether this method is defined in routes file or not, it will be regarded as an action by Play.


And there's another problem: passing parameters by calling action method directly will be impossible

The above uploading function will not work, Because the file parameter in basicUpload function is always null (But the file parameter in upload function is not null)


To solve this problem, we need to change the access modifier from public to private

Now the file parameter in basicUpload function will be valid

Date format in javascript

Formatting date is a common task, like converting timestamp to "yyyy-MM-dd hh:mm:ss" format (e.g. 2013-03-03 12:00:00)

Date.format function can do this job

But it only works in Chrome, but not work in IE and Firefox.

Here we can use Moment.js library to format the date (Moment.js is a cross-browser date library)


Job found still running after platform shutdown

When I'm coding in Eclipse, suddenly a popup window displayed. And it's saying "SWT crashed" such things. Then Eclipse doesn't respond any more.

I tried restarting Eclipse several times, but it always stop and exit before reaching 50% of the loading progress bar.

To get a friendly error message, I opened command line and run "eclipsec.exe", now the long exception is shown:

Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: org.eclipse.ui.internal.Workbench



The solution is to delete file workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi


Python CGI setup (for Hostgator hosting)

In this post we will enable Python CGI for Hostgator

Create a .htaccess file and put following contents in this file:

This will make the web server to interprete .py file as Python CGI script.


Next create a python file (named test.py here) with following code:

And set this file's permission setting so that Owner, Group and Public have "execute" permission for this file (Or set 755 permission simply)

Visit http://server_address/app_path/test.py, you will see a page with "hello" printed.



The first two lines of code is necessary, otherwise you will get a "500 Internal Server Error".


specify port number for sftp

I need upload some scripts to hostgator hosting /home/[username] directory, then sftp is a good choice here.

But I got following error:

Connecting to port 22 failed

After reading hostgator's documentation, I realized that hostgator hosting's default ssh port is 2222 but not 22. Then I tried:

But same error appeared again.. After searching on google for a while, I got that -oPort=2222 should be placed before username@host


putty for serial port (COM)

In Windows XP HyperTerminal can be used to test serial port connection, But it's not available from Windows Vista. Here we can use open source program Putty to do this job.


Open putty and select "Serial" from left menu




Then select "Session" from left menu, switch Connection Type to "Serial".





Finally click the "Open" button to open the Session Window