Posts

Showing posts from 2015

Solving Gradle DSL method not found : 'android()'

Image
Getting "Gradle DSL method not found : 'android()" error, well then you are at right place to solve the things :)


Solution:
Open the project top level 'build.gradle' file Remove the below configuration  android() method  // Delete these lines from project top level 'build.gradle' file android {  compileSdkVersion 23  buildToolsVersion '22.0.1' }
Save the changes and re-compile

Configure Jenkins email notifications

Image
In this tutorial we will discuss about setting up the email notification in your Jenkins environment from the start :

Part I: Configure the email notifications from Jenkins Management section.
Part II : Configure the email notification for the individual Jenkins job  

Part I: Configure the email notifications from Jenkins Management section.
First you should be logged in to Jenkins interface as Administrators, so you should see 'Manage Jenkins' link on the left side options. Click on the 'Manage Jenkins', to navigate to 'Manage Jenkins' page. 'Configure System' option should be available Click on the 'Configure System' link, scroll down on 'Configure System' page, you should see the 'Email notifications' section. Set the following settings in the 'Email notification' section [We are taking yahoo domain for example]SMTP Server : smtp.mail.yahoo.comCheck 'Use SMTP Authentication'Username : <email address to send emails&…

Some helpful commands to build multi-module maven project tests

Build and execute tests from all the sub modules


mvn clean install
Build and execute tests from a specific sub module

mvn clean install -pl <module-name> -am
Build and execute a specific test from a specific sub module

mvn -DfailIfNoTests=false -Dtest=<test-class-name> clean install -pl <module-name> -ammvn -DfailIfNoTests=false -Dtest=<test-class-name#test-method-name> clean install -pl <module-name> -am

An error occurred while resigning the app 'selendroid-test-app-0.15.0.apk'

Image
An error occurred while resigning the app 'selendroid-test-app-0.15.0.apk'


If you got the same error message while trying to start the Selendoid server with your apk file, try the below to fix it :

Solution : 

Check JAVA_HOME is set properlySet System variable with name "JAVA_HOME"  with value set to Java jdk like "C:\Program Files\Java\jdk1.8.0_40\"Check ANDROID_HOME is set properlySet System variable with name "ANDROID_HOME"  with value set to Android Sdk like "C:\Users\lalit\AppData\Local\Android\sdk\"

Still after setting the above variables correctly, if you see any error try to sign your app manually using below command
C:\Program Files\Java\jdk1.8.0_40\bin> jarsigner.exe -sigalg MD5withRSA -digestalg SHA1 -signedjar < apk file path >  -storepass android -keystore <keystore location> < apk file path >  androiddebugkey
Example:
C:\Program Files\Java\jdk1.8.0_40\bin > jarsigner.exe -sigalg MD5withRSA -digestalg SH…

Automatic logon in windows XP/7/8/Windows Server

Image
Open the Windows Registery editor from run.exe [ type regedit and ENTER ]Navigate to "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\winlogon"Set or create the following keys (DWORD, String, String)AutoAdminLogon = "1"DefaultUserName = Your user nameDefaultPassword = Your passwordRestart and now machine will be automatically logged in :)

The host supports Intel VT-x, but Intel VT-x is disabled

Image
"The host supports Intel VT-x, but Intel VT-x is disabled" is thrown -  on trying to start a virtual machine e.g using VMware Player; when the Virtual Technology(VT) is disabled from system BIOS Settings.

Steps to fix this and run virtual machines successfully :-
Close all the application and restart the System.Press F10 on system startup, to go to Bios SettingsEnable the Virtual Settings from Bios Settings > System Configuration Save the Changes and Start the System.Video link :
Now try to start your virtual machine :) it should start without any error now :)

Install and run Sqlmap on Windows

Image
Sqlmap is the most popular tool for finding and exploiting the sql vulnerability on the web. It is written in python for cross platform, today i will show the simple steps to install it on the Windows environment ( i am doing it on windows 8.1 :D )

Download and install the Python interpreter from https://www.python.org/downloads/ on your System. Python 2.7.9 version should be fine.Now download the Sqlmap zip file from http://sqlmap.org/Unzip the sqlmap zip folderOpen the command prompt > navigate to sqlmap unzipped folderLaunch command "sqlmap.py" Sqlmap is installed successfully and ready to roll and hack someone database :D ;)

Android Json tutorial : Saving custom class object as JSONObject and JSONArray on Parse

Android JSONObject and JSONArray allows you to save your custom class values on the Parse.com as a json string.
                  Suppose you would like to save your custom class values in a single Parse.com class column, you can just convert your class parameter values in JSONObject and then can save in a column on Parse.com.

Saving JSONObject on Parse
// Create a Parse object for the table under which you like to add your json object in a column. ParseObject parseObject = new ParseObject("MainTable"); // Add your JSONObject parseObject.put("myCustomClass",new JSONObject().put("key","value")); // Tip : Here you can add all of your custom class variable as key value pair in JSONObject // Save the Parse object parseObject.saveInBackground();
Saving JSONArray on Parse [ If you like to save an array of custom class instances]
// Create a Parse object for the table under which you like to add your json object in a column. ParseObject parseObject = n…

The working copy at XXX is too old (format XXX) to work with client version XXX (rXXX)’ (expects format XX). You need to upgrade the working copy first.

Image
The working copy at XXX is too old (format XXX) to work with client version XXX (rXXX)’ (expects format XX). You need to upgrade the working copy first.


You are at right place for the solution, if you faced the error message like above while using svn client.

Reasons why this error occurs:

You have installed a newer version of svn client on your machine, and trying to add/commit some new files to svn server from you current working copy. Easy fix 1: Go to your svn checked project > right click > select 'upgrade the Working copy'This will upgrade the working copy and now you should be able to add/commit file easily. Easy Fix 2: Still after applying the fix above, issue is not fixed :(. You can try below then:Right click on the folder causing the issue.If on right click it does not have any svn 'upgrade the working copy'Then go under the folder delete the ".svn" folder completelyAdd/commit the remaining files to svn :) it will no give any error :)
Thank you f…

Mcafee - Internet Security antivirus extend trial period free trick

Image
Like one of my previous blog post on extending a software trial period, here comes the same trick to get the McAfee - Internet Security antivirus free extended subscription just by changing system date and time.
Simple 2 step to extend the trial period and get free subscription :)

As you can see expired trial period screenshot on dated 04-01-2014. Change the System date to previous date say '01-01-2014' in our case.  Close the McAfee and start again. and Bingooooo !!!! free subscription activated

Hands on hacking - Windows 8.1 Elevation of Privilege vulnerability

Image
Windows-Elevation of Privilege vulnerability in ahcache.sys/NtApphelpCacheControl, reported by the Google project Zero team is now all over in news. So, i thought to try it on my Windows 8.1 and let's see if the provided exploit works or not, and how to verify it ;)

Below are the steps taken directly from the report, and we will be going to execute it one by one and see how it works

1) Put the AppCompatCache.exe and Testdll.dll on disk 2) Ensure that UAC is enabled, the current user is a split-token admin and the UAC setting is the default (no prompt for specific executables). 3) Execute AppCompatCache from the command prompt with the command line "AppCompatCache.exe c:\windows\system32\ComputerDefaults.exe testdll.dll". 4) If successful then the calculator should appear running as an administrator. If it doesn't work first time (and you get the ComputerDefaults program) re-run the exploit from 3, there seems to be a caching/timing issue sometimes on first run.
Let…

Running Selenium Webdriver tests on Internet Explorer browser

Image
So finally added support to execute tests on Internet Explorer browser also in my github project https://github.com/lalit-k/selenium-java-tests.

3 Simple steps to add Internet Explorer support in Selenium Webdriver project:
Download the IEDriverServer.exe , you can download the latest version from http://selenium-release.storage.googleapis.com/index.html for your target operating system.[download url may change, you can google latest if it changes]Extract the IEDriverServer.exe from the downloaded zip, and place in your project resources folder.Now, go to the Driver script where you are initializing the IEDriverServer and add the below code line to initialize the IEDriverServer. System.setProperty("webdriver.ie.driver", <full system path of the IEDriverServer.exe. Example: c:\tests\resources\IEDriverServer.exe>); WebDriver driver = new InternetExplorerDriver();
Tip : you can use the "System.getProperty("user.dir");" to get the current working direc…

Running Selenium Webdriver tests on Google Chrome browser

Image
Few months back i had added the support to execute tests on Google Chrome browser in my github project https://github.com/lalit-k/selenium-java-tests , so i thought to write it down how you can do the same if needed in your project.

3 Simple steps to add Google Chrome support in Selenium Webdriver project:
Download the ChromeDriver.exe , you can download the latest version from http://chromedriver.storage.googleapis.com/index.html for your target operating system.[download url may change, you can google latest if it changes]Extract the chromedriver.exe from the downloaded zip, and place in your project resources folder.Now, go to the Driver file where you are initializing the ChromeDriver and add the below code line to initialize the ChromeDriver. System.setProperty("webdriver.chrome.driver", <full system path of the chromedriver.exe. Example: c:\tests\resources\chromedriver.exe>); WebDriver driver = new ChromeDriver();
Tip : you can use the "System.getProperty(&…

Add Facebook popup Like box on your blog

Image
When you come first time on this blog you must have seen a Facebook Like pop up box. Well that is just a few lines of JavaScript code embedded in the blog template.

So, i thought it to share with you guys if you like to add on your blogs also :)


1. Open the your blog Layout Editor > Add a Widget > Select HTML/JavaScript widget.


2. Copy and paste the below code in the content section as shown in above image. [ Just change the page id to your own Facebook page/profile]

 <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type='text/javascript'></script> <style> #fbox-background {     display: none;     background: rgba(0,0,0,0.8);     width: 100%;     height: 100%;     position: fixed;     top: 0;     left: 0;     z-index: 99999; } #fbox-close {     width: 100%;     height: 100%; } #fbox-display {     background: #eaeaea;     border: 5px solid #828282;     width: 340px;     height: 230px;     pos…

ParseUser.logout() doesn't logs user out

Recently working on a android app integrated with Parse and Facebook, i observed the issue that just calling the ParseUser.logout() does not clear the authenticated user token and logs in the user again on clicking on 'Log in as Facebook' even if user have logged out from the Facebook app also.


goggled the solution, but found this is as Design :(


So, still if you like to invalidate the facebook authentication token on ParseUser.logout(), you can do by adding a few lines of code shown below.


#################Code Snippet#####################

// Logout already logged in user from your android app.

ParseUser.logout();


// Check if user is logged in Facebook android app or not. If not clear the token information  explicitly.

 com.facebook.Session facebookSession= com.facebook.Session.getActiveSession();
        if (facebookSession== null) {
            facebookSession= new com.facebook.Session(this);
            com.facebook.Session.setActiveSession(facebookSession);
        }
   …