Posts

Two notes on Mixed security warnings

Image
When deploying and testing websites that use secure connections (SSL)  we might get warnings about non secure content on the page. This is usually an easy thing to fix. Just find a tool like "Fiddler" and find out what traffic is going over a regular HTTP (non secure) channel. Sometimes even a simple FIND over the code will let you find those "unsecured" elements. But that's not enough if you refer some javascript or refer a link over SSL that then does some non-SSL redirection.  Each browser has a similar way to show you how secure you are on a website. Google Chrome shows website security indicators (icons) that will appear next to your site URL in the toolbar. The first one (1) is just a regular site with no SSL, and we want number (2) the green one, you should avoid the other ones. Now two notes on that. Google Ads Don't use Google Adsense on your website if you use SSL and you care about your site not showing any warning, the ads will b...

Using WPConnect instead of Zune for Windows Phone development

Image
Sometimes you get so used to do something everyday that you don't appreciate how much time it saves you. So in this entry I want to go back to the basics and comment on something I had been asked many times. I remember the times where we used Active Sync to connect Windows Mobile devices, is was not that hard but it could get tricky some times, depending if the device was connected via USB or Wi-Fi, emulators via  DMA and more. And to be honest, it was not that long ago. Fortunately the new Microsoft Windows Phone 7 series does this in a pretty easy way. Zune Besides being used to download apps, musics, podcasts or to sync content between the computer and the device. The Zune software is what we can easily use to "hook up" your device with your Visual Studio and deploy apps to your phone. If you are a registered developer at Microsoft Marketplace just connect your unlocked/activated phone. Run Zune if not setup to auto-start. Then on the Visual Stud...

Nice panning and zooming in Windows Phone 7

A bit of time ago I published an app called Hidden Pics on the Microsoft Marketplace, on that entry I covered some basics on the Isolated Storage and the PhotoChooserTask for Windows Phone 7. On this entry I want to cover the zooming and panning. As part of that app, the user has the option to open a photo full size on the device screen and then pinch to zoom the photo.  They can also pan by dragging on the screen with the fingers. Now this is supposed to be very basic, but there is a catch, which is making the zoom stable. By stable I mean that if you use two fingers to zoom in the photo, once you finish the two fingers should have the same pixels behind them, which indicates that you zoomed proportionally and panned correctly. After googling around a bit I put together the code to do both zooming and panning properly. So here is the XAML for the control, I am using an Image control inside a Canvas with a CompositeTransform : The photo will start fully fitted on the Ima...

Hidden Pics: My first App on Windows Phone marketplace

Image
Just days ago I finished and published my first app to Microsoft Windows Phone Marketplace. As part of the "#30tolaunch" program, I must admit that waiting for  the app to be certified was a little scaring, but the app was approved without any trouble and is already up, you can grab it here . Now the idea of the app is simple, it uses the Isolated Storage to hide pictures you want to keep out of curious people looking at your phone. And it involves two common elements that might be useful for you in future apps. 1) Isolated Storage 2) Photo Chooser Task Isolated Storage. The Isolated Storage is a virtualized file system so your app can't really access the device storage like it used to be. If you are a Windows Mobile developer, you might remember those times where you could write/read files all across the filesystem of a windows device. Thankfully that's not like that anymore. And you get a isolated space just for you application. Reading bytes from a file ...

To be or not to be: A real app.

Image
App is the new black, everyone talks about downloading, buying or selling apps, advertising about them is everywhere. The phone manufacturers have marketplaces and stores where phone users can get get those "apps". We all know the term app is short from application. If this term was coined because was easier or because of a marketing strategy I don't know. But it is catchy, and so we will use it. But to be exact on term, int this case it means "mobile application". Otherwise any program would be an app right? But exactly what is an "app",  really ?  Third-party programs running on mobile is not something new at all, for  more than 10 years we had Java Midlets for almost any kind of cell phone, and I myself programmed for years for the Pocket PC and Windows Mobile, using either eVC, eVB, and later any .NET language like C# or VB.NET by using the .NET Compact Framework (.NET CF). And all those were actually apps . So, if is not new, why the boom...

Git, git extensions and the case-sensitive thing...

As a general rule, I always use some kind of source control on all my projects. For the matter of fact I use GIT even when some people might find that weird, being myself a .NET developer .... But hey... GIT is in my opinion the best things out there when it comes to really good team development tools. Then the second part is to use it with people online, for that github.com is pretty good, and the final part is a good add-in for Visual Studio or a shell extension. I use Git-Extensions for all that and so far, except for the little problem I am going to explain here, I have no complains at all. The problem: Git branches are case-sensitive, so you can have "test" and "TEST" as different branches, and it will work fine if you use linux as a client. But when using git-extensions from Windows, and ran into a huge problem, where one of my friends was pushing code and I was not able to see it. She was uploading code to same branch but just with different casing. Is ...

Referencing Silverlight assemblies from non-SL projects

Image
One of the best things about Silverlight is that represents a set of portable functionality that you can expect to run almost anywhere. Its similarity – although reduced – with WPF results in an amazing way to develop rich UIs and logic in Browser-side apps. And then results normal to want to reuse Silverlight code from our own .NET applications. Reusing code from Silverlight assemblies is possible; the referencing process works well because Silverlight is a subset of .NET Framework, so that “by logic” should just work. Of course this is not all happiness, there are lot of limitations, but it will work as long as you keep yourself into the borders of certain assemblies like Mscorlib , System ,System.Core ,System.ComponentModel.Composition and Microsoft.VisualBasic , playing with others might give you mixed results. Now the trick. You SHOULD NOT add the reference to the Silverlight PROJECT. You MUST add the reference to the Silverlight ASSEMBLY. So let’s assume you have a scenario with...

WCF, Data Contracts and Enums

Image
With Windows Communication Foundation it is easy to create any kind of services, of course my opinion could be biased because I am a .net (mainly c#) developer, but I really find hard to believe that someone could disagree with such statement. Of course there is a lot of know-how and trouble for beginners, specially trying to understand that WCF integrates all communication models we know (web, tcp, pipes, message queues) under one uniform paradigm. But there are some moments where you hit a rock in the path; years ago I stumbled upon the following scenario: I had a library “common.dll” that I used from both the client and the service. You might think this is not something you would do too often, and many people would say “that a client must not know anything about the service internals”. Well… that’s true, but this is not that case. It is just a situation where a client shares some business logic with the service. And the problem? Well, there is no problem with that config...

Disable ENTER key on web pages with multiple forms

Image
As an asp.net developer, you might find pretty common to have more than one form on a web page, sometimes you decided so, sometimes you just inherited a design and have to make it work. Let's just put the case where we have a form on the master page area, like a “search” or a “subscribe” button, and our inner page is a simple form with some fields to collect user information and submit it back to our site, like the image below. Both forms will cause well-formed postbacks to the server if you click either on the search or the submit button, however if you are typing on a textbox and you hit ENTER, anything could happen. You might have inadvertently submitted form 1 instead of form 2 or vice versa. Changing the default button of the page is simple and will help you if you know which button will be the one to respond to the ENTER key all the time. If you are using ASP.NET Just one line of code and you are done. However, this might not work smoothly across different browsers...

Before blogging about code....

The first thing that we need before blogging in a tech blog, is a way to display well-formatted code, and that means with all the syntax highlighting that our more beloved editors do. You can’t deny, after all, that reading code without colors, is not the same. So I checked a bit online and I managed to show code like this: var total = (from u in ctx.Blogs where u.Name.Contains("Blogger") select u).Count(); if (total > 1) return "I though blogger was the only one"; The best thing about this tool is that supports “brushes” to render a lot of languages, so we can have pieces of code in html, c#, c++, python or whatever we want, the setup is quite easy. I found many entries on internet but finally when to they integration page to really see it working. So it seems we are ready to start blogging with source code!