Hidden feature in Apple iOS 6 for web developers

10. Januar 2013

Developing mobile pages sometimes is really difficult – especially if you want to use JavaScript. Normally you have some nice develop tools like FireBug or the Internet Explorer Develop Tools… but on a mobile device there simply does not exist any like that.

Adobe had the idea of an interconnection between Chrome and an App on your iPhone – something nice but first it was really buggy and second it is not for free anymore.

But with iOS 6 there is a hidden feature (or simply instead of the „activate javascript console“ menu entry) which allows you to connect to your desktop safari and simply debug there. Wow… a really nice tool – at first.

After downloading the latest version of Safari I followed the simple instructions to enable the iPhone-support and then there happend nothing… A short lookup simply explained my situation: The iOS6 feature for remote debugging simply works only for Safari 6.x – and for a windows based machine there only exists 5.x even if the version 6 is already released for more than half a year.

So for me it is simple to say: Great job Apple… Having iOS 6 installed on my mobile device and NOT having a Mac (I decided to buy an equivalent PC and a car instead) this simply results in being unable to develop mobile pages with javascrit for iOS-devices… This idea must have come from a genious…

Advertisements

Installing Silverlight 4 Tools via Web Platform Installer

20. Dezember 2012

After my Web Platform Installer process finally reached the „Silverlight 4 Tools“ task it failed with the following message:

Installation Blockers:
1) Visual Studio 2010 or Visual Web Developer Express 2010 or Visual Phone Developer Express 2010 that matches the language version of Silverlight Tools 4 must be installed before installation of Silverlight Tools can continue. Silverlight Tools is available in other languages at http://go.microsoft.com/fwlink/?LinkId=177432.

 

Luckily a short search via Google gave me the answer:

I’ve installed the Visual Studio 2010 Service Pack 1 in prior and with this package the Silverlight Tools are already installed – unfortunately the Web Platform Installer does not recognize this. Well… even Microsoft seems to fail from time to time 🙂


What really annoys me about the Microsoft Web Platform Installer

20. Dezember 2012

The Microsoft Web Platform Installer is a pretty cool tool: One single program which will help you install all the tools, SDKs, frameworks and software you may need for developing on a Windows computer.

As you may guess I recently got a new machine which needs several of these things to be installed – so first pick is the platform installer.

But there is one single but seriously annoying problem with the installer:

No progress, no duration

No progress, no duration

As you may see there is no real progress bar nor any duration information. You can only guess how long the installation will take. It may take 5 minutes or couple of hours – no real chance to plan to do anything between that.

Fortunately the old machine is still there and I can go on working… or at least write a nice blog article about things which annoy me 😉


Error Reporting Tool

10. Oktober 2012

You recognize an problem or an issue but its too complicated to put it into words? Well, Microsoft delivers a nice solution for that with Windows 7 and Windows 8: The Problem Step Recorder.

Scott Hanselman wrote a nice blog article about that which I want to share: http://www.hanselman.com/blog/HelpYourUsersRecordAndReportBugsWithTheProblemStepsRecorder.aspx

This is a pretty nice and easy tool to report any bug, issue or problem… I think every programmer would love error reports in this format.


Facebook Development: Posting Feeds and Uploading Images

12. Juni 2012

Currently I’m working on some experimental stuff with Facebook and their JavaScript SDK which can be used in several cases like e.g. a FacebookApp, your own website when integrated the FacebookLogin etc pp.

When learning how to use the SDK you will soon recognize that the documentation is a little bit short – just with the experience from other users who share their knowledge I solved my problems. That’s why I want to share mine too – maybe it helps someone who stumbles by accident over this blog.

So when working with the JavaScript SDK you will get a really powerfull jQuery-like weapon to get access to someones Facebook-account – if he/she grants you the access. For today I will restrict my article on how to post to the users wall and „upload“ a picture to ones album via JavaScript.

When working with the tutorials you will come to a point where you find the first approach on how to post a feed via javascript: Do a HTTP-POST call to an url with the message as JavaScript array. Basically this works fine – but when trying to do this asynchronously you will fail due to the cross-domain-policy rules which will only allow a GET.

But working with the SDK this is easy as anything else:

FB.api('/<TARGET>/<WHAT>', 'post', {
message: '<MESSAGE>' },
function(response) {   if (!response || response.error) {     alert('Error occured');   } else {     alert('Post ID: ' + response.id);   } }); }

Or more as an example:

FB.api('/me/feed', 'post', { message: 'Hello world!' }, function(response) {   if (!response || response.error) {     alert('Error occured');   } else {     alert('Post ID: ' + response.id);   } }); }

As you can see it is simply the same as the first intention: You get a target („/me/feed“) and depending on your choosen target you will need to support a dynamic array of data. In this case the simple message „Hello World!“.

Now to „upload“ an image – as you should know it is impossible to really upload an image via JavaScript as this would open a direct door to your computer files. But you can support an URL of an image which will then be „uploaded“ to the users album you targeted at or in case you did not defined a target album id it will then create a new album with the registered FacebookAppName:

FB.api('/me/photos', 'post', {
message: msg,
url: pic },
function(response) {   if (!response || response.error) {     alert('Error occured: ' + response.error.message);   } else {     alert('Post ID: ' + response.id);   } });

Now it should be a little bit easier to understand the documentation of the Facebook-API as we now have a nice tool (the SDK) given to access all the nice litte informations we’re offered by Facebook about the users of our websites or Apps.

But always think of the policies about posting in name of others: You have to follow the rules and you should not post without the users permission. So better do it visible instead silently in the background – this could harm your reputation as a company and also have other consequences.


Developing with Facebook: Signature in .NET

5. Januar 2012

At the moment I’m working a little on developing an application for Facebook. On the one hand this is for getting experience with the Facebook-API for future options in our software and on the other hand it is useful for my private life to get a glimpse at the data Facebook provides the application hoster.

First before really getting into the Facebook-API you’ll need a server which ideally supports SSL. A small test-web-application could easily be created, the IIS configured and the app registered at Facebook. Next step was to register the newly created app to the page I’m working with where my private account is the administrator.

After all the setup steps (easily described in the Facebook tutorial) and manually hacking around with Try&Error where the tutorial misses some small information, I finally got my first Facebook-data-string.

The string consists of two Base64-encoded substrings with a ‘.’ as seperator. The first is a signature of the second one – the second one is the interesting data as a JSON-array.

It’s really easy to get the data – but what worth is it without checking whether it is correct or not? So I needed to calculate the hash of the data. Sounds easy, eh? From the tutorial I knew that it is simply a HMCA SHA-256 hash-function – fortunately with a .NET equivalent.

Unfortunately getting this running was not as easy as it looked in the tutorial: After some more Try & Error I found that Facebook does not really delivers a standard Base64 string – it simply removes all ‘=’ (equivalent for String.Empty) and replaces ‘+’ with ‘-‘ and ‘/’ with ‘_’.

So after calculating the hash-value all I needed to to is to do the same as Facebook – et voilá my signature was the same.

Following is an example code how I implemented the hash-function:

Public Shared Function FacebookHMACSHA256(ByVal myKey As String, ByVal stringToHash As String) As String
Dim encoding As New System.Text.ASCIIEncoding
Dim key() As Byte = encoding.GetBytes(myKey)
Dim XML() As Byte = encoding.GetBytes(stringToHash)
Dim myHMACSHA256 As New System.Security.Cryptography.HMACSHA256(key)
Dim HashCode As Byte() = myHMACSHA256.ComputeHash(XML)
Dim output As String = ToUrlBase64String(myHMACSHA256.Hash)

Return output
End Function

Shared Function ToUrlBase64String(ByVal input As Byte()) As String
' Facebook benutzt andere URL-Encoding-Zeichen
Return Convert.ToBase64String(input).Replace("=", String.Empty).Replace("+", "-").Replace("/", "_")
End Function

Finally it’s worth to say that the first glimpse at the data Facebook supports is really really interesting. Soon I will report about my next experience with this experiment.


Beloved Internet Explorer and massive Style-Tags

5. Januar 2012

Today a colleague and I stumbled over an interesting limitation of the Internet Explorer:

In one of our web-projects we’re producing dynamic web-output and also added usage of jQuery-UI for nice pretty radio buttons. The context of the dynamic output could include nice web-formulars with many of these nice pretty radio buttons. Unfortunately every single group of radio items creates dynamically a new <STYLE>-Tag – nothing special we thought.

Unfortunately the Internet Explorer owns a limitation of CSS-entries: A maximum of 32 entries is allowed inside a single web-page. All following elements will be ignored.

Using Google I soon found entries from Microsoft concerning this problem – but again they’re working against me: It’s a feature not a bug 😦

http://support.microsoft.com/kb/262161

Maybe a community-link could help: http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/ad1b6e88-bbfa-4cc4-9e95-3889b82a7c1d/

Well… finally we could say that it’s not a fault of our software but a IE-bug… my colleague works now on a solution of pre-rendering the new styles and collecting them in a single <STYLE>-Tag.