Search Results

Search found 2380 results on 96 pages for 'strongly typed'.

Page 10/96 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Hybrid EAV/CR model via WCF (and statically-typed language)?

    - by Pat
    Background I'm working on the architecture for a cloud-based LOB application, using Silverlight for the client, WCF, ASP.NET/C# for server and SQL Server for storage. The data model requires some flexibility per user (ability to add custom properties and define validation rules for them, for example), and a hybrid EAV/CR persistence model on the server side will suit nicely. Problem I need an efficient and maintainable technology and approach to handle the transformation from the persisted EAV model to/from WCF (and similarly allow the client to bind to the resulting data - DataGrid is a key UI element)? Admission: I don't yet know enough about WCF to understand if it supports ExpandoObject directly, but I suspect it will. Options I started off looking at WCF RIA services, but quickly discovered they're heavily dependent upon both static type data and compile-time code generation. Neither of these appeal. The options I'm considering include: Using WCF RIA services and pass the data over the network directly in EAV form (i.e. Dictionary), and handle the binding issue purely on the client side (like this) Using a dynamic language (probably IronPython) to handle both ends of the communication, with plumbing to generate the necessary CLR type data on the client to allow binding, and transform to/from EAV form on the server (spam preventer stopped me from posting a URL here, I'll try it in a comment). Dynamic LINQ (CreateClass() and friends), although I'm way out of my depth there and don't know what the limitations on that approach might be yet. I'm interested in comments on these approaches as well as alternative approaches that might solve the problem. Other Notes The Silverlight client will not be the only consumer of the service, making me slightly uncomfortable with option #1 above. While the data model is flexible, it's not expected to be modified heavily. For argument's sake, we could assume that we might have 25 distinct data models active at a given time, with something like 10-20 unique data fields/rules each. Modifications to the data model will happen infrequently (typically when a new user is initially configured).

    Read the article

  • Does the 'dynamic' keyword and the DLR promote C# to a first class citizen as a dynamically typed la

    - by Quigrim
    I understand that the new ‘dynamic’ keyword in C# 4.0 facilitates interaction with dynamic .NET languages, and can help to cut code by using it instead of reflection. So usage is for very specific situations. However, what I would like to know is if it will give C# all the dynamic benefits that one would get in other dynamic languages such is the IronXXX languages? In other words, will it be possible to write a entire application in C# in a dynamic language style? And if it is possible, would it be recommended or not. And why, or why not respectively? Will I get all the benefits of a dynamic language without switching to another language?

    Read the article

  • Must a Language that Implements Monads be Statically Typed?

    - by Morgan Cheng
    I am learning functional programming style. From this link http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads/, Brian Beckman gave a brilliant introduction about Monad. He mentioned that Monad is about composition of functions so as to address complexity. A Monad includes a unit function that transfers type T to an amplified type M(T); and a Bind function that, given function from T to M(U), transforms type M(T) to another type M(U). (U can be T, but is not necessarily). In my understanding, the language implementing monad should be type-checked statically. Otherwise, type errors cannot be found during compilation and "Complexity" is not controlled. Is my understanding correct?

    Read the article

  • Is there an Emacs-analog for the VI '.' command to repeat-last-typed-text

    - by Don
    I've used emacs for decades and always wondered, but kept on coding, if there was a way to type in something, them move the cursor and insert the same text, like the VI . command. Instead what I do is to type the text, set the mark, backup, copy the region, go to the next spot (often just C-n, down one line) and then pre-arg yank, C-u C-y. It's the overhead of set mark, backup and copy region that makes me just go ahead and retype the thing.

    Read the article

  • Making "helper" text in a form be a different color then typed text.

    - by aslum
    <input name="phone" type="text" id="phone" value="Phone #" onfocus="value=''"> I've got two problems here. The main one is I would like the helper text (in this case "Phone Number") to be a different color then the inputted text from the user, to make it easier for the user to differentiate between filled and unfilled fields. The second is that with this methodology (onfocus="value''") if you mistype something in a field and come back to it you have to retype the whole thing which isn't really acceptable.

    Read the article

  • Is there a term for this concept, and does it exist in a static-typed language?

    - by Strilanc
    Recently I started noticing a repetition in some of my code. Of course, once you notice a repetition, it becomes grating. Which is why I'm asking this question. The idea is this: sometimes you write different versions of the same class: a raw version, a locked version, a read-only facade version, etc. These are common things to do to a class, but the translations are highly mechanical. Surround all the methods with lock acquires/releases, etc. In a dynamic language, you could write a function which did this to an instance of a class (eg. iterate over all the functions, replacing them with a version which acquires/releases a lock.). I think a good term for what I mean is 'reflected class'. You create a transformation which takes a class, and returns a modified-in-a-desired-way class. Synchronization is the easiest case, but there are others: make a class immutable [wrap methods so they clone, mutate the clone, and include it in the result], make a class readonly [assuming you can identify mutating methods], make a class appear to work with type A instead of type B, etc. The important part is that, in theory, these transformations make sense at compile-time. Even though an ActorModel<T> has methods which change depending on T, they depend on T in a specific way knowable at compile-time (ActorModel<T> methods would return a future of the original result type). I'm just wondering if this has been implemented in a language, and what it's called.

    Read the article

  • Is there a better way to declare an empty, typed matrix in MATLAB?

    - by Arthur Ward
    Is there a way to "declare" a variable with a particular user-defined type in MATLAB? zeros() only works for built-in numeric types. The only solution I've come up with involves using repmat() to duplicate a dummy object zero times: arr = repmat(myClass(), [1 0]) Without declaring variables this way, any code which does "arr(end+1) = myClass()" has to include a special case for the default empty matrix which is of type double. Have I missed something a little more sensible?

    Read the article

  • How to take a collection of bytes and pull typed values out of it?

    - by Pat
    Say I have a collection of bytes var bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; and I want to pull out a defined value from the bytes as a managed type, e.g. a ushort. What is a simple way to define what types reside at what location in the collection and pull out those values? One (ugly) way is to use System.BitConverter and a Queue or byte[] with an index and simply iterate through, e.g.: int index = 0; ushort first = System.BitConverter.ToUint16(bytes, index); index += 2; // size of a ushort int second = System.BitConverter.ToInt32(bytes, index); index += 4; ... This method gets very, very tedious when you deal with a lot of these structures! I know that there is the System.Runtime.InteropServices.StructLayoutAttribute which allows me to define the locations of types inside a struct or class, but there doesn't seem to be a way to import the collection of bytes into that struct. If I could somehow overlay the struct on the collection of bytes and pull out the values, that would be ideal. E.g. Foo foo = (Foo)bytes; // doesn't work because I'd need to implement the implicit operator ushort first = foo.first; int second = foo.second; ... [StructLayout(LayoutKind.Explicit, Size=FOO_SIZE)] public struct Foo { [FieldOffset(0)] public ushort first; [FieldOffset(2)] public int second; } Any thoughts on how to achieve this?

    Read the article

  • Can I have fixed typed ArrayList in C#, just like C++?

    - by Kazoom
    I have an ArrayList which contains fixed type of objects. However everytime I need to extract an object a particular index, I need to typecast it to my user defined type from object type. Is there a way in C# to declare ArrayList of fixed types just like Java and C++, or is there a work around to avoid the typecasting everytime? Edit: I apologize I forgot mentioning that I require the datastructure to be thread-safe, which List is not. Otherwise I would have just used a normal Array. But I want to save myself from the effort of explicitly locking and unlocking while writing the array. So I thought of using ArrayList, synchronize it, but it requires typecasting every time.

    Read the article

  • How to write function where argument is type but not typed value?

    - by ssp
    I want to convert a string representations of few dozen enum types to enum values. It's easy to convert string to concrete type: Enum.Parse(typeof<FontStyle>,"Bold") |> unbox<FontStyle> but for now i want to write function where type and string are parameters. The best one i can write is: > let s2e (_: 'a) s = Enum.Parse(typeof<'a>,s) |> unbox<'a>;; val s2e : 'a -> string -> 'a > s2e FontStyle.Regular "Bold";; val it : FontStyle = Bold Is there any option to write something like this but with type itself as first argument?

    Read the article

  • How to get from JRuby a correctly typed ruby implementation of a Java interface?

    - by Guss
    I'm trying to use JRuby (through the JSR233 interface included in JRuby 1.5) from a Java application to load a ruby implementation of a Java interface. My sample implementation looks like this: Interface: package some.package; import java.util.List; public interface ScriptDemoIf { int fibonacci(int d); List<String> filterLength(List<String> source, int maxlen); } Ruby Implementation: require 'java' include Java class ScriptDemo java_implements some.package.ScriptDemoIf java_signature 'int fibonacci(int d)' def fibonacci(d) d < 2 ? d : fibonacci(d-1) + fibonacci(d-2) end java_signature 'List<String> filterLength(List<String> source, int maxlen)' def filterLength(source, maxlen) source.find_all { |str| str.length <= maxlen } end end Class loader: public ScriptDemoIf load(String filename) throws ScriptException { ScriptEngine engine = new ScriptEngineManager().getEngineByName("jruby"); FileReader script = new FileReader(filename); try { engine.eval(new FileReader(script)); } catch (FileNotFoundException e) { throw new ScriptException("Failed to load " + filename); } return (ScriptDemoIf) m_engine.eval("ScriptDemo.new"); } (Obviously the loader is a bit more generic in real life - it doesn't assume that the implementation class name is "ScriptDemo" - this is just for simplicity). Problem - I get a class cast exception in the last line of the loader - the engine.eval() return a RubyObject type which doesn't cast down nicely to my interface. From stuff I read all over the web I was under the impression that the whole point of use java_implements in the Ruby section was for the interface implementations to be compiled in properly. What am I doing wrong?

    Read the article

  • Using Rails, how can I set my primary key to not be an integer-typed column?

    - by Rudd Zwolinski
    I'm using Rails migrations to manage a database schema, and I'm creating a simple table where I'd like to use a non-integer value as the primary key (in particular, a string). To abstract away from my problem, let's say there's a table employees where employees are identified by an alphanumeric string, e.g. "134SNW". I've tried creating the table in a migration like this: create_table :employees, {:primary_key => :emp_id} do |t| t.string :emp_id t.string :first_name t.string :last_name end What this gives me is what seems like it completely ignored the line t.string :emp_id and went ahead and made it an integer column. Is there some other way to have rails generate the PRIMARY_KEY constraint (I'm using PostgreSQL) for me, without having to write the SQL in an execute call? NOTE: I know it's not best to use string columns as primary keys, so please no answers just saying to add an integer primary key. I may add one anyway, but this question is still valid.

    Read the article

  • Stringly typed values table in sql, is there a better way to do this? (we're using MSSQL)

    - by Jason Hernandez
    We have have a table layout with property names in one table, and values in a second table, and items in a third. (Yes, we're re-implementing tables in SQL.) We join all three to get a value of a property for a specific item. Unfortunately the values can have multiple data types double, varchar, bit, etc. Currently the consensus is to stringly type all the values and store the type name in the column next to the value. tblValues DataTypeName nvarchar Is there a better, cleaner way to do this?

    Read the article

  • What is the supposed productivity gain of dynamic typing?

    - by hstoerr
    I often heard the claim that dynamically typed languages are more productive than statically typed languages. What are the reasons for this claim? Isn't it just tooling with modern concepts like convention over configuration, the use of functional programming, advanced programming models and use of consistent abstractions? Admittedly there is less clutter because the (for instance in Java) often redundant type declarations are not needed, but you can also omit most type declarations in statically typed languages that usw type inference, without loosing the other advantages of static typing. And all of this is available for modern statically typed languages like Scala as well. So: what is there to say for productivity with dynamic typing that really is an advantage of the type model itself?

    Read the article

  • Are dynamic languages at disadvantage for agile development?

    - by Gerenuk
    From what I've read agile development often involves refactoring or reverse engineering code into diagrams. Of course there is much more than that, but if we consider the practices that rely on these two methods, are dynamically typed languages at disadvantage? It seem static typing would make refactoring and reverse engineering much easier? Refactoring or (automated) reverse engineering is hard if not impossible in dynamically typed languages? What does real world projects tell about usage of dynamically typed languages for agile methodology?

    Read the article

  • How to pass Model from a view to a partial view?

    - by chobo2
    Hi I have a view that is not strongly typed. However I have in this view a partial view that is strongly typed. How do I do I pass the model to this strongly typed view? I tried something like public ActionResult Test() { MyData = new Data(); MyData.One = 1; return View("Test",MyData) } In my TestView <% Html.RenderPartial("PartialView",Model); %> This give me a stackoverflow exception. So I am not sure how to pass it on. Of course I don't want to make the test view strongly typed if possible as what happens if I had like 10 strongly typed partial views in that view I would need like some sort of wrapper.

    Read the article

  • Group method parameter or individual parameter?

    - by Nassign
    I would like to ask on method parameters design consideration. I am usually deciding between using individual variables as parameters versus grouping them to a class or dictionary as one parameter. Is there such a rule when you should use individual parameter against using a class or a dictionary to group the parameter? Individual parameter - Straight forward, strongly typed Dictionary parameter - Very extensible, like HTTP request but cannot be strongly typed. Class parameter - Extensible by adding member to the class parameter, strongly typed. I am looking for a design reference on when to use which? Note: I am not sure if this question is valid in programmers but I definitely think it would be closed in stackoverflow, If it is still not valid, please point me to the proper page.

    Read the article

  • Two Java Update Releases

    - by Tori Wieldt
    Oracle has released two updates of Java, and strongly recommends that all users update. Java SE 7 Update 9 This releases address security concerns. Oracle strongly recommends that all Java SE 7 users upgrade to this release. JavaFX 2.2.3 is now bundled with the JDK on Windows, Mac and Linux x86/x64. Download Release Notes Java SE 6 Update 37 This releases address security concerns. Oracle strongly recommends that all Java SE 6 users upgrade to this release. Download Release Notes

    Read the article

  • typeahead.js remote with subset matching

    - by rebelde
    Instead of returning to the server after each additional letter is typed, I want it to only go to the server once, get all matching words, and filter the downloaded data after that. We are having trouble making this work. We are successfully using "remote" to wait until two letters are typed, but we can't get it to stop going to the server as additional letters are typed. Steps: 1. After two letters are typed, retrieve all matching words that start with those two letters. 2. When a third and additional letters are typed, don't go to the server again, just filter from the previous list that was sent. An example: "mo" is typed in. All 100 words that start with "mo" are returned. (Only 10 are shown.) "mor" - now with a third letter, we don't go back to the server. We just find the 20 words that match from within the previous set of words. Can anybody make this work? In real life (using YUI2), we do this and then go back to the server if somebody types in a space after the word. At that point, we know to retrieve additional words. Thanks!

    Read the article

  • JSON to javaScript array

    - by saturn_research
    I'm having a problem handling JSON data within JavaScript, specifically in regards to using the data as an array and accessing and iterating through individual values. The JSON file is structured as follows: { "head": { "vars": [ "place" , "lat" , "long" , "page" ] } , "results": { "bindings": [ { "place": { "type": "literal" , "value": "Building A" } , "lat": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "10.3456" } , "long": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "-1.2345" } , "page": { "type": "uri" , "value": "http://www.example.com/a.html" } } , { "place": { "type": "literal" , "value": "Building B" } , "lat": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "11.3456" } , "long": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "-2.2345" } , "page": { "type": "uri" , "value": "http://www.example.com/b.html" } } , { "place": { "type": "literal" , "value": "Building C" } , "lat": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "12.3456" } , "long": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "-3.2345" } , "page": { "type": "uri" , "value": "http://www.example.com/c.html" } } ] } } I want to be able to convert this into a JavaScript array as follows in order that I can iterate through it and pull out the values for each location in order: var locations = [ ['Building A',10.3456,-1.2345,'http://www.example.com/a.html'], ['Building B',11.3456,-2.2345,'http://www.example.com/b.html'], ['Building C',12.3456,-3.2345,'http://www.example.com/c.html'] ]; Does anyone have any advice on how to achieve this? I have tried the following, but it picks up the "type" within the JSON, rather than just the value: $.each(JSONObject.results.bindings, function(i, object) { $.each(object, function(property, object) { $.each(object, function(property, value) { value; }); }); }); Any help, suggestions, advice or corrections would be greatly appreciated.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >