I'd like to add a generic type method DoSomething<T>, but for backwards compatibility, I want it to simply pass the type parameter for the generic type from an existing method with the same name.
public void DoSomething<T>(Data data)
{
//do something with Data, it depends on the type of T
}
public void DoSomething(Data data, Type d...
Hello All,
I couldn't solve that mistery question in SQL SERVER.
Here an example that I tried to do and it didn't work.
DECLARE @Total int;
SET @Total = (SELECT COUNT(*)-10 FROM MYTABLE)
SELECT TOP @Total IdColumn FROM MYTABLE
How can I use the following query
SELECT COUNT(*)-10 FROM MYTABLE
as an integer variable, somewhere el...
EDIT: Language is PHP.
So, I'm implementing a listener/observer pattern. One of the objects I implemented was an object for including files. Which works in a way like this:
class IncludeEvent extends Event {
protected $File = '';
public $Contents;
....
public function Begin() {
....
// this is the ONLY t...
I tried with NMock2 but I get TypeLoadExceptions when trying to pass the mocks into the constructor, also I saw TypeMock can do that but it costs 80$
...
Is there any way to access the prepared statement as sent to the SQL server?
Dim params(1) As OleDb.OleDbParameter
params(0) = New OleDb.OleDbParameter("@ID", OleDb.OleDbType.VarChar, 50)
params(0).Value = guiItemsGridView.Rows(e.RowIndex).Cells("ID").Value
params(1) = New OleDb.OleDbParam...
I need to work around an NHibernate bug I reported here. Essentially, NHibernate will generate multiple SQL parameters for the same HQL parameter, which results in problems for queries that use a parameter in a grouping construct.
Until the bug is fixed, I figured I'd just concatenate the parameter into the HQL. Obviously this is suscep...
I'm using mod_rewrite to rewrite pretty URLs to a form supported by a Spring 2.5 application.
e.g. /category/cat1?q=x => /controller?category=cat1&q=x
However from my controller I want to know the original URL the request came from (so I can generate a link if required). This approach is needed generically across all pages so it i...
Hi all, I am writing a small application in Classic ASP. I have a page which has a form, which posts to a second page. Included with the form's POST, are file uploads, hence the need for a POST method.
The second page though is NOT seeing ANY of the fields being sent by the first page. Calling either Request("param") or Request.Form("...
I have many html forms referring to many persistence classes.
All the html forms are generated by one single class HTMLForm by passing in the respective HTMLFields instances:
public class HTMLForm<T>{
HTMLForm(HTMLFields[] f, Class<T> classt){
this.stupidSunWontAllowTnewInstance = classt;
// ... whatever GWT jazz ....
}
public...
I am not sure how to have a function that receives a class object as a parameter. Any help? Here is an example below.
#include<iostream>
void function(class object); //prototype
void function(class tempObject)
{
//do something with object
//use or change member variables
}
Basically I am just confused on how to create a functi...
I thought I heard somewhere that you couldn't use jquery to manipulate the content... Is that correct? Basically, I have a site that has parameters like p.php?d=keyword+keyword+keyword, and I wanted to be able to set the title according to what's in that d parameter... Is there a way to do that?
...
In the work I do, I often have parameters that I need to group into subsets for convenience:
d1 = {'x':1,'y':2}
d2 = {'a':3,'b':4}
I do this by passing in multiple dictionaries. Most of the time I use the passed dictionary directly, i.e.:
def f(d1,d2):
for k in d1:
blah( d1[k] )
In some functions I need to access the v...
Hi
I have this line of code:
<%= link_to "Add to cart", :controller => "car", :action => "add_to_cart", :car => car %>
when im in the add_to_cart method...how can i call the :car please?
@car = Car.new(params[:car])
doesnt work because it says im trying to stringify
I dont understand whats wrong because I used this to create new ...
While updating a DataTable to a SQL Server database I get the error message "Column 'PK_Column' does not allow nulls" after calling GetErrors()
I don't want to provide a value for PK_Column because it is a auto increment primary key column in the database. My insert statement looks like this:
INSERT INTO [Order] ([Customer_Id], [OrderTi...
I have three tree view controls which house different (but mostly similar data), as a result the actions that can be taken at each level is the same as far as the user is concerned, but different in their type (which is something I have to worry about as the developer). What I would like to do is reuse this context menu and pass in a typ...
Let me explain a little.
Image you have the flowing MySQL table:
CREATE TABLE test (
value DATETIME
);
Currently I am doing something like this:
command.CommandText = "UPDATE test SET value = ?value";
command.Parameters.AddWithValue("?value", DateTime.Now);
But the clients date/time settings are unreliable so I would like the ti...
Here is a quote from here:
So in short ... you need to look into login
page, see what params it uses e.g
login=xxx, password=yyy, post it to
that page and you will have to manage
the cookies too, that is where library
like twill etc come into picture.
How could I do it using Python and Google App Engine? Can anybody pleas...
Short Version
For those who don't have the time to read my reasoning for this question below:
Is there any way to enforce a policy of "new objects only" or "existing objects only" for a method's parameters?
Long Version
There are plenty of methods which take objects as parameters, and it doesn't matter whether the method has the obje...
After running Code Analysis in VS2010 beta (FxCop for previous versions) I'm getting the following warning:
In externally visible method
'Identity.Identity(WindowsIdentity)',
validate parameter 'windowsIdentity'
before using it.
The constructor is:
public Identity(WindowsIdentity windowsIdentity)
: base(windowsIdent...
Hi all,
Is it possible to use a variable as an update parameter in asp.net?
I have the page number to be updated stored in a variable called 'mypagenum', how would I write an update parameter using that value.
Thanks
...