Search Results

Search found 721 results on 29 pages for 'benjamin jones'.

Page 13/29 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Calculating multiple column average in SQLite3

    - by Benjamin Oakes
    I need to average some values in a row-wise fashion, rather than a column-wise fashion. (If I were doing a column-wise average, I could just use avg()). My specific application of this requires me ignore NULLs in averaging. It's pretty straightforward logic, but seems awfully difficult to do in SQL. Is there an elegant way of doing my calculation? I'm using SQLite3, for what it's worth. Details If you need more details, here's an illustration: I have a a table with a survey: | q1 | q2 | q3 | ... | q144 | |----|-------|-------|-----|------| | 1 | 3 | 7 | ... | 2 | | 4 | 2 | NULL | ... | 1 | | 5 | NULL | 2 | ... | 3 | (Those are just some example values and simple column names. The valid values are 1 through 7 and NULL.) I need to calculate some averages like so: q7 + q33 + q38 + q40 + ... + q119 / 11 as domain_score_1 q10 + q11 + q34 + q35 + ... + q140 / 13 as domain_score_2 ... q2 + q5 + q13 + q25 + ... + q122 / 12 as domain_score_14 ...but i need to pull out the nulls and average based on the non-nulls. So, for domain_score_1 (which has 11 items), I would need to do: Input: 3, 5, NULL, 7, 2, NULL, 3, 1, 5, NULL, 1 (3 + 5 + 7 + 2 + 3 + 1 + 5 + 1) / (11 - 3) 27 / 8 3.375 A simple algorithm I'm considering is: Input: 3, 5, NULL, 7, 2, NULL, 3, 1, 5, NULL, 1 Coalesce each value to 0 if NULL: 3, 5, 0, 7, 2, 0, 3, 1, 5, 0, 1 Sum: 27 Get the number of non-zeros by converting values 0 to 1 and sum: 3, 5, 0, 7, 2, 0, 3, 1, 5, 0, 1 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1 8 Divide those two numbers 27 / 8 3.375 But that seems like a lot more programming than this should take. Is there an elegant way of doing this that I'm not aware of? Update: Unless I'm misunderstanding something, avg() won't work for this. Example of what I would want to do: select avg(q7, q33, q38, ..., q119) from survey; Output: SQL error near line 3: wrong number of arguments to function avg()

    Read the article

  • warning C6242: A jump out of this try-block forces local unwind

    - by Benjamin
    When we use SEH with __finally block, if we do return in __try block, it causes a local unwind. To Local unwind, the system need to approximately 1000 instructions. The local unwind causes a warning C6242. MSDN suggests using __leave keyword(with saving a return value). But I don't think it's a good idea. If we save a return value and leave the block, there will be many mistakes. Is the waring really necessary? What do you prefer?

    Read the article

  • ld: symbol(s) not found with OpenSSL (libssl)

    - by Benjamin
    Hi all, I'm trying to build TorTunnel on my mac. I've successfully installed the Boost library and its development files. TorTunnel also requires the OpenSSL and its development files. I've got them installed in /usr/lib/libssl.dylib and /usr/include/openssl/. When I run the make command this is the error i'm getting: g++ -ggdb -g -O2 -lssl -lboost_system-xgcc42-mt-1_38 -o torproxy TorProxy.o HybridEncryption.o Connection.o Cell.o Directory.o ServerListing.o Util.o Circuit.o CellEncrypter.o RelayCellDispatcher.o CellConsumer.o ProxyShuffler.o CreateCell.o CreatedCell.o TorTunnel.o SocksConnection.o Network.o Undefined symbols: "_BN_hex2bn", referenced from: Circuit::initializeDhParameters() in Circuit.o "_BN_free", referenced from: Circuit::~Circuit()in Circuit.o Circuit::~Circuit()in Circuit.o CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o "_DH_generate_key", referenced from: Circuit::initializeDhParameters() in Circuit.o "_PEM_read_bio_RSAPublicKey", referenced from: ServerListing::getOnionKey() in ServerListing.o "_BIO_s_mem", referenced from: Connection::initializeSSL() in Connection.o Connection::initializeSSL() in Connection.o "_DH_free", referenced from: Circuit::~Circuit()in Circuit.o "_BIO_ctrl_pending", referenced from: Connection::writeFromBuffer(boost::function)in Connection.o "_RSA_size", referenced from: HybridEncryption::encryptInSingleChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o HybridEncryption::encrypt(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o "_RSA_public_encrypt", referenced from: HybridEncryption::encryptInSingleChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o "_BN_num_bits", referenced from: CreateCell::CreateCell(unsigned short, dh_st*, rsa_st*)in CreateCell.o CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o CreatedCell::isValid() in CreatedCell.o "_SHA1", referenced from: CellEncrypter::expandKeyMaterial(unsigned char*, int, unsigned char*, int)in CellEncrypter.o "_BN_bn2bin", referenced from: CreateCell::CreateCell(unsigned short, dh_st*, rsa_st*)in CreateCell.o "_BN_bin2bn", referenced from: CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o "_DH_compute_key", referenced from: CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o "_BIO_new", referenced from: Connection::initializeSSL() in Connection.o Connection::initializeSSL() in Connection.o "_BIO_new_mem_buf", referenced from: ServerListing::getOnionKey() in ServerListing.o "_AES_ctr128_encrypt", referenced from: HybridEncryption::AES_encrypt(unsigned char*, int, unsigned char*, unsigned char*, int)in HybridEncryption.o CellEncrypter::aesOperate(Cell&, aes_key_st*, unsigned char*, unsigned char*, unsigned int*)in CellEncrypter.o "_BIO_read", referenced from: Connection::writeFromBuffer(boost::function)in Connection.o "_SHA1_Update", referenced from: CellEncrypter::calculateDigest(SHAstate_st*, RelayCell&, unsigned char*)in CellEncrypter.o CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o "_SHA1_Final", referenced from: CellEncrypter::calculateDigest(SHAstate_st*, RelayCell&, unsigned char*)in CellEncrypter.o "_DH_size", referenced from: CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o "_DH_new", referenced from: Circuit::initializeDhParameters() in Circuit.o "_BIO_write", referenced from: Connection::readIntoBufferComplete(boost::function, boost::system::error_code const&, unsigned long)in Connection.o "_RSA_free", referenced from: Circuit::~Circuit()in Circuit.o "_BN_dup", referenced from: Circuit::initializeDhParameters() in Circuit.o Circuit::initializeDhParameters() in Circuit.o "_BN_new", referenced from: Circuit::initializeDhParameters() in Circuit.o Circuit::initializeDhParameters() in Circuit.o "_SHA1_Init", referenced from: CellEncrypter::CellEncrypter()in CellEncrypter.o CellEncrypter::CellEncrypter()in CellEncrypter.o "_RAND_bytes", referenced from: HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o Util::getRandomId() in Util.o "_AES_set_encrypt_key", referenced from: HybridEncryption::AES_encrypt(unsigned char*, int, unsigned char*, unsigned char*, int)in HybridEncryption.o CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o "_BN_set_word", referenced from: Circuit::initializeDhParameters() in Circuit.o "_RSA_new", referenced from: ServerListing::getOnionKey() in ServerListing.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [torproxy] Error 1 Any idea how I could fix it?

    Read the article

  • PHP gallery, thumbnail listing

    - by Benjamin
    Hi everyone, I am planning a dynamic PHP photo gallery and having difficulty deciding on the best way to display the thumbnails after they have been retrieved via MySQL. I considered using an inline unordered list but this resulted in the thumbs being stacked one on top of the other (touching). Also tried a table but not sure how I would start the next row after x number of thumbnails. Any suggestions on page layout for this purpose? I will be using Lightbox to cycle through the photos themselves, that isn't the issue. Also, would a while() loop be best for fetching the list of thumbs and inserting the appropriate HTML? Thanks! -Ben

    Read the article

  • Perl script -need some help.

    - by benjamin button
    I have an sql file which will give me an output like below: 10|1 10|2 10|3 11|2 11|4 . . . I am using this in a perl script like below: my @tmp_cycledef = `sqlplus -s $connstr \@DLCycleState.sql`; after this above statement,since tmp_cycledef has all the output of the sql query i want to show the output as: 10 1,2,3 11 2,4 how could i do this using perl?

    Read the article

  • A good Design-by-Contract library for Java?

    - by Chris Jones
    A few years ago, I did a survey of DbC packages for Java, and I wasn't wholly satisfied with any of them. Unfortunately I didn't keep good notes on my findings, and I assume things have changed. Would anybody care to compare and contrast different DbC packages for Java?

    Read the article

  • How can I run NUnit(Selenium Grid) tests in parallel?

    - by Benjamin Lee
    My current project uses NUnit for unit tests and to drive UATs written with Selenium. Developers normally run tests using ReSharper's test runner in VS.Net 2003 and our build box kicks them off via NAnt. We would like to run the UAT tests in parallel so that we can take advantage of Selenium Grid/RCs so that they will be able to run much faster. Does anyone have any thoughts on how this might be achieved? and/or best practices for testing Selenium tests against multiple browsers environments without writing duplicate tests automatically? Thank you.

    Read the article

  • Visualizing an AST created with ANTLR (in a .Net environment)

    - by Benjamin Podszun
    Hi there. For a pet project I started to fiddle with ANTLR. After following some tutorials I'm now trying to create the grammar for my very own language and to generate an AST. For now I'm messing around in ANTLRWorks mostly, but now that I have validated that the parse tree seems to be fine I'd like to (iteratively, because I'm still learning and still need to make some decisions regarding the final structure of the tree) create the AST. It seems that antlrworks won't visualize it (or at least not using the "Interpreter" feature, Debug's not working on any of my machines). Bottom line: Is the only way to visualize the AST the manual way, traversing/showing it or printing the tree in string representation to a console? What I'm looking for is a simple way to go from input, grammar - visual AST representation a la the "Interpreter" feature of ANTLRWorks. Any ideas?

    Read the article

  • Which full-text search package should I use for SQLite3?

    - by Benjamin Pollack
    SQLite3 appears to come with three different full-text search engines, called FTS1, FTS2, and FTS3. The documentation available on the website mentions that FTS1 is stable, FTS2 is in development, and that you should use FTS2. Examples I find online use FTS3, which is in CVS, and not documented versus FTS2. None of the full-text search engines come with the amalgamated source, as near as I can tell. So, my question: which of these three engines, if any, should I use for full-text indexing in SQLite? Or should I simply use a third-party tool like Sphinx, or a custom solution in Lucene, instead?

    Read the article

  • Perl open call failing.

    - by benjamin button
    I am new to perl coding. I am facing a problem while executing a small script i have: open is not able to find the file which i am giving as an argument.Please see below: File is available: ls -l DLmissing_months.sql -rwxr-xr-x 1 tlmwrk61 aimsys 2842 May 16 09:44 DLmissing_months.sql My perl script: #!/usr/local/bin/perl use strict; use warnings; my $this_line = ""; my $do_next = 0; my $file_name = $ARGV[0]; open( my $fh, '<', '$file_name') or die "Error opening file - $!\n"; close($fh); executing the perl script : > new.pl DLmissing_months.sql Error opening file - No such file or directory what is the problem with my perl script.

    Read the article

  • Using TSQLUnit to test INSTEAD OF triggers

    - by Jeff Jones
    I have an INSTEAD OF trigger on a table in my SQL Server 2005 database that checks several incoming values. If an incoming value is invalid, an error is raised and the transaction is rolled back. Otherwise the record is inserted. I would like to include a TSQLUnit test of this trigger where, if an invalid value is inserted, having the transaction rolled back is the successful outcome of the test. I have created a test procedure to do this, but rolling back the transaction aborts execution of the whole suite of tests. Has anyone had success with this? If so, how did you accomplish it? If this is not possible with TSQLUnit, how do you test your triggers? Or do you test them at all?

    Read the article

  • Populating fields in modal form using PHP, jQuery

    - by Benjamin
    I have a form that adds links to a database, deletes them, and -- soon -- allows the user to edit details. I am using jQuery and Ajax heavily on this project and would like to keep all control in the same page. In the past, to handle editing something like details about another website (link entry), I would have sent the user to another PHP page with form fields populated with PHP from a MySQL database table. How do I accomplish this using a jQuery UI modal form and calling the details individually for that particular entry? Here is what I have so far- <?php while ($linkDetails = mysql_fetch_assoc($getLinks)) {?> <div class="linkBox ui-corner-all" id="linkID<?php echo $linkDetails['id'];?>"> <div class="linkHeader"><?php echo $linkDetails['title'];?></div> <div class="linkDescription"><p><?php echo $linkDetails['description'];?></p> <p><strong>Link:</strong><br/> <span class="link"><a href="<?php echo $linkDetails['url'];?>" target="_blank"><?php echo $linkDetails['url'];?></a></span></p></div> <p align="right"> <span class="control"> <span class="delete addButton ui-state-default">Delete</span> <span class="edit addButton ui-state-default">Edit</span> </span> </p> </div> <?php }?> And here is the jQuery that I am using to delete entries- $(".delete").click(function() { var parent = $(this).closest('div'); var id = parent.attr('id'); $("#delete-confirm").dialog({ resizable: false, modal: true, title: 'Delete Link?', buttons: { 'Delete': function() { var dataString = 'id='+ id ; $.ajax({ type: "POST", url: "../includes/forms/delete_link.php", data: dataString, cache: false, success: function() { parent.fadeOut('slow'); $("#delete-confirm").dialog('close'); } }); }, Cancel: function() { $(this).dialog('close'); } } }); return false; }); Everything is working just fine, just need to find a solution to edit. Thanks!

    Read the article

  • SAML Authentication Portal

    - by Alvin Jones
    I'd like to develop a portal similar to what a company like OneLogin (http://www.onelogin.com/) has: The user would login with their login credentials then have links to the web resources that their account is associated with. When they see their resources all they need to do is click on them and they'll be automatically login in (SAML authentication). Are there any open source projects out there that have started on this effort? It would be great if there was something that we could use as a base to build on top of with a friendly license (e.g. MIT). Thanks

    Read the article

  • Using Active Directory and Open ID to authenticate a Play Framework based application.

    - by Nick Jones
    I have an application I am building using the Play Framework. I would like this application to authenticate users using Open ID and Active Directory. Is this possible? Please excuse my ignorance as I am not a J2EE expert but come from a deep knowledge of the .Net framework and some experience writing Java applications. Any guidance would be much appreciated. Thanks in advance.

    Read the article

  • Problem cube mapping in OpenGL using DDS compressed images

    - by Paul Jones
    Hi All, I am having trouble cube mapping when using a DDS cube map, I'm just getting a black cube which leads me to believe I have missing something simple, here's the code so far: DDS_IMAGE_DATA *pDDSImageData = LoadDDSFile(filename); //compressedTexture = -1; if(pDDSImageData != NULL) { int height = pDDSImageData->height; int width = pDDSImageData->width; int numMipMaps = pDDSImageData->numMipMaps; int blockSize; GLenum cubefaces[6] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, }; if( pDDSImageData->format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ) blockSize = 8; else blockSize = 16; glGenTextures( 1, &textureId ); int nSize; int nOffset = 0; glEnable(GL_TEXTURE_CUBE_MAP); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); for(int face = 0; face < 6; face++) { for( int i = 0; i < numMipMaps; i++ ) { if( width == 0 ) width = 1; if( height == 0 ) height = 1; glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_GENERATE_MIPMAP, GL_TRUE); nSize = ((width+3)>>2) * ((height+3)>>2) * blockSize; glCompressedTexImage2D(cubefaces[face] , i, pDDSImageData->format, width, height, 0, nSize, pDDSImageData->pixels + nOffset ); nOffset += nSize; // Half the image size for the next mip-map level... width = (width / 2); height = (height / 2); } } } Once this code is called I bind the texture using glBindTexture and draw a cube using GL_QUADS and glTexCoord3f. Thank you for reading and all comments are welcome, sorry if any of the formatting comes out wrong.

    Read the article

  • viewing the updated data in a file

    - by benjamin button
    If i have file for eg: a log file created by any background process on unix, how do i view the data that getting updated each and every time. i know that i can use tail command to see the file.but let's say i have used tail -10 file.txt it will give the last 10 lines.but if lets say at one time 10 lines got added and at the next instance it has been added 2 lines. now from the tail command i can see previous 8 lines also.i don't want this.i want only those two lines which were added. In short i want to view only those lines which were appended.how can i do this?

    Read the article

  • Core dump of a multithreaded program

    - by benjamin button
    Hi, i have regularly worked with single threaded programs. i never saw a multithreded program crashing since i havent worked on any. is there any difference between both teh core dumps? is there any additional information provided in the core dump of a multithreaded program when compared to a single threaded program?

    Read the article

  • Printing the exact content of a text file in java

    - by Benjamin
    I want to print the content of a simple text file in java exactly the way the text appears in the text file. The print out has the same content as the text file but the format is not the same. tabs and line breaks are ignored in the print out. Any help will be very much appreciated.

    Read the article

  • Printing the exact content of a text file in java

    - by Benjamin
    I want to print the content of a simple text file in java exactly the way the text appears in the text file. The print out has the same content as the text file but the format is not the same. tabs and line breaks are ignored in the print out. Any help will be very much appreciated.

    Read the article

  • jquery anchor to html extract

    - by Benjamin Ortuzar
    I would like to implement something similar to the Google quick scroll extension with jquery for the extracts of a search result, so when the full document is opened (within the same website) it gives the user the opportunity to go straight to the extract location. Here is a sample of what I get returned from the search engine when I search for 'food'. <doc> <docid>129305</docid> <title><span class='highlighted'>Food</span></title> <summary> <summarytext>Papers subject to Negative Resolution: 4 <span class='highlighted'>Food</span> <span class='highlighted'>Food</span> Irradiation (England) Regulations 2009 (S.I., 2009, No. 1584), dated 24 June 2009 (by Act), </summarytext> </summary> <paras> <paraitemcount>2</paraitemcount> <para> <paraitem>1</paraitem> <paraid>42</paraid> <pararelevance>100</pararelevance> <paraweights>50</paraweights> <paratext>4 <span class='highlighted'>Food</span></paratext> </para> <para> <paraitem>2</paraitem> <paraid>54</paraid> <pararelevance>100</pararelevance> <paraweights>50</paraweights> <paratext><span class='highlighted'>Food</span> Irradiation (England) Regulations 2009 (S.I., 2009, No. 1584), dated 24 June 2009 (by Act), with an Explanatory Memorandum and an Impact Assessment (</paratext> </para> </paras> </doc> As you see the search engine has returned a document that contains one summary and two extracts. So let's say the user clicks on the second extract in the search resutls page, the browser would open the detailed document in the same website, and would offer the user the possibility to go to the extract as the Google quick scroll extension does. Is there an existing jquery script for this? If not, can you suggest any jquery/javascript code that would simplify my task to implement this. Notes: I can access the extracts from the document details page. I'm aware that the HTML in some cases could be slightly different in the extract than in the details page, finding no match. The search engine does not return where the extract was located. At the moment I'm trying to understand the JS code that the extension uses.

    Read the article

  • IE8 won't load JavaScript file in "Compatibility View."

    - by Don Jones
    Here's my JS insert: <script type="text/javascript" src="include/profile.js"></script> In IE8 with "Compatibility View," the file never loads. The first line in the file is a simple alert() call, so that I know it loaded. Change the browser to Standards View, and it loads fine. Also, if I add: <meta http-equiv="X-UA-Compatible" content="IE=100" > It forces to Standards View and it loads fine. Any idea why this would be the case? I've not been able to test against IE7, but I know the JS file also does not load in IE6. Right now the tag is in the section of the file.

    Read the article

  • Opening web page within existing web page

    - by Bob Jones
    I need to be able to load web pages from different sites within a page on my site. I am using C# .NET and master pages. Within the content page, I want to be able to load an arbitrary page and display it without any of the browser controls appearing - just the page content.

    Read the article

  • VirtualTreeView add roots with Threads

    - by Benjamin Weiss
    I would like to add roots to a VirtualTreeView http://www.delphi-gems.com/index.php/controls/virtual-treeview with a thread like this: function AddRoot ( p : TForm1 ) : Integer; stdcall; begin p.VirtualStringTree1.AddChild(NIL); end; var Dummy : DWORD; i : Integer; begin for i := 0 to 2000 do begin CloseHandle(CreateThread(NIL,0, @ADDROOT, Self,0, Dummy)); end; end; The reason for this is that I want to add all connections from my INDY Server to the TreeView. Indy's onexecute/onconnect get's called as a thread. So if 3+ connections come in at the same time the app crashes due to the TreeView. Same is if a client gets disconnected and I want to delete the Node. I am using Delphi7 and Indy9 Any Idea how to fix that?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >