Must-Know Visual Studio Keyboard Shortcuts

Here, I will give you a short list of keyboard short-cuts for things you probably do often in Visual Studio.

Visual Studio Keyboard Shortcuts

Project Related Keyboard Shortcuts

  • Ctrl + Shift + B = Build your project
  • Ctrl + Alt + L = Shows Solution Explorer
  • Shift + Alt + C = Add new class
  • Shift + Alt + A = Add new item to project

Editor Related Keyboard Shortcuts

  • Ctrl + Enter = Insert blank line above the current line
  • Ctrl + Shift + Enter = Insert blank line below the current line
  • Ctrl + Space = Autocomplete using IntelliSense
  • Alt + Shift + arrow keys(←,↑,↓,→) = Select custom part of the code
  • Ctrl + } = Match curly braces, brackets
  • Ctrl + Shift + } = Select text between matched braces, brackets
  • Ctrl + Shift + S = Saves all files and projects
  • Ctrl + K, Ctrl + C = Comments the selected lines
  • Ctrl + K, Ctrl + U = Uncomments the selected lines
  • Ctrl + K, Ctrl + D = Do proper alignment of all the code
  • Shift + End = Select the entire line from start to end
  • Shift + Home = Select the entire line from end to start
  • Ctrl + Delete = Deletes the word to the right of the cursor

Navigation Related Keyboard Shortcuts

  • Ctrl + Up/Down = Scrolls the window without moving the cursor
  • Ctrl + – = Take cursor to its previous location
  • Ctrl + + = Take cursor to its next location
  • F12 = Go to definition

Debugging Related Keyboard Shortcuts

  • Ctrl + Alt + P = Attach to process
  • F10 = Debug step over
  • F5 = Start debugging
  • Shift + F5 = Stop debugging
  • Ctrl + Alt + Q = Add quick watch
  • F9 = Set or remove a breakpoint

Search Related Keyboard Shortcuts

  • Ctrl + K Ctrl + K = Bookmark the current line
  • Ctrl + K Ctrl + N = Navigates to next bookmark
  • Ctrl + . = If you type in a class name like Collection<string> and do not have the proper namespace import, then this shortcut combination will automatically insert the import
  • Ctrl + Shift + F = Find in Files
  • Shift + F12 = Find all references
  • Ctrl + F = Displays the Find Dialog
  • Ctrl + H = Displays the Replace Dialog
  • Ctrl + G = Jumps to the line number or go to the line
  • Ctrl + Shift + F = Find the references of the selected item in the entire solution

BSNL to set up 40,000 Wi-Fi hotspots

Public sector telecom major BSNL said it is working on setting up 40,000 Wi-Fi Hotspots in the country to counter its inadequacy in providing 4G data services.

“We are at present neither a 4G service provider, nor do we have the relevant spectrum to launch this service. But to deal with this challenge, we are working on a scheme to set up 40,000 Wi-Fi Hotspots in the country, as it (Wi-Fi Hotspot) is faster than 4G services,” BSNL CMD Anupam Shrivastava told reporters.

Shrivastava said under the scheme, 500 Wi-Fi Hotspots have been set up in the country, and the company plans to increase them to 2,500 in the current financial year.

He apprised that in order to improve its telecom service, the BSNL would be setting up around 25,000 mobile towers in the country, with an investment of Rs 5,500 crores.

Print selected webpage data using Javascript

Many times we would like to place a button on webpage to print the content of that web page via an actual printer. JavaScript helps you to implement this functionality using the print function of window object.

The JavaScript print function window.print() prints the current web page when executed. You can call this function directly using the onclick event and also set which portion would be printed.

See the Example as below :

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript">
            function printthis() {
                var printthis = document.getElementById('printthis');
                var popupWin = window.open('', '_blank', 'width=1000,height=600');
                popupWin.document.open();
                popupWin.document.write('<html><body onload="window.print()">' + printthis.innerHTML + '</html>');
                popupWin.document.close();
            }
        </script>
    </head>
    <body>
        <div>
            Other contents
        </div>
        
        <div id="printthis">
            <div>
                Print this portion
            </div>
        </div>
        <div>
            <input type="button" value="print" onclick="printthis();" />
        </div>
    </body>
</html>

 

sometimes we want some portion of the page need to be print not a whole page,as per above example set id or class to portion which need to print (here #printthis).
when javascript function call on onclick then this function prints part of page which having data within #printthis div.

Flipkart : first Indian app to cross 50 million install

Flipkart recently announced that its Android app had crossed the 50 million installs landmark on the Google Play Store in the first week of February 2016. With a rating of 4.2 it is currently ahead of its competitors Snapdeal and Amazon which both have a rating of 4.1. Flipkart is now the first Indian app across all genres including- communication, social, entertainment, to cross the 50 million install benchmark.

The company launched its android app in Sep 2013 and has achieved the feat in less than 30 months.

A SimilarWeb report ranked Flipkart as India’s number one shopping app with 47% of the share of visits. The report also stated that the combined traffic share of Flipkart and Myntra stood at 63%. Amazon was in the third position with 15.86% followed by Snapdeal with 13.84%.

The Morgan Stanley report on ‘E-commerce in India for 2016’ placed Flipkart as the number one e-commerce company in India with a dominant market share of 45%. According to the report, Flipkart’s market share of 45% is equivalent to the combined market share of the next three players (Snapdeal, Amazon and Paytm).

Truecaller : Third-party apps use caller profiles for verification

Truecaller has launched a user verification SDK (Software Development Kit) for third-party apps which will allow apps to verify users based on their information with Truecaller. As of now the SDK is only on Android and is available to registered third party apps on that platform.

The company has partnered with 12 Indian apps including Quikr, Mobikwik, redBus, CarDekho, BharatMatrimony.com, ixigo, OYO Rooms, TO THE NEW Digital, FreshMenu, Terraa, Cash Care and ShopClues. TrueSDK will help users utilise their Truecaller credentials to log in to third-party apps and verify their phone numbers. TrueSDK is also free for developers to use and has no plans to charge them for the service any time soon.

The company, which generates revenue only from premium subscriptions, is also planning a lot of partnerships to increase their consumer base. Currently, Truecaller has partnerships with Airtel, Tata Docomo, Gionee, Obi, Celkon, Micromax, Microsoft, Cyanogen among others.

How to Secure Cookie in PHP using Session

An alternative way to make data accessible across the various pages of an entire website is to use a PHP Session.session creates a file in a temporary directory on the server where registered session variables and their values are stored. This data will be available to all pages on the site during that visit.

But now you want to set permissions on these session variables or values to accessing on other folder or page.for this you want to set the session cookie parameters.

Set the session cookie parameters PHP have function:

session_set_cookie_params();

 

Parameters :

lifetime – Lifetime of the session cookie, defined in seconds.
path – Path on the domain where the cookie will work. Use a single slash (‘/’) for all paths on the domain.
domain – Cookie domain, for example ‘www.example.com’. To make cookies visible on all subdomains then the domain must be prefixed with a dot like ‘.example.com’.
secure – If TRUE cookie will only be sent over secure connections.
httponly – If set to TRUE then PHP will attempt to send the httponly flag when setting the session cookie.

void session_set_cookie_params ( int $lifetime [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]] )

 

Example :

if (ini_get("session.use_cookies")) {
    session_set_cookie_params(0, '/abc/xyz/', '', false, true);
}

In above example says now values of cookies that will be created anywhere inside the page of abc/xyz folder will be accessable only inside abc/xyz folder not in other folder present anywhere on server.

This function has not returned any value and you need to call session_set_cookie_params() for every request and before session_start() is called.

Get the session cookie parameters :

To get the session cookie parameters PHP have function

session_get_cookie_params();

Returns an array with the current session cookie information, the array contains the following items:

lifetime – The lifetime of the cookie in seconds.
path – The path where information is stored.
domain – The domain of the cookie.
secure – The cookie should only be sent over secure connections.
httponly – The cookie can only be accessed through the HTTP protocol.

Example :

if (ini_get("session.use_cookies")) {
    $params = session_get_cookie_params();
}

$params returned array with 5 parameters as listed above.

MySQL Transactions

MySQL transactions can be used when you want to make sure all the statements you specify are executed. Only the tables of InnoDB storage engine support transactions.

In a transaction, if at least one statement fails, all the changes will be rolled back and database will be in its initial state.

In web applications, it’s common that you want to either run set of statements or do no change since success of only few statements can cause data corruption.

Think you need to add data in 2 tables

$query1 = INSERT INTO `users` (`id`, `first_name`, `last_name`) VALUES (1, 'test', 'user');

$query2 = INSERT INTO `profile` (`pid`,`id`, `gender-`, `mobile`,`email`) VALUES (1, '1', 'male','123456789','test@example.com');

Here you can see in second query gender field having speeling mistake, hence no data will be added for this operation and data from first query will be inserted successfully.When running these two statements, think that second one fails and first one succeeds.

If we ran these two statements in a MySQL transaction, if the second statement fails then the first statement will be rolled back making no changes.

In PHP, we can execute a transaction using MySQLi functions like below.

/* Change database details according to your database */
$dbConnection = mysqli_connect('localhost', 'root', 'username', 'db_name');

mysqli_autocommit($dbConnection, false);
$flag = true;

$query1 = INSERT INTO `users` (`id`, `first_name`, `last_name`) VALUES (1, 'test', 'user');

$query2 = INSERT INTO `profile` (`pid`,`id`, `gender-`, `mobile`,`email`) VALUES (1, '1', 'male','123456789','test@example.com');

$result = mysqli_query($dbConnection, $query1);

if (!$result) {
    $flag = false;
    echo "Error details: " . mysqli_error($dbConnection) . ".";
}

$result = mysqli_query($dbConnection, $query2);

if (!$result) {
    $flag = false;
    echo "Error details: " . mysqli_error($dbConnection) . ".";
}

if ($flag) {
    mysqli_commit($dbConnection);
    echo "All queries were executed successfully";
} else {
    mysqli_rollback($dbConnection);
    echo "All queries were rolled back";
}

mysqli_close($dbConnection);

When you execute mysqli_query() function, result is immediately committed to the database. Using mysqli_autocommit() function, you can turn off this behavior so that result won’t be committed to the database permanently till you command.

After that we simply execute the necessary statements and set the $flag to false if any statement fails. If there are many statements to run, consider storing the statements in an array and using a for or foreach loop.

At the end, if flag is true (no error has occurred), we commit the results to the database permanently using mysqli_commit(). Else we roll back the results using mysqli_rollback() function.

If you ran above PHP script, you would notice that no statement is executed since the field name gender having spelling mistake.While transactions will help you to eliminate data corruptions in programming level.

Slicebox : A fresh 3D image slider

Slicebox is a jQuery 3D image slider plugin that makes use of CSS 3D Transforms and provides a graceful fallback for older browsers that don’t support the new properties.

With the CSS 3D Transforms we can create some neat effects by transforming elements in three-dimensional space. Slicebox makes use of the 3D transforms properties and allows different kind of effects. The main idea is to create three-dimensional image slices that will rotate and reveal the next image as another side of the 3D object. In case the browser does not support 3D transforms, a simple slider will be used as fallback.

How to Use ?

In order to use Slicebox, put your images in an unordered list with the class “sb-slider”:

<ul id="sb-slider" class="sb-slider">

    <li>
        <a href="#" target="_blank">
            <img src="images/1.jpg" alt="image1"/>
        </a>
        <div class="sb-description">
            <h3>Creative Lifesaver</h3>
        </div>
    </li>

    <li>
        <img src="images/2.jpg" alt="image2"/>
        <div class="sb-description">
            <h3>...</h3>
        </div>
    </li>

    <li><!-- ... --></li>
    
    <!-- ... -->
    
</ul>

 

You can use the div with the class “sb-description” to add any kind of description for the respective image. As shown in this example, you can also add an anchor around the image.

Then you can call the plugin with:

$('#sb-slider').slicebox();

Options

$.Slicebox.defaults = {
	// (v)ertical, (h)orizontal or (r)andom
	orientation : 'v',

	// perspective value
	perspective : 1200,

	// number of slices / cuboids
	// needs to be an odd number 15 => number > 0 (if you want the limit higher, 
	// change the _validate function).
	cuboidsCount : 5,

	// if true then the number of slices / cuboids is going to be random (cuboidsCount is overwitten)
	cuboidsRandom : false,

	// the range of possible number of cuboids if cuboidsRandom is true
	// it is strongly recommended that you do not set a very large number :)
	maxCuboidsCount : 5,

	// each cuboid will move x pixels left / top (depending on orientation). 
	// The middle cuboid doesn't move. the middle cuboid's neighbors will 
	// move disperseFactor pixels
	disperseFactor : 0,

	// color of the hidden sides
	colorHiddenSides : '#222',

	// the animation will start from left to right. The left most 
	// cuboid will be the first one to rotate
	// this is the interval between each rotation in ms
	sequentialFactor : 150,

	// animation speed
	// this is the speed that takes "1" cuboid to rotate
	speed : 600,

	// transition easing
	easing : 'ease',

	// if true the slicebox will start the animation automatically
	autoplay : false,

	// time (ms) between each rotation, if autoplay is true
	interval: 3000,

	// the fallback will just fade out / fade in the items
	// this is the time fr the fade effect
	fallbackFadeSpeed : 300,
	
	// callbacks
	onBeforeChange : function( position ) { return false; },
	onAfterChange : function( position ) { return false; }
};

 

For more details and example visit www.tympanus.net/codrops

FreeCharge aims for 7 million transactions a day by end of 2016

Digital payments platform FreeCharge announced that it is on its way to achieve 7 million transactions a day by end of 2016. Currently, the company is recording one million transactions a day. Soon after the wallet launch, the company also introduced new categories like bill pay and metro recharge.

Recently, FreeCharge also launched the Freecharge Go Card in association with MasterCard, which enables customers to use the wallet on all online stores in the country. The Freecharge Go card is said to have seen over half a million cards issued within 10 days of its launch and customers are actively using it on e-commerce portals, to pay for movie tickets, book event tickets, and for commute, such as cabs.

Chief Operating Officer FreeCharge said, “We are focused on creating the digital habit. At FreeCharge, UI is super important. We want to make sure all transactions are completed within 10 seconds. And this focus on stickiness has paid off.  75% of our customers are repeat customers. The milestone of 1 million has been achieved in just 4 months since launch. We are confident at this rate of growth and stickiness we will cross 7 million transactions a day by the end of the year”.

FreeCharge has also announced that ‘FreeCharge Wallet’ crossed 10 million registered active users. FreeCharge Wallet is a service that is actively being used by customers for recharge and utility bill payments.

Samsung to start rolling out Android 6.0 Marshmallow to Galaxy devices

Samsung has announced it will bring the latest flavor of Android to its devices. The company said Android 6.0 Marshmallow update has started rolling out to Galaxy S6 and Galaxy S6 edge, followed by other Galaxy devices. The new update starts rolling just a week ahead of Samsung’s Unpacked event wherein it is expected to launch the new flagship devices.

So, if you are an owner of the Galaxy S6 or Galaxy S6 edge, the update should be coming to you soon. The roll out is expected for other Galaxy devices soon. There is no time frame or mention of which other models in the Galaxy series will be getting the update. For up gradable models, the company is expected to make separate announcements on details of OS updates for each market depending upon the market situation and carriers’ requirements.

Samsung says, “With the Android 6.0 Marshmallow update, Samsung provides the enhanced edge screen and new edge screen features, which are the unique user interface of the beautifully curved edge screen to the next level, making it faster and more convenient than ever.

Google’s Android 6.0 Marshmallow brings new features such as the new Google Now on Tap, a predictive assistant.