Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I've got a list of items, and I wish to configure sub-lists of of these items based on users configurations. I've got this idea for the moment, but I'd like an opinion on it. This will have to run when generating an ASP.NET page, and I'm worried that it'll get slow as more and more predicates are added.

code:
class CustomList{
 List<Predicate<Item>> itemSpecifiers;

 public void AddSpecifierForSomeIntProperty(int n)
 {
  itemSpecifiers.Add(new Predicate<Item>( x => x.PropertyInQuestion == n ));
 }

 public IEnumerable<Item> GetItems()
 {
    List<Item> totalItems = GlobalAccessor.GetTotalItems(); // returns a list of ~2500 *things*

    HashSet<Item> ret = new HashSet<Item>();

    foreach (Predicate<Item> pred in itemSpecifiers)
    {
        foreach (Item item in totalItems.Where(x => pred(x)))
        {
            ret.Add(item);
        }
    }

    return ret;
  }
}

Adbot
ADBOT LOVES YOU

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

EkardNT posted:

code:
public IEnumerable<Item> GetItems()
{
	var totalItems = GlobalAccessor.GetTotalItems();
	return totalItems.Where(item => itemSpecifiers.Any(pred => pred(item)));
}

I had realized the first part of your post more or less immediately after posting. The return line above though is what I was really missing though - I was sure that it was possible to syntax my way out of writing the nested loops. I'm a little impressed that it went all the way down to one line though! Thanks :)

edit:

Here's a followup that I maybe should have considered beforehand. Is it possible now to serialize instances of my CustomList class? At first glance, it doesn't look trivial to serialize predicates that are defined in run-time. But since my predicates are relatively simple, I could probably wrap them in a class that is easily serializable.

eg,
code:
class SelectionPredicate<T>{
  T Comparitor;
  String PropertyToCompare;

  public Predicate<Item>
  {
    // some reflection magic required here
    get{ return new Predicate<Item>( x =>  x.PropertyToCompare.Equals(Comparitor)); }
  }
}
This class would be easy to serialize, but I don't see any way to avoid the reflection magics, and this will likely lead to it being a big hassle to alter the Item class down the road - a big problem. Maybe I should look for another route altogether?

Newf fucked around with this message at 19:46 on Jun 26, 2014

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
Here's a real easy ASP.NET question for everyone. I'm trying to display a list of strings in a ListView, but the examples I'm working from all work from all bind to properties of the bound objects rather than the objects themselves. EG, the //what goes here line is expressed using something like <% #Eval("PropertyX") %>. How do I display the bound object itself (they're just strings!).

code:
<asp:listview ID="Listview1" runat="server" DataSourceID="PortfolioList" 
            EnableModelValidation="True">

        <LayoutTemplate>
          <ol>
            <asp:PlaceHolder runat="server" ID="itemPlaceHolder">
            </asp:PlaceHolder>
          </ol>
        </LayoutTemplate>

        <ItemTemplate>
          <li>
            // what goes here?
          </li>
        </ItemTemplate>
</asp:listview>
edit: <%# Container.DataItem %> goes there.

Newf fucked around with this message at 17:50 on Jun 27, 2014

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
More trouble in ASP land. I think that my goal should be obvious from the code, but I'm having a lot of trouble googling the right answers. I'm working with a ListView, and States is an (incomplete) array of two letter State abbreviations.

code:
<ItemTemplate>

Length is <%# Eval("States.Length") %>

<%

 int length = int.Parse(Eval("States.Length").ToString()); // error
 
 for (int i=0; i<length; i++)
 {
  Response.Write("<li>");
  Response.Write(Eval("States[" + i + "]")); // again?
  Response.Write("</li>");
 }

%>

</ItemTemplate>
The error that gets thrown here is Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. Presumably the same thing would happen if it reached that line in the loop.

Suggestions?

Newf fucked around with this message at 19:13 on Jul 9, 2014

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
It's perhaps not clear, but I am in a databound control (note that the first <%# Eval("States.Length") %> works). The problem is that the control is bound to an object which has a number of arrays as members, including the present States array.

The solution then, I guess, is to bind more specifically to the States array rather than its parent object.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

wwb posted:

You have a few issues in this code. First thing, don't try and convert int to strings and then do int things to them (error #1). Response.Write() is also an abomination that should generally be avoided in ASP.NET webforms as it really screws with the page lifecycle.

In general, with complex data binding, you are better off convervting the Container.DataItem to your custom object and never loving using eval no Response.Write. Something like:

code:
...
Been a really long time since I did webforms so that might not be perfectly kosher but you get the idea.

Holy poo poo, this is great. The whole webforms thing is really still a mindfuck to me. The way that you can mix markup and code is kinda magical. Also, being able change this code on the fly and having it reflected on the next page load. I guess the c# is compiled on the fly when there's a page request?

Thanks all. I did end up binding directly to the States list (and then did the same for the other lists I wanted on the page).

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Ithaqua posted:

Or, better yet, don't use webforms if you don't have to.

To follow up on this... The context here is that I'm making a web front-end that interfaces with a windows service which exposes a bunch of controls exposed via [ServiceContract] class and [OperationContract] methods. I'm using svcutil.exe to generate the client class for the webapp.

I understand that webforms are maybe on the way out, but they do seem like the simplest tool that's adequate for the job. Nothing super fancy will be going on - mostly CRUD interaction and configuring the windows service. Am I wrong about this? Are there reasons that I'd be better off going for an MVC2 app? (VS2010)

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

I cannot help, but you have my sympathy. These are the parts of development that make me want to jump out of a plane.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
What method does HashSet<> use in order to determine whether an element is already a member of the set?

I've got a set of bean objects, but I'd like only one field in the bean to be the 'key' for insertion. Eg, I want to prevent the insertion of new objects into the set if it's key is already contained in the set. I has assumed from the name that it was checking hashes as a unique ID, but the following doesn't work:

code:
public class DataBean
{
  public String Key;
  public String OtherData;

  public override int GetHashCode()
  {
    return Key.GetHashCode();
  }

  public DataBean(String k, String D) { Key = k; OtherData = D }
}

var set = new HashSet<DataBean>();
set.Add(new DataBean("1234", "other data"));
set.Add(new DataBean("1234", "hello world")); // set now contains both objects, but the second Add should have failed

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
That had occurred to me, but wouldn't a dictionary's default action be to overwrite the data associated with an existing key with the new data? (edit: it throws an exception.) I want to keep the original. In particular, the only thing that changes with the new inserts is a timestamp, but I'm only interested in knowing the earliest timestamp.

Semantically, it's a set of these objects, and the 'Key' here is itself data, so I don't like splitting the object into Key / Value.

Newf fucked around with this message at 15:43 on Jul 16, 2014

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Bognar posted:

This is correct. HashSet first checks the hash, then checks for equality using the specified equality comparer (which will most likely be EqualityComparer<T>.Default which uses .Equals()).

But yeah, you should probably be using a Dictionary.

Ah, that clarifies.

Overriding Equals did work (thanks Betjeman!), but I was confused because I knew that Add (and Contains) were supposed to be O(1), so I figured that it had to be checking with GetHashCode(). Makes sense that it's done as a first pass.

Thanks all.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Ithaqua posted:

Can you describe the initial problem in a little bit more detail? I'm always wary of the XY Problem rearing its head.

It's really not a complicated issue, and either implementation works, I think. I've left it as it because the Equals override was only a couple of lines and I'd rather not have to wrap my Adds in Try/Catch blocks.

The initial problem is to keep a list of objects (they're boats, incidentally) who have requested a service. Each boat, after requesting service, will receive a default service until the service is configured (server side) for them by an administrator. I just want to keep a list of boats who have requested service but remain unconfigured. I also want the dates at which they first requested service. So the bean is just a unique identifier for the boat (the key in my problem), the boat's "common name", and the date of the service request. It's possible for a boat to make several service requests before the administrator configures them, but I don't want double/triple/ ect records of that.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

My prejudice towards sets here probably comes from my math background. I do recognize that it's better practice to use a dictionary, specifically for the reason Ithaqua mentioned of constructing lovely hash codes. In this case though, the hash code is just inheriting from String.GetHashCode(), so there's no chance that it's bad...

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I've thrown a bootstrap tarp over a .net webforms app. I used this starter template and things have gone peachy with one little hickup. The markup for the navbar is in my WebApp.master markup file, which is then followed by a ContentPlaceHolder for my pages to go. The problem is that I'm not sure how best to go about altering the nav element that's tagged as 'active' when clicking from one page to the next.

code:
...
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">Project name</a>
        </div>
        <div class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">Home</a></li>  <-- this element stuck as 'active'
            <li><a href="#about">Page1</a></li>
            <li><a href="#contact">Page2a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>

    <div class="container" style="padding-top: 65px;">
      <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" />
    </div>
...
My first thought is to put something in the Page_Load of WebApp.Master.cs that reads Request.Url and then assigns the class="active" decoration to the appropriate element. Doing some poking though, and it doesn't look like code-behind files enjoy working with DOM elements (probably because the html is output after all of the code-behind has run?).


edit: Ok, that worked. I gave each <li> an id and runat="server" and something along the lines of

code:
if (Request.Url.ToString().Contains("Page1"))
  Page1.Attributes["class"] = "active";
works just fine.

Newf fucked around with this message at 19:26 on Jul 17, 2014

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I'd like to know what gets spit out by Path.GetInvalidFileNameChars(). Is there a more reasonable thing for me to do than boot up a new console app and print them to screen? I feel like Visual Studio should have some sort of console that I can type commands like this into.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
That's great! Thanks!

Ctrl+alt+F opens this console in VS 2010 and up, for anyone who's wondering.


My knowledge of F# has now increased from nothing to "it's like C# except you use two semicolons". I'm confident that this is accurate.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
All very useful suggestions. Thanks!

ljw1004 posted:

(1) Launch VS. You have to load a project -- any old project will do.

Not quite, I'm afraid! Apparently:

msdn posted:

You cannot use design time expression evaluation in project types that require starting up an execution environment, including Visual Studio Tools for Office projects, Web projects, Smart Device projects, and SQL projects.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I'll second that. I'm a complete rear end whenever it comes to deciding things like typography and colors, but I'm currently having a good deal of success with a work project that I essentially threw a Bootstrap tarp over the top of.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Bognar posted:

complete lack of syntax support (even through plugins) in Visual Studio for JSX.

.NET devs who want to +1 in the name of progress on this front can do so here: http://webessentials.uservoice.com/forums/140520-general/suggestions/4935998-add-reactjs-jsx-support

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Volte posted:

There is strong reason to believe that Xamarin will be part of Visual Studio in the not too distant future, so there's still hope.

Looking forward to a $1600 VS 2015!

Side note, someone in the oldie thread seems to want to quit his job because they've decided to move to xamarin. If you people like it he may benefit from hearing so.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

gently caress them posted:

The users like a "walk along search", that is, as you type, every lift of your key makes the current string in the searchbox fire a search event. Right now this is done with an incomprehensible mishmash of codebehind, <%eval%> magic, and $get() from the ajaxtoolkit I confused with jQuery for a long time. And their own custom gridview that was opaque and undocumented. And reams of commented out code.

I'm currently enjoying great success with this sort of thing via selectize. I'm using it as a configuration tool, and it was really easy to attach ajax events to the menu so that it updates my model on the fly. The below attaches to a <select id="AvailablePortfolios"> element that gets populated server-side by an ASP:ListView, and makes a real nice, user-friendly menu for selecting the different portfolios.


JavaScript code:
$('#AvailablePortfolios').selectize({
        onItemAdd: function(value, $item){
            
            $.ajax(
            {
                type: "POST",
                url: "Vessel.aspx/VesselAddPortfolio",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify({ vessel: $('.haspID').text(), portfolio: value })
            });
        },
        onItemRemove: function(value){
            
            $.ajax(
            {
                type: "POST",
                url: "Vessel.aspx/VesselRemovePortfolio",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify({ vessel: $('.haspID').text(), portfolio: value })
            });

        }
    });

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
For that level of responsiveness I think client-side solutions are worth checking out. tinysort is a pretty rad js library for sorting dom elements via custom search functions (which can be attached to the keyup event of your favorite search box). Bottom of the page there has it working with a table.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
Is there a way to instantiate automatic properties without having to put it in the constructor itself? Or is ClassC (no automatic properties) the most graceful answer?

C# code:
class ClassA
{
 public SomeDataClass data = new SomeDataClass();
 public ClassA(){} // data is not null
}

class ClassB
{
 public SomeDataClass data { get; set; }
 public ClassB(){} // data is null
}

class ClassC
{
 private SomeDataClass _data = new SomeDataClass();
 public SomeDataClass data { get{return _data;} set{_data = value;} }
 public ClassC(){} // data is not null
}

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
More of my low priority idle wishes need to come true like this.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I've got a class with some static and some non-static methods, and I'd like to lazily check the existence of system setup / default configurations whenever the class is referenced. Is the following a bad idea for any reason?

C# code:
Class Foo
{
 private static bool initialized = InitClass();
 private static bool InitClass()
 {
  // check that necessary directory structure is in place
  // check that a 'default' foo is in place
  return true;
 }
}
I figure that InitClass() will now be called only when the class is first referenced at runtime for any given run of the program, and will run before any static method or constructor since the class needs to initialize all of its static variables before running any of its meat code.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

gariig posted:

InitClass will be called at startup because the runtime wants to create the variable initialized. It sounds like you want Lazy<T>. Without a better sample it's hard to say if this is good or bad. I'd lean toward not doing it because it's hard to mock out or hide static anything during a unit test.

Lazy<T> would be the way to go except that the project is 3.5. I've run this code though, and it didn't run at startup - the class itself isn't static, so that's probably the difference.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
A visual studio question. I'm used to being able to edit code in c++ projects while the program is running in a debugger, and when I'm at a suitable point I ctrl-alt-break to pause, and F5 to spark an edit-and-continue rebuild. In .NET, I haven't been able to figure out how to do this. Open source files for running projects are decorated with a little lock icon, and attempts to edit them are met with

Edit and Continue posted:

Changes are not allowed while code is running or if the option 'Break all processes when one process breaks' is disabled. The option can be enabled in Tools, Options, Debugging.

[OK]

Any way to get around this?

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
It's VS 2010, but I'm debugging in x86 and I'm able to edit and continue if I break the running process - it just won't let me do any typing (editing) while the process is running.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Malcolm XML posted:

This would break source mapping if you e.g. deleted a method with a breakpoint in it.

I get that, and I get it as a reason to disallow it, but when doing it in C++ my breakpoints just change from solid red dots to little hollow dots and life goes on until the next build.


One totally queer thing that I've just found is that if I edit a file OUTSIDE of VS, it asks if I'd like it reloaded, and then the 'locks' disappear from every file other than the one that I edited / reloaded. I'm then able to edit all of these in the way I wanted, complete with the edit and continue specific compiler warnings (can't alter types, etc).

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Wait - do solved cases count as negative?

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
If someone calls SomeClass SomeClassInstance = SomeClass.Load(key); with an invalid key, should the method return null or throw an exception or log some swear words or what? As far as I can tell I could go either route without much headache but I'm sure that this is something that has lots of established best practices.

fake edit: Please, look inside your mercy file... File Not Found.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

GrumpyDoctor posted:

With that little contextual information, I think the only advice anyone can reasonably give you is "All of those options are fine, as long as whatever you do is consistent with the rest of your codebase."

Logging swear words it is, then.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I've just come across something I don't understand.

C# code:
// Settings.Default.Properties is a System.Configuration.SettingsPropertyCollection

foreach(var setting in Settings.Default.Properties)
{
  // setting is an 'object'
}

foreach(System.Configuration.SettingsProperty setting in Settings.Default.Properties)
{
  // setting is a SettingsProperty
}
To the best of my knowledge, the compiler / visual studio should always know the correct type of variables declared with var. Eg, Intellisense knows anywhere in a file file that var variable = "asdf"; is a string.

What gives?

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

zokie posted:

It has to be the fully qualified type names or missing usings. Does it work with just foreach(SettingsProperty p in ...)?

If I stick in the using System.Configuration; then I can use foreach(SettingsProperty p ...), but still not var.


Ithaqua posted:

You'll see that kind of thing a lot with pre-generic collections. It implements IEnumerable, not IEnumerable<T>. Even if all of the stuff in the collection is of the same type, the compiler has no way to know that. Just put a .Cast<Type>() in there.

DataTable has the same problem. Even though its Rows are DataRows, the Rows property is a non-generic collection.

Ahh, this makes sense. But my confusion has shifted to why I'm able to declare the inner variable type at all - having just tried, I'm able to compile and run

C# code:
foreach(SomeOtherClass setting in Settings.Default.Properties)
{
  // setting is an 'object'
}
only to produce a runtime error (unable to cast object of type X to type Y) on the loop when it's discovered that the setting isn't actually a SomeOtherClass.

Isn't the whole point of strong static typed languages to avoid this sort of problem? Is this an edge case wart that was a side effect of the introduction of generics which we're happy enough to suffer? (Or an edge case that appeared after the introduction of both generics and the var keyword?)

Newf fucked around with this message at 16:36 on Sep 18, 2014

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

GrumpyDoctor posted:

This is the problem that generics solved, but the collection you're iterating over doesn't have a generic interface, which is why var's type inference isn't working.

I get that, but I don't get why I'm able to declare the type of a variable when the compiler doesn't know it ahead of time. It feels like a stricter version would force me to expect only objects from an IEnumerable and then cast them myself - at least in this case the cast becomes explicit. Had I gone with foreach(SettingsProperty ... instead of var in the first place I would never have noticed that any cast was taking place - that's bad, isn't it?

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

GrumpyDoctor posted:

http://stackoverflow.com/questions/3917129/foreachderived-obj-in-new-listbase is your exact question with the answer (tldr it's a special thing that foreach does for historial reasons)


ljw1004 posted:

Basically the C#/VB languages consider foreach loops to be explicit casts.

The relevant part of the C# spec is $8.4.4


The key bit is "(V)(T)e.Current".

Thanks both, and all. I think at least that the quality of my confusions is rising.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Silvah posted:

Does EF work properly with interfaces? So instead of using the abstract BaseClass, you could just compose your derived classes by implementing various interfaces, then maybe use some master interface from the context to add the query conditions?


EssOEss posted:

I tried using a subclassing structure for modeling my database once and I will never try it again. This is just one of the headaches you will encounter. My recommendation is to not try to make any fancy entity model - just treat your entity classes as database rows and you'll have a happy life.

This sounds more or less exactly like what I'm currently attempting to do. I'm working on a math-tutoring app that's got a pile of different question classes which have a shared inheritance structure blah blah. It's code-first with the current MVC5 / EF6 / VS2013. Haven't run into any problems yet but I'm always nervous that I might sneeze in the wrong direction and then my program will never compile again.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
Here's a question to slot into inheritance/EF chat.

I've been working on something with MVC but I'm starting to doubt whether it's the tool for the job. The short of it is that I've got some slowly growing (as the system matures) number of hand-made classes each of which have ~100 instances stored in the DB. Each class also has associated with it at least one but potentially any number of views. My first look tells me that it's going to be a pain to store the views themselves in the DB, since the framework wants to be loading them from Views/ClassName/ActionName (or whatever, but it wants to be loading physical .cshtml files).

In practice, I expect classes to be static, but the views (including the number of them assigned to each class) will be in flux in a partially automated, partially user driver way. Moreover, the system itself needs to be 'aware' of the coming and going of the views. This is why I prefer to have them persisted as DB objects rather than as physical files.

Does anyone have experience with VirtualPathProvider to do this sort of thing? And on a related note, how inconvenient would it become to be editing razor views in VS in order to then persist them to the DB? Probably just a matter of setting up an alternate project to store all of that?

This is total greenfield and it's my first time looking at MVC, so it's possible that I'm missing a better route to take with MVC, and it's also possible for me to ditch and move to another framework if something is a more natural fit with my intention.

Would appreciate any feedback.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Ithaqua posted:

It sounds like you're doing something really, really fishy. I think we may have an XY problem. What's the goal of the system that's requiring hundreds of views?

The views are alternative representations of math problems.

EG, your basic multiplication problem can be put to people several obvious ways:

quote:

4x5=__

quote:

How many dots are there?

....
....
....
....
....

quote:

There are 4 cookies in each box. [picture of five boxes]. How many cookies are there?

The idea is to feed this to children, "do big data stuff" to gain information about the relative merits of different question/view schemes, feed a better refined diet of it to children, and so on.


edit: It's not necessarily the case that '100s of views' are required for a particular question at a particular time, but the idea is to be running generalized A/B/C... testing against the existing stockpile in order to find the most useful ones and toss the least useful.

Newf fucked around with this message at 23:04 on Sep 25, 2014

Adbot
ADBOT LOVES YOU

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

EssOEss posted:

I recommend a change of viewpoint. What you are calling views here are not actually views - they are different ways to model some entities. Views are a purely UI layer thing. Think of the different representations as parts of the model and orient your views around showing these different representations.

I think I understand your meaning here, but the point of having a single model displayed via different views is to help students discern the equivalence for themselves. A numerate person will instantly and thoughtlessly use multiplication in order to count the square tiles on a floor, but a young kid won't necessarily do that without first giving it some thought. The idea is to give them the experience to internalize the equivalence for themselves, rather than 'telling' them about it, and a way to measure for it is to measure their relative performance with "different views" of the same "model". It simplifies some of the logistics if there's a hard-wired relationship between these different views. Still considering options here though - more plumbing work is ongoing.

ljw1004 posted:

(1) Don't do any more coding until you've met with your data-scientist and he's done the first run through of data.

(2) Store your test in a Dictionary<string,string>. This will make it really easy to store and manipulate. Strong typing doesn't actually buy you anything in terms of bug-finding. Unit-tests on the data-analysis will do all that for you.

(3) Hand code your viewmodel and/or view for each different question type. You might use inheritance for your views, but it's not needed for your data or viewmodels.

(4) Remember localization!

1) This is a one-man show I'm afraid. On the plus side, it keeps me from designing a CMS / ViewModel that's incompatible with what the data-scientist wants the data to look like! I'm not actually learned in anything like 'data-science' (honestly I'm not even sure what that refers to) but I've done a bit of evolutionary programming and I've got a ton of experience working with low-numeracy students and I have a scheme in mind that I think can work. The short of it is that it's an evolutionary scheme where a bunch of software objects have 'opinions' on how different skills are related to one another, and are continually gambling on the performance of the users. The objects with better opinions about the relationships between skills will be better able to predict student performance, and be selected for. (They all have access to the students' prior performance records). I built a version of this scheme for arbitrary binary data for a course a year or so ago and it was extremely successful (if a little slow) at learning the relationships between the individual bits of a stream of bitstrings I threw at it :)

2-3) That's something to think about. I'm going to plow forward for the moment because I'm nearing the point of actually loosing my data scheme against the existing model, at which point I guess I'll step back and try to figure out whether the model will work (well) going forward.

4) You mean cultural / language wise? My intended audience for this is a few dozen kids who are part of an after-school program around the corner. I think that internationalization is maybe a ways off :)


Your app sounds neat. Thanks for all of the feedback everyone.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply