Undefined symbols for architecture i386: _htmlReadMemory

SOAPEngine is an iOS SOAP client library, the trial version provides a .framework file for user.

I added it via Project->Targets->General->Linked Frameworks and Libraries, then include its header file:

But when compiling the program, I got following error message:

Undefined symbols for architecture i386:
“_htmlReadMemory”, referenced from:
_PerformHTMLXPathQuery in SOAPEngineTrial(XPathQuery.o)
“_xmlFreeDoc”, referenced from:
_PerformHTMLXPathQuery in SOAPEngineTrial(XPathQuery.o)
_PerformXMLXPathQuery in SOAPEngineTrial(XPathQuery.o)
“_xmlReadMemory”, referenced from:
_PerformXMLXPathQuery in SOAPEngineTrial(XPathQuery.o)
“_xmlXPathEvalExpression”, referenced from:
_PerformXPathQuery in SOAPEngineTrial(XPathQuery.o)
“_xmlXPathFreeContext”, referenced from:
_PerformXPathQuery in SOAPEngineTrial(XPathQuery.o)
“_xmlXPathFreeObject”, referenced from:
_PerformXPathQuery in SOAPEngineTrial(XPathQuery.o)
“_xmlXPathNewContext”, referenced from:
_PerformXPathQuery in SOAPEngineTrial(XPathQuery.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

Actually libxml2 is needed for SOAPEngine, so we need add “libxml2.dylib” file to “Linked Frameworks and Libraries”. After adding this library, the error disappeared.

Unity compilation error: Expression expected after yield return

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.

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

 

Solution

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

 

Python CGI setup (for Hostgator hosting)

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.

 

Note

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

putty_connection_config

 

 

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

session

 

 

 

Finally click the “Open” button to open the Session Window

session_window