Archive for September, 2015

If you have just gotten around to installing the all new Windows 10 OS then you should definitely check out the Windows 10 beginner tips and tweak some Windows 10 settingswhile you’re at it. However, if you really want to get a good grasp on this all new Operating System from Microsoft then you need to learn some useful keyboard shortcuts. Fortunately for you, today we bring you the best keyboard shortcuts for Windows 10. Below are the 26 best Windows 10 shortcuts that everyone should learn.

1. Snap A Window (Windows Key + Left/Right/Up/Down Key)

Snap-a-window

Windows 10 brings the all new snapping feature that lets you use multiple windows simultaneously side-by-side. All you have to do is snap the windows in any direction by using the shortcut. This comes in handy when you want to keep an eye on each active window.

2. Activate Cortana (Windows Key + C)

activate-cortana

Cortana is the best addition to Windows 10. It can help you with almost anything that you want on your device. Just use this shortcut to quickly activate Cortana and tell her whatever you want done. She will definitely obey as long as your command is understandable.

3. Record your gameplay (Windows key + Alt + R)

In Windows 10, you don’t need 3rd party screen recorder software to record your gameplay anymore because Windows 10 lets you record all your gameplay videos with just a simple shortcut. Whenever you are playing a game just use this shortcut to record your gameplay so you can share it with everyone later.

4. Open Task Manager (Ctrl + Shift + Esc)

open-task-manager

The good old Ctrl + Alt + Del for opening the task manager has been replaced with this new shortcut If you want to access the task manager on your Windows 10 device then you will have to use this new shortcut from now on.

5. Open Settings (Windows key + I)

Opening the settings menu manually in Windows 10 would take a decent amount of mouse clicks, however, if you’re not a big fan of manual labor then you can just press the dedicated keys for this shortcut and get the Settings right on your screen in a second.

6. Lock your Computer (Windows key + L)

Don’t want to shut down your computer but also don’t want anyone else to access it? Well by using this simple Windows 10 shortcut you can now lock your computer with your password or PIN so nobody can access it but you.

7. Switch between apps (Alt + Tab)

switch-tabs

If you have multiple apps running on your Windows 10 PC then using this shortcut will let you access any of the running apps on your computer without having to click on them individually. This comes in handy when you have a lot of tabs open.

8. Quick Restart (Windows key + X + U + R)

If you’re tired of going to the start menu and pressing the power button and restarting your PC then you are going to love this shortcut because it will quickly restart your Windows 10 PC whenever you want to restart it.

9. Open Search (Windows key + S)

Not a big fan of Cortana? Just want that normal search bar on your Windows 10 PC? Well, just fire up this shortcut to get the traditional Windows search menu and you can search anything locally or on the web without much hassle. It will be still linked to Cortana but you can type instead of speaking.

10. Open Action Center (Windows key + A)

Action-center

Action Center is where all the action happens, well not really but you can access all the toggle buttons and even the full settings from here. Just open up the Action center and you can see all your notifications in there.

11. Take a Peek at Desktop (Windows key + ,[comma key])

When you’re crowded by different active windows and don’t want to minimize each one of them to look at your desktop then you need to try out this shortcut because it will let you take a peek. As soon as you let go off the buttons, you will be returned back to the last active window.

12. Quick Shutdown (Windows key + X + U + U)

If Quick Restart is not what you’re looking for then Quick Shutdown should help you out when needed. Just use this shortcut to quickly shut your Window 10 PC down without having to wait at all.

13. Create New Virtual Desktop (Windows key + Ctrl + D)

The all new virtual desktop feature in Windows 10 lets you create individual desktops for different tasks so that one desktop doesn’t become cluttered with all the different stuff. Using this shortcut will create a new desktop so you can keep doing your work peacefully.

14. Switch Between Desktops (Windows key + Ctrl + Right/Left)

When you create a lot of virtual desktops, you also need a simple way to switch between them all. This simple shortcut will let you browse through all of your create virtual desktops so you can utilize them more efficiently.

15. Quick Access Menu (Windows key + X)

Are you looking for all the different options and features on your Windows 10 device? Well then use this shortcut to get the Quick access menu for most options available on your system. You can even get the task manager from there as well.

16. Open Gamebar (Windows key + G)

This will open up a small bar from where you can take screenshots or even record your gameplays. You can also access the Xbox app directly from this bar. You can take  screenshot by pressing the camera button or record via the Dot button.

17. Close Active Desktop (Windows key + Ctrl + F4)

Creating and switching between virtual desktops is all cool but what happens when you want to close a certain virtual desktop? This little shortcut will help you achieve just that. Get rid of any active desktop you want.

18. Minimize Everything on Windows 10(Windows key + M)

This shortcut simplifies your life and just gets rid of everything on your desktop without actually closing them. All your windows and open tabs will be minimized so you can get on the desktop easily without having to deal with the clutter.

19. Share Charm (Windows key + H)

If you want to share your screenshot that you have taken on your Windows 10 device then Share charm will come in really handy. You can quickly share it via email or just upload it to your OneNote account and share it to your social media channels from there.

20. Open File Explorer (Windows key + E)

Just use this simple shortcut to quickly open the Windows File Explorer so you can browse for your files and folders in different drives on your PC. It will open up the “This PC” folder where you will have access to all the folders on your computer.

21. Open Start menu (Windows key)

This is classic shortcut that has been running for ages in all the Windows iterations. Just hit the Windows key on your keyboard to fire up the start menu and access all the programs on your computer.

22. Open Task View (Windows key + Tab)

desktop

This is similar to switching between active apps but this one will actually show you all your active tabs and all your created desktops. You can manage all of them from here like close some of the virtual desktops or create a few more. You can also handle all the open apps from here as well for each desktop.

23. Take a Screenshot (Windows key + PrntScrn)

You can take a screenshot of your whole desktop on Windows 10 by using this simple shortcut. If you’re only looking for a way to take a screenshot of the current active window then press Windows Key + Alt + PrntScrn,  this will let you only capture the current active window. the screenshot image will be saved on your hard drive.

24. Connect to other wireless devices (Windows key + K)

If you have other wireless devices like a wireless keyboard or a mouse and you want to connect your Windows 10 device to them then just use this shortcut to make the whole process simpler. All the wireless devices will be available in the list so you can connect to them easily.

25. Open Narrator (Windows key + Enter)

narrator

If you want to hear everything that appears on your computer’s screen then you will need the help from the built-in narrator. It will speak out every word that’s available on the screen which comes in very handy for people with eyesight problems.

26. Enable Copy/Paste (Ctrl + C/Ctrl + V) feature in Command Prompt

CMD shortcut

In previous version of Windows, you were not able to use the copy/paste shortcuts in the CMD. This was pretty annoying for many people who had to type everything in the command prompt. However, with the advent of Windows 10, you can now easily use the copy/paste shortcut inside the command prompt. First of all, you will have to enable it from the command prompt setting. Open Command Prompt, right click on the top edge of the cmd window and click Properties, now check “Enable Ctrl key shortcuts”. You can now easily use Ctrl + C/Ctrl + V to copy/paste inside the cmd.

NativeScript is a runtime that lets you build native iOS, Android, and (soon) Windows Universal apps using JavaScript code. NativeScript has a lot of cool features, such as two-way data binding between JavaScript objects and native UI components, and a CSS implementation for native apps. But my favorite feature, and the subject of this article, is NativeScript’s mechanism for giving you direct access to native platform APIs.

It’s pretty awesome, but it can mess with your mind a little. For example, check out this code for a NativeScript Android app:

I’ll give your brain a minute or two to parse this, because yes, thisJavaScript code instantiates a Java android.text.format.Time()object, calls its set() method, and then logs the return value of itsformat() method, which is the string "01/01/15".

 

I’m with you Keanu, but hold on, because the rabbit hole gets deeper. Here’s one more example before we dive into the how this code actually works—this time for iOS:

This JavaScript code instantiates an Objective-C UIAlertView class, sets its message property, and then calls its addButtonWithTitle() andshow() methods. When you run a NativeScript iOS app with this code you’ll see the alert below:

Pretty cool, huh?

One thing I should clarify before we dive into how all of this works: just because you can access native iOS and Android APIs, doesn’t mean NativeScript apps contain only JavaScript-ified Objective-C and Java code. NativeScript includes a number of cross-platform modules for common tasks, such as making HTTP requests, building UI components, and so forth. But that being said, most apps have some need to access native APIs occasionally, and the NativeScript runtime makes that access simple when you need it. Let’s look at how it works.

The NativeScript Runtime

The NativeScript runtime may seem like magic, but believe it or not, the architecture isn’t all that complex. Everything starts with JavaScript virtual machines, as they’re what NativeScript uses to execute JavaScript commands. Specifically, NativeScript uses V8 on Android andJavaScriptCore on iOS. Because NativeScript uses JavaScript VMs, all native-API-accessing code you write, including the code in the examples above, still needs to use JavaScript constructs and syntaxes that V8 and JavaScript Core understand.

Generally speaking, NativeScript tries to use the latest stable releases of both V8 and JavaScriptCore; therefore the ECMAScript language support in NativeScript for iOS is nearly identical to the support in desktop Safari, and the support in NativeScript for Android is nearly identical to the support in desktop Chrome. You can get an idea of what specific ES6 features that includes here.

Knowing that that NativeScript uses JavaScript VMs is important, but it’s only the first part of the puzzle. Let’s return to the first line of code in this article:

In the NativeScript Android runtime, this code is compiled (JIT compiled, technically) and executed by V8. How this works is pretty easy to understand for simple statements like var x = 1 + 2;, but in this case, the next question becomes… how does V8 know whatandroid.text.format.Time() is?

The next few sections focus on V8 and Android for simplicity, but the same basic architectural patterns apply to JavaScriptCore and iOS. Where there are notable differences they will be noted.

I do not discuss NativeScript’s Windows Universal runtime in detail because it’s subject to change, however, the current Windows implementation uses JavaScriptCore much like the iOS runtime does.

How NativeScript manages JavaScript VMs

V8 knows what android is because the NativeScript runtime injects it, because as it turns out, V8 has a whole slew of APIs that let you configure a bunch of things about its JavaScript environment. You can insert custom C++ code to profile JavaScript CPU usage, manage JavaScript garbage collection, change how the environment’s internals work, and a whole lot more:

654dcuD
V8 has a ton of APIs. Who knew?

Amidst these APIs are a few “Context” classes that let you manipulate the global scope, making it possible for NativeScript to inject a globalandroid object. This is actually the same mechanism Node.js uses to make its global APIs available – e.g. require() – and NativeScript uses it to inject APIs that let you access native code. JavaScriptCore has a similar mechanism that makes the same technique possible for iOS. Cool, right?

Let’s go back to our code:

You now know that this code runs on V8, and that V8 knows whatandroid.text.format.Time() is because NativeScript injected the necessary objects into the global scope. But there are still some big unanswered questions, like, how does NativeScript know which APIs to inject, and how does NativeScript know what to do when the Time() call is actually made? Let’s start with the first of these questions, and look at how NativeScript builds its list of APIs.

Metadata

NativeScript uses reflection to build the list of the APIs that are available on the platform they run on. If you’re a JavaScript developer you may not be familiar with reflection, as the permissive nature of the JavaScript language makes reflection largely unnecessary. In many other languages, most notably Java, reflection is the only technique you can use to examine the runtime itself. For example, in Java the only way to build a list of methods an arbitrary Object can invoke is with reflection.

For NativeScript’s purposes, reflection is what lets NativeScript build a comprehensive list of APIs for each platform, includingandroid.text.format.Time. Because generating this data is non-trivial from a performance perspective, NativeScript does it ahead of time, and embeds the pre-generated metadata during the Android/iOS build step.

With that in mind let’s again return to our line of code:

You now know that this code runs on V8, that NativeScript injects theandroid.text.format.Time JavaScript object, that NativeScript knows each API to inject from a separate metadata process, and that NativeScript embeds that metadata during its Android and iOS builds. On to the next question: how does NativeScript turn a JavaScript Time() call into a native android.text.format.Time() object?

Invoking native code

The answer to how NativeScript invokes native code again lies in the JavaScript VM APIs. When we last looked at V8’s APIs, we saw how NativeScript used them to inject global variables. This time we’ll look at a series of callbacks that let you execute C++ code at given points during JavaScript execution.

For example, the code new android.text.format.Time() invokes a JavaScript function, which V8 has a callback for. That is, V8 has a callback that lets NativeScript intercept the function call, take some action with custom C++ code, and provide a new result.

In the case of Android, the NativeScript runtime’s C++ code cannot directly access Java APIs such as android.text.format.Time. However,Android’s JNI, or Java Native Interface, provides the ability to bridge between C++ and Java, so NativeScript uses JNI to make the jump. On iOS this extra bridge is unnecessary as C++ code can directly invoke Objective-C APIs.

With all of this in mind, let’s return to our line of code:

We already know that this code runs on V8; that it knows whatandroid.text.format.Time is because NativeScript injects such an object; and that NativeScript has a metadata-generating process for obtaining these APIs. We now know that when Time() executes, the following things happen:

  • 1) The V8 function callback runs.
  • 2) The NativeScript runtime uses its metadata to know that Time()means it needs to instantiate an android.text.format.Timeobject.
  • 3) The NativeScript runtime uses the JNI to instantiate aandroid.text.format.Time object and keeps a reference to it.
  • 4) The NativeScript runtime returns a JavaScript object that proxies the Java Time object.
  • 5) Control returns to JavaScript where the proxy object gets stored as a local time variable.

The proxy object is how NativeScript maintains a mapping of JavaScript objects to native ones. For example, let’s look at the next line of code from our earlier example:

Because of the generated metadata, NativeScript knows all the methods to put on the proxy object. In this case the code invokes the Time object’sset() method. When this method runs, V8 again invokes its function callback; NativeScript detects that this is a method call; and then NativeScript uses the Android JNI to make the corresponding method call on the Java Time object.

And that’s really most of how NativeScript works. Cool, right?

Now, I did leave out some of the really complex parts, because converting Objective-C and Java objects into JavaScript objects can get tricky, especially when you consider the different inheritance models each language uses.

However, we’re not going to dig into those type conversion details here because they’re not a very common thing you need to know when building a NativeScript app. In fact, even though this article has focused on how native access in NativeScript works, another feature of NativeScript keeps you from having to dive into native code very often: TNS modules.

TNS Modules

I like to think of TNS modules, or Telerik NativeScript modules, as Node modules that depend on the NativeScript runtime. TNS modules follow the same CommonJS conventions as Node modules, so if you already know how require() and the exports object work, then you already know how TNS modules work.

TNS modules allow you to abstract platform-specific code into a platform-agnostic API, and NativeScript itself provides several dozens of these modules for you out of the box. As an example, suppose you need to create a file in your iOS/Android app. You could write the following code for Android:

As well as the following code on iOS:

But you’re better off just using the TNS file-system module, as it lets you write your code once, without having to worry about the iOS/Android internals:

What’s cool is that all TNS modules are written using the same NativeScript runtime conventions discussed in this article, which means that it’s really easy to browse any module’s source code, and that it’s really easy to create your own distributable TNS modules. For example, here’s a TNS module that retrieves a device’s OS version:

This code only retrieves one property, but it gives you an idea of much you can accomplish in a small amount of code. Using custom TNS modules is also trivial, as you use the same require() call you use to retrieve npm modules. Here’s how you use the device module shown above:

NativeScript modules are surprisingly easy to write, distribute, and use, especially if you’re already familiar with npm’s conventions. Personally, as a web developer, native iOS and Android code scares me, but even I can reference the Java/Objective-C API documentation and throw together something functional if you give me a few hours. It’s exciting stuff, and it lowers the barrier for web and Node developers that want to build on native platforms.

 

 

The only question that I have in mind is that can it be a Xamarin killer? Well.. I don’t think so.