Replace Text With An Image Using CSS

This technique works by pushing the text down inside the header with a rather large line-height (it must be at least twice the height). Then the overflow: hidden hides the text since it’s overflowing. Source

<style type="text/css">
             width: 13px;
            height: 15px;   

            overflow: hidden;
            line-height: 500px;                  

Launch Activity/Service On Android Boot

package com.logicvoid.voguetools;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public  class OnBootReceiver extends  BroadcastReceiver {

    public void onReceive(Context context, Intent intent) {
         if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
              Log.d("VogueTools", "Got the Boot Event>>>");
              // do your stuff for example, start a background service directly
              // here
              Toast.makeText(context, "Testing From VogueTools", Toast.LENGTH_LONG).show();



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".MainActivity"
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

		<!--   Handling for On Boot Receiver -->
		 <receiver android:name=".OnBootReceiver"  android:enabled="true"  android:exported="false"  android:label="OnBootReceiver">
		        <action android:name="android.intent.action.BOOT_COMPLETED" />
		 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
		<!-- End Handling for On Boot Receiver -->

    <uses-sdk android:minSdkVersion="4" />


For reference. the Context passed in the onReceive is that of the Application, not a specific Activity.

If you’re doing anything that is context sensitive like dealing with preferences in your application, perhaps using appContext.getSharedPreferences. Use getApplicationContext() within your application to ensure the preferences will be read from both the BroadcastReceiver onReceive and the application itself. As the onReceive Context is that of the application, they will be equal.

Easily Remove /r and /n Chars From MultiLine Literal XML String

protected string CreateInfoRequestPackage()

        string RequestPackage = "<inforequest ID=\"90210\">";
        RequestPackage += @"       
      <title>Sr Manager</title> 
      <institution>Acme Inc</institution> 
      <addr1>100 Main St</addr1> 
      <addr2>Suite 12</addr2> 
      <comment>Send ASAP</comment> 

        // Using the data above create well formed XML (removing the /r /n)
        XmlDocument xmlDoc = new XmlDocument();
        return xmlDoc.InnerXml;



How To Bind Custom Object To Build Dynamic CheckBoxList


<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="InvestorDataFeedTest" %>

<script runat="server">
    protected override void OnLoad(EventArgs e)

        if (!IsPostBack)
            CBMaterialItems.DataSource = PrintedMaterialLogic.GetPrintedMaterialCBDataTable();
            CBMaterialItems.DataValueField = "MaterialID";
            CBMaterialItems.DataTextField = "MaterialName";




<head id="Head1" runat="server">
    <form id="form1" runat="server">
        <asp:CheckBoxList ID="CBMaterialItems" runat="server" AutoPostBack="True" />


using System;
using System.Collections.Generic;
using System.Web;

using System.Web.UI;
using System.Xml;
using System.Data;
using System.Reflection;
using System.Net;
using System.IO;
using System.Collections.Specialized;

namespace InvestorDataFeedTest
    public class PrintedMaterialLogic

        public PrintedMaterialLogic() { }

        // Public Methods (Business Logic Layer)
        #region public static DataTable GetPrintedMaterialCBDataTable()
        public static DataTable GetPrintedMaterialCBDataTable()

            // Create an object to return
            DataTable datatable = new DataTable();

                List<PrintedMaterialData> entireList = new List<PrintedMaterialData>();

                entireList = GetPrintedMaterialCBData();

                datatable = ListToDataTable(entireList);
            catch (Exception ex)
                // Send error email
                BLL.SendErrorEmail("Get Printed Material CheckBox DataTable Error", "", ex);

            return datatable;


        // Private Methods (Data Access Layer)
        #region public static List<PrintedMaterialData> GetPrintedMaterialCBData()
        public static List<PrintedMaterialData> GetPrintedMaterialCBData()
            // Create object to return
            List<PrintedMaterialData> list = new List<PrintedMaterialData>();

            // Check cache for value first           
            Page page = (Page)HttpContext.Current.CurrentHandler;
            string cacheKey = "GetPrintedMaterialCBData";

            if (page.Cache[cacheKey] != null)
                // Return cached value if it exists
                return (List<PrintedMaterialData>)page.Cache[cacheKey];
                // Fill cache

                // Get XML
                string url = "";
                string data = GetScreenScrape(url);

                XmlDocument xmlDoc = new XmlDocument();              

                // Get nodes
                XmlNodeList xmlNodes = xmlDoc.DocumentElement.SelectNodes("/IRXML/InformationRequest/InfoRequestMaterials/InfoRequestMaterial");
                // For each xml node, create the corresponding objects
                foreach (XmlNode xmlNode in xmlNodes)

                    XmlElement elt = (XmlElement)xmlNode;

                    PrintedMaterialData node = PrintedMaterialCBDataCreate(xmlNode);

                    // If node was created, then add to our list
                    if (node != null) { list.Add(node); }

            return list;

        #region public static PrintedMaterialData PrintedMaterialCBDataCreate(XmlNode xmlNode)
        public static PrintedMaterialData PrintedMaterialCBDataCreate(XmlNode xmlNode)
            // Create an object to return
            PrintedMaterialData item = new PrintedMaterialData();

            if (xmlNode != null)
                XmlNode materialNameNode = xmlNode.SelectSingleNode("MaterialName");                   
                XmlAttribute materialIDAttribute = xmlNode.Attributes["MaterialID"];

                item.MaterialName = (materialNameNode == null) ? "" : materialNameNode.InnerText.Trim();
                item.MaterialID = (materialIDAttribute == null) ? "" : materialIDAttribute.InnerText.Trim();     

                return item;

            return null;


        // Methods / Functions already in .COM Solution
        #region public static string GetScreenScrape(string url)
        public static string GetScreenScrape(string url)
            // Create the WebRequest for the URL we are using
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)";
            // Get the stream from the returned web response
            StreamReader stream = new StreamReader(req.GetResponse().GetResponseStream());

            //experiment try reading entire thing at once
            string html = stream.ReadToEnd();

            // Finished with the stream so close it now

            return html;

        #region private static DataTable ListToDataTable<T>(List<T> list)
        private static DataTable ListToDataTable<T>(List<T> list)
            DataTable dt = new DataTable();

            foreach (PropertyInfo info in typeof(T).GetProperties())
                dt.Columns.Add(new DataColumn(info.Name, info.PropertyType));
            foreach (T t in list)
                DataRow row = dt.NewRow();
                foreach (PropertyInfo info in typeof(T).GetProperties())
                    row[info.Name] = info.GetValue(t, null);
            return dt;