« first day (1695 days earlier)      last day (1805 days later) » 

Ben
12:45 AM
Anyone know any programming?
 
@Ben Sup.
 
Ben
Brace yourself for this.
I have a List<Datatable(string, string)> simple enough
 
Okay.
 
Ben
The idea is that string 1 is the "header", and string b is the "value".
What I want to do is create a table. For each item in List, create a duo of columns - "Label #" and "Value #", where # is the index of the item in the List.
 
So...you want a 1-row table with twice as many columns as there are items in the list?
 
Ben
12:50 AM
What I've got, is an immediate [redacted] of a nested foreach with immediate breaks to try and deal with each string, string pair
Admittedly, this was adapted from a previous program that created the Column header from string a, and inserted string b into the appropriate row/column. That worked fine
 
for(int i = 0; i < list.size(); i++) {
    columns.add(list.get(i).first);
    columns.add(list.get(i).second);
}
Something like that? ^
Well, I saw a few seconds of it, lol
 
Ben
What's the formatting?
Also - C# if that makes any difference.
@Miniman 2 columns per list item, 1 row per if string a = 'name'
 
@Ben Copy the code as it appears in your text editor, then hit the "fixed font" button that appears next to the Send + Upload buttons.
	const roll_ptr dice::MARIO = std::make_shared<custom_die>("SMP Mario", std::vector<die_face>{ 1,3,3,3,5,6 });
	const roll_ptr dice::LUIGI = std::make_shared<custom_die>("SMP Luigi", std::vector<die_face>{ 1,1,1,5,6,7 });
	const roll_ptr dice::PEACH = std::make_shared<custom_die>("SMP Peach", std::vector<die_face>{ 0,2,4,4,4,6 });
	const roll_ptr dice::DAISY = std::make_shared<custom_die>("SMP Daisy", std::vector<die_face>{ 3,3,3,3,4,4 });
	const roll_ptr dice::ROSALINA = std::make_shared<custom_die>("SMP Rosalina", std::vector<die_face>{die_face(0,2),die_face(0,2),die_face(2),die_face(3),d
 
Ben
DataTable AddToTable(List<Dictionary<string, string>> recordList)
{
DataTable table = new DataTable();
DataColumn keyColumn;
DataColumn valColumn;
DataRow row;

foreach (var record in recordList)
{
row = table.NewRow();
foreach (var item in record)
{
if (recordList.IndexOf(record) == 0)
{
row = table.NewRow();
// Add "Filename" column
keyColumn = new DataColumn();
keyColumn.ColumnName = item.Key.ToString();
keyColumn.DefaultValue = "";
table.Columns.Add(keyColumn);

// Add label to row
row[item.Key.ToString()] = item.Value.ToString();
Dang it. Lol
You get it though
 
1:06 AM
Yeah.
 
Ben
It's a mess. I will admit that
 
So what are you trying to fix in the code?
Or change?
 
Ben
Well currently what that does is generate 800 columns, and no rows. Lol
 
And what's it supposed to do?
 
Ben
I'm expecting maybe 10 columns, and 400 rows
That

foreach (record in List)
{
    foreach (item in record)
    {
        //do stuff
        break;
    }
}
 
1:10 AM
So the records are supposed to each have their own row, and each item in the record is a column in that row?
 
Ben
That bit is nasty
 
Well, you can't escape it. The algorithmic complexity is O(n^2), any tricks you employ to avoid that is just going to make your code harder to debug.
But....
 
Ben
the list looks a bit like this:

Filename, "name.ext"
Fruit, Apple
Filename, "name2.ext"
Fruit, Orange
Animal, Dog

etc...
so each time it hits that "filename", it creates a new row
 
So in that example, some rows have some columns that are blank?
Like "name.ext" doesn't have an animal listed.
 
Ben
@Xirema Potentially, yeah.
And the idea is that when it adds a new list entry to that row, it will create the appropriate "Label #, Value #" columns for it
@xirema potentially might be worthwhile moving this to TBR?
 
1:16 AM
Yeah.
 
Ben
@BESW or other mods please feel free to move all this junk to TBR :)
 
44 messages moved from RPG General Chat
 
 
14 hours later…
3:01 PM
hi. Just letting you know that after the cheese, now there is a new contest going.
@nitsua60 don't know if you want to try your luck with this one too.
It is about time this time.
 
3:31 PM
@Derpy Thanks--I'll take a look!
 
@nitsua60 I am attempting an "Advent Calendar".
2
A: Time for some more swag!

SPArchaeologistWell, considering the current season and that the theme is the passing of time, I think an Advent Calendar is most appropriate here. Run the attached snippet to see it. var today = new Date(); $(".dialog").dialog({ autoOpen : false, modal : true, show : "blind", hide : "blind" ...

I hope I can think of enough lame puns to last untill Dec 25th.
 

« first day (1695 days earlier)      last day (1805 days later) »