0 Comments

For the previous (and latest) release of Indian Cinema UK app for Windows Phone 8.1, I wanted to display the Film Info in a Hub, but the screen estate to look like the Bing Apps on Windows Phone. I got this inspiration from Amar’s blog post.

But, having done it, there was a problem. There was a margin on the left and because I was displaying the film poster, it looked odd. I wanted the film poster to look flushed left.

Being new to Hub control, I thought it was the 1st Hub Section adding some kind of margin, so I tried a negative margin with a guessed value. This did not work. So, I wanted to inspect the Xaml Visual Tree to find out

  1. which control was contributing the left margin
  2. how much margin was being set

And to do this, XAML Spy came to help. This incredible piece of software shows the visual tree, rather than having to guess the complex XAML rendering behaviour.

Turns out that a default margin is added by the Hub control for all the Hub Sections and the value is 19 as shown below.

xamlspy-flush-left

 

Having discovered that, I then set the margin for the Hub control and here is how it appears now.

wp_ss_20140709_0001

0 Comments
Given a SSH only GIT Repo, was unable to git clone the repo, despite my public key being successfully stored in the remote repo's authorization_keys file. The git clone command invoked from within the git bash kept prompting for password, but could not authenticate for some bizarre reason. Thought it could be some proxy issue. But no, was able to ping successfully to the server hosting the git repo. Then came the saviour. Pageant.exe, which gets installed when PuTTy SSH client gets installed in windows. Pageant runs on the system tray and serves like a vault of .ppk keys. After adding my ppk to it, was able to successfully connect to the server using putty. Then I thought git clone will also work. But No. Apparently an environment variable GIT_SSH pointing to plink.exe (found within the putty installation directory) is needed. After adding that, I was able to git clone the repository without it prompting me for a password. So, in summary here are the steps:
  1. Install Putty (via Windows Installer to get all the tools in one go)
  2. Use PuttyGen to create a private/public key pair.
  3. Send the public key to the remote Git repo administrator so that it can be added to the ~/.ssh/authorization_keys file
  4. Once that is done, Run Pageant.exe (found in Putty installation directory. Mostly C:/Program Files (x86)/Putty)
  5. Right-click on the system tray of Pageant to view the keys and add the private key generated using PuttyGen
  6. Install Git for Windows
  7. Run Git Bash
  8. Navigate to the Putty installation folder (eg. $ cd "c:\Program Files (x86)\Putty)
  9. To test if the Pageant is working fine, execute the command $putty git@servername:gittreponame.git
  10. This will login you to the git server where you can $ cd ~/.ssh to see the authorization_keys file. If curious, to open it, use $cat ~/.ssh/authorization_keys and one of the keys in that would be your public key
  11. Now try $git clone git@servername:gittreponame.git and it might prompt you for a password. I tried to use the password associated with my private key, but did not work. Hence the following steps.
  12. Add GIT_SSH environment variable in Windows. The value for this should be the path to plink.exe which will normally be in the Putty installation folder.
    git_ssh 13. Then try $git clone git@servername:gittreponame.git and it should start the cloning without any prompts.  

0 Comments
My friend wanted to get started with using Foundation for an upcoming Greenfield project. The trouble is Foundation comes in two flavours:
  • Foundation3 with default CSS
  • Foundation3 with SCSS (Sassy CSS, which is the syntax used by SASS – "Syntactically Awesome Style Sheets". SASS is an extension of CSS3 which brings familiar programming concepts to CSS like variables, nesting of selectors, functions aka mixins)
While "Foundation3 with default CSS" can be perfectly used to take advantage of Foundation's amazing features, using "Foundation3 with SCSS" was thought of a natural way to learn and build websites with SCSS. But, the problem is "Foundation3 with SCSS" does not come as an executable installer for Windows. It is packaged with a CSS Authoring Framework called "Compass". For a start, Compass contains re-usable cross-browse CSS mixins, which in itself is a good utility. There are other advantages in using Compass too. The Compass framework does not have a Windows Installer. It is only available as a Ruby Gem package, which means we have to install Ruby for Windows first. After this, we follow the following steps to get Compass with Foundation: Start Command Prompt with Ruby (Run as Administrator) Execute the command to install the "Compass with Foundation" package NOTE: If gem install throws an ECONNECTION related error, it would mostly to do with the command prompt unable to connect to internet and this could be because the computer may be behind http proxy. In such cases, refer to gem documentation on how to use it with –http-proxy option. Create a new Compass website called "Peakbyte.Web" This creates the following folder structure The detailed structure is better revealed when we open this website using WebMatrix2 The _settings.scss file contains all the commonly used variables in Foundation. The web developer/designer can either re-use these in their own SCSS by uncommenting the bits as needed. The app.scss file imports the _settings.scss file and the complete foundation module as shown below The app.scss is the main SCSS file. This needs to be processed by the SASS pre-processor to produce stylesheets/app.css which is the CSS file referenced in index.html So, how does the .scss get processed to .css files? By running the following command, the compass SASS pre-processor will continuously watch for any changes done to the .scss files in the "Peakbyte.Web" folder. If it detects any change, it will process the .scss files and re-generate the stylesheets/app.css file. So, all that is pending is to learn how to write SCSS and make use of Foundation and Compass modules/features.

0 Comments

I had promised my students that we would implement a “Find nearest XXXX” feature in our on going project. I was doing this for the first time and thought it would not be difficult. But, most of my time while preparing for the class, I was frustrated.

I could not come up with a WCF Web Service (hosted on Visual Studio’s development web server eg., http://localhost:1234/MyService.svc ) that could be invoked by Javascript on my website (hosted again on Visual Studio’s development web server eg., http://localhost:9876/MyWebsite/Default.aspx ).

Due to time constraints, I abandoned the WCF Service implementation and went in for the ASP.NET Ajax Page Methods

It’s only after reading this nice article, I understand the mistake I made or the way the cross-domain web requests work.

Mash-it Up with ASP.NET AJAX: Using a proxy to access remote API

2 Comments
Here is a tip I discovered today while at work. I had earlier postponed the addition of common columns needed for all the tables (columns needed for auditing purposes like AddedDate, AddedBy etc.). But, the time had come now to type in and set the properties for columns on all tables one by one. I finished adding these columns to the first table. When on the second table, my laziness kicked in and wanted an easier way to do this mundane task. So,
  1. Opened the design of table1 using SQL Server Management Studio.
  2. Selected the last 4 columns.
  3. Ctrl+C.
  4. Opened the design view of table2
  5. Ctrl+V
And there it was, all the columns along with the properties replicated in a jiffy!