strongly-typed

Linq to Entities Filtering an Entity Dynamic/Strongly Typed

I am binding a Winforms Grid to an entity. (For reasons I won't go into here it must be bound to the entity, not the result a query) The code is as follows: grid.DataSource = myEntities.entityName.Where("it.field = " & field) It works, but it obviously isn't strongly typed. Is there a way to define the Where clause of an entity usin...

Is there anything like a generic list in Cocoa / Objective-C?

What I really like in C# are generic lists. A list that can contain only one type of objects. Is there something like a generic list in Cocoa/Objective-C? As far I only know NSArray who will take a pointer to any object. ...

how to query strongly type datatable

Hi, I have a news portal. For this portal I have a database with a "News" table and with the following columns (NewsID, CategoryID, NewsTitle, NewsText, DateAdded, ImagePath, TotalRead, NewsType, isActive) I use dataset files (.xsd) and for this one, I have a query that returns the last 3 days' news into a custom class that I coded, ...

Strongly typed Lua

I am looking for a Lua front-end compiler that is strongly-type, but outputs standard Lua 5.1 byte-code (that has no notion of types at all). What I want is a decent amount of static, compile-time syntactic analysis and optional typing, to detect trivial errors sooner than run-time. The resulting byte-code would have to play nicely wit...

Are there strongly-typed collections in Objective-C?

I'm new to Mac/iPhone programming and Objective-C. In C# and Java we have "generics", collection classes whose members can only be of the type declared. For example, in C# Dictionary<int, MyCustomObject> can only contain keys that are integers and values that are of type MyCustomObject. Does a similar mechanism exist in Objective-C...

ASP.NET MVC - How to create a strongly-typed view from classes in referenced class-library?

Hi, i'm trying to create a strongly-typed view using Visual Studio 2008. I can right-click a controller action and choose: Add view... In the next dialog window there is an option 'Create a strongly-typed view'. If I check this option I can select a list of classes that are in my current project. However I cannot select the class I ne...

Static/strong typing and refactoring

It seems to me that the most invaluable thing about a static/strongly-typed programming language is that it helps refactoring: if/when you change any API, then the compiler will tell you what that change has broken. I can imagine writing code in a runtime/weakly-typed language ... but I can't imagine refactoring without the compiler's h...

MVC. Strongly-typed view difference (MVC sources vs. assembly)

I'm trying to create a strongly typed partial view <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Pt.Data.Services>>" %> <table> <% foreach (Pt.Data.Services item in Model) { Html.RenderPartial("ServiceItem",item); } %> </table> in Controller IEnumerable<...

LINQ To SQL SubSelect Like Query

Hi folks, imagine there are two tables. Order +----------------+ | ID | | Name | +----------------+ OrderStatus +----------------+ | ID | | OrderId | | StatusId | +----------------+ A Order can have more than one OrderStatus, which could be called OrderStatusHistory. I'll have an Strong...

ListBox.DisplayMember = [String] Can I somehow workaround it to be other than string in .NET?

The question is asked with respect to an Object DataSource. So Consider that I have a class public class Customer{ public String name; public int age; public Customer(String name, int age) { this.name = name; this.age = age; } } And I have databound a list box to a list of these objects. So I say ...

Preventing XSS exploits using the type system as Joel suggested?

In Podcast 58 (about 20 minutes in), Jeff complains about the problems of HTML.Encode() and Joel talks about using the type system to have ordinary strings and HTMLStrings: A brief political rant about the evil of view engines that fail to HTML encode by default. The problem with this design choice is that it is not “safe by...

NHibernate + ASP.Net MVC - how to order data in strongly typed manned according to user selected field

I'm presenting data for users in a grid (ExtJS) with remote sorting and paging. Let's say I have a grid with some Orders. Order entity looks like Order{OrderNumber, Customer, Date, Address{Street, City, PostCode}}. Customer is mapped by NH as relation, Address is mapped as component. Data presented in the grid are flattened to columns na...

Arguments for duck-typing in a strongly-typed OOP language?

Is there a case where you wrote something in such a language (e.g. C#, Java), and missed duck typing? (See this question for arguments against duck typing) ...

Strongly-typed ASCX in WebForms 3.5?

I'm looking to get rid of the code-behind for a control in my WebForms 3.5 application. Again bitten by the bug of how it's done in MVC, I'd like to get a step closer to this methodology by doing: <%@ Control Language="C#" Inherits="Core.DataTemplate<Models.NewsArticle>" %> This gives me the parser error you'd expect, so I remembered...

Creating an array that contains only objects of a given class

Ok, so I have the code below (Objective-C FYI) and I was wondering if I want to create an NSMutableArray of c_data objects, how would I go about doing that? It's sort of like declaring a List<c_data> cData in C#. @interface c_data : NSObject { double value; int label; int ID; } @property double value; @property int label...

Is there a good strongly typed way to do PropertyChanged events in C#?

It must be a somewhat common event to change the name of a property and expect the Rename functionality in Visual Studio to take care of all the necessary renaming, except for the property name of the PropertyChanged event of INotifyPropertyChanged. Is there a better way to somehow get it strongly typed so you don't need to remember to ...

Looking for a fast, compact, streamable, multi-language, strongly typed serialization format

I'm currently using JSON (compressed via gzip) in my Java project, in which I need to store a large number of objects (hundreds of millions) on disk. I have one JSON object per line, and disallow linebreaks within the JSON object. This way I can stream the data off disk line-by-line without having to read the entire file at once. It t...

Would javascript and similar scripting languages benefit from being strongly typed?

Just had my mind going today. I spent some time in IE debug mode, browsing the web as usual, and oh boy do I see many errors :) Most of these errors are because some value are of a different type than expected (at least as far as I interpret the error messages). What are the reasons JavaScript and similar scripting languages aren't stro...

Python Strongly type lists.

Hello, I am using eclips for python and i am facing a problem. I have many classes with many properties and want a list of objects from one of my declared classes. The problem is:When i am accessing any item from the list, the IDE does not know it's type because in python we do not declare the variable with it's type, so there is no auto...

Type limitation in loop variables in Java, C and C++

Why Java, C and C++ (maybe other languages also) do not allow more than one type on for-loop variables? For example: for (int i = 0; i < 15; i++) in this case we have a loop variable i, which is the loop counter. But I may want to have another variable which scope is limited to the loop, not to each iteration. For example: for (int ...