Category Archives: Simple Stuffs

Android GPS Randomly Turned-On XiaoMi and Huawei Honor Alternative Solutions

Recently I encountered GPS randomly turned-on on my Android phone. Even though countless time of turning-off and disabling location access on my Android phone, it is still turning on by itself.

It appears that it affects certain network and mobile device brands only.

Alternative Solution: Set network mode to GSM only.

1) Go to Settings.

2) Open Mobile Network Settings.

3) Click Network Mode.

4) Select GSM only.

When needed for browsing the Internet, turn back to Auto Network Mode.

This is a temporary solution until the network operator can resolve this issue.

PHP HTML Entities String Function For Javascript Function Not Working Solution – Simple Concept

“Uncaught SyntaxError: Unexpected token ILLEGAL” is a common error when input parameter of JavaScript function is not closed properly.

1) To escape JavaScript parameter, we use PHP htmlentities function. However, even with PHP htmlentities, we might still encounter this issue. Consider the following example:

 PHP Code:

echo "<a href='javascript:showContent(\"" . htmlentities ("Edit Service Sushi's Shop", ENT_QUOTES) . "\");'></a>";

2) Now the string should be Edit Service Sushi&apos;s Shop.

3) However, when this string reaches browser, the string gets unescaped and becomes:

<a href='javascript:showContent("Edit Service Sushi's Shop");'></a>

4) Hence, the JavaScript function breaks when user click on this link.

5) To solve this, we need to double-escape the string.

echo "<a href='javascript:showContent(\"" . htmlentities(htmlentities("Edit Service Sushi's Shop", ENT_QUOTES), ENT_QUOTES) . "\");'></a>";

6) Now the string becomes Edit Service Sushi&amp;apos;s Shop. The string parameter is now safe. We can use this parameter string as input for jQuery.html() function without breaking the JavaScript function.

<a href='javascript:showContent("Edit Service Sushi&apos;s Shop");'></a>

<script>
function showContent(input){
   $("#mydiv").html(input); 
   //the escaped characters will be unescaped via .html function
}
</script>

jQuery Images Crossfading Front Page Banner – Simple Stuffs

Creating a crossfading images slideshow for a homepage is easy. All you need is jQuery.

Steps as follow:

1) Assuming we have 3 images. All these images have same height and width, and positioned absolute. Each of these images are overlapping on top of each other.

<div>
	<img id="home-image-1" class="position-absolute" src="home-image-1.png"/>
	<img id="home-image-2" class="position-absolute" src="home-image-2.png"/>
	<img id="home-image-3" class="position-absolute" src="home-image-3.png"/>
</div>
.position-absolute{
	position: absolute;
}

2) Hide second and third image using jQuery hide(). Now we have only one image showing.

3) Next, we need to make the second image fading in after a certain amount of time in crossfading manner. To do this, we will set first and third images to have z-index = 0 while second image to have z-index = 1.

Note we have second image on top of all other images and it is still hidden. Call fadeIn(‘slow’) for second image.

4) Once fadeIn() animation for second image is completed, call hide() for first and third images.

5) Repeat this method for next images.

To see how to create continues looping of crossfading images, see code sample below:

<script>
	$(document).ready(function(){
		$("#home-image-2, #home-image-3").hide(); //Show first image and hide the rest.
		setInterval(function(){loopHomeImages();},5000);
	});

	var curr = 1;

	function loopHomeImages(){
		var after = (this.curr + 1)%3; //Next image in the loop
		var bef = ((curr - 1) >= 0) ? (curr - 1) : 2; //Previous image in the loop

		$(".position-absolute").css("z-index", 0);
		$("#home-image-" + curr).css("z-index", 1);
		$("#home-image-" + curr).fadeIn("slow", function(){
			$("#home-image-" + after).hide();
			$("#home-image-" + bef).hide();
		});
		curr = (curr + 1)%3;
	}
</script>

That’s all.

Good luck and have fun.

Internet Explorer 10 Reset Settings – Simple Stuffs

Sometimes, Internet Explorer may crash or freeze during launch time. Therefore, resetting IE settings may help. Below are the simple steps to reset IE settings:

Disclaimer: This is a suggested method. Use at your own risk.

1) Click Windows Start button.

2) From Search programs and files text box, type “Run“. See image below.

Windows Run

Alternatively, press “Windows Logo” + “R”.

3) Click Run. A run dialog box will appear.

Run DIalog Box

4) From Run dialog box, copy and paste the following line.

%windir%\System32\rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,6

Windows Run Box

5) Click OK.

Result: Internet Properties dialog box will appear.

Internet Properties

6) From Internet Properties dialog box, click Restore advanced settings.

7) From Internet Properties dialog box, click Reset.

Reset IE Settings

Result: Reset Internet Explorer Settings dialog box will appear.

8) Click Reset.

9) Click OK.

10) Restart Internet Explorer browser.

Done.

Internet Explorer 10 Show Menu Bar – Simple Stuffs

Sometimes, you may notice that Internet Explorer menu bar is missing. Here’s the method to show it.

1) Open Internet Explorer.

2) Right click on the top part of the browser.

Internet Explorer Show Menu

3) From right-click menu, click Menu Bar.

Internet Explorer Show Menu

Result:

done

Done.

Note: If steps above not showing menu bar, you will need to close all Internet Explorer browsers and try the steps again.

 

Enable Wireless-11N Adhoc – Simple Stuff

Sometimes, you may not be able to connect to your newly bought wireless modem from your laptop. Your wireless modem may be 802.11 a/b/g/n wireless mode ready. The default mode might be set to “n”. If your laptop is not able to scan your access point, then you can try the following:

1) Right click network icon, click “Open Network and Sharing Center”.

Wireless N

2) Click “Change adapter settings”.

Wireless N

3) Right click Wireless Network Connection. Click Properties.

Wireless N

4) From Networking tab, click Configure.

Wireless N

5) From Advanced tab, click “Adhoc 11n”.

6) From Value drop down, select Enable.

7) Click OK.

Wireless N

Now you can try to see if you are able to connect to your access point.

Change Folder Icon In Windows

Sometimes, you may want to change the icon of a folder for aesthetic purpose or you need to make the folder more noticeable. Changing icon of a folder is simple. It can be done in a few steps:

1) Right click on the folder that you would like to change. Click Properties.

Change Folder Icon

2) From properties dialog box, click Customize tab.

Sometimes, you may want to change the icon of a folder for aesthetic purpose or you need to make the folder more noticeable. Changing icon of a folder in simple. It can be done in a few steps:

3) Click Change Icon. You will see icon selection dialog box appear.

Change folder icon

 

4) From icon selection dialog box, select your desired icon. Click OK.

Change folder icon

Done.

Showing Underline When Hovering A Link – Simple Stuff

Showing an underline for a link on a website is simple. Here are the steps:

Demo: http://kennykee.com/demo/css-underline

1) Within <head></head> of your HTML page, create <style></style> if not exist. For example,

<head>
<style></style>
</head>

2) Let’s say you have a link <a class=”mylink” href=”http://kennykee.com”>My Website</a>. Note the class=”mylink”. We need this to show the underline effect.

3) Update your <style> tag to following:

<head>
<style>
.mylink{
text-decoration: none;
}
.mylink:hover{
text-decoration: underline;
}
</style>
</head>

Done. http://kennykee.com/demo/css-underline

Full code below:

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
  	    .mylink{
            text-decoration: none;
			font-size: 50px;
			font-family: arial;
			margin-left: 20px;
		}
		.mylink:hover{
			text-decoration: underline;
		}
    </style>
  </head>

  <body>
	 <a class="mylink" href="http://kennykee.com">My Website - Hover Here</a>
  </body>
</html>

Windows Live Mail Keeps Work Offline – Simple Solution

If you are using Windows Live Mail, you may encounter the following error message:

“You are currently working offline. Would you like to go online now?” Even though you keep clicking Yes, the pop-up will keep coming up.

Windows Live Mail Offline

So how to solve this? The solution is simple.

1) Open Internet Explorer browser.

2) From the menu bar, click File. (If menu is not shown, press “Alt” button on your keyboard)

3) Uncheck “Work offline” by clicking on it.

IE Work Offline

4) From Windows Live Mail, click Send/Receive button. If you are being asked to go online, click Yes.

Problem solved.

Additional information on showing menu bar – http://kennykee.com/304/internet-explorer-10-show-menu-bar/
__________________________________________________________________________________________________

Please like or comment below if this helps you 🙂