I m populating data for different entities into set of lists using generic lists as follows :
List<Foo> foos ..
List<Bar> bars ..
I need to write these lists to a file, i do have a util method to get the values of properties etc. using reflection.
What i want to do is: using a single method to write these into files such as:
void w...
Hi,
I have a txt file which contains data in the following format:
X1 Y1
X2 Y2
etc..
I want to read the data from this file and create two lists in ruby (X containing X1, X2 and Y containing Y1, Y2). How can I do this in Ruby?
Thanks.
...
I've been banging my head against a brick wall over this little problem since thursday and I'm still no nearer to an answer than I was back then.
I have a user control which has a property like this:
/// <summary>
/// Gets or sets the media types.
/// </summary>
/// <value>The media types.</value>
public List<MediaType> MediaTypesFilte...
Hi guys
I'm looking for an equivalent in python of dictionary.get(key, default) for lists. Is there any one liner idiom to get the nth element of a list or a default value if not available?
For example, given a list myList I would like to get myList[0], or 5 if myList is an empty list
Thanks!
...
The problem
I've been struggling with this partiular problem for two days now and just run out of ideas. A little... background: we have a WinForms app that needs to access a database, construct a list of related in-memory objects from that data, and then display on a DataGridView. Important point is that we first populate an app-wide c...
I am trying to create a list of a certain type.
I want to use the List notation but all I know is a "System.Type"
The type a have is variable. How can I create a list of a variable type?
I want something similar to this code.
public IList createListOfMyType(Type myType)
{
return new List<myType>();
}
...
How can i have a tuple that has a list as a value.
F.x. if i want to have a structure like this.
( Somechar , Somelist[] )
And how would i iterate through a dictionary of these things?
...
I have 2 lists: one of type A and one of type Aa. type Aa is inherited from type A.
So:
List<A> listA = new List<A>();
List<Aa> listAa = new List<Aa>();
with
class Aa : A
I have:
public property Lists<A>
{
get
{
List<A> newList = new List<A>();
//return concat of both lists
foreach(List l in listA)
{
ne...
I haven’t been able to find a good solution for this problem on the net (probably because switch, position, list and Python are all such overloaded words).
It’s rather simple – I have this list:
['title', 'email', 'password2', 'password1', 'first_name', 'last_name', 'next', 'newsletter']
I’d like to switch position of 'password2' and...
I was looking at the following code in python:
for ob in [ob for ob in context.scene.objects if ob.is_visible()]:
pass
Obviously, it's a for each loop, saying for each object in foo array. However, I'm having a bit of trouble reading the array. If it just had:
[for ob in context.scene.objects if ob.is_visible()]
that would ma...
Hi all,
I'd like to be able to open a binary file, and make a list (kind of array) with all the chars in, like : "\x21\x23\x22\x21\x22\x31" to ["\x21","\x23","\x22","\x21","\x22","\x31"]
What would be the best solution to convert it ?
Thanks !
...
I have a text file that I am reading each line of using sr.readline()
As I read that line, I want to search for it in a List that the line should have been added to previously, then add the line to a NEW (different) list. How do I do this?
...
I'm not even sure how I should phrase this question. I'm passing some CustomStruct objects as parameters to a class method, and storing them in a List. What I'm wondering is if it's possible and more efficient to add multiple references to a particular instance of a CustomStruct if a equivalent instance it found.
This is a dummy/exampl...
On my web site, there is an index page, but if I take out that index page, users will see the files in that directory, for instance my site is : XYZ.com and I have a directory called "My_Dir", so when a user typed in "XYZ.com/My_Dir" he will see the index.html if there is one, but if it's not there, he will see a list of all my files ins...
Hi,
I have a certain check to be done and if the check satisfies, I want the result to be printed. Below is the code:
import string
import codecs
import sys
y=sys.argv[1]
list_1=[]
f=1.0
x=0.05
write_in = open ("new_file.txt", "w")
write_in_1 = open ("new_file_1.txt", "w")
ligand_file=open( y, "r" ) #Open the receptor.txt file
ligand_l...
Hi,
in my Django 1.1.1 application I've got a function in the view that returns to his template a range of numbers and a list of lists of items, for example:
...
data=[[item1 , item2, item3], [item4, item5, item6], [item7, item8, item9]]
return render_to_response('page.html', {'data':data, 'cycle':range(0,len(data)-1])
Inside the...
Hi,
Is it possible to automatically create Word documents which include list fields from a custom SharePoint list?
here is the scenario:
- custom list (over 100 columns)
- Word templates (not sure where is best to store them yet)
- Entry Form will provide data for the templates (or partial data, ie Client name, Sales Rep)
- a form tha...
Hi I'm using grails navigation plugin and when it generates menus it put the sub navigation underneath the main menu, but i'm making my menu a vertical menu so i don't want the sub menu under the whole menu i want it under the active element.
Example: this is how it generate the menu and sub menu
<ul class="mainmenu">
<li>item1</li>...
Hi,
Is it possible to automatically create Word documents which include list fields from a custom SharePoint list?
here is the scenario: - custom list (over 100 columns) - Word templates (not sure where is best to store them yet) - Entry Form will provide data for the templates (or partial data, ie Client name, Sales Rep) - a form that...
I have a list of objects. Each object has an integer quantity and a DateTime variable which contains a month and year value. I'd like to traverse the list and pad the list by adding missing months (with quantity 0) so that all consecutive months are represented in the list. What would be the best way to accomplish this?
Example:
Origina...