Posted by Mike Fleming | Posted in MySQL, SQL Server | Posted on 26-02-2009
0
I saw a post yesterday that explains the simple process of setting up a MySQL database as a linked server in Microsoft SQL Server. SQL Server has had the linked server functionality for years now. In short it allows you to set up a data connection to another RDBMS and grab your data from it. The post below is a great step by step guide to setting up a linked server to a MySQL database.
HOWTO: Setup SQL Server Linked Server to MySQL
Posted by Mike Fleming | Posted in AIR | Posted on 26-02-2009
2
Ever been on Criagslist before? I am sure most everyone has by now, at least to browse some listings. It has one of the most minimalist designs of any popular site in history. If you have ever wished for a nicer looking layout for the site, look no further. CL Desktop is an Adobe AIR app that wraps Craigslist into your desktop. I have not tried the application out yet, but it appears you can save searches to run again as favorites. Another plus is that it allows you to view the pictures associated with a post on the listing screen. This eliminates the click to a listing just to see a photo. If anyone has tried this yet let me know what you think.
Posted by Mike Fleming | Posted in ColdFusion | Posted on 24-02-2009
1
So I guess I have been living under a rock. Today I came across the suggestions attribute that started shipping with ColdFusion 7. In short, this feature will attempt to suggest better search criteria than what the user provided. For example, if you type in "blgo" as your search criteria, it may return no results. But using the suggestions feature it can return to you the suggested search criteria of "blog". You can then use that to suggest this to your users (i.e. like Google does), or you could even run another search using this suggested criteria. So far this feature has done a very good job of suggesting other search criteria.
To use this feature, when you call the cfsearch tag you provide an attribute named status. This returns a structure with additional information on the search, one of this which is the suggestions text. An example is below.
| 01 | <cfsearch |
| 02 | collection="collections" |
| 03 | name="qrySearch" |
| 04 | type="Simple" |
| 05 | criteria="#form.searchCriteria#" |
| 06 | status="strSearch" |
| 07 | suggestions="0"> |
| 08 | |
| 09 | <cfif StructKeyExists(strSearch, "suggestedquery") AND Len(trim(strSearch.suggestedquery))> |
| 10 | Did you mean #strSearch.suggestedquery# |
| 11 | </cfif> |
One quick work of caution. The suggestedquery element of the status structure does not always exist. So you must check that exists before using the element.
Posted by Mike Fleming | Posted in .NET, ColdFusion | Posted on 23-02-2009
0
Our next little topic in the series comparing ColdFusion and .NET will cover the simple task of uploading a file via FTP. This task is fairly easy in both languages as you will see below.
We will look at the ColdFusion code first. ColdFusion includes the handy CFFTP tag to handle all of our FTP operations. To upload a file you will follow three steps: opening the FTP connection, transferring the file and finally closing the FTP connection.
| 01 | <cfftp connection = "ftpConn" |
| 02 | username = "FTPusername" |
| 03 | password = "FTPpassword" |
| 04 | server = "FTPserver" |
| 05 | action = "open" |
| 06 | stopOnError = "Yes" |
| 07 | > |
| 08 | |
| 09 | <cfftp |
| 10 | connection = "ftpConn" |
| 11 | action = "putFile" |
| 12 | localFile = "#getDirectoryFromPath(getCurrentTemplatePath())#\harvick.jpg" |
| 13 | remoteFile = "harvick.jpg" |
| 14 | passive="yes" |
| 15 | > |
| 16 | |
| 17 | <cfftp connection = "ftpConn" |
| 18 | action = "close" |
| 19 | stopOnError = "Yes" |
| 20 | > |
Next is the .NET version of our code to accomplish the same task. I have wrapped the core code into a function for code resuse. You will then see how you simply call the function and pass it the data you need.
| 01 | using System; |
| 02 | using System.Net; |
| 03 | using System.IO; |
| 04 | |
| 05 | public partial class upload_file : System.Web.UI.Page |
| 06 | { |
| 07 | protected void Page_Load(object sender, EventArgs e) |
| 08 | { |
| 09 | ftpUpload("harvick.jpg", "YOUR LOCAL FILE PATH", "FTPserver", "FTPusername", "FTPpassword"); |
| 10 | } |
| 11 | |
| 12 | static void ftpUpload(string filename, string localPath, string host, string un, string pw) |
| 13 | { |
| 14 | FileInfo fileInf = new FileInfo(localPath + filename); |
| 15 | string uri = "ftp://" + host + "/" + fileInf.Name; |
| 16 | FtpWebRequest reqFTP; |
| 17 | |
| 18 | // Create FtpWebRequest object from the Uri provided |
| 19 | reqFTP = (FtpWebRequest)FtpWebRequest.Create |
| 20 | (new Uri("ftp://" + host + "/" + fileInf.Name)); |
| 21 | |
| 22 | // Provide the WebPermission Credintials |
| 23 | reqFTP.Credentials = new NetworkCredential(un, pw); |
| 24 | |
| 25 | // By default KeepAlive is true, where the control connection |
| 26 | // is not closed after a command is executed. |
| 27 | reqFTP.KeepAlive = false; |
| 28 | |
| 29 | // Specify the command to be executed. |
| 30 | reqFTP.Method = WebRequestMethods.Ftp.UploadFile; |
| 31 | |
| 32 | // Specify the data transfer type. |
| 33 | reqFTP.UseBinary = false; |
| 34 | |
| 35 | // Notify the server about the size of the uploaded file |
| 36 | reqFTP.ContentLength = fileInf.Length; |
| 37 | |
| 38 | // The buffer size is set to 2kb |
| 39 | int buffLength = 2048; |
| 40 | byte[] buff = new byte[buffLength]; |
| 41 | int contentLen; |
| 42 | |
| 43 | // Opens a file stream (System.IO.FileStream) to read the file |
| 44 | // to be uploaded |
| 45 | FileStream fs = fileInf.OpenRead(); |
| 46 | |
| 47 | // Stream to which the file to be upload is written |
| 48 | Stream strm = reqFTP.GetRequestStream(); |
| 49 | |
| 50 | // Read from the file stream 2kb at a time |
| 51 | contentLen = fs.Read(buff, 0, buffLength); |
| 52 | |
| 53 | // Till Stream content ends |
| 54 | while (contentLen != 0) |
| 55 | { |
| 56 | // Write Content from the file stream to the FTP Upload |
| 57 | // Stream |
| 58 | strm.Write(buff, 0, contentLen); |
| 59 | contentLen = fs.Read(buff, 0, buffLength); |
| 60 | } |
| 61 | |
| 62 | // Close the file stream and the Request Stream |
| 63 | strm.Close(); |
| 64 | fs.Close(); |
| 65 | } |
| 66 | } |
The .NET code seems a bit longer due to the commenting. But as you can see, both languages make upload a file a very simple task.
Posted by Mike Fleming | Posted in Business | Posted on 20-02-2009
0
While reading the news this morning I came across this article by Sarah Milstein describing how two companies have used Twitter to increase sales. One of them was Dell, who has claimed to have made over a million in revenue due to Twitter. The second company was Namecheap, a domain registrar. They used Twitter as a base for contests and promotions and also claimed to have good success.
Do you know of any other companies using Twitter to market their business or services?
Posted by Mike Fleming | Posted in General | Posted on 19-02-2009
0
One of my favorite blogs is Danger Room. It's great reading for all things related to national security. Today they had a post on cyberattacks and raised the question if the United States was ready to defend against one. Paul Kurtz, a cyber security veteran of the Clinton and Bush administrations, doesn't think we are. The author of the post, Noah Shachtman, disagrees with some of the ideas from Kurtz to help prevent an attack. Does this remind anyone of WarGames?!
Posted by Mike Fleming | Posted in Technology | Posted on 19-02-2009
2
The Los Angeles Times has a very nice post on how Jack Dorsey and his pals started Twitter. It's an interesting read, especially when he details the inspiration behind it all. Believe it or not, his first thoughts revolved around bicycle messengers, and their status. He also goes into detail on how they decided on the name as well. He says the name Twitter means "a short burst of inconsequential information". That may be the best explanation of what Twitter is!
This is just another example of how some folks can take a very simple thought and turn it into the next big thing.
Posted by Mike Fleming | Posted in General | Posted on 18-02-2009
1
Facebook has listened! After being the target of criticism for it's new updates to the terms of service, they have changed face and reverted back to the old terms of service.
Below is the message posted to all Facebook accounts letting users know of the change back to the old terms:
Over the past few days, we have received a lot of feedback about the
new terms we posted two weeks ago. Because of this response, we have
decided to return to our previous Terms of Use while we resolve the
issues that people have raised. For more information, visit the Facebook Blog.
If you want to share your thoughts on what should be in the new terms, check out our group Facebook Bill of Rights and Responsibilities.
Kudos to Facebook for listening to the outcry of it's user base. I would like to point out that the message above does make it sound as though they will have new terms of service, but hopefully the controversial pieces will be left out.
Posted by Mike Fleming | Posted in General | Posted on 17-02-2009
0
To go along with the post earlier on the updates to the Facebook terms of service, I came across this post from the folks at AllFaceBook.com. It covers their 10 privacy settings that Facebook users should be aware. So if you are a user of Facebook check these out to see if any are useful to you.
Posted by Mike Fleming | Posted in General | Posted on 17-02-2009
0
I am sure most of you have heard by now that Facebook slyly updated it's terms of service on February 4th. Most people probably never read such things when they signed up for accounts on the web, but if you are user of Facebook you may want to read the updated terms of service and privacy policies. I do not want to generalize this too much, but in the end Facebook owns all the data you provide to the site. In some cases this data will still be kept even if you delete your account.
This Fox News story summarizes everything very well, including a response from the CEO of Facebook Mark Zuckerberg. His response in defense of the terms are flawed in my opinion. If a user decides to delete their account, I am of the belief that every piece of content posted by that user should be deleted. Zuckerberg's defense of this argument uses an example of sending a message on the site. When a user composes a message to a fellow user, there are two "copies" of that message on the site, one in the composing users sent messages and one if the receiving users inbox. He says they believe if the composing user deletes their account that the message in the inbox of the receiving users should stay as it was sent originally. This not only includes messages, but could also include photographs.
Other folks who commented on this issue on various blogs around the internet, are not happy with this policy. Some believe that basically Facebook can profit greatly on using your data or photographs to market themselves, without you making a dime. What do other people think on this topic? Do you agree or disagree with the policies of Facebook?