php split()
Bit behind the eight ball, but the php function split(string $pattern, string $string) is depreciated. Instead use explode(string $delimiter, string $string)
1
For more info… http://php.net/manual/en/function.explode.php
creating mutli line strings in c#
Great concept, if you’re like me and hate having really really long one line strings… e.g. a query this is the solution for you.
Example, you may have the following… which won’t work.
1
Instead of adding ” something ” + (new line) + ” something else “… Continue reading
How to get the application pool process id
Many times I’ve been working on two sites in Visual Studio 2010, and I get this common problem all the time. Which process to attach? w3wp.exe is the only thing that comes up, and we have no other way of knowing. One method is to identify what the worker process is called.
IIS7
Launch command prompt
Navigate to C:\Windows\System32\inetsrv
Run appcmd list wp
1
Microsoft Windows [Version… Continue reading
how to get the current page file name
Incase you need to get the current filename, e.g. default.apsx
How to find out if a column exists in a DataRow
Bit of a stupid one, but hey! you never know…
This example re-uses a function I created in another post, you can view it here: http://www.validusconcepts.com/blog/example-datatable
1
String age = string.Empty;
DataTable dtPeople = GetExampleDataTable();
for (int i = 0; i < dtPeople.Rows.Count; i++)
{
DataRow drPerson = dtPeople.Rows[i];
if(drPeople.Table.Columns.Contains("Age"))
{
// then you can reference the column and your code… Continue reading
Example DataTable
Every now and then I need to create a dummy data table to test out gridviews n stuff… so here’s a quick post on how to create one
1
public static DataTable ExampleDataTable()
{
// Declare the DataTable
DataTable dtExample = new DataTable();
// Here we define the columns, Add() takes in two params, the name and the data type
dtExample.Columns.Add("ID", typeof(int))… Continue reading
open a new window using jQuery
I had an issue with a client concept last week, and we basically needed to launch a new popup window. But I wanted to make sure it wasn’t just target=”_blank”. So I thought I’d use jQuery, I remember there was a window.open() function, so here’s the example
1
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script><script type="text/javascript">
$(document).ready(function() {
$(‘.popup’).click(function(event) {
window.open($(this).attr("href"), "popup", "width=250,height=250,scrollbars=no");
});
});
</script>… Continue reading
PHP Single vs Double quotes
Had a question yesterday…
Is it bad practice to use double quotes (“) for almost all my expressions in…well, anything? As opposed to a single quote? I know there’s a difference between the two and when to use it, but is it just generally better practice to use single instead of double? Most developers I see use single quotes for almost everything.
Quick answer, there’s no… Continue reading
