Count lines of Code in a project :
find . -type f -name "*.php" -exec cat {} \; | wc
Aller au contenu | Aller au menu | Aller à la recherche
vendredi, septembre 2 2011
Par jaillet simon le vendredi, septembre 2 2011, 04:55 - Admin Linux
Count lines of Code in a project :
find . -type f -name "*.php" -exec cat {} \; | wc
samedi, août 27 2011
Par jaillet simon le samedi, août 27 2011, 01:16 - Admin Linux
sudo aptitude install automake m4 php5-dev
Compile and install bcompiler
sudo pecl install bcompiler
Add "extension=bcompiler.so" to /etc/php5/cli/php.ini to activate the extension.
vendredi, août 19 2011
Par jaillet simon le vendredi, août 19 2011, 20:37 - Code
http://code.google.com/intl/fr/apis/gdata/docs/auth/authsub.html
http://code.google.com/intl/fr/apis/accounts/docs/RegistrationForWebAppsAuto.html
https://www.google.com/accounts/ManageDomains
http://code.google.com/intl/fr/apis/gdata/docs/auth/authsub.html#Registered
Google Calendar API request/response works in the form of Google Data API feeds. The popular PHP client library used to work with Calendar service is Zend's GData which is also distributed as a part of Zend Framework.
First download the latest release GData library from here. Extract it and keep the folder anywhere you like. Lets assume that we kept it at /home/abbas/ZendGdata/.
Next step is to make sure you can include ZendGdata/library in your php script. This is done by setting include_path directive and this can be done in the following three ways:
* Permanently set the include_path directive in your php.ini configuration file from the command line * Set the include_path path variable on a "per directory" level using .htaccess * Use the set_include_path() function to dynamically set the include path in your scripts
We will use the set_include_path() function to set the include path. The code will look something like this...
$path = '/home/abbas/ZendGdata/library'; // Append the library path to existing paths $oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);
The Gdata libarary can be used to access both public as well as private calendars. For private calendars we need to authenticate to the calendar servers. There are three types of authentication viz AuthSub proxy authentication, ClientLogin username/password authentication and Magic cookie authentication. We will be using ClientLogin username/password authentication in this tutorial as it is much easier to use and fits in the example we are going to take. Here's how to authenticate using username/password (Google calendar account credentials):
$path = '/home/abbas/ZendGdata/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
// User whose calendars you want to access
$user = 'username@gmail.com';
$pass = 'yourpass';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
At this point authentication token is retrieved and $client is an object of Zend_Http_Client with appropriate Authentication header.
Retrieving list of Calendars
Now lets use the http client object to retrieve a list of all calanders. (In continuation of above code..)
$service = new Zend_Gdata_Calendar($client);
// Get the calendar list feed
$listFeed = $service->getCalendarListFeed();
echo "<h1>Calendar List</h1>";
echo "<ul>";
foreach ($listFeed as $calendar) {
echo "<li>" . $calendar->title . " (" . $calendar->id . ")</li>";
}
echo "</ul>";
Continuing the same topic lets now see how to retrieve events from Google calendar using GData library.
Firstly, lets instantiate the Zend_Gdata_Calendar class.
$path = '/home/abbas/ZendGdata/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
// User whose calendars you want to access
$user = 'username@gmail.com';
$pass = 'yourpass';
$serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $serviceName);
$service = new Zend_Gdata_Calendar($client);
For retrieving events, specially constructed URLs are used and Zend_Gdata_Calendar_EventQuery makes it easy to construct URL based on the parameters passed to it. Following three parameters are important.
* User: If not specified, the "default" (currently authenticated) user is used i.e. default calendar. Use email address for shared calendars or use the Calendar ID * Visibility: Whether user's public or private calendars should be searched * Projection: Specifies the amount of data that should be returned. Generally use "full".
Lets get a list of events from default calendar.
$query = $service->newEventQuery();
// Set different query parameters
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
// Get the event list
try {
$eventFeed = $service->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getMessage();
}
echo "<ul>";
foreach ($eventFeed as $event) {
echo "<li>" . $event->title . " </li>";
}
echo "</ul>";
Just add these two parameters to the query before getting the event feed
// Start date from where to get the events
$query->setStartMin('2010-02-01');
// End date
$query->setStartMax('2010-03-15');
This can be done in two ways. If you know the event ID then set the event parameter in the query and use getCalendarEventEntry method instead of getCalendarEventFeed.
$query->setEvent('pomb7gnnum6sjiii6qgb76xyz');
// Get the individual event
try {
$event = $service->getCalendarEventEntry($query);
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getMessage();
}
or if you know the full event URL (you get this when you retrieve all events), you can skip creating the query object and directly pass the event URL to getCalendarEventEntry.
$eventURL = "http://www.google.com/calendar/feeds/default/private/full/pomb7gnnum6sjiii6qgb76xyz";
try {
$event = $service->getCalendarEventEntry($eventURL);
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getMessage();
}
Now its time to manage events i.e. create, update and delete events.
First we need the Calendar service instance, so lets instantiate the Zend_GData_Calendar class.
$path = '/home/abbas/ZendGdata/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
// User whose calendars you want to access
$user = 'username@gmail.com';
$pass = 'yourpass';
$serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $serviceName);
$service = new Zend_Gdata_Calendar($client);
Lets directly look at the code which has self explanatory comments
// Create a new event object using calendar service's factory method.
// We will then set different attributes of event in this object.
$event= $service->newEventEntry();
// Create a new title instance and set it in the event
$event->title = $service->newTitle("Some Event");
// Where attribute can have multiple values and hence passing an array of where objects
$event->where = array($service->newWhere("Nagpur, India"));
$event->content = $service->newContent("Some event content.");
// Create an object of When and set start and end datetime for the event
$when = $service->newWhen();
// Set start and end times in RFC3339 (http://www.ietf.org/rfc/rfc3339.txt)
$when->startTime = "2010-07-08T16:30:00.000+05:30"; // 8th July 2010, 4:30 pm (+5:30 GMT)
$when->endTime = "2010-07-08T17:30:00.000+05:30"; // 8th July 2010, 5:30 pm (+5:30 GMT)
// Set the when attribute for the event
$event->when = array($when);
// Create the event on google server
$newEvent = $service->insertEvent($event);
// URI of the new event which can be saved locally for later use
$eventUri = $newEvent->id->text;
If you want the event to last the whole day then only set the date in startTime and skip endTime attribute of "when"
$when->startTime = "2010-07-08"; // 8th July 2010, Whole day event
Recurring events are created almost similar to non recurring events. The only difference is that instead of "where" attribute we would set "recurrence" attribute for the event. Recurrence attribute is a string pattern in iCalendar standard RFC2445. For more details please check out Google Data API Guide.
// This event will occur all day every Friday starting from 9th July 2010 until 8th Dec 2015 $recurrence = "DTSTART;VALUE=DATE:20100709\r\n" . "DTEND;VALUE=DATE:20100710\r\n" . "RRULE:FREQ=WEEKLY;BYDAY=Fr;UNTIL=20151208\r\n"; $event->recurrence = $service->newRecurrence($recurrence);
For modifying an event, we first need to get its reference. This can be done using the event URI which we got after we created the event (see above). Once we get the event reference, we can pretty much change any attribute of it (as we did while creating an event) and then we have to save it.
// URI of the event which we got after creating it.
$eventUri = "http://www.google.com/calendar/feeds/default/private/full/53608ibmrtnb57o7hqf8l1tsu4";
// Get the event
$event = $service->getCalendarEventEntry($eventUri);
// Change the title
$event->title = $service->newTitle("New Title!");
// Save the event
$event->save();
Deleting an event is very simple. Just get the event reference (as we did for updating) and call the event's delete method.
// Get the event $event = $service->getCalendarEventEntry($eventUri); // Delete the event $event->delete();
vendredi, juin 3 2011
Par jaillet simon le vendredi, juin 3 2011, 16:35 - Tools
pecl install xdebug
zend_extension=xdebug.so xdebug.remote_enable=On xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler="dbgp" xdebug.idekey="netbeans-xdebug" :Optionnal ;xdebug.remote_log="/tmp/xdebug.log"
Don't use "extension=xdebug.so" If you do use this way, you will get the module to load, and it will show up in phpinfo(), but Netbeans will not break on your breakpoints! So, switch to zend_extension. This has to do with the way xdebug loads, and is essential.
Uncheck the Stop at First Line checkbox (usually it's not necessary and it's just annoying). Check the Watches and Balloon Evaluation checbox. It will probably show a warning message. This might sometimes cause unexpected behaviour (see troubleshooting below). This option enabled you to watch custom expression or variables during debugging.
In the "general" options also check what's your default web browser, because it'll be opend every time you start debugging.
Choose the "Run Configuration entry" and click on the advanced button. Check the "Ask Every Time"
Sometimes when mod_rewrite is used it's necessary to set the Path mapping. If you are working on "localhost" define a new entry where the server path and the project path to the the same location (i.e. the root directory of your index.php). Seems to be stupid but with mod_rewrite Netbeans is not able to identify the right path for setting breakpoint using the IDE.
Optionally enable NetBeans PHP debugger logging by starting NetBeans with -J-Dorg.netbeans.modules.php.dbgp.level=400 or by editing netbeans.conf
mercredi, octobre 20 2010
Par jaillet simon le mercredi, octobre 20 2010, 17:15 - Admin Linux
Remove the kernel metapackage that pulls in each new kernel :
sudo aptitude remove linux-generic linux-headers-generic linux-image-generic
This will stop the kernel updating, it won't remove any kernels. Now newer kernels must be update manually.
vendredi, septembre 3 2010
Par jaillet simon le vendredi, septembre 3 2010, 15:42 - Admin Linux
On a replication master, you must enable binary logging and establish a unique server ID. If this has not already been done, this part of master setup requires a server restart.
To configure the binary log and server ID options, you will need to shut down your MySQL server and edit the my.cnf file. Add the following options to the configuration file within the mysqld section :
[mysqld] log-bin=mysql-bin server-id=1
Restart the server :
/etc/init.d/mysqld restart
On a replication slave, you must establish a unique server ID. For example:
[mysqld] server-id=2
After making the changes, restart the server.
Each slave must connect to the master using a MySQL user name and password, so there must be a user account on the master that the slave can use to connect.
You may want to create a separate account that has privileges only for the replication process, to minimize the possibility of compromise to other accounts.
To create a new acccount, use CREATE USER. For example, to set up a new user, repl, that can connect for replication from any host within the mydomain.com domain, issue these statements on the master:
mysql> CREATE USER 'repl'@'%.mydomain.com' IDENTIFIED BY 'slavepass'; mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.mydomain.com';
To configure replication on the slave you must determine the master's current coordinates within its binary log. You will need this information so that when the slave starts the replication process, it is able to start processing events from the binary log at the correct point.
If you have existing data on your master that you want to synchronize on your slaves before starting the replication process, you must stop processing statements on the master, and then obtain its current binary log coordinates and dump its data, before permitting the master to continue executing statements. If you do not stop the execution of statements, the data dump and the master status information that you use will not match and you will end up with inconsistent or corrupted databases on the slaves.
To obtain the master binary log coordinates, follow these steps:
Step 1 :
Start a session on the master by connecting to it with the command-line client, and flush all tables and block write statements by executing the FLUSH TABLES WITH READ LOCK statement:
mysql> FLUSH TABLES WITH READ LOCK;
For InnoDB tables, note that FLUSH TABLES WITH READ LOCK also blocks COMMIT operations. Warning Leave the client from which you issued the FLUSH TABLES statement running so that the read lock remains in effect. If you exit the client, the lock is released.
Step 2 :
In a different session on the master, use the SHOW MASTER STATUS statement to determine the current binary log file name and position:
mysql > SHOW MASTER STATUS; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000003 | 73 | test | manual,mysql | +------------------+----------+--------------+------------------+
The File column shows the name of the log file and Position shows the position within the file. In this example, the binary log file is mysql-bin.000003 and the position is 73. Record these values. You need them later when you are setting up the slave. They represent the replication coordinates at which the slave should begin processing new updates from the master.
If you have existing data that needs be to synchronized with the slave before you start replication, leave the client running so that the lock remains in place and then proceed to a data snapshot using mysqldump in a shell :
mysqldump --opt database_name > snapshot.sql
Release the read lock in the client.
mysql> UNLOCK TABLES;
On the slave, import the dump file:
mysql < snapshot.sql
To set up the slave to communicate with the master for replication, you must tell the slave the necessary connection information. To do this, execute the following statement on the slave, replacing the option values with the actual values relevant to your system:
mysql> CHANGE MASTER TO
-> MASTER_HOST='master_host_name',
-> MASTER_USER='replication_user_name',
-> MASTER_PASSWORD='replication_password',
-> MASTER_LOG_FILE='recorded_log_file_name',
-> MASTER_LOG_POS=recorded_log_position;
Finally, Start the slave threads:
mysql> START SLAVE;
For stopping the slave threads:
mysql> STOP SLAVE;
For making the slave to forget its replication position in the master's binary log use:
mysql> RESET SLAVE;
lundi, juillet 26 2010
Par jaillet simon le lundi, juillet 26 2010, 20:40 - Admin Linux
sudo aptitude install cryptsetup dmsetup
Erase the partition with random writing
sudo aptitude install e2fsprogs sudo /sbin/badblocks -s -w -t random -v /dev/sdxx
Formating the partition with luks
sudo luksformat -t ext2 /dev/sdxx mkdir /media/cryptfs
Add to /etc/fstab : /dev/mapper/cdisk1 /media/cryptfs ext2 noauto,defaults 0 0
Manually mount the partition
cryptsetup luksOpen /dev/sdxx cdisk1
mercredi, juillet 21 2010
Par jaillet simon le mercredi, juillet 21 2010, 13:47 - Admin Linux
pear list -a
pear list
pearl list-all
sudo pear config-set preferred_state alpha sudo pear install <package_name> sudo pear config-set preferred_state stable
sudo pear uninstall <channel_name>/<package_name>-<version_name>
ex : sudo pear uninstall __URI/SQLI_CodeSniffer-0.4.0dev1
pear upgrade <name_of_the_package>
pear channel-update pear.php.net
pear remote-list -c <name_to_search>
pear channel-discover <name_of_the_channel>
ex : sudo pear channel-discover pear.symfony-project.com
pear channel-delete <name_of_the_channel>
ex : sudo pear channel-delete pear.symfony-project.com
mardi, juillet 20 2010
Par jaillet simon le mardi, juillet 20 2010, 12:50 - Code
sudo aptitude install git-core
mkdir myapp cd myapp tar xzf myapp.tar.gz git config --global user.name "Your Name Comes Here" git config --global user.email you@yourdomain.example.com git init
you may notice a new directory created, named ".git".
Next, tell git to take a snapshot of the contents of all files under the current directory :
git add .
This snapshot is now stored in a temporary staging area which git calls the "index". You can permanently store the contents of the index in the repository with git commit:
git commit
sudo apt-get install sun-java6-jdk
Select the /usr/lib/jvm/java-6-sun/jre/bin/java alternative
sudo update-alternatives --config java
To start, CruiseControl needs the JAVA_HOME variable set. To set it add the lone below to your /etc/environment.
JAVA_HOME="/usr/lib/jvm/java-6-sun"
Install CruiseControl: unzip the bin release to a directory. For example
sudo unzip cruisecontrol-bin-2.8.3.zip /opt cd /opt/cruisecontrol-bin-2.8.3 sudo ln -s cruisecontrol-bin-2.8.3 cruisecontrol
The script implements the following functions: start, stop, restart, status. Save it to /etc/init.d/cruisecontrol and make it executable (chmod +x /etc/init.d/cruisecontrol).
#!/bin/sh
### BEGIN INIT INFO
# Provides: cruisecontrol
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop cruisecontrol CI server
### END INIT INFO
#
# cruisecontrol This init.d script is used to start cruisecontrol.
# It basically just calls cruisecontrol.sh.
# ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
CCON_PATH=/opt/cruisecontrol
CCON_USER=www-data
PIDFILE=$CCON_PATH/cc.pid
LOGFILE=/var/log/cruisecontrol.log
JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME
. /lib/lsb/init-functions
ccon_is_running() {
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
PID_COUNT=`ps aux | grep -E $PID | grep -v grep | wc -l`
if [ $PID_COUNT = 1 ]; then
return 1
fi
fi
return 0
}
ccon_start() {
ccon_is_running
rc=$?
if [ $rc -eq 1 ]; then
log_failure_msg "CruiseControl is already running"
else
log_daemon_msg "Starting CI server" "CruiseControl"
cd $CCON_PATH
sudo -E -H -u $CCON_USER ./cruisecontrol.sh >> $LOGFILE 2>&1
log_end_msg $?
fi
}
ccon_stop() {
ccon_is_running
rc=$?
if [ $rc -eq 1 ]; then
log_daemon_msg "Stopping CI server" "CruiseControl"
PID=`cat $PIDFILE`
retval=0
i=0
while $(kill "$PID" 2> /dev/null); do
if [ $i = '60' ]; then
echo ""
log_failure_msg "CruiseControl is taking too long to shutdown"
retval=1
break
else
if [ $i = '0' ]; then
echo -n " ... waiting "
else
echo -n "."
fi
i=$(($i+1))
sleep 1
fi
done
log_end_msg $retval
else
log_failure_msg "CruiseControl is not running"
fi
}
ccon_status() {
ccon_is_running
rc=$?
if [ $rc -eq 1 ]; then
PID=`cat $PIDFILE`
log_success_msg "CruiseControl is running (pid $PID)."
else
log_failure_msg "CruiseControl is not running."
fi
}
case $1 in
start)
ccon_start
;;
stop)
ccon_stop
;;
restart)
ccon_stop
ccon_start
;;
status)
ccon_status
;;
*)
log_success_msg "Usage: /etc/init.d/cruisecontrol {start|stop|restart|status}"
exit 1
;;
esac
Then change the ownership of the cruisecontrol installation to the user you specified in the init script (in my case www-data):
chown -R www-data.www-data /opt/cruisecontrol-bin-2.8.3/
Additionally you can add it to the default runlevels to start it automatically on system boot.
update-rc.d cruisecontrol defaults
sudo aptitude install php5-xdebug
Or :
sudo aptitude install php5-dev php-pear pecl install xdebug
zend_extension="FULL_PATH_TO/xdebug.so"
sudo pear upgrade pear sudo pear channel-discover pear.phpunit.de sudo pear channel-discover pear.symfony-project.com sudo pear install phpunit/PHPUnit sudo pear channel-discover components.ez.no sudo pear install -a ezc/Graph sudo pear config-set preferred_state alpha sudo pear install PHP_CodeSniffer sudo pear install phpunit/PHP_CodeBrowser sudo pear config-set preferred_state stable sudo pear install phpunit/PHP_Timer sudo pear install phpunit/phpcpd sudo pear channel-discover pear.pdepend.org sudo pear install pdepend/PHP_Depend-beta sudo pear channel-discover pear.phpmd.org sudo pear install --alldeps phpmd/PHP_PMD-alpha
cd /opt sudo git clone git://github.com/manuelpichler/phpUnderControl.git sudo phpuc install cruisecontrol
Example projets :
sudo phpuc example /opt/cruisecontrol
Removing a project :
sudo phpuc delete --project-name connectfour /opt/cruisecontrol sudo phpuc delete --project-name php-under-control /opt/cruisecontrol
cd /opt/cruisecontrol cd projects/myapp
create the build.xml file :
<project name="myapp" default="build" basedir=".">
<property name="builddir" value="${basedir}/build" />
<target name="prepare" depends="clean,init" />
<target name="init">
<mkdir dir="${builddir}" />
<mkdir dir="${builddir}/api" />
<mkdir dir="${builddir}/log" />
<mkdir dir="${builddir}/coverage" />
<mkdir dir="${builddir}/phpcb" />
</target>
<!--
Removes all temporary build artifacts
-->
<target name="clean">
<delete dir="${builddir}" />
</target>
<target name="checkout">
<exec dir="${basedir}/source" executable="git">
<arg line="pull"> </arg>
</exec>
</target>
<!-- Checkout for SVN
<target name="checkout">
<exec executable="svn" dir="${basedir}/source">
<arg line="up" />
</exec>
</target>
-->
<target name="phpunit">
<exec executable="phpunit" dir="${basedir}/source" failonerror="on">
<arg line="--log-junit ${builddir}/log/junit.xml --coverage-clover ${builddir}/log/phpunit.coverage.xml --coverage-html ${builddir}/coverage phpucAllTests testsuite/all_tests.php" />
</exec>
</target>
<target name="phpcpd" depends="init">
<exec executable="phpcpd" failonerror="false">
<arg line="--log-pmd ${builddir}/log/pmd-cpd.xml ${basedir}/source --exclude plugin/,test/,view/,webroot/" />
</exec>
</target>
<target name="php-documentor">
<exec executable="phpdoc" dir="${basedir}/source">
<arg line="-ct type -ue on -t ${builddir}/api -tb '/usr/share/php/data/phpUnderControl/data/phpdoc' -o HTML:Phpuc:phpuc -d . -i plugin/,test/,webroot/,view/"/>
</exec>
</target>
<target name="php-codesniffer">
<exec executable="phpcs" dir="${basedir}/source" output="${builddir}/log/checkstyle.xml" error="/tmp/checkstyle.error.log">
<arg line="--report=checkstyle --standard=PEAR --ignore=plugin/,view/,test/,webroot/ ."/>
</exec>
</target>
<target name="phpmd">
<exec executable="phpmd" dir="${basedir}/source">
<arg line=". xml codesize,unusedcode,naming --reportfile ${builddir}/log/pmd.xml --exclude plugin/,test/,view/,webroot/"/>
</exec>
</target>
<target name="build" depends="checkout,php-documentor,php-codesniffer,phpmd,phpcpd,phpunit"/>
</project>
Init & import Git / SVN (choose one solution)
ant init sudo git clone file:///opt/src/mylocalgitrepository/myapp.git source
Other possible import solution :
sudo svn co svn://my.svnserver.com/myproject/trunk source sudo git clone git://my.gitserver.com/myrepository/myapp.git source
<cruisecontrol>
<project name="....">
...
</project>
...
<project name="myapp" buildafterfailed="false">
<plugin name="git" classname="net.sourceforge.cruisecontrol.sourcecontrols.Git"/>
<!-- SVN plugin
<plugin name="svn" classname="net.sourceforge.cruisecontrol.sourcecontrols.SVN" />
-->
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
</listeners>
<modificationset quietperiod="60">
<git localworkingcopy="projects/${project.name}/source/"/>
</modificationset>
<schedule interval="300">
<ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml"/>
</schedule>
<log dir="logs/${project.name}">
<merge dir="projects/${project.name}/build/logs/"/>
</log>
<publishers>
<artifactspublisher subdirectory="api" dest="artifacts/${project.name}" dir="projects/${project.name}/build/api"/>
<artifactspublisher subdirectory="coverage" dest="artifacts/${project.name}" dir="projects/${project.name}/build/coverage"/>
<execute command="phpcb --log projects/${project.name}/build/log --output projects/${project.name}/build/phpcb"/>
<artifactspublisher dir="projects/${project.name}/build/phpcb" dest="artifacts/${project.name}" subdirectory="php-code-browser"/>
<execute command="phpuc graph logs/${project.name} artifacts/${project.name}"/>
<!-- Mailing
<email mailhost="smtp.localhost"
username="username"
password="password"
returnaddress="cruise@phpundercontrol.org"
buildresultsurl="http://localhost:8080/buildresults/${project.name}"
skipusers="true"
spamwhilebroken="true">
<always address="successful@maildomain.com"/>
<always address="cruise@maildomain.com"/>
<failure address="failed@maildomain.com"/>
</email>
-->
</publishers>
</project>
</cruisecontrol>
lundi, juin 14 2010
Par jaillet simon le lundi, juin 14 2010, 03:33 - Admin Linux
Replace to lowercase using \l and \L
sed -i 's/\([a-z]\)\([A-Z]\)/\1_\l\2/g' filename
mardi, décembre 29 2009
Par jaillet simon le mardi, décembre 29 2009, 19:37 - Admin Linux
Purge unused configuration file :
sudo dpkg --purge $(COLUMNS=200 dpkg -l | grep "^rc" | tr -s ' ' | cut -d ' ' -f 2)
or for on packet :
sudo aptitude remove nom-du-paquet --purge
mercredi, décembre 9 2009
Par jaillet simon le mercredi, décembre 9 2009, 15:50 - Admin Linux
With mplayer :
mplayer -dumpaudio nodame_theme.flv -dumpfile nodame_theme.mp3 mplayer -dumpstream http://64.236.34.97:80/stream/1005 -dumpfile smoothjazz.mp3
with ffmpeg :
ffmpeg -i nodame_theme.flv -ab 128 -ar 44100 nodame_theme.mp3 ffmpeg -i http://64.236.34.97:80/stream/1005 -ab 128 -ar 44100 smoothjazz.mp3
libavcodec-unstripped will enable ffmpeg support for mpeg4 encoding.
Unsupported codec for output stream #0.0 : The ffmpeg avcodec libraries come in many separate packages: libavutil, libavcodec, libavfilter, libavformat, and libavdevice. For versions of Ubuntu 9.10 and older, these packages came in "unstripped" versions (i.e. libavutil-unstripped, libavfilter-unstriped, etc.)
Versions of Ubuntu starting with 10.04 and newer have renamed the "unstripped" packages to "extra" packages, such as libavcodec-extra. However, if you don't know which version you have, you can just install the unstripped ones, and they will automatically install the -extra packages for you instead.
Just launch the package manager (either Software Center or Synaptic,) and search for "libav." Find the packages with "unstripped-51" in their name and install those.
From the command line, you can use aptitude's pattern matching like this:
sudo aptitude search unstripped
dimanche, décembre 6 2009
Par jaillet simon le dimanche, décembre 6 2009, 12:16 - Admin Linux
There are many great tools for backing up or synchronizing directories :
mardi, décembre 1 2009
Par jaillet simon le mardi, décembre 1 2009, 02:37 - Code
Life is all about standing on the shoulders of giants, and sometimes clubbing baby seals.
Par jaillet simon le mardi, décembre 1 2009, 02:35 - Admin Linux
Your system is configured properly, but each time you plug your USB Mass Storage device you need to check all the "/dev/sdxx". Using udev you can make sure that, no matter what order you plug in your USB devices, the storage device is always at /dev/usbdrive (or whatever mount point you like).
First, find the ID of your usb drive by using /sys: (assuming the device is currently in /dev/sdc)
#> udevinfo -a -p `udevinfo -q path -n /dev/sdc`
If your device is an USB device you should have a section like the following :
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb7/7-4':
KERNELS=="7-4"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{dev}=="189:776"
ATTRS{configuration}=="USB Mass Storage"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="c0"
ATTRS{bMaxPower}==" 2mA"
ATTRS{urbnum}=="14451"
ATTRS{idVendor}=="059f"
ATTRS{idProduct}=="1021"
ATTRS{bcdDevice}=="0001"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{speed}=="480"
ATTRS{busnum}=="7"
ATTRS{devnum}=="9"
ATTRS{version}==" 2.00"
ATTRS{maxchild}=="0"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="LaCie"
ATTRS{product}=="little disk"
ATTRS{serial}=="00E001036060D"
ATTRS{serial}=="00E001036060D" seems to be a good values to identifying the device.
On this device i've two partitions : - /dev/sdc1 (fat32) - /dev/sdc2 (ext2fs)
and i want them to be mounted on /media/laciewin ans /media/lacielinux respectively.
So next, you'll have add the following rules in your "/etc/udev/rules.d/10-local.rules" files (create it if you don't have one):
SUBSYSTEMS=="usb",ATTRS{serial}=="00E001036060D",KERNEL=="sd?1", NAME="laciewin", SYMLINK="usbdevices/laciewin"
SUBSYSTEMS=="usb",ATTRS{serial}=="00E001036060D",KERNEL=="sd?2", NAME="lacielinux", SYMLINK="usbdevices/lacielinux"
Then make udevd re-read the updated ruleset:
#> sudo udevcontrol reload_rules
or:
#> sudo /etc/init.d/udev restart
Finally, you'll have to create the mount point and configuring /etc/fstab :
#> sudo mkdir /media/laciewin #> sudo mkdir /media/lacielinux
Add the following rules in your /etc/fstab :
/dev/laciewin /media/laciewin vfat defaults,user,utf8,umask=007,gid=46 0 1 /dev/lacielinux /media/lacielinux ext2 defaults,user 0 2
Should work !
Par jaillet simon le mardi, décembre 1 2009, 02:33 - Code
The K&R style :
while (x == y) {
something();
somethingelse();
}
finalthing();
BSD/Allman style :
while(x == y)
{
something();
somethingelse();
}
finalthing();
GNU style :
while (x == y)
{
something ();
somethingelse ();
}
finalthing ();
Whitesmiths style :
while (x == y)
{
something();
somethingelse();
}
finalthing();
Banner style :
while (x == y) {
something ();
somethingelse ();
}
finalthing ();
Well... i need to pay attention now :)
Par jaillet simon le mardi, décembre 1 2009, 02:33 - Javascript
Usefull infos for calling parent Javascript function (e.g from inside an iframe)
window.top : Returns a reference to the topmost window in the window hierarchy.
window.parent : Returns a reference to the parent of the current window or subframe.
window.opener : Returns a reference to the window that opened this current window.
function parentCall()
{
if(typeof(window.parent)!="undefined"))
{
window.parent.myFunction();
}
}
Par jaillet simon le mardi, décembre 1 2009, 02:31 - Admin Linux
Building Postfix with Cyrus SASL with Gentoo :
emerge cyrus-sasl; emerge postifx;
Not that hard !
Configuring the passwd deamon :
emacs /etc/conf.d/saslauthd
#For Pam password checking set :
SASLAUTHD_OPTS="${SASLAUTH_MECH} -a pam -r"
#For Unix Shadow password checking set :
SASLAUTHD_OPTS="${SASLAUTH_MECH} -a shadow"
/etc/init.d/saslauthd restart
Configuring SASL :
emacs /etc/sasl2/smtpd.conf
pwcheck_method: saslauthd mech_list: plain login
Configuring Posfix :
emacs /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes smtpd_delay_reject = yes smtpd_recipient_restrictions = permit_sasl_authenticated, reject smtpd_sasl_security_options = noanonymous smtpd_sasl_authenticated_header = yes broken_sasl_auth_clients = yes
/etc/init.d/postfix restart
Par jaillet simon le mardi, décembre 1 2009, 02:29 - Javascript
In JavaScript null is an object. undefined is used for things that don't exist. The DOM returns null for almost all cases where it fails to find some structure in the document, but in JavaScript itself undefined is the value used.
For example :
(name is undefined)
You: What is name?
JavaScript: name? What's a name? I don't know what you're talking about.
name = null;
You: What is name?
JavaScript: I don't know.
so null and undefined are not strictly equivalent. If you really want to check for null, do:
if (varname === null)
If you want to check if a variable exist
if (typeof(varname) != 'undefined')
Par jaillet simon le mardi, décembre 1 2009, 02:28 - CSS
auto-width Margins in CSS :
body {
text-align:center;
}
#content {
width:800px;
margin:0px auto;
text-align:left;
border:1px solid #999999;
background-color:#eeeeeee;
}
IE incorrectly applies the CSS "text-align" attribute. Declaring "text-align:center" for the containing block-level element (body in this case) horizontally centers the box in IE. In addition, it is often necessary to explicitly set the "text-align" attribute (to left) owerwise all text will display centered in the page.
« billets précédents - page 1 de 3