Search Results

Search found 249 results on 10 pages for 'lucas'.

Page 8/10 | < Previous Page | 4 5 6 7 8 9 10  | Next Page >

  • Manually setting object's position or have the object do it all?

    - by N. Lucas
    I'm stuck thinking about the best way to go about setting a line segment's position, I have a class Line(length, angle, previous) being called from a class Polygon.. Right now I have: public function Line(length:Number, angle:Number, previous:Line = null) { if (previous != null) { this.x = previous.end.x; this.y = previous.end.y; } /**/ } Now, is this the best practice or should I be doing: Polygon.addLine(length:Number, angle:Number):void { var previous = _line[_line.length - 1]; // Array containing all Lines var line:Line = new Line(length, angle, previous); line.x = previous.end.x; line.y = previous.end.y; /**/ }

    Read the article

  • A generic C++ library that provides QtConcurrent functionality?

    - by Lucas
    QtConcurrent is awesome. I'll let the Qt docs speak for themselves: QtConcurrent includes functional programming style APIs for parallel list processing, including a MapReduce and FilterReduce implementation for shared-memory (non-distributed) systems, and classes for managing asynchronous computations in GUI applications. For instance, you give QtConcurrent::map() an iterable sequence and a function that accepts items of the type stored in the sequence, and that function is applied to all the items in the collection. This is done in a multi-threaded manner, with a thread pool equal to the number of logical CPU's on the system. There are plenty of other function in QtConcurrent, like filter(), filteredReduced() etc. The standard CompSci map/reduce functions and the like. I'm totally in love with this, but I'm starting work on an OSS project that will not be using the Qt framework. It's a library, and I don't want to force others to depend on such a large framework like Qt. I'm trying to keep external dependencies to a minimum (it's the decent thing to do). I'm looking for a generic C++ framework that provides me with the same/similar high-level primitives that QtConcurrent does. AFAIK boost has nothing like this (I may be wrong though). boost::thread is very low-level compared to what I'm looking for. I know C# has something very similar with their Parallel Extensions so I know this isn't a Qt-only idea. What do you suggest I use?

    Read the article

  • How to install ASP.NET MVC 2 templates after already installing VS Web Dev 2010 first?

    - by Lucas McCoy
    First off these questions are related but do not fix my problem: http://stackoverflow.com/questions/2499934/ http://stackoverflow.com/questions/652836/ I have installed Visual Studio Web Developer Express Edition 2010, then I installed MVC 2. Now I can successfully run a MVC 2 application, however I have to do the manual imports of the namespaces and stuff. How can I install the templates?

    Read the article

  • A good F# codebase to learn from

    - by Lucas
    Hi all, I've been teaching myself F# for a while now. I've read Programming F# by Chris Smith (great book) and I've written a few small scripts for getting the job done here and there. But IMO the best way to learn a new programming language—and more importantly, the idioms that come with it—is to read a good open source codebase written in that language. Naturally, writing code in that language is crucial, but in the beginning, you're basically struggling with your own ignorance about how things should be done. You could perform certain tasks one way or the other, but it takes experience to realize the flaws and virtues of each. Even after you've gotten a firm grasp of how things work, reading the code of people who have an even firmer one helps a great deal. Most would agree that the most insightful parts of any learn-a-programming-language book are the code examples, and reading a well-written open source codebase is the next level of that. So are there any out there for F#?

    Read the article

  • Sharing NSMutableArray

    - by Lucas Veiga
    Hey everbody, im trying to share a NSMutableArray to another xib. The cartList.codigo is a NSMutableArray from a shared class, according to James Brannan's tutorial (http://www.vimeo.com/12164589). When i count it, it gives me 1. But when i load the another view, gives me 0. Whats wrong? View that adds: self.produtoCodigo = [[NSMutableArray alloc]init]; [self.produtoCodigo addObject:@"aa"]; CartViewController *carrinho = [[CartViewController alloc] initWithNibName:@"CartViewController" bundle:[NSBundle mainBundle]]; CartList *lista = [[CartList alloc] init]; carrinho.cartList = lista; carrinho.cartList.codigo = self.produtoCodigo; NSLog(@"QTD %i", [carrinho.cartList.codigo count]); View that wants to load the item added: - (void) viewDidAppear:(BOOL)animated { self.produtoCodigo = self.cartList.codigo; NSLog(@"%i", [self.produtoCodigo count]); [super viewDidLoad]; } Im loading the CartList class in both. Thanks!

    Read the article

  • redirection follow by post

    - by lucas
    hi, just wonder how those air ticket booking website redirect the user to the airline booking website and then fill up(i suppose doing POST) the required information so that the users will land on the booking page with origin/destination/date selected? Is the technique used is to open up new browser window and do a ajax POST from there? Thanks.

    Read the article

  • How do I simplify these NUNit tests?

    - by Lucas Meijer
    These three tests are identical, except that they use a different static function to create a StartInfo instance. I have this pattern coming up all trough my testcode, and would love to be be able to simplify this using [TestCase], or any other way that reduces boilerplate code. To the best of my knowledge I'm not allowed to use a delegate as a [TestCase] argument, and I'm hoping people here have creative ideas on how to make the code below more terse. [Test] public void ResponseHeadersWorkinPlatform1() { DoResponseHeadersWorkTest(Platform1StartInfo.CreateOneRunning); } [Test] public void ResponseHeadersWorkinPlatform2() { DoResponseHeadersWorkTest(Platform2StartInfo.CreateOneRunning); } [Test] public void ResponseHeadersWorkinPlatform3() { DoResponseHeadersWorkTest(Platform3StartInfo.CreateOneRunning); } void DoResponseHeadersWorkTest(Func<ScriptResource,StartInfo> startInfoCreator) { ScriptResource sr = ScriptResource.Default; var process = startInfoCreator(sr).Start(); //assert some things here }

    Read the article

  • C++ stl collections or linked lists

    - by Lucas
    I'm developing a OpenGL based simulation in C++. I'm optmizing my code now and i see throughout the code the frequently use of std:list and std:vector. What is the more performatic: to continue using C++ stl data structs or a pointer based linked list? The main operation that involve std::list and std::vector is open a iterator and loop through all items in the data structs and apply some processing

    Read the article

  • How can i get the entire HTML of an element using regex?

    - by Lucas
    Hello, i'm learning Regex but can't figure it out.... i want to get the entire HTML from a DIV, how to procced? already tried this; /\< td class=\"desc1\"\>(.+)/i it returns; Array ( [0] => < td class="desc1"> [1] => ) the code that i'm matching is this; <table id="profile" cellpadding="1" cellspacing="1"> <thead> <tr> <th colspan="2">Jogador TheInFEcT </th> </tr> <tr> <td>Detalhes</td> <td>Descrição:</td> </tr> </thead><tbody> <tr> <td class="empty"></td><td class="empty"></td> </tr> <tr> <td class="details"> <table cellpadding="0" cellspacing="0"> <tbody><tr> <th>Classificação</th> <td>11056</td> </tr> <tr> <th>Tribo:</th> <td>Teutões</td> </tr> <tr> <th>Aliança:</th> <td>-</td> </tr> <tr> <th>Aldeias:</th> <td>1</td> </tr> <tr> <th>População:</th> <td>2</td> </tr><tr> <td colspan="2" class="empty"></td> </tr> <tr> <td colspan="2"> <a href="spieler.php?s=1">» Alterar perfil</a></td> </tr> </tbody></table> </td> <td class="desc1"> <div>STATUS: OFNAaaaAA</div> </td> </tr> </tbody> </table> i need to get the entire code inside the < td class="desc1", like that; <div >STATUS: OFNAaaaAA< /div> </td> </tr> </tbody> </table> Could someone help me out? Thanks in advance.

    Read the article

  • Phonegap Android application exiting - but not really - when home button is pressed

    - by Lucas T
    I have created an Phonegap 1.5/Android application. My client reports that, when he leaves the app using the Home button, and then relaunches it using the app icon, the app relaunches from the start instead of resuming. However, when he holds the home button, the app appears in the running apps, and when he accesses the app through this menu, the app resumes in the expected way. I thought this could be linked to the app being automatically closed by the OS due to a lack of memory, but if that was the case the app shouldn't appear in the running apps. I could not reproduce the bug on my Sony Ericsson XPERIA with Android 2.3.4, the client has experienced this behaviour on a Motorola Defy and on another phone (i'll add the reference of the other phone and the OS versions as soon as I get them). The initialization process of the app is declared this way : window.addEventListener('load', function(){ document.addEventListener('deviceready', _onDeviceReady, false); }, false); Could this be fixed by attaching the processes to other events (although I doubt it, the app really seems to be relaunched from the start) ? Is there a declaration to make in the Android Manifest to prevent this behavior ? Is that a known bug in some Android phones/versions ?

    Read the article

  • How to remove "Standard Error" column from xtable() output of an lm on R/RSweave/LaTeX

    - by Lucas Spangher
    I'm currently doing some data analysis on population data, so reporting the standard errors in the tables of parameter coefficients just doesn't really make statistical sense. I've done a fair bit of searching and can't find any way to customize the xtable output to remove it. Can anyone point me in the right direction? Thanks a lot, I didn't post this lightly; if it's something obvious, I apologize for having wasted time!

    Read the article

  • How would you update 100+ variables if something is changed in a different class?

    - by N. Lucas
    I have a class Grid which produces a graph paper like grid on in the drawing area. I then have 5 other classes for different shapes to draw with; Line, Polygon, Ellipse, Curve, Arc Now, these 5 classes use an instance of Grid because Grid has a resolution and a scale. Inside Grid I have: public function set resolution(x:Number):void { _gap = (modBy10(x) / 10); _scale = (modBy10(x) / (this.resolution * _scale)); draw(); } public function get resolution():Number { return (_gap * 10); } public function set scale(x:Number):void { _scale = (this.resolution / x); } public function get scale():Number { return _scale; } /**/ public function scaleLength(x:Number):Number { return (x * this.scale); } public function scaleLengthDown(x:Number):Number { return (x / this.scale); } public function scaleArea(x:Number):Number { return (x / Math.pow(this.scale, 2)); } I'm just lost for a solution on how to update every instance of my 5 drawing classes when Grid is changed. For instance, Polygon is made up of multiple instances of Line, Line(length, angle) where "length" is in either in, ft, cm, or m. If the user wishes to change the scale from say 10ft per 100px resolution.. Is there an easier way than re-drawing every Line inside Polygon?

    Read the article

  • Ignoring "Content is not allowed in trailing section" SAXException

    - by Paul J. Lucas
    I'm using Java's DocumentBuilder.parse(InputStream) to parse an XML document. Occasionally, I get malformed XML documents in that there is extra junk after the final > that causes a SAXException: Content is not allowed in trailing section. (In the cases I've seen, the junk is simply one or more null bytes.) I don't care what's after the final >. Is there an easy way to parse an entire XML document in Java and have it ignore any trailing junk? Note that by "ignore" I don't simply mean to catch and ignore the exception: I mean to ignore the trailing junk, throw no exception, and to return the Document object since the XML up to an including the final > is valid.

    Read the article

  • Why PHP (script) serves more requests than CGI (compiled)?

    - by Lucas Batistussi
    I developed the following CGI script and run on Apache 2 (http://localhost/test.chtml). I did same script in PHP (http://localhost/verifica.php). Later I performed Apache benchmark using Apache Benchmark tool. The results are showed in images. include #include <stdlib.h> int main(void) { printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1",13,10); printf("<TITLE>Multiplication results</TITLE>\n"); printf("<H3>Multiplication results</H3>\n"); return 0; } Someone can explain me why PHP serves more requests than CGI script?

    Read the article

  • Exporting ActiveRecord objects into POROs

    - by Lucas d. Prim
    Hello, I'm developing a "script generator" to automatize some processes at work. It has a Rails application running on a server that stores all data needed to make the script and generates the script itself at the end of the process. The problem I am having is how to export the data from the ActiveRecord format to Plain Old Ruby Objects (POROs) so I can deal with them in my script with no database support and a pure-ruby implementation. I tought about YAML, CSV or something like this to export the data but it would be a painful process to update these structures if the process changes. Is there a simpler way? Ty!

    Read the article

  • Apache/PHP is determined to serve the wrong file

    - by Lucas
    I have a page that is called with a url like http://testserver/path/to/foo/bar/ but apache is serving the wrong file altogether. /path/to/ is a real directory where all the code and .htaccess file is. foo/bar/ is supposed to redirect to foo_bar.php with a RewriteRule, but it never gets there. It's not a mod_rewrite issue as I have commented out all the rules that could be interfering, which should give me 404s for that request, but the same problem occurs: the file that is served is /path/to/foo.php, so in it I var_dump $_SERVER and get: REQUEST_URI = /path/to/foo/bar/ SCRIPT_NAME = /path/to/foo.php SCRIPT_FILENAME = /real/path/to/foo.php PATH_INFO = /bar/ PATH_TRANSLATED = /real/bar/ PHP_SELF = /path/to/foo.php/bar/ Why is this request being routed to this file at all?

    Read the article

  • MySQL Limiting a query to one consistent value

    - by Lucas Matos
    My current query returns a table like: +------------+ value1 | .... value1 | .... value2 | .... value3 | .... +------------+ I want: +------------+ value1 | .... value1 | .... +------------+ I want to only receive all rows with the first value. Normally I would do a WHERE clause if I knew that value, and I cannot use a LIMIT because each value has a different number of rows. Right now My query looks like "SELECT u.*, n.something, w.* FROM ... AS u, ... AS n, ... AS w WHERE u.id = n.id AND w.val = n.val AND u.desc LIKE '%GET REQUEST VARIABLE%';" This works great, except I get way too many rows and using PHP to do this ruins code portability and is superfluous. Thanks for reading

    Read the article

  • Parsing a string representing a float *with an exponent* in Python

    - by Lucas
    Hi, I have a large file with numbers in the form of 6,52353753563E-7. So there's an exponent in that string. float() dies on this. While I could write custom code to pre-process the string into something float() can eat, I'm looking for the pythonic way of converting these into a float (something like a format string passed somewhere). I must say I'm surprised float() can't handle strings with such an exponent, this is pretty common stuff. I'm using python 2.6, but 3.1 is an option if need be.

    Read the article

  • Hidden input text submit with jquery

    - by Lucas Silva de Freitas
    I have a javascript var that returns the value of a input text named "pro_barras", with the value of "pro_barras" I need to make a search in my database without submiting the page. I can't use a javascript var in the java code, so i've setted the value in a hidden input text named "hidden_barra", but I need to submit it to get the value with the java code and make the search...How do I do it ? <input type="text" id="pro_barras"> <input type="hidden" id="hidden_barra"> <script> var barra = document.getElementById('pro_barras').value; document.getElementById('hidden_barra').value = barra; var ref = <%=pd.getProdutosBarra(">VAR 'barra' HERE or request.getParameter("hidden_barra")<").getPro_referencia()%>; </script>

    Read the article

  • matplotlib equivalent for MATLABs truesize()

    - by Lucas
    I am new to matplotlib and python and would like to display an image so that 1 pixel of the image is actually represented by 1 pixel in the figure. In MATLAB, this is achieved with the command truesize(). How can I do this in Python? I tried playing around with the imshow() arguments as well as set_dpi() and set_figwidth()/set_figheight(), but with no luck. Thanks.

    Read the article

  • How can the crosshair of ginput be restricted to one plot?

    - by Lucas
    I wrote a small MATLAB program with a gui. Inside the gui I have, among other things, a plot in which the user should be able to select two points. For this I use the function ginput, which creates a crosshair for selection. Unfortunatley the crosshair extends the whole window and is not restricted to the plot, which doesn't look nice and is confusing for the user. How can the crosshair be restricted only to the area of the plot?

    Read the article

  • How can I get size in bytes of an object sent using RMI?

    - by Lucas Batistussi
    I'm implementing a cache server with MongoDB and ConcurrentHashMap java class. When there are available space to put object in memory, it will put at. Otherwise, the object will be saved in a mongodb database. Is allowed that user specify a size limit in memory (this should not exceed heap size limit obviously!) for the memory cache. The clients can use the cache service connecting through RMI. I need to know the size of each object to verify if a new incoming object can be put into memory. I searched over internet and i got this solution to get size: public long getObjectSize(Object o){ try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(o); oos.close(); return bos.size(); } catch (Exception e) { return Long.MAX_VALUE; } } This solution works very well. But, in terms of memory use doesn't solve my problem. :( If many clients are verifying the object size at same time this will cause stack overflow, right? Well... some people can say: Why you don't get the specific object size and store it in memory and when another object is need to put in memory check the object size? This is not possible because the objects are variable in size. :( Someone can help me? I was thinking in get socket from RMI communication, but I don't know how to do this...

    Read the article

< Previous Page | 4 5 6 7 8 9 10  | Next Page >