Thursday, 11 December 2014

Stripping HTML from EXCEL SHEET, Easy way for clean up...

Hello guys,

Got a EXCEL SHEET with loads of HTML TAGS....and want to STRIP it....

So here is an easy way of doing it..


Open the excel sheet with the data having HTML tags...

Go  to EDIT Menu and look for Find & Replace...



Then comes the powerful regular expression... It will search through the complete sheet and look for the text between "<" and ">"...and eliminate then leaving behind only text.
So, Copy this and put it in Search for box :  "<[^<>]*>" (without quotes).

Leave the "Replace with" box empty and Hit "Replace All" button..

Gotcha!! The excel sheet with only text, no unwanted HTMLS tags.. :)


Hope this will help..


Thanks
Sovan

Sunday, 19 October 2014

Servoy - How to Rotate Image (clock and anti-clockwise)...

Hi All,

Int his article, rather a tip, I am going to explain how to rotate an image in an media field clockwise and anti clock wise. It is very easy to do but sometimes we look around different stuffs to achieve this. Here is a small method that will rotate an image attach to an media field.

Steps :




  • Place a media field in servoy form and place two buttons for clockwise and anti clockwise rotation.
  • Attach an data provider to the media field. You can add a form variable or a database column.
  • Attach the code here to the buttons. Make sure to name the button as 'btn_clockwise' and 'btn_anticlockwise' respectively.
  • Define a form variable 'rotatingOrientation' which holds the initial angle of rotation. Initially define it as 0*.
  • That is all. you can also copy the code below. 


/*************************************************************
* This method will rotate the image in clockwise and
* anticlockwise on two button click respectively
**************************************************************/

/**
 * @properties={typeid:35,uuid:"9450ACA1-6BC6-4310-B013-F28FE4D96936",variableType:-4}
 */
var imageData = null;

/**
 * @properties={typeid:35,uuid:"CB1ABE68-C4E9-4367-82E5-38AF9BE27509",variableType:-4}
 */
var $image = null;

/**
 * Hold the angle the image will be rotated to
 * 
 * @type {Number}
 * 
 * @properties={typeid:35,uuid:"E59FFF2E-2AC5-494B-8134-4CB1E39C39F9",variableType:8}
 */
var rotatingOrientation = 0;

/**
 * Rotate an image clockwise and anti clockwise
 * 
 * @author sovanm
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"50BA214F-8548-42EB-884C-BCB0A6979779"}
 */
function rotateImageClockWiseAndAnticlockwise(event) {
 
 // If desired to rotate clockwise
 if(event.getElementName() == 'btn_clockwise') {
  
  rotatingOrientation += 90;                                           // Add 90' to the angle
  if(rotatingOrientation >= 360){
   
   rotatingOrientation = 0;                                            // If angle greater than 360', reset to 0'
  }
  $image = $image.rotate(rotatingOrientation);                         // Rotate the image
  imageData = $image;                                                  // Save it in a variable
  
 } else if(event.getElementName() == 'btn_anticlockwise') {
  
  rotatingOrientation -= 90;                                           // Subtract 90' from the angle
  if(rotatingOrientation <= -360) {
   
   rotatingOrientation = 0;                                            // If angle less than -360', reset to 0'
  }  
  $image = $image.rotate(rotatingOrientation);                         // Rotate the image
  imageData = $image;                                                  // Save the image
 }
}

/**
 * Callback method when form is (re)loaded.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"3BDA02C0-4EB5-4004-BC4B-6AE195DE6FE3"}
 */
function onLoad(event) {
 
 $image = plugins.images.getImage('C:/Users/sovanm/Desktop/images/house.jpg');
 imageData = $image;
}


Hope this will be helpful.

Thanks
Sovan

Thursday, 2 October 2014

XML5608 : Expected Semicolon Line X , Column Y (HeadBang! Only happens in IE!!)



Opened the solution in Chrome, worked fine...
Opened the solution in Firefox, worked fine...

Now opening the Solution in Internet Explorer..Duh!!...ERROR..
What ?? Why ?? Where??


Surprised? No not really because error is on IE only...hope you got what I meant.

Hello folks,
Welcome to the unique world of issues with respect to IE... :P

Wednesday, 17 September 2014

Servoy Web Services Part-4

Hello and welcome back... :)

Hope by this time you must have successfully posted a form and save the data in database...
Now let move ahead and GET those data and display in our web page.

To fetch data from Servoy one must have to do a GET request through HTTP. 
Let us add a HTML Button to send the request. We can request for a particular record, bunch of records or all the records. So let us put a text box as well to to enter the ID to be fetched.

 <label for="name">Enter ID to get the value:<br></label>
 <input name="elementId" type="text"  /><br><br>
 <input type="button" value="GET" onclick="getServoyDataInForm();"/>

Definition of  getServoyDataInForm()...

Servoy Web Services Part-3

Hello,

Welcome back again...Keep your fingers ready to type in some codes now...

Let us create a HTML file and have a form with simply two fields 'firstName' and 'lastName'. We will be doing POST request to post these form data to servoy web service and store them in database.

HTML form contents
 <form id="myForm">
      <label for="name">First Name:</label>
      <input name="firstName" type="text"  /><br>
 <label for="name">Last Name:</label>
 <input name="lastName" type="text"  /><br>
      <input type="button" value="Submit" onclick="postFormDataToServoy();"/>
</form>

Lets add JQuery to our web page...

<script src="jquery.js"></script>

Tuesday, 16 September 2014

Servoy Web Services part-2

Hello,

Welcome Back, 

In the first part we have learnt about the web services and what are the different method we have in HTTP Request.

In this article , we are going to create a solution in Servoy and write few methods that will map to the HTTP requests.

Before we jump into creating solutions and methods, let understand how servoy handles the requests from HTTP...

Servoy Web Services Part-1

Hello,


We must have heard about web services and some point of time we must have wondered, it is possible to expose servoy method (server side methods) as Web Service over network?

The answer is YES!!
Servoy has everything we wish for...kinda cool.. :)

Before we move ahead on how to use web services in servoy, let us first understand what is web services and why we need to use that in servoy application.

What is web service ?

Web service helps in communicating between client and server over World Wide Web's (WWW) Hypertext Transfer Protocol(HTTP).

Why Web services ?

- We can use Web Services to expose some server-side methods to be remotely invoked using HTTP, meaning it can be activated by using HTTP request. So Web Services allows to expose functionality over the network.
- Helps in connecting two different application. Web services allows different applications to talk to each other and exchange data and services among themselves example ".NET" application can talk to java web services and vice verse, Web application can talk to Servoy application and vice verse. So, Web services is used to make the application platform and technology independent.
- Easy to use.
- We can expose functionality of our application. So you might be thinking it is not secure. We can even make it secure by using authentication in web services.