JSON with Javascript and Jquery

JSJavascript has grown  from a way to add interactivity on your page , to a language that lets you perform tasks that once belonged to servers.JSON provides for an easy way to create and store data structures within JavaScript. JSON stands for JavaScript Object Notation…it’s called that because storing data with JSON creates a JavaScript object. The JavaScript object can be easily parsed and manipulated with JavaScript.

First, we create a variable to hold our data, and then we use JSON to define our object. Our sample object above is a simple as it gets. Just an item called firstName and it’s value Sam. When using strings with JSON, you should use them with quotations as above. If you use numbers, then you don’t have to use quotations.

<script> var data = { “Firstname”: “Sam” }; alert(data.Firstname); </script>

Let’s put data inside an HTML element.

<script>
var data = {
"Firstname": "Sam",
"Lastname": "Legend",
"Age": "34"
};

 document.getElementById("placeholder").innerHTML = data.Firstname + " " + data.Lastname + " " + data.Age;
</script>
  • Every object in json is stored with curly braces {}, an array is stored with brackets[].

  • So in order to organize our data, we created an object called users, which held an array (using brackets).

  • That object had a couple of other objects…each stored like before with curly braces {}.

  • Each element in that object was separated by commas.

<html>
<head>
<meta charset="utf-8" />
<title>JSON Data</title>
</head>
<body>
 <div id="placeholder"> </div>
</body>
</html>
<script>
var data = {
"users": [
{
"Firstname": "Sam",
"Lastname": "Legend",
"Age": "34"
},
{
"Firstname": "John",
"Lastname": "Watson",
"Age": "22"
}
]
};
 document.getElementById("placeholder").innerHTML = data.users[0].Firstname + " " + data.users[0].Lastname + " " + data.users[0].Age;
</script>


How to achieve multithreading in Java Script

Achieve Multithreading in Java Script

Alright, before we start let me admit that JavaScript is a single-threaded environment, JavaScript historically suffers from an important limitation that all its execution process remains inside a single thread.

On the web you may found the various ways to archive multi-threading but as far as I know, the only way is HTML5 Web Workers. You can simulate ‘concurrency’ by using techniques like setTimeout(),setInterval() and event handlers.

Yes, all of these features run asynchronously, but non-blocking doesn’t necessarily mean concurrency. Like setInterval() only schedule things to happen later, they don’t run concurrently with anything else. Before multithreading when executing scripts in an HTML page, the page becomes unresponsive until the script is finished.

Multithreading using HTML5 Web Workers

Continue reading “How to achieve multithreading in Java Script”

Autocomplete Textbox Using Jquery/JSON from Database

JSONIn web page designing  autocomplete property of textbox is widely used for making the site user friendly and interactive , so in this article we will understand the simple method for autocompletion of textbox using Jquery.

First we will see a simple example for this then in next step I will show you how you can fetch the data from the database using JSON

HTML Code

<html>
<head>

<!-- Load jQuery, jQuery UI and jQuery ui styles from jQuery website -->
<<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>

var data = [
"Delhi",
"Mumbai",
"Indore",
"Dehradun",
"Assam"];
$(document).ready(
function () {
 $("#City").autocomplete({
source: data,
 autoFocus: true,
});
}
);
</script>
</head>

<body>

<label for="City">City <input type="text" name="CityNames" id="City" /></label>
</body>

</html>

Continue reading “Autocomplete Textbox Using Jquery/JSON from Database”

DLL Hell Problem and Solution

DLL Hell Problem

DLL Hell is a problem in which two different Application share a common assembly and If one Application changes the common assembly, the changes which are not backward compatible will cause another Application to crash. Let us understand this with an example.

Let say you have two Applications, we can call it as Application1 and Application2  and both Applications shares a common Assembly we can call it as Shared. Both Application consumes GetOperation().

Dll hell problem

Continue reading “DLL Hell Problem and Solution”

Console Application For Reading Disk Space

Sometimes you need to check the disk space of remote windows server , the simple way out for checking this is  what I am going to provide you in this article .

Console Application To Read Disk Space:

  • First create a new Console Application ,  here I have named it as ReadDiskSpace Read Disk Space
  • After creating the application write these simple line of codes.Remember using the References.

using System;
using System.IO;

namespace ReadDiskSpace
{
class Test
{
public static void Main()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" Drive type: {0}", d.DriveType);
if (d.IsReady == true)
{
Console.WriteLine(" Volume label: {0}", d.VolumeLabel);
Console.WriteLine(" File system: {0}", d.DriveFormat);
Console.WriteLine(" Available space to current user:{0, 15} bytes",d.AvailableFreeSpace);
Console.WriteLine(" Total available space: {0, 15} bytes",d.TotalFreeSpace);
Convert.ToDecimal(d.TotalFreeSpace);
Console.WriteLine(" Total size of drive: {0, 15} bytes ",d.TotalSize);
      }
    }
  }
}

  • Now its time to run the application,Disk Space

Happy Coding !!!

Microsoft HoloLens

HoloLensAnnounced completely by surprise at the January 21, Windows 10: The next chapter event, HoloLens is Microsoft’s brand new head-worn Windows 10 computing device. Running a ‘holographic’ version of Windows 10, the HoloLens will immerse you in your personal computing environment.

Be that playing Minecraft, making a Skype call, even walking on Mars, all and more are possible with the HoloLens. It was developed “hiding in plain sight” on Microsoft’s main campus in Redmond.

It’s completely wireless, has spatial sound and a see-through lens so that you can still see the real world in front of you, but with the holograms laid atop it.

It is basically a holographic computer that you wear. It enables you to bring your digital world into your real world.

Continue reading “Microsoft HoloLens”

Basic commands that are used in GIT

GITBasic Commands used in GIT

Here I’m listing all basic Commands used in GIT bash.

  1. git –version: Tells you about version
  2. git –global Page on user.name “Code Hotfix” : Register user name
  3. git –global user.email “codehotfix@github.com” : Register user email
  4. git config –list : Git Config
  5. git help / git help command : Git help
  6. pwd : Gives you the working directory of repository 
  7. cd .. : To go back
  8. ls : Gives you all folder
  9. cd nameOfFolder : To move to the specified folder
  10. git init : To make folder as a git repository (First move into the folder to make it as a repository)
  11. ls -la : Gives you the list of folder in repository that keep record of changes
  12. git add . : To aware git to add the file in the directory it adds to the staging area  (. Means all) you can replace (.) With file name like second.txt
  13. git commit -m “Expressing the detail about change ” : This will commit the changes with the note
  14. git log : Gives you the commit history
  15. git log –author=”CodeHotfix” : Gives you commit history of specific author
  16. git status : Gives you the status of pending changes.
  17. git diff : Give you the difference of working directory and repository
  18. git diff –staged : Compare staged  area with repository
  19. git rm filename : Removes the file from repository as well as working directory
  20. git mv oldname to newNAME : Also rename the file
  21. git mv oldname to newPATH/newNAME : Also rename the file and move to the new path
  1. git commit -am “Commit message” :Directly commit to the repository without adding to the staging area
  2. git checkout — Views/Home/Index.cshtml : Undo Pending Changes
  3. git reset HEAD filename  : Unstage the file to the working area
  4. git checkout refrenceumber — file/folder : Get the previous version copy of specified file

You can also read Understanding GIT and GitHub 

Enjoy.. !!

Schedule an email to be sent later

Have  you ever been in a situation where you want to schedule an email to be sent on a specific time or  you need to make sure that you follow up within a specific time frame after sending a message then you should know about Boomerang for Gmail.

Boomerang for Gmail helps you to control your emails in Gmail. With Boomerang installed in your Gmail you can have following features :

  1. You can set Boomerang to give you a reminder if you don’t get a reply after a certain amount of days
  2. With Boomerang, you can write an email now and schedule it to be sent automatically at the time you want.
  3. Take control of when you send and receive email messages.
  4. Use Boomerang to take messages out of your inbox until you actually need them.
  5. You can write an email while you’re on the go, and have it arrive exactly when you need to be reminded.
  6. Boomerang is available on Mobile but only for Android i.e on Google Play Store.

Continue reading “Schedule an email to be sent later”

Find your stolen Phones, Tablets and Laptops

Obviously it sucks when you  lost your phones, tablets or  laptops. So if you want to know about your lost then you should have to know about Prey Project.

Prey is a lightweight theft protection software that will run silently on your device and always  keep an eye on your device. Prey works with Windows, Apple , Linux and  Android. With Prey Installed on your device you can

  1. Find whether your device is in town or abroad.
  2. Trigger actions on all your devices from a single place .
  3. Recover your device if ever lost or stolen.

Continue reading “Find your stolen Phones, Tablets and Laptops”

Export to excel table without hitting server using Jquery

Want to export the data to excel, but don’t  want to hit server again and again ?? So here is the simple way out for you.

In the following steps you will understand how simply we can export the data to excel sheet by using jquery.

Continue reading “Export to excel table without hitting server using Jquery”