Wednesday, 25 April 2018

Update Column With Random predefined word list in PostgreSQL


   Update Column With Random  enum word list in PostgreSQL ?
   How to Update Column With Random word ?

    UPDATE stock
    SET shape = (
              (
               ARRAY['CS','CM','RN','EM','AS','PR','OV','HT','BG','Round','MQ','PC']
              )          [floor(random()*12)+1]
           );

Update Date Column With RANDOM date in PostgreSQL



Random Dates and Numbers in PostgreSQL with the RANDOM() Function



select NOW() + (random() * (NOW()+'90 days' - NOW())) + '30 days';

UPDATE stock SET trans_date = NOW() + (random() * (NOW()+'90 days' - NOW())) + '30 days';



Monday, 23 April 2018

How to Flush/Clean DNS cache in Ubuntu 16.04 and Ubuntu 20.04



In Windows, we useipconfig /flushdnsin Ubuntu 16.04  run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart

or use:

sudo /etc/init.d/networking force-reload


Ubuntu 20.04 

How to Clear DNS Cache on Ubuntu?

We can run the following command to clear the DNS cache on Ubuntu.

 sudo systemd-resolve --flush-caches



Friday, 13 April 2018

SURAT: India's first district cooperative bank built on the green concept

 SURAT: India's first district cooperative bank built on the green concept will be inaugurated in the diamond city by Chief Minister Vijay Rupani on Friday
Established in 1909, the 109-year-old Surat district cooperative bank  has become the first among the 370 district banks in India and 18 district banks in Gujarat for constructing its new headquarter in the diamond city’s Majura Gate on the green building concept. Constructed on 45,000 square feet, the bank took just 15 months for completition at the cost of Rs 34 crore.


The terrace of the district bank is installed with rooftop solar plant for generating 36 kilowatts of electricity for its in-house needs. The solar panels have been so designed that the electricity requirements would be met even during the monsoon season.

The five-storey bank building has green patches for gardening at each of the floors. The entry of the building has a green landscape with lush garden for providing a different feeling to the customers visiting the bank. Each floor has the facility of toilets and reception, mineral RO plants for clean drinking water etc.

Watch a New Surat district cooperative bank in 360 degree.


SURAT district cooperative bank entrance gate


Saturday, 24 February 2018

Install Latest and update Node js in Ubuntu


On Ubuntu 16.04 LTS the easier way is
1 Install npm:
sudo apt-get install npm
2.Install n
sudo npm install n -g
3 Get latest version of node
sudo n latest
If you prefer to install a specific version of `node you can
4 List available node versions
n ls
5 and the install a specific version

sudo n 4.5.0



Friday, 1 December 2017

Benefit of virtual reality



Many industries are now reaping the benefits of integrating virtual reality devices into their day-to-day work.



VR makes it possible for engineers and manufacturers to experience their creations before they’re builtMark Miles, managing director, RenderMedia

many business sectors are use a virtual reality for
presenting their product,office, showrooms.

In Surat, India  one of a  young entrepreneur start a virtual reality base startup could 360eye.in
and they already cover a many  business sectors like a Event And Function,
Restaurants And Hotels,Showrooms,Real Estate,industries,Tourist Places
Hospital And Clinic.
If we even imagine sitting in  room and actually experiencing the sound and life of a Event And Function on the virtual reality headset, we get goosebumps. Entertainment to health, to psychology, to business: the benefits of virtual reality are approaching infinity, and it will really take the world to new places.
some real example by 360 eye virtual tour
Real Estate
RealEstate Virtual Tour Solitaire Sangini Group
Restaurants And Hotels
Hotels Hari Champa Resort Surat

Main Website 
http://360eye.in



Thursday, 8 September 2016

Html Table Export To excel Using Javascript


Note : this Code is working Only Google Chrome
Note : only 2 MB data Uri in Exported  ( 1500 Record and 35 Columns ) Tested.


$("#btnExport").click(function(e) {
       //getting values of current time for generating the file name
       var dt = new Date();
       var day = dt.getDate();
       var month = dt.getMonth() + 1;
       var year = dt.getFullYear();
       var hour = dt.getHours();
       var mins = dt.getMinutes();
       var postfix = day + "." + month + "." + year + "_" + hour + "." + mins;
       //creating a temporary HTML link element (they support setting file names)
       var a = document.createElement('a');
       //getting data from our div that contains the HTML table
       var data_type = 'data:application/vnd.ms-excel';
       var table_div = document.getElementById('tableDiv');
       var table_html = table_div.outerHTML.replace(/ /g, '%20');
       a.href = data_type + ', ' + table_html;
       //setting the file name
       a.download = 'exported_table_' + postfix + '.xls';
       //triggering the function
       a.click();
       //just in case, prevent default behaviour
       e.preventDefault();
});

Friday, 3 June 2016

English to marathi date convert


English to marathi date convert javascript

var marathiNumber = ["०","१","२","३","४","५","६","७","८","९"];
    function getMarathiDate(englishDate) {
      var englishDateArray = englishDate.split("");
      var marathiDate = "";
      englishDateArray.forEach(function(el) {
         if (isNaN(el) === false) {
           marathiDate +=  marathiNumber[el];
         } else {
           marathiDate += "-"
         }
      });
      return marathiDate;
    }

marathi date picker

bootstrap date picker localization example

bootstrap date picker marathi  localization

;(function($){
$.fn.datepicker.dates['MA'] = {
days: ["रविवारी", "सोमवारी", "मंगळवारी", "बुधवारी", "गुरुवारी", "शुक्रवारी", "शनिवारी"],
daysShort: ["रवी", "सोम", "मंगळ", "बुध", "गुर", "शुक", "शन"],
daysMin: ["रवी", "सोम", "मंगळ", "बुध", "गुर", "शुक", "शन"],
months: ["जानेवारी", "फेब्रुवारी", "मार्च", "एप्रिल", "मे", "जून", "जुलै", "ऑगस्ट", "सप्टेंबर", "ऑक्टोबर", "नोव्हेंबर", "डिसेंबर"],
monthsShort:  ["जानेवारी", "फेब्रुवारी", "मार्च", "एप्रिल", "मे", "जून", "जुलै", "ऑगस्ट", "सप्टेंबर", "ऑक्टोबर", "नोव्हेंबर", "डिसेंबर"],
today: "आज",
monthsTitle: "महिन्यात",
clear: "साफ करा",
weekStart: 1,
format: "d/mm/yyyy"
};
}(jQuery));


Sunday, 22 May 2016

send push notification in android using node js?


send push notification in android ?
send push notification in android using node-gcm ?


save below code pushnotification.js

run code with this command

node pushnotification.js

register your token using  /register api call

open http://localhost:3000

send push notification
http://localhost:3000/push  (open in browser)


Friday, 15 April 2016

Remove a drop down item if it is selected ?

   
Remove a drop down item if it is selected  Select2.js?
Ability to hide currently selected value in dropdown ?
Ability to hide currently selected value in dropdown Select2.js ?

$('#ddlType').select2({  
     tags:false,  
     multiple:multiple  
  });  




Hide Selected Tag Css
.select2-results__option[aria-selected="true"] {
  display:none;
}
.select2-results__option[aria-selected="false"] {
  display:block;
}




Prevent select2 dropdown open when clearing selection ?

  var ddl = selectEl.select2({  
       allowClear: true,  
       placeholder: "Select a "+columnName  
    }).on("select2:close",function() {  
      console.log("close");  
    }).on('select2:unselecting', function() {  
       $(this).data('unselecting',true);  
    }).on('select2:opening', function(e) {  
      if ($(this).data('unselecting')) {  
        $(this).removeData('unselecting');  
        e.preventDefault();  
      }  
    }).on("change", function (e) {  
       console.log("change event Call");
    });  

Wednesday, 18 November 2015

Changes in Node Js Express 5

Removed methods and properties:

Changed:
Improvements:

Removed methods and properties

If you use any of these methods or properties in your app, it will crash. So, you’ll need to go through and change your app once you update to version 5.

app.del()

Express 5 no longer supports app.del(). Using it will throw an error. For registering HTTP DELETE routes, use app.delete() instead.
Initially del was used instead of delete considering delete is a reserved keyword in JavaScript. However, as of ECMAScript 6, delete and other reserved keywords can legally be used as a property names. You can read the discussion which lead to the deprecation of app.del here.

app.param(fn)

The app.param(fn) signature was used for modifying the behavior ofapp.param(name, fn). It has been deprecated since v4.11.0, and Express 5 no longer supports it at all.

Pluralized method names

The following method names have been pluralized.  In Express 4, using the old methods resulted in a deprecation warning.  Express 5 no longer supports them at all:
  • req.acceptsCharset() is replaced by req.acceptsCharsets().
  • req.acceptsEncoding() is replaced by req.acceptsEncodings().
  • req.acceptsLanguage() is replaced by req.acceptsLanguages().

Leading colon (:) in name for app.param(name, fn)

A leading colon character (:) in name for app.param(name, fn) is remnant of Express 3, and for the sake of backwards compatibility, Express 4 supported it with a deprecation notice. Express 5 will silently ignore it; use the name parameter without prefixing it with a colon.
This should not affect your code, if you have been following the Express 4 documentation of app.param, as it makes no mention of the leading colon.

req.param(name)

This potentially confusing and dangerous method of retrieving form data has been removed. You will now need to specifically look for the submitted parameter name inreq.paramsreq.body, or req.query.

res.json(obj, status)

Express 5 no longer supports the signature res.json(obj, status).  Instead, set the status and then chain it to the res.json() method like this:res.status(status).json(obj).

res.jsonp(obj, status)

Express 5 no longer supports the signature res.jsonp(obj, status).  Instead, set the status and then chain it to the res.jsonp() method like this:res.status(status).jsonp(obj).

res.send(body, status)

Express 5 no longer supports the signature res.send(obj, status).  Instead, set the status and then chain it to the res.send() method like this:res.status(status).send(obj).

res.send(status)

Express 5 no longer supports the signature res.send(status), where status is a number. Instead, use res.sendStatus(status), which sets the HTTP response header code and sends the text version of the code: “Not Found,” “Internal Server Error,” and so on.
If you need to send a number using res.send(), quote the number to convert it to a string, so that Express does not interpret it as an attempt at using the unsupported old signature.

res.sendfile()

res.sendfile() has been replaced by a camel-cased version res.sendFile() in Express 5.

Changed

app.router

The app.router object, which was removed in Express 4, has made a comeback in Express 5. In the new version, it is a just a reference to the base Express router, unlike in Express 3, where an app had to explicitly load it.

req.host

In Express 4, req.host incorrectly stripped off the port number if it was present. In Express 5 the port number is maintained.

req.query

In Express 4.7 and Express 5 onwards, the query parser option can accept false to disable query string parsing, and instead use your own function for query string parsing logic.

Improvements

res.render()

This method now enforces asynchronous behavior for all view engines, avoiding bugs caused by view engines which had a synchronous implementation and violated the recommended interface.

Thursday, 1 October 2015

directive link prelink & compile & controller

var app = angular.module('app', []);
app.directive('dad', function () {
    return {
        restrict: 'EA',
        template: '<div class="dad">{{greeting}}{{name}}'+
        '<son></son>'+
        '</div>',
        link: {
            pre: function(scope,elem,attr) {
                scope.name = 'Paul';
                scope.greeting = 'Hey, I am ';
            }
        }
    };
});
app.directive('son', function () {
    return {
        restrict: 'EA',
        template: '<div class="son">{{sonSays}}</div>',
        link: function(scope,elem,attr){
            alert("son");
            scope.sonSays = 'Hey, I am son, and my dad is '+ scope.name;
        }
    };
});

      app.directive('compileExample', compileExample);

    function compileExample() {
      return {
        restrict: 'E',
        scope:{
            type:"="
        },
          bindToController:true,
   controllerAs:'vm',
   controller:function($scope) {
       alert("controller");
   },
        compile: function(tElement, tAttrs) {
            if (tAttrs.type === "new") {
                 angular.element(tElement).append("My new name is {{name}}");
            } else {
                angular.element(tElement).append("My name is {{name}}");
            }
          alert("compile"+tAttrs.type);
          return function postLink(scope, element, attrs) {
              alert("compile postLink");
            scope.name = 'David'
          }
        }
      }
    }