Friday, 3 August 2018

Couldn't connect to logcat, GetProcessId returned: 0 (Xamrin Andriod Visual Studio)

Couldn't connect to logcat, GetProcessId returned: 0 (Xamrin Andriod Visual Studio)

Solution: Uninstall APP from emulator. 

Following is a step.

  1. Go to settings.
  2. Find the app
  3.  Uninstall the APP
  4. Close the emulator
  5. Run again the emulator








'adb' is not recognized as an internal or external command, operable program or batch file.

'adb' is not recognized as an internal or external command,operable program or batch file.





 Solution:

Step 1

I have windows 10. Here is adb.exe is located. Copy the following path.

 Step 2:

Go to control panel and click Advanced system settings.

Step 3: Click Environment Variable button.


Step 4

Select Path button and Click Edit button


Step 5:

Paste the adb path here and then click ok and ok


Step 6:

Run again command prompt and type abd.

Sunday, 22 December 2013

Get data from second last row in SQL Server

We have a following table suppliersInformation and we want to Get data from second last row in SQL Server.

Following query shows how to get data from second last row in SQL Server
 
SELECT TOP 1 * FROM
  (SELECT TOP 2* FROM suppliersInformation ORDER BY sup_rec_id DESC) tbl
  ORDER BY sup_rec_id ASC


Wednesday, 18 December 2013

Switch in PHP examples

Example No.1
<?php
$week = "Friday";
switch($week)
{
    case "Sunday":
    echo "Today is Sunday";
    break;
    case "Monday":
    echo "Today is Monday";
    break;
    case "Tuesday":
    echo "Today is Tuesday";
    break;
    case "Wednesday":
    echo "Today is Wednesday";
    break;
    case "Thursday":
    echo "Today is Thursday";
    break;
    case "Friday":
    echo "Today is Friday";
    break;
    case "Saturday":
    echo "Today is Saturday";
    break;
 }

?>
output:
Today is Friday

Example No.2
using default in switch
<?php
$week = "Notavailble";
switch($week)
{
    case "Sunday":
    echo "Today is Sunday";
    break;
    case "Monday":
    echo "Today is Monday";
    break;
    case "Tuesday":
    echo "Today is Tuesday";
    break;
    case "Wednesday":
    echo "Today is Wednesday";
    break;
    case "Thursday":
    echo "Today is Thursday";
    break;
    case "Friday":
    echo "Today is Friday";
    break;
    case "Saturday":
    echo "Today is Saturday";
    break;
    default:
    echo "This weekend is not availabe in our list";
}
?>
output:
This weekend is not availabe in our list

Example NO.3
Always used break keyword in the end of case body.Otherwise you got wrong output.Following example shows What you got when you did not used break keyword

<?php
$week = "Sunday";
switch($week)
{
    case "Sunday":
    echo "Today is Sunday";
   
    case "Monday":
    echo "Today is Monday";
   
    case "Tuesday":
    echo "Today is Tuesday";
   
    case "Wednesday":
    echo "Today is Wednesday";
   
    case "Thursday":
    echo "Today is Thursday";
   
    case "Friday":
    echo "Today is Friday";
   
    case "Saturday":
    echo "Today is Saturday";
   
    default:
    echo "This weekend is not availbe in our list";
}


?>
output:
Today is SundayToday is MondayToday is TuesdayToday is WednesdayToday is ThursdayToday is FridayToday is SaturdayThis weekend is not availbe in our list




Call by refrence in PHP

Following example show orignal value of parameter change.
<?php
function orignalValueChange(&$refParameter)
{
    $refParameter = 4;
  
}
$var = 23;
orignalValueChange($var);
echo $var;

?>
output:
4
Following example show orignal value of parameter not change.

<?php
function orignalValuenotChange($refParameter)
{
    $refParameter = 4;
  
}
$var = 23;
orignalValuenotChange($var);
echo $var;

?>
output:
23

Example

<?php
function callbyref(&$para1, &$para2,&$para3)
{ $para1 = $para2 = $para3;
}
$var1 = 1000;
$var2 = 2000;
$var3 = 3000;
callbyref($var1, $var2,$var3);
$var2 = 5;
echo "<br/>";
echo $var1;

?>
output:
 3000

Tuesday, 17 December 2013

Infinite loop using for loop and while loop in PHP

Followings scripts shows how to run a loop infinite.

Example 1

Using For loop
<?php

for(; ;)
{
   
  echo "infinte loop";
    
}
?>

Example2

 Using While Loop
<?php
while(true)
{
    echo "infinte loop";
   
}
?>

Monday, 16 December 2013

Server Side PHP Date convert in javascript format.

Server Side PHP Date convert in javascript format.


Javascript is a client side scripting language.So when we dealing with dates in javascript.Some time we need the current date of Server using javascript.So we can get a unix time stamp in PHP using strtotime() function in PHP
So following Script give you server Side Date and time in Javascript.

Example

<script type="text/javascript">
var ServerSide = <?=strtotime("now")?>;
var today = new Date(ServerSide * 1000);
alert(today);
</script>

output



Thanks for reading