Sunday, September 28, 2014

Bookmarks - 1

Some of my recent searches over the internet are as follows,
  1. Introduction to Graphs: Definitions, Traversal, Depth-First Search - CodeChef Discuss
    A very conceptual topic that every programmer at least skim through once (although just skimming doesn't give you any fruits).
  2. NPTEL PHASE 2 - Courses
    Something that should be taken as a online course by every single data-structures learner.
  3. Computing Factorials of a huge number in C/C++: A tutorial - CodeChef Discuss
    Huge number case study for those who are curious how these BigInt and other number manipulation libraries are build.

Friday, September 26, 2014

Surfing Windows Like Webpages

From last few days, I'm trying to find the square hole for this square peg. Windows compatibility for its own development platforms is disgusting.
It all starts from here,
If you need to do little programming for evaluation purposes you need an express edition. Okay I see you got express edition there, it is free for use but please register it. Okay you've registered it too? Good.
If you need to do Windows 8/8.1 metro app development, you probably need higher versions of Visual Studio. Got higher version? Okay you can't do everything anymore on your Windows 8. Switch to Windows 8.1 it is really free, just install all the updates from Windows Updates. Got updates? Sorry for inconvenience but you really need to restart your PC. Back? You got a few more updates. Okaynowtellmewhatnext? It is "you need to install these updates to get your free update of Windows 8.1". Installed? Congratulations, you can download the free upgrade now. Downloading? Nope "unfortunately Windows Store app doesn't work very fine in Windows 8".
And if you even get the upgrade to Windows 8.1 (I don't know how). There are a lot of device issues in it and still filed as undocumented bugs in it.
The measure of last resort is always Windows 7 for me. But idon'tknow why I switch the operating system again, wait I tell why, I need to develop apps because that's what I am, a desperate app developer. (Windows 7 doesn't support Windows Phone development).

Saturday, September 13, 2014

C#: How to Save Image from a Canvas

So recently I've been working on this Windows Phone app so hard that I hardly get time for myself and blog some fishes here. But now I am talking with my blog I'm talking about the same thing I've been doing since 5 days (nights included too).
I was actually trying to save some image from the screen, more of a screenshot but in a programmers way. I was searching for a lot of XAML tags and studying about them like DrawingSurface and every frigging tag that looks like something that can be sixth sensed and categorized into something imagery (save an image I meant). In the meantime I find this life saver Canvas and now its all vanished. All my dark problems inside me pouncing upon each other to hike through my wind pipe out into the fresh air are now gone.
Here is the code.

Wednesday, August 27, 2014

Learning

So far I've learned so much from +Bob Tabor, I'm thankful to him for each and every series I watched (JS fundamentals, C# fundamentals, WP8 fundamentals). Feeling so enthusiastic after learning new technologies that I've cooked some basic applications in the fields. Looking forward to build something bigger. All I need is a little more time.
Happy learning!

Saturday, August 23, 2014

Summers

It's been a long time since I wrote something that is actually about me. Well, here I am spending my summer vacations quite in the way I planned in last semester (huh! what a bad time it was). I actually planned a lot of things to do in summers but I always plan more than I can do so that I do more and more. I am watching movies (a lot), television series, playing games, learning a few things. Recently a lot of people (mostly juniors) have asked me what to do best in summers so that at the end you don't regret that you wasted whole a lot of time doing nothing. I told all of them, "do what needs to be done." Really you should go with your heart. You want to play games? Play them like day and night (literally only stop to eat). You want to go on a tour to some northern areas? Go far away from north. But at the end you shouldn't regret. Regrets are something you keep regretting your whole life.
What I am doing right now?
Well, I am watching Game of Thrones (nearly ended), The Strain and I wish I could mention The Big Bang Theory (God, I miss that badly.)
I am learning C# from learnvisualstudio.net (a video lecture series compiled by Bob Tabor, really a good one for absolute beginners).
I am reading some books to cover the old topics from data structures course and discrete mathematics.
I plan to hit a game in future (in some days) before I leave for Karachi (still planning).

Thursday, August 7, 2014

The `override` Keyword in C++11

Since C++11 has been released, a lot of new things are added in newer versions of working draft (available at http://www.open-std.org/jtc1/sc22/wg21/). Recently I've come to know about the `override` keyword (which is not actually a `keyword` but an identifier with a special meaning).

A very good description with code example is given in this link below,
http://stackoverflow.com/questions/18198314/override-keyword-in-c

Key points are,
  1. Works with virtual functions.
  2. The identifier `override` makes sure that the base class has the same function signature if you write override specifier after some virtual function in derived class.
  3. Quoting working draft C++11 N3242 (published on 28-Feb-2011),
    If a virtual function is marked with the virt-specifier override and does not override a member function of a base class, the program is ill-formed.

Initializing a Constant Pointer

A little off-road but still something was whispering in my head, "can you initialize constant pointer pointing to constant pointer pointing to constant pointer pointing to an integer constant?". Well why not.
Trick was just to send initialized pointers into initializer of previous pointers.
Normally you don't need this scenario. Though creating constant pointers and putting a lot `const` specifiers in a pointer declaration makes the pointer `safe` to be manipulated.

What if you need to initialize an array if you've the same pointer declared. It can be way more tacky and might result into `impossible`.
You can simply declare a pointer and pass it to the function where the parameter is accomplishing all that safety you require from some critical section you want your pointer to stay safe in.
For example,