VERY rough development notes for my personal reference which I use as a quick lookup when coding & troubleshooting.

05/03/2012 - 10:04

Displaying a short update message when performing updates using update panel and asp.net ajax.


System.Threading.Thread.Sleep(2000); - Add to update method in code-behind

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
Updating...
</ProgressTemplate>
</asp:UpdateProgress>

04/20/2012 - 14:06

If there are references to legacy publications within replication monitor, despite them not showing up under sql replication publication folder, you need to re-create each publisher with the exact same name and then delete it for the leagcy references to get deleted.

This issue can arrise when sql server is setup to perform log-shipping between 2 servers under a fail-over plan with replication setup. Legacy replication references can still be present under replication monitor which impacts the ability to re-create the real replication setup after a fail over.

04/19/2012 - 08:38

Put your splash.png file into res/drawable-ldpi, res/drawable-mdpi, res/drawable-hdpi, res/drawable-xdpi.

Those directories = low, medium, high and extra large dots per inch. Resize slash.png for each directory or Android will stretch it.

The sizes of each image should be:
•xlarge: at least 960 x 720
•large: at least 640 x 480
•medium: at least 470 x 320
•small: at least 426 x 320

Then in your main Java class, the one that extends DroidGap, you'll need to add one line and modify another. First add:
super.setIntegerProperty("splashscreen", R.drawable.splash);

this line should show up under super.onCreate but before super.loadUrl. Then you'll need to modify your loadUrl method to pause for 5 seconds before loading up the main page. It would look like this:
super.loadUrl("file:///android_asset/www/index.html", 5000);

04/17/2012 - 09:06

GridView - A very powerful control that provides an easy interface to add, update, delete, and
display data.

Sometimes we may need to manipulate the text, cells, and rows to fit our needs.

GridView is great for very simple tables. Sometimes we need to specify the format of the data, and the way it is rendered in the table, more exactly.

DataList could be used but doesn't have all the features such as paging and sorting that are commonly required.

If you need to use the GridView, but also need more control on the way that the table is rendered, you can use the GridView events and properties.

RowDataBound - The most common event used. This event is fired every time a row is bound to data. Whenever this event is fired, we will have access to the current row and all of its data, so we can manipulate the table, row, cells, and or controls of the table accordingly.

Other important events are the DataBound and the Load event.

Load event - fires when the GridView is loaded and has not been attached to any data yet. In this event the user can set properties such as the color of the border, themes, or any other rendering options that are not dependent on the data itself.

DataBound - is similar to the RowDataBound in that both are fired after a bound event has happened. The difference is that DataBound is fired once after the entire Grid has been bound; while the RowDataBound is fired every time a row is bound, meaning it will almost always be fired more than once. So you can use the DataBound to manipulate the table based on the data contained in it.

Thanks to http://www.simple-talk.com/dotnet/asp.net/take-row-level-control-of-your-gridview/ Visit the link for a full breakdown.


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView
OnRowDataBound="gvComorbidities_RowDataBound"
DataKeyNames="comorbidityID"
runat="server"
ID="gvComorbidities"
AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<p>Date Reported</p>
</HeaderTemplate>
<ItemTemplate>
<table>
<tr>
<td><a href='<%# String.Format("Comorbidities.aspx?comorbidityID={0}&Patient_ID={1}&OperationID={2}",DataBinder.Eval(Container.DataItem,"comorbidityid"),DataBinder.Eval(Container.DataItem,"patient_id"),DataBinder.Eval(Container.DataItem,"operationid")) %>'><%# DataBinder.Eval(Container.DataItem, "dateoffirstsymptoms", "{0:d}")%></a></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>


protected void gvComorbidities_RowDataBound(object sender, GridViewRowEventArgs e)
{
// Look for data items

if (e.Row.RowType == DataControlRowType.DataRow)
{
string comorbidityid = gvComorbidities.DataKeys[e.Row.DataItemIndex].Value.ToString();
string qscomorbidityid = Request.QueryString["comorbidityid"].ToString();

if (comorbidityid == qscomorbidityid)
{
e.Row.BackColor = System.Drawing.Color.LightGray;
}
}
}

04/16/2012 - 14:49

When using jquery along side ajax, the jquery isn't wired up if the page performs a partial pageback using ajax.

To get around this add a javascript pageLoad() function in the page and put the jQuery inside this function.

The pageLoad() function is available in JavaScript if you are using ASP.NET ajax. The AJAX framework automatically wires up any client-side function named pageLoad() as an Application.Load handler.

function pageLoad(sender, args)
{
$("#btnClientSide").bind('click', function()
{ alert('I am clicked');
});
}

04/12/2012 - 10:06

When setting up site in webmaster tools, ensure you set the preferred domain to www.bla.com and not otherwise site strength is split between bla.com and www.bla.com

In order to get this setup in webmaster tools, you need to add both sites as there is currently a bug in google. you need to setup www.bla.com and bla.com. verify both sites and then delete the one you don't need.

In addition to this, if google has indexed pages that related to the incorrect version of your site, i.e. bla.com/page1 instead of www.bla.com/page 1, you will need to setup a 301 redirect with your htacess file. If you don't have access to this, get your host to do it for you.

See for more information.
http://www.a3webtech.com/index.php/gwt-preferred-domain-bug-fix.html

03/31/2012 - 14:59

First - on page factors

1. pick key words to target.
2. create separate pages for each keyword
3. on page factors - page titles, url,keywords,h1-tags,title tags.
Dont use meta keywords.
Do you use meta description and title.

4. technially good website, can slow down website and google ranks the page load speed. I.e.
no broken links,
invalid css - http://jigsaw.w3.org/css-validator/
do not copy and paste content. duplicate google figures out

- pingdom
-copyscape, http://www.plagium.com

5. develop good content. If people click back after going to your site, it goes against you in google. Add new pages, don't change content on a page.

Second - off page factors

build incoming links
articles for directory submission
post articles on other sites
press releases.

Need to link to pages from other sites.

Thanks to Startups For The Rest Of Us for these tips.
http://www.startupsfortherestofus.com/episodes/episode-69-5-best-things-...

03/13/2012 - 10:29

Step 1: Dump the database either through PHPMyAdmin’s export form or through mysqldump. Note (mysqldump -h -u -p

if you ommit the -h switch it will default to “localhost”). After you enter the command below and press enter, you will be prompted for a password because you did not enter the password after the -p switch.
$ mysqldump -u -p >> somedatabasetable.sql

Step 2: Once you have the sql file, log into mysql and create a database or “use” an existing database – again, ommiting the -h will default to localhost and you will be prompted for a password if you don’t enter a password after the -p switch.
$ mysql -u -p

Step 3: After logging in, you will need to either create a new database and select the database for use with the import, or use an existing database. For this example, we’ll create a new database. Remember to use backticks and not apostrophe’s to create your new MySQL database.
mysql> create database `somedb`

Step 5: Remember where you put the SQL file and issue a “source” command:
mysql> source somedatabasetable.sql
The query is executed and if you didn’t mess around with the SQL produced by mysqldump, it should run things flawlessly.

03/13/2012 - 10:19

Below are some troubleshooting points to remember when setting up windows auth on windows server

HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Check if ‘php via FastCGI’ is added as a Module Mapping within IIS under Handler Mappings‘

Windows Authentication

Switch off anonymous user in iis and turn on windows authentication. The following gives me DOMAIN\MiteshChohan

print "here :". $_SERVER["REMOTE_USER"];

Drupal Windows Authentication
Once I did the above, I installed http://drupal.org/project/webserver_auth. One issue with this that it won’t let you logout. Workaround, see below:

- Disable anonymous user in iis. Assign given user Full Admin and Permission Rights. Then disable anonymous users in IIS. Said user will now have admin rights.

Saving User with illegal characters

On a drupal user page, if the user has a ‘domain\miteshchohan’ for example, this won’t pass drupal’s validation, hence you won’t be able to assign groups to the users. A workaround is to comment out below, from users\user.module

/*
if (preg_match('/[^\x{80}-\x{F7} a-z0-9@_.\'-]/i', $name)) {
return t('The username contains an illegal character.');
}
*/

Page 500 Error on root
Not sure if this is correct but to get around this, in IIS Page Errors, redirect the 500 error to the index.php of the site.

03/11/2012 - 12:26

Jquery mobile apps are themed using swatches :

- Reference the main jquery-mobile.min.js file

- Create a new swatch file by copying an existing jquery mobile.css file non-min version. Delete all swatches apart from Swatch A. Now Replace Swatch A with your own letter.

- Save swatch to something like jquery.swatch-m.css

- Reference this file inside your html pages and use data-them="m" to use the new swatch.

In order to use jquery mobile icons, you must copy the images folder that comes part of the jquery mobile download when hosting your own files into the same folder where jquery-mobile.css file is located.

10/05/2011 - 09:28

Below code populates a dropdown list using the ListItemCollection. In order to add this to the items collection, it needs to be casted to an array.

/* Accepts a comma delimited string and transforms this into list items */
public ListItemCollection splitListOptions(string aStr,string optPat,string keyvalPat)
{
//split each option
string[] strOptions = Regex.Split(aStr, optPat);

ListItemCollection licoll = new ListItemCollection();

foreach (string opt in strOptions)
{
//split each keyval
string[] strKeyVal = Regex.Split(opt, keyvalPat);
licoll.Add(new ListItem(strKeyVal[0], strKeyVal[1]));
}

return licoll;
}

DropDownList dd = new DropDownList();
dd.ID = "myddid";
ListItemCollection licoll = splitListOptions(f.fieldkeyvalueoptions, "##", "!:!");
var result = licoll.Cast<ListItem>().ToArray();
dd.Items.AddRange(result);
ph.Controls.Add(dd);

03/13/2011 - 10:14

results: [,…]
results: [,…]
a.0: {custid:cust_1, prod:item2, createdAt:2012-02-02T23:34:50.271Z, updatedAt:2012-02-02T23:34:50.271Z,…}
b.1: {custid:cust_1, prod:item1, createdAt:2012-02-02T23:34:53.163Z, updatedAt:2012-02-02T23:34:53.163Z,…}
c.2: {custid:cust_1, prod:item3, createdAt:2012-02-03T09:46:14.080Z, updatedAt:2012-02-03T09:46:

xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
var results = JSON.parse(xhr.responseText);
alert(results.results[0].prod);
}
}