Windows Phone 8 #buildstuff

Few hours ago my second application for Windows Phone just released, this time I made application for Build Stuff conference. Just check this out and please let me know about any issue or things to improve, via mail pawel@sawicz.eu or in comment below.

Of course it’s first release, and application will be updated if any new speaker or session come out.

2 3 4 7

Windows Store : http://www.windowsphone.com/pl-pl/store/app/buildstuff/202f5800-8081-45d4-845c-ab5d4a1f30db

See ya on Build Stuff!

Grid in Windows Phone 8 #windowsphone

When we are creating Windows Phone application first thing that we will be using is GridWindows Phone Grid

Grid, it’s our base for creating our world in devices. In this post I want to approach closer this topic. First thought is, how to use it ? and why it’s so powerful ?

Let’s me answer. It’s quite powerful mechanism because <Grid> can be our box for others items like (list box, text block etc.).

Moreover you can nest <Grid> inside <ListBox> or similar items.

<Grid> has got various members, for declaring rows and columns we have to use  <Grid.RowDefinitions> and  <Grid.ColumnDefinitions> by these members we can declare width of column, and height of row.

Example implementation :

wp_grid_col_row_def

As you can see I made three rows, and four columns. Now if you want place something on specific column or row, it’s similar to game “Battleship“. Let’s place text box, with help comes Grid.Row and Grid.Column.

<TextBox Grid.Row="0" Grid.Column="1" />

wp_grid_col_row_def_box

Notice: good practice – you should implement whole sizes at this step (by Row-Column Definitions), because in my opinion using fixed width and height at items property is mistake (of course sometimes you have to use item property), it’s like clothes, you want them to well fit on your body, you do not resize your body to clothes.

Notice: When you are designing your UI by the <Grid> make sure that you are include margin inside these definitions, I think it’s good practices to define spacing by this mechanism.

Nesting

You can define <Grid> inside of <ListBox> (i.e), and you can form <ListBox> view as you wish, it’s very helpful to create custom view of listbox.

wp_listbox_grid

As you can see I didn’t use here fixed height, width. Even margins are implemented inside Row-Column Definitions. Of course this grid we can use inside DataTemplate, so if we have dynamic render data.

Conclusion : When you are modeling UI remember to use grid, and try to not use margin,height,width properties. It’s much more maintainable.

MongoDB and Web API, power of NoSQL philosophy

Few days ago I had to create very simple database, and there was a need to expose API, so first thought was no RDBM! (because there wasn’t any relation). @mfranc has showed me this powerful diagram, where you can easily decide which database engine will be the best for your solution. In my case I had choose MongoDB, it’s document-oriented database, tree of MongoDB is quite similar to RDBM, engine->database->collections->documents (so each document represent record of our data).

Now let’s go to see some code, first of all you have to download MongoDB, and then install it. If you did it, now we can run our VS, and select new Web API project.

First of all you need to add Package of MongoDB C# Driver.mongodb_package

Now we can write some code, so first we need model of our data. Speaker.cs, this class represents model of speaker.

And here is example data inserted to this model, as you can see ILIst<Presentation> create us a list of presentation. Moreover this record is one document inside of speaker collection.

mongodb_speaker_tree

Presentation.cs model of presentation.

Example data based on this model,

mongodb_presentation_tree

You have to know that Presentation Collection isn’t member of Speaker IList<Presentation> data! This isn’t a relation!

After these steps, now we can create our api controllers, Controllers->Add->New Item->Web API Controller, PresentationController.cs

As you can see there is only implemented Get Method because in my case I need only this, MongoDB queries are somehow similar to ORM’s, just look at this method where you want to get only one specific Presentation, you have to use Query.EQ – In this case every record are tested, are they equal to specific value. Also I use .Single() to cut off collection to single record.

SpeakerController.cs, Here is a dynamic method to show you that you can form your api as you wish

Conclusion : NoSQL – not only sql, it is philosphy to not use only sql in your solutions, in this case using MySQL or MSSQL will overpower my project, moreover Mongodb has better time r/w than typical RDBM. I recommend hereby to use as simple as possible solution, if there is no need of using specific product. At least look at this side, how fast you create and expose this api for me it was a 15-20 minutes.

Comments: When you are creating MongoDB model, it should represent a specific view of our data, it’s very helpful and required. In this example there is no need to add relation at this two models, Speaker.cs and Presentation.cs.

Interviews – How to be not rejected ?

This post is about my experience with job interviews. Two months ago I have started looking for a job. As you know there is plenty of job offers for .NET Developer, but in the beginning I decided to reject working in big corporation, and focus at small / medium companies. I have participated in six interviews till this moment (15 May 2013).

Ardua prima via est!

My first interview was quite good and it was leaded by owner. My friend has recommended this company. There is 10+ developers. First minutes was terrible because I had been a little nervous but after few minutes I was relaxed. There wasn’t any test.

The first meeting where I had to pass test was a small company with department in other city. This time, before we met I had invested my time to prepare, unfortunately even with preparation I had got stressed Damn it! After presentation I had to pass a skill exam, but what was great we just had discussion about problem described on paper. There wasn’t need of writing code in a paper.

The worst interview was few days ago, I got call and immediately I decided to meet up in same day. I wanted to check how it goes without any preparations, and it went wrong! Don’t do it! Always schedule your interviews at least one week ahead. 

In six meetings I had to do three skills exams, so if HR or recruiter will call to you. Remember to ask him/her if there will be skill exam, because it’s the most important case! Prepare properly your knowledge
For basic and some intermediate issues try : C# 5.0 in a Nutshell, 5th Edition. Moreover you should know answer to this questions. Now I will list me skills question that I got.

  • Interfaces of LINQ.
  • Basic usage of LINQ.
  • Basic SQL queries (PL/SQL, T/SQL).
  • Difference between abstract class and interface.
  • What is interface.
  • Difference between ref and out.
  • What new technologies came up in .NET 3.5.
  • What is order of calling virtual methods.
  • Write a method that reverse string backwards.
  • Enum
  • Factory Pattern
  • How works MVC

In conclusion, here I am a little wiser than two months ago, so to the next interview I will focused on this next things :

  • More preparation in basic aspects of language
  • Practise with someone, it’s a great opportunity because it shows you “if I understand what I’m talking about? ” Let’s assume that you are talking about some kind of project, and your partner asks you what is mean that you use “abstract class”, or tell me what is “ORM”. Moreover it’s potential questions that you can get in interview
  • no more interview on the front of white board!! and writing the code on it. I get stressed and I forget about everything…
  • Schedule meeting at least one week ahead.

Deploy from external repo

tl;tr; Deploy from external repo on MS Azure

Few days ago I was on a Global Windows Azure Bootcamp,We had few sessions, one of those session was lectured by @mpraglowski, he showed us this wonderful feature. What if we want to deploy our website on each git push without any extra action on our server ? With help come Azure Web Sites.

First, create new web site by choosing New -> Compute -> Web site-> Custom createcreatewebsite_0

Next step will be, fill out these boxes. Important is that to check box “Publish from source control”.
createwebsite_1

Third step is to choose which service we want to use (Bitbucket, TFS, Github etc.)

screatewebsite_2

In final step of creating web site, we choose repository that will be use.

createwebsite_3

If there is no error we should see deploy with a green header like in this picture. Azure has a nice feature, we can freely manage which git push we want on our website any time. Let’s imagine that you push commits but something don’t work exactly how you assumed. You can change to early version of deploy just clicking on it and clicking “redeploy” on bottom of website

createwebsite_4

Windows Azure Developer Challenge

Quick info! There is a event which is already running, but there is still chance to get a prize, event is named “Windows Azure Developer Challenge” we pass through five steps. On each step we have chance to get 64GB Surfece (for US citizen) or cash equivalent for (2,1k $, outside US). Organiser of this event is codeproject, over 16.000$ is to give away so go register ourselves!

@Edit: First stage was extended for a week!