Posts

Example code on how to open dialog box when click on the list AdapterView - Android

Image
Today I want to show how to open list items in the dialog box. For this tutorial, you need to have:- Dialog design view_item.xml MyDialogFragment.java class OnClick Event to call dialog. Announcement.java Class AnnouncementHelper Class OnCreateView Method view_item.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="match_parent" android:orientation="horizontal" android:padding="5dip" android:id="@+id/Announcement" android:transitionGroup="false"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alig

Add search condition on Kentico smart search API

Below is an example of using the Smart Search API module in Kentico. The API Example inside Kentico not telling this, but I was able to figure out the way.  Kindly have a try on the snippet example  Smart Search Module API - Search With Condition  public void SmartSearchWithCondition(string searchText,string ClassName,string extraCondition) { DocumentSearchCondition docCondition = new DocumentSearchCondition(); docCondition.ClassNames = ClassName; docCondition.Culture = "en-US"; //refer https://docs.kentico.com/display/K82/Smart+search+syntax for the extra condition syntax var condition = new SearchCondition(extraCondition, SearchModeEnum.AllWords, SearchOptionsEnum.FullSearch, docCondition, true); searchText = SearchSyntaxHelper.CombineSearchCondition(searchText, condition); // Get the search index SearchIndexInfo index = SearchIndexInfoProvider.GetSearchIndexInfo("SearchIndex"); if (index != null)

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