Search Results

Search found 2558 results on 103 pages for 'significant digits'.

Page 65/103 | < Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >

  • PHP: json_decode dumping NULL, BOM not found

    - by SerEnder
    I've been trying to find out why this 'json_encode'd string isn't parsing out correctly, and came across previously answered questions that had the UTF BOM sequence that was throwing the error, but didn't help me here. Here's the code that isn't currently working: //Decode the notes attached to the sig $aNotes = json_decode($rule->getNotes(),true); $bom = pack("CCC",0xef,0xbb,0xbf); if(0 == strncmp($rule->getNotes(),$bom,3)) { print('BOM detected - json encoding in UTF-8<br/>'); } else { print('BOM NOT detected - json encoding correctly<br/>'); } print('rule->getNotes:<br/>' . $rule->getNotes() .'<br/>'); var_dump($aNotes); Which generates this result: BOM NOT detected - json encoding correctly rule->getNotes: [{"lDate":"Unknown","sAuthor":"Unknown","sNote":"This is a general purpose Russian spam rule that matches anything starting with 2, 3 or 4 hex digits followed by a domain name ending with .ru -RSK 2010-05-10"},{"lDate":"1295031463082","sAuthor":"Drew Thorstenson","sNote":"this is Ryan's ru rule"}] NULL I've run it through JSON Lint, which said it was valid, and An Online JSON Parser which parsed it correctly too. Any insight would be greatly appreciated.

    Read the article

  • Performance characteristics of pthreads vs ucontext

    - by Robert Mason
    I'm trying to port a library that uses ucontext over to a platform which supports pthreads but not ucontext. The code is pretty well written so it should be relatively easy to replace all the calls to the ucontext API with a call to pthread routines. However, does this introduce a significant amount of additional overhead? Or is this a satisfactory replacement. I'm not sure how ucontext maps to operating system threads, and the purpose of this facility is to make coroutine spawning fairly cheap and easy. So, question is: Does replacing ucontext calls with pthread calls significantly change the performance characteristics of a library?

    Read the article

  • Measuring the performance of classification algorithm

    - by Silver Dragon
    I've got a classification problem in my hand, which I'd like to address with a machine learning algorithm ( Bayes, or Markovian probably, the question is independent on the classifier to be used). Given a number of training instances, I'm looking for a way to measure the performance of an implemented classificator, with taking data overfitting problem into account. That is: given N[1..100] training samples, if I run the training algorithm on every one of the samples, and use this very same samples to measure fitness, it might stuck into a data overfitting problem -the classifier will know the exact answers for the training instances, without having much predictive power, rendering the fitness results useless. An obvious solution would be seperating the hand-tagged samples into training, and test samples; and I'd like to learn about methods selecting the statistically significant samples for training. White papers, book pointers, and PDFs much appreciated!

    Read the article

  • Minifying CSS, JS, and HTML - together

    - by Radu
    Minifying JS and CSS is quite common. The benefits of minifying JS are much greater that those seen with CSS because with CSS you can't rename elements - and same goes for HTML. But what if all 3 were minified together so that the benefits of using shorter names can be brought to CSS and HTML? That is, instead of minifying without any regard to the relationships between the 3, these could be preserved and made simpler. I imagine that the implementation could be quite difficult but if it were possible, do you think it would provide a significant advantage over traditional minification?

    Read the article

  • ant cpptask with ivy

    - by AC
    A company I am working for, has some c binaries build with ant using cpptask. They use ivy to retrieve shared c libraries every time we start a build which wastes a significant amount of time comparing the revisions and downloading, when then only need to be download if the header files have changed. I have added a target which sets a var, which causes the build to skip over the ivy steps but I'd like a better solution. I see that cpptask creates a file history.xml and only rebuilds to binary if any of the sources have change. I'd like to know if there is way to independently test if the binary needs to build, and it does, I'd like it fire off the ivy targets. I'd also like for a variable to be set if the binary was rebuilt so that I can conditionally start an rpm generation task

    Read the article

  • What is the fastest way to find duplicates in multiple BIG txt files?

    - by user2950750
    I am really in deep water here and I need a lifeline. I have 10 txt files. Each file has up to 100.000.000 lines of data. Each line is simply a number representing something else. Numbers go up to 9 digits. I need to (somehow) scan these 10 files and find the numbers that appear in all 10 files. And here comes the tricky part. I have to do it in less than 2 seconds. I am not a developer, so I need an explanation for dummies. I have done enough research to learn that hash tables and map reduce might be something that I can make use of. But can it really be used to make it this fast, or do I need more advanced solutions? I have also been thinking about cutting up the files into smaller files. To that 1 file with 100.000.000 lines is transformed into 100 files with 1.000.000 lines. But I do not know what is best: 10 files with 100 million lines or 1000 files with 1 million lines? When I try to open the 100 million line file, it takes forever. So I think, maybe, it is just too big to be used. But I don't know if you can write code that will scan it without opening. Speed is the most important factor in this, and I need to know if it can be done as fast as I need it, or if I have to store my data in another way, for example, in a database like mysql or something. Thank you in advance to anybody that can give some good feedback.

    Read the article

  • Search Result displaying-like google php

    - by Ramesh
    i have an paragraph and user will search inside that and if the search term has 3 matches inside but all are in 3 different places ex World War II, or the Second World War[1] (often abbreviated WWII or WW2), was a global military conflict lasting from 1939 to 1945 which involved most of the world's nations, including all of the great powers, organised into two opposing military alliances: the Allies and the Axis. It was the most widespread war in history, with more than 100 million military personnel mobilised. In a state of "total war," the major participants placed their entire economic, industrial, and scientific capabilities at the service of the war effort, erasing the distinction between civilian and military resources. Marked by significant action against civilians, including the Holocaust and the only use of nuclear weapons in warfare, it was the deadliest conflict in human history,[2] with over seventy million casualties. i have to search "war" so that it should display like World War II, or the Second World War[1].....In a state of "totalwar,".... some thing like this ///

    Read the article

  • Parallelize Bash Script

    - by thelsdj
    Lets say I have a loop in bash: for foo in `some-command` do do-something $foo done do-something is cpu bound and I have a nice shiny 4 core processor. I'd like to be able to run up to 4 do-something's at once. The naive approach seems to be: for foo in `some-command` do do-something $foo & done This will run all do-somethings at once, but there are a couple downsides, mainly that do-something may also have some significant I/O which performing all at once might slow down a bit. The other problem is that this code block returns immediately, so no way to do other work when all the do-somethings are finished. How would you write this loop so there are always X do-somethings running at once?

    Read the article

  • How would I create a technology standards document for my company?

    - by Rob O
    I'm a Director of Product Engineering for my company. My CEO has asked me to create a technology standards document, explaining things like the technology we use, our policy on adapting to new technology, and design standards like percent of code covered by unit tests. I've never had to do something like this, and I've spent a significant amount of time searching the web for examples, but I haven't found any at all. The closest I've found are documents describing technical specifications for an individual product. However, I'm trying to define this for the entire company. Can someone provide examples of how this document could be formatted/organized, and what the typical content would be? Thanks!

    Read the article

  • How communicate with pty via minicom or screen?

    - by gscott2112
    I am trying to provide an AT/Modem-like interface around some hardware. Follwing this post I have the server setting up a pty using openpty(). Now I can communicate with the server as expected with a client app that open the slave and communicates via read() and write() calls. However I would also like to be able to use either the screen command or minicom to issue commands by hand to the slave. However the server never seems to receive any data when trying to do this. Is there something significant I am missing with this approach?

    Read the article

  • Build Pipelining and Continuous Integration with Maven and Hudson

    - by Brandon
    Currently the my team is considering splitting our single CI build process into a more streamlined multi-stage process to speed up basic build feedback and isolate different ci concerns. The idea we had was to have each stage exist in Hudson as a different build with the correct maven goal or maven plugin execution, then chain them together using the post-build hooks of Hudson. However to my knowledge, Maven as a build tool mandates that any lifecycle phase which is performed automatically builds every preceding lifecycle phase. This presents a number of problems the most significant of which is that maven is recreating the build resources with each distinct call and not using those of the previous stage. This not only breaks the consistency of the build lifecycle but has much more unnecessary processing overhead. Is there a way to accomplish pipelining with CI using Maven? Assuming there is, is there a way to let Hudson know to use those resources built from the previous stage in the next one?

    Read the article

  • Can isdigit legitimately be locale dependent in C

    - by cdev
    In the section covering setlocale, the ANSI C standard states in a footnote that the only ctype.h functions whose behaviour is not affected by the current locale are isdigit and isxdigit. The Microsoft implementation of isdigit is locale dependent because, for example, in locales using code page 1250 isdigit only returns non-zero for characters in the range 0x30 ('0') - 0x39 ('9'), whereas in locales using code page 1252 isdigit also returns non-zero for the superscript digits 0xB2 ('²'), 0xB3 ('³') and 0xB9 ('¹'). Is Microsoft in violation of the C standard by making isdigit locale dependent? In this question I am primarily interested in C90, which Microsoft claims to conform to, rather than C99. Additional background: Microsoft's own documentation of setlocale incorrectly states that isdigit is unaffected by the LC_CTYPE part of the locale. The section of the C standard that covers the ctype.h functions contains some wording that I consider ambiguous: "The behavior of these functions is affected by the current locale. Those functions that have locale-specific aspects only when not in the "C" locale are noted below." I consider this ambiguous because it is unclear what it is trying to say about functions such as isdigit for which there are no notes about locale-specific aspects. It might be trying to say that such functions must be assumed to be locale dependent, in which case Microsoft's implementation of isdigit would be OK. (Except that the footnote I mentioned earlier seems to contradict this interpretation.)

    Read the article

  • fopen / fopen_s and writing to files

    - by yCalleecharan
    Hi, I'm using fopen in C to write the output to a text file. The function declaration is (where ARRAY_SIZE has been defined earlier): void create_out_file(char file_name[],long double *z1){ FILE *out; int i; if((out = fopen(file_name, "w+")) == NULL){ fprintf(stderr, "* Open error on output file %s", file_name); exit(-1); } for(i = 0; i < ARRAY_SIZE; i++) fprintf(out, "%.16Le\n", z1[i]); fclose(out); } My questions: On compilation with MVS2008 I get the warning: warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. I haven't see much information on fopen_s so that I can change my code. Any suggestions? Can one instruct fprintf to write at desired precision? If I'm using long double then I assume that my answers are good till 15 digits after the decimal point. Am I right? Thanks a lot...

    Read the article

  • what is the best and valid way for cross browser min-height?

    - by metal-gear-solid
    for #main-content I don't want to give any fix height because content can be long and short but if content is short then it should take minimum height 500px. i need compatibility in all browser. Is thery any w3c valid and cross browser way without using !important because i read !important should not be used In conclusion, don’t use the !important declaration unless you’ve tried everything else first, and keep in mind any drawbacks. If you do use it, it would probably make sense, if possible, to put a comment in your CSS next to any styles that are being overridden, to ensure better code maintainability. I tried to cover everything significant in relation to use of the !important declaration, so please offer comments if you think there’s anything I’ve missed, or if I’ve misstated anything, and I’ll be happy to make any needed corrections. http://www.impressivewebs.com/everything-you-need-to-know-about-the-important-css-declaration/

    Read the article

  • Conceptually, how does replay work in a game?

    - by SnOrfus
    I was kind of curious as to how replay might be implemented in a game. Initially, I thought that there would be just a command list of every player/ai action that was taken in the game, and it then 're-plays' the game and lets the engine render as usual. However, I have looked at replays in FPS/RTS games, and upon careful inspection even things like the particles and graphical/audible glitches are consistent (and those glitches are generally *in*consistent). So How does this happen. In fixed camera angle games I though it might just write every frame of the whole scene to a stream that gets stored and then just replays the stream back, but that doesn't seem like enough for games that allow you to pause and move the camera around. You'd have to store the locations of everything in the scene at all points in time (No?). So for things like particles, that's a lot of data to push which seems like a significant draw on the game's performance whilst playing.

    Read the article

  • Would the world be a better place if there were only one programming language?

    - by Simon
    Well, perhaps not the world, but would it encourage more-re-use, less replication of basic code, or at least an uplift in what is considered basic code, more time advancing the application science and a greater encouragement to share, a more advanced base of understanding for new programmers, since the language could be taught ubiquitously and patterns of teaching would have emerged which were optimised for students learning etc etc? I think all of those things would make the programming world better and would probably have significant commercial benefit too. This is definitely not a religious debate about which language is best, and is predicated on the notion of some super-being having designed the perfect language to start with, which was improbable, but it strikes me that if, from the beginning, there were only a single programming language we may be further along in terms of the evolution of the software industry and software science. And although it is now impossible, if you buy some or all of these assertions is there an argument for standardising on a single language for the future so we can accelerate our collective progress rather than all of us re-inventing some part of the same wheel and consigning our children to the same fate?

    Read the article

  • Expression Studio - v2 good enough for learning?

    - by aSkywalker
    I have VS 2008, and looking forward to moving fairly quickly to VS2010. Our applications (we only have a few) are all winforms apps - mostly VB. I want to start to learn WPF. My version of Expression Studio is version 2. I have heard that the improvements made from version 2 to version 3 are significant. If it follows the paradigm of version 3 being the adult app (past the infancy of version 1 and the awkwardness of version 2), then I suppose it would be worth the investment to get it before starting to learn. But, unless my company was willing to pay, I am hoping to keep costs low. Can anyone share some experience - is version 2 good enough to learn on, or should I bite the bullet and smooth my learning experience by going with version 3? Thanks!

    Read the article

  • How can I make an Access database readable from the web while it is open in MS Access?

    - by djdilicious
    I have a website using ASP with an MS Access DB back-end for storing mainly blog posts. My company has a very long software approval process so I am stuck with what I have (i.e. I must use Access). I use server-side javascript to retrieve posts stored in the database using OLEDB calls. Everything works fine except that I cannot read any tables from the database when it is open in the MS Access program. The page displays an error message about the file being in use. This could lead to significant downtime while I am doing any work within Access. How can I make the file readable by my ASP application while it is open in Access?

    Read the article

  • OpenGL and layouts

    - by Hnefi
    I'm using OpenGL to render a game view in my android application. The game is turn based and I wish to add some buttons to the interface. I'd prefer to use standard Android widgets, structured in an XML-generated layout (or, if I have to, a hardcoded layout) and put the OpenGL view in its own window as part of that layout. So in regards to this, I have 3 questions: 1: Is such a thing possible? I've done a few half-hearted tries, but have had no luck so far. 2: Is such a thing advisable? Does it carry a significant performance penalty, for example, over using OpenGL-based homebrew widgetry? 3: Is it possible to pass particular arguments to instances created in XML layouts? For example, my current OpenGL view has three arguments in its constructor; is it somehow possible for me to invoke that particular constructor with particular parameters when it's part of a layout?

    Read the article

  • SSIS - Connection Management Within a Loop

    - by Rob Bowman
    Hi I have the following SSIS package: The problem is that within the Foreach loop a connection is opened and closed for each iteration. On running SQL Profiler I see a series of: Audit Login RPC:Completed Audit Lout The duration for the login and the RPC that actually does the work is minimal. However, the duration for the logout is significant, running into several seconds each. This causes the JOB to run very slowly - taking many hours. I get the same problem when running either on a test server or stand-alone laptop. Could anyone please suggest how I may change the package to improve performance? Also, I have noticed that when running the package from Visual Studio, it looks as though it continues to run with the component blocks going amber then green but actually all the processing has been completed and SQL profiler has dropped silent? Thanks, Rob.

    Read the article

  • Can I use memcpy in C++ to copy classes that have no pointers or virtual functions

    - by Shane MacLaughlin
    Say I have a class, something like the following; class MyClass { public: MyClass(); int a,b,c; double x,y,z; }; #define PageSize 1000000 MyClass Array1[PageSize],Array2[PageSize]; If my class has not pointers or virtual methods, is it safe to use the following? memcpy(Array1,Array2,PageSize*sizeof(MyClass)); The reason I ask, is that I'm dealing with very large collections of paged data, as decribed here, where performance is critical, and memcpy offers significant performance advantages over iterative assignment. I suspect it should be ok, as the 'this' pointer is an implicit parameter rather than anything stored, but are there any other hidden nasties I should be aware of?

    Read the article

  • Should I create subclass NSManagedObject or not?

    - by TP
    Hi, I have spent a few days learning and writing NSCoding and finally got it working. However, it took very long to archive and unarchive the (quite complex) object graph, which is unacceptable. After searching the internet for some time, I think the better way is to use core data. Do you recommend that 1) I should rewrite all my classes as subclasses of NSManagedObject or 2) should I create an instance variable of NSManagedObject in each of my class so that any changes to the class also updates its core data representation? Doing either way will need significant changes to the exiting classes and I think I have to update lots of unit test cases as well if it changes the way the classes are initialized. What do you recommend? I really don't want to head to the wrong approach again... Thanks!

    Read the article

  • Accessing a webpage in C++

    - by wyatt
    Is there a good, simple library which allows C++ to load a webpage? I just want to grab the source as text. I'm not using any IDE or significant library, just straight command line. Tangentially, is there something fundamental I'm missing about programming in C++? I would think any language in common use today would have droves of web-based functionality, being so central to computer usage, but I can find next to no discussion on how to accomplish it. I realise C++ significantly predates the modern internet, so it lacking any core ability in the regard is reasonable, but the fact that relevant libraries seem so sparse is baffling. Thanks for your help.

    Read the article

  • How to make cycle over cycles in Java?

    - by Roman
    I would like to make a cycle over the following elements: [1,2,11,12,21,22,111,112,121,122,....,222222] or for example [1,2,3,11,12,13,21,22,23,31,32,33,111,112,113,... 333333333] How can I make it in Java? In my particular case I use 4 digits (1,2,3,4) and the length of the last number can be from 1 to 10. I managed to do it in Python and PHP. In the first case I used list over lists. I started from [[1],[2],] then for every element of the list I added 1 and 2, so I got [[1,1],[1,2],[2,1],[2,2]] and so on: nchips = sum(chips) traj = [[]] last = [[]] while len(last[0]) < nchips: newlast = [] for tr in last: for d in [1,2,3,4]: newlast.append(tr + [d]) last = newlast traj += last When I did it in PHP I used number with base 3. But it was a tricky and non elegant solution. for ($i=-1; $i<=$n; $i+=1) { if ($i>-1) { $n5 = base_convert($i,10,5); $n5_str = strval($n5); $tr = array(); $found = 0; for ($j=0; $j<strlen($n5_str); $j+=1) { $k = $n5_str[$j]; if ($k==0) { $found = 1; break; } array_push($tr,$k); } if ($found==1) continue; } else { $tr = array(); } } Can it be done easily in Java?

    Read the article

  • Adding up fractions in PHP

    - by Gamemorize
    I would like to create a loop that keeps adding a set fraction, here in my example 1/3, and which later I can check against for matches with integer values. Obviously when php adds 1/3 + 1/3 + 1/3 the result is 0.9999999, so i thought I could use the occasional round to help me, but this isn't working either. The idea that I had would be that .333 + .333 becomes .666 and that if rounded that would become .667, then + .333 and the result is 1. However round only seems to work, for me, if the number of digits actually decreases. so round (0.666, 3) remains 0.666 <?php $denom = 3; $frac = 1/$denom; $frac = round($frac,3); $value = 0; $max =24; for($f = 1; $f <= $max; $f++){ echo "old value is now at ".$value.".<br/>"; $value = $value+$frac; echo "value is now at ".$value.".<br/>"; $value = round($value,3); echo "rounded value is now at ".$value.".<br/>"; $valueArray[$f] = $value; //and here for ease of testing.... if (($value==1)OR ($value==2)OR ($value==3)OR ($value==4)OR ($value==5)OR ($value==6)OR ($value==7)OR ($value==8)){ echo "match!<br/>"; }else{ echo "no match!<br/>"; } } ?> Am I going about this in a totally stupid way? Accuracy when the value is not an integer is not needed, just that it can == with integers.

    Read the article

< Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >