Ramblings
I’ve recently been learning how to use perl regular expressions, and while I am by no means an expert - more likely a rank amateur at this point - I did stumble across a really useful cheat sheet for perl regular expressions, just follow the link to download the handy pdf.
Largely I have found regular expressions useful when I’ve been parsing large amounts of data and extracting meaning from it, i.e. giving order to non-structured data.
For instance, I’ve recently been parsing a feed of data from an affiliate network, picking out the products that are relevant to our website, then using my script to determine what category and weight a particular product is from the non-structured descriptive data that is supplied in the feed.
This has been useful, as it has allowed me to add thousands of products to a database in a really short period of time, much quicker than if I had personally had to go through each record from the feed and manually add the data to our database.
Instead, I’ve been able to simply use the script to parse the data, add it to a temporary table in the database, which feeds into a “sanity checking” workflow, whereby I can simply accept/reject or alter the data, thus saving me days of data entry.
I announced it a few weeks ago, but today we have actually finished the website, Discount Supplements Guide is up and running and ready to start comparing prices for all those fitness fanatics and bodybuilders who are searching for ways to save money during the economic downturn.
We have built the UK’s first dedicated price comparison search engine for nutritional supplements. Currently there are only five or six suppliers on the website, but during the course of the next few weeks we will be adding more suppliers.
In case you’re wondering “Is this just for bodybuilders and fitness fanatics?” then the answer is a resounding “No!”. This website will trawl the web for all kinds of nutritional supplements, regardless of whether they are sports related, health related, age related, gender related - it really doesn’t matter.
By the time we (that’s me and my brother - the guys that built it!) have finished adding all the suppliers, we expect to have covered all areas of nutritional supplements and uncovered all the suppliers available, thus making finding the right supplements at the best price as easy as possible!
I’ve been a busy bee this week, done lots of new posts on my fitness blog, mainly because I’ve been feeling creative, but also because I’ve been spurred on by seeing my traffic double in the last few weeks!
I’m now doing more than 100 unique visitors everyday on my fitness blog, still not enough to start making any serious money from, but the general trend is upward, with steady month-on-month growth.
My latest article has been written just to provide a taste of the benefits of bodybuilding and is entitled lift weights to lose weight, fairly self-evident what the article is about, but amazing how so few people still don’t understand this simple truth.
In addition to being busy on my fitness blog, I’ve also been busy putting together a new internet business, discount supplements guide, which although not finished yet, will be a website full of lots of information about different sports supplements.
This is something that I have to do on a fairly regular basis, and I always have to look it up in a book or something to remember how to do it, as such I figured there would probably be other people who keep doing the same, here’s how to do it:
- mysql -h(host) -u(username) -p(password) (database) < (data_file)
You don’t need the brackets (), they are just there to delimit the variables that need to be replaced. The datafile should be a .sql file, and I’ve found that sometimes, depending on the setup, you don’t always need to specify the host, in cases like this just remove the -h(host) and run the rest of it.
I have recently been the victim of content theft on my bodybuilding and fitness blog, where some unscrupulous website owner stole the content of this article high intensity hill sprint interval training session and posted it on their own blog, as if it were their own content.
At first I was furious at this because their page was ranking in Google before my page was, despite my page being the original content. It turns out however that this is fairly commonplace and happens to lots of bloggers.
I decided that I wasn’t going to stand for it and that I should do something about it. First port of call was Google, to flag it up as duplicate content. To do this, go to https://www.google.com/webmasters/tools/spamreport?hl=en and report it. You will need to put in offending URL, then the search that you entered into Google to find the duplicate content (spam) and lastly the Google results page that it brings up. There are a bunch of check-boxes, select “Duplicate site or pages”, then there is a free text box to add in your own words about the problem.
After you’ve submitted the spam request to Google, it’s worthwhile trying to defend against this happening in the future by making some amendments to your WordPress installation. Sorry if you are using other bloggin software, but I have no experience of them so can’t help.
To add a copyright notice and related posts to your feed, download the Copyright Feed plugin from WordPress, install it on your blog, then activate it via the Plugins tab.
Once activated, you will need to go to Settings tab and click on the ©Feed tab to amend the settings. I have added a digital fingerprint to mine. To do this, I just did an MD5 hash of a phrase that is dear to my heart, and I’ve kept a copy of this phrase on my dev server. This means that if I do a search on Google for my digital fingerprint, I should find any offending content thieves - assuming they haven’t removed the digital fingerprint from the content they steal!
I’ve recently added some links on my other blog that I wanted to ensure the paths were not clear to anyone viewing the blog. You may need to do this on your WordPress blog also, so if so, here’s how you do it:
- Create a directory to store all your external redirect links in. I chose “Go”, but you could call it “Redirect” or “External”.
- Add a file to this directory, which is simply a php file that contains all the info about your external links. My file is called merchant.php, because I have links out to various merchants from my file.
- In your redirect file, you will need to have an array of the various different url’s that you want to link to. If you have distinct groups of websites taht you wish to link to, it’s best to have more than one array. Your arrays should be set up so that you have a key and a val, for example: array(key1=>val1, key2 => val2)
- If you are using more than one array, you will need to pass the array and the key of the url to your redirect script. I used the variable names $a for the array and $n for the number of the key.
- If you have more than one array, you will need a switch statement, to ensure that you pull the correct url from the correct array, here’s an example of how to do this:
- You will need to acquire the variables $a and $n from the query string, like this:
- To use this in a post or a page, you’ll need to make your links like this:
- Upload and test to make sure it works!
switch ($a)
{
case “array_1″:
$url = $array_1[$n];
header (”Location: $url”);
exit;
case “array_2″:
$url = $array_2[$n];
header (”Location: $url”);
exit;}
$a = $_GET['a'];
$n = $_GET['n'];
<a href=”<?php echo get_bloginfo(’url’); ?>/go/redirect.php?a=array_1&n=1″>Link to redirect urk</a>
I’ve been busy today adding some really useful content to my body building blog about body building nutrition.
I’d been having a week off from weight training, and in fact decent nutrition, taking the time to let my body re-cuperate after having gone fourteen straight weeks training and eating right.
During this time off, I’ve been reading a really good book about nutrition by Anita Bean, called Sports Nutrition. From reading this book, I realised some of my nutrition habits were slightly outdated, and so I’ve written up my findings in these two new posts.
The first post is all about your resting metabolic rate, which is vital to know if you are going to have any success in either weight loss or weight gain. If you have ever wondered - what is my resting metabolic rate - read the article to find out.
The second post is all about correct nutrition for gaining muscle, something that I am keen to understand as best as I can, so that my weight training yields good results. In my mind there’s nothing worse than working hard at your fitness or physique and only seeing marginal results, you have to have the patience of a saint to continue only seeing slow results.
For my money, you’re far better off maximising your results by ensuring you give yourself the best possible platform from which to work from, and in body building this means training hard and eating right. If you want to gain muscle fast by eating right, then this article will provide you with lots of useful information about how to calculate the amount of protein and carbohydrates are needed to stimulate fast muscle growth.
I’ve added a new article to my bodybuilding and fitness blog about body building techniques that work. I’ve been experimenting with the heavy duty techniques most notably pioneered by Mike Mentzer in the 1970’s during my workouts over the past few weeks and have noticed a sizeable increase in the muscles during this period.
My article is just aimed at giving out some useful advice to novice bodybuilders who want to know how to get results fast. I know there is no short cut with body building, but there’s no point in pursuing a strategy that is going to take longer than you may have patience for before seeing any results.
I’ve added a new article to Find Financial Freedom, my financial blog. This new article is a quick synopsis of the various measures that can be taken to protect one’s financial security.
The article is entitled how to protect your financial security and draws on my training and experience of working in the financial services industry for two years as a mortgage broker.
From what I can see there doesn’t seem to be a lot of free advice about what products can be bought to protect your financial security and the financial services watchdog, the Financial Services Authority don’t seem to want anyone to have an opinion on this unless they have been authorised and regulated by them.
I wrote a new article for my financial blog about how to achieve financial freedom the other day. The article is inspired by a book I’m currently reading “The Millionaire Next Door”, which is a breakdown of some of the myths about the wealthy.
What’s struck me most from reading this book is that from the research the authors have done into American millionaires, is that most of the millionaires surveyed live very down to earth, mundane lives. The people that actually live like how we perceive millionaires are usually not millionaires, but have high incomes which get spent on items that make them feel successful, such as flash cars, flash houses (and flash consumer durables for their houses), boats, expensive clothes, watches and exotic holidays.
This has changed my outlook on things greatly. I can also see how I used to think is clearly not condusive to obtaining financial security or freedom for that matter. I used to be obsessed with building up a successful business that would allow me to have a high income, but the only reason I wanted this was because I wanted to be able to spend lots of money. I can now see that I’m far better off building a successful business, but keeping my income relatively low, and using the excess profits to invest rather than worry about wanting a nice car or a nice house.
Maybe some people get this concept very early on in their lives, unfortunately for me it’s taken the best part of thirty years to figure this out, and not without the help of various books that I’ve read, including the Rich Dad, Poor Dad series amongst others. With a bit of luck, the next time we have a recession, I’ll be better placed to deal with it, having put into practice what I’ve learnt from my readings.
