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.

Sunday, 7 September 2014

Connecting MySQL database with Servoy

Hello All,


This tutorials is for new developers into the world of servoy.

While learning servoy must must have gone through this line. "We can connect servoy to any back-end database and same code base will work for any database you connect". That is TRUE and it is very easy to connect databases with servoy. Just we need some information to connect it..

In this article, I am going to show you how we can connect MySQL with servoy.

Friday, 22 August 2014

Adding An Additional Font To Servoy Editable HTML_AREA (TinyMCE)

Hello World, 

As we all know in servoy 7.4.1 onward servoy is using tinyMCE as the default HTML_EDITOR. Servoy stopped using the old and legacy YUIeditor (Now of course this has been upgraded). This will be shown in the client when we place a HTML_AREA and mark it as 'editable' . This is come up with a beautiful editor tool. I know you will just love it.

Thanks to servoy, to make it more better they have also exposed a way to add our external plugins. We can now configure as the way you want. But How ??

To do this :



Tuesday, 19 August 2014

Migrating Postgres SQL from v9.0 to latest version...

Hello everyone,

Having legacy application and want to move to a new platform..well that a good idea of upgrading to the new release than relying on older version.

This article will help those who want to migrate PostgreSQL data from pre-postgres 9.1 to post-postgres 9.1 version.

What will be the problem? It must be a simple upgrade of database?

Well yeah! It is a simple database upgrade. Just keep a backup and upgrade the database and restore the data. Done!

Wait, when you will have a column in postgres having "citext" extension, then bang!! It will not let you in and even if it will, then your application will throws exceptions related to collation mismatch while comparing with values having "citext" data type. Believe me that will make you scream "What the hell is happening...??"

 ERROR: could not determine which collation to use for string comparison Hint: Use the COLLATE clause to set the collation explicitly.

Reason for this problem:


Thursday, 3 July 2014

Click Download And Sleep Tight.....

John : Feeling sleepy....download complete 33%...still long way to go...shit man!! I could have started the download few hours back... Now who will shut this damn thing off..:(

Jeremiah : Is that a problem! huh! Can't you set the auto shutdown option in the download manager set to "Shut down when complete". That is simple!!

John : Aahaan!! Thanks man!! You are a genius!!

Stuart : Hey!! What if your internet connection fails? :P

Jeremiah John : Ooo !! Aaann...

Stuart : Do not worry guys, we have a solution here for this...along with Jeremiah's idea... Few days back I met an guy who wrote something to sort this thing....

REM Author : Sovan Misra
REM Created on : 9th Feb 2013
REM Purpose : To check if internet is connected or not, if connected okay, else shut down
REM Start execution
@echo off
REM goto main label to ping www.google.com
goto :MAIN
:MAIN
ECHO Checking connection, please wait...
PING -n 1 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS
IF     ERRORLEVEL 1 goto :TRYAGAIN
:TRYAGAIN
ECHO FAILURE!
ECHO Let me try a bit more, please wait...
@echo off
PING -n 3 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS2
IF     ERRORLEVEL 1 goto :TRYIP
:TRYIP
ECHO FAILURE!
ECHO Checking DNS...
ECHO Lets try by IP address...
@echo off
ping -n 1 216.239.37.99|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESSDNS
IF     ERRORLEVEL 1 goto :TRYROUTER
:TRYROUTER
ECHO FAILURE!
ECHO Lets try pinging the router....
ping -n 2 192.168.100.1|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :ROUTERSUCCESS
IF     ERRORLEVEL 1 goto :NETDOWN
:ROUTERSUCCESS
ECHO It appears that you can reach the router, but internet is unreachable.
goto :FAILURE
:NETDOWN
ECHO FAILURE!
ECHO It appears that you having network issues, the router cannot be reached.
goto :FAILURE
:SUCCESSDNS
ECHO It appears that you are having DNS issues.
goto :FAILURE
:SUCCESS
ECHO You have an active Internet connection
ECHO Next checking will be done after 300 sec
timeout /T 300
goto :MAIN

:SUCCESS2
ECHO You have an active internet connection but some packet loss was detected.
ECHO Next checking will be done after 300 sec
timeout /T 300
goto :MAIN

:FAILURE
ECHO You do not have an active Internet connection
ECHO Computer is shutting down in 10 mins
timeout /T 600
goto :SHUTDOWN
goto :END
:SHUTDOWN
SHUTDOWN -S
goto :END

:END


Take a note pad -> copy and paste this -> save this file as "net_check.bat" -> Run it -> Go to bed..where ever the internet connection fails, it will wait for 600 seconds for connection to restore before shutting down the system

Make sure you have used Jeremiah's idea too....if connection remains firm this will help to shut down when download completes.

Hope will help you guys!!