Posts

Red blinking issue on Microsoft Display Dock

Image
Red blinking light? Check the power supply cord. I just got my Microsoft Display Dock courtesy of MS after pre-ordering a Lumia 950XL. But after the first attempt I just got a red blinking light on the front and nothing more. The phone won't recognize it and the display connected would just go to sleep. After playing with it a bit I realized the USB-C connector on the dock's power supply (identical to the "fast charger")  was a bit loose. I then compared to the one that came with the 950XL and voilĂ !  See the difference below. Left: Adapter from the 950xl box | Right: Adapter from the Display Dock Since it is shorter (manufacturer error? bad batch? who knows...)  the adapter packaged with the Display Dock won't reach the connector properly. However, it will fit in and charge the 950XL perfectly. I think one of the reasons is the thick casing in the Microsoft Display Dock. Check it out. The case is sturdy and thick. So if you happen to have a Micros...

Why this new Microsoft is impressive

Image
The last Microsoft event on October 6 showed a few surprises, let me explain you why this is impressive and why I think the new Nadella direction at MS is different. Iris Scanner, Liquid Cooling, Continuum... A new Surface 4 tablet with Liquid Cooling The new Surface 4 was a really good upgrade, and a real big one. More resolution in the same size, up to 16GB of RAM and 1TB of HDD and Liquid Cooling . All that packaged in a device as think as this, only 8.5mm of depth. Check how the cooling works. New phones with Continuum and Liquid Cooling I know Windows only have 3% of the market on phones, and that's a bummer because we don't get to have all the apps. But now the new phones have continuum, a feature that allows using a phone as a full size computer. They also manage to get liquid cooling into a handheld device. That's a good direction. Let's just hope this new direction combined with universal apps will get more developers into the boat. A new Sur...

Fixing Visual Studio 2015 Android Designer with Xamarin

Image
While using Visual Studio 2015 to edit and android layout file ( axml ) I got this error:   The installed Android SDK is too old. Version 24.3.4 or newer is required The number version might be different in your case. Here are a few possible causes for the error: 1) You actually need to upgrade your Android SDK. 2) You have the wrong path for the Android SDK installation on Visual Studio. (change it on Tools->Options->Xamarin) 3) Mixed Xamarin extensions (this was my case) After reinstalling the Android SDK and checking the everything was fine on that part I went to check on Visual Studio extensions ( Tools -> Extensions and Updates ). It turns out that  I caused a mix up of versions, since I already had Xamarin and Visual Studio 2013 side by side. and now 2015 had another one, my Visual Studio 2015 ended up with 2 extensions for Xamarin. Disabling one of them solved the problem and the designer was working again. The one that I disabled was titled "...

Was the Lenovo/Superfish thing so unique?

It is a big deal, and by no means I would defend them; I don't think anyone can. They did a cheap and horrible thing by installing a piece of adware junk, that not only was used to monetize on the buyers, it is also a major security breach. Many people are still upset at lenovo and blaming everything on the "chinese government" and talking about all sorts of conspiracies. But I don't want to talk about who did it or why, as I was reading about all this, I just could not stop wondering:   are they the only ones ? Of course not. The Gemalto hack But did you know about the Gemalto  SIM card hack ? A massive sim card hack that allegedly allows US and UK spies access to billions of phones. The Gemalto hack quoted here from PC World: " Gemalto, based in the Netherlands, produces about 2 billion SIM cards a year. About 450 mobile carriers, including AT&T, T-Mobile, Verizon Wireless and Sprint, use the company’s SIM cards. With the compromised encrypti...

My bipolar approach when recommending a mobile device (phones)

Image
Recommending a new device to somebody else requires a lot of analysis, first of all, they will think you are trying to push your own preferences. And that could be true, at least up to a certain point. For me, however, recommending a device becomes a more complex thing. As a developer I work with and own a lot of them: iPhone, iPad, Android phones and tablets, Windows tablets, both "RT" and regular x86. And while my own device is a Windows Phone (Lumia 925) the right device for you depends on a lot of factors. First, the Phones Let's compare the three platforms, but only phones for now, we'll be talking about tablets later. So we have iOS (iPhone), Android and Windows Phone. At some point the discussion must be about a specific brand, but at the end we will have to sort results by platform. Apps Most likely the app you need is available for both iOS and Android. There is a huge app gap, as well as a huge number of low quality apps in some stores, so my ...

From AsyncCompleted to async await

Since we got the magic of async/await on C# things got much easier on the developer front. Working with Tasks is the key to it, but we also have two older approaches in .NET framework that we need to deal with.  APM (Asynchronous Programming Model) The pair of Being / End methods.  EAP (Event-based Asynchronous Programming) The Method Async / Method Completed pair. Converting from APM to Tasks is achieved by means of the   System.Threading.Tasks.TaskFactory   class and its generic counterpart. Now converting from EAP to Tasks  requires us to use the TaskCompletionSource<T> class and notify of the state of the task as it goes. See the example of a "handshake" operation in a WCF service. I am also using the approach from my older post regarding events and anonymous methods. The return type of the WCF operation is WrappedResultOfString , and that will be the actual generic parameter of the Task<T> that the HandshakeAsync method will produ...

The uncatchable exceptions in WCF clients

Did you ever have a problem with a WCF client throwing exceptions you can't catch? If you have used WCF clients from Windows Phone, Silverlight or Xamarin.iOS, you might have noticed that it is not possible to create Synchronous or Task-Based operations; the functionality is reduced to the Event-based Asynchronous Pattern (EAP). That means that the way to call a WCF method and get the response is usually as follows: var client = new MyWCFClient(); client.DownloadDataCompleted += (sender, e) => { try { //accessing e.Result here might raise an exception in another //thread, that will not be captured by the 'catch' below. } catch(Exception ex) { } }; client.DownloadDataAsync(url); Our results are wrapped in an auto-generated class that inherits from  AsyncCompletedEventArgs , this class has a property  Error  of type  Exception , that will carry information about the error and a property  Result  with our expected return valu...

Get-ChildItem vs Dir in PowerShell

Image
Batch as usual Recently I was in the need of modifying a huge amount of files across a network share. After installing Serviio media streaming service I noticed that it will crash "randomly". After checking the logs it was clear that ffmpeg was crashing when trying to open subtitle files that were not in the encoding indicated by the Serviio console. I needed a quick way to update all subtitle files to a common encoding, so I decided to convert all files to UTF8. Since I use a windows environment I went directly to PowerShell and wrote this.  Get-ChildItem -path .\ -filter *.srt -file  | ForEach-Object { (get-content $_.FullName) | Out-File $_.FullName -encoding utf8 } This worked almost right except for files with "[" or "]" (among other symbols) on the name or path. To solve it, just added the "-LiteralPath" switch to tell powershell not to consider any wildcards on the path name and just use it exactly as it is.  Get-ChildIt...

My favorite (critical) developer tools

Image
In addition to pizza, caffeine, and video games, a developer requires a lot of tools, and I mean "a lot". Each one is different so here I want to showcase what I use, and briefly explain why. The idea of this post rather than make any type of advertising (notice there are no links at all) is more to actually find out what other people use and share with you all my experience. So, the profile:  .NET Developer. The usual work: Web applications with ASP.NET (Web Forms and MVC) Windows Forms Windows Presentation Foundation Windows Phone Apps iOS Apps  Of course, I might code almost every day a bit of JavaScript and some HTML/CSS fixes, along with some other things, but that's not enough to consider it the main course. The Infrastructure Before coding, organization and planning is everything, and that means for me 3 things, since I am a SCRUManiac: Source Control Issue/Bug tracking Continuous Integration For source control, I prefer Git particularly, ...

Virtual Keyboard in iOS - part 2

Image
One the first entry of this series I covered the issues with the keyboard in iOS not hiding automatically when needed. In this second - and final - entry on the subject I am going to go for the most of annoying issue when creating UIs in iOS. The keyboard overlaps a focused TextField  If you have a TextField below the keyboard top edge position, they will be hidden once the keyboard shows up. The keyboard size is 320x216 points* in in portrait mode, so anything below the 264 (iPhone 4/4s) or 352 (iPhone 5/5s) points won’t be visible.  It is so simple that is almost unbelievable, but it happens as you can see in the images. Since this default behavior is inconvenient we are going for the workaround. The solution is not pretty but it is trivial: we need to place the UI elements inside a UIScrollView  and will use notifications to monitor when the keyboard will Show/Hide and will scroll the content of the container to ensure that views inside are always vis...

Virtual Keyboard in iOS - part 1

Image
When you are a developer for more than one platform, you might find that what is considered basic or pre-built in one, it’s incomplete or completely missing in another one. This entry is about fixing some issues with the virtual keyboard on iOS; especially when it hides your text fields or keeps the input focus. Xamarin Studio/Mono and XCode were used for this example. Hiding the keyboard Tapping inside the TextField will show the keyboard, but it won't be possible to get rid of it by tapping outside or pressing “RETURN” on it. This is something pre-built in Silverlight for Windows Phone. Tapping outside of the textbox or hitting the “back” key will hide the keyboard. But well, there is no back key on the iPhone. So let’s start by creating and extension method that we will use in the rest of the solution. The method will return the view that is the first responder or the “active” one. public static class Extensions { public static UIView FirstRespon...

Where is Silverlight now?

Time ago I wrote an article  about the comparison between of HTML5 and Silverlight. That article was indeed about the "comparison" itself rather than another attempt to compare the two; mainly because I consider that kind of measuring to be pointless. Then again with the pass of time the same question arises: is Silverlight dead? Before going into trying to answer that, allow me to be clearer than what I was at the time and let me rephrase the question: is the silverlight plugin for browsers dead? Well... the answer is yes, not even a "maybe". But as with any existing software, dead is not actually extinct. We still have people writing code in COBOL, FORTRAN,  DELPHI and VB6. And this is because the enterprise market does not move at the same pace as the consumer market. They invest in infrastructure, they keep it, and they treasure it. And Silverlight was highly adopted in the enterprise for LOB applications. So in that area, Silverlight is going to be there ...

New updates in apps and games

Image
Just recently updated a couple of apps. Loan Calculator Reversi (both Free and Full editions) Loan Calculator First the small "Loan Calculator" app, got a small update. The UI was simplified and some small glitches were addressed. Is hard to improve an app that is already quite useful yet simple. However new versions will improve it even more and not just cosmetic changes. Reversi Reversi got an "almost major" update, with an improved UI (at least over the previous one) and also a new feature that allows the user to see the possibles moves (hints), which of course, you can turn on/off. Hints are available and optional In addition to these improvements in the user interface, the internals were also improved a lot, the new game is quite faster than the previous versions and also plays better. Fixing an issue introduced with version 1.2 when the AI was... not so smart. For next versions... Sounds Statistics board All levels available ...

The invisible property of UIViewController

Popular wisdom says "things happen for a reason". However experience has proved me that when it comes to programmers, that is not always true. Things can just happen for no reason at all. That's why we require feedback, here is one and I assure you is in good spirit. So let's me write about something I found when building an app for iOS using Xamarin/Mono. The invisible property. Ranging from windows forms (desktop or Windows Mobile) to WPF, Silverlight/XAML on the web or windows phone. ASP.NET Web Forms or Razor, MVC or classic. One thing I can say for sure: any visual element  has a way to check for its visual status. Call it "Visible" in windows forms, "Visibility" in Silverlight/WPF. There is always an intuitive, simple and trivial way to know if something - that might be visible - it is visible at a particular moment or not. You can't imagine my surprise when I realized that the UIViewController in iOS does not provide such mecha...

The value of your opinion

I have published apps and games for Microsoft Windows Phone, and I update them in a regular basis. Most of the time is because a bug is found, sometimes is a new feature or just because I am trying something new. It helps to keep things moving and people thank you for that. However, I never had to protect an app or a game from human stupidity. Until now . Software developers learn  over time how to deal with the final user - in some measure - and I must admit is not easy; as programmers we are not trained to deal with them, is usually another person's job. But when it comes to phone/tablet apps, that individual is you, because as an 'indie' developer you are too close to the complete production line. I classify the users like this: The happy mute The unhappy mute The fan The hater The stupid The mute ones... There are always people that either like or don't like your app or website, or tool, but they just don't say anything. This is good and b...

Events and Multithreading

This is  the second and final part of this series. Will focus now a bit on what happen when we add multithreading to our work with events. Cleaning Up Events and Context Information In the previous post I mentioned some issues using lambdas and anonymous methods on events. The unsubscribe problem had a tricky "solution" by declaring a "cleanup" method inside the class that holds the event. public void CleanupSubscribers() { SayHelloCompleted = null; } The problem here is obvious since the cleanup method will remove all subscribers from the event. Hence, individually removing listeners from the event gets tricky when using lambdas/anonymous methods. So in this case the recommendations would be: Do not use lambdas if you need to unsubscribe. If you do so, use the cleanup method UNLESS your code is multithreaded.  NOTE: this only applies to the use of lambda expressions and anonymous methods, as for regular named methods yo...

The lambdas, the anonymous and the events

Combining lambdas, anonymous methods and events feels natural in C#, and we use them almost as a reflex, they help us to create closures and avoid creating state variables outside the scope of our methods or passing extra state data through event calls. But one thing that come with events is the fact that writing good applications implies making good use of the resources, meaning we have to dispose those we no longer need. When using events with lambdas and anonymous methods, is possible to forget about that, thus writing code that is not efficient and prone to crashes. Will start this 2-part series talking about the subscribe/unsubscribe behavior. Subscribe/Unsubscribe lambdas and anonymous methods Let's begin with a basic scenario using events in a single-thread context for now; just to keep it simple. The code fragment below contains the HelloEventArgs implementation as well as the publisher class MyClassWithEvents . public class HelloEventArgs:EventArgs { ...

Windows Phone vs iOS Development (with C#): Round One

Image
DISCLAIMER: This is not about iPhone vs WP7 devices; its about development tools. If you think you can enter into a device fight here, or you like to listen to Justin Bieber, you should leave the page now. I like programming, and that's it. Well...no. I LOVE programming. No matter the platform, OS, framework or  language; I find that programming is a rewarding experience. Of course as with anything in life, you want that experience to be as smooth as possible. And that's why I am so picky with development tools... They are supposed to make my work easier. And this entry is about that, comparing the development tools used to create apps for iOS (iPhone) and Windows Phone. Recently I had the opportunity to develop the same mobile app for two platforms: Windows Phone and iOS. While I have developed for these platforms before, I rarely have coded the same app (and a complex one) for the two of them. And this is a good chance to perform a comparison, beca...

New app and updates

Image
Crazy cars, the new game Recently added a new game to my list of apps for Microsoft Windows Phone, a game, and is called "Crazy cars" can be downloaded  here . The game have been download thousands of times and very short time! Check out the new UI created in Silverlight. Hidden Pics The app for hiding photos on you phone also get a new UI, more styled design and several bug fixes. Check out the new look. New updates are coming for this app, including encrypted photo sharing, fake passwords, bogus tiles and more.

The Loan Calculator App

Image
Few days ago I added a new App to my inventory on Windows Phone Marketplace. The Loan Calculator app was just something I needed when I was in a hunt for a car (still am). The thing is I wanted to keep it simple. Just input the numbers and see the total, how much, for how long, you know.. just the FINAL number. Which is what car dealers will never give upfront, because they always play that 101 psychology thing on you. So I built this app using the common formula that you can see around in many websites. The idea is pretty simple, just input the data and get the total final price and the monthly installments. As an extra you can also see how the amortization for the loan plays along time. Check it out, assume we want to calculate the final price for a car that cost 25k, we will put a  10% down payment, 2.5k, with an APR of 3.0%, and with a loan term of 3 years. Just enter the data and hit "Calculate" Then we just get the summary result with the final cost, se...