What is Facebookupdate.exe? Is it safe?

I was using that amazing little windows administration application called CCleaner that allows you to view all start-up applications. I noticed a start-up application called ‘facebookupdate.exe’, this immediately gave me concern as I had no facebook applications installed and it certainly sounded like a possible spyware threat.

After doing some further investigation I discovered that in my case this was not spyware but was a little application to control the interaction for applications like Skype with facebook. But I didn’t install it and I certainly didn’t want to take the risk so I decided to get rid! If I was a horrible spyware creator, I would certainly be looking at creating my application to slot into this filename as its a trademark that many people trust – not me!

I would recommend any users to be safe and disable this, to find out how to easily disable applications with CCleaner follow my guide here (coming soon)

Picture Credit: Husin Sani

My web hosting company won’t touch me for legal reasons; thanks facebook!

A few months ago a tool I used once every few weeks went offline. The tool was a little web app to allow you find out who had deleted you on facebook; such a tool gave a interesting insight in the rare occasion that my number of friends decreased. When the website went down I looked further into it and found out that it was actually the domain which had expired.

When I discovered that the domain was still up for grabs I decided that I could use the domains prospects to finally work within a area of web apps that I had never touched but often been fond of – facebook integration. I could create my own version of the friend deletion tool which still had a place upon my favorites bar.

The logic was simple, all I required was a list of the users friends and then store this information either in a database or in a cookie – then the user would revisit the website at which point the past data would be compared against with the latest data to find the missing friend. This data is so easy to get with facebooks own query language. A summary of how to get to grips with this query language and how to get started with facebook integration can be found here (Coming Soon).

After a days work I was well ahead on creating the tool. After creating a nice eye candy interface combined with some slick jquery moves I could successfully release a app which I feel could be used by many people. However, after registering my domain successfully I moved onto arranging my hosting for this domain. After registering the hosting account, I got a unexpected call from an American girl; she was from my hosting company and due to the fact that my domain contained the word “Facebook” they were unable to provide me with hosting. This of course shit immediately me up; this was a massive oversight – I had blinkers on to get this little project done and the common business sense vanished.

Development at this point stopped, I had one aim now – to research what kind of fuckup I had created and if I could find a way out of a possible legal battle with one of the biggest web companies in the world. First I needed to find out if there was a way of getting rid of any liability of ownership of the domains. My research came short – there was not one single document that explained how to cancel a dotcom website, all I could find is that the process has something to do with a company called OpenSRS. I did however come across a website that told me to offload the domain using a service flippa, but flippa decided at the start of the year to ban all domains that contained well known trademarks – bastards! After many googlings I discovered that many sites that contain the facebook trademark usually have written requests to stop using the domain – a request that I certainly don’t mind co-operating with. In the meantime, I have contracted my domain registrar to cancel the domains on my request – I shall keep you up to date on that progress!

I understand the whole trademark issue and respect it. The trademark issue was a massive oversight – This little ‘project’ of mine is now dead. RIP

Picture Credit: Sean MacEntee

Why is facebook not correctly showing my sites description on comments?

When I first started doing all the SEO management for this site I noticed that facebook was getting slightly confused with what to display when I shared the website on peoples walls. It was attempting to show the whole last blog post in the description for the site, which would be confusing for any new people who may be interested in what the site was about.

I did some research into why Facebook was getting so confused and I released it was not me that was getting this wrong – it was because of Facebooks own internal system which featured some kind of cache for this information. I will quickly explain how to get your sites description on facebook links and how to reset this facebook cache.

<meta name="description" content="Text about your site!....."/>

First, you need to ensure that your meta information is correct. This is what facebook uses for the website description, if that information is not there facebook will attempt to grab some text from the page. The code above will allow you to set a description for your page and will be used not only by Facebook but by web crawlers too! If you are using wordpress a good tool to use is by Yoast SEO which allows you to easily manage this data (for those among you who are not into coding).

Ok, so we have done our meta tags… but why is facebook still showing the old description on the site? Well its because of a facebook cache that we need to update. I was impressed that this facebook debugger tool worked straight away, if it was made by google it would take a while to complete (Their web crawl times). You can find the tool here: http://developers.facebook.com/tools/debug?url . Just type in your websites URL and it resets all the data facebook hold on your website, it also gives a intresting summary, I was only interested in the following information:

og:title: (Taken from <Title> on your page)
og:description: (Taken from the above meta information)

I then posted the URL on my friends wall and the new data was updated.

Yay!

Picture Credit: www.scottdoescode.com

How to Lock a Windows Machine using interop services.

 Before the dotnet framework came along most programming languages such as C complied in unmanaged environments. This would allow a software programmer to have more freedom with how they interfaced with a system. To access core system actions we need to access the Windows API which is confined within many different libraries. We can use interop services to access this unmanaged code from our dotnet managed environment.

To allow us to control how the system manages a lock routine we need to access the operating system’s services though a DLL. As the dotnet framework is managed we need to use dotnet’s interop services to invoke unmanaged services which are held within the DLL. Don’t let this scare you, all this means is that we load in the DLL and then we query it in our code.

First, what we need to do is connect to the DLL which contains controls the lock command. The DLL is called user32.dll which contains all the core user experience for Microsoft Windows and is a aspect of the Windows API.

[DllImport("user32.dll", SetLastError = true)]

The code tells the compiler to declare functions which are contained in the user32 DLL file. The DllImport attrubte is contained within the System.Runtime.InteropServices library, so don’t forget to import this before running the code!

static extern bool LockWorkStation();

We then declare a variable which uses the extern modifier to declare that the LockWorkStation method exists within the Windows API in the user32.dll file.

LockWorkStation();

Now we can call the LockWorkStation method anywhere in the text to lock the machine. Magic!  This code can be added to a button to lock the machine when its clicked or attached to a timer to ensure the machine is locked after a certain time. The uses are endless!

Further Reading

System.Runtime.InteropServices Namespace

Interoperating with Unmanaged Code

The Component Object Model (COM)

Picture Credit

How to export data from ASP.Net datagrids to spreadsheets? Its alot easier then you expect!

 Let me introduce you to contenttypes in asp, it’s not that new as its been around since framework 2. This allows you to specify content types and is usually reserved to control how email attachments are downloaded. All browsers recognize the response contenttypes and convert the raw data into a file which can be opened by the relevant program.

The code below will allow you to convert data from a data-grid and then export to excel. Think of what .NET is doing is making a nice tasty sandwich, the first slice of bread adds a header which tells the browser that kind of content is within, the next is the filling which uses a stringwriter to re-render the datatable information and finally the other slice of bread finishes the response ready for a refresh.

string attachment = "attachment; filename=file.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();

With the above code you can place within a button such as one titled “convert to excel” at which point the code above is called. You will be able to change the MIMIE type value for Response.Content type to change the format downloaded for the user – I would recommend trying different MIMIE types to see how your browser reacts. Check out the various MIMIE types in my article here.

And its that easy!

Interfacing .net and PHP webservices – Two English chefs and two Polish chefs but not enough broth to go around!

 Many .net programmers would be certain to jump the gun with saying interfacing with other technologies is silly, as the framework provides a solid grounding for web service communication.

But if you have a limited time scale but a wide range of skills at your disposal wouldn’t you harness cross-skill development? I recently worked on a client server application which required a web service to control a large amount of communication. Within the project team we had a development issue, two .net programmers and the rest were PHP based programmers and a six month turn around for development. So we had two English chefs, two Polish chefs but not enough broth to go around!

As developers we knew that there was an easy option to go ahead with a solid .net project but this would make our two Polish chefs making tasty PHP soup redundant.

We decided as a team to go ahead with a alternative web service. We required a established PHP web service that would provide us with the ability to submit whole arrays from .net to our PHP script. Our preliminary searching didn’t find anything, it appeared that such a thing didn’t exist – this worried us. Later on we came across an open source project called “NuSoap” which at first we overlooked, however we decided it was the only possible solution that we could find.

NuSoap is a open source project which consists of a few written libraries which allow the user to write a script which allows web services to be designed in a object-oriented layout. As the script uses WDSL, .NET loves it! I created a method using NuSoap that would return the string “Hello” & the string of text sent to the PHP web service. I must admit the best feeling in the world is having a .net program say “Hello Scott” at 2am after a hard days investigation and graft.

NuSoap allowed us to perform cross-language development side by side and allowed our management of our intensive .net data to be more efficient with reliable communication with MySql.

The method of submitting arrays is recorded as not being possible, but after a mistake we succeeded I will write a tutorial on how to connect NuSoap to a .net program soon and communicate arrays soon!