JavaScript

Wednesday, 13 January 2016

Create ZIP file with multiple file in a folder



   first you can add system.io.compression.filedirectory
 then create a file and move it a folder then compress it


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Compression;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileNamewithExtension = DateTime.Now.Ticks.ToString() + ".txt";
            string filePath = @"C:\AbhishekData\" ;
            string fileName = filePath + fileNamewithExtension;
            using (FileStream fs = new FileStream(fileName, FileMode.Append, FileAccess.Write))
            {
                string s = "My Name is abhishek";
                byte[] byteArray = Encoding.ASCII.GetBytes(s);
                fs.Write(byteArray, 0, byteArray.Length);
                fs.Flush();
                fs.Close();
              
                string zipPath = @"C:\AbhishekData\"+ DateTime.Now.Ticks.ToString()+".zip";
                if (!Directory.Exists(@"C:\AbhishekData\myabc"))
                {
                    Directory.CreateDirectory(@"C:\AbhishekData\myabc");
                    File.Move(fileName, @"C:\AbhishekData\myabc\"+ fileNamewithExtension);
                    ZipFile.CreateFromDirectory(@"C:\AbhishekData\myabc", zipPath,CompressionLevel.Fastest,true);
                }
                else
                {
                    File.Move(fileName, @"C:\AbhishekData\myabc\"+ fileNamewithExtension);
                    ZipFile.CreateFromDirectory(@"C:\AbhishekData\myabc", zipPath, CompressionLevel.Fastest, true);
                }
            }
        }
    }
}

Tuesday, 13 October 2015

Create Cross Page Posting in web api through angular javascript

Develop you first web api application Using .Net IDE

   [ActionName("GetValues")]
        public IEnumerable<string> Get(string UserName, string Password)
        {
            return new string[] { "value1", "value2" };
        }

This API return array of string then we consume
using angular javascript

var phoneCateApp = angular.module('PhoneCatApp', ['ngRoute']);

phoneCateApp.controller('PhoneCateController', function ($scope, $http) {
   
    $http({
        url: 'http://localhost:52600/api/Values/GetValues',
        method: "GET",
     
        contentType: "application/json",
        headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
  
        data: '{ UserName: fsdfsda, Password: fsdfsda }'
    }).success(function (data) { $scope.PhoneList = data; });

});

inject the ngRoute in angular javascript

then set the web.config web api

 <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
      </customHeaders>
    </httpProtocol>

in <system.webserver>


Then your application call all your rest service successfully

Wednesday, 24 June 2015

Form Validation throgh Angular js

 i am searching on internet then found many missing thing on validation on form when you are beginner and learning in angular js
I am follow few step of validation of angular js then validate my form. validation script
   var d = angular.module('myapp', []);
    d.controller('HomeController', function($scope) {
      $scope.loginForm = {
        UserName: '',
        password: '',
        email: '',
        Gender: [{
          value: 0,
          text: '--select--'
        }, {
          value: 1,
          text: 'Male'
        }, {
          value: 2,
          text: 'female'
        }]
      }
      $scope.form = $scope.loginForm.Gender[0].value

      $scope.validate = function(model) {

        $scope.form1.$submitted = true;
        $scope.selectedGender = document.getElementById('ddlGender').value == '0'
        if ($scope.selectedGender) {
          return false;
        }
        if ($scope.form1.$valid) alert(1);

      }
      $scope.onSelectChange = function() {
        $scope.selectedGender = document.getElementById('ddlGender').value == '0'
      }

    })

Name This is required
Password This is required
Gender this is required

Friday, 27 March 2015

Post List of object using ajax in server side



  This is simple step how to send data client side to server side using javascript and jquery
/// arry your object u can store value of json type
  var array = [];
        function SendData() {
            if (array.length > 0) {
                var json_Parse = JSON.stringify(array);
             
                console.log(json_Parse);
                $.ajax({
                    type: "post",
                    url: "LargeDataPageLoad.aspx/GetString",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: '{ "obj":' + json_Parse + ' }',
                    success: function (response) {
                        response ? alert("It worked!") : alert("It didn't work.");
                        onCustomerClick();
                    },
                    error: function (xhr, status, error) {
                        alert(error);
                    }
                });
           
            }
       
         }

Thursday, 26 March 2015

Best way manipulate data in json array get server side using client side

 
 <script type="text/javascript">
        $(document).ready(function () { });
        function onCustomerClick() {
            $("#CustomerDetails").html('');
            $("#CustomerDetails").append('<table widht="100%" id="newTable"  cellpadding="5">' +
            '<tr><th>&nbsp;</th><th>&nbsp;</th><th>CustomerCode</th><th>Customer Name</th><th>Name On Card</th><th>Created Date</th><th>&nbsp;</th></tr>');
            var optionHTML = '';
            optionHTML += '<select>';
            $.ajax({
                type: "post",
                url: "LargeDataPageLoad.aspx/LoadHugeData",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    $.each(response, function (key, value) {

                        var json_data = JSON.parse(value);
                        console.log();
                        for (var index = 0; index < json_data.dt.length; index++) {

                            var selectId = "select_" + index;
                            var d = new Date(json_data.dt[index]["CreatedDate"]);
                            $("#newTable").append('<tr><td>' + (index + 1) + '</td><td><input type="checkbox" onchange="enableDropdown(this,' + selectId + ')" id="chk_' + index + '"/></td><td>' + json_data.dt[index]["CustomerCode"] + '</td><td>'
                                                     + json_data.dt[index]["NameOnCard"] + '</td><td>'
                                                     + json_data.dt[index]["CustomerName"] + '  <td>' + d.toLocaleDateString()
                                                     + '</td><td id="td_' + index + '"></td></tr>'

                                               );

                            { $('#td_' + index).append('<select id="select_' + index + '" disabled="disabled" >'); }
                            for (var option = 0; option < json_data.dtOption.length; option++) {
                                if (option == 0)
                                    $('#select_' + index).append('<option value="-1">-Select-</option>');
                                $('#select_' + index).append('<option  value="' + json_data.dtOption[option]["Value"] + '">' + json_data.dtOption[option]["Name"] + '</option>');

                            }
                            $('#td_' + index).append('</select></td>');
                            //$('#td_' + index).html(optionHTML);
                        }
                        //                        $.each(value, function (key1, value1) {
                        //                            console.log(key1);
                        //                            var json_data = JSON.parse(value1);
                        //                            for (var index = 0; index < json_data.length; index++) {
                        //                                $("#newTable").append('<tr><td>' + json_data[index]["CustomerCode"] + '</td><td>'
                        //                             + json_data[index]["NameOnCard"] + '</td><td>'
                        //                             + json_data[index]["CustomerName"] + '</td>'

                        //                           );
                        //                            }

                        //                        });

                    });
                },
                error: function (xhr, status, error) {
                    alert(error);
                }
            });

            $("#CustomerDetails").append('</table>');
        }
        var array = [];

        function enableDropdown(value, ddlValue) {

            var ddlId = '#' + ddlValue.id;
            var splitValue = ddlId.split('_');
            var json_data = { id: parseInt(splitValue[1]) };

            $(ddlId).attr('disabled', !document.getElementById(value.id).checked);
            if (document.getElementById(value.id).checked) {
                array.push(json_data);
              
            } else {
              $.grep(array, function (n, i) {
                 if(typeof n != "undefined")
                if (n.id == parseInt(splitValue[1])) {
                  
                    var index = array.indexOf(array[i]);
                  
                    if (index > -1) {
                        array.splice(index, 1);
                    }
                }
                return array;
            });
            }
            console.log(array);
        }
    </script>

Friday, 31 May 2013

Creat google map your website

<script type="text/javascript">
var map;
var infowindow;
 var k =0
var lat = [28.6312870,28.634244 ,28.634401,28.626969]
var lang =[77.2270520, 77.22220300000004, 77.222125,77.22228300000006]
var destination =['Lalit House', 'Nirulas', 'Costa Coffee','British Council']
function initialize()
{
  var pyrmont = new google.maps.LatLng(28.6312870, 77.2270520);
  map = new google.maps.Map(document.getElementById('googleMap'), {
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    center: pyrmont,
    zoom: 15
  });

 
  infowindow = new google.maps.InfoWindow();
  var service = new google.maps.places.PlacesService(map);
  var placeLoc = '(28.6312870, 77.2270520)';
  for(var i =0 ; i< lat.length; i++)
    {
  if(i < lang.length){
  for(var j =0 ; j < lang.length; j++)
  {
  var items = new google.maps.LatLng(lat[i++],lang[j])
   if(j< destination.length){
    createMarker(items,destination[k])
        }
     k++;
      }
    }
  }
}
function createMarker(place,name)
{
  var marker = new google.maps.Marker({ map: map, position:place });
  google.maps.event.addListener(marker, 'click', function()
  {
    infowindow.setContent(name+"<div><a href=\"\">More Info</a></div>");
    infowindow.open(map, this);                 
  });
}
google.maps.event.addDomListener(window, 'load', initialize);

    </script>
<div id="googleMap" style="width:400px; height:300px;" runat="server"></div>

Tuesday, 30 April 2013

Create XML file usign C# and then create sub node in existing file

 string file = @"c:\bb.xml";  
        // declearation 
       // parent node
        
        XmlElement subnode = xdoc.CreateElement("subnode");
       // Checking File Exist or not
        if (File.Exists(file))
        {
            xdoc.Load(@"C:\bb.xml");
            xdoc.DocumentElement.AppendChild(userinfo(txtuser.Text, txtpass.Text));
            xdoc.Save(file);
        }
        else
        {
            subnode.AppendChild(userinfo(txtuser.Text, txtpass.Text));
            xdoc.AppendChild(subnode);
            xdoc.InsertBefore(xdoc.CreateXmlDeclaration("1.0", "utf-8", null), subnode);
            xdoc.Save(file);
        }


// then create the xml node using this methods


XmlNode node = xdoc.CreateElement("Info");
        XmlNode user_node = xdoc.CreateElement("user");
        user_node.InnerText = user.ToString();
        node.AppendChild(user_node);
        XmlNode pass_node = xdoc.CreateElement("password");
        pass_node.InnerText = pass;
        node.AppendChild(pass_node);
        return node;

Friday, 8 March 2013

Top 40 blog websites visit more and more visitors

    
 Top 40 blog websites visit more and more visitors

1. The Huffington Post
   
2. BuzzFeed - Latest

3. Mashable!

4. The Verge

5. Business Insider
   
6. Gawker

6. TechCrunch

8. Ars Technica

9. Engadget

10. Gizmodo

11. Breaking news and opinions on …

12. TMZ.com | Celebrity Gossip | …
   
13. L.A. NOW
   
14. The Next Web

15. Mediaite

16. Bits

17. Deadspin

18. Boing Boing

19. Jezebel
   
20. Deadline.com

21. Hot Air

22. Laughing Squid
   
23. SB Nation

24. ZeroHedge

25. The Opinionator

26 | HuffingtonPost


27 | TMZ


28 | BusinessInsider


29 | engadget

30 | PerezHilton


31| Gizmodo


32 | Mashable


33 | TechCrunch


34 | Gawker


35 | lifehacker


36 | The Daily Beast


37 | SmashingMagazine


39 | FailBlog


40 | Kotaku


41 | boingboing

Thursday, 21 February 2013

First Application with MVC pattern in form submit app

First of you create mvc application
then you create view, controller, model class

then go the view page see the code in form submit


then go the model class
create you database class and property


then go Controller page create your logic

3

put into the controller class

Monday, 18 February 2013

Fetch data using database in JSON form and populated with Dropdown lis


 first of create you asp.net application then attach the database

then create default.aspx page then define your code fetch the data in databse in Json format


then add your aspx page using jquery



Add  you jquery in header then call in function in body onload then work perfectelly

Monday, 16 April 2012

How to validate date through Jquery






Submit



date validation through jquery......................


$("#Text3").datepicker({numberOfMonths:2,
     showButtonPanel: true,
     dateFormat:'dd/mm/yy',
     autoSize: true,
    
     maxDate: '+3m',
     Image:"image.axd.jpeg",
     showOn: 'both'
    
  
     });
     $("#button").click(function(){
     //alert("hello");
     var dateformat= document.getElementById("Text3");
     var splitvaue= dateformat.value.split('/');
    
     var date= new Date();
     alert(date.getMonth()+1);
    
    // if((parseInt(splitvaue[0])>=date.getDate())&&(parseInt(splitvaue[1]))>=(date.getMonth()+1)){
if(parseInt(splitvaue[1])<13 && parseInt(splitvaue[0])<=31){
    if(parseInt(splitvaue[2])==(date.getFullYear())) {
        alert("hello");
     }
}
     else
     {
     alert("should be enter Today Date");
     }
   
         });
     });


Saturday, 14 April 2012

How to handle dropdown list with Jquery ???







then dropdown code this work 




Monday, 6 February 2012

how to validate date in dd/mmm/yyyy format

this is simple validation in date format

function a(){
var i=document.getElementById("t1").value;

if(abc(i)){
alert("valid")}
else
{
alert("not valid");
}
}
function abc(output){
var i=output;
var reg= new RegExp("^([0][1-9]|[1-2][0-9]|[3][0-1])/(jan|JAN|Jan|feb|Feb|FEB|mar|Mar|MAR|apr|Apr|APR|may|May|MAY|May|Jun|jun|JUN|jul|JUL|Aug|aug|AUG|Sep|sep|SEP|Oct|oct|OCT|nov|Nov|NOV|dec|DEC|Dec)/([1-9][0-9][0-9][0-9])");
//document.write(i);
return reg.test(i);
//if(i=="")
//alert("blank");
}
 </script>

Tuesday, 17 January 2012

Free Blog Creation Website List

Blog is most important effort any website, you can daily update own website through blog.
I have most famous blog found,
List are given below
----------------------------------------------------------------------------------------------------------

http://www.blogger.com/

http://www.weebly.com/

http://www.scribd.com/

http://www.webs.com/

http://www.livejournal.com/


Saturday, 7 January 2012

How To Add Google Pluse Bladge In Blogspot


1)  Create Page own Google Pluse

2)  Then you can go to the https://developers.google.com/+/plugins/badge/
3)  Which type of Bladge you want

    Then your 14 digit string provide your page URl

    Go to https://developers.google.com/+/plugins/badge/config
    provide then some Java Script code then you past in HEAD tag


    <!-- Place this tag in the <head> of your document -->
<link href="https://plus.google.com/Your 14 Digit no provide by your google pluse" rel="publisher" /><script type="text/javascript">
(function()
{var po = document.createElement("script");
po.type = "text/javascript"; po.async = true;po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(po, s);
})();</script>

  --------------------------------------------------------------------

    Finally post your code in

    <g:plus href='https://plus.google.com/Your 14 Digit no provide by your google pluse' size='badge'/>

Friday, 6 January 2012

Do-Follow Article and Blog


http://www.realtychat.com/
http://newsjungle.us/
http://www.inube.com/
www.free-adz.com
http://www.allthewebsites.org/
http://www.212articles.com/
http://blog.co.in/
http://www.freescrapblogs.com/
http://teacherlingo.com/
http://articles.besttofind.com/
http://www.thewhir.com/
http://www.articleblast.com/
http://www.flixya.com/
http://www.blogdrive.com/
http://www.india-friends.com
http://www.experienceproject.com/
http://www.travelpod.com/
http://www.ultimatearticledirectory.com/
http://www.articlesisland.com/
http://www.bloglines.com/logout
http://www.tumblr.com/
http://www.upublish.info/
http://www.pubarticles.com/
http://www.articlesbase.com/
http://articledirectory.com/
http://www.pixel4less.com/
http://www.smallbizarticles.com/
http://ukrealestateinfo.com/
http://www.articlemint.com/
http://www.1articleworld.com/
http://www.articlegallery.net/
http://blogfather.net/     
http://www.busythumbs.com/
http://zoock.net/
http://www.articlefarm.com/
http://www.articledepot.co.uk/
http://www.1888articles.com/
http://a-p-e-x.org/
http://www.articletrader.com/     
http://www.articlebin.com/
http://www.ezinearticles.biz/
http://www.insanejournal.com/     
http://www.com-x2.com/     
http://www.ideamarketers.com/
http://www.articlecity.com/
http://linrails.com/submit.php
http://www.site-reference.com/
http://www.workoninternet.com/
http://www.articlebiz.com/
http://www.article-treasure.com/
http://www.articlemark.org/
http://www.articlecube.com/
http://www.articlerich.com/
http://www.articlefair.com/
http://www.directoryniche.co.uk
http://articles.widbox.com/
http://www.articlesxpert.com/

Thursday, 5 January 2012

DO-Follow forum list Creat back link


http://forums.kayako.com/
http://forums.thedailywtf.com/
http://www.webmasterserve.com/
http://forums.digitalpoint.com/
http://www.exbii.com/
http://forums.serchen.com
 http://www.affiliateseeking.com/forums/
http://www.veoh.com/bulletin 
http://www.kaskus.us/
http://www.kirupa.com/
http://www.t-shirtforums.com/
http://www.sitepoint.com/
http://www.bcmtouring.com/
http://www.crazyengineers.com/
http://hackforums.net/
http://www.vectorsforum.com/
http://forums.mangafox.com/
http://forum.lowyat.net/  
http://www.seorefugee.com/forums
http://forums.seochat.com
http://whirlpool.net.au 

Sunday, 1 January 2012

How to verify own blog through technorati

you can make account then put the own url in the technorati ---


then post your blog like as my token code this ----

GWF2QXS3JUAR


then your blog is approve through technorati, get the huge traffic your website

Networking ties

The year 2011 truly belonged to the digital consumer. Social networking sites became the meeting point for almost anything — from finding friends to protesting against corruption. In 2011, India touched the 100-million mark in terms of internet users, 85 million being active users. The numbers may be relatively small compared to other markets, but this is a significant base for online firms. For LinkedIn, India is the second-largest base after the US. Google+ has garnered four million users in a short span and Facebook has close to 40 million Indian users. Here’s what you can expect in 2012.
PROFESSIONAL NETWORKING
If 2011 was a year in which online networking garnered attention the world over, in India, we saw professional networking gain immense traction with professionals. People have realised the value of building their online identity of record and have, thus, started leveraging such platforms to showcase and brand themselves. Not only professionals, but students and entrepreneurs have also started using these networking options as a launch pad for their career that helps them establish their profiles, connect with like-minded professionals and generate leads and business development. To give you an example, one of our members, Purvish Diwanji, director, Satyajit Chemicals, created a free company page on LinkedIn. He connected with prospective international partners and got a $15000 assignment from a buyer in South Africa.
THE FORECAST FOR 2012
Professional networking in India will continue to grow. The primary reason for this is the large number of individuals entering the workforce. Having started our India operations in 2009, we have grown from a mere 3.4 million to a 13 million member base, the largest market after the US. The growth opportunity in India is, thus, tremendous. Professional networks need to continue to remain contextual and relevant to its audiences. As long as we continue to connect talent with opportunity, our members, recruiters and brands will derive value from the platform.  
DOMINANT PLATFORM: MOBILE OR ONLINE?
Mobile and online content is always evolving. Our mission is to make professionals productive and successful and to do this we will be present on relevant platforms. We work where the professional works — applications for the BlackBerry, Android and iOS give them the ability to engage on groups, read the top news in their industry, look up a person before a meeting or simply connect with a new contact without the need to be stationed on a computer. A mobile product cannot host just a profile, but needs added features to provide maximum value to a user. That is why you see that we have various features that drive value and engagement on the go. With mobile penetration increasing in India, supported by affordable data access, this platform, in my opinion will lead to increased engagement among professionals.
Hari V Krishnan, Country Manager, LinkedIn India 

Source------>http://www.business-standard.com/india/news/networking-ties/460387/

Friday, 30 December 2011

How to Improve Local SEO Efforts

Optimizing a website for local search is important for a few reasons. First, the number of smart phone and tablet users is on the rise meaning that a larger percentage of searches are being performed “on the go”. Mobile web searchers are often looking for local information and local establishments. Second, search is becoming more personalized and search results vary depending on individual search behavior, social media connections, and location. Therefore, it’s important to consider the following local SEO best practices while conducting an SEO campaign:
Incorporate Local Keywords
The first step of an SEO campaign is to conduct keyword research to find out how target audience members are searching for the products or services that you provide. Skipping this step can result in less traffic or less qualified traffic that won’t convert. Keyword research should first be conducted nationally, and then localized later by adding the city or town, state, and neighborhood in front of the chosen keyword. For example, for a local pizza shop it makes more sense to optimize for “Anytown NY pizza place” than it does to target the much more broad “pizza place”.
Develop Local Search Profiles
You don’t need to be a business that only operates locally to create a local search profile. In fact, all businesses should submit their information to Google, Yahoo!, and Bing local directories. It improves search engine results page visibility, increases your online real estate, and builds another legitimate inbound link to your website.
Include Contact Information
Contact information including a physical address, a mailing address, and a phone number should be included on every page of the site and should be crawlable text that the search engine spiders can “read”. For many websites it makes sense to include this information in the footer.
Optimize Social Profiles
Just as you would optimize your website for local keywords, it’s important to do the same to your social media pages. Optimize the title of the page using a local keyword and include local terms in the bio sections as well as in post content whenever it makes sense to do so.
Make Sure Your Website is Mobile Friendly
What’s the point of optimizing your site for local search from mobile devices if your site can’t be viewed on a mobile device? You can’t assume that a visitor will return to your site at a later time on a desktop. In fact, it’s doubtful that that will happen. They will simply go to your competitor’s site and do business with them instead.
Source----- http://isedb.com/20111230-16168.php