Pages

Search This Blog

Tuesday 26 January 2016

Android Studio - HAXM is not working and emulator runs in emulation mode

This error occurs when your Android Virtual Device (AVD) memory is larger than the space that was specified for Hardware Accelerated Execution Manager (HAXM).






How to Resolve?

Step1: Click SDK Manager and see whether HAXM is installed


If it’s not installed get it installed from Android Studio. If it’s already installed feel free

Step2: Go to the path highlighted in the error log. In my case it’s C:\Android\sdk
Navigate to C:\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager and start the setup file



Don’t change the memory size here. Just note down the space used by it



Step3: Click AVD Manager in Android Studio and check the size of your AVD
a.       Select AVD Manager from Toolbar and select the AVD (Nexus/Your test AVD) and click Edit and then choose Advance Settings. 


Change the memory size to the space that was specified in HAXM (1024 MB = 1 GB) and click on Finish

Running your project again will do the trick.



 

Sunday 9 March 2014

COND PARAMETER IN JCL - OVERRIDE

COND parameters in JCL used to bypass selective steps in a job based on the condition returned by previous step. It can be coded in both JOB and EXEC statement.
//MYJOB  JOB  (U3369),'RAJESH', COND=(4,GT)
//STEP1  EXEC  PGM=PROG1
//STEP2  EXEC  PGM=COBPROG,COND=(8,EQ)
 
 The first step in a job will not check for conditions at any time. 
With the above example consider 
if step 1 returns 0:
STEP2 first checks it with the JOB card condition.

4> 0 true, so no step is executed halts execution
If first step returns 8:

4>8 false, now step condition is verified. 8=8 true, so step 2 is not executed because
of the step condition
If first step returns 12:

4> 12 false, now step condition is verified, 8=12 false, so step 2 is executed.

This means JOB COND overrides STEP condition. 

Sunday 9 February 2014

VB.NET/MySql- Access Denied @localhost(using password:NO)

This error when your code looks like:

con.Open();
con.ConnectionString="server=localhost;database=sample;username=root;password=****";

The statement con.ConnectionString should come before con.Open(). So the actual correct code is:

con.ConnectionString="server=localhost;database=sample;username=root;password=****";
con.Open();

con is an object of Connection class.

SKIP AND EXECUTE SELECTIVE STEPS IN A JOB - JCL

Using IEBEDIT utility you can take control of the steps that has to be executed in a job. You have the option of executing selective steps and also few steps can be skipped. The below is a sample JCL which skips STEP04 in a job

//JOBCARD
//          EXEC PGM=IEBEDIT
//SYSUT1 DD DSN=JOBS.ALL(JOB001),DISP=SHR
//SYSUT2 DD SYSOUT=(*,INTRDR)
//SYSIN DD *
  EDIT TYPE=EXCLUDE,STEPNAME=(STEP04)
/*
//SYSPRINT DD SYSOUT=*


EDIT TYPE=EXCLUDE will exclude a particular step of a job from execution and if many steps has to excluded it can be done by separating the step names with comma.

EDIT TYPE=INCLUDE will allow only that step to be executed.

INTRDR - refers to internal reader where all jobs are submitted for execution

Saturday 18 January 2014

JCL to count the number of duplicate records in a dataset

Say you have an input file with transaction details and want to count the number of records with same transaction ID.
 
Input File
TRN1
TRN1
TRN1
TRN2
TRN2
TRN3
 
Output File
TRN1  3
TRN2  2
TRN3  1 
 
JCL
//STEP10 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*

//DFSMSG DD SYSOUT=*

//OUTFILE DD DSN=TRNCNT.PS,DISP=SHR
//INFILE DD DSN=TNFIL.PS,DISP=SHR
//TOOLIN DD *
OCCUR FROM(INFILE) LIST(OUTFILE) -
NOHEADER NOCC-

ON(1,4,CH) -

ON(VALCNT,N06)

/*
 
 
The duplicate values will be looked only in the first 4 bytes of each record and count will be displayed in the 6th position. 
 
If you want compare records with 80 bytes change 4 as 80 and 6 to the position where you want to display your count

Tuesday 7 January 2014

jQuery to trim text

I spent hours and hours to fix a small problem. It is because the way I used the trim function is wrong and it didn't throw any error messages and it was working on few cases. later I found the correct way of trimming spaces in a text using jQuery.

Wrong Way

var customerNo = $("#<%=lblCustomerNo.ClientID%>").text();
customerNo = customerNo.trim();

Right Method

var customerNo = $("#<%=lblCustomerNo.ClientID%>").text();
customerNo = $.trim(customerNo);



 

Close the jQuery dialog when clicked anywhere on the page

You would have created a jQuery dialog and it will be opened on few cases. there will be requirement where the dialog should be closed when user clicks anywhere on the page. The following code piece does the trick:

$(document).ready(function () {
         //the dialog should close when clicking anywhere else on the page
             $('body').on('click', function (event) {
                     $("#dialog").dialog("close");
             });
});

The above code will work fine but the dialog will be closed even when the click event occurs on the dialog. So to avoid that check whether the click event is not on the dialog. Code below works as expected.

$(document).ready(function () {
      //the dialog should close when clicking anywhere else on the page
      $('body').on('click', function (event) {
                  var parent = $(event.target).closest("div");
                   if (!(parent.attr('id') == "dialog"))
                          $("#dialog").dialog("close");
});
});


Usually Dialog is created with help of an div tag, so check the ID of the closest div where the click event occured