format ‘12345′ to ‘12,345′
javascript:
string.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, function(s){return s+","})
ruby:
string.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) { |match| match + ',' }
DecimalFormat class also can be used.
format ‘12345′ to ‘12,345′
javascript:
string.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, function(s){return s+","})
ruby:
string.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) { |match| match + ',' }
DecimalFormat class also can be used.
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h myhost password ‘new-password’
mysql -p -u root
install samba in arch linux:
$pacman -S samba
$cp /etc/samba/smb.conf.default /etc/samba/smb.conf
$adduser -d /home/<user dir> -m <user name>
$passwd <user name>
$smbpasswd -a <user name>
add two lines in to /etc/samba/smb.conf
netbios name = archsmb
encrypt passwords = yes
[homes]
browseable = yes
writable = yes
then:
$/etc/rc.d/samba start
$smbclient -L localhost -U <user name>
phpRPG is an open source project established since 2001. The aim of the project is to develop a web-based RPG (role-playing game) using a powerful server-side scripting engine called PHP and its best known open source database companion MySQL.
cube engine is a open source project for 3D game engine. Cube 2: Sauerbraten is a free multiplayer/singleplayer first person shooter, built as a major redesign of the Cube FPS.
for start each service in arch linux, set deamon in /etc/rc.conf. using sshd for example:
deamons(… sshd lighttpd … …)
for flash game developer, the pushbutton is a quite useful game engine. It is open source project host in google code. official web site support some game snapshot. for developing, it require java 1.6, flash player 9, AIR runtime and Flex SDK
some sources about silverlight 3D programming:
open ssh service. change /etc/hosts.allow add one line
sshd: ALL
install lighttpd php fcgi and mysql.
pacman -Ss search
pacman -S lighttpd php fcgi mysql samba perl-cgi
configuation arch linux network by dhcp:
add following lines to /etc/rc.conf
eth0=”dhcp”
INTERFACES=(eth0)
ROUTES=(!gateway)
then try /etc/rc.d/network restart
install red5 in the ubuntu:
install sun-java5-bin by apt-get
$sudo apt-get install sun-java5-bin
then download deb package in the red5 website. I used version 0.7.0(final). Try command:
$sudo dkpg -i red5_0.7.0_all.deb
$/etc/init.d/red5 start
finially: open your web browser, access web address http://localhost:5080
for configuration red5 server. you can find the conf file in the /usr/lib/red5/conf. and the service apps is in the /usr/lib/red5/webapps
using python get current timestamp
>>>import time
>>>time.time()
//currenting timestamp to int
>>>int(time.time())
//converting to string
>>>str(time.time())
using python get friend timeline in twitter. following tools should be used:
python-simplejson
first install python-simplejson, if in ubuntu, just using command as follows
$apt-get install python-simplejson
then, downloading python-twitter , unpackage it. then using command
$ python setup.py build $ python setup.py install
then, open python.
>>> import twitter
>>> api = twitter.Api(”username”, “passworld”)
>>> posts = api.GetFriendsTimeline(’username’)
>>> print [post.text in post as posts ];
for the file, the script should be liked:
import twitter
class mytwitter():
def __init__(self):
self._config = None
def main():
api = twitter.Api('inputx', 'inputbbs')
posts = api.GetFriendsTimeline('inputx')
for post in posts:
print post.text.encode('utf-8')
if __name__ == "__main__":
main()
some java client for twitter: java-twitter, jtwitter, twitter4j.
first look kubuntu.
the most bugs of KDE have been fixed. the wifi mod has been improved. the package library adds many new software, like monodevelop2 firefox 3.1 and 3.5, kooldock, etc. but I didn’t see katapult.
To mount the ISO image file.iso to the mount point /mnt/test use this command:
mount -o loop -t iso9660 file.iso /mnt/test
building a PXE boot server in the ubuntu.
1. install dhcp3 server in the ubuntu.
apt-get install dhcp3-server
2. edit /etc/default/dhcp3-server
INTERFACES=”eth0″
3. edit /etc/dhcp3/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example";
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
range 192.168.1.150 192.168.1.200;
}
4. edit /etc/network/interfaces
auto eth0:1
iface eth0:1 inet static
name DHCPserver
address 192.168.1.1
netmask 255.255.255.0
5. restart networking and dhcp3
service networking restart
service dhcp3-server restart
a popual ruby on rails, part1 and part2. there is other tutorial based on rails 2.1. basicly, grammer has some changes between 2.0, 2.1 and 2.2.
work on the ruby on vista.
firstly, install ruby
next, install rails, by command “gem install rails”
then, create a new web app by rails by “rails project”.
if “project” has been create, it can be runned by command “ruby script/server webrick”.
lastly, open address “http://localhost:3000″ web browser.
very simple CMS system build by php. it provides support for mysql database, but not support template.
using c read each char and covert to long int:
while(*buffer != ‘\n’);
{
read(fileName, buffer, 1);
printf(” Byte: %s”, buffer);
}
good way.
remember: mono2.4 and monodevelop 2.0, try them tonight.
share april desktop wallpaper. http://www.smashingmagazine.com/2009/03/30/desktop-wallpaper-calendar-april-2009/
I’m sure that IE8 is more quickly than IE7 in the high level computer. I’m not sure how about low level computer.
facebook and adobe will partner to build a new development tools. it will have more helpful in the facebook application development. official adobe development website provides a overview for new flash facebook development platform(include video).
currently, adobe official facebook api client is version 3. it is avaliable at google code, include doc and example.
but, there is one problem. the hotmal pop service only allow login by every 15 minutes
cool, using gmail to get hotmail.
login to your gmail. select “setting” -> “account” -> “Add a mail account you own”
1. input your hotmail address.
2. username is your whole hotmail address, like “abc@hotmail.com”
3. your hotmail password.
4. hotmail pop server address is “pop3.live.com” and port is 995.
5. selecting “Always use a secure connection(SSL)” at least.
6. pressing “add account” button.
see google official blog post.
degrafa is a graph library based on the flex. it is compatible with flex 2 and 3. it also support other graph library, example of papervision3D(3D graph and animation library). there is a example that visual map based on the degrafa, pv3D and yahoo map.
some effect of the vbox in flex 3.
all intel cpu have flaw called “cache Poisoning“. hacker can get administrator power through this flaw by “RootKit Hook“. this flaw was found by Joanna Rutkowska on the Invisible Things Lab.
C / ANSI-C examples (example source code) Organized by topic
a open sources game engine based on actionscript 3, named ffilmation, sources code is avaliable at google code and official site. and API reference is here.