Search Results

Search found 8167 results on 327 pages for 'general tapioca'.

Page 210/327 | < Previous Page | 206 207 208 209 210 211 212 213 214 215 216 217  | Next Page >

  • Can the lock function be used to implement thread-safe enumeration?

    - by Daniel
    I'm working on a thread-safe collection that uses Dictionary as a backing store. In C# you can do the following: private IEnumerable<KeyValuePair<K, V>> Enumerate() { if (_synchronize) { lock (_locker) { foreach (var entry in _dict) yield return entry; } } else { foreach (var entry in _dict) yield return entry; } } The only way I've found to do this in F# is using Monitor, e.g.: let enumerate() = if synchronize then seq { System.Threading.Monitor.Enter(locker) try for entry in dict -> entry finally System.Threading.Monitor.Exit(locker) } else seq { for entry in dict -> entry } Can this be done using the lock function? Or, is there a better way to do this in general? I don't think returning a copy of the collection for iteration will work because I need absolute synchronization.

    Read the article

  • Why Are Ruby Programmers So Full of Themselves? [closed]

    - by Pierreten
    I've noticed this culture surrounding Ruby where developers truly believe that they are somehow more gifted than developers of other languages, regardless of experience and talent (even when that isn't the case, I've met some extremely junior Ruby developers come up with some pretty basic constructs, and pass them off as some sort of revolutionary idea). The derision of strongly typed languages seems to be a common theme as well; regardless of its merits. Is there something particular to the Ruby syntax in general that is to account for this? Is there a socialogical component to it?

    Read the article

  • What's the most scalable way to handle somewhat large file uploads in a Python webapp?

    - by Jason Baker
    We have a web application that takes file uploads for some parts. The file uploads aren't terribly big (mostly word documents and such), but they're much larger than your typical web request and they tend to tie up our threaded servers (zope 2 servers running behind an Apache proxy). I'm mostly in the brainstorming phase right now and trying to figure out a general technique to use. Some ideas I have are: Using a python asynchronous server like tornado or diesel or gunicorn. Writing something in twisted to handle it. Just using nginx to handle the actual file uploads. It's surprisingly difficult to find information on which approach I should be taking. I'm sure there are plenty of details that would be needed to make an actual decision, but I'm more worried about figuring out how to make this decision than anything else. Can anyone give me some advice about how to proceed with this?

    Read the article

  • C++ Header Guard issues

    - by JP
    I am making a small C++ framework, which contains many .h and .cpp. I have created a general include which include all my .h file such as: framework.h #include "A.h" #include "B.h" #include "C.h" each .h header are protected with include guard such as #ifndef A_HEADER #define A_HEADER ... #endif The issues is, I would like to be able to include "framework.h" inside all the sub .h such as, but it cause lots of compiler error: #ifndef A_HEADER #define A_HEADER #include "framework.h" ... #endif If instead I use the real header file for each sub header, and the framework.h for what ever use my framework it works fine.. I would just like to include the main header inside all my sub .h so I dont need to include all the dependency everytime. Thanks :)

    Read the article

  • C++: Why don't I need to check if references are invalid/null?

    - by jbu
    Hi all, Reading http://www.cprogramming.com/tutorial/references.html, it says: In general, references should always be valid because you must always initialize a reference. This means that barring some bizarre circumstances (see below), you can be certain that using a reference is just like using a plain old non-reference variable. You don't need to check to make sure that a reference isn't pointing to NULL, and you won't get bitten by an uninitialized reference that you forgot to allocate memory for. My question is how do I know that the object's memory hasn't been freed/deleted AFTER you've initialized the reference. What it comes down to is that I can't take this advice on faith and I need a better explanation. Can anyone shed some light? Thanks, jbu

    Read the article

  • Is there a good collection library for C-language?

    - by matti
    We have to maintain and even develop C-code of our legacy system. Is there good collection library that would support Java/C# (new versions) style collections. Hashtable, HashSet, etc. Of course without objects, but with structs. The HashTable key limitations to "strings" and ints is not a problem. It wouldn't be bad if it's free even for commercial use. I'm back to C from C# and I must say i'm depressed using our own libraries and the language in general. We're using VS2005 and MS C-compiler if that has nothing to do with anything. Thanks & BR -Matti

    Read the article

  • Determine if javascript has completed.

    - by Duracell
    My question is somewhat similar to this one. We want to know if there's a way to determine if all javascript has completed (so no javascript is running). We have a lot of stuff that runs on a timeout after the page's onload event, so even after the page is loading, stuff could be happening for a few seconds. For a whole bunch of reasons, mostly relating to requirements from management, we need to know when all of these scripts have finished running. There's an arbitrary number of them so a general solution would be great.

    Read the article

  • Security of PHP script, embedded or otherwise

    - by typoknig
    Hi all, I am curious about the security of PHP on an HTML webpage where PHP code is embedded (a webpage that would exist on the server as "webpage.php") or on a PHP script that may be referenced by an HTML page (that is, a PHP script that is not actually part of a webpage that exists on the server as "something.php" and is referenced by "webpage.html"). Getting to the point, let us say that if the source code of my PHP script is known by anyone it would be a very big problem. I know that when you view the source of a PHP page in a browser the PHP script is not shown, but what if the PHP server failed and the HTML still loaded (is this even possible), would a user be able to see the PHP script? To be more general, is there ANY possible way that a user could access the source of a PHP script from a web browser, and if so, how do I prevent it?

    Read the article

  • Do you use another language instead of english ?

    - by Luc M
    Duplicate Should identifiers and comments be always in English or in the native language of the application and developers? For people who are not native English speakers, which language do you use to declare variables, classes, etc. ? I had to continue a project from a Spanish guy. Everything was written in Spanish. Since this time, I have decided to use English identifiers ( variables, classes, file names) and write comments in french. Everything was in french before that. What are the general recommendations about that practice? Do you use English everywhere knowing that no English people will work on your project ? Edit : Here's a post from Jeff Atwood about this subject: The Ugly American Programmer

    Read the article

  • How can open source projects obtain license for commercial software without spending a lot of money?

    - by Ikaso
    I just joined an open source project on codeplex. The project is based on the .NET compact framework. So the development tool is Visual Studio. Currently I am using some trial version of Visual Studio which is going to end and I wondered how can I obtain a valid license to work on the project without spending a lot of money. Please pay attention that the Express edition does not help me since my application is running on Windows Mobile 6.5 which is not supported on the Express edition (and the 2010 Express edition supports only Windows Mobile Phone 7 series development). In the general sense, are there some organizations that donate software licenses for open source projects?

    Read the article

  • Java and Different Types of Stacks

    - by Rarge
    Currently the only stack I know anything about is Vector, I normally use this in place of an array but I understand that there is other types of stacks and they all suit different jobs. The project I am currently working on requires me to be inserting objects in a certain position inside a stack, not always the front of the stack and I am under the impression that a Vector may not be the best class for this job. Could somebody please give me a brief description of the other types of stacks available to me with the Java language and their advantages and disadvantages? Are these names homogeneous? E.g. Are they only used in the Java language or are they used as general terms in Computer Science? Thank you

    Read the article

  • Validating call to web service against schema before sending request

    - by Cen
    I am calling a web service (written in Java) in my web app. I use the WSDL to generate proxy classes using the wsdl.exe command line tool. Everything is working fine. However, I have found out that the web service is not doing any data validation at all when they receive a request from my app. Hence, if I happen to send one minute piece of data that isn't exactly what they want, I receive a general fault error in return, with no specifics at all of what the incorrect (if any) piece of data is. So, before I make the request, I'd like to validate my request against the schema they have provided. Is this possible, and if so, how do I go about this? Thanks in advance

    Read the article

  • Is concatenating with an empty string to do a string conversion really that bad?

    - by polygenelubricants
    Let's say I have two char variables, and later on I want to concatenate them into a string. This is how I would do it: char c1, c2; // ... String s = "" + c1 + c2; I've seen people who say that the "" + "trick" is "ugly", etc, and that you should use String.valueOf or Character.toString instead. I prefer this construct because: I prefer using language feature instead of API call if possible In general, isn't the language usually more stable than the API? If language feature only hides API call, then even stronger reason to prefer it! More abstract! Hiding is good! I like that the c1 and c2 are visually on the same level String.valueOf(c1) + c2 suggests something is special about c1 It's shorter. Is there really a good argument why String.valueOf or Character.toString is preferrable to "" +? Trivia: in java.lang.AssertionError, the following line appears 7 times, each with a different type: this("" + detailMessage);

    Read the article

  • In which controller do you put the CRUD for the child part of a relationship?

    - by uriDium
    I am using ASP.Net MVC but this probably applies to all MVC patterns in general. My problem, for example I have companies and in each company I have a list of contacts. When I have selected a company I can see its details and a list of the contacts for that company. When I want to add a new contact for that company, should the implementation of that action go into the company controller as an "AddContact" action or should it go into the contact controller into a "New" action and we pass the Company ID in the URL? What is the usual way of dealing with this sort of thing in ASP.Net MVC? Is there a better stategy?

    Read the article

  • Dynamic binding in C++

    - by chmike
    I'm implementing a CORBA like server. Each class has remotely callable methods and a dispatch method with two possible input, a string identifying the method or an integer which would be the index of the method in a table. A mapping of the string to the corresponding integer would be implemented by a map. The caller would send the string on the first call and get back the integer with the response so that it simply has to send the integer on subsequent calls. It is just a small optimization. The integer may be assigned dynamically on demand by the server object. The server class may be derived from another class with overridden virtual methods. What could be a simple and general way to define the method binding and the dispatch method ?

    Read the article

  • Secure password transmission over unencrypted tcp/ip

    - by academicRobot
    I'm in the designing stages of a custom tcp/ip protocol for mobile client-server communication. When not required (data is not sensitive), I'd like to avoid using SSL for overhead reasons (both in handshake latency and conserving cycles). My question is, what is the best practices way of transmitting authentication information over an unencrypted connection? Currently, I'm liking SRP or J-PAKE (they generate secure session tokens, are hash/salt friendly, and allow kicking into TLS when necessary), which I believe are both implemented in OpenSSL. However, I am a bit wary since I don't see many people using these algorithms for this purpose. Would also appreciate pointers to any materials discussing this topic in general, since I had trouble finding any.

    Read the article

  • Mac OS X: Best way to do runtime check for retina display?

    - by Todd Ditchendorf
    Given a Cocoa application which runs on Mac OS X 10.7 and later: What is the best way to check, at runtime, if your app is currently running on a Mac with at least one retina display attached? If checking for this sort of thing is just really wrong-headed, I fully welcome a well-reasoned explanation of why. But I'd still like to know :). It seems likely you could just do a check specifically for the new Mac Book Pro "Retina" hardware (the only Mac at this time which currently has a retina display), but ideally, I'd really prefer a more general/generic/future-proof way to check than this. Ideally, I'd like to know how to detect the retina display, not the specific Mac model which currently happens to ship with a retina display.

    Read the article

  • Sphinx: change column set for searching in runtime

    - by Fedyashev Nikita
    I use Ultrasphinx gem plugin as a wrapper for accessing Sphinx search daemon. My model declaration: class Foo < ActiveRecord::Base is_indexed :fields => ['content', 'private_notes', 'user_id'] Client code: filters = {} if type == "private" # search only in `content` column filters['user_id'] = current_user.id else # search in `content` and `private_notes` columns end results = Ultrasphinx::Search.new(:query => params[:query], :per_page => 20, :page => params[:page] || 1, :filters => filters) The problem I have now with Ultrasphinx gem(or Sphinx, in general?) is that it does not allow me to change set of fields where to look for matches IN RUNTIME How can I solve this problem?

    Read the article

  • Choosing between assembler and COBOL

    - by Azares Cob
    I have to rewrite and greatly modify parts of a legacy COBOL application. The COBOL source-code is available (around 100.000 lines of copy & pasted code mixed with GOTOs). Some more details on the system: It is a general management system controlling transactions, bank management, customer data and employees of the company I work for. The COBOL-powered database is about 4 Terabytes distributed over 50 old HDDs. (But messing around with them is the sysadmins job) They are using COBOL85 only. Now I have two options: Rewrite and refactor 50% of the old COBOL system, or use X86 assembly. Should I use X86 assembler or COBOL?

    Read the article

  • Getting a "summary" of a webpage

    - by MattiasK
    I have something of a a hairy problem, I'd like to generate a couple of paragraphs of "description" of a given url, normally the start of an article. The Meta description field is one way to go but it isn't always good or set properly. It's fair to say it's a bit problematic to accomplish this from the screenscraped HTML. I had a general idea that perhaps one could scan the HTML for the first "appropriate" segment but it's hard to say what that is, perhaps something like the first paragraph containing a certain amount of text... Anyone have any good ideas? :) It doesn't have to be foolproof

    Read the article

  • rewrite image URLs

    - by Don
    Hi, I'm writing a Maven plugin that merges CSS files together. So all the CSS files that match /foo/bar/*.css might get merged to /foo/merged.css. A concern is that in a file such as /foo/bar/baz.css there might be a property such as: background: url("images/pic.jpg") So when the file is merged into /foo/merged.css this will need to be changed to background: url("bar/images/pic.jpg") The recalculated URL obviously depends on 3 factors: original URL original CSS file location merged CSS file location Assuming that the original and merged CSS files are both on the same filesystem, is there a general formula (or Java library) that can be used to calculate the new url given these 3 inputs? Thanks, Don

    Read the article

  • How to enforce a site-wide license?

    - by Roy Tang
    We have a small .Net program that we sell with individual licenses. The individual licenses are enforced by registering a key file that is generated using information from the machine used to install the program (MAC address, etc.) Now, we have a customer request for a site-wide license, such that they can deploy to as many machines on their site as possible. From the technical POV I'm not sure what are the usual approaches for this; our old approach won't work since we can't map the license to any machine-specific information. Any suggestions? A few more details: the program is a client-side program that includes an Office Add-In the machines to be installed on may or may not have internet access we aren't restricted to .Net-only approaches, I'm just looking for a general idea of how this sort of thing is usually handled

    Read the article

  • "Socket operation on non-socket" error due to strange sytax

    - by Robert S. Barnes
    I ran across the error Socket operation on non-socket in some of my networking code when calling connect and spent a lot of time trying to figure out what was causing it. I finally figured out that the following line of code was causing the problem: if ((sockfd = socket( ai->ai_family, ai->ai_socktype, ai->ai_protocol) < 0)) { See the problem? Here's what the line should look like: if ((sockfd = socket( ai->ai_family, ai->ai_socktype, ai->ai_protocol)) < 0) { What I don't understand is why the first, incorrect line doesn't produce a warning. To put it another way, shouldn't the general form: if ( foo = bar() < baz ) do_somthing(); look odd to the compiler, especially running with g++ -Wall -Wextra? If not, shouldn't it at least show up as "bad style" to cppcheck, which I'm also running as part of my compile?

    Read the article

  • Future of web services

    - by Landon Ashes
    I want to know what are the possible Future research areas Regarding "Web Services" and in what direction "Web Services" are moving. I am not talking about "Microsoft Web Services". I am talking about "Web Services" in general. I did google but what ever i found was like couple of years old and obsolete. couldnt get any direction from IEEE too. Plz some expert of this line should guide me. I will be obliged like anything. Thanks in Advance.

    Read the article

  • Do I have to store a TcpClient even though I only care about its stream?

    - by mafutrct
    A new instance of a TcpClient connects to a remote host. Its NetworkStream is retrieved and stored. Do I have to store the TcpClient itself as well to make sure it is not garbage collected? In case you're going to answer "You have to store it to be able to dispose it": In my specific case, the TcpClient is usually living for a long time (app lifetime), so disposing it is not really a must. However, I agree that, in general, it has to be stored just to be able to call Dispose.

    Read the article

< Previous Page | 206 207 208 209 210 211 212 213 214 215 216 217  | Next Page >