Search Results

Search found 3322 results on 133 pages for 'equivalent'.

Page 23/133 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • F# equivalent of the C# typeof(IEnumerable<>)

    - by Rune FS
    I have a piece of code where I need to figure out if a given type implements IEnumerable (I don't care about the T) I've tried (t:System.Type in case you wonder) let interfaces = t.GetInterfaces() let enumerbale = interfaces.Any( fun t -> (t.GetGenericTypeDefinition() = typeof<IEnumerable<>>) however that wont compile (the compile don't like the <). I then tried let interfaces = t.GetInterfaces() let enumerbale = interfaces.Any( fun t -> (t.GetGenericTypeDefinition() = typeof<IEnumerable<'a>>) but get's a warning that 'a is constraint to obj. I Don't want to figure out if IEnumerable is implemented but IEnumerabl<. Any one know's the solution and btw feel free to comment on the code above as well. It's my first non-trivial F# program

    Read the article

  • Functional equivalent of if (p(f(a), f(b)) a else b

    - by oxbow_lakes
    I'm guessing that there must be a better functional way of expressing the following: def foo(i: Any) : Int if (foo(a) < foo(b)) a else b So in this example f == foo and p == _ < _. There's bound to be some masterful cleverness in scalaz for this! I can see that using BooleanW I can write: p(f(a), f(b)).option(a).getOrElse(b) But I was sure that I would be able to write some code which only referred to a and b once. If this exists it must be on some combination of Function1W and something else but scalaz is a bit of a mystery to me! EDIT: I guess what I'm asking here is not "how do I write this?" but "What is the correct name and signature for such a function and does it have anything to do with FP stuff I do not yet understand like Kleisli, Comonad etc?"

    Read the article

  • What is the .NET equivalent of PHP var_dump?

    - by George Mauer
    I remember seeing a while ago that there is some method in maybe the Reflection namespace that would recursively run ToString() on all of an object's properties and format it nicely for display. Yes, I know everything I could want will be accessible through the debugger, but I'm wondering if anyone knows that command?

    Read the article

  • R equivalent of SELECT DISTINCT on two or more fields/variables

    - by wahalulu
    Say I have a dataframe df with two or more columns, is there an easy way to use unique() or other R function to create a subset of unique combinations of two or more columns? I know I can use sqldf() and write an easy "SELECT DISTINCT var1, var2, ... varN" query, but I am looking for an R way of doing this. It occurred to me to try ftable coerced to a dataframe and use the field names, but I also get the cross tabulations of combinations that don't exist in the dataset: uniques <- as.data.frame(ftable(df$var1, df$var2))

    Read the article

  • python equivalent of filter() getting two output lists

    - by FX
    Let's say I have a list, and a filtering function. Using something like >>> filter(lambda x: x > 10, [1,4,12,7,42]) [12, 42] I can get the elements matching the criterion. Is there a function I could use that would output two lists, one of elements matching, one of the remaining elements? I could call the filter() function twice, but that's kinda ugly :) Edit: the order of elements should be conserved, and I may have identical elements multiple times.

    Read the article

  • Groups equivalent for social plugin Facepile

    - by oivvio
    I need to do something similar to the Facepile social plugin for a site I'm working on. The problem is the client does not have have a Facebook page, but instead has a Facebook Group (with some 4000+ members). I guess I could urge the client to move their group members to a page, and I might do that in the future. But before I do I want to research how we're going to do Facebook-integration more thoroughly. For now I just need a quick fix.

    Read the article

  • C# equivalent of recv?

    - by mlh
    Hello, I have a portion of C code that I am trying to port over to C#. In my C code, I create a socket and then issue a receive command. The receive command is void receive(mysocket, char * command_buffer) { recv(mysocket, command_buffer, COMMAND_BUFFER_SIZE, 0); } now, the command buffer is returned with new values including command_buffer[8] being a pointer to a string. I'm really confused as to how to do this in C# because C# Read() command specifically takes in bytes and not char. The important part is that I get the pointer to the string. Any ideas?

    Read the article

  • Beanshell equivalent for .Net

    - by Midhat
    Is there anything like Beanshell, which exposes CLR classes instead of Java classes, and lets you write scripts in C# or VB.Net (or any .Net language for that matter) Should come in handy to test one-liner code snippets

    Read the article

  • C# equivalent of typeof for fields

    - by rwallace
    With reflection, you can look up a class from a string at run time, but you can also say typeof(Foo) and get compile time type checking, auto completion etc. If what you want is a field not a class, you can look it up from a string at runtime, but if you want compile time type checking etc., is there anyway to say something like fieldof(Foo.Bar)? I know the name of both the class and the field in advance, and I want to be able to refer to the field at compile time rather than with a run-time string lookup.

    Read the article

  • Java: Efficient Equivalent to Removing while Iterating a Collection

    - by Claudiu
    Hello everyone. We all know you can't do this: for (Object i : l) if (condition(i)) l.remove(i); ConcurrentModificationException etc... this apparently works sometimes, but not always. Here's some specific code: public static void main(String[] args) { Collection<Integer> l = new ArrayList<Integer>(); for (int i=0; i < 10; ++i) { l.add(new Integer(4)); l.add(new Integer(5)); l.add(new Integer(6)); } for (Integer i : l) { if (i.intValue() == 5) l.remove(i); } System.out.println(l); } This, of course, results in: Exception in thread "main" java.util.ConcurrentModificationException ...even though multiple threads aren't doing it... Anyway. What's the best solution to this problem? "Best" here means most time and space efficient (I realize you can't always have both!) I'm also using an arbitrary Collection here, not necessarily an ArrayList, so you can't rely on get.

    Read the article

  • Equivalent of alarm(3600) in Python

    - by knorv
    Starting a Perl script with alarm(3600) will make the script abort if it is still running after one hour (3600 seconds). Assume I want to set an upper bound on the running time of a Python script, what is the easiest way to achieve that?

    Read the article

  • equivalent to getch(), mac/linux crash

    - by acidzombie24
    Hey guys. So I am using getch() and my app crashes instantly. Including when doing: int main() { getch(); } I can't find the link but supposedly the problem is, it needs to turn off buffering or something strange along those lines and I still want cout to work along with cross platform code. I was told to use std::cin.get(), but I'd like the app to quit when a key is pressed, not when the user typed in a letter or number then press enter to quit. Is there any function for this? The code must work under Mac (my os) and Windows.

    Read the article

  • What is the equivalent of domain admin on Sharepoint 2010?

    - by user54266
    I have to support Sharepoint on a daily basis but do not have the equivalent of domain access so I'm constantly having to ask the guy in charge of Sharepoint to add me to a new security group to complete my task. Rather than having to bug him all the time (he is only somewhat technical) it would be easier to simply have the equivalent of domain admin access for Sharepoint (I'm a sys admin and have domain admin access already but this doesn't seem to carry over to FOSS). What is the equivalent of domain admin access on Sharepoint 2010? Thanks in advance.

    Read the article

  • What to answer to a customer who asks which one of two equivalent technologies must be used?

    - by MainMa
    As a freelancer, I am often asked by my customers what they must choose between similar elements, neither of which being better than another. Examples: “Do I need my e-commerce website be in PHP or ASP.NET?” “Do I need to host this ordinary web service in Cloud or use an ordinary hosting service?” “Which one is better for my new website: MySQL or Oracle?” etc. There is maybe at most 1% of cases where the choice is relevant, and there is a real, objective reason to use one over another, based on the precise metrics and studies. In all other cases, it doesn't matter at all. It is totally, completely irrelevant, either because there are no implications¹, or because those implications are too small to be taken in account², or, finally, because it's impossible to predict those implications³. If you know one thing and not another one, the answer to those questions is easy: “You can either write the application in C# or Java, both being probably equivalent in your case. Note that I'm a C# developer, so if you choose Java, I would not be able to work on your project and you would need to find another freelancer.” When you know both technologies, you can't answer that. In this case, how to explain to the customer that the question he asks is subject to flamewar and has no real consequences on his project? In other words, how to explain that you've chosen to use one technology rather than an equivalent one for the reasons related to human resources, without giving the impression to be unprofessional or to not care about the project? ¹ Example: Is MySQL better (worse?), performance-wise, compared to Oracle, for a personal website which will be accessed by, oh, let's be optimistic, two people per day? ² Example: for a given project, I was asked to asset if Windows Azure hosting would be cheaper than the hosting of the same application on a well-known ASP.NET hosting provider. The cost revealed to be exactly the same. ³ Example: your customer have an idea of a future application (the idea itself being extremely vague). There is no business plan, no requirements, nothing at all. Just an idea. You are asked if Java is better than C# for this app. What do you answer?

    Read the article

  • Internet : vers un équivalent informatique de la guerre froide ? Les États-Unis disposeraient des cyberarmes prêtes à être utilisées

    Internet : vers un équivalent informatique de la guerre froide ? Les États-Unis disposeraient des cyberarmes prêtes à être utilisées si le besoin se fait sentirLes États-Unis se lancent dans une vaste campagne de préparation pour une cyberguerre.Ce n'est plus un secret pour personne. Maintes fois la Chine a été pointée du doigt par les États-Unis comme responsable de la vague sans précédent d'espionnage que ses industries ont subi récemment. Ces derniers sont même allés jusqu'à dire que les Chinois étaient entrés en possession d'arme...

    Read the article

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