Category: Web Development
Execute Javascript code on browser back button
Here is sample code to trap browser back button and execute Javascript code on this event: jQuery(document).ready(function($) { if (window.history && window.history.pushState) { $(window).on(‘popstate’, function() {//when back is clicked popstate event executes //code here will execute on back click });
Salesforce | Visualforce Component to AWS S3
Description : To access the features provided by amazon for storage and cloud computations from a visualforce component , the S3 service uses information from the form’s input fields to authorize uploads, and to set the properties of uploaded file
jQuery and HTML5 validations together
When we use HTML5 validation on form fields like required attribute, input type email, pattern attribute etc, then form data is not submitted until all HTML5 validations are passed. But if we associate some jquery code to the submit button
Java | Execute SQL script using Maven
Whenever there is a change in the database whether we are altering database structure or adding/updating data inside database most of the times we create a script file and run it manually. We can automate this process using Maven. Solution:
PHP | strpos() and result compare
strpos($wholeText, $findText) in PHP returns position from which the $findText value starts if it is present in $wholeText. If it is not found then this function returns false. Fun starts when text is found at the very beginning (at position
Salesforce | Delete the Info/list of records permanently from Salesforce Recycle Bin
You are not able to delete the records permanently and the records will be stored into the Recycle bin till 15 days from the deletion date: Number of records stored in recycle bin = 5000* Number of Licenses your organisation
PHP – Get files modified on a particular date
Solution: In following example we have filtered files which are modified on current date (today’s date): $source= “C:\wamp\www\Files\”; $files = scandir($source); $archiveFiles = array(); foreach($files as $file) { if (!in_array($file,array(“.”,”..”))) { $lastModified = date(‘d/m/y’,filemtime($source . ‘/’ .$file)); IF($lastModified==date(“d/m/y”)) { array_push($archiveFiles, $file);
Moodle/Totara | Moodle not inserting values to new column added to an existing table
In Moodle, if we alter a table by adding a new column to it and use Moodle $DB->insert_record(‘table_name’,$dataobject) , it inserts the value which are assigned to old columns but not to the newly created columns. For Example: if we
Selenium | How to locate an element with css selector and set value in it using code
See the image below and html source of it. There is an element with name “email”. If we want to access that field and set a value in it, we can achieve that with this sample code: public void test()