How To Set Google SSL Search as Your Default Search Engine in Chrome OS

Earlier today I was at Which Wich with my Cr-48, but using Freebird’s WiFi. I didn’t have a problem with browsing the web, because most of my stuff was through Google Services and was over SSL. Everything except Search itself.

I started poking around to see what happens if you force https on a Google Search, and it turns out you’re redirected to:

https://encrypted.google.com

Then I wondered how to make this my default search engine without the use of plugins. It turns out it’s very simple.

  1. Do a Google Search using the above URL, and you’ll notice the basic format is: https://encrypted.google.com/search?<insert-a-bunch-of-parameters>&q=<query>. We are just interested in the bolded part of that fake URL: https://encrypted.google.com/search?q=<query>
  2. In Chrome OS, click the Wrench menu, click Options, then go to Basics and find the Search section. Click on Manage search engines… button.
  3. You’ll get a window with all the Search Engines that your Chrome OS knows about. At the bottom of the “Other search engines” list, you’ll see a row for adding a new search engine.
    1. In “Add a new search engine“, put something like: Google SSL
    2. In “Keyword“, put something like: encrypted.google.com
    3. In “URL with %s in place of query“, put the URL we made from above: https://encrypted.google.com/search?q=%s
    4. Hit Enter.
  4. Hover over the newly created search engine entry, and click Make Default when the button appears over the URL column.
  5. Then try out a new search in the Omnibox and it should be SSL’d through Google’s SSL Beta search service.
That’s all there is to it. You can add more search parameters if you like via this site that documents a lot of them. Also, you can (and should) perform the same steps on your desktop version of Chrome Browser as well. Sorry I don’t have any screenshots of it actually in action on Chrome OS – I haven’t found a decent screenshot tool that lets me capture the UI of Chrome outside of the web pages.

Technorati Tags: , , , , , , , , ,

Using Friend Lists for Facebook Privacy

Facebook Security Logo - Source: allfacebook.comIn my previous post, I walked you through setting up your Facebook application security settings to prevent apps from taking your personal information, using it how ever they wanted, and even impersonating you on Facebook. Properly configured application setting will help prevent leaking your personal information behind the scenes, and properly configured Facebook profile security settings helps prevent it from being leaked to the public at large. But sometimes, there are certain things that certain people should not be allowed to see. Maybe you have some co-workers on your friend list, and you like to complain about work in your status updates; maybe you have a creepy ex and don’t want him/her or any of their friends to see any pictures of your new love interest; maybe you have an estranged family member you don’t wish to talk to any more, but not adding them as a friend would bring nothing but turmoil to family gatherings. There’s a way to segregate out those people and limit which services they have access to. It’s called Friend Lists.

Setting up a Friend Lists

Account > Edit Friends

First thing you need to do is get on the Edit Friends page by clicking on the Account menu in the top-right corner of the Facebook site, and then on Edit Friends.

Once there, on the left-hand side you may notice a list of menu items: Friends, Phonebook, Find Friends, Invite Friends. Right in the middle of that list is where your Friends Lists will appear…like the one for the-spot.net in this image.

When we’re all done setting them up, you could have a list similar to my actual Friends Lists in the image below. I’ve segregated all of my friends into various lists describing where I first met them or my relationship to me. I have avoided putting people in more than 1 list. If they are in more than one list, and you restrict one of those lists, the results of the restrictions could behave unexpectedly.

Creating a Friend List

In the middle of the page, you’ll find a list of all your friends (probably defaulted to “Recently Interacted”). Just above it you’ll find a drop-down menu to filter the friends based on certain criteria (all, by city, recently interacted, and lists). There’s also a dynamic filter search box – as you start typing a name in it, your friends list is automatically reduced to the names that fit what you’ve typed. Above those is the Create List button.

  1. Click the “+ Create a List” button.
  2. Type a name in the Enter a name box.
  3. Start selecting friends. Each one you click will turn blue. You can also type a name in the box to do a quick filter to find a particular friend.
  4. Click Create List.

In my example, I’ve created a list called “Fans of tsn.”

Do this for as many different types of segregation you want amongst your groups of friends. If you’ve forgotten someone while searching through your lengthy friends list, you can hover over them and click the Edit Lists button, and then add them right there (as in the image below). You will also be able to add people to your lists when you’re responding to or requesting Friend Invitations.

Using Friend Lists as Privacy Settings

Once you’re done and you’ve got your lists, let’s put them to work on your privacy. Go to your Account > Privacy Settings page, and then click on the Customize Settings link below the Sharing on Facebook section.

On the Customize Settings page you’re presented with drop-down menus for the features list that we set to Friends Only when we configured your Facebook Profile Privacy Settings, as well as some things that others share related to you, and your contact information.

To make use of your new Lists, click the drop-down menu for the feature, and choose Customize. We’ll do Status Updates and Posts, for example.

This will give you a popup window with two options:

  1. Who, in the world, should this be visible to…
  2. Within that group of people, who should not be able to see it.

You might also see something like the image below, asking you about your Networks as well…

That goes back to the original intention of privacy. We only want our friends, not people who live in the same town, or go to the same school…leave them unchecked.

In the blocking area, you can use the Lists you’ve made, or individual friends from your global friends list…just start typing the name of the list or friend, and choose from the dynamic drop-down.

One example for this type of setup would be “Friends Only” can see my status updates, unless they are also on my CoWorkers List. Another would be “Friends Only”, except for your ex, Blake Smith.

Do this for all the ones you wish to hide from certain people. If you find yourself blocking the same group in every single feature, you might as well unfriend everyone in that group, and if they ask about it, and let the chips fall where they may. Most people won’t bring it back up, or even notice, unless they are constantly checking your profile – which is creepy anyway.

When you’re done, your feature menu will look something like this:

You can also use these lists to edit your Photo Albums’ Privacy as well, by clicking the Edit Album Privacy for existing photos link at the bottom of the page…

Once there, you’ll see a list of all your photo albums, and a similar drop-down menu as the features. Just click on it, choose Customize, and change the visibility settings.

Completed Configuration Example

Below is my entire configuration on my personal account. I have a Work list with all my coworkers on it, and I have blocked them from seeing anything that I post on Facebook as a status update. They have access to things like these blog posts through Facebook Pages I’ve created for my instructional websites. But my personal updates and thoughts are only broadcast to my friends. If the time comes that I change jobs, I’ll swap all of my coworkers out to my DFW (new skool) list and put my new coworkers into the list. If I start having problems with some people not currently blocked, I just create a new list and block them…but that hasn’t happened to me personally.

 

Conclusion of Facebook Friend Lists

Now that you’ve learned how to segment your friend lists into groups, and assign those groups permissions or restrictions, there shouldn’t be a time when you think to yourself “man I wish I could block that person from seeing stuff about me, without unfriending them.” Keep in mind, though, the reality of the internet: nothing is private. There’s nothing to stop the one person who is blocked from going over to a mutual friends’ house and still seeing what was previously blocked from them. If you find yourself posting something that would be devastating for them to see, you probably shouldn’t post it online. If you think you have mutual friends or connections to any of the blocked person’s friends/family members, then you should either block them all, unfriend them, or just not post the material online.

In my case, I have blocked my coworkers and non-friends from easily seeing my updates on Facebook, but those same updates are available elsewhere online. The reason the coworkers are blocked is less about the content and more about the frequency and that I don’t sit on Facebook all day, but rather I syndicate my updates from Twitter. If they found the updates, it wouldn’t be that big a deal for them to read; it’s more of an image thing.

If you’re posting things online that could hurt your image (photos with red SOLO cups, alcoholic beverages, profanity, obscene language, bitching & moaning about individuals), and want to hide that, you probably shouldn’t post it online, due to the content. But if you’re posting photos of your family or things, and are trying to block people to avoid harassment, that is an acceptable use.

The next post I’ll cover how to tell if some Facebook application or link or post is a scam or phishing attack, what those phrases mean, and how to protect yourself.

Technorati Tags: , , , , , , , , , , , , , , ,

How to Connect to SQL through Windows Authenticated ODBC in PHP

For about the last year, I’ve been creating a CMS (content management system), for the automatic management and maintenance of my company’s eCommerce site, on the Yahoo! Store platform. The software imports the entire store automatically, runs a series of cleanup processes with about a dozen different criteria, saves the changes it has made, exports the modified pages, and makes them available to download from Jada’s interface. This automation cuts the need for about 3-4 people doing a weeks’ worth of work, and does it all automatically in 10-30 minutes. The one thing it doesn’t do, is the one cleanup process that takes the longest, and requires the most human thought: comparing every product’s available options on the site, and checking them against actual inventory in the order management software.

Until now.

Our current order management software runs as a MS Access front-end to a MSSQL 2005 server backend through and ODBC DSN connection. This connection has been limited to MS Access and MS Excel application/queries, and thus, was the limiting factor to writing this most-complex cleanup process into Jada. The most difficult part in my development was finding an understandable article describing how to make an ODBC call, and then actually get the data back, in the same simple manner that one makes a MySQL query. The real issue has been once the connection is closed, the result cannot be accessed. I had to find that out the hardway, via Microsoft’s convoluted documentation on using ODBC.

Here’s the code I’ve used to make the ODBC connection in PHP (unfortunately my blog’s template can’t handle actual code right now):

Code Breakdown

We’ll start creating a function that makes an ODBC connection, passes it an SQL query, then parses the data into a table/array and return the array.

Function call

function odbcQuery($sql, $attempt="") {

When we call the function, we’ll provide the SQL Query we want executed, and an optional description of what we’re trying to do with the query. In this way, if it errors, an semantic error will be displayed along with the technical one to help locate the code easily.

Database Connection

// Establish an odbc connection with the database
$link = odbc_connect("My_DSN_Name", "", "");

When running odbc_connect() it takes 3 parameters:

  • the DSN; Server,Port; or Server/SQLInstance
  • username
  • password

When connecting using Windows Authentication & a DSN (as this example is about), there are some caveats and things to remember:

  1. On the web server, the User running the Web Service process needs to be a User with permission to access the SQL Server.
    1. In my case, the user running the web server is SYSTEM, and so the user trying to access the SQL server is “DOMAIN\COMPUTERNAME$“.
    2. There is no password for a SYSTEM account, and so on the SQL Server needs to have a user created named “DOMAIN\COMPUTERNAME$“.
    3. Due to some security concerns, I’ve decided to give the account read-only access to the database I want to access. You’ll need to consult your own IT Administrator or security advisor for your security concerns.
  2. In the odbc_connect() statement, you then only need the name of the DSN (which I assume has already been configured on the Web Server you’re using) , followed by two null-quotes: “”.

This creates an active link via ODBC to the SQL Server…supposedly

Database Connection Checking & Error Handling

if (!$link) {
	die('Could not connect: '.odbc_error().': '.odbc_errormsg());
} else {

Next, we check the link . If it just flat-out doesn’t exist, then we kill the program, throw an error message that will read: “Could not connect: <;insert odbc error code>;: <;insert odbc error text>;”. Otherwise, we move on…

Sending the SQL Query & Checking Response

$data = odbc_exec($link, $sql);
if($data === false) {
	echo "ODBC Query: ".$sql."

"; die("ODBC Query failed: ".$attempt."
Error: ".odbc_error()); } else {

Now that we have a valid link to the database, we’ll send a request for data using the odbc_exec() function. This function sends the connection resource ($link) and the SQL Query we want run ($sql). It will return a “ODBC result identifier” or false.

Since a result identifier could, I assume, be the number 0 (zero) I want to ensure that $data is actually false and not just zero. That’s where the triple === comes in. When doing conditional statements, using == will convert the data being compared into a true/false value, where zero or nothing = false and anything else = true. When you use === you test for an actual boolean value, meaning anything including zero = true and false = false.

If the query failed, and resulted in a false result, we’ll display an error message: “ODBC Query: <;insert actual SQL Query>; // ODBC Query failed: <;insert query description>; // Error: <;insert ODBC error code>;”. Otherwise, we’ll move on…

Parsing the Query Results – Column Headers

// Initialization
$row = $fields = $records = $result = array(); 	

// Get the result's column names
$count = odbc_num_fields($data);
for($x=1;$x<=$count;$x++) {
	$fields[] = odbc_field_name($data, $x);
}

We start off by initializing all the variables we're going to use in the next bit of code, to make sure they're empty.

Then we'll run odbc_num_fields() over the $data to get the number of columns we need to iterate through. For columns, the counting starts at 1, so the for-loop starts at 1.

Iterate through each column name and add it to an array, called $fields:

Array (
	[0] => field_name_1
	[1] => field_name_2
	[2] => field_name_3
)

Parsing the Query Results - Records

// Get the result's data: array[record#][column#] = value
$count = odbc_num_rows($data);
for($x=0;$x<$count;$x++) {
	odbc_fetch_into($data, $row, $x);
	array_push($records,$row);
}

Then we run odbc_num_rows() over the $data to get the number of rows we need to iterate through. For rows, the counting starts at 0, so the for-loop starts at 0.

Iterate through each record row and insert it to a temporary array $row using odbc_fetch_into(). Then take $row and put it into an array of records, $records giving you something like this:

Array (
	[0] =>; Array (
		[0] =>; record_1_column_1
		[1] =>; record_1_column_2
		[2] =>; record_1_column_3
	)
	[1] =>; Array (
		[0] =>; record_2_column_1
 		[1] =>; record_2_column_2
 		[2] =>; record_2_column_3
  	)
	[2] =>; Array (
 		[0] =>; record_3_column_1
 		[1] =>; record_3_column_2
 		[2] =>; record_3_column_3
  	)
 )

Making the data useable

Now that we've got two tables/arrays of data - the field/column names, and each record's array of data - it's time to make it usable in a format that we can consistently expect to be returned. There are two ways to do this. We can create an array listind every record as an array with column_name keys and values

// Return data in the format: array[record_id][column_name] = value
foreach($records as $rid =>; $record) {
	foreach($fields as $key =>; $name) {
		$result[$rid][$name] = $record[$key];
	}
}

or we can list every column as an array of record id's as keys and values.

// Return the data in the format: array[column_name][record_id] = value
foreach($fields as $key =>; $name) {
	foreach($records as $record) {
		$result[$name][] = $record[$key];
	}
}

Personally I find the first option to be more consistent with my results when calling a 2-dimensional result from MySQL queries, so it is the one I have gone with in my example at the start of the post, and in this description.

The foreach() statements describe a compilation of a $result array in this manner:

  1. For each item in the $records array, store the record_id as $rid, and the record array as $record.
  2. Then for each item in the $fields array, store its cardinality as $key and it's value/name as $name.
  3. Then compile an array, iterating through each of the fields, storing this $record's associated cardinality $key's value into the $result array's storage for this record's id ($rid) under the appropriate field name.

It's a lot easier to grasp than it sounds. Basically, take array from the Query Results - Records section, and replace the # with the column name in each: [#] =>; record_y_column_x, but store it as a different array, called $results. The resulting array would look something like this:

Array (
	[0] =>; Array (
		[column1] =>; record_1_column_1_data
		[column2] =>; record_1_column_2_data
		[column3] =>; record_1_column_3_data
	)
	[1] =>; Array (
		[column1] =>; record_2_column_1_data
 		[column2] =>; record_2_column_2_data
 		[column3] =>; record_2_column_3_data
  	)
	[2] =>; Array (
 		[column1] =>; record_3_column_1_data
 		[column2] =>; record_3_column_2_data
 		[column3] =>; record_3_column_3_data
  	)
 )

Close the connection, Return the result

		odbc_close($link);
		return $result;
	}
}

Now that we've stored the data we need from the volatile $data variable returned from the SQL Query into $result, we can close the connection to $link using odbc_close(), and then return $result for the program to do with it what it will.

Conclusion

This is just an example code that explains one way of many to extract a variable 1-2 dimension array of data from your SQL Query, using a Windows-Authenticated ODBC DSN connection. There are many other methods to do this, as well as security fixes, data scrubbing, and other modifications that one would probably want to do.

This is the first function I've written in any language to access an SQL Server via ODBC. This is also a function that has worked in tests, but that I have not yet put into production. I encourage you to take this bit of explanation and massage it into something that fits your needs in the code that you're writing, and don't rely on what I've got here as a written-in-stone example of good production-level code. This sample will change many times before I actually implement it.

Happy Hacking!

Technorati Tags: , , , , , , , , , , , ,

Configuring your Facebook Application Security Settings

Facebook Security Logo - Source: allfacebook.comAfter you have properly configured your Facebook profile privacy settings, the next hole to plug is one that most people forget about: Facebook Applications. If you’re not careful, you could easily wind up giving away permission to all your personal information on Facebook, or even your username and password itself. We’re going to put a stop to that, right now.

Configuring Facebook Application Security

One of the lures of Facebook that attracted people away from MySpace (aside from the lack of smiley ads and whoring out of everyone who ever picked up a musical instrument) is the applications. Whether you realize it or not, applications first appeared on Facebook around 2006, but didn’t take off until 2007. And if you didn’t realize it has been that long, then chances are you don’t realize you may have residual applications still sucking down your personal information. You may also be unaware that the application you just installed to “see how many people viewed your Facebook profile” or “see what my first status update was” or any of the “OMG you have to click this link to see [insert something outrageous]” were actually scams. Now it’s time to clean up all that crap you’ve installed on your Facebook profile.

Privacy Settings > Application Security Settings

Open up your Privacy Settings (as in the image above) and then locate the “Edit your settings” link in the Apps and Websites area…

Facebook Privacy Settings: Apps and Websites

Once you’re inside of the Applications Settings area, you should see something like the image below, which lists all the different application settings available to configure. We’ll start with the Red box, “Apps you use” > Edit Settings button…

Facebook Privacy: Applications and Websites settings

Facebook Privacy > Apps and Websites > Apps you use

Click on the Edit Settings button for the “Apps you use” section (the red box in the image above) and you should see a list of all the apps you’ve ever given access to your information in the past, and haven’t yet removed. It should look something like this…

If you want to see what information each individual application has access to, you can click the Edit Settings link for that application, and take a look. The Ping.FM app looks like this…

There are a couple rules of thumb you could use to figure out which applications to remove, and which ones to keep.

  1. Do I actively use this application, on a more-than-monthly basis? Basically, if you don’t constantly need this application in order for your Facebook experience to stay in tact (i.e. pulling your twitter updates, posting your RSS feed from your blog as notes, updating via Ping.FM, etc) then you probably don’t need to keep it installed. This will probably get rid of the majority of your applications that are just sitting there sucking up your personal information.
  2. Did this application complete its purpose? Was the app used to collect your status updates for the year, find out your Aura’s Color, or some other thing that you had to install it once, and got one result, and never touched it again? If so, you don’t need this application to linger around – it has served its purpose.
  3. Did this application fail to complete its purpose? Was the app originally for something like adding a Dislike button, or showing your profile views, or finding your biggest Facebook stalkers…but never actually gave you accurate information or came through with its end of the deal? Then the app was a phony, and was created for the sole purpose of collecting information about you, and you should have deleted it the day you installed it and it failed.
  4. Do you remember even installing this application? If you don’t even remember installing it, remove it. Don’t convince yourself of the fallacy “I don’t know what it is, so I better keep it in case I need it.” This isn’t like Computer Software – if you end up needing the app sometime in the future, then the app will make you reinstall it again.

To remove the applications:

  • Just click the little X icon for each one.
  • It will ask you if you really want to remove the app, and then click Remove.
  • It will take a few seconds, and then come back with a confirmation. Click Okay.
  • Then move on to the next one.

Once you’ve paired down all the applications to just the ones you want/need to keep, we can move on to the next Apps and Websites Setting, “Info accessible through your friends“.

Facebook Privacy > Apps and Websites > Info accessible through your friends

If you recall, in the Ping.FM application image above, there is a section called “Access my friends’ information“. This Settings page is where you limit the information that your friends’ applications can access about you. When you click Edit Settings for the “Info accessible through your friends” you will get a window full of check boxes where you can uncheck anything you don’t want your friends’ applications to be able to get. Personally, I only want them to know about my website – the more traffic it gets, the more people I can help with information like this. Here’s what I have set mine to…

In the early days of Facebook applications, some clever developers would take your friends profile photos, and then use some code to display their photo and claim they were using the app also, or that they scored X points on this game, or other false information to get you to continue using their application. Personally, I don’t want any of my information to be available to anyone other than my human friends, and only outside of applications.

Facebook Privacy > Apps and Websites > Game and App Activity

There really isn’t much to this section. Just set it to Friends Only to limit all your game playing and other activity (Youtube Favoriting, etc) to just your friends.

Facebook Privacy > Apps and Websites > Instant Personalization

This setting is directed at a particular set of websites. At the moment, according to Facebook’s Instant Personalization page, those websites include:

WARNING: Once you visit one of these websites, they will AUTOMATICALLY show up in your “Apps You Use” section.  You will have to go remove them if you do not want them to continue to have access to your information.

The purpose of this feature is to display the public activity of your friends, with respect to the particular website you’re visiting from the list. For example, if you visit Rotten Tomatoes, any of your friends’ public activity relating to the Rotten Tomatoes website will be displayed in the designated section. In order for this to happen, the website must automatically install their application as soon as you visit the site, assuming you’re enabled “Instant Personalization“. Conversely, if you have this feature enabled, any of your public activity on this website will be visible to your friends when they visit the site as well. According to the description on the Instant Personalization page, this is limited to only the information you have set to be visible to “Everyone“.

If you followed the instructions in the previous “Privacy’s a Joke” post, “Configuring your Facebook Profile Privacy Settings” then there is a pretty good chance that you do not have anything set to “Everyone“. As this is an exercise in privacy, we’re going to disable this feature.

  1. Click the “Edit Settings” button for Instant Personalization
  2. Close the popup video window.
  3. At the bottom of the page, uncheck the “Enable instant personalization on partner websites” checkbox.
  4. Click the Confirm button in the popup window
  5. Then click the Back to Apps button in the top left to go back.

Facebook Privacy > Apps and Websites > Public Search

The last setting to modify is the Public Search. If you followed the ”Configuring your Facebook Profile Privacy Settings” post, and didn’t leave anything set to “Everyone” then you’re set.

This feature tells search engines whether or not to show a preview of your profile in their search results. When you click the Edit Settings button, there is a See Preview link to see a preview of your information if the feature was enabled.

Generally, if you’re concerned about keeping your personal information private, then ensure that the checkbox is cleared for Enable Public Search and you’re all set.

Part 2 Conclusion

Hopefully you’ve gone through all the various sections described here, and prevented your personal information from leaking out behind the scenes and without your knowledge. Now that you’ve locked up your information from prying eyes on the outside, and from prying eyes behind the scenes, the next post will show you how to lock it up from prying eyes on the INSIDE.

Not everyone on your friends list is the friend you think they are. Do you really keep 200, 300, 500, 1000 different people at the forefront of your thoughts every day? Probably not. There’s a good chance that some people are just lurking around benignly watching what you’re doing. Other people you may have to work with every day, but can’t post updates on the internet because they’ll read it and you might offend them. Still others may comment on your photos, or updates, or notes and say stupid stuff all the time, and you just wish they couldn’t even see them in the first place. Grouping up these sets of people, and using these groups for more granular control of your information is what I’ll cover in the next post: Friends Lists.

Technorati Tags: , , , , , , , , , , , , , , ,