Type cast variable to String in python

This can be done by using str() function.

For example:

myvar = str(myvar)

Escaping character in batch

Sometimes in Programming we can escape character by \. However in batch, the escape character is ^.

Example of the special characters are & (ampersand), < (less than) and > (greater than)

For example:

Escaping & would look like ^&

<html> would be ^<html^>

PS. Today I have to escape the url.

Change working directory in batch

Today I found that I need /d parameter to change directory in a batch file.

For example:

cd /d c:\java

It should look something like this during the execution:

c:>test.bat

c:\java>

Open a website in a browser from commandline

My attempt to open a website in command prompt or a batch file.

I found that, for Windows, I could run

explorer https://waoewaoe.wordpress.com

In batch script, I can do:

start explorer https://waoewaoe.wordpress.com

Ps. Actually, I don’t really have to use start 🙂

In Linux, we should be able to run

firefox https://waoewaoe.wordpress.com

(if there is Firefox)

Java JDK 6 also supports it using Browse class: http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)

Exception when starting tomcat

Starting Tomcat throws:

java.net.BindException: Address already in use: JVM_Bind

This is because the port has been used. To find out which program is using that port, open a command prompt

1. Get PID of the process by running netstat -a -n -o

2. Go to Task Manager (CTRL+ALT+DEL) under tab Services

3. Kill the process or change tomcat shutdown port

Eclipse error: Resource is out of sync with the file system

Today when I tried to run the project in eclipse, I received this error: Resource is out of sync with the file system.

My solution is to do a refresh on the project via Project Explorer and start the server again.

Error when deleting file that has a long name

Today while I’m trying to delete a folder. I’ve received this ” The folder ‘                   ‘ contains items whose name is too long for the Recycle Bin.”

longname

longname

Does it make any sense to you?