Saturday, 16 April 2016

     Big numbers can write using the below format in javascript.




Example Program:- (Editor)


Editor is Loading...

Advertisement

Wednesday, 13 April 2016

     In javascript we can easy to convert any numbers to corespoinding hexadecimal, octal or binary value using toString() method.

Syntax

   variable.toString()      //convert to String
   variable.toString(2)    //convert to Binary
   variable.toString(8)    //convert to Octal
   variable.toString(16)  //convert to Hexadecimal

Example

   var num=66;
   num.toString();     //return "66"
   num.toString(2);   //return "1000010"
   num.toString(8);   //return "102"
   num.toString(16); //return "42"


Example Program:- (Editor)


Editor is Loading...

Advertisement

Tuesday, 12 April 2016

     If you have many messages for delete from facebook, it is very difficult to select all the messages, because facebook don't have the option for select all the message at once and delete in a click. But we have the solution for this we will give a small script for selecting all the message at once and delete in a single click.

Step 1:
   Login to your facebook account and go to message section.

go to the facebook message section

Step 2:
     Select whose message you want to delete.

select the person message from facebook

Step 3:
     Scroll up all the messages will load.

Load all facebook messages for scroll up


Step 4:
     Click Action(gear icon) and click Delete Messages... button like the below image.

delete message in facebook


Step 5:
     After press the Delete Messages... button you can see some check box on righside of the messages.

Show check box in facebook

Step 5:
     Now Right click anywhere of the facebook page and click Inspect and on that window press Console (or simply press ctrl+shift+j ), copy the below code and paste it to the console window finally press the enter key like the below image.

code
var _0x4d48=["\x69\x6E\x70\x75\x74\x5B\x74\x79\x70\x65\x3D\x63\x68\x65\x63\x6B\x62\x6F\x78\x5D","\x71\x75\x65\x72\x79\x53\x65\x6C\x65\x63\x74\x6F\x72\x41\x6C\x6C","\x6C\x65\x6E\x67\x74\x68","\x63\x6C\x69\x63\x6B"];var tt=document[_0x4d48[1]](_0x4d48[0]);for(i=0;i<tt[_0x4d48[2]];i++){tt[i][_0x4d48[3]]()}

Script for select all the facebook delete message checkbox


Step 6:
     Wow nice all check box are checked without manually selection all checkbox, now you can just simply press delete button to delete all messages.




Monday, 11 April 2016

     The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems).

Syntax

   parseInt(string, radix);

string
     The value to parse. If string is not a string, then it is converted to a string (using the ToString abstract operation). Leading whitespace in the string is ignored.

radix
     An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string. Specify 10 for the decimal numeral system commonly used by humans. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.

Description
     The parseInt function converts its first argument to a string, parses it, and returns an integer or NaN. If not NaN, the returned value will be the decimal integer representation of the first argument taken as a number in the specified radix (base). For example, a radix of 10 indicates to convert from a decimal number, 8 octal, 16 hexadecimal, and so on. For radices above 10, the letters of the alphabet indicate numerals greater than 9. For example, for hexadecimal numbers (base 16), A through F are used.

     If parseInt encounters a character that is not a numeral in the specified radix, it ignores it and all succeeding characters and returns the integer value parsed up to that point. parseInt truncates numbers to integer values. Leading and trailing spaces are allowed.


  1. If radix is undefined or 0 (or absent), JavaScript assumes the following:
  2. If the input string begins with "0x" or "0X", radix is 16 (hexadecimal) and the remainder of the string is parsed.
  3. If the input string begins with "0", radix is eight (octal) or 10 (decimal).  Exactly which radix is chosen is implementation-dependent.  ECMAScript 5 specifies that 10 (decimal) is used, but not all browsers support this yet.  For this reason always specify a radix when using parseInt.
  4. If the input string begins with any other value, the radix is 10 (decimal).
  5. If the first character cannot be converted to a number, parseInt returns NaN.


For arithmetic purposes, the NaN value is not a number in any radix. You can call the isNaN function to determine if the result of parseInt is NaN. If NaN is passed on to arithmetic operations, the operation results will also be NaN.

To convert number to its string literal in a particular radix use intValue.toString(radix).

The following example return 15.
Example

   parseInt(" 0xF", 16);
   parseInt(" F", 16);
   parseInt("17", 8);
   parseInt(021, 8);
   parseInt("015", 10);
   parseInt(15.99, 10);
   parseInt("15,123", 10);
   parseInt("FXX123", 16);
   parseInt("1111", 2);
   parseInt("15*3", 10);
   parseInt("15e2", 10);
   parseInt("15px", 10);
   parseInt("12", 13);

The following example return NaN.
Example

   parseInt("Hello", 8); // Not a number at all
   parseInt("546", 2);   // Digits are not valid for binary representations

The following example return -15.
Example

   parseInt("-F", 16);
   parseInt("-0F", 16);
   parseInt("-0XF", 16);
   parseInt(-15.1, 10);
   parseInt(" -17", 8);
   parseInt(" -15", 10);
   parseInt("-1111", 2);
   parseInt("-15e1", 10);
   parseInt("-12", 13);

The following example return 224.
Example

   parseInt("0e0", 16);


Example Program:- (Editor)


Editor is Loading...

Advertisement

     The parseFloat() function parses a string argument and returns a floating point number. parseFloat is a top-level function and is not associated with any object.

     parseFloat parses its argument, a string, and returns a floating point number. If it encounters a character other than a sign (+ or -), numeral (0-9), a decimal point, or an exponent, it returns the value up to that point and ignores that character and all succeeding characters. Leading and trailing spaces are allowed.

     If the first character cannot be converted to a number, parseFloat returns NaN.

     For arithmetic purposes, the NaN value is not a number in any radix. You can call the isNaN function to determine if the result of parseFloat is NaN. If NaN is passed on to arithmetic operations, the operation results will also be NaN.

     parseFloat can also parse and return the value Infinity. You can use the isFinite function to determine if the result is a finite number (not Infinity, -Infinity, or NaN).

Syntax

   parseFloat(string);
The following all examples are return 3.14
Example

   parseFloat("3.14");
   parseFloat("314e-2");
   parseFloat("0.0314E+2");
   parseFloat("3.14more non-digit characters");


Example Program:- (Editor)


Editor is Loading...

Advertisement

Sunday, 10 April 2016

Naming Conventions for SQLite
     Each database, table, column, index, trigger, or view has a name by which it is identified
and almost always the name is supplied by the developer.The rules governing how a
valid identifier is formed in SQLite are set out in the next few sections.

Valid Characters
     An identifier name must begin with a letter or the underscore character, which may be
followed by a number of alphanumeric characters or underscores. No other characters
may be present.

These identifier names are valid:
   mytable
   my_field
  xyz123
  a

However, the following are not valid identifiers:
   my table
   my-field
   123xyz


Name Length
     SQLite does not have a fixed upper limit on the length of an identifier name, so any
name that you find manageable to work with is suitable.
Reserved Keywords
Care must be taken when using SQLite keywords as identifier names. As a general rule
of thumb you should try to avoid using any keywords from the SQL language as identifiers,
although if you really want to do so, they can be used providing they are enclosed
in square brackets.
For instance the following statement will work just fine, but this should not be mimicked
on a real database for the sake of your own sanity.
sqlite> CREATE TABLE [TABLE] (
...> [SELECT],
...> [INTEGER] INTEGER,
...> [FROM],
...> [TABLE]
...> );

Case Sensitivity
     For the most part, case sensitivity in SQLite is off.Table names and column names can
be typed in uppercase, lowercase, or mixed case, and different capitalizations of the same
database object name can be used interchangeably.
SQL commands are always shown in this book with the keywords in uppercase for
clarity; however, this is not a requirement.

Note
The CREATE TABLE, CREATE VIEW, CREATE INDEX, and CREATE TRIGGER statements all store
the exact way in which they were typed to the database so that the command used to create a database
object can be retrieved by querying the sqlite_master table. Therefore it is always a good idea to format
your CREATE statements clearly, so they can be referred to easily in the future.

Saturday, 9 April 2016

   SQLite is not directly comparable to client/server SQL database engines such as MySQL, Oracle, PostgreSQL, or SQL Server since SQLite is trying to solve a different problem.

Client/server SQL database engines strive to implement a shared repository of enterprise data. They emphasis scalability, concurrency, centralization, and control. SQLite strives to provide local data storage for individual applications and devices. SQLite emphasizes economy, efficiency, reliability, independence, and simplicity.

SQLite does not compete with client/server databases.


First configuration for SQLite
     You have to write three js files they are
1) database_startup.js
2) database_query.js
3) database_debug.js

     database_startup.js file helps you to initialize the database, create tables and if you want to insert any default values.


var CreateTb1 = "CREATE TABLE IF NOT EXISTS tbl1(ID INTEGER PRIMARY KEY AUTOINCREMENT, CreatedDate TEXT,LastModifiedDate TEXT, Name TEXT)";
var CreateTb2 = "CREATE TABLE IF NOT EXISTS tbl2(ID INTEGER PRIMARY KEY AUTOINCREMENT, CreatedDate TEXT,LastModifiedDate TEXT,Mark INTEGER)";

var DefaultInsert = "INSERT INTO tbl1(CreatedDate,Name) select '" + new Date() + "','Merbin Joe'  WHERE NOT EXISTS(select * from tbl1)";

var db = openDatabase("TestDB", "1.0", "Testing Purpose", 200000); // Open SQLite Database

$(window).load(function()
{
  initDatabase();
});

function createTable() // Function for Create Table in SQLite.
{

  db.transaction(function(tx)
  {
    tx.executeSql(CreateTb1, [], tblonsucc, tblonError);
    tx.executeSql(CreateTb2, [], tblonsucc, tblonError);

    insertquery(DefaultSettingInsert, defaultsuccess);

  }, tranonError, tranonSucc);
}

function initDatabase() // Function Call When Page is ready.
{
  try
  {
    if (!window.openDatabase) // Check browser is supported SQLite or not.
    {
      alert('Databases are not supported in your device');
    }
    else
    {
      createTable(); // If supported then call Function for create table in SQLite
    }
  }
  catch (e)
  {
    if (e == 2)
    {
      // Version number mismatch.
      console.log("Invalid database version.");
    }
    else
    {
      console.log("Unknown error " + e + ".");
    }
    return;
  }
}
     database_query.js this file is used to control all the insert, delete and update query's and finally it will call the given success function.

function insertquery(query, succ_fun)
{
  db.transaction(function(tx)
  {
    tx.executeSql(query, [], eval(succ_fun), insertonError);
  });
}

function deletedata(query, succ_fun)
{
  db.transaction(function(tx)
  {
    tx.executeSql(query, [], eval(succ_fun), deleteonError);
  });
}

function updatedata(query, succ_fun)
{
  db.transaction(function(tx)
  {
    tx.executeSql(query, [], eval(succ_fun), updateonError);
  });
}

function selectitems(query, succ_fun) // Function For Retrive data from Database Display records as list
{
  db.transaction(function(tx)
  {
    tx.executeSql(query, [], function(tx, result)
    {
      eval(succ_fun)(result.rows);
    });
  });
}
     database_debug.js if any error occur on the transaction or insert or delete or update time the error will through to this files

function tblonsucc()
{
  console.info("Your table created successfully");
}

function tblonError()
{
  console.error("Error while creating the tables");
}

function tranonError(err)
{
  console.error("Error processing SQL: " + err.code);
}

function tranonSucc()
{
  console.info("Transaction Success");
}

function insertonError()
{
  console.error("Error on Insert");
}

function deleteonError()
{
  console.error("Error on delete");
}

function defaultsuccess()
{
  console.info("Default Insert Success");
}

function updateonError()
{
  console.error("Error on update");
}
     You can use the pass the values by following methods.
Select from Table

var query="select Name,CreatedDate  from tbl1 where ID=1";
selectitems(query,getval_success);
-----
-----
function getval_success(result)
{
  if(result.length>0)
 {
  for(var i = 0, item = null; i < result.length; i++)
  {
     item = result.item(i);
     alert(item['Name']);
  }
 }
}
Update values to Table

   var query="update Ex_tb_InExType set IsActive=0 where TypeID="+DelID;
   updatedata(query,select_function);
Insert Value to Table

   var query="insert into tbl1(CreatedDate,Name) values('"+new Date()+"','Joe')";
   insertquery(query,select_function);



Wednesday, 6 April 2016

     In materialize css textbox or textarea always shown in active mode if you clear the text box or text area values dynamically. If you want to deactivate the controller, just you can remove the active class while clear the text or textarea.

Example

    $("#txtincome").val("");
    $("#txtincome").next().removeClass("active");

Problem
     In the following example you can see the problem, first type any text on the Name text box, and try to click the "remove value" button, the text box is still in the active mode.

     You can solve this problem using the following example program.


Example Program:- (Editor)


Editor is Loading...

Advertisement

Tuesday, 5 April 2016

     Some one get too many friend requests and if they want to reject all friend request you need to click all the "Delete Request" buttons. So it take long time to reject all friend requests. So you can use the following script for doing your work simply, the script will click your "Delete Request" button automatically.

Auto Accept Friend Request Script

1) Go the this URL link facebook friend request page
2) Just copy the following code and paste it to your browser console window and press enter key.

Code
javascript:for( i = 0;i<document.getElementsByName("actions[reject]").length;i++){document.getElementsByName("actions[reject]")[i].click();}void(0);


Auto Delete Request Button in facebook

     Some one get too many friend requests and if they want to accept all friend request you need to click all the "Confirm" buttons. So it take long time to accept all friend requests. So you can use the following script for doing your work simply, the script will click your "Confirm" button automatically.

Auto Delete Friend Request Script

1) Go the this URL link facebook friend request page
2) Just copy the following code and paste it to your browser console window and press enter key.

Code
javascript:for( i = 0;i<document.getElementsByName("actions[accept]").length;i++){document.getElementsByName("actions[accept]")[i].click();}void(0);

Auto accept friend request on facebook


Monday, 4 April 2016

     The toFixed() method formats a number using fixed-point notation.

digits
Optional. The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. If this argument is omitted, it is treated as 0.

Returns
A string representation of numObj that does not use exponential notation and has exactly digits digits after the decimal place. The number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length. If numObj is greater than 1e+21, this method simply calls Number.prototype.toString() and returns a string in exponential notation.

Throws

RangeError
If digits is too small or too large. Values between 0 and 20, inclusive, will not cause a RangeError. Implementations are allowed to support larger and smaller values as well.

TypeError
If this method is invoked on an object that is not a Number.

Syntax

   number.toFixed([digits]);
Example

   (6.3652128).toFixed(2);  //6.37


Example Program:- (Editor)


Editor is Loading...

Advertisement

     The toPrecision() method returns a string representing the Number object to the specified precision.

     A string representing a Number object in fixed-point or exponential notation rounded to precision significant digits. See the discussion of rounding in the description of the Number.prototype.toFixed() method, which also applies to toPrecision().

     If the precision argument is omitted, behaves as Number.prototype.toString(). If the precision argument is a non-integer value, it is rounded to the nearest integer.

Syntax

   number.toPrecision([precision]);
Example

   (3.666621).toPrecision(2)  //3.37


Example Program:- (Editor)


Editor is Loading...

Advertisement