Search Results

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

Page 203/327 | < Previous Page | 199 200 201 202 203 204 205 206 207 208 209 210  | Next Page >

  • Code to find nth largest number in an array

    - by user136104
    I have written following code in perl #!/usr/bin/perl @array = (3,6,8,1,2); my $second_largest = 0; my $largest = 0; for (@array) { if($_ > $largest) { $second_largest = $largest; $largest = $_; } if($_ > $second_largest && $_ < $largest) { $second_largest = $_; } } print "Second largest::".$second_largest; print "largest::".$largest; But I need a general code to find out "Nth" largest and smallest number of an array Please help me

    Read the article

  • Fastest way of converting a quad to a triangle strip?

    - by Tina Brooks
    What is the fastest way of converting a quadrilateral (made up of foyr x,y points) to a triangle strip? I'm well aware of the general triangulation algorithms that exist, but I need a short, well optimized algorithm that deals with quadrilaterals only. My current algorithm does this, which works for most quads but still gets the points mixed up for some: #define fp(f) bounds.p##f /* Sort four points in ascending order by their Y values */ point_sort4_y(&fp(1), &fp(2), &fp(3), &fp(4)); /* Bottom two */ if (fminf(-fp(1).x, -fp(2).x) == -fp(2).x) { out_quad.p1 = fp(2); out_quad.p2 = fp(1); } else { out_quad.p1 = fp(1); out_quad.p2 = fp(2); } /* Top two */ if (fminf(-fp(3).x, -fp(4).x) == -fp(3).x) { out_quad.p3 = fp(3); out_quad.p4 = fp(4); } else { out_quad.p3 = fp(4); out_quad.p4 = fp(3); }

    Read the article

  • make: invoke command for multiple targets of multiple files?

    - by marvin2k
    Hi, I looking to optimize an existing Makefile. It's used to create multiple plots (using Octave) for every logfile in a given directory using an scriptfile for every plot which takes a logfilename as an argument. In the Moment, I use one single rule for every kind of plot available, with a handwritten call to Octave, giving the specific scriptfile/logfile as an argument. It would be nice, if every plot has "his" octave-script as a dependency (plus the logfile, of course), so only one plot is regenerated if his script is changed. Since I don't want to type that much, I wonder how I can simplifiy this by using only one general rule to build "a" plot? To make it clearer: Logfile: "$(LOGNAME).log" Scriptfile: "plot$(PLOTNAME).m" creates "$(LOGNAME)_$(PLOTNAME).png" The first thing I had in mind: %1_%2.png: %1.log $(OCTAVE) --eval "plot$<2('$<1')" But this seems not to be allowed. Could someone give me a hint?

    Read the article

  • Problems crossing the boundary between protected greasemonkey execution space and the unsafeWindow l

    - by Chilly
    Hi guys. Here is my problem: I've registered some callbacks into a Yahoo event driven webpage (betfair.com market views) and am trapping the betsPlaced events with a handler. So far so simple. Next stage is to get the event back into greasemonkey land, and while I know that from greasemoney space you can call unsafeWindow.stuff, there is no reverse operation (by design). So if I want to send the contents of the event over, say, a cometd queue, my carefully set up jquery, greasemonkey, YUI2, betfair environment fails by telling me that unsafeWindow processes cant call GM_ajax stuff. This is obviously safe and sane, but it basically stops me doing what I want to do. Has anyone tried doing this (ignore the cometd stuff, just general ajax calls) and succeeded? I've had a look at pages like this: http://wiki.greasespot.net/0.7.20080121.0%2B_compatibility but it doesnt appear to work for all the calls.

    Read the article

  • In Javascript, by what mechanism does setting an Image src property trigger an image load?

    - by brainjam
    One of the things you learn early on when manipulating a DOM using Javascript is the following pattern: var img = new Image(); // Create new Image object img.onload = function(){ // execute drawImage statements here } img.src = 'myImage.png'; // Set source path As far as I know, in general when you set an object property there are no side effects. So what is the mechanism for triggering an image load? Is it just magic? Or can I use a similar mechanism to implement a class Foo that supports a parallel pattern? var foo = new Foo(); // Create new object foo.barchanged = function(){ // execute something after side effect has completed } foo.bar = 'whatever'; // Assign something to 'bar' property I'm vaguely aware of Javascript getters and setters. Is this how Image.src triggers a load?

    Read the article

  • Straight Java/Groovy versus ETL tool (Talend/etc) - what libraries would you use?

    - by Alex R
    Assume you have a small project which on the surface looks like a good match for an ETL tool like Talend. But assume further, that you have never used Talend and furthermore, you do not trust "visual programming" tools in general and would rather code everything the old fashioned way (text on a nice IDE!) with the help of an appropriate language & support libraries. What are some language patterns & support libraries that could help you stay away from the ETL tool temptation/trap?

    Read the article

  • netbeans + hibernate for java swing application

    - by blow
    Hi all, im developing a java swing app and i would use hibernate for persistance. Im totally new in jpa, hibernate and ORM in general. Im follow this tutorial, its easy but the problem is the java class that descrive a table in db are made from the table with reverse enginering. I want do the opposite process: i want make db table from the java class. The question is, how can i do this with netbeans? There are some tutorial?

    Read the article

  • System_Daemon and shell_exec

    - by Jesse
    Hey Everyone, I've set up a daemon (daemon.php) using PEAR's System_Daemon which waits for something to appear in the database. Once something is there, the daemon gets enough information and sends it out to another script (execute.php) using the shell_exec command this way I'm not worried about waiting for a response and holding up the daemon. Both of the scripts work fine alone and I'm even able to call shell_exec before calling System_Daemon::start(); . However, if I trying calling it AFTER System_Daemon::start();, then I get an Access Denied only when outputting to a file. I'm still new to Daemons in general, so any ideas or thoughts would be great! Thanks Guys!

    Read the article

  • Accessing typedef from the instance

    - by piotr
    As in stl containers, why can't we access a typedef inside the class from the class instance? Is there a particular insight into this? When value_type was a template parameter it could help making more general code if there wasn't the need to specify the template parameters as in vector::value_type Example: class T { public: typedef int value_type; value_type i; }; T t; T::value_type i; // ok t.value_type i; // won't work

    Read the article

  • In what specific areas has F# proven more applicable than C#?

    - by Peter McGrattan
    Over the last few years F# has evolved into one of Microsoft's fully supported languages employing many ideas incubated in OCaml, ML and Haskell. Over the last several years C# has extended it's general purpose features by introducing more and more functional language features: LINQ (list comprehension), Lamdas, Closures, Anonymous Delegates and more... Given C#'s adoption of these functional features and F#'s taxonomy as an impure functional language (it allows YOU to access framework libraries or change shared state when a function is called if you want to) there is a strong similarity between the two languages although each has it's own polar opposite primary emphasis. I'm interested in any successful models employing these two languages in your production polyglot programs and also the areas within production software (web apps, client apps, server apps) you have written in F# in the past year or so that you would previously have written in C#. EDIT: Altered title with the intent of reducing perceived ambiguity.

    Read the article

  • Getting started with learning the Rails source

    - by japancheese
    Hello, I've been using Ruby on Rails for many projects lately, and I thought it would be interesting to take a look at the Rails source and really see how things operate underneath. I think it'd be a great learning experience and would probably enhance the way I code Rails apps all the more. Does anyone have any tips on how to get started? And where within the Rails source does an application begin to be executed? Perhaps if I started there, I could see how everything is loaded and works in general.

    Read the article

  • What to see in India as a developer and student

    - by lasseespeholt
    Hi, I'm planning a trip to India around July-August. And I want to hear Indian developers or developers traveled to India if there are something interesting to see in India (around Bombay) for developers in general. Maybe a conference etc. I have looked at http://www.conferencealerts.com/computing.htm I have studied computer science in a year now but have been a spare time and independent developer for some years now. Furthermore, I have tried finding summer courses but that is properly too late now and computer science summer courses is hard to find in India. Best regards, Lasse Espeholt

    Read the article

  • Converting a constantly changing scalar value to a changing interval or frequency

    - by eco_bach
    Although I'm coding in Objective C, this is more of a general programming question. What is the best way to convert a constantly changing scalar value to a changing interval or frequency? Right now every time the scalar value changes I am destroying the NSInterval ie [self.myTimer invalidate]; self.myTimer = nil; and creating a new one, but this seems like a VERY expensive way to achieve my goal, since the changing scalar value in my case represents the horizontal velocity of a swipe. For a rough analogy, think of the speed of a swipe being reflected in a visual metronome, the faster you swipe, the higher(shorter interval) the frequency of the metronome.

    Read the article

  • linq "let" translation

    - by luke
    I understand that when the C# compiler sees a linq query comprehension, it basically does a straight translation to the corresponding Linq Extension methods and lambdas. i.e. from x in list select x.property gets translated to: list.Select(x => x.property) my question is what do let clauses get translated to. for example how would this get translated by the compiler. from x in list let v = SomeComplexExpressionDependingOnx select v (p.s. i know this could be reduced to just select SomeComplexExpressionDependingOnx but i want to know how this is done in general) Thanks!

    Read the article

  • Passing a template func. as a func. ptr to an overloaded func. - is there a way to compile this code

    - by LoudNPossiblyRight
    Just a general c++ curiosity: This code below shouldn't compile because it's impossible to know which to instantiate: temp(const int&) or temp(const string&) when calling func(temp) - this part i know. What i would like to know is if there is anything i can do to the line marked PASSINGLINE to get the compiler to deduce that i want FPTR1 called and not FPTR2 ? #include<iostream> using std::cout; using std::endl; /*FPTR1*/ void func(void(*fptr)(const int&)){ fptr(1001001);} /*FPTR2*/ void func(void(*fptr)(const string&)){ fptr("1001001"); } template <typename T> void temp(const T &t){ cout << t << endl; } int main(){ /*PASSINGLINE*/ func(temp); return 0; } Thank you.

    Read the article

  • Difficulty determining the file type of text database file

    - by Joseph Silvashy
    So the USDA has some weird database of general nutrition facts about food, and well naturally we're going to steal it for use in our app. But anyhow the format of the lines is like the following: ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 ~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 ~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 ~01004~^~0100~^~Cheese, blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 With those odd ~ and ^ separating the values, It also lacks a header row but thats ok, I can figure that out from the other stuff on their site: http://www.ars.usda.gov/Services/docs.htm?docid=8964 Any help would be great! If it matters we're making an open/free API with Ruby to query this data. Additionally I'm having a tough time posing this question so I've made it a community wiki so we can all pitch in!

    Read the article

  • What is the "task" in twitter Storm parallelism

    - by John Wang
    I'm trying to learn twitter storm by following the great article "Understanding the parallelism of a Storm topology" However I'm a bit confused by the concept of "task". Is a task an running instance of the component(spout or bolt) ? A executor having multiple tasks actually is saying the same component is executed for multiple times by the executor, am I correct ? Moreover in a general parallelism sense, Storm will spawn a dedicated thread(executor) for a spout or bolt, but what is contributed to the parallelism by an executor(thread) having multiple tasks ? I think having multiple tasks in a thread, since a thread executes sequentially, only make the thread a kind of "cached" resource, which avoids spawning new thread for next task run. Am I correct? I may clear those confusion by myself after taking more time to investigate, but you know, we both love stackoverflow ;-) Thanks in advance.

    Read the article

  • Validation errors from Google App Engine Logout link

    - by goggin13
    I am making a web page using the Google App Engine. I am validating my pages, and found that the logout link that is generated by the call to the users api (in python) users.create_logout_url(request.uri) does not validate as XHTML 1.0 Strict. The href in the anchor tag looks like this: /_ah/login?continue=http%3A//localhost%3A8080/&action=Logout Including a link with this anchor text throws three different validation errors: *general entity "action" not defined and no default entity *reference to entity "action" for which no system identifier could be generated *EntityRef: expecting ';' Here is a dummy page with the anchor tag in it, if you want to try it on w3c validator.Dummy Page. The logout link wont work, but you can see how the page is valid without it, but the actual text inside the href tag breaks the validation. Any thoughts on whats going on? Thank you!

    Read the article

  • Php/ODBC encoding problem

    - by JohnM2
    I use ODBC to connect to SQL Server from PHP. In PHP I read some string (nvarchar column) data from SQL Server and then want to insert it to mysql database. When I try to insert such value to mysql database table I get this mysql error: Incorrect string value: '\xB3\xB9ow...' for column 'name' at row 1 For string with all ASCII characters everything is fine, the problem occurs when non-ASCII characters (from some European languages) exist. So, in more general terms: there is a Unicode string in MS SQL Server database, which is retrieved by PHP trough ODBC. Then it is put in sql insert query (as value for utf-8 varchar column) which is executed for mysql database. Can someone explain to me what is happening in this situation in terms of encoding? At which step what character encoding convertions may take place? I use: PHP 5.2.5, MySQL5.0.45-community-nt, MS Sql Server 2005.

    Read the article

  • Content pulled in via jQuery AJAX is not associating with previous functions

    - by Jarsen
    I'm using the jquery .load() function to pull in data to populate a div with. The content I'm pulling in has CSS selectors that should match up with jQuery click functions I've written. However, when I load in the data, although the correct CSS selectors are there, when I click on areas that should invoke a response from jQuery, nothing happens. Do I need to do some sort of reload? Here's the code I've got for the jQuery AJAX: $(document).ready(function() { // AJAX functionality for drupal nodes $(".ajax_node").click(function() { var ajax_src = $(this).attr("href"); // we're gonna load the href // empty target div and load in content // the space in the string before the #id is necessary $("#ajax_area").empty().load(ajax_src + " #ajax_wrapper"); return false; // stops the link from following through }); // General AJAX fucntionality $(".ajax").click(function() { var ajax_src = $(this).attr("href"); $("#ajax_area").empty().load(ajax_src); return false; }); });

    Read the article

  • Selecting items from events, as evenly spaced as possible

    - by Matt Warren
    If I have an event that happens 15 times a second (numbered 1 - 15), but I only want to process it 3 times I can choose [1], [6] and [11],. It's important that the events I process are as evenly spaced as possible and take into account wrap-around, i.e. the events are continuous 13, 14, 15, 1, 2, 3 etc. If I want 4 items the best I can do is [1], [5], [9] & [13]. Is there a general algorithm that will calculate which events I need to process given the total number of events (total) and the number to process (processAmount).

    Read the article

  • Does CLOS have an eql specialization dispatch on strings?

    - by mhb
    Examples of what you can do. (defmethod some-fn ((num real)) (print "an integer")) (defmethod some-fn ((num real)) (print "a real")) (defmethod some-fn ((num (eql 0))) (print "zero")) (some-fn 19323923198319) "an integer" (some-fn 19323923198319.3) "a real" (some-fn 0) "zero" It also works with a general 'string type. (defmethod some-fn ((num string)) (print "a string")) (some-fn "asrt") "a string" Not with a specific string, however (defmethod some-fn ((num (eql "A")) (print "a specifict string"))) => doesn't compile I imagine it doesn't work because eql does not work on strings in the way that would be necessary for it to work. (eql "a" "a") => nil Is there a way to do it?

    Read the article

  • How to model dependency injection in UML ?

    - by hjo1620
    I have a Contract class. The contract is valid 1 Jan 2010 - 31 Dec 2010. It can be in state Active or Passive, depending on which date I ask the instance for it's state. ex. if I ask 4 July 2010, it's in state Active, but if I ask 1 Jan 2011, it's in state Passive. Instances are created using constructor dependency injection, i.e. they are either Active or Passive already when created, null is not allowed as a parameter for the internal state member. One initial/created vertex is drawn in UML. I have two arrows, leading out from the initial vertex, one leading to state Active and the other to state Passive. Is this a correct representation of dependency injection in UML ? This is related to http://stackoverflow.com/questions/2779922/how-model-statemachine-when-state-is-dependent-on-a-function which initiated the question on how to model DI in general, in UML.

    Read the article

  • How to distinguish properties from constants if they both use PascalCasing for naming?

    - by Gishu
    As stated in the framework design guidelines and the WWW in general, the current guideline is to name your constants like this LastTemplateIndex as opposed to LAST_TEMPLATE_INDEX With the PascalCasing approach, how do you differentiate between a Property and a Constant. ErrorCodes.ServerDown is fine. But what about private constants within your class ? I use quite a lot of them for naming magic numbers.. or for expected values in my unit tests and so on. The ALL_CAPS style helps me know that it is a constant . _testApp.SelectTemplate(LAST_TEMPLATE_INDEX); *Disclosure: I have been using the SCREAMING_CAPS style for a while for constants + I find it more readable than squishedTogetherPascalCasedName. It actually STANDS_OUT in a block of text*

    Read the article

  • Running .NET app from network share in Win 7?

    - by schooner
    We have a .NET 1.1 application that we keep on a netowork share. We install the .NET Framerwork to the local PCs and also set the full trust via the following: %windir%\Microsoft.NET\Framework\v1.1.4322\caspol -pp off -cg LocalIntranet_Zone FullTrust This has worked fine on all PCs to date however now we have a few new PCs with Win7 and the process no longer is working. The app will run fine from a local drive in Win7 but running the networked copy results in a general exception error. Any ideas on how to get this to work under Win7?

    Read the article

< Previous Page | 199 200 201 202 203 204 205 206 207 208 209 210  | Next Page >