Search Results

Search found 8616 results on 345 pages for 'primitive types'.

Page 21/345 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Can one create Sized Types in Scala?

    - by Jens Schauder
    Is it possible to create types like e.g. String(20) in scala? The aim would be to have compiler checks for things like: a: String(20) b: String(30) a = b; // throws a compiler exception when no implicit conversion is available b= a; // works just fine Note: It doesn't need to be/named String

    Read the article

  • EXTRACT for TIMESTAMP types in SQLite3

    - by umuthorax
    Hi, It seems extract function is not supported by SQLite3 for timestamp types (ref). For example; select extract(year from l_shipdate) as l_year from ... gives the following error; Error: near "from": syntax error I wonder whether there is an alternative way to do this in SQLite3 (or through rewriting the SQL query). Thanks in advance,

    Read the article

  • Contravariant Delegates Value Types

    - by ChloeRadshaw
    Can anyone shed light on why contravariance does not work with C# value types? The below does not work private delegate Asset AssetDelegate(int m); internal string DoMe() { AssetDelegate aw = new AssetDelegate(DelegateMethod); aw(32); return "Class1"; } private static House DelegateMethod(object m) { return null; }

    Read the article

  • Android: Issue with acceptable file types via bluetooth

    - by poeschlorn
    Hi guys, i've got a problem with pushing files to my nexus one: It seems to me that there is only a small selection of file types that are accepted by my phone (such like jpg, gif and so on). I recently tried to push other files to my phone (in my case gpx) and my phone has rejected it automatically... is there a way to bypass or extent this filter? Is there also a way to catch those files by a service? greets, poeschlorn

    Read the article

  • Merge two data frames together that have the same variable names and data types

    - by Brandon
    I have tried the merge function to merge two csv files that I imported. They both have the same variable names and data types but each time I run merge all that I get is an object that contains the names of the two data frames. I have tried the following: # ex1 obj <- merge(obj1, obj2, by=obj) # ex2 obj <- merge(obj1, obj2, all) and several other iterations of the above. Is merge the correct function? If so, what am I doing wrong?

    Read the article

  • capture types of varargs parameters

    - by IttayD
    Hi, I'd like to define a method accepting varargs, so that I get the types with which it was called even in the case of nulls. def foo(args: Any*) = .... val s: String = null foo(1, s) // i'd like to be able to tell in foo that args(0) is Int, args(1) is String

    Read the article

  • Correct XML serialization and deserialization of "mixed" types in .NET

    - by Stefan
    My current task involves writing a class library for processing HL7 CDA files. These HL7 CDA files are XML files with a defined XML schema, so I used xsd.exe to generate .NET classes for XML serialization and deserialization. The XML Schema contains various types which contain the mixed="true" attribute, specifying that an XML node of this type may contain normal text mixed with other XML nodes. The relevant part of the XML schema for one of these types looks like this: <xs:complexType name="StrucDoc.Paragraph" mixed="true"> <xs:sequence> <xs:element name="caption" type="StrucDoc.Caption" minOccurs="0"/> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="br" type="StrucDoc.Br"/> <xs:element name="sub" type="StrucDoc.Sub"/> <xs:element name="sup" type="StrucDoc.Sup"/> <!-- ...other possible nodes... --> </xs:choice> </xs:sequence> <xs:attribute name="ID" type="xs:ID"/> <!-- ...other attributes... --> </xs:complexType> The generated code for this type looks like this: /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(TypeName="StrucDoc.Paragraph", Namespace="urn:hl7-org:v3")] public partial class StrucDocParagraph { private StrucDocCaption captionField; private object[] itemsField; private string[] textField; private string idField; // ...fields for other attributes... /// <remarks/> public StrucDocCaption caption { get { return this.captionField; } set { this.captionField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("br", typeof(StrucDocBr))] [System.Xml.Serialization.XmlElementAttribute("sub", typeof(StrucDocSub))] [System.Xml.Serialization.XmlElementAttribute("sup", typeof(StrucDocSup))] // ...other possible nodes... public object[] Items { get { return this.itemsField; } set { this.itemsField = value; } } /// <remarks/> [System.Xml.Serialization.XmlTextAttribute()] public string[] Text { get { return this.textField; } set { this.textField = value; } } /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute(DataType="ID")] public string ID { get { return this.idField; } set { this.idField = value; } } // ...properties for other attributes... } If I deserialize an XML element where the paragraph node looks like this: <paragraph>first line<br /><br />third line</paragraph> The result is that the item and text arrays are read like this: itemsField = new object[] { new StrucDocBr(), new StrucDocBr(), }; textField = new string[] { "first line", "third line", }; From this there is no possible way to determine the exact order of the text and the other nodes. If I serialize this again, the result looks exactly like this: <paragraph> <br /> <br />first linethird line </paragraph> The default serializer just serializes the items first and then the text. I tried implementing IXmlSerializable on the StrucDocParagraph class so that I could control the deserialization and serialization of the content, but it's rather complex since there are so many classes involved and I didn't come to a solution yet because I don't know if the effort pays off. Is there some kind of easy workaround to this problem, or is it even possible by doing custom serialization via IXmlSerializable? Or should I just use XmlDocument or XmlReader/XmlWriter to process these documents?

    Read the article

  • How to associate all file types within Wine with its corresponding native application?

    - by MestreLion
    This is easily done for a single file type, as answered in How to associate a file type within Wine with a native application?, by creating a .reg for the desired filetype. But this is for AVI only. I use some wine apps (uTorrent, Soulseek, Eudora, to name a few) that can launch a wide range of files. Email attachments, for example, can be JPG, DOC, PDF, PPS... its impossible (and not desirable) to track down all possible file types that one may receive in an email or download in a torrent. So I neeed a solution to be more generic and broad. I need the file association to honor whatever native app is currently configured. And I want this to be done for all file types configured in my system. I've already figured out how to make the solution generic. Simply replacing the launched app in .reg for winebrowser, like this: [HKEY_CLASSES_ROOT\.pdf] @="PDFfile" "Content Type"="application/pdf" [HKEY_CLASSES_ROOT\PDFfile\Shell\Open\command] @="C:\\windows\\system32\\winebrowser.exe \"%1\"" Ive tested this and it works correctly. Since winebrowser uses xdg-open as a backend, and converts my windows path to a Unix one, the correct (Linux) app is launched. So I need a "batch" updater to wine's registry, sort of a wine-update-associations script that I can run whenever a new app is installed. Maybe a tool that can: List all Mime Types types in my system that have a default, installed app associated Extract all the needed info (glob, mime type, etc) Generate the .REG file in the above format The tricky part is: i've searched a LOT to find info about how association is done in Ubuntu 10.10 onwards, and documentation is scarce and confusing, to say the least. Freedesktop.org has no complete spec, and even Gnome docs are obsolete. So far I've gathered 4 files that contain association info, but im clueless on which (or why) to use, or how to use them to generate the .reg file: ~/.local/share/applications/mimeapps.list ~/.local/share/applications/miminfo.cache /usr/share/applications/miminfo.cache /etc/gnome/defaults.list Any help, script or explanation would be greatly appreciated! Thanks!

    Read the article

  • How do you encode Algebraic Data Types in a C#- or Java-like language?

    - by Jörg W Mittag
    There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as: data ConsList a = Empty | ConsCell a (ConsList a) consmap f Empty = Empty consmap f (ConsCell a b) = ConsCell (f a) (consmap f b) l = ConsCell 1 (ConsCell 2 (ConsCell 3 Empty)) consmap (+1) l This particular example is in Haskell, but it would be similar in other languages with native support for Algebraic Data Types. It turns out that there is an obvious mapping to OO-style subtyping: the datatype becomes an abstract base class and every data constructor becomes a concrete subclass. Here's an example in Scala: sealed abstract class ConsList[+T] { def map[U](f: T => U): ConsList[U] } object Empty extends ConsList[Nothing] { override def map[U](f: Nothing => U) = this } final class ConsCell[T](first: T, rest: ConsList[T]) extends ConsList[T] { override def map[U](f: T => U) = new ConsCell(f(first), rest.map(f)) } val l = (new ConsCell(1, new ConsCell(2, new ConsCell(3, Empty))) l.map(1+) The only thing needed beyond naive subclassing is a way to seal classes, i.e. a way to make it impossible to add subclasses to a hierarchy. How would you approach this problem in a language like C# or Java? The two stumbling blocks I found when trying to use Algebraic Data Types in C# were: I couldn't figure out what the bottom type is called in C# (i.e. I couldn't figure out what to put into class Empty : ConsList< ??? >) I couldn't figure out a way to seal ConsList so that no subclasses can be added to the hierarchy What would be the most idiomatic way to implement Algebraic Data Types in C# and/or Java? Or, if it isn't possible, what would be the idiomatic replacement?

    Read the article

  • Is there an equivalent to Lisp's "runtime" primitive in Scheme?

    - by Bill the Lizard
    According to SICP section 1.2.6, exercise 1.22: Most Lisp implementations include a primitive called runtime that returns an integer that specifies the amount of time the system has been running (measured, for example, in microseconds). I'm using DrScheme, where runtime doesn't seem to be available, so I'm looking for a good substitute. I found in the PLT-Scheme Reference that there is a current-milliseconds primitive. Does anyone know if there's a timer in Scheme with better resolution?

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >