Connecting businesses to people through effective online marketing strategy
In: Tutorials
20 Oct 2009Here is a new component that will generate random strings for you. You can pass it a set of characters to pick from and how long your random string should be. I use it to generate passwords but you can do just about anything with it.
To use it, create a file called random_helper.php in app/controllers/components and copy the following code.
<?php class RandomHelperComponent extends Object { /** * Random string generator function * * This function will randomly generate a password from a given set of characters * * @param int = 8, length of the password you want to generate * @param string = 0123456789abcdefghijklmnopqrstuvwxyz all possible values * @return string, the password */ function generateRandomString ($length = 8, $possible = '0123456789abcdefghijklmnopqrstuvwxyz') { // initialize variables $password = ""; $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); // we don't want this character if it's already in the password if (!strstr($password, $char)) { $password .= $char; $i++; } } return $password; } } ?>
make sure you include it in the appcontroller as such
var $components = array('Auth','Email','RandomHelper');
then you can call it as follows in any function
$password= $this->RandomHelper->generateRandomString(4,'abcdefghijklmnopqrstuvwxyz');
Enjoy!
In: News and Updates
20 Oct 2009We all heard of the term living on the edge before right?
Here is a definition of what this means from the urbandictionary
Living on the edge
Living on the edge means living a dangerous and/or unusual everyday life. People who live on the edge are very frequently exposed to phisical, psycological, economical, lawful or other kinds of dangers.
Examples for people who live on the edge:
Extreme-sportsmen, gamblers, policemen, thiefs, human-rights-activists, rappers, etc.
-My friend John is living on the edge.
-Oh yeah? He is a gambler or something?
-No, he cleans windows of high office buildings.
Today, I am officially coining a new term called “living on the point” … see when you live on the edge, you got an infinite amount of points to live on. All the sudden you realize that the edge is not as extreme as you may have thought before.
This is where the point comes in. When you live on the point that’s all you got. One single point, making this life style the most extreme. A definition for such life style may sound something like the following. Perhaps this will be on the urban dictionary soon.
Living on the point
Living on the point means living a life more dangerous and/or unusual than you can humanly understand. People who live on the point are in constant extreme phisical, psycological, economical, lawful or other kinds of dangers.
Examples for people who live on the point:
Extreme-extreme-sportsmen, gamblers (playing poker in tank full of sharks), policemen (performing riot control on tigers), thiefs (stealing unstable dynamite), etc.
-My friend John is living on the point.
-Oh yeah? He is a gambler or something?
-No, he jumps off of high office buildings with nothing but a small zip-lock bag and dental floss.
In: Tutorials
6 Aug 2009If you use service like Twitter where you only get a limited number of characters to post or if you are just sick of dealing with unruly long urls you might be familliar with url shortening services such as Bit.ly.
I personally like them because of they offer a nice API and statistics all for free. It is a pretty quick service too. You can generate hundreds of URLs in just a few seconds. All you have to do is register and you get a username and API key which you will need in the following section.
Here is the code … As you can see I only implemented the shorten for now but I will probably add some of the other stuff later. For some reason WP won’t let me post curl_exec( so be sure to remove the extra character.
class bitly { /** * A PHP class to utilize the bitly API * through the Bitly API. Handles: * - Shorten * * Requires PHP5, CURL, JSON and a Bitly account http://bit.ly/ * * Bitly API documentation: http://code.google.com/p/bitly-api/wiki/ApiDocumentation */ protected $appkey; protected $login; protected $version; /** * Contruct the Bitly Class * * @param string, your Bitly account key * @param string, your Bitly account login */ public function __construct($login, $appkey, $version='2.0.1') { $this->login = $login; $this->appkey = $appkey; $this->version = $version; } /** * Retrieve a shortened URL * * @param string, url to shorten * @param string, version of Bitly to use */ public function shorten($url) { //create the URL $api_url = 'http://api.bit.ly/shorten?version='.$this->version.'&longUrl='.urlencode($url).'&format=xml&login='.$this->login.'&apiKey='.$this->appkey; //call the API $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $api_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_ex_ec($curl); curl_close($curl); //parse the XML response and return the url $xml_object = new SimpleXMLElement($response); return $xml_object->results->nodeKeyVal->shortUrl; } }
If you want to use this in CakePHP … you will want to do something like this.
Put this line before the class … I actually use this in a helper since this is a view level class
App::import('Vendor','Bitly', array("file" => "bitly/bitly.class.php"));
Now you can just invoke it in one of your functions somewhere with two simple calls!
$bitly = new Bitly('username', 'your_API_key_here'); $short_url = $bitly->shorten($long_url);
Simple as that … oh and one more thing. Be sure to have CURL installed else this won’t work.
In: Tutorials
23 Jul 2009MagpieRSS is a PHP based RSS parser that can be downloaded here http://magpierss.sourceforge.net/
What good is it you ask? You can use it to pull in information from any RSS feed and do what ever you want with the data. For example I use it to pull the RSS feed from my blog and display links to my latest posts on http://www.rewardchamp.com You can see it on the bottom of the page.
CakePHP makes this way to easy! First you need to download the MagpieRSS files from the link above and then extract to your vendors folder.
You need to put this line at the very top of your controller file you want to use RSS with. Before the class declaration
App::import('Vendor','Snoopy', array("file" => "magpierss/extlib/Snoopy.class.inc"));
Now inside a function you want create a new Snoopy object. I use Snoopy because I’m lazy … MagpieRSS is not constructed as Classes like CakePHP would like it to be … Snoopy is. Snoopy will return XML for you which you can make into an easily usable object with SimpleXMLElement. You can var_dump to see what exactly is in this object. You can figure out what to do from there.
$snoopy = new Snoopy(); $snoopy->fetch('http://www.solitechgmbh.com/your/feed/here'); $xml = new SimpleXMLElement($snoopy->results); return $xml->channel->item;
Something like this will get you the title for example.
echo $item->title;
Happy coding!
I am happy to announce that Forumvirus.com is no longer in our portfolio. It has found a new home with a web savvy investor. It has been a fun little project and I am happy it found a good new home.
We acquired Forumvirus.com about three years ago for $500.00 USD through an online auction site. It was an easy transfer, there wasn’t much to the website at the time. The transaction was completed quickly and we were excited to get workgin on the project.
We were looking to getting into the website flipping business and though jumping head first would be the best approach at the time. The market was hot and we didn’t want to miss out on it. In hind site, I think we paid too much for the website since there was little to no income that wasn’t due to the advertisement that the previous owner was running and there was no organic traffic. The design of the website needed some definite work also.
If you are looking for a good project, those flaws are actually exactly what you would looking for to buy. You want to have identified the flaws and have a strategy to fix them before you buy else your investment will most likely not be worth it in the end.
We have done a lot of SEO work on the site and over time we got into the top five position for forum directory related searches on Google. We have not done any advertisement short of some link building in the beginning. When we sold the site, all traffic was organic which is worth a lot since it is continuous and free. We have also updated the look of the website and made it more appealing and easier to use for visitors and forum owners looking to advertise.
Over all, it has been a fun project and it was fun to see it grow into a recognizned name on teh internet when it came to forum directories. I am happy it has found a good new home.
It has been a few years since we designed our first website for SoliTech and it has served us well. At the time, we were looking fro a sleek, clean design that we used to create an online presence with. It listed our services, current portfolio, gave our customers a way to contact us. It also had some entry ages to some of our services.
As time went on, we got pore web development and information technology consulting projects which was great for business but they never made it onto our website or they just did not get the exposure they deserved do to the static orientation of the website.
In today’s world, information is key and the web is a great way t distribute information. Our new websit would focus on just that. We chose to use somethign that looked more like an online blog then or static site. We want to open up channels of communication with our customers and potential customers. We want to offer new way of learning about our company and wha we are all about.
We present you the new SoliTech GmbH website which promises more insight into the company and opens up new way of communication and customer feedback. Please explore our website and leave us comments on what you think.
Old website screen shots:
Services such as Facebook, MySpace, LinkedIn, Twitter etc. are experiencing exponential growth. Your company needs to stay competitive and utilize this new technology. We will help you devise and execute a higly effective marketing strategy that will grow your brands' following and deliver measurable results.
Click here to see all our service.