setting PHP Server Header

[Issue]

you get warning in your browser that the js data are transfered as MIME type text/xs-javascript,
Or you have delared in your html meta:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

but you can still not read utf-8 charactor in your browser.

[Reason]
It is all because your server header is sending in a different definition.
I am using a lot Appache and PHP. So the definition in your html meta is not enough for a UTF-8
display.

[Solution]
I need to set the Server header manually. It is possible to change the setting in Appache config file.
But mostly you don’t have the possibility to access this file.
In PHP you can set the server header with “header()” function.

For example:
call

// set server content header
header('Content-Type: text/html; charset=UTF-8');

at the very first line of your php file. If the php file has include, you should
insert the header call at the very first line of your include file so that this
Server header modification always take effect first.

 

Advertisements

A bash script for WindowsDFS mount in Linux

[Purpose]
Since the Kerberos Tickets only works for 24 hours in our system,
i wrote a bash script for crontab to automatically remount a windows DFS
directory in our linux system.

[Prerequisite]
Please sieh my post: Mount Windows DFS in Linux with Kerberos

[Advice]
You should run this bash as “root” or root user. If you want to use it for other users,
your should check the rights for your users.

[Results]
this script only need to be called once, even the kerberos tickets is invalid after
24hours the mount  point is still working. you still have write and read access
to the mounting point (Windows DFS Directory).
Just make sure after server reboot,
this script will be called.

[Codes]

#!bin/sh
#Editted in 10.05.2012
mountDIR=<your mount point in linux system>
mountingDIR=<your directory in windows DFS //windows/directory >
# AD User and AD password
ad_user=<your Active Directory user, who can be authenticated in AD>
ad_password=<AD user password>
# Access User for Mounting Directory in DFS
user=< User who has the access and write rights in Windows DFS directory, $ad_use >
password=< User password for DFS directory ,$ad_password >
# DFS Domain
dom=<Your DFS directory Domain, XXX >
# Access Richts Setting for Mount Point
uid=< The user who should have access from Linux to access the Mount Point, 
      your DFS after mounting >
gid=< The Group who should have access from Linux to access the Mount Point >

#creat mount point directory
if [ ! -d $mountDIR ]
then
        echo "Directory doesn't exist"
        mkdir $mountDIR       
else
        echo "Directory exist, it will be unmounted"
        /sbin/umount.cifs $mountDIR
fi

# get kerbos granting ticket from AD, the user must be a memeber of AD
kinit $ad_user $ad_password;

# after the ticket successfully granted, mount nas Directory to mount point
# use uid and gid option to specify the user id and group id'
# for mount point access rights
/sbin/mount.cifs $mountingDIR $mountDIR -o user=$user,dom=$dom,
password=$password,uid=$uid,gid=$gid

Activate Screenlock for Lxde

[Issue]
if i am away from my lxde session, i can not find a easy way to lock my screen by means of Screensaver application.

[workarround]
i have tried to make a short cut of Screensaver in my desktop, and than start Screensaver.
In menu ->”File”->”lock screen now”. But this procedure is still too complicated

[Solution]
Edit your lxde configuration file to enable key combination to lock screen.

vi  ~/.config/openbox/lxde-rc.xml

And then add the following codes within the <keyboard> tag

<!– Launch Screensaver by user  –>
<keybind key=”C-A-l”>
<action name=”Execute”>
<command>xscreensaver-command -lock</command>
</action>
</keybind>

After the modification, you should log off from your lxde session, if you start your session
again, you can lock your screen with “Ctrl-Alt-L”

[Note]
Please make sure that there is a “space” between the “xscreensaver-command”
and the option “-lock” within the <command> tag, otherwise this will not work.

AccessRightsForLibreOffice

[Problem background]

ich made a new user for my Opensuse System. Want to use libre Office.

[Issue]

The application cannot be started. LibreOffice user installation could not be processed due to missing access rights. Please make sure that you have sufficient access rights for the following location and restart LibreOffice: /home/<username>/.config/.libreoffice/3-suse

[Workarrounds]

The Issue means libreoffice can not access the .config/.libreoffice directory

As i looked to the rights it is made only for root access

so just execute

“sudo chown -R <username>:users /home/<username>/.config/.libreoffice/”

to change the permission of this .config directory

[Results]

After permission change, libre Office runs for the appropriate user. I am just still wondering how it comes, the .libreoffice directory has root as owner at the very beginning.

[Comments]

Libre Office is a good alternativ to microsoft office sets, but why cannot opensource just work without any professional skills? 🙂 life is still hard for a normal people in linux worlds.

Convert vmx data from version 4 to version 3.1.5

[Problem]

I have created a linux vmware guest system in a vmplayer 4 and want to

play this vmware guest in a vmware player 3.1.5

Since i can’t upgrade my pc from vmware player 3.1.5 to version 4,

i have to modify the vmx config data.

[Issue]

While playing the vmware guest in vmplayer 3.1.5 , i got this error message

“Invalid configuration file. File “D:\virtualmachines\Opensuse12.1-1\Opensuse12.1.vmx” was created by a VMware product with more features than this version of VMware Player and cannot be used with this version of VMware Player.
Cannot open configuration file D:\virtualmachines\Opensuse12.1-1\Opensuse12.1.vmx.”

[Solution]

Edit the xxx.vmx file

Change line: virtualHW.version = “8”

to : virtualHW.version = “7”

[Result]

After this Modification , the guest is running in player 3.1.5