- Details
- Category: blog
- Hits: 4359
- Page2RSS + Feedly + IFTTT
- Page2RSS (no need of account) + Blogtrottr (add account to record feeds)
ftp_monitor.php.txt:
<?php /* * ftp_monitor.php * Copyright (c) 2006 Mark Woodman * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Generate an RSS feed by scanning an FTP site * for the [$itemCount] newest files. */ function generateRssFeed($host, $user, $pass, $path, $itemCount) { // Get array of file/time arrays $fileList = exploreFtpServer($host, $user, $pass, $path); // Use user's count or # of files found, whichever is smaller if(count($fileList)<$itemCount) $itemCount=count($fileList); // Create link prefix for feed $linkPrefix = 'ftp://' . $host; // Declare date for channel/pubDate $channelPubDate = null; // Array for item strings $items = array(); // Create array of RSS items from most recent files foreach ($fileList as $filePath => $time) { // Create item/pubDate according to RFC822 $itemPubDate = date("r", $time); // Also use first item/pubDate as channel/pubDate if($channelPubDate==null) $channelPubDate = $itemPubDate; // Absolute path to ftp file $fileUri = ereg_replace(" ", "%20", $linkPrefix . $filePath); // Create item $item = '<item>' .'<title>' . $fileUri . '</title>' .'<DEFANGED_link>'. $fileUri . '</DEFANGED_link>' .'<pubDate>' . $itemPubDate . '</pubDate>' .'</item>'; // Add to item array array_push($items, $item); // If max items for feed reached, stop if(count($items)==$itemCount) break; } // Build RSS feed $rss = '<rss version="2.0">' . '<channel>' . '<title>FTP Monitor: ' . $host . '</title>' . '<DEFANGED_link>' . $linkPrefix . '</DEFANGED_link>' . '<description>The ' . $itemCount.' latest changes on ' . $host . $path . ' (out of ' . count($fileList) . ' files)</description>' . '<pubDate>' . $channelPubDate . '</pubDate>' . "\n" . join("\n", $items) . "\n" . '</channel>' . '</rss>'; // Set header for XML mime type header("Content-type: text/xml; charset=UTF-8"); // Display RSS feed echo($rss); } /** * Gets files and their timestamps of an FTP * server directory and its children. * * @return an associative array where keys are * filenames and values are timestamps */ function exploreFtpServer($host, $user, $pass, $path="/") { // Connect $cid = ftp_connect($host) or die("Couldn't connect to server"); // Login if (ftp_login($cid, $user, $pass)) { // Passive mode ftp_pasv($cid, true); //echo("Scanning " . $host . " ...<br/>"); // Recurse directory structure $fileList = scanDirectory($cid, $path); // Disconnect ftp_close($cid); } else { // Disconnect ftp_close($cid); die("Couldn't authenticate."); } // Sort by timestamp, newest (largest number) first arsort($fileList); // Return the result return $fileList; } /** * Scan a directory for files, collecting timestamps * and recursing into subdirectories. * * @return an associative array where keys are * filenames and values are timestamps */ function scanDirectory($cid, $dir) { // Use static value to collect results static $fileList=array(); // Get a listing of directory contents // Note: wu-ftpd servers will not include directories $contents = ftp_nlist($cid, $dir); // Iterate through the directory contents foreach ($contents as $item) { // Is the item a file? if (ftp_size($cid, $item)>=0) { // Prepend slash if not present if($item[0]!="/") $item = "/" . $item; // Add file and modify timestamp to results $fileList[$item] = ftp_mdtm($cid, $item); } else // Item is a directory { // Exclude self/parent aliases if($item!="." && $item!=".." && $item!="/") { // Server uses full path names if($item==strstr($item, $dir)) { scanDirectory($cid, $item); } else { // Server uses relative path names if($dir=="/") { scanDirectory($cid, $dir . $item); } else { scanDirectory($cid, $dir . "/" . $item); } } } } } // Return the results return $fileList; } /* Content of the ftp site */ // Connection params to monitor FreeBSD snapshots $host = "ftp.lyx.org"; $user = "anonymous"; $pass = "This email address is being protected from spambots. You need JavaScript enabled to view it. "; $path = "/pub/lyx/devel/lyx-2.2/"; // Generate RSS 2.0 feed showing newest FreeBSD snapshots generateRssFeed($host, $user, $pass, $path, 10); ?>
- Details
- Category: blog
- Hits: 4080
Dell D620 uses Broadcom BCM43xx based wireless network card which may not work when you try to install Ubuntu. There are already drivers for them.
- Details
- Written by: Wen-Fong Ke
- Category: blog
- Hits: 9367
You like the fonts you are using when you edit a document in MS Word, and you would like to use them also in your TeX documents. It sounds like a good idea, but appears to be impossible for you. Acturally, it is not too difficult, thanks to MTFI. Following the steps in this article, and you will be using one shortly. It is not perfect, but it is somewhat easy enough so that you can be satisfied with it.
In this article, you will be instructed to
- Get and install MTFI
- Use MTFI to install True Type Fonts
- Use the installed True Type Fonts in a TeX article
- Details
- Category: blog
- Hits: 13205
A Site Temporarily Unavailable Error 2 indicates that Joomla is having some problem with the database. If it happens with a change (updating) of mysql, it could be that the password is in trouble. In my case, I could still use mysql-front end to connect to the database, but not with phpBB and Joomla. Here is how you can solve this type of problem...
Read more: (solved) Joomla: Site Temporarily Unavailable Error 2