Validus … talkin bout <code> n sh!t

10Oct/111

DevExpress ASPxCallback crash course

Posted by Joey

I keep forgetting how to create a simple callback, so I’ve decided I’ll quickly make this post.

Scenario: I have a button, that I want to execute a method, but I don’t want to use a Full Postback, so I’ll use a Callback.

Firstly lets put code up our button & callback
1

Next add the Callback
1
<%@… Continue reading

Filed under: C# 1 Comment
14Sep/110

php split()

Posted by Joey

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

Filed under: PHP No Comments
15Aug/110

creating mutli line strings in c#

Posted by Joey

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

Filed under: C# No Comments
6Aug/111

How to get the application pool process id

Posted by Joey

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

Filed under: C# 1 Comment
5Aug/110

how to get the current page file name

Posted by Joey

Incase you need to get the current filename, e.g. default.apsx

1… Continue reading

Filed under: C# No Comments
5Aug/110

How to find out if a column exists in a DataRow

Posted by Joey

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

Filed under: C# No Comments
4Aug/110

Example DataTable

Posted by Joey

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

Filed under: C# No Comments
2Aug/110

open a new window using jQuery

Posted by Joey

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&gt… Continue reading

Filed under: Stuff No Comments
2Aug/110

c# compare multiple strings

Posted by Joey

Seems pretty straight forward, but I totally forgot how to compare a list of strings against another string. So here’s the code!

1… Continue reading

Filed under: C# No Comments
1Aug/110

PHP Single vs Double quotes

Posted by Joey

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

Filed under: PHP No Comments