Hi,
I want to get tree representation answer from my t-sql stored procedure. How can I do it ?
Does .NET have a predefined types for working with xml-answers from stored procedures ?
I'm using Java's DataInputStream with scala to parse some simple binary file (which is very bad exprerience due to the lack of unsigned types, even in scala, but that's a different story).
However I find myself forced to use mutable data structure, since Java's streams are inherently state preserving entities.
What's a good design to wrap Java's streams with nice functional data structure?
I am using MySql ODBC driver with .Net 3.5. I have created a stored procedure in MySQl which accepts around 15 parameters with types like datetime, varchar, Int32, Int64 etc.. When I run the SP from the query window with the arguments provided, it runs fine. But whwn I test using the .Net application, it gives exception with "Memory allocation error", MySQL native error code is 4001.
Any help will be much appreciated.
I'm doing course 3354 (Implementing System Types and Interfaces in the .NET Framework 2.0) and it is said that for simple classes, with members variables and functions, it is better to use a struct than a class because of overhead.
I have never heard of such a thing, what is the validity of this claim?
Hi folks,
I'll briefly explain what I'm trying to do:
I need to sort a set of content-types within a paginated page. Also I need to add filtering to the page, for example each content-type should have a set of tags and the filter needs to filter through these tags.
This is a basic mockup of what this page consists of:
I'm finding it quite hard figuring out the best way to do it, and if this can be done.
Help would be very much appreciated!!
I use windows 7. I set the ClassPath like this:
D:\EclipseProjects\DLFWD_NEW\WebContent\WEB-INF\lib\jsf-api.jar;D:\EclipseProjects\DLFWD_NEW\WebContent\WEB-INF\lib\jsf-impl.jar;D:\EclipseProjects\DLFWD_NEW\WebContent\WEB-INF\lib\primefaces-2.2.RC1.jar
And I alse do this:
Window Preferences General Content Types Text JSP Add (xhtml)
But, it doesn't works.
When I use netbeans. I do nothing, but the autocomplete function works well.
For some reason, all of the objects in my ASP.NET markup are now null when I try to assign values to their properties in the code behind.
My project was going fine and then now when I try to assign a data source to a GridView, I get a null reference error.
I have no idea why it's doing this. I am not doing nothing special. I am just trying to assign a value to a property to an asp.net element in on the page. The intellisense knows that the element is there and I get no errors when I build the project. It's just when I am running the website I get the null reference.
I have been trying to fix this issue for a couple weeks now. Please Help.
Thanks.
Here is the code:
protected void Page_PreRender(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
Entities context = new Entities();
var types = (from t in context.CustomerTypes
select t).OrderBy(t => t.TypeName);
gvCustomerTypes.DataSource = types;
gvCustomerTypes.DataBind();
}
and on in the markup the gridview looks like this:
<asp:GridView ID="gvCustomerTypes" runat="server" ShowHeader="true" GridLines="Both"
AutoGenerateColumns="false" AlternatingRowStyle-BackColor="AliceBlue" Width="100%">
<Columns>
<asp:TemplateField HeaderText="Customer Type Name" HeaderStyle-HorizontalAlign="Left"
ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblType" runat="server" Text='<%# Eval("TypeName") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" NavigateUrl='<%#Eval("CustomerTypeID", "CreateEditCustomerType.aspx?ID={0}") %>'
Text="Edit" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" CommandName='<%#Eval("CustomerTypeID") %>' OnClientClick="javascript:return confirm('Are you sure you want to delete this Customer Type?');"
OnCommand="DeleteCustomerType" Text="Delete" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Every now and then (once every day or so) we're seeing the following types of errors in our logs for an ASP.NET 3.5 application
Invalid viewstate
Invalid postback or callback argument
Are these something that "just happens" from time-to-time with an ASP.NET application? Would anyone recommend we spend a lot of time trying to diagnose what's causing the issues?
I'd like to dynamically create a module from a dictionary, and I'm wondering if adding an element to sys.modules is really the best way to do this. EG
context = { a: 1, b: 2 }
import types
test_context_module = types.ModuleType('TestContext', 'Module created to provide a context for tests')
test_context_module.__dict__.update(context)
import sys
sys.modules['TestContext'] = test_context_module
My immediate goal in this regard is to be able to provide a context for timing test execution:
import timeit
timeit.Timer('a + b', 'from TestContext import *')
It seems that there are other ways to do this, since the Timer constructor takes objects as well as strings. I'm still interested in learning how to do this though, since a) it has other potential applications; and b) I'm not sure exactly how to use objects with the Timer constructor; doing so may prove to be less appropriate than this approach in some circumstances.
EDITS/REVELATIONS/PHOOEYS/EUREKAE:
I've realized that the example code relating to running timing tests won't actually work, because import * only works at the module level, and the context in which that statement is executed is that of a function in the testit module. In other words, the globals dictionary used when executing that code is that of main, since that's where I was when I wrote the code in the interactive shell. So that rationale for figuring this out is a bit botched, but it's still a valid question.
I've discovered that the code run in the first set of examples has the undesirable effect that the namespace in which the newly created module's code executes is that of the module in which it was declared, not its own module. This is like way weird, and could lead to all sorts of unexpected rattlesnakeic sketchiness. So I'm pretty sure that this is not how this sort of thing is meant to be done, if it is in fact something that the Guido doth shine upon.
The similar-but-subtly-different case of dynamically loading a module from a file that is not in python's include path is quite easily accomplished using imp.load_source('NewModuleName', 'path/to/module/module_to_load.py'). This does load the module into sys.modules. However this doesn't really answer my question, because really, what if you're running python on an embedded platform with no filesystem?
I'm battling a considerable case of information overload at the moment, so I could be mistaken, but there doesn't seem to be anything in the imp module that's capable of this.
But the question, essentially, at this point is how to set the global (ie module) context for an object. Maybe I should ask that more specifically? And at a larger scope, how to get Python to do this while shoehorning objects into a given module?
What software (or types of software) can be condsidered as innovative?
What distinctive parameters or features of product can be considered as innovative?
We currently have an iPhone app and would like to build a mobile website that has similar functionalities so it is accessible on multiple types of handsets.
what programming language should we best use for this? our app would like to use geolocation, camera/photo upload and access to the phone's contacts.
hope you can help us out!
best,
Robbert
Is it possible to create and manage custom permission types in Jetspeed. In addition to the default - folder, page, link, portlet I would like to add document as a type.
I want to then use the list of permissions of type "document" that a principal has to manage access to documents.
Thanks
Im asp.net mvc3 c# code returns json list like this:
return Json(new { name = UserNames, imageUrl = ImageUrls });
UserNames and ImageUrls are both List types
And this is my jquery
function StartSearch(text) {
$.ajax({
url: '/Shared/Search',
type: 'POST',
data: { SearchText: text },
dataType: 'json',
success: function (result) {
$.each(result, function (i, item) {
alert(result[i].name);
});
}
});
}
How i can get names and umageUrls?
Thanks
When building gtk2hs-buildtools with ghc 7.4.2, I get the following warning:
c2hs/toplevel/C2HSConfig.hs:110:1:
Warning: newtype `CInt' is used in an FFI declaration,
but its constructor is not in scope.
This will become an error in GHC 7.6.1.
When checking declaration:
foreign import ccall safe "static bitfield_direction" bitfield_direction
:: CInt
I get similar warnings with FFI calls, even though I have import Foreign.C.Types(CInt).
What is the correct way of getting rid of this warning?
I want to create a method sum that I can call on different types, specifically sum(1,2).
def sum[A](a1: A, a2: A) = a1 + a2
This fails because the compiler can't tell if A has a method '+'
I tried to define a structural type:
type Addable = {def +(a: Addable)}
This fails because of an illegal cyclic reference
How can I achieve this in a type safe way without requiring A to extend a specific trait?
Hello, I wrote this code:
public static bool MyMethod(int someid, params string[] types)
{...}
How could I write that using Func?
public static Func < int, ?params?, bool > MyMethod = ???
Thanks :-)
Hi,
I'm working on a Rewriterule in order to have URLs like these: http://www.myhost.com/var1/var2/
RewriteRule ^(.*)\/(.*)\/$ index.php?var1=$1&var2=$2 [L]
What I would like to add is that when someone types myhost.com/var1/var2 (without the end slash), it still goes to the same page.
Is there a better way to do it than this?
RewriteRule ^(.*)\/(.*)\/$ index.php?band=$1&song=$2 [L]
RewriteRule ^(.*)\/(.*)$ index.php?band=$1&song=$2 [L]
I have the following (doctored) class in a system I'm working on and Findbugs is generating a SE_BAD_FIELD warning and I'm trying to understand why it would say that before I fix it in the way that I thought I would. The reason I'm confused is because the description would seem to indicate that I had used no other non-serializable instance fields in the class but bar.model.Foo is also not serializable and used in the exact same way (as far as I can tell) but Findbugs generates no warning for it.
import bar.model.Foo;
import java.io.File;
import java.io.Serializable;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Demo implements Serializable {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final File file;
private final List<Foo> originalFoos;
private Integer count;
private int primitive = 0;
public Demo() {
for (Foo foo : originalFoos) {
this.logger.debug(...);
}
}
...
}
My initial blush at a solution is to get a logger reference from the factory right as I use it:
public DispositionFile() {
Logger logger = LoggerFactory.getLogger(this.getClass());
for (Foo foo : originalFoos) {
this.logger.debug(...);
}
}
That doesn't seem particularly efficient, though.
Thoughts?
I have a table in my database called "OrderItemType" which has about 5 records for the different OrderItemTypes in my system. Each OrderItem contains an OrderItemType, and this gives me referential integrity. In my middletier code, I also have an enum which matches the values in this table so that I can have business logic for the different types.
My dev manager says he hates it when people do this, and I am not exactly sure why. Is there a better practice I should be following?
I want to use selenium test to cover my rails project ! but i just find little documents on selenium test . I want someone to give me some documents for selenium test of all types !like website ,pdf ,text etc. you can sent them to my gmail [email protected] Thank you ,and best regards!
Hi I have a task as that
a dropdown list to choose an input type
selections are
textbox
datetime
number
while choosing one of those types, I have to open the selected input(for example if user chose datetime I have to open a datetime input)
For this task which is most suitable
using aspview(each input type one view)
for each one a usercontrol so when user select
a type loading it's usercontrol at runtime
or do you have any better ideas?
I know that you can instantiate anonymous types with Linq but I am looking to instantiate an object I have already defined. Every time I do, all the properties are returned with their defaults (null, 0, etc.) Is there a way to make this work?
I've tried something like this:
ServiceDepartment[] serviceDepartments = (from d in departments
orderby d.department_name
select new ServiceDepartment
{
DepartmentID = d.department_id,
DepartmentName = d.department_name
}).ToArray();
As we know, in C# structs are passed by value, not by reference. So if I have a struct with the following data members:
private struct MessageBox
{
// data members
private DateTime dm_DateTimeStamp; // a struct type
private TimeSpan dm_TimeSpanInterval; // also a struct
private ulong dm_MessageID; // System.Int64 type, struct
private String dm_strMessage; // an object (hence a reference is stored here)
// more methods, properties, etc ...
}
So when a MessageBox is passed as a parameter, a COPY is made on the stack, right?
What does that mean in terms of how the data members are copied?
The first two are struct types, so copies should be made of DateTime and TimeSpan. The third type is a primitive, so it's also copied. But what about the dm_strMessage, which is a reference to an object? When it's copied, another reference to the same String is created, right? The object itself resides in the heap, and is NOT copied (there is only one instance of it on the heap.) So now we have to references to the same object of type String. If the two references are accessed from different threads, it's conceivable that the String object could be corrupted by being modified from two different directions simultaneously. The MSDN documentation says that System.String is thread safe. Does that mean that the String class has a built-in mechanism to prevent an object being corrupted in exactly the type of situation described here?
I'm trying to figure out if my MessageBox struct has any potential flaws / pitfalls being a structure vs. a class.
Thanks for any input.
Source.Energy.
i have one form and i am using PHPMailer to send data from that form to my email. Users can send attachments as well, but i have one rpoblem: how to make PHPMailer to deny attachments larger than 2Mb and to allow only iamge attachments (no other types of documents)?
This is code i using for multiply email attachments with PHPMailer:
foreach(array_keys($_FILES['fileAttach']['name']) as $key) {
$source = $_FILES['fileAttach']['tmp_name'][$key];
$filename = $_FILES['fileAttach']['name'][$key];
$mail->AddAttachment($source, $filename);
}
I'm trying to define a class (or set of classes which implement the same interface) that will behave as a loosely typed object (like JavaScript). They can hold any sort of data and operations on them depend on the underlying type.
I have it working in three different ways but none seem ideal. These test versions only allow strings and integers and the only operation is add. Adding integers results in the sum of the integer values, adding strings concatenates the strings and adding an integer to a string converts the integer to a string and concatenates it with the string. The final version will have more types (Doubles, Arrays, JavaScript-like objects where new properties can be added dynamically) and more operations.
Way 1:
public interface DynObject1 {
@Override public String toString();
public DynObject1 add(DynObject1 d);
public DynObject1 addTo(DynInteger1 d);
public DynObject1 addTo(DynString1 d);
}
public class DynInteger1 implements DynObject1 {
private int value;
public DynInteger1(int v) {
value = v;
}
@Override
public String toString() {
return Integer.toString(value);
}
public DynObject1 add(DynObject1 d) {
return d.addTo(this);
}
public DynObject1 addTo(DynInteger1 d) {
return new DynInteger1(d.value + value);
}
public DynObject1 addTo(DynString1 d)
{
return new DynString1(d.toString()+Integer.toString(value));
}
}
...and similar for DynString1
Way 2:
public interface DynObject2 {
@Override public String toString();
public DynObject2 add(DynObject2 d);
}
public class DynInteger2 implements DynObject2 {
private int value;
public DynInteger2(int v) {
value = v;
}
@Override
public String toString() {
return Integer.toString(value);
}
public DynObject2 add(DynObject2 d) {
Class c = d.getClass();
if(c==DynInteger2.class)
{
return new DynInteger2(value + ((DynInteger2)d).value);
}
else
{
return new DynString2(toString() + d.toString());
}
}
}
...and similar for DynString2
Way 3:
public class DynObject3 {
private enum ObjectType {
Integer,
String
};
Object value;
ObjectType type;
public DynObject3(Integer v) {
value = v;
type = ObjectType.Integer;
}
public DynObject3(String v) {
value = v;
type = ObjectType.String;
}
@Override
public String toString() {
return value.toString();
}
public DynObject3 add(DynObject3 d)
{
if(type==ObjectType.Integer && d.type==ObjectType.Integer)
{
return new DynObject3(Integer.valueOf(((Integer)value).intValue()+((Integer)value).intValue()));
}
else
{
return new DynObject3(value.toString()+d.value.toString());
}
}
}
With the if-else logic I could use value.getClass()==Integer.class instead of storing the type but with more types I'd change this to use a switch statement and Java doesn't allow switch to use Classes.
Anyway... My question is what is the best way to go about something thike this?