Creating a PHP rss feed parser class

If you thought how to build rss feed parser you should think first think about what php xml parse you should use. If we examine the parser that we have built in then you will find expat, simple xml and xml dom manupulation. In order to parse a feed from a url you should first validate the feed url , get the contents of the xml through file_get_contents, and loop through nodes of xml and get the nodes values.
So here are steps the in order to build our class:
1. Validate url
2. Get contents using file_get_contents

3.Set the limit of how many items to return
4. Parse results. We should replace the spaces of the node values.

Class Description
Variables
$url – the url of the feed that will be parsed.
$doc – the DOM Document that will load the xml parsed from url.
$limit – Limits the number of items to be retrieved.
$isValidUrl – Verifies if the link is valid.
$items – the RSS items that would be returned.

Constructor
Initialize the url of the feed and all class variables with empty variables. We initialize the limit to 5 items.
Methods
SetLimit – sets the limit of the items to be parsed
ValidateUrl – validates the url of the rss feed. It checks if the feed url begins with ‘https://’
ExecuteRssParser – fetches the feed url and loads into a php variable. After that it loads the xml and parses the rss nodes values and returns the results into the variable ‘feeds’.

<?
class RssFeedParser
{
private $url, $doc, $limit;
public $isValidUrl, $items;
 
public function __construct($url) {
$this->url = $url;
$this->items = array();
$this->doc = new DOMDocument();
$this->limit = 5;
}
 
private function ValidateUrl()
{
if (stristr( $this->url, 'https://') === FALSE)
{
return false;
}
else
{
return true;
}
}
 
public function SetLimit($limit)
{
$this->limit = $limit;
}
 
public function ExecuteRssParser()
{
$this->isValidUrl = $this->ValidateUrl();
if ($this->isValidUrl)
{
  $xmlText = preg_replace("/>\s+</", "><", file_get_contents($this->url));
  $this->doc->loadXML($xmlText);
 
  if ($this->doc->getElementsByTagName('item'))
  {
	  $count = 0;
	  foreach ($this->doc->getElementsByTagName('item') as $node) {
		$itemRSS = array ( 
		  'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
		  'description' => $node->getElementsByTagName('description')->item(0)->nodeValue,
		  'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
		  'pubDate' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
		  );
		array_push($this->items, $itemRSS);
		$count++;
		if ($count>=$this->limit)
		{
			break;
		}
	  }
  }
}
}
}
?>

You can easy modificate this class in order to fit your needs. Good luck!!!

Create a PHP file log

Writing a file log on disk with php it’s pretty straigt forward. Here is a simple php class that can help you log to a file. The class is logging on the directory where the script exists. You can also create a directory where the script inside and change the path in order to log to the directory you created. In the constructor of the class you should pass the name of the log file. Every time you call the function WriteLogToFile it appends messages in the file log of the directory script.


class FileLogger{
private $filename;
public function __construct($file) {
$this->filename = $file;
}

public function WriteLogToFile($messageLog) {
$currentDir = dirname(__FILE__)."/";
$fileLog = fopen($currentDir.$this->filename, 'a+');
fwrite($fileLog, $messageLog."\r\n");
fclose($fileLog);
}
}
?>

Calling function example:
$filel = new FileLogger('file.log');
$filel->WriteLogToFile('log...');

PHP database logging


Warning: imagepng(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/img_57455a01146ab-913ac76.png): failed to open stream: Permission denied in /home/admin/web/techhum.com/public_html/wp-includes/class-wp-image-editor.php on line 489

Warning: getimagesize(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/img_57455a01146ab-913ac76.png): failed to open stream: No such file or directory in /home/admin/web/techhum.com/public_html/wp-content/themes/jupiterx/lib/api/image/class-image-editor.php on line 144

Warning: imagepng(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/img_57455a01146ab-27513ac.png): failed to open stream: Permission denied in /home/admin/web/techhum.com/public_html/wp-includes/class-wp-image-editor.php on line 489

Warning: getimagesize(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/img_57455a01146ab-27513ac.png): failed to open stream: No such file or directory in /home/admin/web/techhum.com/public_html/wp-content/themes/jupiterx/lib/api/image/class-image-editor.php on line 144

In order to make database logging in php we should first create a table with 2 fields: the message that we log and the date that the log was made. After creating the database we should create a php class that will have to pass the instance of the MySQL database to the log class contructor. After that as previous example of php log file we should call a function that inserts a new row in a table database. Here is the class for php database logging:


class DBLog {
private $_db;

public function __construct($db) {
$this->_db = $db;
}

public function WriteLogToDB($message) {
if(!empty($message)){
$date = date("Y-m-d h:m:s");
mysql_query ("INSERT INTO DBLog VALUES('".$message."', '$date')", $this->_db);
}
}
}

In order to call the function of database logging we should first make a connection to the database and then call the function to save row log to database:


$connection = mysql_connect("localhost", "username", "password")
or die("Unable to connect to MySQL server");
mysql_select_db('DatabaseName', $connection) or die ("Database not found.");
$filel = new DBLog($connection);
$filel->WriteLogToDB('Here is my first log.');

We only need the mysql script that creates the table in our database:


CREATE TABLE IF NOT EXISTS `dblog` (
`Message` text NOT NULL,
`DateCreated` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Google working hard to push Artificial Intelligence in the mainstream


Warning: imagepng(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/processor-created-by-google-d953dfb.png): failed to open stream: Permission denied in /home/admin/web/techhum.com/public_html/wp-includes/class-wp-image-editor.php on line 489

Warning: getimagesize(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/processor-created-by-google-d953dfb.png): failed to open stream: No such file or directory in /home/admin/web/techhum.com/public_html/wp-content/themes/jupiterx/lib/api/image/class-image-editor.php on line 144

Warning: imagepng(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/processor-created-by-google-8c0e872.png): failed to open stream: Permission denied in /home/admin/web/techhum.com/public_html/wp-includes/class-wp-image-editor.php on line 489

Warning: getimagesize(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/processor-created-by-google-8c0e872.png): failed to open stream: No such file or directory in /home/admin/web/techhum.com/public_html/wp-content/themes/jupiterx/lib/api/image/class-image-editor.php on line 144

This is what the the processor created by Google looks like that is being used to develop an artificial intelligence platform.

Google I/O 2016 is already underway, it will be three days in which all kinds of workshops and lectures for developers will take place.

This year there is a common theme in virtually everything presented: the importance of artificial intelligence that will happen in on our future. Not in the sense of replacing the tasks we humans perform, but help us in our day to day, while the machines are becoming more and more intelligent, learning for themselves.

Tensor Processing Unit, the heart that machines use for learning

Tensor Processing Unit, the heart machines use for learning

On paper this looks very nice, but hardware is needed to achieve it, and Google does. This Google TPU processor, named “Tensor Processing Unit,” is an integrated circuit tailored specifically created for the “learning machine”.

In addition, the TPU has been adapted to work with TensorFlow, which is a library of open source software for the development of artificial intelligence in machines that anyone can access from Google’s code.

This piece is adapted to machine learning applications, is able to perform more operations per second than traditional hardware using equal consumed energy, it can prioritize tasks and learn from failures to automatically correct on these actions. The most interesting is that this is not a theoretical project, Google has kept secret already more than a year using it in different services and projects. They have been using TPU in their data centers and is part of projects like RankBrain, Street View or to improve the accuracy of maps via Maps and navigation.

Google has made it clear they want to lead the development of learning machines and artificial intelligence. TPU is another step and most likely will end up licensing its technology to other companies. Skynet anyone say?

The top 10 private trackers for torrents

If you are looking for the best private trackers, here’s a list that lets you find what will work best for you.
Although torrent downloads seem to suffer from lag and missing files and slowdowns, we can not say the same of private trackers, whose loyal users still share files as usual.

Anyone can download a torrent, but you really do not realize the potential of this protocol until you use a private tracker; it is as if a whole new world opened before you, a community full of people with similar tastes to yours and are willing to share what they have archived.

Of course, it is not always easy to get into a private tracker. In this post you will find the perfect community for your needs. There are many private trackers and it would be impossible to gather them all in one article, so this time we will focus on the most popular while covering specific niches.

Note that we will not link to certain “sites” for various reasons; to begin with, because many owners do not want to be linked as trackers, but also because the site might get in trouble. Suffice to say that, if you know the name of a community, is not very difficult to find using the Internet.

Torrentleech

tracker privado 11

One of the most popular private trackers out there, with a huge number of different categories, although it is not ideal if you want to find something concrete.

Baconbits

tracker privado 21

A general tracker born in the Reddit community. It is a tracker born of mutual trust, so there is no minimum ratio, but we have to participate in the community via Reddit (or we can also play a clone of bacon themed Space Invaders free if we do not have an account).

SceneAccess

tracker privado 31

One of the most prestigious private trackers, but at the same time one of the most elite. Many functions are available only if you “donate”.

TorrentShack

tracker privado 4

One of the most popular because it is not necessary to maintain a ratio and due to the good number of different categories provide by this private tracker host.

Bibliotik

tracker privado 5

One of the most popular exclusive trackers for sharing books; is a modern version of book clubs, and so its ideal for finding rare editions or books, preferably in English.

32Pages (ComicBT)

tracker privado 6

Although this community had to change his name after being forced to close the original site, it is still one of the best communities to find and share comics.

What.CD

A reference site to find music discs of any kind and quality, although it may be difficult to get into this community.

HDBits

tracker privado 4 1

One of the most popular websites for HD movies.

AnimeBytes

tracker privado 6 1

On this website you can find full anime series and manga’s that you will not find anywhere else.

Racingforme

tracker privado 13

This is a community is filled with fans of car racing. Practically the only place you’ll find ancient races in acceptable quality.

This is how you can use Whatsapp while driving your car

One of the major violations committed by drivers is related to the use of mobile devices, specifically with popular apps such as Whatsapp.

But as a lesser evil (we all know we’ll do it) there exists an application that can do two things at once, driving and letting us work with Whatsapp. The app that will allow us to do this is called Auto4Android and is free in the Android store, Play Store.

What’s neat in this ‘app’ is that you can read messages while you are driving. Messages from other messaging applications, such as Line, Viber, Hangouts, Facebook or Messenger, among others (as you can see in the picture).

This app has the ability to read messages with the screen off, and you can answer them with our voice if you click on an icon with a microphone. And thanks to Auto4Android you can play music or audio books downloaded and saved earlier in other application. You can also find out what the traffic is like through other apps like Waze.

This is how you can listen to music from YouTube in the background on your Android

YouTube is the most popular video platform in the world. Every day, millions of people use this portal to listen to their favorite songs in the background, ie, while doing another activity on their computers.

However, YouTube users using Android on their mobile devices such as smartphones or tablets, can not listen to any song in the background, and the music will stop just minimize the application.

For now, YouTube has no official option to correct this error on Android devices. To solve this problem we could use a free application that can be found in Google Play.

AudioPocket is the name of this free application, you can find here, that will allow YouTube to listen to music in the background on your Android smartphone or tablet. Here we show you what you should do.


Once you have installed this app on your Android device, you should go to the YouTube app and choose the song you want to hear in the background, that is, while you do other things.

Once the song starts playing on YouTube on your Android device, you must press the icon “Share”. You will see several options, you must choose “AudioPocket

That is all, now YouTube song will open in AudioPocket and you can minimize it so you can chat or play while listening to your favorite music. We recommend you check the gallery for details.

Nvidia SHIELD Tablet K1 Tegra K1 great for gaming


Warning: imagepng(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/tegra-k1-31cc4d5.png): failed to open stream: Permission denied in /home/admin/web/techhum.com/public_html/wp-includes/class-wp-image-editor.php on line 489

Warning: getimagesize(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/tegra-k1-31cc4d5.png): failed to open stream: No such file or directory in /home/admin/web/techhum.com/public_html/wp-content/themes/jupiterx/lib/api/image/class-image-editor.php on line 144

Warning: imagepng(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/tegra-k1-107cff4.png): failed to open stream: Permission denied in /home/admin/web/techhum.com/public_html/wp-includes/class-wp-image-editor.php on line 489

Warning: getimagesize(/home/admin/web/techhum.com/public_html/wp-content/uploads/jupiterx/images/tegra-k1-107cff4.png): failed to open stream: No such file or directory in /home/admin/web/techhum.com/public_html/wp-content/themes/jupiterx/lib/api/image/class-image-editor.php on line 144

Nvidia can currently boast for creating a great tablet for gaming, but also a great tablet for everything else. With its Tegra K1 processor plus an 8-inch screen that offers 1920×1200 pixel resolution and 2GB of RAM it will surely play any game out there. In addition, Nvidia Tegra Zone, the game portal from the company lets you download exclusive games such as Portal and Half-Life 2.

GameStream and Nvidia Grid allow you to run PC games on your tablet via streaming. If you want you can connect it to your TV since it has HDMI output and a controller is available currently sold separately by Nvidia make it a very powerful and interesting console. Here is a list of games compatible with GameStream. The tablet also has a stylus with which to more comfortably write or to use certain design applications.

Even if you’re not a gamer or someone who likes to play games on a tablet, the quality of the design and power that carries inside is great, also its a compact tablet. If you’re in the market for a powerful tablet we highly recommended the Tegra K1, which is also updated to Android 5.0.

Basic features of the Tegra K1:

  • SoC: Nvidia Tegra K1 (32 bits) (Tegra K1)
  • Cores: 4 at 2.3 GHz
  • GPU: Kepler at 950MHz
  • Memory: 2 GB
  • Storage: 16 GB
  • Dimensions: 221 x 126 x 9.2 mm
  • Weight: 390 gram
  • Battery: 5197 mAh Li-Ion
  • Operating System: Android 5.1 updatable to Android 6.0
  • Screen: size: 8” a 1920 x 1200 pixels (284 ppp)
  • Camera: front 5 megapixels, rear camera 5 megapixels

[super-post id=”sp573acc9aee310″ search=”SHIELD Tablet” items=”5″ show_title=”true” title_length=”0″ title_ellipsis=”…” show_thumbnail=”true” remove_no_thumbnail=”false” icon_height=”40″ icon_width=”40″ icon_empty=”14248″ show_comments=”false” comment_icon=”https://www.techhum.com/wp-content/plugins/super-post/images/comments.png” show_date=”false” show_date_link=”false” date_icon=”https://www.techhum.com/wp-content/plugins/super-post/images/date.png” date_format=”M j, Y” show_author=”false” author_title=”View all posts by {author}” author_icon=”https://www.techhum.com/wp-content/plugins/super-post/images/author.png” show_category=”false” first_category=”true” category_separator=”, ” category_icon=”https://www.techhum.com/wp-content/plugins/super-post/images/category.png” offset=”0″ page_range=”5″ load_text=”Load more posts” query=”recent” order=”DESC” post_status=”publish” title_trim=”words” load_style=”none” template=”left”]

Apple MacBook 12 (Early 2016) 1.1 GHz model specs

Apple MacBook 12 (Early 2016) 1.1 GHz

  • Processor: Intel Core m3-6Y30 1.1 GHz
  • Graphics Card: Intel HD Graphics 515
  • Memory: 8192 MB, DDR3L-1866 welded
  • Screen: 12 inch 16:10, 2304×1440 pixels, 226 PPI, APPA027, IPS, glossy: yes
  • Motherboard: Intel Skylake-Y Premium PCH
  • Hard drive: Apple SSD AP0256, 256 GB, NVMe, 231 GB free space
  • Weight: 927
  • Weight: $1299

 

 

csm mb12 m3 20161 7ddedcfe13

csm mb12 m3 20162 0b11c7f0ae

How to check who can see photos in which you’re tagged in Facebook

You can easily control the privacy of the photos that you upload to Facebook, but what about the photos published by others in which you are tagged?

If the person who uploaded your photo has as set adjustment of privacy  to Public or Friends of Friends it is possible that people who are not even your friend on Facebook to see your photo and your label.

To find out which of the photos that you’re tagged are visible to people who are not your friends please click the triangular icon top right, then select Activity Log> Photos> Pictures that you appear.

Top center you can then filter the results according to who they were shared.

If a friend shared with the “Public” or “Friends of Friends” a picture of you that you do not want to be accessible you have to ask your friend to change the setting for that picture to be allowed  for just friends, only a specific group of people or the delete it directly.

Alternatively, you can manually remove your own label.