Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Javascript Loop particular number replace

Javascript Loop particular number replace

Hi,

Today We Discuss JavaScript how to replace particular number we create one loop that loop how to replace particular number to some string.

Javscript Loop particular number replace
JavaScript Loop particular number replace



var a = 100;
var str =[];
var ar = [];
for(var i=1;i<a;i++){
if(i.toString().indexOf('4') != -1){
   ar.push('buzz');
else {
   ar.push(i);
}
}
console.log(ar);  ////Replaced 4 number only Buzz


output

 [1, 2, 3, "buzz", 5, 6, 7, 8, 9, 10, 11, 12, 13, "buzz", 15, 16, 17, 18, 19, 20, 21, 22, 23, "buzz", 25, 26, 27, 28, 29, 30, 31, 32, 33, "buzz", 35, 36, 37, 38, 39, "buzz", "buzz", "buzz", "buzz", "buzz", "buzz", "buzz", "buzz", "buzz", "buzz", 50, 51, 52, 53, "buzz", 55, 56, 57, 58, 59, 60, 61, 62, 63, "buzz", 65, 66, 67, 68, 69, 70, 71, 72, 73, "buzz", 75, 76, 77, 78, 79, 80, 81, 82, 83, "buzz", 85, 86, 87, 88, 89, 90, 91, 92, 93, "buzz", 95, 96, 97, 98, 99]

How do you reverse a string in JavaScript?

How do you reverse a string in JavaScript?

 

string reverse print javascript
string reverse print javascript

 

Hi,

Today we discuss how to given string reverse print using javascript. blow code.

function stringprint(str){

let strpint = "";
for(let i=0;i<str.length;i++){
strpints = str[i]+ strpint;
console.log(strpints);
return strpints;



Reverse print ;

function reverseespringprint(str){
let reverstr = "";

for(let i>str.length-1;i>=0;i--){
revstr = reverstr+str[i] ;
console.log(revstr);
return revstr;
}

Stimulsoft Reports.JS is a platform for generating reports using JavaScript and HTML5. Angularjs

Stimulsoft Reports.JS is a platform for generating reports using JavaScript and HTML5.


Stimulsoft Reports.js is a platform for generating report using javascript and html5. Normally html design and report geneerating and stimulsoft is autometically report generation and connection string your db connection and wrtie query auto function generation report.


DBconnection
dbconnection
Stimulsoft Report is modify design any design easily modifed and watermark and everything is very easy.

View Report
View Report
Include Files:
 <link href="css/demo.css" rel="stylesheet">
 
 <!-- Report Viewer Office2013 style -->
 <link href="css/stimulsoft.viewer.office2013.whiteblue.css" rel="stylesheet">
 
 <!-- Report Designer Office2013 style -->
 <link href="css/stimulsoft.designer.office2013.whiteblue.css" rel="stylesheet">
 
 <!-- Stimusloft Reports.JS -->
 <script src="scripts/stimulsoft.reports.js" type="text/javascript"></script>
 <script src="scripts/stimulsoft.viewer.js" type="text/javascript"></script>
 <script src="scripts/stimulsoft.designer.js" type="text/javascript"></script>

 <!-- Reports -->
 <script src="reports/OnlineStoreSales.js" type="text/javascript"></script>
 <script src="reports/UsersAppleIpad.js" type="text/javascript"></script>
 <script src="reports/SmartphoneBestsellersInQ12015.js" type="text/javascript"></script>
 <script src="reports/SiteStatistics.js" type="text/javascript"></script>
 <script src="reports/HighlightCondition.js" type="text/javascript"></script>
 <script src="reports/Images.js" type="text/javascript"></script>
 <script src="reports/MasterDetail.js" type="text/javascript"></script>
 <script src="reports/MultiColumnList.js" type="text/javascript"></script>
 <script src="reports/SideBySideListWithContainers.js" type="text/javascript"></script>
 <script src="reports/SimpleGroup.js" type="text/javascript"></script>
 <script src="reports/SimpleList.js" type="text/javascript"></script>
 <script src="reports/ParametersSelectingCountry.js" type="text/javascript"></script>

 <!-- Demo data -->


<script>
  var viewer = null;
  var designer = null;
  
  function createViewer() {
   // Specify necessary options for the viewer
   var options = new Stimulsoft.Viewer.StiViewerOptions();
   options.height = "100%";
   options.appearance.scrollbarsMode = true;
   options.toolbar.showDesignButton = true;
   options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct;
   options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table;

   // Create an instance of the viewer
   viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
   
   // Add the design button event
   viewer.onDesignReport = function (e) {
    this.visible = false;
    if (designer == null) createDesigner();
    designer.visible = true;
    designer.report = e.report;
   };
   
   viewer.renderHtml("viewerContent");
  }
  
  function createDesigner() {
   var options = new Stimulsoft.Designer.StiDesignerOptions();
   options.appearance.fullScreenMode = true;
   options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table;
   
   // Create an instance of the designer
   designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
   
   // Add the exit menu item event
   designer.onExit = function (e) {
    this.visible = false;
    viewer.visible = true;
   }
   
   designer.renderHtml("designerContent");
  }
  
  function setReport(reportObject) {
   // Forcibly show process indicator
   viewer.showProcessIndicator();
   
   // Timeout need for immediate display loading report indicator
   setTimeout(function () {
    // Create a new report instance
    var report = new Stimulsoft.Report.StiReport();
    // Load reports from JSON object
    report.load(reportObject);

    // Remove all connections in report template (they are used in the first place)
    report.dictionary.databases.clear();
    // Registered JSON data specified in the report with same name
    report.regData("Demo", "Demo", Demo);
    // Assign the report to the viewer
    viewer.report = report;
   }, 50);
  }
  
  // Set report button style
  function setReportButton(button) {
   for (var reportName in reportsCollection) {
    var reportButton = document.getElementById(reportName);
    reportButton.isSelected = reportButton == button;
    reportButton.className = reportButton.isSelected ? "ReportButton Selected" : "ReportButton";
   }
  }
  
  // Load first report after the page is loaded
  function onBodyLoad() {
   createViewer();
   selectedButton = document.getElementById("SimpleList");
   onButtonClick(selectedButton, SimpleList);
  }
  
  // Demo Report button events
  // ---
  
  function onButtonClick(button, reportObject) {
   selectedButton.className = "ReportButton";
   button.className = "ReportButton Selected";
   selectedButton = button;
   setReport(reportObject);
  }
  
  function onButtonMouseOver(button) {
   if (button != selectedButton) button.className = "ReportButton Over";
  }
  
  function onButtonMouseOut(button) {
   if (button != selectedButton) button.className = "ReportButton";
  }
 </script>
Html Files
<body onload="onBodyLoad();">
 <div id="designerContent"></div>
 <table class="Main" cellpadding="0" cellspacing="4">
  <tr>
   <td width="150px">
    <table class="LeftPanel" cellpadding="0" cellspacing="0">
     <tr>
      <td height="60px">
       <img style="position: absolute; width: 150px; left: 0px; top: 5px;" src="images/StimulsoftReports.png" />
       <img style="position: absolute; width: 30px; height: 30px; left: 105px; top: 25px;" src="images/Js.png" />
      </td>
     </tr>
     <tr>
      <td height="90%">
       <div class="Buttons">
        <script type="text/javascript">
         // Report id and names for this Demo
         var reportsCollection = {
          "OnlineStoreSales": "Online Store Sales",
          "SimpleList": "Simple List",
          "HighlightCondition": "Highlight Condition",
          "Images": "Images",
          "MasterDetail": "Master-Detail",
          "UsersAppleIpad": "Users Apple Ipad",
          "SmartphoneBestsellersInQ12015": "Smartphone Bestsellers In Q1 2015",
          "MultiColumnList": "Multi-Column List",
          "SimpleGroup": "Simple Group",
          "SiteStatistics": "Site Statistics",
          "ParametersSelectingCountry": "Parameters Selecting Country"
         };
         // Render all report buttons
         for (var reportName in reportsCollection) {
          document.write(
           "<a class=\"ReportButton\" id=\"" + reportName + "\"" + 
           "onmouseover=\"onButtonMouseOver(this)\"" +
           "onmouseout=\"onButtonMouseOut(this)\"" + 
           "onclick=\"onButtonClick(this, " + reportName + ")\">" +
           "<table cellpadding=\"0\" cellspacing=\"0\">" +
           "<tr><td style=\"text-align: center; width: 100%;\"><img src=\"images/" + reportName + ".png\" /></td></tr>" +
           "<tr><td class=\"Caption\">" + reportsCollection[reportName] + "</td></tr>" +
           "</table>" +
           "</a>");
         }
        </script>
       </div>
      </td>
     </tr>
    </table>
   </td>
   <td height="100%" id="viewerContent"></td>
  </tr>
 </table>
</body>
</html>




Java For Beginners

  JAVA  FOR BEGINNERS  

 Java is a high level object oriented programming language.java developed by sun Microsystems in 1995.java runs on variety of platforms such as windows , Mac is , and various versions of UNIX.
Java For Beginners
Java For Beginners

Java Is Platform Independent

Platform independent is a program capability of moving from one computer system to another.
Java is portable.
Java is security.
Java is simple.

We will discuss about  simple java program

Class firstjava {
public  static void main( String args [])
{
System. out.println("hello  world");
}
}

this program has two main parts:

All the program enclosed in a class definition:  - here class called first java.

Body  of the program contained in a method called main(). In java applications as in c and c++
Program. main() is the first method or function in the program that is run when  the program is executed.


This continue will come in  next post.

Angularjs Image Crop

A simply way to crop image using  Angularjs



Image Croping
Angularjs Image Crop


Angularjs Image Crop

Whenever we allowing a user upload image, it's better to provide cropping option for them.  Touch support, swipe to move and drag handle to zoom image. Output as a base64 encoded data Url
Uses HTML5 Canvas to display image in a flexible context, to allow dragging and zooming.
Angularjs

Try this following code

Style.css

.cropImage {
  background: #E4E4E4;
  overflow: hidden;
  width:500px;
  height:350px;
}


View.html

<body ng-app="app" ng-controller="Ctrl">
  <div>Select an image file: <input type="file" id="fileInput" /></div>
  <div class="cropImage">
    <img-crop image="myImage" result-image="myCroppedImage"></img-crop>
  </div>
  <div>Cropped Image:</div>
  <div><img ng-src="{{myCroppedImage}}" /></div>
</body>


Controller.js

angular.module('app', ['ngImgCrop'])
  .controller('Ctrl', function($scope) {
    $scope.myImage='';
    $scope.myCroppedImage='';

    var handleFileSelect=function(evt) {
      var file=evt.currentTarget.files[0];
      var reader = new FileReader();
      reader.onload = function (evt) {
        $scope.$apply(function($scope){
          $scope.myImage=evt.target.result;
        });
      };
      reader.readAsDataURL(file);
    };
    angular.element(document.querySelector('#fileInput')).on('change',handleFileSelect);
  });



Jquery() Function


jQuery to replace one tag with another

Using jQuery, I'm trying to replace all the occurrences of:
<p>.....</p>

With

<h1>.....</h1>

Code


$('p').replaceWith(function(){
    return $("<h1/>", {html: $(this).html()});
});



Disabling Right Mouse Click

If you are to disable right click on your web browser, you can use the following piece of code:

$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});


Detect Current Mouse Coordinates

Now, suppose you need to detect the current mouse coordinates in the web browser in use. To do this, you can write the following piece of code:


$(document).ready(function() {
$().mousemove(function(e)
{
$('# MouseCoordinates ').html("X Axis Position = " + e.pageX + " and Y Axis Position = " + e.pageY);
});
<div id=MouseCoordinates></div>
});



Set a Timer

The following piece of code can be used to set a timer using jQuery:

$(document).ready(function()
{
window.setTimeout(function()
{
// some code
}, 1000);
});