Search Results

Search found 84 results on 4 pages for 'denny mueller'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • F# Equivalent to Enumerable.OfType<'a>

    - by Joel Mueller
    ...or, how do I filter a sequence of classes by the interfaces they implement? Let's say I have a sequence of objects that inherit from Foo, a seq<#Foo>. In other words, my sequence will contain one or more of four different subclasses of Foo. Each subclass implements a different independent interface that shares nothing with the interfaces implemented by the other subclasses. Now I need to filter this sequence down to only the items that implement a particular interface. The C# version is simple: void MergeFoosIntoList<T>(IEnumerable<Foo> allFoos, IList<T> dest) where T : class { foreach (var foo in allFoos) { var castFoo = foo as T; if (castFoo != null) { dest.Add(castFoo); } } } I could use LINQ from F#: let mergeFoosIntoList (foos:seq<#Foo>) (dest:IList<'a>) = System.Linq.Enumerable.OfType<'a>(foos) |> Seq.iter dest.Add However, I feel like there should be a more idiomatic way to accomplish it. I thought this would work... let mergeFoosIntoList (foos:seq<#Foo>) (dest:IList<'a>) = foos |> Seq.choose (function | :? 'a as x -> Some(x) | _ -> None) |> Seq.iter dest.Add However, the complier complains about :? 'a - telling me: This runtime coercion or type test from type 'b to 'a involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. I can't figure out what further type annotations to add. There's no relationship between the interface 'a and #Foo except that one or more subclasses of Foo implement that interface. Also, there's no relationship between the different interfaces that can be passed in as 'a except that they are all implemented by subclasses of Foo. I eagerly anticipate smacking myself in the head as soon as one of you kind people points out the obvious thing I've been missing.

    Read the article

  • Conversion of pointer-to-pointer between derived and base classes?

    - by Mike Mueller
    Regarding the following C++ program: class Base { }; class Child : public Base { }; int main() { // Normal: using child as base is allowed Child *c = new Child(); Base *b = c; // Double pointers: apparently can't use Child** as Base** Child **cc = &c; Base **bb = cc; return 0; } GCC produces the following error on the last assignment statement: error: invalid conversion from ‘Child**’ to ‘Base**’ My question is in two parts: Why is there no implicit conversion from Child** to Base**? I can make this example work with a C-style cast or a reinterpret_cast. Using these casts means throwing away all type safety. Is there anything I can add to the class definitions to make these pointers cast implicitly, or at least phrase the conversion in a way that allows me to use static_cast instead?

    Read the article

  • Regular Expression - capturing contents of <select>

    - by joey mueller
    I'm trying to use a regular expression to capture the contents of all option values inside an HTML select element For example, in: <select name="test"> <option value="blah">one</option> <option value="mehh">two</option> <option value="rawr">three</option> </select> I'd like to capture one two and three into an array. My current code is var pages = responseDetails.responseText.match(/<select name="page" .+?>(?:\s*<option .+?>([^<]+)<\/option>)+\s*<\/select>/); for (var c = 0; c<pages.length; c++) { alert(pages[c]); } But it only captures the last value, in this case, "three". How can I modify this to capture all of them? Thanks!

    Read the article

  • Capturing the contents of <select>

    - by joey mueller
    I'm trying to use a regular expression to capture the contents of all option values inside an HTML select element For example, in: <select name="test"> <option value="blah">one</option> <option value="mehh">two</option> <option value="rawr">three</option> </select> I'd like to capture one two and three into an array. My current code is var pages = responseDetails.responseText.match(/<select name="page" .+?>(?:\s*<option .+?>([^<]+)<\/option>)+\s*<\/select>/); for (var c = 0; c<pages.length; c++) { alert(pages[c]); } But it only captures the last value, in this case, "three". How can I modify this to capture all of them? Thanks!

    Read the article

  • System.Interactive: Difference between Memoize() and MemoizeAll()?

    - by Joel Mueller
    In System.Interactive.dll (v1.0.2521.0) from Reactive Extensions, EnumerableEx has both a Memoize method and a MemoizeAll method. The API documentation is identical for both of them: Creates an enumerable that enumerates the original enumerable only once and caches its results. However, these methods are clearly not identical. If I use Memoize, my enumerable has values the first time I enumerate it, and seems to be empty the second time. If I use MemoizeAll then I get the behavior I would expect from the description of either method - I can enumerate the result as many times as I want and get the same results each time, but the source is only enumerated once. Can anyone tell me what the intended difference between these methods is? What is the use-case for Memoize? It seems like a fairly useless method with really confusing documentation.

    Read the article

  • Android : Oracle muscle sa plainte contre Google et déclare que 8 fichiers du code d'Android sont du code Oracle décompilé

    Android : Oracle muscle sa plainte contre Google Et déclare que 8 fichiers du code d'Android sont du code Oracle décompilé Mise à jour du 24/02/11, par Hinault Romaric Nouvel épisode dans l'affaire opposant Oracle et Google sur l'utilisation de Java dans Android. L'analyse de l'expert en logiciels libres Florian Mueller qui affirmait que Google aurait ouvertement copié du code Java sans les permissions nécessaires dans Android 2.2 et 2.3 (lire ci-avant) a permis à Oracle de muscler un peu plus sa plainte contre Google. Oracle a en effet adressé une nouvelle déposition au juge de la cour fédérale Williams Alsup pou...

    Read the article

  • Extend hasMap to add putChildren method

    - by denny
    Hi all, i have question, i want to develop a programme about extend the hashmap to add putchildren method.. I wrote main class, but now i wanna write putChildrenValue method.. My question is : i need to implement a putChildrenValue method with 3 parameters, String key, String key, ObjectValue. It will store the system as described above accordingly. When i finished this method When you finish the method data Key1 = "RUBY" value=HashMap which has -> "key2" = 5248 && "VALUE" = German Key1 = "PHYTON" value=HashMap which has -> "key2" = 1234 && -> "VALUE" = German My main class is : public static void main(String [] args) { ExtendedHashMap extendedMap = new ExtendedHashMap(); extendedMap.put (“Row1”, “Column1”, “German”); extendedMap.put (“Row1”, “Column2”, “English”); extendedMap.put (“Row1”, “Column3”, “Spanish”); extendedMap.put (“Row2”, “Column1”, “Ruby”); extendedMap.put (“Row2”, “Column2”, “Phyton”); extendedMap.put (“Row3”, “Column3”, “Java”); } Can anyone help me?

    Read the article

  • Extend HashMap to add putChildren method

    - by denny
    Hi all, i have question, i want to develop a programme about extend the hashmap to add putchildren method.. I wrote main class, but now i wanna write putChildrenValue method.. My question is : i need to implement a putChildrenValue method with 3 parameters, String key, String key, ObjectValue. It will store the system as described above accordingly. When i finished this method When you finish the method data Key1 = "RUBY" value=HashMap which has -> "key2" = 5248 && "VALUE" = German Key1 = "PHYTON" value=HashMap which has -> "key2" = 1234 && -> "VALUE" = German My main class is : public static void main(String [] args) { ExtendedHashMap extendedMap = new ExtendedHashMap(); extendedMap.put (“Row1”, “Column1”, “German”); extendedMap.put (“Row1”, “Column2”, “English”); extendedMap.put (“Row1”, “Column3”, “Spanish”); extendedMap.put (“Row2”, “Column1”, “Ruby”); extendedMap.put (“Row2”, “Column2”, “Phyton”); extendedMap.put (“Row3”, “Column3”, “Java”); } Can anyone help me?

    Read the article

  • Getting started with OpenGL

    - by Bryan Denny
    As you can see here I'm about to start work on a 3d project for class. Do you have any useful resources/websites/tips/etc. on someone getting started with OpenGL for the first time? The project will be in C++ and accessing OpenGL via GLUT. Thanks!

    Read the article

  • How to produce precisely-timed tone and silence in C#

    - by Bob Denny
    I have a C# project that plays Morse code for RSS feeds. I write it using Managed DirectX, only to discover that Managed DirectX is old and deprecated. The task I have is to play pure sine wave bursts interspersed with silence periods (the code) which are precisely timed as to their duration. I need to be able to call a function which plays a pure tone for so many milliseconds, then Thread.Sleep() then play another, etc. At its fastest, the tones and spaces can be as short as 40ms. It's working quite well in Managed DirectX. To get the precisely timed tone I create 1 sec. of sine wave into a secondary buffer, then to play a tone of a certain duration I seek forward to within x milliseconds of the end of the buffer then play. I've tried System.Media.SoundPlayer. It's a loser because you have to Play(), Sleep(), then Stop() for arbitrary tone lengths. The result is a tone that is too long, variable by CPU load. It takes an indeterminate amount of time to actually stop the tone. I then embarked on a lengthy attempt to use NAudio 1.3. I ended up with a memory resident stream providing the tone data, and again seeking forward leaving the desired length of tone remaining in the stream, then playing. This worked OK on the DirectSoundOut class for a while (see below) but the WaveOut class quickly dies with an internal assert saying that buffers are still on the queue despite PlayerStopped = true. This is odd since I play to the end then put a wait of the same duration between the end of the tone and the start of the next. You'd think that 80ms after starting Play of a 40 ms tone that it wouldn't have buffers on the queue. DirectSoundOut works well for a while, but its problem is that for every tone burst Play() it spins off a separate thread. Eventually (5 min or so) it just stops working. You can see thread after thread after thread exiting in the Output window while running the project in VS2008 IDE. I don't create new objects during playing, I just Seek() the tone stream then call Play() over and over, so I don't think it's a problem with orphaned buffers/whatever piling up till it's choked. I'm out of patience on this one, so I'm asking in the hopes that someone here has faced a similar requirement and can steer me in a direction with a likely solution. Thanks in advance...

    Read the article

  • How to produce precisely-timed tone and silence?

    - by Bob Denny
    I have a C# project that plays Morse code for RSS feeds. I write it using Managed DirectX, only to discover that Managed DirectX is old and deprecated. The task I have is to play pure sine wave bursts interspersed with silence periods (the code) which are precisely timed as to their duration. I need to be able to call a function which plays a pure tone for so many milliseconds, then Thread.Sleep() then play another, etc. At its fastest, the tones and spaces can be as short as 40ms. It's working quite well in Managed DirectX. To get the precisely timed tone I create 1 sec. of sine wave into a secondary buffer, then to play a tone of a certain duration I seek forward to within x milliseconds of the end of the buffer then play. I've tried System.Media.SoundPlayer. It's a loser because you have to Play(), Sleep(), then Stop() for arbitrary tone lengths. The result is a tone that is too long, variable by CPU load. It takes an indeterminate amount of time to actually stop the tone. I then embarked on a lengthy attempt to use NAudio 1.3. I ended up with a memory resident stream providing the tone data, and again seeking forward leaving the desired length of tone remaining in the stream, then playing. This worked OK on the DirectSoundOut class for a while (see below) but the WaveOut class quickly dies with an internal assert saying that buffers are still on the queue despite PlayerStopped = true. This is odd since I play to the end then put a wait of the same duration between the end of the tone and the start of the next. You'd think that 80ms after starting Play of a 40 ms tone that it wouldn't have buffers on the queue. DirectSoundOut works well for a while, but its problem is that for every tone burst Play() it spins off a separate thread. Eventually (5 min or so) it just stops working. You can see thread after thread after thread exiting in the Output window while running the project in VS2008 IDE. I don't create new objects during playing, I just Seek() the tone stream then call Play() over and over, so I don't think it's a problem with orphaned buffers/whatever piling up till it's choked. I'm out of patience on this one, so I'm asking in the hopes that someone here has faced a similar requirement and can steer me in a direction with a likely solution.

    Read the article

  • Filling combobox from database by using hibernate in Java

    - by denny
    Heyy; I am developing a small swing based application with hibernate in java. And I want fill combobox from database coloumn.How i can do that ? And I don't know in where(under initComponents, buttonActionPerformd) i need to do. For saving i'am using jbutton and it's code is here : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int idd=Integer.parseInt(jTextField1.getText()); String name=jTextField2.getText(); String description=jTextField3.getText(); Session session = null; SessionFactory sessionFactory = new Configuration().configure() .buildSessionFactory(); session = sessionFactory.openSession(); Transaction transaction = session.getTransaction(); try { ContactGroup con = new ContactGroup(); con.setId(idd); con.setGroupName(name); con.setGroupDescription(description); transaction.begin(); session.save(con); transaction.commit(); } catch (Exception e) { e.printStackTrace(); } finally{ session.close(); } }

    Read the article

  • Play .WAV under Mono on Mac OS X (Snow Leopard)?

    - by Bob Denny
    The Mono 2.6 distribution contains System.Media.SoundPlayer, but attempts to play result in no sound (and no errors) on Mac OS X. All I can find with Google search is obscure references to ALSA. I posted to the Mono-OSX list, but there have been on replies there. I hope someone here has an answer. I think I need to tap into CoreAudio, but don't know how from Mono/C#.

    Read the article

  • How can I use the paid version of my app as a "key" to the free version?

    - by Bryan Denny
    Let's say for example that I have some Android app that does X. The free version has ads or basic features. I want to have a paid version that removes the ads and adds extra features. How can I use the paid app as a "license key" to unlock the features in the free app? So the user would install the free app, then install the paid app to get the extra features, but they would still run the free app (which would now be unlocked). What's the best approach to doing this?

    Read the article

  • Best way to bundles photos with app: files or in sqlite database?

    - by Bryan Denny
    Lets say that I have an app that lets you browse through a listing of cars found in a Sqlite database. When you click on a car in the listing, it'll open up a view with the description of the car and a photo of the car. My question is: should I keep the photo in the database as a binary data column in the row for this specific car, or should I have the photo somewhere in the resources directory? Which is better to do? Are there any limitations of Sqlite in terms of how big a binary data column can be? The database will be pretty much be read only and bundled with the app (so the user wouldn't be inserting any cars and their photos).

    Read the article

  • What are some good ways to promote my Android application?

    - by Bryan Denny
    I'm a new Android developer and I just released a free, open source tipping calculator app called Tippy Tipper. I created this app to get myself familiar with Android and to hopefully provide a good example app for other new developers to look at. Now that I've overcome the challenges of learning how to program, test and release my Android app, I've come across a new challenge: marketing! What are some good ways to promote my app to the Android community? Can anyone with some experience talk about how they did this successfully with their own app?

    Read the article

< Previous Page | 1 2 3 4  | Next Page >