Taken from:
http://support.microsoft.com/kb/315231
Quick command:
Start->Execute-> control userpasswords2
Thursday, August 21, 2008
Thursday, July 10, 2008
Character encoding in Apache
One of the last problem that i faced is related on how to setup character encoding on apache httpd for content served directly by the web server. What i was willing to do was to serve all the content with UTF-8 character encoding. Let see how to procede.
First we must edit the httpd.conf. Search for AddDefaultCharset and set it to utf-8:
AddDefaultCharset utf-8
Then we must be sure that the content that we are going to serve is stored on the file system in utf-8 as well. If this is not the case we will have wired behavior, with characters not displayed correctly. Unfortunately in linux is not possible to discover which is the encoding of a file, so the quickest way will be to verify directly the output on the browser. Linux in any case provide a quick way to convert from an encoding to another:
iconv -f ISO-8859-1 -t UTF-8 index.html > index.html.utf8
then we can simply:
mv -f index.html.utf8 index.html
Pay attention that iconv do NOT check the source file encoding. This means that if you apply this command to a file that is already stored with utf-8 encoding it will simply produce a wired file as output.
Last but not least, i would suggest you to avoid to put inside the page:
<meta equiv="Content-Type" content="text/html; charset=utf-8">
because in any case the parameters passed by apache through the http header will override it.
PS I've created a small script to modify a bunch of file in a row. It accept a search like parameter :
#!/usr/bin/ksh
USAGE="usage: "
if (( $# < 1 )) then
print $USAGE;
exit;
elif (( $# > 1 )) then
print $USAGE;
exit;
fi
for file in *$1*
do
if [[ $file = *html* ]]
then
iconv -f ISO-8859-1 -t UTF-8 $file > $file.utf8;
mv -f $file.utf8 $file;
echo $file;
fi
done
First we must edit the httpd.conf. Search for AddDefaultCharset and set it to utf-8:
AddDefaultCharset utf-8
Then we must be sure that the content that we are going to serve is stored on the file system in utf-8 as well. If this is not the case we will have wired behavior, with characters not displayed correctly. Unfortunately in linux is not possible to discover which is the encoding of a file, so the quickest way will be to verify directly the output on the browser. Linux in any case provide a quick way to convert from an encoding to another:
iconv -f ISO-8859-1 -t UTF-8 index.html > index.html.utf8
then we can simply:
mv -f index.html.utf8 index.html
Pay attention that iconv do NOT check the source file encoding. This means that if you apply this command to a file that is already stored with utf-8 encoding it will simply produce a wired file as output.
Last but not least, i would suggest you to avoid to put inside the page:
<meta equiv="Content-Type" content="text/html; charset=utf-8">
because in any case the parameters passed by apache through the http header will override it.
PS I've created a small script to modify a bunch of file in a row. It accept a search like parameter :
#!/usr/bin/ksh
USAGE="usage:
if (( $# < 1 )) then
print $USAGE;
exit;
elif (( $# > 1 )) then
print $USAGE;
exit;
fi
for file in *$1*
do
if [[ $file = *html* ]]
then
iconv -f ISO-8859-1 -t UTF-8 $file > $file.utf8;
mv -f $file.utf8 $file;
echo $file;
fi
done
Wednesday, July 9, 2008
Compress / Decompress initrd files
To Decompress:
zcat initrd.gz > initrd
mount -t ext2 -o loop,rw initrd /tmp/
After the modification of the folder structure, to compress again:
gzip -c initrd > initrd.gz
zcat initrd.gz > initrd
mount -t ext2 -o loop,rw initrd /tmp/
After the modification of the folder structure, to compress again:
gzip -c initrd > initrd.gz
Monday, May 12, 2008
Remove tabulation from an Excel file
Just a simple routine to remove "Tab characters" from an excel file:
Sub RemoveTab()
Dim MyCell As Range
For Each MyCell In Selection
Dim a As String
a = MyCell.Text
a = Replace(a, Chr(9), "")
MyCell.Value = a
Next MyCell
End Sub
Sub RemoveTab()
Dim MyCell As Range
For Each MyCell In Selection
Dim a As String
a = MyCell.Text
a = Replace(a, Chr(9), "")
MyCell.Value = a
Next MyCell
End Sub
Saturday, April 5, 2008
Create a manager accout
It is very usefull to create a manager account in your tomcat. In fact it will be used to access all the administration sections that you can see if you point to the root of your tomcat from a browser (e.g. http://localhost:8080/). But it is also usefull if you want to start, stop, redeploy... from the url with the tomcat manager (http://{host}:{port}/manager/{command}?{parameters}) or with ant. We have to open tomcat-users.xml (..apache-tomcat-5.5.26\conf\tomcat-users.xml). We will add the following lines:
<role rolename="manager">
...
<user username="user" password="pass" roles="manager">
So in the end we will have something like this:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="user" password="pass" roles="manager"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>
<role rolename="manager">
...
<user username="user" password="pass" roles="manager">
So in the end we will have something like this:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="user" password="pass" roles="manager"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>
Use tomcat through a proxy
During last days I had the necessity to access from my development tomcat the external world (e.g. access remote web services). The problem is that, inside my network, access to the external world is achieved through a proxy with autentication. The solution is to add the following line to your catalina.properties (..\apache-tomcat-5.5.26\conf\catalina.properties):
http.proxyHost=my.proxy.com
http.proxyPort=8080
http.proxyUser=user
http.proxyPassword=password
VoilĂ !
http.proxyHost=my.proxy.com
http.proxyPort=8080
http.proxyUser=user
http.proxyPassword=password
VoilĂ !
Wednesday, March 19, 2008
Hex Edit using VI
Here are some few commands to edit an hexadecimal file using vi:
vi file.hex
#now editing in vi
[esc] :%!xxd
#now editing file.hex in hex
#find some innocuous string or rcsid
#change the values on the hex side
[esc] :%!xxd -r
[esc] :wq!
#Now have a look on the file just created
hexdump file.hex
Subscribe to:
Posts (Atom)