Code Slinger

Computer hardware is great and I have lots of it as the owner of a computer company. However when you want that cold plastic composite and metal thingy to do something...you need code.

Code Projects
  • Code Projects in C++,C#,PHP,Java

    Code Projects in C++,C#,PHP,Java

  • Future Tech

    Future Tech

X-NLP

X-NLP

Extreme Natural Language Processing.
Read More
Data Bots

Data Bots

Internet Bots for Crawling, Scraping and Data Mining
Read More
Vid Automatic

Vid Automatic

Creating rich real time video products and streaming services.
Read More
VR Hacker

VR Hacker

The Hacking of Virtual Reality with the Oculus Rift.
Read More

Sharing FireFox Multiple User Profiles On Dropbox

DropBox FireFox

I love that FireFox allows you to have multiple user accounts using the user profile manager. If I need to login to one of my social profiles like Twitter as several different users at once I start up multiple instances of FireFox each using different profiles. However I find myself sometimes needing to login to these different profiles on different computers so the solution is to share their profiles through DropBox.

If you haven’t setup a shortcut for launching FireFox User Profiles see: Shortcut to Quick Launch FireFox User Profiles

Begin by closing all instances of FireFox.

Step 1 (Copy FireFox Folder to DropBox)

FireFox data and profiles are located in windows at: C:\Users\Master\AppData\Roaming\Mozilla\FireFox

Start by copying this directory to your DropBox. In this example we will assume your DropBox is at C:\DropBox

When done copying the folder should be in DropBox like so: C:\DropBox\FireFox

Step 2 (Rename original FireFox folder)

Rename your FireFox directory at C:\Users\Master\AppData\Roaming\Mozilla\FireFox to C:\Users\Master\AppData\Roaming\Mozilla\FireFoxBackup

Step 3 (Create Junction Link to DropBox location of FireFox)

1. If you aren’t already login to Windows 7 or 8 as an administrator
2. Goto \Windows\System32 and locate cmd.exe, right click on it and select “Run as administrator”
3. Change Directory to your FireFox location:
a. cd C:\Users\Master\AppData\Roaming\Mozilla
4. Make a junction for FireFox to the copied location on DropBox
a. Mklink /J FireFox C:\DropBox\Firefox

Test

Run FireFox as normal and make sure it works. Is it slow? Of course what did you expect.

Deploy across other computers

Now repeat Step 3 on all the other computers you want to share the same FF profiles with. You will need to install FireFox on those computers if you haven’t done so already.

Shortcut to Quick Launch FireFox User Profiles

ffx

FireFox allows you to run multiple User Profiles at once. This is great if you want to be logged into many social profile accounts at once, such as Google, Facebook, Twitter you name it. Usually you can only be logged into each of these one time. Even if you ran your browser multiple times you would still be forced to logout as one profile and login as another.
However with FireFox you can have multiple instances of the browser open and logged into different accounts all at the same time. By default this is not really the case, you need to create a shortcut to your FireFox program with some special tags to allow it to behave like this.
1. Start by right clicking on your windows desktop and selecting > New > Shortcut
2. When it asks you to type in the location of the item enter:

"C:\Mozilla Firefox\firefox.exe" -profilemanager -no-remote

Assuming FireFox is installed in C:\Mozilla FireFox (change as necessary.)
3. Hit next and enter the name for the shortcut.
Now launch FF and it should come up with the Choose User Profile manager.

XAMPP shared on DropBox and LAN

One DropBox to Rule them All

dropbox

DropBox and other Cloud drive services are great for getting your files from one machine to another. However the caveat is that every time you update a file in your DropBox then it has to resync with all the other computers across the Internet. This can be kind of slow and eats up your bandwidth.

If you have multiple computers on a local network you can share the DropBox folder.

Setup one computer to have your DropBox folder. Then share that folder on your network. In windows you can map the drive or even setup a full junction point.

Say you install a program directly to your DropBox folder and it requires a specific path to run. Mapping the drive or setting up shortcuts won’t fix the problem with launching the program properly on your other computers.

1. Login to Windows 7 or 8 as an administrator on the networked computer (not the one with dropbox)
2. Goto \Windows\System32 and locate cmd.exe, right click on it and select “Run as administrator”
3. In the command window enter:


C:\> mklink /J “C:\DropBox” “\\COMPUTERNAME\DropBox”

In the above example COMPUTERNAME is the name of the computer on the network that has DropBox installed at C:\DropBox and that folder is shared.
So now there is a Junction link on your other computer that will call DropBox and treat it and any programs on it as if it was running from the same location on the other machine.

Note: Just because you created a junction link sharing your program across the network doesn’t mean it will run in every instance, you may find you still need to install it on the other computer and give it the install path of the original through the junction link you created. Also keep in mind installing like this may make you loose data on the source system location so back it up first!

Symbolic Linking Directories on Windows

mklink

It is great to finally see a real effective symbolic link implemented as a standard option in the latest Windows 7 and up. If you have experience with unix or linux systems you may already know all about symbolic links. If not, a symbolic link is a way of telling the computers operating system that a file path points to a different location. This is useful when dealing with compatibility or access problems with programs such as unchangeable or default install locations of programs that are too problematic to actually reinstall in the new location or for some reason impossible to change. This method will help standardized file path conflicts.

When you create a symbolic link the “new folder” will point to the “source folder”. This will allow you to access files in the source folder through the new folder path and the computer will not try and correct it, it will believe the files actually are located through the new folder path, but in reality they will be affecting those in the original source folder.

1. Login to Windows 7 or 8 as an administrator
2. Goto \Windows\System32 and locate cmd.exe, right click on it and select “Run as administrator”
3. In the command window you will enter the command to create the symbolic link between the two directories like so.


C:\> mklink /D “C:\NEWFOLDER” “C:\SOURCEFOLDER”

Now if you open your computer folders and goto C: (or whatever location you did this at) you will see the folder C:\NEWFOLDER you will also notice a little arrow in the bottom left of the icon indicating this is a symbolic link (not to be mistaken by a shortcut).

Note on shortcuts: A shortcut will resolve to the source folder unlike symbolic links which resolve directly through the path of the symbolic link. So shortcuts don’t have the ability to correct path conflicts in most instances like this method will.

Mklink /D (symbolic link) vs /J (junction)

In the above example we used /D to make a symbolic link, however it must be noted that a symbolic link for a directory only works if the new folder and source folder exist on the same partition. If you want to make a symbolic link across partitions, drives, shared network drives-then you must a junkction. Simply replace the option /D to /J in the example above.

Oculus Rift Virtual Lap Dances

Duke and I went out on the town the other night bringing a fat wad a lot of bucks for the girlies.

Here is an moment in the life of game history now available in virtual reality for the Oculus Rift.

Oculus Rift Now Plays Most Popular PC Game in the World

I have spent long days and nights the last few months to add VR support to the worlds most famous PC game and here are the final results.

If your taste for great games in VR hasn’t been satisfied yet watch the new port for Mine Sweeper..OOOH YA!

View my new YouTube Channel @ http://www.youtube.com/user/codesslinger

WordPress.com Post By Email with Images (PHP)

wordpress_smash

In an earlier blog I showed how one can use a simple PHP script to send blog posts to blogger via email. The same thing can also be done to other blogs such as wordpress.com. When I say WordPress.com I mean the hosted site not the self hosted WordPress offered by wordpress.org (I will address self hosted WP sites in a future blog.)

Here are the steps to turn on Post By Email for WordPress.com blogs.

1. From the main account area: At the top of your wordpress.com login click “My Blogs” then under the blog listing “Blog Admin”, this will put you in the blogs dashboard
2. From the dashboard: On the left side menu, mouse over “Settings” on the sub menu select “Writing”. At the bottom of the Writing Settings page there is a section called “Post by Email” Click on the “My Blogs” link.
3. There should now be a list of all your blogs, in a table, one of the columns is called “Post by Email” and there is a button to push called “Enable” push it and it will generate a secret email that you can use to post blogs via emails to. Write this down we will use it in the code below.

When you send an email to this secret email address it will post the contents of the email to the blog and the subject of the email will become the title of the article. If you include an image as an attachment then the image will also be included in the blog and hosted on wordpress.com’s server.
However there is an issue at this time with such image attachments, the image is posted following the blog article contents, not at the top. In the forums the developers state they are looking into a fixing this issue but I don’t think it is a priority for them.

Another issue regards HTML content. Not all HTML tags and formatting will make as wordpress.com strips some out. Currently I have no list of what is and isn’t passed through but form and javascript tags are stripped.

I should also note that Post By Email for wordpress.com includes some extra custom tagging options. These options include:

• [category x,y,z]
• [excerpt]some excerpt[/excerpt]
• [tags x,y,z]
• [delay +1 hour]
• [comments on | off]
• [status publish | pending | draft | private]
• [password secret-password]
• [slug some-url-name]
• [title Your post title]
• [end] – everything after this shortcode is ignored (i.e. signatures). Make sure it’s on its own line with a blank line above it.
• [slideshow] – replaces the auto-gallery with a slideshow
• [nogallery] – disables the auto-gallery and displays all images inline
• [more] – more tag
• [nextpage] – pagination
• [geotag on | off] – override your geotagging privacy defaults to enable or disable the showing of geo information
• [publicize off|twitter|facebook] – change Publicize options
• [poll]question and answers[/poll] – insert a Polldaddy poll into your post

For details on how these tags operate you can read the documentation page on the wordpress.com site here: http://en.support.wordpress.com/post-by-email/

Now for the PHP code. I recommend using the PHPMAILER class and using a gmail account for the sender, this seems to be the most stable way of performing the email posts.

include('class.phpmailer.php');

$gmail_your_name = "YOUR NAME";
$gmail_username = "YOUR GMAIL USERNAME";
$gmail_password = "YOUR GMAIL PASSWORD";
$gmail_email = "YOUR GMAIL EMAIL ADDRESS";
$wordpress_email = "YOUR WORDPRESS SECRET EMAIL";
$wordpress_url = "YOUR WORDPRESS.COM BLOG URL";
$image_location = 'C:/YOUR LOCATION OF IMAGE/IMAGE.JPG';
$email_title = "EMAIL TITLE";
$email_body = "EMAIL BODY"; // (LIMITED) HTML OK

$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->IsSMTP();
$mail->;SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = $gmail_username;
$mail->Password = $gmail_password;
$fromname = $gmail_your_name;

$To = trim($wordpress_email,"\r\n");

$mail->AddAttachment($image_location);
$mail->From = $gmail_email;
$mail->FromName = $fromname;
$mail->Subject = $email_title;
$mail->Body = $email_body;
$mail->AddAddress($To);
$mail->set('X-Priority', '3'); //Priority 1 = High, 3 = Normal, 5 = low
$mail->Send();

If you are wanting to capture the URL for the newly posted blog after it has been made you can use the following.

sleep(15); // give it enough time to receive and update the post (15 seconds)
$bf = file_get_contents(rtrim($d2s[html_code],'/').'/feed/');
list($t,$b1) = explode("<item>",$bf,2);
list($t,$b2) = explode('<link>',$b1,2);
list($b3,$t) = explode('<',$b2,2);
$bb = trim(str_replace('"','',$b3));
$bb = trim(str_replace("'",'',$bb));
$bb = trim(str_replace(' ','',$bb));
echo '<li>LINK IS='.$bb;

Stop Giving Your Affiliate Link Juice

broken-link

It is no wonder that Amazon and other giant shopping sites that offer affiliate programs rank highest on search engines like Google. The associate that use the affiliate programs are helping drive those stores link popularity up by using the standard links which in turn hurts their own affiliate marketing strategies. There are easy ways you can implement linking to prevent sabotaging your own SEO.

The Problem

When you create a link that points to a product or the associated program for commission referrals, the search engines follow that link even if it is redirected by a 301 or other means. Even if you try and use Google’s “nofollow” rules the link is still observed as a pointer from your site to theirs. Even using a jump gate and robot.txt rules the search engines will still observe the outgoing link to the destination. When you have thousands of other associates using their own links to point to that same product then OF COURSE that drives the authority of the affiliate programs own page to the top of the search engine listings.

Then of course customers are not going to drill down several pages deep in search engine results to click on your link. That is if you get listed on the search engines at all with such tactics. It is counterintuitive to use such direct links for any type of reseller campaign.

The Solution

First you need to stop using the original manufacturer information supplied by the affiliate program for your affiliate link pages. When search engines see the exact same content on a thousand different pages then you will get very little traction if any. I will cover “content mutation” in a future article.

Addressing the problem with links and link juice pouring out of you page to the affiliate program you must eliminate the ability of the search engine to recognize and follow the actual link while not blocking your own web traffic from channeling through the link.

There are several different approaches that can be used, AJAX, Javascript, CSS Dom to name a few but the easiest is to simply use a POST form. Currently search engines such as Google do not try and press on form buttons and follow them, they are completely ignored, except in the case of simple action GET forms.

<form action="http://MY AFFILIATE LINK" method="POST">
<input type="submit" value="BUY NOW" />
</form>

This is not totally ideal as the link can still be picked up from the action tag, however not all affiliates will have the ability to add a jump gate, but it is better than nothing, it won’t be considered a hole in your page for link juice.

This is not totally ideal as the link can still be picked up from the action tag, however not all affiliates will have the ability to add a jump gate, but it is better than nothing, it won’t be considered a hole in your page for link juice.

A better solution is to use a simple jump gate that masks the URL, such as something like this.

<form action="jump.php" method="POST">
<input type="hidden" name="id" value="<?php echo base64_encode(http://MY AFFILIATE LINK); ?>" />
<input type="submit" value="BUY NOW" />
</form>

jump.php

<?php
header('Location: '.base64_decode($_REQUEST[id]));
exit;
?>

NSA Metadata

dreamstime_2470101

What exactly is metadata? Well it is data.

With the current Edward Snowden leak of the NSA projects the media has been slinging some terms around lately such as metadata. That the NSA is only collecting the metadata of phone conversations and emails. What they are implying is that a recorded phone conversation is the “data” and that the phone number that the calling and receiving phone numbers are the “metadata”.
The phone numbers are themselves data, we refer to metadata when a piece of associated data can be used to cross-reference or look up the associated data. So if you want to retrieve the full phone conversation and other related data using the phone number, the phone number in essence becomes a piece of meta data. Yet metadata is not some obscure index key or random file number, it is actually data for the purpose of looking up the rest of the data.

Here is where we start to see through the smoke and mirrors the government wants to throw at us with this terminology and I fear that the media truly is ignorant on. If any piece of data can be meta data, then the conversation itself is also metadata because algorithms can, and are, used for detecting keywords in the conversation. So there you have it, EVERYTHING, including the entire phone conversation, the entire email is all meta data.

So don’t be fooled by this crazy double talk about “we are only collecting metadata”, it means they are collecting ALL OF IT.

Cyberspace is Near

johnny-mnemonic2

Over two decades ago William Gibson coined the phrase cyberspace. Most consider that term today to mean the Internet and online games. However that is not actually as Gibson described it. Cyberspace is more of a virtual landscape that corresponds in relationship to that of the physical world. So if you are sitting at home and want to go check out your bank account you put on your VR and walk or fly down the street in cyberspace to the location of your bank to access your account, you of course physically are still at home.

Of course the actual Internet is a lot of more convenient when it comes to say banking then the one envisioned by Gibson, but it doesn’t mean his vision was wrong. The vision of Cyberspace was to emerge in the early to mid 2010’s, that is now and guess what, that technology is actually emerging today. So Gibson may have been fully correct in his futuristic predictions.

0wyjn1xhufomfxoce6rm

Why would we want this style of Cyberspace? It is all about the new technologies of Augmented Reality (AR). Now with GPS, WiFi, Google Glasses and other technologies such as VR to AR with the Oculus Rift, augmented reality is about to become the next big thing–depending on market demands.

The other key factor that will shape Cyberspace in the next few years in the flood of cheap micro computing. Tiny computers with built in wifi/RF and location that are very cheap that can be put into the wild. Store owners can install several of such devices in their store that will signal specials and where things are to customers as they move through the store using AR devices.
Even cheaper alternatives can be applied as well to go with AR that include QR codes and other types of even invisible to the necked eye watermarks on signs and billboards that only the AR devices can pick up but signal the device to show holographic images, movies, play sound tracks and all kinds of things including interactive games.

Going back to the banking idea above, we can imagine when we walk into our bank we are instantly and securely connected to the banks cyberspace and you maybe greeted with a virtual teller or someone in loans, not that you may even need to goto the bank, just like with the Internet you can goto the banks cyberspace without actually being there but your presence would be recognized as you were there for talking with a real in house agent for say getting a bank loan.

You and your significant other want to dine out tonight on the top of the Eifel tower without leaving the home. Cook up a good meal, set down and throw on your cyberspace devices and your experiencing dinner on the Eifel tower in real time.

Reality is soon to change, Cyberpsace is near.