Hi,
Can I use Linq-to-xml to persist my object state without having to use/know Xpath & XSD Syntax?
ie. really looking for simple but flexible way to persist a graph of object data (e.g. have say 2 or 3 classes with associations) - if Linq-to-xml were as simple as saying "persist this graph to XML", and then you could also query it via Linq, or load it into memory again/change/then re-save to the xml file.
Hello,
I get the warning "Format not a string literal and no format arguments" on the NSLog call in the following block:
(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog([NSString stringWithFormat:@"%d", buttonIndex]);
}
I have read in another post here that this error message indicates an insecure use of NSLog. Could someone point me in the direction of a properly formatted string for this?
Thanks for any and all assistance!
Regards,
Steve O'Sullivan
In this link: http://css-tricks.com/snippets/jquery/jquery-plugin-template/ it has a line of code that says
// Add a reverse reference to the DOM object
base.$el.data("yourPluginName", base);
what does the "reverse reference to the DOM object" mean?
I have an 'optional' parameter on a method that is a KeyValuePair. I wanted an overload that passes null to the core method for this parameter, but in the core method, when I want to check if the KeyValuePair is null, I get the following error:
Operator '!=' cannot be applied to operands of type System.Collections.Generic.KeyValuePair<string,object>' and '<null>.
How can I not be allowed to check if an object is null?
I have the following variable that accepts a file name:
var xtr = new XmlTextReader(xmlFileName)
{
WhitespaceHandling = WhitespaceHandling.None
};
var xd = new XmlDocument();
xd.Load(xtr);
I would like to change it so that I can pass in an object. I don't want to have to serialize the objectto file first.
Is this possible?
I have an unsigned char array that I need in a std::string, but my current way uses reinterpret_cast which I would like to avoid. Is there a cleaner way to do this?
unsigned char my_txt[] = {
0x52, 0x5f, 0x73, 0x68, 0x7e, 0x29, 0x33, 0x74, 0x74, 0x73, 0x72, 0x55
}
unsigned int my_txt_len = 12;
std::string my_std_string(reinterpret_cast<const char *>(my_txt), my_txt_len);
How can I return a java.util.concurrent.Future object with a Receipt object and only use the @javax.ejb.Asynchronous annotation?
And do I need any extra configuration to let Spring handle ejb annotations?
I don't want to write any concurrency logic myself.
Here's my attempt that doesn't work:
@Asynchronous
public Future<Receipt> execute(Job job) {
Receipt receipt = timeConsumingWork(job);
return receipt;
}
I have an object which has both a copy constructor and assignment operator defined. It is enclosed inside a shared pointer.
I want to make another shared pointer that contains a copy of the original shared pointer (i.e. new shared pointer to a new memory location, which however, has the same data as the original object).
Thanks for any assistance.
With the new ConcurrentBag<T> in .NET 4, how do you remove a certain, specific object from it when only TryTake() and TryPeek() are available?
I'm thinking of using TryTake() and then just adding the resulting object back into the list if I don't want to remove it, but I feel like I might be missing something. Is this the correct way?
Is it possible, given a SEL to generate a string representation of the method it refers to?
For context:
I have an object instance initialized thusly:
-(id) initWithTarget:(id)object action: (SEL)action;
Within the instance I would like to echo the string name of the method referred to by SEL. How do I do that?
In my code, is there a shorthand that I can use to assign a variable the value of a object's property ONLY if the object isn't null?
string username = SomeUserObject.Username; // fails if null
I know I can do a check like if(SomeUserObject != null) but I think I saw a shorthand for this kind of test.
I tried:
string username = SomeUserObject ?? "" : SomeUserObject.Username;
But that doesn't work.
I want to use a standard dialog to solicit user input of an ADO.net connection string. It is trivial to do for the oledb connection string as described here:
MSDN Article on MSDASC.DataLinks().Prompt
I've also found examples that use Microsoft.Data.ConnectionUI.dll and MicrosoftData.ConnectionUI.Dialog.dll from VS (HOWTO: Using the Choose Data Source dialog of Visual Studio 2005 from your own code).
Unfortunately these DLLs are not licensed for redistribution.
Is there a standard dialog for choosing a data source that can be distributed with my application?
I have a WPF ListBox control and I'm setting it's "ItemsSource" to a collection of item objects. How can I bind the "IsSelected" property of the ListBoxItem to a "Selected" property of a corresponding item object without having an instance of the objectto set as a binding.Source?
I'm getting a datetime string in a format like "2009-05-28T16:15:00" (this is ISO 8601, I believe) one hack-ish option seems to be to parse the string using time.strptime and passing the first 6 elements of the touple into the datetime constructor, like:
datetime.datetime(*time.strptime("2007-03-04T21:08:12", "%Y-%m-%dT%H:%M:%S")[:6])
I haven't been able to find a "cleaner" way of doing this, is there one?
My site does some short ajax call in JSON format, using jQuery.
At client-side i'd like to send object just passing it in ajax function, without being forced to wrap it in an object literal like this: {'JSON_Obj' : myJSON_Obj }.
For the same reasons, at server-side i'd like to manage objects without the binding of $_GET['JSON_Obj'] or $_POST['JSON_Obj'].
For example, using file_get_contents("php://input"), i can manage POST requests in that way, but in GET format it doesn't work.
Any suggestions?
What is the CodePage for DBCS so I can encode an xml string and show it in a asp.net text box? I don't think I should have to convert the characters myself when Server.HTMLEncode will work if the string is DBCS.
Thanks!
I don't really think there is some method to do this… Anyway… How can I replace one object with another everywhere in the program? It would be like all the references to an old object start to point to a new one.
All the Python built-ins are subclasses of object and I come across many user-defined classes which are too. Why? What is the purpose of the class object? It's just an empty class, right?
In a python source code I stumbled upon I've seen a small b before a string like in:
b"abcdef"
I know of u prefix that means unicode and r prefix that means raw.
What does the b stand for and in which kind of source code is it useful as it seems to be exactly like a plain string without any prefix ?
I created a .xcdatamodel Managed Object Model file in Xcode. I selected that file in Groups & Files. Then I go to File New... and nowhere in the iPhone Templates / Cocoa Touch Class templates I see the "Managed Object Class" file template.
Does anyone know what can be wrong?
While studying C# I found it really strange, that dynamically typed Python will rise an error in the following code:
i = 5
print i + " "
whereas statically typed C# will normally proceed the similar code:
int i = 5;
Console.Write(i + " ");
I would expect other way around (in python I would be able to do this without any casting, but C# would require me to cast int tostring or stringto int).
Just to highlight, I am not asking what language is better, I am curious what was the reason behind implementing the language this way.