Jul 30 2010

iPhone 3.0G and iOS 4

Category: .lolAmit Bahree @ 10:27 am

The wife has one of these and can absolutely relate to this! Smile

Tags:


Jul 28 2010

Microsoft’s Street Slide

Category: .geekAmit Bahree @ 6:22 pm

This is quite cool – now only if MS hurry’s up and incorporated this to Bing Maps.

MS Street Slide

Tags:


Jun 28 2010

Upgraded to WP 3.0

Category: .misc,UncategorizedAmit Bahree @ 11:00 pm

Just upgraded the blog to WordPress 3.0 – two clicks and I was done – can it get any simpler? What a pleasant surprise compared to the pile of crap that CS 2007+ turned out to be. Try upgrading that in something like two clicks? Ha! Well done WordPress!

Tags:


Jun 25 2010

Interesting Find #22

Category: .linksAmit Bahree @ 8:01 am

Next post in the interesting find series.

  1. Speccy – an advanced and very cool System Information tool for your PC.
  2. Channeling Earth – Rivers Seen From Space
  3. The SSD Relapse – Understanding and Choosing the Best SSD
  4. Turn off laptop screen – every machine does not have an option to switch off the screen (say at night) and this small app is perfect for those situations – very handy at night.
  5. How to save and share ridiculously large files – well the name says it all. :)
  6. SQL Server I/O Internals – if you wanted to know how SQL Server handles I/O then this is a very interesting read.
  7. Clustered Tables vs Heap Tables – interesting to understand the comparisons in SQL Server (especially if/when you will be dealing with SQL Azure).
  8. Cloud Computing footprint – is it time we started measuring our digital footprint just the same as we have our carbon footprint?
  9. Zettabytes – Petabytes is so yesterday; hello Zettabytes! I wonder how one indexes that?
  10. Let me Google that for you – perfect for when you get a question from a few lazy people.
  11. Let me Bing that for you – same as above, except this uses Bing.
  12. 15 RDP Solutions for Linux – good write up comparing the various options you have if you want to RDP to Linux from Windows/Mac.
  13. Ninite easy PC Setup – Install multiple apps at once without toolbars or clicking Next. Quite handy if you have less-technical friends/family. :)

Tags:


Jun 21 2010

What we have learned …

Category: .miscAmit Bahree @ 7:08 am

… the average wife spends nearly 8,000 minutes a year nagging her husband!

Tags:


Jun 20 2010

Hardware Chart

Category: .geekAmit Bahree @ 7:15 pm

This computer hardware chart is quite cool. Not sure why, where and who would want to use this. But, it does beg the question – can things get any geekier? :)

907479120_5ZgiC-S[1]

Tags:


Apr 18 2010

invalid use of incomplete type ‘blah’

Category: .codeAmit Bahree @ 9:21 pm

When you try and compile some code and you get an error along the lines of invalid use of an incomplete type ‘whatever type’ then in most cases it means you need to include the header file where that type is displayed.

For example I had the following events in my header file:

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

When when I tried to compile gave the following error:
invalid use of incomplete type ‘struct QGraphicsSceneMouseEvent’

This was because the compiler could not find details of the struct and hence the details. To fix the problem I need to include the header.

This of course is similar to the initialized but not complete error but subtly different.

Tags:


Apr 16 2010

Free eBook on SQL Server 2008 R2

Category: .booksAmit Bahree @ 6:44 am

Microsoft is giving away a free eBook on SQL Server 2008 R2 for free. It gives you insight into exciting new implementations in the DB such as complex event processing (CEP) and StreamInsight. You can check out the Table of Contents here and download the book in either pdf format or xps format.

Tags:


Apr 09 2010

Pixels

Category: .lolAmit Bahree @ 5:11 pm

Pixels is Awesome! Any self righteous geek has to check this out. :)

Tags:


Apr 08 2010

Free (technical) Microsoft Courses

Category: .microsoft,.ms.futureAmit Bahree @ 9:38 pm

Channel 9 has a number of free technical courses on a number of emerging MS technologies covering a wide range such as Azure, Win7, Identity, SQL Server 2008 R2, Visual Studio 2010, .NET 4.0, Silverlight 4, MOSS 2010, Office 2010, etc.

These cover a number of the features and essentially have everything to get a developer quite comfortable with the stack. In some areas they go a little deep as well. I think its an excellent way to come up to speed.

Here is a quick example of the topics covered in some of the tracks:

  • Win7 – how to use the Taskbar, Multitouch, Ribbon, Sensors and Location, Session 0 Isolation, etc.
  • Azure – Azure Overview, Azure Storage, Deployment, SQL Azure, etc.
  • VS 2010 and .NET 4 – F#, ASP.NET 4, Parallel Computing, ALM, etc.

Tags: ,


Apr 05 2010

Finding an element in a list

Category: .codeAmit Bahree @ 3:17 pm

Often you need to search through an array or list to find a specific element and of course you need this search to be as fast and efficient as possible. One of the best ways to do this is using a binary predicate function.

A binary function is a function object (which are also called Functors) and is any object which can be called as if it was a function. Depending on your language and platform of choice, Function objects are also known as callback functions, function pointers and delegates (.NET). Generally, there are three types of function objects:

  1. Generators – function with no arguments
  2. Unary Functions – function with one argument
  3. Binary Functions – functions with two arguments

A function object which takes one parameter (i.e. unary function) and returns a bool are treated as a special case and are  called Predicate functions.

How do we use it? Say we have a simple data structure called ContactData to represent a Contact in an Address book as shown in the code snippet below. We also define a predicate function called FindAContact. Now we need to use this predicate function and define another function called  findContact. The findContact function in turn uses find_if.  find_if takes three parameters, the start of the iterator, the last element and the predicate to use. It returns the first iterator it finds in a given range for which the predicate holds. If no matches are found then  the last element in the iterator is returned.

We also need to ensure we have the relevant includes for this to compile and link properly hence include’s below.

The code snippet below shows all that we have discussed.

#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

//Simple data structure
struct ContactData {
	string name;
	string addr1;
	string addr2;
	string addr3;
	string city;
	string postcode;
	string country;
	int workPhone;
	int homePhone;
	int mobilePhone;
	string workEmail;
	string homeEmail;
};

//I am lazy, create a typedef for the vector
typedef vector<ContactData> ContactDataArray;

// predicate function for rapidly searching the Contact data array
struct FindAContact: public std::binary_function<ContactData, std::string, bool>
{
	bool operator() (const ContactData &contact, const string &name) const
	{
		return (contact.name == name);
	}
};

//If a contact is find it returns that; else returns the iterator's last element
ContactData Contact::findContact(string name)
{
	ContactDataArray::iterator it = find_if(addressBook.begin(),
						addressBook.end(),
						std::bind2nd(FindAContact(), name)
					);

	return *it;
}

Tags:


Apr 04 2010

Deleting folder on Linux

Category: .opensourceAmit Bahree @ 7:31 pm

If you are a newbie to Ubuntu like me (or any other Unix distro) and you tried deleting a folder which is not empty contains files or subdirectories then you get the annoying error “Directory not empty”.

To delete such a folder (from a terminal) use the rm -rf command. For example to delete a folder called amitbahree run the following:

rm -rf amitbahree/

Tags:


Next Page »
Get Adobe Flash playerPlugin by wpburn.com wordpress themes