Search Results

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

Page 60/103 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • Can JAXB Incrementally Marshall An Object?

    - by Intellectual Tortoise
    I've got a fairly simple, but potentially large structure to serialize. Basically the structure of the XML will be: <simple_wrapper> <main_object_type> <sub_objects> </main_object_type> ... main_object_type repeats up to 5,000 times </simple_wrapper> The main_object_type can have a significant amount of data. On my first 3,500 record extract, I had to give the JVM way more memory than it should need. So, I'd like to write out to disk after each (or a bunch of) main_object_type. I know that setting Marshaller.JAXB_FRAGMENT would allow it fragments, but I loose the outer xml document tags and the <simple_wrapper>. Any suggestions?

    Read the article

  • java distributed cache for low latency, high availability

    - by Shahbaz
    I've never used distributed caches/DHTs like memcached, jboss cache, ehcache, etc. I'm wondering which, if any, is appropriate for my use. First, I'm not doing web applications (as most of these project seem to be geared towards web apps). I write servers (Order Management Systems actually) for financial trading firms. The servers themselves are not too complicated. They need to receive information (market data, orders, executions, etc.) rout them to their destination while possibly transforming some of these messages. I am looking at these products to solve the following problems: * Safe repository of the state of the server. I'd rather build the logic of my application as a bunch of transformers (similar to Apache Camel) and store the state in a 'safe' place * This repository should be distributed: in case one of these data stores crashes, one or two more should be up and I should be able to switch to them seamlessly * This repository should be fast. Single digits milliseconds count here, in other words, systems which consume/process this data are automated systems, not humans clicking on links. This system needs to have high-throughput and low latency. By sending my data outside the process, I am necessarily slowing performance, but I am trying to balance absolute raw speed and absolute protection of data. * This repository should be safe. Similar to the point about several on-line backups, this system needs to write data to disk (potentially more than one disk). I'd really like to stop writing my own 'transaction servers.' Am I correct to be looking into projects such as jboss cache, ehcache, etc.? Thanks

    Read the article

  • Parsing HTML with Python 2.7 - HTMLParser, SGMLParser, or Beautiful Soup?

    - by Eric Wilson
    I want to do some screen-scraping with Python 2.7, and I have no context for the differences between HTMLParser, SGMLParser, or Beautiful Soup. Are these all trying to solve the same problem, or do they exist for different reasons? Which is simplest, which is most robust, and which (if any) is the default choice? Also, please let me know if I have overlooked a significant option. Edit: I should mention that I'm not particularly experienced in HTML parsing, and I'm particularly interested in which will get me moving the quickest, with the goal of parsing HTML on one particular site.

    Read the article

  • Best practices book for CRUD apps

    - by Kevin L.
    We will soon be designing a new tool to calculate commissions across multiple business units. This new compensation scheme is pretty clever and well thought-out, but the complexity that the implementation will involve will make the Hubble look like a toaster. A significant portion of the programming industry involves CRUD apps; updating insurance data, calculating commissions (Joel included) ...even storing questions and answers for a programmer Q&A site. We as programmers have Code Complete for the low-level formatting/style and Design Patterns for high-level architecture (to name just a few). Where’s the comparable book that teaches best practices for CRUD?

    Read the article

  • Using datetime float representation as primary key

    - by devanalyst
    From my experience I have learn that using an surrogate INT data type column as primary key esp. an IDENTITY key column offers better performance than using GUID or char/varchar data type column as primary key. I try to use IDENTITY key as primary key wherever possible. But recently I came across a schema where the tables were horizontally partitioned and were managed via a Partitioned view. So the tables could not have an IDENTITY column since that would make the Partitioned View non updatable. One work around for this was to create a dummy 'keygenerator' table with an identity column to generate IDs for primary key. But this would mean having a 'keygenerator' table for each of the Partitioned View. My next thought was to use float as a primary key. The reason is the following key algorithm that I devised DECLARE @KEY FLOAT SET @KEY = CONVERT(FLOAT,GETDATE())/100000.0 SET @KEY = @EMP_ID + @KEY Heres how it works. CONVERT(FLOAT,GETDATE()) gives float representation of current datetime since internally all datetime are represented by SQL as a float value. CONVERT(FLOAT,GETDATE())/100000.0 converts the float representation into complete decimal value i.e. all digits are pushed to right side of ".". @KEY = @EMP_ID + @KEY adds the Employee ID which is an integer to this decimal value. The logic is that the Employee ID is guaranteed to be unique across sessions since an employee cannot connect to an application more than once at the same time. And for the same employee each time a key will be generated the current datetime will be unique. In all an unique key across all employee sessions and across time. So for Emp Ids 11 and 12, I have key values like 12.40046693321566357, 11.40046693542361111 But my concern whether float data type as primary key offer benefits compared to choosing GUID or char/varchar as primary keys. Also important thing is because of partitioning the float column is going to be part of a composite key.

    Read the article

  • Is it professional to have funny looking logging messages

    - by JCH
    Hi, Recently I have joined a new project team where in the java application logs have logged messages in a non-formal way[can't think of suitable word]. here how they look :-) <message> for info messages :-| <message> for warn :-( <message> for error besides there's also ASCII art drawing , different one for each log when that particular service starts up or is killed .And there many more styles for certain application events. iam not sure if it has any significant overhead on the application or not. I would like to ask you folks if you come across such unique styles of logging messages or do you also practice any styles.what is your opinion about it. BR /jon

    Read the article

  • Does Windows Azure support the Application Warm-Up module or something similar?

    - by Corey O'Brien
    We have a Web Role that we are hosting in Windows Azure that uses an old ASMX based Web Reference to contact an external system. The Web Reference proxy code is big enough that instantiating it the first time has a significant cost. We'd like to be able to have this run when the Web Role starts instead of on the first request. I know IIS 7.5 has an Application Warm-Up module that would allow us to achieve this, but I'm having trouble figuring out if something similar exists with hosting on Windows Azure. Thanks, Corey

    Read the article

  • C#: How to parse a hexadecimal digit

    - by Biosci3c
    Okay, I am working on a card playing program, and I am storing card values as hexadecimal digits. Here is the array: public int[] originalCards = new int[54] { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x50, 0x51 }; The first digit refers to the suit (1 = spades; 2 = clubs; .... 5 = Jokers) The second digit is the number of the card (1 = ace, 5 = 5; 13 = K, etc). I would like to do something like the following: Pseudocode: public int ReturnCard(int num) { int card = currentDeck[num]; int suit = card.firsthexdigit; int value = card.secondhexdigit; return 0; } I don't need a new method to work on ints, I just included it for clarity's sake. Anybody know how to do this in C#?

    Read the article

  • Working with bytes and binary data in Python

    - by ignoramus
    Four consecutive bytes in a byte string together specify some value. However, only 7 bits in each byte are used; the most significant bit is ignored (that makes 28 bits altogether). So... b"\x00\x00\x02\x01" would be 000 0000 000 0000 000 0010 000 0001. Or, for the sake of legibility, 10 000 0001. That's the value the four bytes represent. But I want a decimal, so I do this: >>> 0b100000001 257 I can work all that out myself, but how would I incorporate it into a program?

    Read the article

  • What the performance impact of enabling WebSphere PMI

    - by Andrew Whitehouse
    I am currently looking at some JProfiler traces from our WebSphere-based application, and am noticing that a significant amount of CPU time is being spent in the class com.ibm.io.async.AsyncLibrary.getCompletionData2. I am guessing, but I am wondering whether this is PMI-related (and we do have this enabled). My knowledge of PMI is limited, as this is managed by another team. Is it expected that PMI can have this sort of impact? (If so) Is the only option to turn it off completely? Or are there some types of data capture that have a particularly high overhead?

    Read the article

  • Displaying indexed png- files out of NSArray on the iphone screen

    - by Thomas Hülsmann
    Hi, i like to create an artwork counter- display on an iphone, diplaying 0 to 9. The 10 digits are 10 png- files with the numbers 0 to 9 as their artwork content. The 10 png- files are implemented by using NSArray. Following you'll find the implementation- code: zahlenArray = [NSArray arrayWithObjects: [UIImage imageNamed:@"ziffer-0.png"], [UIImage imageNamed:@"ziffer-1.png"], [UIImage imageNamed:@"ziffer-2.png"], [UIImage imageNamed:@"ziffer-3.png"], [UIImage imageNamed:@"ziffer-4.png"], [UIImage imageNamed:@"ziffer-5.png"], [UIImage imageNamed:@"ziffer-6.png"], [UIImage imageNamed:@"ziffer-7.png"], [UIImage imageNamed:@"ziffer-8.png"], [UIImage imageNamed:@"ziffer-9.png"], nil]; As an index for the 10 digitis I use an integer variable, initializing with 0: int counter = 0; Furthermore I declare an UIImageview programmaticaly: UIImageView *zahlenEinsBisNeun; The implementation code for the UIImageview is: zahlenEinsBisNeun = [UIImage alloc] initWithFrame:CGRectMake(240, 50, 200, 200)]; ???????????????????????????????????????? [self.view addSubview:zahlenEinsBisNeun]; [zahlenEinsBisNeun release]; There, where you see the questionmarks, I don't know how to write the code, to retrieve my content artworks 0 to 9 from NSArray with the index "counter" and make it visible on my iphone screen by using .... addSubview:zahlenEinsBisNeun ... Can anybody help??? My thanks for your support in advance Thomas Hülsmann

    Read the article

  • Why am I getting 'Heap Corruption'?

    - by fneep
    Please don't crucify me for this one. I decided it might be good to use a char* because the string I intended to build was of a known size. I am also aware that if timeinfo-tm_hour returns something other than 2 digits, things are going to go badly wrong. That said, when this function returns VIsual Studio goes ape at me about HEAP CORRUPTION. What's going wrong? (Also, should I just use a stringbuilder?) void cLogger::_writelogmessage(std::string Message) { time_t rawtime; struct tm* timeinfo = 0; time(&rawtime); timeinfo = localtime(&rawtime); char* MessageBuffer = new char[Message.length()+11]; char* msgptr = MessageBuffer; _itoa(timeinfo->tm_hour, msgptr, 10); msgptr+=2; strcpy(msgptr, "::"); msgptr+=2; _itoa(timeinfo->tm_min, msgptr, 10); msgptr+=2; strcpy(msgptr, "::"); msgptr+=2; _itoa(timeinfo->tm_sec, msgptr, 10); msgptr+=2; strcpy(msgptr, " "); msgptr+=1; strcpy(msgptr, Message.c_str()); _file << MessageBuffer; delete[] MessageBuffer; }

    Read the article

  • Testing harness for online teaching?

    - by candeira
    I have been asked to teach an online programming course, and I am looking for a test harness especially geared to education. Some students will have significant coding experience, but others will be total newbies. The course is an introduction to software development, mostly taught in C with some C++ and Java thrown in. In any case, I would like to read their source code only after a test suite has made sure that it compiles and executes properly. The students will also benefit from having a tool they can check their code against before submitting it. However, the Learning Management System my employer is using doesn't have such a system. Do you know of any LMS software that includes this feature? Which testing harness would you recommend in case I have to roll my own?

    Read the article

  • How to preprocess text to do OCR error correction

    - by eaglefarm
    Here is what I'm trying to accomplish: I need to get a several large text files from a computer that is not networked and has no other output except a printer. I tried printing the text, then scanning the printout with OCR to recover the text on another computer but the OCR gets lots of errors (1 vs l, o vs 0, O vs D, etc). To solve this I am thinking of writing a program to process (annotate?) the text file, before printing it, so that the errors can be corrected from the text output of the OCR program. For example, for 1 (number one) vs l (letter L), I could change the text like this: sample inserting \nnn after characters that are frequently wrong in the OCR results: sampl\108e Then I can write another program to examine the file, looking for \nnn and check the character before the \nnn (where nnn is the ascii code in decimal) and fix it if necessary. Of course the program will have to recognize that the \nnn may have errors too but at least it knows that the nnn are digits and can easily correct them. I think I would add a CRC on each line so that any line that isn't corrected perfectly can be flagged as having a problem. Has anyone done anything like this? If there is an existing way of doing this I'd rather not reinvent the wheel. Or any suggestions for annotation format that would help solve this problem would be helpful too.

    Read the article

  • Laws of Computer Science and Programming

    - by Jonas
    We have Amdahl's law that basically states that if your program is 10% sequential you can get a maximum 10x performance boost by parallelizing your application. Another one is Wadler's law which states that In any language design, the total time spent discussing a feature in this list is proportional to two raised to the power of its position. 0. Semantics 1. Syntax 2. Lexical syntax 3. Lexical syntax of comments My question is this: What are the most important (or at least significant / funny but true / sad but true) laws of Computer Science and programming? I want named laws, and not random theorems, So an answer should look something like Surname's (law|theorem|conjecture|corollary...) Please state the law in your answer, and not only a link. Edit: The name of the law does not need to contain it's inventors surname. But I do want to know who stated (and perhaps proved) the law

    Read the article

  • Calculating odds distribution with 6-sided dice

    - by Stephen
    I'm trying to calculate the odds distribution of a changing number of 6-sided die rolls. For example, 3d6 ranges from 3 to 18 as follows: 3:1, 4:3, 5:6, 6:10, 7:15, 8:21, 9:25, 10:27, 11:27, 12:25, 13:21, 14:15, 15:10, 16:6, 17:3, 18:1 I wrote this php program to calculate it: function distributionCalc($numberDice,$sides=6) { for ( $i=0; $i<pow($sides,$numberDice); $i++) { $sum=0; for ($j=0; $j<$numberDice; $j++) { $sum+=(1+(floor($i/pow($sides,$j))) % $sides); } $distribution[$sum]++; } return $distribution; } The inner $j for-loop uses the magic of the floor and modulus functions to create a base-6 counting sequence with the number of digits being the number of dice, so 3d6 would count as: 111,112,113,114,115,116,121,122,123,124,125,126,131,etc. The function takes the sum of each, so it would read as: 3,4,5,6,7,8,4,5,6,7,8,9,5,etc. It plows through all 3^6 possible results and adds 1 to the corresponding slot in the $distribution array between 3 and 18. Pretty straightforward. However, it only works until about 8d6, afterward i get server time-outs because it's now doing billions of calculations. But I don't think it's necessary because die probability follows a sweet bell-curve distribution. I'm wondering if there's a way to skip the number crunching and go straight to the curve itself. Is there a way to do this, so, for example, with 80d6 (80-480)? Can the distribution be projected without doing 6^80 calculations? I'm not a professional coder and probability is still new to me, so thanks for all the help! Stephen

    Read the article

  • How to find a binary logarithm very fast? (O(1) at best)

    - by psihodelia
    Is there any very fast method to find a binary logarithm of an integer number? For example, given a number x=52656145834278593348959013841835216159447547700274555627155488768 such algorithm must find y=log(x,2) which is 215. x is always a power of 2. The problem seems to be really simple. All what is required is to find the position of the most significant 1 bit. There is a well-known method FloorLog, but it is not very fast especially for the very long multi-words integers. What is the fastest method?

    Read the article

  • Work Experience - Internship Years

    - by James Jones
    I interned at my current place of employment for 2.5 years while I was an undergrad. During that time, I worked 40 hours per week during the summer and averaged 20 hours per week during the school year. I have since been hired full-time and I have been with the company a little over 3 years now. How many years of work experience do I have? Background info: There is a significant income disparity between someone with 1 year of experience vs 3 years (as per salary.com). I have job responsibilities equivalent to that of someone who has been at my company for about 5 years. I am trying to determine what I should expect in terms of income, raises, etc.

    Read the article

  • Open source iPhone components? Reusable views, controllers, buttons, table cells, etc?

    - by Ian Terrell
    Are there any repositories around for open sourced iPhone components? For instance, I have found myself needing to create several new types of table cells to mimic some of Apple's existing functionality (for instance, all the different types of table cells present in the Settings application). I can't imagine I'm alone here. Where do you go to find open sourced reusable components, or do you just write and hoard your own? Update: I know there are open source full projects around (see this question), but rummaging through them and picking and choosing still leads to significant duplication of effort. Update 2: Here are some libraries that I've found (or have come into existence) since asking this question: Three20 -- Custom UI classes used in the Facebook application CocoaHelpers -- Extensions to common classes MBProgressHUD -- Replacement for the undocumented UIProgressHUD

    Read the article

  • How to print a number with a space as thousand separator?

    - by dygi
    I've got a simple class Currency with overloaded operator<<. I don't know how can i separate the number with spaces every 3 digits, so it looks like: "1 234 567 ISK". #include <cstdlib> #include <iostream> using namespace std; class Currency { int val; char curr[4]; public: Currency(int _val, const char * _curr) { val = _val; strcpy(curr, _curr); } friend ostream & operator<< (ostream & out, const Currency & c); }; ostream & operator<< (ostream & out, const Currency & c) { out << c.val<< " " << c.curr; return out; } int main(int argc, char *argv[]) { Currency c(2354123, "ISK"); cout << c; } What interests me, is somehow the easiest solution for this particular situation.

    Read the article

  • Matlab-Bisection-Newton-Secant , finding roots?

    - by i z
    Hello and thanks in advance for your possible help ! Here's my problem: I have 2 functions f1(x)=14.*x*exp(x-2)-12.*exp(x-2)-7.*x.^3+20.*x.^2-26.*x+12 f2(x)=54.*x.^6+45.*x.^5-102.*x.^4-69.*x.^3+35.*x.^2+16.*x-4 Make the graph for those 2, the first one in [0,3] and the 2nd one in [-2,2]. Find the 3 roots with accuracy of 6 decimal digits using a) bisection ,b) newton,c)secant.For each root find the number of iterations that have been made. For Newton-Raphson, find which roots have quadratic congruence and which don't. What is the main common thing that roots with no quadratic congruence (Newton's method)? Why ? Excuse me if i ask silly things, but i'm asked to do this with no Matlab courses and I'm trying to learn it myself. There are many issues i have with this exercise . Questions : 1.I only see 2 roots in the graph for the f1 function and 4-5 (?) roots for the function f2 and not 3 roots as the exercise says. Here's the 2 graphs : http://postimage.org/image/cltihi9kh/ http://postimage.org/image/gsn4sg97f/ Am i wrong ? Do both have only 3 roots in [0,3] and [-2,2] ? Concerning the Newton's method , how am i supposed to check out which roots have quadratic congruence and which not??? Accuracy means tolerance e=10^(-6), right ?

    Read the article

  • Is the heap actually a heap?

    - by ElectricDialect
    In .NET (and Java as far as I know), the area where objects are dynamically allocated is referred to as the managed heap. However, most documentation that describes how the managed heap works depicts it as a linear data structure, such as a linked list or stack. So, is the managed heap actually a heap, or is it implemented with some other data structure? If it actually does not use a heap data structure, is seems like a significant failure of terminology to overload the meaning of this word. If it is in fact a heap data structure, what is the value that satisfies the heap property: the size of the allocated memory region?

    Read the article

  • Set the caret/cursor position to the end of the string value WPF textbox

    - by Zamboni
    I am try to set the caret/cursor position to the end of the string value in my WPF textbox when I open my window for the first time. I use the FocusManager to set the focus on my textbox when my window opens. Nothing seems to work. Any ideas? Note, I am using the MVVM pattern, and I included only a portion of the XAML from my code. <Window FocusManager.FocusedElement="{Binding ElementName=NumberOfDigits}" Height="400" Width="800"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <TextBox Grid.Column="0" Grid.Row="0" x:Name="NumberOfDigits" IsReadOnly="{Binding Path=IsRunning, Mode=TwoWay}" VerticalContentAlignment="Center" Text="{Binding Path=Digits, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> <Button Grid.Column="0" Grid.Row="1" Margin="10,0,10,0" IsDefault="True" Content="Start" Command="{Binding StartCommand}"/> </Grid> </Window>

    Read the article

  • What's the best way to do literate programming in Python on Windows?

    - by JasonFruit
    I've been playing with various ways of doing literate programming in Python. I like noweb, but I have two main problems with it: first, it is hard to build on Windows, where I spend about half my development time; and second, it requires me to indent each chunk of code as it will be in the final program --- which I don't necessarily know when I write it. I don't want to use Leo, because I'm very attached to Emacs. Is there a good literate programming tool that: Runs on Windows Allows me to set the indentation of the chunks when they're used, not when they're written Still lets me work in Emacs Thanks! Correction: noweb does allow me to indent later --- I misread the paper I found on it. By default, notangle preserves whitespace and maintains indentation when expanding chunks. It can therefore be used with languages like Miranda and Haskell, in which indentation is significant That leaves me with only the "Runs on Windows" problem.

    Read the article

  • Flex (Lex, not actionscript or w/e) Error

    - by incrediman
    I'm totally new to flex. I'm getting a build error when using flex. That is, I've generated a .c file using flex, and, when running it, am getting this error: 1>lextest.obj : error LNK2001: unresolved external symbol "int __cdecl isatty(int)" (?isatty@@YAHH@Z) 1>C:\...\lextest.exe : fatal error LNK1120: 1 unresolved externals here is the lex file I'm using (grabbed from here): /*** Definition section ***/ %{ /* C code to be copied verbatim */ #include <stdio.h> %} /* This tells flex to read only one input file */ %option noyywrap %% /*** Rules section ***/ /* [0-9]+ matches a string of one or more digits */ [0-9]+ { /* yytext is a string containing the matched text. */ printf("Saw an integer: %s\n", yytext); } . { /* Ignore all other characters. */ } %% /*** C Code section ***/ int main(void) { /* Call the lexer, then quit. */ yylex(); return 0; } As well, why do I have to put a 'main' function in the lex syntax code? What I'd like is to be able to call yylex(); from another c file.

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >