tostring

C++ array to string

I have a vector<int> container that has integers (e.g. {1,2,3,4}) and I would like to convert to a string of the form "1,2,3,4" What is the cleanest way to do that in C++? In Python this is how I would do it: >>> array = [1,2,3,4] >>> ",".join(map(str,array)) '1,2,3,4' ...

php Object to String

I'm trying to teach myself php... so please be kind and bear with me. I'm trying to follow this tutorial on how to cache files... the page I want to cache is HTML only, so I've modified the php to just deal with data. I know the caching part is working, it's when I try to modify the results that I get a "Catchable fatal error: Object of...

conversion from string yyyyMMdd to type integer is not valid

I have a dataset containing a datatable, and I enumerate all rows in that datatable. When trying to format a column in that row, I run into an exception. (Part of) the code is: For Each dr As DataRow In ds.Tables("records").Rows file = dr("timestamp").ToString("yyyyMMdd") & "~.wav" Next This results in the following error message:...

What is the reverse of (ArrayList).toString for a Java ArrayList?

I am using the toString method of ArrayList to store ArrayList data into a String. My question is, how do I go the other way? Is there an existing method that will parse the data in the String back into an ArrayList? ...

How to return a verbatim string from ConfigurationManager.AppSetting["settingname"].ToString()

I am using the ConfigurationManager.AppSetting["blah"].ToString() method to get the path to the folder that contains the files I'm needing. But I'm throwing an UnsupportedFormatException on the path when it tries to use Directory.GetFiles(path). The returning value has the escape characters included and I'm not sure how to keep it from ...

How to "echo" a class?

This is probably really easy but I can't seem to figure out how to print/echo a class so I can find out some details about it. I know this doesn't work, but this is what I'm trying to do: <?php echo $class; ?> What is the correct way to achieve something like this? ...

window.toString.call is undefined in IE8

When you run: window.toString.call("") everything's fine in FF/CH but in IE8 you get a script error. Investigating a bit more it turned out, that window.toString.call is undefined in IE8? You can also run this one: window.toString instanceof Function; // false alert(window.toString); // function toString() { // [native code] // ...

ToStringBuilder append X appendSuper

Hi all... in my classes when writing the toString() method I always use the ToStringBuilder from org.apache.commons And when I'm extending other classes I use appendSuper() and then my appends The question: Are there are any real differences in doing: appendSuper(super.toString()) instead of append(super.toString()) Kind of dum...

Hashtable how to get string value without toString().

How could I get the string value from a hashtable without calling toString() methode? example: my class: public class myHashT : Hashtable { public myHashT () { } ... public override object this[object key] { get { return base[key].ToString(); <--this doesn't work! } set ...

toString(), equals(), and hashCode() in an interface...

So, I have an interface with a bunch of methods that need to be implemented, the method names are irrelevant. The objects that implement this interface are often put into collections, and also have a special toString() format that I want them to use. So, I thought it would be convenient to put hashCode(), equals(), and toString() into ...

How do I implement toString() in a class that is mapped with Hibernate?

I have an instance of a class that I got from a Hibernate session. That session is long gone. Now, I'm calling toString() and I'm getting the expected LazyInitializationException: could not initialize proxy - no Session since I'm trying to access a reference which Hibernate didn't resolve during loading of the instance (lazy loading). I...

How do you put a subclass method into a superclasses JLabel?

So here's the class and the super class, question to follow: TestDraw: package project3; import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JLabel; public class TestDraw extends MyShape { public static void main(String[] args) { DrawPanel panel = new DrawPanel(); JFrame application = new JF...

how to use the toString() method for multiple enum members in same class in Java

I am trying to add more user friendly descriptions for multiple enum members in the same class. Right now I just have each enum returned in lowercase: public enum Part { ROTOR, DOUBLE_SWITCH, 100_BULB, 75_BULB, SMALL_GAUGE, LARGE_GAUGE, DRIVER; private final String description; Part() { description = toString()....

Problem getting GUID string value in Linq-To-Entity query

Hi, I am trying to write a GUID value to a string in a linq select. The code can be seen below (where c.ID is GUID), but I get the following error: Unable to cast the type 'System.Guid' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types. var media = ( from media in Current...

Java: Getting the properties of a class to construct a string representation

Let's say I have a class like this (and also further assume that all the private variables: public class Item { private String _id = null; private String _name = null; private String _description = null; ... } Now, if I want to build a toString() representation of this class, I would do something like this inside ...

Django CharField To String

Hello All, Hopefully a really simple one, possible even stupid! I'm building a tagging system in Django and would like to allow spaces and other characters in the tag name for display but filter them out and use lower case when matching names etc. To that end I have added a field to my Tag model as so: class Tag(models.Model): n...

Is it possible to disable both debugger visualization and ToString() invocation in all the debugger views of VS2008?

Dear ladies and sirs. My project depends on a 3rd party assembly which defines debugger visualizers for some of its types. Usually this is totally fine, but some types have lazy logic, which becomes eager once the data is observed in the debugger. And when I wish to explore the lazy behavior all this visualizers completely screw it. I ...

Java ArrayList Help!

I am working on learning java a little, and i found this question in a java text book on Google books, I have been working on it for a while, and for some reason these seems like it should be simple. Anyone bored and would like to show me what this is suppose to look like in Java code?? (Using ArrayList) Write a program that creates an ...

Displaying the size of a file in CListCtrl

I am working in Windows MFC application..In my design am displaying the file details (type,name,size) in a CListCtrl control. I found those file details using FileStatus but when I try to display, I am not able to display the file size since its an integer. I tried CListCtrl::SetItemText and I also tried to type cast but its not working....

What does it mean to return the client?

What does it mean to "return the client?" My teacher asked in an assignment to write a method that will return the date and the client. Here is her exact wording: " You should also override the ToString method, to return the date and the client. (DateTime has a reasonable ToString method defined. Use it.) I found using "\t" (the tab s...