Таз седмица отскоихме до Велинград с колегите от университета. Ленчето беше запазила места в комплекс при Дузпата . Чудесен комплекс в стил дървен лукс. А кръчмата беше ужасно близо, което беше супер, а пържолата по ловджийски беше страхотна.
Таз седмица отскоихме до Велинград с колегите от университета. Ленчето беше запазила места в комплекс при Дузпата . Чудесен комплекс в стил дървен лукс. А кръчмата беше ужасно близо, което беше супер, а пържолата по ловджийски беше страхотна.
До сега не се бях замислял колко мощен може да бъде xinetd докато не прочетох следната статия
You can use the simple but powerful xinetd on your Linux server to monitor almost anything on the server. Since xinetd just holds open a port and waits for a connection, you can tell it to run a script and return the output directly to the network stream.
To start, you’ll need a script which will return data to stdout. In this example, I’ll use a very simple script like the following:
#!/bin/bash
echo `uptime | egrep -o ‘up ([0-9]+) days’ | awk ‘{print $2}’`This script pulls the number of days that the server has been online. Make the script executable with a chmod +x.
Now, you’ll need to choose a port on which to run the xinetd service. I normally find a service in /etc/services that I won’t be using on the server. In this example, I’ll use isdnlog, which runs on port 20011. Create a file called /etc/xinetd.d/myscript and include the following in the file:
service isdnlog
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = root
server = /path/to/script.sh
server_args = test
}Depending on your xinetd version, you may need to enable your new configuration and restart xinetd:
chkconfig myscript on
/etc/init.d/xinetd restartYou can test your new script using netcat:
$ uptime
18:10:30 up 141 days, 19:17, 1 user, load average: 0.65, 1.47, 1.14
$ nc localhost 20011
141If you need to pass arguments to your script, just adjust the server_args line in the xinetd configuration. Also, be sure that your script is set up to handle the arguments.
Попаднах на една интересна статия как се импортват/експортват данни от екселски файл с помщта на php
If you have Excel files that need to be imported into MySQL, you can import them easily with PHP. First, you will need to download some prerequisites:
PHPExcelReader – http://sourceforge.net/projects/phpexcelreader/
Spreadsheet_Excel_Writer – http://pear.php.net/package/Spreadsheet_Excel_WriterOnce you’ve downloaded both items, upload them to your server. Your directory listing on your server should have two directories:
Excel
(from PHPExcelReader) andSpreadsheet_Excel_Writer-x.x.x
(from Spreadsheet_Excel_Writer). To work around a bug in PHPExcelReader, copyoleread.inc
from theExcel
directory into a new path:
Spreadsheet/Excel/Reader/OLERead.php
The PHPExcelReader code will expect
OLERead.php
to be in that specific location. Once that is complete, you’re ready to use the PHPExcelReader class. I made an example Excel spreadsheet like this:Name Extension Email ---------------------------------------------------- Jon Smith 2001 jsmith@domain.com Clint Jones 2002 cjones@domain.com Frank Peterson 2003 fpeterson@domain.comAfter that, I created a PHP script to pick up the data and insert it into the database, row by row:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 require_once 'Excel/reader.php'; $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('CP1251'); $data->read('exceltestsheet.xls'); $conn = mysql_connect("hostname","username","password"); mysql_select_db("database",$conn); for ($x = 2; $x < = count($data->sheets[0]["cells"]); $x++) { $name = $data->sheets[0]["cells"][$x][1]; $extension = $data->sheets[0]["cells"][$x][2]; $email = $data->sheets[0]["cells"][$x][3]; $sql = "INSERT INTO mytable (name,extension,email) VALUES ('$name',$extension,'$email')"; echo $sql."\n"; mysql_query($sql); }After the script ran, each row had been added to the database table successfully. If you have additional columns to insert, just repeat these lines, using an appropriate variable for each column:
$variable = $data->sheets[0]["cells"][$row_number][$column_number];For more details, you can refer to a post in Zend’s Developer Zone.
Вчера ходихме в новооткритата кръчма Малкият Хан. Кръчмата има хубава кухня и стилен интериор. Масите са обградени от паравани така че не можете да видите кой похапва покрай вас. Музиката не е силна и спокойно можете си говорите с хората с които сте излезнали. На горните етажи се намират и стаите на семейният хотел. Изкарахме си супер и мисля да отида пак.
Ето и телефона за резервации 038 / 62 62 32, 0878 / 45 67 93
И темата с котките продължава…