Archive

Archive for January, 2010

PHP – internationalization

January 28, 2010 Leave a comment

Internationalization cakePHP!:


*app/controllers/components/local.php > http://cakeforge.org/snippet/download.php?type=snippet&id=29

1. /dev/2/app/views/news/index.ctp

echo _(“Hello world”);

2. xgettext we need in linux/unix , windows !

$xgettext -a src/*.php

*/ or

xgettext –no-location -j -L PHP —from-code=ISO-88591 `find ~/dev/2/app/views/ | grep ctp` `find ~/dev/2/app/controllers/ | grep php` `find ~/dev/2/app/ -maxdepth 1 | grep php`

3. messages.po :

# SOME DESCRIPTIVE TITLE.

# Copyright (C) YEAR Free Software Foundation, Inc.

# FIRST AUTHOR , YEAR.

#

#, fuzzy

msgid “”

msgstr “”

“Project-Id-Version: PACKAGE VERSION\n”

“POT-Creation-Date: 2009-12-08 19:15-0300\n”

“PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n”

“Last-Translator: FULL NAME \n”

“Language-Team: LANGUAGE \n”

“MIME-Version: 1.0\n”

“Content-Type: text/plain; charset=CHARSET\n”

“Content-Transfer-Encoding: ENCODING\n”

msgid “Hello world”

msgstr “”

4. messages.po to messages.mo

$msgfmt messages.po -o messages.mo

/src

/locale/en/LC_MESSAGES/messages.mo

messages.po

es/LC_MESSAGES/messages.po

messages.mo

5. Now mention this

$locale = $language . ‘_BE’;

// default langauge

putenv(“LANG=$locale);

setlocale(LC_ALL, $locale);

// local/messages.mo

$domain = ‘messages’;

// bindtextdomain($domain, “/var/www/html/cake/app/locale”);

bindtextdomain($domain, $_SERVER[‘DOCUMENT_ROOT’] . ‘/locale’);

textdomain($domain);

6. On fly done.

Categories: cakePHP, PHP, Zend Tags:

centOS – pop

January 28, 2010 Leave a comment

Lets make a co-location (point of presence) and our own MMR (meet me room)?

a. Home colocation? or b. Wirehouse pro colocations?

A. Home co-location:

What is VDSL?

VDSL stands for Very High Speed Digital Subscriber Line and offers a much faster transmission of data than standard DSL lines. It is delivered via a pair of copper lines twisted together to make a single line.
What’s so different about VDSL?

VDSL is deployed over ordinary phone lines, which makes it a much cheaper option for upgrading than fibre optics or new experimental methods that require power lines.

VDSL2 looks promising with possible bandwidths of up to 30MHz that will enable data transfer rates of up to 100Mbps for both up and down streaming.

This has some exciting prospects for high quality video, such as HDTV, on the Net. In addition, the seven different frequency bands used by VDSL means users can customise their upload and download rates.

ADSL vs VDSL

The existing ADSL and ADSL2+ broadband services have fixed bit rates for downloading and uploading, and cannot support high definition video because of bandwidth limitations. VDSL does not have these limitations and, understandably, VDSL2 has a much greater range than VDSL1. However, ADSL still performs better, in terms of how far away a computer is from a telephone exchange before the service is seriously compromised or unavailable, and is more cost-effective for the average user.

One downside is that while VDSL2 could start with a theoretical maximum of up to 250Mbps (if the computer was inside the telephone exchange), it quickly drops to 100Mbps if the computer moves just half a kilometre away. At one kilometre the rate halves to just 50Mbps. ADSL2+ matches the performance of VDSL if the computer moves to just 1.6km away from the telephone exchange.
Which countries have VDSL?

Japan and Korea are by far the most ardent supporters of VDSL and have made widespread use of it to date. Other countries have been slower to take up the technology, with only one or two providers in each participating country.

Australia only has one VDSL provider, TransACT, an Internet provider based in Canberra. VDSL services are aimed at businesses, not individuals, so it can be assumed the cost of accessing the service is extremely high at this stage. To date, TransACT does not offer VDSL2 services.

– thanks to this vdsl vs adsl tips writter. Now we know the home staff?

Doc: http://www.speedtouch.nl/docs/ConfigGuides/ConfigGuide_IPSec.pdf
Or i can use PSTN/ISDN: cisco soho/linksys (cisco), us robotics, dreytek

Categories: centOS, Fedora 12, Solaris, Unix/Linux Tags:

PHP – rewrite

January 22, 2010 Leave a comment

RewriteRule ^edities/nl/([0-9-]+)/?$ /dn0/up/edities/nl/index.php?g=$1 [R=301,L]

RewriteRule ^a/? /hello  // means a == true or false

RewriteCond %{REQUEST_URI} !^/index\.php RewriteRule (.*) /index.php?$1

RewriteRule ^/?([^/]*\.html?|[^\./]*)[:;,\.]*$ /show.php?$1 [L,NS]

RewriteRule ^([0-9-]+)/?$ /dn/index.php?g=$1 [R=301,L]

Categories: PHP Tags:

PHP – pear

January 22, 2010 1 comment

Pear install
================
1. lynx
2. lynx -source http://pear.php.net/go-pear | php
3. pear version
4. pear config-get php_dir

Package install:
================
[root@shamun ~]# pear search Spreadsheet
Retrieving data…0%
Matched packages, channel pear.php.net:
=======================================
Package Stable/(Latest) Local
Spreadsheet_Excel_Writer 0.9.2 (beta) Package for generating Excel spreadshee ts (.xls)

[root@shamun ~]# pear install Spreadsheet_Excel_Writer
downloading Spreadsheet_Excel_Writer-0.9.2.tgz …
Starting to download Spreadsheet_Excel_Writer-0.9.2.tgz (57,629 bytes)
…………..done: 57,629 bytes
downloading OLE-1.0.0RC1.tgz …
Starting to download OLE-1.0.0RC1.tgz (12,153 bytes)
…done: 12,153 bytes
install ok: channel://pear.php.net/OLE-1.0.0RC1
install ok: channel://pear.php.net/Spreadsheet_Excel_Writer-0.9.2

[root@shamun ~]# pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.5 stable
Console_Getopt 1.2.3 stable
OLE 1.0.0RC1 beta
PEAR 1.9.0 stable
Spreadsheet_Excel_Writer 0.9.2 beta
Structures_Graph 1.0.3 stable
[root@shamun ~]#

Categories: PHP Tags:

centOS – proFTPD

January 7, 2010 Leave a comment

Server FTP for Fedora 12

1. Query if installed?

[root@shamun html]# rpm -qa | grep ftp
gvfs-obexftp-1.4.3-1.fc12.i686
proftpd-1.3.2c-1.fc12.i686
lftp-4.0.4-1.fc12.i686
[root@shamun html]#

2. Install

[root@shamun html]# yum install proftpd.i686

3. Check if its on for root else add that line.

[root@shamun html]# cat /etc/proftpd.conf | grep RootLogin
RootLogin                       on
[root@shamun html]#

4. Restart service

[root@shamun html]# service proftpd restart
Shutting down proftpd:                                     [  OK  ]
Starting proftpd:                                          [  OK  ]

TEST? i use firefox > addons >  FireFTP > as a client to

Categories: centOS Tags:

centOS – noip2

January 6, 2010 3 comments

How to dynamic ip to static DNS?
[root@www noip-2.1.9-1]# uname -a
Linux .be 2.6.18-164.el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 i686 i386 GNU/Linux

#####################################################

1. http://www.no-ip.com

2. have a account > After login > Hosts/Redirects

3. Add host > anyNames.no-ip.org > for the public ip

4. download the client noip2….tar.gz file

[root@www ~]# wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
–2010-02-14 23:58:28–  http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
Resolving http://www.no-ip.com… 204.16.252.112
Connecting to http://www.no-ip.com|204.16.252.112|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 134188 (131K) [application/x-gzip]
Saving to: `noip-duc-linux.tar.gz’

100%[===================================================================================================================>] 134,188     86.2K/s   in 1.5s

2010-02-14 23:58:30 (86.2 KB/s) – `noip-duc-linux.tar.gz’ saved [134188/134188]

[root@www ~]#

5. upzip

[root@www ~]# tar xvfz noip-duc-linux.tar.gz -C /root/
./._noip-2.1.9-1
noip-2.1.9-1/

6. make fail, use make install

[root@www noip-2.1.9-1]# cp binaries/noip2-i686 noip2
[root@www noip-2.1.9-1]# ls
binaries         gentoo.noip2.sh        LISEZMOI.ENPREMIER  noip2 README.FIRST.FRANCAIS  README.FIRST_PT     redhat.noip.sh
COPYING          LEEME.PRIMERO          mac.osx.startup     noip2.c       README.FIRST.ITALIANO  README.FIRST.pt_BR
debian.noip2.sh  LIESMICH.ERST.deutsch  Makefile            README.FIRST  README.FIRST.JAPANESE  README.FIRST-SWE
[root@www noip-2.1.9-1]# make install
if [ ! -d /usr/local/bin ]; then mkdir -p /usr/local/bin;fi
if [ ! -d /usr/local/etc ]; then mkdir -p /usr/local/etc;fi
cp noip2 /usr/local/bin/noip2
/usr/local/bin/noip2 -C -c /tmp/no-ip2.conf

Auto configuration for Linux client of no-ip.com.

Please enter the login/email string for no-ip.com  sha@gmail.com
Please enter the password for user ‘sha@gmail.com’  ****

Only one host [.no-ip.org] is registered to this account.
It will be used.
Do you wish to run something at successful update?[N] (y/N)  N

New configuration file ‘/tmp/no-ip2.conf’ created.

mv /tmp/no-ip2.conf /usr/local/etc/no-ip2.conf
[root@www noip-2.1.9-1]# mv /tmp/no-ip2.conf /usr/local/etc/no-ip2.conf
mv: cannot stat `/tmp/no-ip2.conf’: No such file or directory

7. Put a standard interval + start the process

[root@www noip-2.1.9-1]# noip2 -U 5
Process 9306 – update interval changed to 5.
Configuration data ‘/usr/local/etc/no-ip2.conf’ updated
[root@www noip-2.1.9-1]# noip2 -S
1 noip2 process active.

Process 9306, started as /root/noip-2.1.9-1/noip2, (version 2.1.9)
Using configuration from /usr/local/etc/no-ip2.conf
Last IP Address set 78.xxx.xxx.xxx
Account sha@gmail.com
configured for:
host  x.no-ip.org
Address check every 5 minutes, directly connected via /dev/eth0.

8. Done..

Categories: centOS, Fedora 12 Tags:

Java – Data types / Type casting /

January 5, 2010 Leave a comment

Data types

Logical: boolean  true/false

Number: byte, short, int, long

Decimal: float, double

Character: char, string

char a = ‘A’ ; // note char inserted using single quotes

enummeration: enum

example: enum shamunExpert { java, centos, php, mysql, networking }

Iwant iw = shamunExpert.java;

constanten: final int abc = 10;

* things to note:

String name; we didnt reserved any memory yet.

myname = new Coordinaat(); // the new will use memory bytes

* type literal

String myname= “Hello there”;

*simple ++ | —

int i = 2;

int j = i++ * 3 ; // j = 6

int j = ++i * 3; // where j = 4 * 3

Categories: Java