Search Results

Search found 34176 results on 1368 pages for 'project types'.

Page 112/1368 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • Erlang Types Specifications

    - by Chang
    I recently read the source code of couch-db, I find this type definition which i don't understand: -type branch() :: {Key::term(), Value::term(), Tree::term()}. -type path() :: {Start::pos_integer(), branch()}. -type tree() :: [branch()]. I did read Erlang doc, But what is the meaning of Start, Key, Value and Tree? From what i understand, they are Erlang variables! I didn't find any information about this in Erlang doc.

    Read the article

  • Two Different Types of Associatons on the Same Two Tables in Rails

    - by tmo256
    I have two models, users and themes, that I'm currently joining in a HABTM association in a themes_users table. Basically, after a user creates a new theme, it becomes available to other users to select for their own use. However, only the original creator of the theme should have the ability to edit it. So, I need to have some other kind of association to handle that relationship, something like an created_by_id field in the theme. In this way, the user model acts as two different roles: they can be an implementer of a theme AND/OR the owner of the theme. The implementer relationship is handled by the themes_users join table; the question is: What is the right way to handle this secondary association? Do I need to make users polymorphic and then make the created_by_id reference an "owner"? Or is there something easier? Thanks so much for your help!

    Read the article

  • Storing Object Types in Variable then Initializing

    - by Jon Mattingly
    Is there a way in Objective-C to store an object/class in a variable to be passed to alloc/init somewhere else? For example: UIViewController = foo foo *bar = [[foo alloc] init] I'm trying to create a system to dynamically create navigation buttons in a separate class based on the current view controller. I can pass 'self' to the method, but the variable that results does not allow me to alloc/init. I could always import the .h file directly, but ideally I would like to make reusing the code as simple as possible. Maybe I'm going about this the wrong way?

    Read the article

  • C++ Template problem adding two data types

    - by Sara
    I have a template class with an overloaded + operator. This is working fine when I am adding two ints or two doubles. How do I get it to add and int and a double and return the double? template <class T> class TemplateTest { private: T x; public: TemplateTest<T> operator+(const TemplateTest<T>& t1)const { return TemplateTest<T>(x + t1.x); } } in my main function i have void main() { TemplateTest intTt1 = TemplateTest<int>(2); TemplateTest intTt2 = TemplateTest<int>(4); TemplateTest doubleTt1 = TemplateTest<double>(2.1d); TemplateTest doubleTt2 = TemplateTest<double>(2.5d); std::cout << intTt1 + intTt2 << /n; std::cout << doubleTt1 + doubleTt2 << /n; } I want to be able to also do this std::cout << doubleTt1 + intTt2 << /n;

    Read the article

  • Linq Query - Average Time (DateTime data types)

    - by Jade
    I have a database that has the following records in a DateTime field: 2012-04-13 08:31:00.000 2012-04-12 07:53:00.000 2012-04-11 07:59:00.000 2012-04-10 08:16:00.000 2012-04-09 15:11:00.000 2012-04-08 08:28:00.000 2012-04-06 08:26:00.000 I want to run a linq to sql query to get the average time from the records above. I tried the following: (From o In MYDATA Select o.SleepTo).Average() Since "SleepTo" is a datetime field I get an error on Average(). If I was trying to get the average of say an integer, the above linq query works. What do I need to do to get it to work for datetimes?

    Read the article

  • Ideal HTTP cache control headers for different types of resources

    - by chris_l
    I want to find a minimal set of headers, that work with "all" caches and browsers (also when using HTTPS!) On my (GWT-based) web site, I'll have three kinds of resources: 1. Forever cacheable (public / equal for all users) These files don't ever change, and they get a filename based on the MD5 of their contents (this is GWT's approach). They should get cached as much as possible, even when using HTTPS (so I assume, I should set Cache-Control: public, especially for Firefox?) 2. Changing for every new version of the site (public / equal for all users) These files can be cached, but probably need to be revalidated every time. 3. Individual for each request (private / user specific) These resources (e. g. JSON responses) should never be cached unencrypted to disk under no circumstances. (Maybe I'll have a few specific requests that could be cached.) I have a general idea on which headers I would probably use for each type, but there's always something I could be missing.

    Read the article

  • AutoMapper : Site wide usage of IValueFormatter for given types

    - by CRice
    It is my understanding I can configure AutoMapper in the following way and during mapping it should format all source model dates to the rules defined in the IValueFormatter and set the result to the mapped model. ForSourceType<DateTime>().AddFormatter<StandardDateFormatter>(); ForSourceType<DateTime?>().AddFormatter<StandardDateFormatter>(); I get no effect for my mapped class with this. It only works when I do the following: Mapper.CreateMap<Member, MemberForm>().ForMember(x => x.DateOfBirth, y => y.AddFormatter<StandardDateFormatter>()); I am mapping DateTime? Member.DateOfBirth to string MemberForm.DateOfBirth. The formatter basically creates a short date string from the date. Is there something I am missing when setting the default formatter for a given type? Thanks public class StandardDateFormatter : IValueFormatter { public string FormatValue(ResolutionContext context) { if (context.SourceValue == null) return null; if (!(context.SourceValue is DateTime)) return context.SourceValue.ToNullSafeString(); return ((DateTime)context.SourceValue).ToShortDateString(); } }

    Read the article

  • C# Lists, Foreach, and Types

    - by user406470
    I was wondering if there is a version of foreach that checks only for a specific type and returns it. For example consider this class tree: org.clixel.ClxBasic - org.clixel.ClxObject - org.clixel.ClxSprite - WindowsGame1.test Then consider this code public List<ClxBasic> objects = new List<ClxBasic>(); foreach(GroupTester tester in objects) { tester.GroupTesterOnlyProperty = true; } tester.GroupTesterOnlyProperty is a property created in GroupTester. Is there some way to make something like this work, like an overload of foreach, or another snippet that might help me? I want to make it easy for a programmer to sort through the lists grabbing only what type they need.

    Read the article

  • Implicit conversion between Scala collection types

    - by ebruchez
    I would like to implicitly convert between the Scala XML Elem object and another representation of an XML element, in my case dom4j Element. I wrote the following implicit conversions: implicit def elemToElement(e: Elem): Element = ... do conversion here ... implicit def elementToElem(e: Element): Elem = ... do conversion here ... So far so good, this works. Now I also need collections of said elements to convert both ways. First, do I absolutely need to write additional conversion methods? Things didn't seem to work if I didn't. I tried to write the following: implicit def elemTToElementT(t: Traversable[Elem]) = t map (elemToElement(_)) implicit def elementTToElemT(t: Traversable[Element]) = t map (elementToElem(_)) This doesn't look too ideal because if the conversion method takes a Traversable, then it also returns a Traversable. If I pass a List, I also get a Traversable out. So I assume the conversion should be parametrized somehow. So what's the standard way of writing these conversions in order to be as generic as possible?

    Read the article

  • Best practice- How to team-split a django project while still allowing code reusal

    - by Infinity
    I know this sounds kind of vague, but please let me explain- I'm starting work on a brand new project, it will have two main components: "ACME PRODUCT" (think Gmail, Meebo, etc), and "THE SITE" (help, information, marketing stuff, promotional landing pages, etc lots of marketing-induced cruft). So basically the url /acme/* will load stuff in the uber cool ajaxy application, and every other URI will load stuff in the other site. Problem: "THE SITE" component is out of my hands, and will be handled by a consultants team that will work closely with marketing, And I and my team will work solely on the ACME PRODUCT. Question: How to set up the django project in such a way that we can have: Seperate releases. (They can push new marketing pages and functionality without having to worry about the state of our code. Maybe even separate Subversion "projects") Minimize impact (on our product) of whatever flying-unicorns-hocus-pocus the other team codes into the site. Still allow some code reusal. My main concern is that the ACME product needs to be rock solid, and therefore needs to be somewhat isolated of whatever mistakes/code bloopers the consultants make in their marketing side of the site. How have you handled this? Any ideas? Thanks!

    Read the article

  • Using groovy ws with enum types?

    - by Jared
    I'm trying to use groovy ws to call a webservice. One of the properties of the generated class is it's self a class with an enum type. Although the debug messages show that the com.test.FinalActionType is created at runtime when the WSDL is read I can't create an instance of it using code like proxy.create("com.test.FinalActionType") When I try and assign a string to my class uin place of an instance of FinalActionType groovy is not able to do the conversion. How can I get an instance of this class to use in a webservice call? I've pasted the important part of the WSDL below. <xsd:simpleType name="FinalActionType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="stop"/> <xsd:enumeration value="quit"/> <xsd:enumeration value="continue"/> <xsd:whiteSpace value="collapse"/> </xsd:restriction> </xsd:simpleType>

    Read the article

  • Control XML serialization of generic types

    - by Luca
    I'm investigating about XML serialization, and since I use lot of dictionary, I would like to serialize them as well. I found the following solution for that (I'm quite proud of it! :) ). [XmlInclude(typeof(Foo))] public class XmlDictionary<TKey, TValue> { /// <summary> /// Key/value pair. /// </summary> public struct DictionaryItem { /// <summary> /// Dictionary item key. /// </summary> public TKey Key; /// <summary> /// Dictionary item value. /// </summary> public TValue Value; } /// <summary> /// Dictionary items. /// </summary> public DictionaryItem[] Items { get { List<DictionaryItem> items = new List<DictionaryItem>(ItemsDictionary.Count); foreach (KeyValuePair<TKey, TValue> pair in ItemsDictionary) { DictionaryItem item; item.Key = pair.Key; item.Value = pair.Value; items.Add(item); } return (items.ToArray()); } set { ItemsDictionary = new Dictionary<TKey,TValue>(); foreach (DictionaryItem item in value) ItemsDictionary.Add(item.Key, item.Value); } } /// <summary> /// Indexer base on dictionary key. /// </summary> /// <param name="key"></param> /// <returns></returns> public TValue this[TKey key] { get { return (ItemsDictionary[key]); } set { Debug.Assert(value != null); ItemsDictionary[key] = value; } } /// <summary> /// Delegate for get key from a dictionary value. /// </summary> /// <param name="value"></param> /// <returns></returns> public delegate TKey GetItemKeyDelegate(TValue value); /// <summary> /// Add a range of values automatically determining the associated keys. /// </summary> /// <param name="values"></param> /// <param name="keygen"></param> public void AddRange(IEnumerable<TValue> values, GetItemKeyDelegate keygen) { foreach (TValue v in values) ItemsDictionary.Add(keygen(v), v); } /// <summary> /// Items dictionary. /// </summary> [XmlIgnore] public Dictionary<TKey, TValue> ItemsDictionary = new Dictionary<TKey,TValue>(); } The classes deriving from this class are serialized in the following way: <XmlProcessList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Items> <DictionaryItemOfInt32Foo> <Key/> <Value/> </DictionaryItemOfInt32XmlProcess> <Items> This give me a good solution, but: How can I control the name of the element DictionaryItemOfInt32Foo What happens if I define a Dictionary<FooInt32, Int32> and I have the classes Foo and FooInt32? Is it possible to optimize the class above? THank you very much!

    Read the article

  • Tools to thumbnail multiple extension types

    - by Joomala
    My requirements are to be able to thumbnail the major image and file extensions: doc(x), txt, xls(x), pdf, rte, and as many others as possible. We have been hooking into Office extensions to do this in the past, but they are not really supported on Vista and Windows 7 operating systems. Are there any third party thumbnailing applications that you have had success implementing? Preferably ones that are easy to invoke from .Net

    Read the article

  • Deserialising Json to derived types in Asp.Net Web API

    - by IoChaos
    I'm calling a method of my WebAPI sending a json that I would like to match (or bind) with a model. In the controller I have a method like: public Result Post([ModelBinder(typeof(CustomModelBinder))]MyClass model); 'MyClass', wich is given as a parameter is an abstract class. I would like that at, depending of the type of json passed, the correct inherited class is instantiated. To achieve it, I'm trying to implement a custom binder. The problem is that (I don't know if it's very basic but I can't find anything) I don't know how to retrieve the raw Json (or better, some kind of serialization) that comes in the request. I see: actionContext.Request.Content But all methods are exposed as async. I don't know who this fits with passing the generate model to the controller method... Thanks a lot!

    Read the article

  • Forcing entry of certain character types in UITextField

    - by cannyboy
    If I have a UITextField which the user is inputing a registration number, which has the format: 11-11-1111 (that is 2 digits, a dash, 2 digits, a dash, four digits) How do I force the user to enter this kind of data only... so they can't enter anything except 0-9 in the first character, and only '-' for the third character etc.

    Read the article

  • Python: Using `copyreg` to define reducers for types that already have reducers

    - by cool-RR
    (Keep in mind I'm working in Python 3, so a solution needs to work in Python 3.) I would like to use the copyreg module to teach Python how to pickle functions. When I tried to do it, the _Pickler object would still try to pickle functions using the save_global function. (Which doesn't work for unbound methods, and that's the motivation for doing this.) It seems like _Pickler first tries to look in its own dispatch for the type of the object that you want to pickle before looking in copyreg.dispatch_table. I'm not sure if this is intentional. Is there any way for me to tell Python to pickle functions with the reducer that I provide?

    Read the article

  • StructureMap Open Generic Types

    - by Shane Fulmer
    I have the following classes: public interface IRenderer<T> { string Render(T obj); } public class Generic<T> { } public class SampleGenericRenderer<T> : IRenderer<Generic<T>> { public string Render(Generic<T> obj) { throw new NotImplementedException(); } } I would like to be able to call StructureMap with ObjectFactory.GetInstance<IRenderer<Generic<string>>>(); and receive SampleGenericRenderer<string>. I'm currently using the following registration and receiving this error when I call GetInstance. "Unable to cast object of type 'ConsoleApplication1.SampleGenericRenderer'1[ConsoleApplication1.Generic'1[System.String]]' to type 'ConsoleApplication1.IRenderer'1[ConsoleApplication1.Generic'1[System.String]]'." public class CoreRegistry : Registry { public CoreRegistry() { Scan(assemblyScanner => { assemblyScanner.AssemblyContainingType(typeof(IRenderer<>)); assemblyScanner.AddAllTypesOf(typeof(IRenderer<>)); assemblyScanner.ConnectImplementationsToTypesClosing(typeof(IRenderer<>)); }); } } Is there any way to configure StructureMap so that it creates SampleGenericRenderer<string> instead of SampleGenericRenderer<Generic<string>>?

    Read the article

  • A better way of getting a data table with various column types into string array

    - by Vlad
    This should be an easy one, looks like I got myself too confused. I get a table from a database, data ranges from varchar to int to Null values. Cheap and dirty way of converting this into a tab-delimited file that I already have is this (shrunken to preserve space, ugliness is kept on par with original): da.Fill(dt) ' da - DataAdapter ' ' dt - DataTable ' Dim lColumns As Long = dt.Columns.Count Dim arrColumns(dt.Columns.Count) As String Dim arrData(dt.Columns.Count) As Object Dim j As Long = 0 Dim arrData(dt.Columns.Count) As Object For i = 0 To dt.Rows.Count - 1 arrData = dt.Rows(i).ItemArray() For j = 0 To arrData.GetUpperBound(0) - 1 arrColumns(j) = arrData(j).ToString Next wrtOutput.WriteLine(String.Join(strFieldDelimiter, arrColumns)) Array.Clear(arrColumns, 0, arrColumns.GetLength(0)) Array.Clear(arrData, 0, arrData.GetLength(0)) Next Not only this is ugly and inefficient, it is also getting on my nerves. Besides, I want, if possible, to avoid the infamous double-loop through the table. I would really appreciate a clean and safe way of rewriting this piece. I like the approach that is used here - especially that is trying to solve the same problem that I have, but it crashes on me when I apply it to my case directly.

    Read the article

  • Yeoman 'grunt test' fails on clean project with 'port already in use'

    - by XMLilley
    With: Mac OS 10.8.4 Node 0.10.12 npm 1.3.1 grunt-cli 0.1.9 yo 1.0.0-rc.1 bower 0.9.2 [email protected] I encounter the following error with a clean yo angular project, followed by grunt server then grunt test: Running "connect:test" (connect) task Fatal error: Port 9000 is already in use by another process. I'm new to Yeoman and am stumped. I've deleted my original project and created a new one in a fresh folder just to make sure I wasn't overlooking any invisible configs. I restarted the machine to make sure I wasn't running any temporary server processes I had forgotten about. After all attempts, the basic server starts fine, attaches to Chrome, and the watcher updates the browser on any changes. (Notably, the server is running on 9000, which seems odd for the test-runner to also be trying to use 9000.) But I get that same error on attempting to start the test runner. Is this something I can fix, or an issue I should report to the Yeoman team? Thanks.

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >