I have an object which is a composite of several other objects. When i use the getObjectSize() method in the Instrumentation package, does it include the size of the composite objects also?
I'm attempting to upload a file like this:
import pycurl
c = pycurl.Curl()
values = [
("name", "tom"),
("image", (pycurl.FORM_FILE, "tom.png"))
]
c.setopt(c.URL, "http://upload.com/submit")
c.setopt(c.HTTPPOST, values)
c.perform()
c.close()
This works fine. However, this only works if the file is local. If I was to fetch the image such that:
import urllib2
resp = urllib2.urlopen("http://upload.com/people/tom.png")
How would I pass resp.fp as a file object instead of writing it to a file and passing the filename? Is this possible?
Hey
I have a problem with my FromView.
I would like to show some data from a Database Table in my FormView. But some data is from the tupe Int32, while this data should be in a TextBox, a string.
How do you convert these Int32's.
FormView and my ObjectDataSource
<asp:FormView ID="fvDetailOrder" runat="server">
<ItemTemplate>
Aantal:<br />
<asp:Label CssClass="txtBox" ID="Label15" runat="server" Text='<%# Eval("COUNT") %>' /><br />
Prijs:<br />
<asp:Label CssClass="txtBox" ID="Label16" runat="server" Text='<%# Eval("PRICE") %>' /><br />
Korting:<br />
<asp:Label CssClass="txtBox" ID="Label17" runat="server" Text='' /><br />
Totaal:<br />
<asp:Label CssClass="txtBox" ID="Label18" runat="server" Text='<%# Eval("AMOUNT") %>' /><br />
Betaald:<br />
<asp:Label CssClass="txtBox" ID="Label19" runat="server" Text='<%# Eval("PAID") %>' /><br />
Datum betaling:<br />
<asp:Label CssClass="txtBox" ID="Label20" runat="server" Text='<%# Eval("PDATE") %>' /><br />
</ItemTemplate>
</asp:FormView>
<asp:ObjectDataSource ID="objdsOrderID" runat="server"
OnSelecting="objdsOrderID_Selecting" SelectMethod="getOrdersByID"
TypeName="DAL.OrdersDAL">
<SelectParameters>
<asp:Parameter Name="id" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
My Code behind
protected void gvOrdersAdmin_SelectedIndexChanged(object sender, EventArgs e)
{
fvDetailOrder.DataSource = objdsOrderID;
fvDetailOrder.DataBind(); // <-- HERE I GET THE ERROR
}
protected void objdsOrderID_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters["id"] = gvOrdersAdmin.DataKeys[gvOrdersAdmin.SelectedRow.RowIndex].Values[0]; ;
}
My Data Acces Layer
public static DataTable getOrdersByID(string id)
{
string sql = "SELECT 'AUTHOR' = tblAuthors.FIRSTNAME + ' ' + tblAuthors.LASTNAME, tblBooks.*, tblGenres.*, tblLanguages.*, tblOrders.* FROM tblAuthors INNER JOIN tblBooks ON tblAuthors.AUTHOR_ID = tblBooks.AUTHOR_ID INNER JOIN tblGenres ON tblBooks.GENRE_ID = tblGenres.GENRE_ID INNER JOIN tblLanguages ON tblBooks.LANG_ID = tblLanguages.LANG_ID INNER JOIN tblOrders ON tblBooks.BOOK_ID = tblOrders.BOOK_ID"
+ " WHERE tblOrders.ID = @id;";
SqlDataAdapter da = new SqlDataAdapter(sql, GetConnectionString());
da.SelectCommand.Parameters["id"].Value = id;
DataSet ds = new DataSet();
da.Fill(ds, "Orders");
return ds.Tables["Orders"];
}
Thanks a lot, Vincent
According to the ActionScript 3.0 documentation, the TextField classes "size" property is an Object. Why is this? Clearly this is a number! When I check its type (using typeOf()), it returns "Number". So whats the deal?
Hi, I am working on a project and I need to save user configuration. The configuration is a set of Jchechboxes I need to store their state (true, false). Which do you think is the better way of saving it, in a file and if yes in what (ini, cfg, txt), or it is better to serialize the object with the states?? Or if there is another way, please tell me :)
Cheers
Hello,
Suppose I have a method like so:
public byte[] GetThoseBytes()
{
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
ms.WriteByte(1);
ms.WriteByte(2);
return ms.ToArray();
}
}
Would this still dispose the 'ms' object? I'm having doubts, maybe because something is returned before the statement block is finished.
Thanks,
AJ.
Hi,
For winforms applications I'm wondering what setup code should go in:
MainForm()
as opposed to
MainForm_Load(object sender, EventArgs e)
Are there any best practise guidelines here?
I am loading an html page into a WebBrowser object in a VB.NET Windows Forms application. The user may make changes to textboxes, dropdowns, etc. on the HTML page displayed in the browser. I want the ability to save the current context to a .pdf file on the local HD. I am able to print using WebBrowser.Print(), which shows the current context, but what ways are possible to get this saved as a PDF file locally?
I want a class property to be reference to another class, not its object and then use this property to call the class's static methods.
class Database {
private static $log;
public static function addLog($LogClass) {
self::$log = $LogClass;
}
public static function log() {
self::$log::write(); // seems not possible to write it like this
}
}
any suggestions how i can accomplish this?
cause i have no reason making them objects, i want to use the classes for it.
Hi, does anyone know if it is possible to cast a generic type with a certain type parameter (e.g. Bar) to the same generic type with the type parameter being a base type of Bar (such as object in my case). And, if it is possible, how would it be done?
What I want to do is have a collection of Foo but be able to add Foos with more specific type arguments.
Thanks
Apparently this does not work.
WHY ???????
I don't want to do all this just to call my function:
Dim x as new Object()
x.Method()
WHY do I have to do this in 2 lines when I can in one. This is really pissing me off.
When using Excel Interop libraries from .NET, I can find a Range object representing the cell offset from Range X by calling something like.
Range Y = X.Range[2,3];
But what should I do to perform the inverse operation, ie: I have two Range objects, A and B, and I would like to find out by how many rows/columns B is offset from A.
Does anyone know the easiest way to do this? Is there a library function?
Thanks.
I have a java.io.Reader as the return type of my method. But i have Object type of an instance which i get from Database. So how can I convert this to Reader type and return?
need help
thanks.
Hi All,
How does jvm know what class an object is an instance of at runtime. I know we can use the getClass method to get the class name but how does the getClass method work?
Thx,
Praveen.
Hi,
If there is a tool for analyzing memory leaks in a c++ COM Object, please provide a link here
If no such tool exist, what would be the best way to handle memory leaks ?
Thank You
Is there any difference between Convert.ToString Method and Object.ToString() in C#.net other than the how these handle null value.
There could be some difference between the two in the Globalization Perspective.
Hi,
I want to move 500 table from Database to other with their data and constraints all the tables have column who has default value, I used SSIS using "Transfer SQL Server Object Task" and I choose to copy all tables, copy data and primary keys, it copies the table except the default bindings
I tried in SQL Server 2008 CopyAllDRIObjects Property but still the same result.
How can I copy all tables from database to other with their data and maintaining their constraints.
Hallo all.
I got a javascript object with some propeties let's say
function Animal() {
this.id;
this.name;
I need to call id function in a dynamic way to get and set its value: something like this
Animal animal = new Animal();
var propertyName = "id";
animal.+propertyName = "name";
Is there an elegant way to do it? With jQuery?
Kind regards
Massimo
In javascript on a browser, I can do this to see if an object is DOM-related:
obj instanceof Node
How do I accomplish this with google desktop? Node is undefined, and this doesn't work either:
obj instanceof basicElement
Hi,
Can any one tell me which one is better in "Session Facade Class" and "Single ton Object" design patterns in ASP.Net? Also, please state the scenarions where specific design pattern is advisable to use.
Thanks
Rupa
How do I create a cache for a struct pointer object in Objective-C? Is there any third party component for caching objects as Java and .NET have?
I have the following struct:
typedef struct _news {
references
char *headline;
char *story_url;
} news;
I have a double pointer for the above struct in an interface class. I would like to cache it for some time using Objective-C.
Hi,
If there is a tool for analyzing memory leaks in a c++ COM Object, please provide a link here
If no such tool exist, what would be the best way to handle memory leaks ?
Thank You
Hi there,
Is there a way to retrieve tables, including alias tables, and columns, including alias columns, from an Apache Torque Criteria object reliably?
I understand that there is methods like: getSelectedColumns, getAsColumns(), getJoins(), etc., but for examples, getJoins() will just return a list of joined tables strings in free text, where one has to use regular expression to extract the needed joined table information out of it.
Thanks in advance!
David