Posts

How to target specific sub element using Jquery

Today I have experienced difficulty to target specific sub-element in my HTML document. So I would like to share the solution that I have. Example HTML : <div class="content"> <span>element one</span> <span>element two</span> <span>element three</span> <span>element four</span> </div> The problem is how to append text on the third sub-element under div with class content.? Below is my solution : <script> $(document).ready(function () { $(".content span:eq(2)").append(" <b>content three append using jquery</b><br/>"); }); </script> From the above solution, basically telling that you can target specific sub-element using "eq(2)" --> 2 is the index with no 2. (Remember index start with 0). Full Code Example : <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">

Open url with section targeting with jQuery and HTML 5

Recently I have some projects that require targeting section in HTML 5 project. after doing some testing and research on google how to do it, finally, I think this snippet is the best that can work in a most modern browser. Let's see the code. HTML sample  <section id="mainIntro" class="" target-url="<target url>"> : : : </section> JQuery Code Snippet <script> $(window).load( function () { setTimeout(function(){ var current = window.location.href; current = current.substr(current.lastIndexOf('/') + 1); $( "section" ).each(function() { var targetURL = $(this).attr("target-url"); if(targetURL == current){ var mainContentH = $(this).offset().top + 1; $('body,html').animate({ scrollTop: mainContentH }, 150/*this is where you can control of page move to target*/ ); return false; } }); }, 100 /*

Handle Error Modes in ASP.NET redirect to proper page - Web.config

Most of the websites and web applications must have an error handler. Some programmers might question what are the error handler should have on one website. Below is the basic error handler that you need to set in the website : Page Not Found - 404 Internal Server Error - 500 Access Denied - 403 The above error page must-have in one website. This is because when the application catch error, the end-users will see asp.net designed page without detailed error information that might not user friendly for the end-users. To handle these errors, all you need to do are two things which are Create the above error page and set in the web.config file in asp.net. Below is an example of a setting in the web.config file. Web.Config <configuration> <system.web> <customErrors defaultRedirect="~/500.html?" mode="RemoteOnly"> <error statusCode="404" redirect="~/404.html" /> <error statusCode="500" redirect=&quo

how to select date time using calendar android

Image
This tutorial shows how to set date time in android app when you click on the textbox. Note : This example using Andorid Studio to create project. Im using Sample Blank Activity with Fragment sample. Step By Step  Add One EditText on the fragment Create DateTimeFragment.java class Copy Paste DateTimeFragment.java class below. Override onViewCreated event from fragment Done. Full Source Code of MainActivity class + Fragment / placeholder class package com.test.selectdatetime; import android.app.Dialog; import android.content.Context; import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; import android.support.v7.app.ActionBarActivity; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Edi

How to create multiple tab with different fragment / view - Android app

Image
Most beginner android developer wonder how to create different fragment for each tab in their android app. Please follow this tutorial to create basic android app with 3 tab before continue with this tutorial. ( http://swengineercode.blogspot.com/2015/05/how-to-create-multiple-tab-on-android.html ) This example using android studio. Kindly download the studio here ( https://developer.android.com/sdk/index.html ) Step By Step  1. Open "Three tab example" android app. ( Refer this tutorial to create "Three tab example" project ) 2. Create New Fragment 3. Give fragment name "FragmentOne" 4. Repeat Step 2 to create next fragment. Give name for new fragment "FragmentTwo". 5.  Now you already have three tab application with 3 fragment. Next we need to link the fragment with the respective tab. Follow below code. Table below show that each section in out tab that should we link. Tab Fragment Section 1 fragment_main.xml Section 2 fragment_fragment_one.xm

Kentico 7 Get Current Date Time using macro

In Kentico 8, you can call the macro method to show date-time information just like C# code which is : {%DateTime.Now%} But for Kentico version 7, you can not call date-time in a macro using the above code. So I have to wonder how to call the date-time using a macro in Kentico 7 and how to format the date-time. Below is a solution to achieve this in Kentico 7. Get Date Time {% CurrentDateTime%} Format Date Time  {% GetDateTime(CurrentDateTime, "MM dd yyyy")%} Hopefully, the above solution helps someone.

How to create multiple tab on android app

Image
This tutorial to show how to create multiple tab on Android App. This example using android studio. Kindly download the studio here ( https://developer.android.com/sdk/index.html ) Step By Step 1. Open Android Studio. 2. Choose Start New Android Studio Project 3. Set Application Name "Three tab example" 4. Choose Phone Or Tablet  Note : Minimum SDK means the lower SDK that your application will support. The more higher your API level the Less phone can support your application. This is because not every phone now have latest version of android OS.  5. Choose Tabbed Activity 6. Set Navigation Style to Action Bar Tabs With View Pager 7. Click Finish button. Now you have basic android app with three tab navigation. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)