Search Results

Search found 688 results on 28 pages for 'md nth'.

Page 6/28 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • How do I find the millionth number in the series: 2 3 4 6 9 13 19 28 42 63 ... ?

    - by HH
    It takes about minute to achieve 3000 in my comp but I need to know the millionth number in the series. The definition is recursive so I cannot see any shortcuts except to calculate everything before the millionth number. How can you fast calculate millionth number in the series? Series Def n_{i+1} = \floor{ 3/2 * n_{i} } and n_{0}=2. Interestingly, only one site list the series according to Google: this one. Too slow Bash code #!/bin/bash function series { n=$( echo "3/2*$n" | bc -l | tr '\n' ' ' | sed -e 's@\\@@g' -e 's@ @@g' ); # bc gives \ at very large numbers, sed-tr for it n=$( echo $n/1 | bc ) #DUMMY FLOOR func } n=2 nth=1 while [ true ]; #$nth -lt 500 ]; do series $n # n gets new value in the function through global value echo $nth $n nth=$( echo $nth + 1 | bc ) #n++ done

    Read the article

  • Millionth number in the serie 2 3 4 6 9 13 19 28 42 63 ... ?

    - by HH
    It takes about minute to achieve 3000 in my comp but I need to know the millionth number in the serie. The definition is recursive so I cannot see any shortcuts except to calculate everything before the millionth number. How can you fast calculate millionth number in the serie? Serie Def n_{i+1} = \floor{ 3/2 * n_{i} } and n_{0}=2. Interestingly, only one site list the serie according to Goolge: this one. Too slow Bash code #!/bin/bash function serie { n=$( echo "3/2*$n" | bc -l | tr '\n' ' ' | sed -e 's@\\@@g' -e 's@ @@g' ); # bc gives \ at very large numbers, sed-tr for it n=$( echo $n/1 | bc ) #DUMMY FLOOR func } n=2 nth=1 while [ true ]; #$nth -lt 500 ]; do serie $n # n gets new value in the function throught global value echo $nth $n nth=$( echo $nth + 1 | bc ) #n++ done

    Read the article

  • How to solve programming problems using logic? [closed]

    - by md nth
    I know these principles: Define the constrains and operations,eg constrains are the rules that you cant pass and what you want determined by the end goal, operations are actions you can do, "choices" . Buy some time by solving easy and solvable piece. Halving the difficulty by dividing the project into small goals and blocks. The more blocks you create the more hinges you have. Analogies which means : using other code blocks, yours or from other programmers . which has problem similar to the current problem. Experiments not guessing by writing "predicted end" code, in other word creating a hypothesis, about what will happen if you do this or that. Use your tools first, don't begin with a unknown code first. By making small goals you ll not get frustrated. Start from smallest problem. Are there other principles?

    Read the article

  • Why Sql not bringing back results unless I set varchar size?

    - by Tom
    I've got an SQL script that fetches results based on the colour passed to it, but unless I set the size of the variable defined as a varchar to (50) no results are returned. If I use: like ''+@Colour+'%' then it works but I don't really want to use it in case it brings back results I don't need or want. The column FieldValue has a type of Varchar(Max) (which can't be changed as this field can store different things). It is part of aspdotnetstorefront package so I can't really change the tables or field types. This doesn't work: declare @Col VarChar set @Col = 'blu' select * from dbo.MetaData as MD where MD.FieldValue = @Colour But this does work: declare @Col VarChar (50) set @Col = 'blu' select * from dbo.MetaData as MD where MD.FieldValue = @Colour The code is used in the following context, but should work either way <query name="Products" rowElementName="Variant"> <sql> <![CDATA[ select * from dbo.MetaData as MD where MD.Colour = @Colour ]]> </sql> <queryparam paramname="@ProductID" paramtype="runtime" requestparamname="pID" sqlDataType="int" defvalue="0" validationpattern="^\d{1,10}$" /> <queryparam paramname="@Colour" paramtype="runtime" requestparamname="pCol" sqlDataType="varchar" defvalue="" validationpattern=""/> </query> Any Ideas?

    Read the article

  • Improve speed of a JOIN in MySQL

    - by ran2
    Dear all, I know there a similar threads around, but this is really the first time I realize that query speed might affect me - so it´s not that easy for me to really make the transfer from other folks problems. That being said I have using the following query successfully with smaller data, but if I use it on what are mildly large tables (about 120,000 records). I am waiting for hours. INSERT INTO anothertable (id,someint1,someint1,somevarchar1,somevarchar1) SELECT DISTINCT md.id,md.someint1,md.someint1,md.somevarchar1,pd.somevarchar1 from table1 AS md JOIN table2 AS pd ON (md.id = pd.id); Tables 1 and 2 contain about 120,000 records. The query has been running for almost 2 hours right now. Is this normal? Do I just have to wait. I really have no idea, but I am pretty sure that one could do it better since it´s my very first try. I read about indexing, but dont know yet what to index in my case? Thanks for any suggestions - feel free to point my to the very beginners guides ! best matt

    Read the article

  • What is the proper way to code a read-while loop in Scala?

    - by ARKBAN
    What is the "proper" of writing the standard read-while loop in Scala? By proper I mean written in a Scala-like way as opposed to a Java-like way. Here is the code I have in Java: MessageDigest md = MessageDigest.getInstance( "MD5" ); InputStream input = new FileInputStream( "file" ); byte[] buffer = new byte[1024]; int readLen; while( ( readLen = input.read( buffer ) ) != -1 ) md.update( buffer, 0, readLen ); return md.digest(); Here is the code I have in Scala: val md = MessageDigest.getInstance( hashInfo.algorithm ) val input = new FileInputStream( "file" ) val buffer = new Array[ Byte ]( 1024 ) var readLen = 0 while( readLen != -1 ) { readLen = input.read( buffer ) if( readLen != -1 ) md.update( buffer, 0, readLen ) } md.digest The Scala code is correct and works, but feels very un-Scala-ish. For one it is a literal translation of the Java code, taking advantage of none of the advantages of Scala. Further it is actually longer than the Java code! I really feel like I'm missing something, but I can't figure out what. I'm fairly new to Scala, and so I'm asking the question to avoid falling into the pitfall of writing Java-style code in Scala. I'm more interested in the Scala way to solve this kind of problem than in any specific helper method that might be provided by the Scala API to hash a file. (I apologize in advance for my ad hoc Scala adjectives throughout this question.)

    Read the article

  • How can I extract the nth occurrence of a match in a Perl regex?

    - by Zaid
    Is it possible to extract the n'th match in a string of single-quoted words? use strict; use warnings; my $string1 = '\'I want to\' \'extract the word\' \'Perl\',\'from this string\''; my $string2 = '\'What about\',\'getting\',\'Perl\',\'from\',\'here\',\'?\''; sub extract_quoted { my ($string, $index) = @_; my ($wanted) = $string =~ /some_regex_using _$index/; return $wanted; } extract_wanted ($string1, 3); # Should return 'Perl', with quotes extract_wanted ($string2, 3); # Should return 'Perl', with quotes

    Read the article

  • How can I substitute the nth occurrence of a match in a Perl regex?

    - by Zaid
    Following up from an earlier question on extracting the n'th regex match, I now need to substitute the match, if found. I thought that I could define the extraction subroutine and call it in the substitution with the /e modifier. I was obviously wrong (admittedly, I had an XY problem). use strict; use warnings; sub extract_quoted { # à la codaddict my ($string, $index) = @_; while($string =~ /'(.*?)'/g) { $index--; return $1 if(! $index); } return; } my $string = "'How can I','use' 'PERL','to process this' 'line'"; extract_quoted ( $string, 3 ); $string =~ s/&extract_quoted($string,2)/'Perl'/e; print $string; # Prints 'How can I','use' 'PERL','to process this' 'line' There are, of course, many other issues with this technique: What if there are identical matches at different positions? What if the match isn't found? In light of this situation, I'm wondering in what ways this could be implemented.

    Read the article

  • Find out 20th, 30th, nth prime number. (I'm getting 20th but not 30th?) [Python]

    - by gsin
    The question is to find the 1000th prime number. I wrote the following python code for this. The problem is, I get the right answer for the 10th , 20th prime but after that each increment of 10 leaves me one off the mark. I can't catch the bug here :( count=1 #to keep count of prime numbers primes=() #tuple to hold primes candidate=3 #variable to test for primes while count<20: for x in range(2,candidate): if candidate%x==0: candidate=candidate+2 else : pass primes=primes+(candidate,) candidate=candidate+2 count=count+1 print primes print "20th prime is ", primes[-1] In case you're wondering, count is initialised as 1 because I am not testing for 2 as a prime number(I'm starting from 3) and candidate is being incremented by 2 because only odd numbers can be prime numbers. I know there are other ways of solving this problem, such as the prime number theorem but I wanna know what's wrong with this approach. Also if there are any optimisations you have in mind, please suggest. Thank You

    Read the article

  • xsl:variable contains nodeset. How to output nth node of variable?

    - by dnagirl
    I am transforming an XML document. There is an attribute @prettydate that is a string similar to "Friday, May 7, 2010". I want to split that string and add links to the month and the year. I am using the exslt:strings module and I can add any other necessary EXSLT module. This is my code so far: <xsl:template match="//calendar"> <xsl:variable name="prettyparts"> <xsl:value-of select="str:split(@prettydate,', ')"/> </xsl:variable> <table class='day'> <thead> <caption><xsl:value-of select="$prettyparts[1]"/>, <a> <xsl:attribute name='href'><xsl:value-of select="$baseref"/>?date=<xsl:value-of select="@highlight"/>&amp;per=m</xsl:attribute> <xsl:value-of select='$prettyparts[2]'/> </a> <xsl:value-of select='$prettyparts[3]'/>, <a> <xsl:attribute name='href'><xsl:value-of select="$baseref"/>?date=<xsl:value-of select="@highlight"/>&amp;per=y</xsl:attribute> <xsl:value-of select='$prettyparts[4]'/> </a> </caption> <!--etcetera--> I have verified, by running $prettyparts through a <xml:for-each/> that I am getting the expected nodeset: <token>Friday</token> <token>May</token> <token>7</token> <token>2010</token> But no matter which way I attempt to refer to a particular <token> directly (not in a foreach) I get nothing or various errors to do with invalid types. Here's some of the syntax I've tried: <xsl:value-of select="$prettyparts[2]"/> <xsl:value-of select="$prettyparts/token[2]"/> <xsl:value-of select="exsl:node-set($prettyparts/token[2])"/> <xsl:value-of select="exsl:node-set($prettyparts/token)[2]"/> Any idea what the expression ought to be?

    Read the article

  • How to replace the nth column/field in a comma-separated string using sed/awk?

    - by Peter Meier
    assume I have a string "1,2,3,4" Now I want to replace, e.g. the 3rd field of the string by some different value. "1,2,NEW,4" I managed to do this with the following command: echo "1,2,3,4" | awk -F, -v OFS=, '{$3="NEW"; print }' Now the index for the column to be replaced should be passed as a variable. So in this case index=3 How can I pass this to awk? Because this won't work: echo "1,2,3,4" | awk -F, -v OFS=, '{$index="NEW"; print }' echo "1,2,3,4" | awk -F, -v OFS=, '{$($index)="NEW"; print }' echo "1,2,3,4" | awk -F, -v OFS=, '{\$$index="NEW"; print }' Thanks for your help!

    Read the article

  • How do I get every nth row in a table, or how do I break up a subset of a table into sets or rows of

    - by Jherico
    I have a table of heterogeneous pieces of data identified by a primary key (ID) and a type identifier (TYPE_ID). I would like to be able to perform a query that returns me a set of ranges for a given type broken into even page sizes. For instance, if there are 10,000 records of type '1' and I specify a page size of 1000, I want 10 pairs of numbers back representing values I can use in a BETWEEN clause in subsequent queries to query the DB 1000 records at a time. My initial attempt was something like this select id, rownum from CONTENT_TABLE where type_id = ? and mod(rownum, ?) = 0 But this doesn't work.

    Read the article

  • Why does the :nth-child(2) selector work on what I expect to be :first-child?

    - by Ben
    I have an example of what I'm trying to ask. I use this kind of format often. I'd expect to be able to select that first div with fieldset div:first-child { } but it seems that it's only grabbed by the 2nd child selector. I would expect "field 1" to be red and not blue. It makes more sense semantically (to me at least) to say "style the first div in the fieldset like so" instead of saying the 2nd. Why is this happening and is there a way to achieve the effect I want (to be able to call div:first-child)?

    Read the article

  • In Lua, can I easily select the Nth result without custom functions?

    - by romkyns
    Suppose I am inserting a string into a table as follows: table.insert(tbl, mystring) and that mystring is generated by replacing all occurrences of "a" with "b" in input: mystring = string.gsub(input, "a", "b") The obvious way to combine the two into one statement doesn't work, because gsub returns two results: table.insert(tbl, string.gsub(input, "a", "b")) -- error! -- (second result of gsub is passed into table.insert) which, I suppose, is the price paid for supporting multiple return values. The question is, is there a standard, built-in way to select just the first return value? When I found select I thought that was exactly what it did, but alas, it actually selects all results from N onwards, and so doesn't help in this scenario. Now I know I can define my own select as follows: function select1(n, ...) return arg[n] end table.insert(tbl, select1(1, string.gsub(input, "a", "b"))) but this doesn't look right, since I'd expect a built-in way of doing this. So, am I missing some built-in construct? If not, do Lua developers tend to use a separate variable to extract the correct argument or write their own select1 functions?

    Read the article

  • Ubuntu server 12.04.03 not checking disk partitions on reboot?

    - by jamesc
    My MOTD is showing: *** /dev/md2 will be checked for errors at next reboot *** *** /dev/md1 will be checked for errors at next reboot *** *** /dev/md3 will be checked for errors at next reboot *** However, a standard sudo shutdown -r now does not appear to check the disks and the message remains. My guess is that the partitions 'should' be checked and that they are not being... so how can I get Ubuntu to check the partitions at reboot and keep things nice and safe? Update - this is the output of cat /etc/fstab proc /proc proc defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 /dev/md/0 none swap sw 0 0 /dev/md/1 /boot ext3 defaults 0 0 /dev/md/2 / ext4 defaults 0 0 /dev/md/3 /home ext4 defaults 0 0 Update 2 - One message gone... Using @christianwolff's suggestions... sudo rm /var/lib/update-notifier/fsck-at-reboot sudo touch /forcefsck sudo shutdown -r now And now the motd is down to *** /dev/md1 will be checked for errors at next reboot *** *** /dev/md3 will be checked for errors at next reboot *** So 'md2(ext4)' has been checked and the message updated.

    Read the article

  • Linux software RAID6: 3 drives offline - how to force online?

    - by Ole Tange
    This is similar to 3 drives fell out of Raid6 mdadm - rebuilding? except that it is not due to a failing cable. Instead the 3rd drive fell offline during rebuild of another drive. The drive failed with: kernel: end_request: I/O error, dev sdc, sector 293732432 kernel: md/raid:md0: read error not correctable (sector 293734224 on sdc). After rebooting both these sectors and the sectors around them are fine. This leads me to believe the error is intermittent and thus the device simply took too long to error correct the sector and remap it. I expect that no data was written to the RAID after it failed. Therefore I hope that if I can kick the last failing device online that the RAID is fine and that the xfs_filesystem is OK, maybe with a few missing recent files. Taking a backup of the disks in the RAID takes 24 hours, so I would prefer that the solution works the first time. I have therefore set up a test scenario: export PRE=3 parallel dd if=/dev/zero of=/tmp/raid${PRE}{} bs=1k count=1000k ::: 1 2 3 4 5 parallel mknod /dev/loop${PRE}{} b 7 ${PRE}{} \; losetup /dev/loop${PRE}{} /tmp/raid${PRE}{} ::: 1 2 3 4 5 mdadm --create /dev/md$PRE -c 4096 --level=6 --raid-devices=5 /dev/loop${PRE}[12345] cat /proc/mdstat mkfs.xfs -f /dev/md$PRE mkdir -p /mnt/disk2 umount -l /mnt/disk2 mount /dev/md$PRE /mnt/disk2 seq 1000 | parallel -j1 mkdir -p /mnt/disk2/{}\;cp /bin/* /mnt/disk2/{}\;sleep 0.5 & mdadm --fail /dev/md$PRE /dev/loop${PRE}3 /dev/loop${PRE}4 cat /proc/mdstat # Assume reboot so no process is using the dir kill %1; sync & kill %1; sync & # Force fail one too many mdadm --fail /dev/md$PRE /dev/loop${PRE}1 parallel --tag -k mdadm -E ::: /dev/loop${PRE}? | grep Upda # loop 2,5 are newest. loop1 almost newest => force add loop1 Next step is to add loop1 back - and this is where I am stuck. After that do a xfs-consistency check. When that works, check that the solution also works on real devices (such a 4 USB sticks).

    Read the article

  • Foreign keys and pagination

    - by whitstone86
    This is my pagination script: <?php /*********************************** * PhpMyCoder Paginator * * Created By PhpMyCoder * * 2010 PhpMyCoder * * ------------------------------- * * You may use this code as long * * as this notice stays intact and * * the proper credit is given to * * the author. * ***********************************/ ?> <head> <title> Pagination Test - Created By PhpMyCoder</title> <style type="text/css"> #nav { font: normal 13px/14px Arial, Helvetica, sans-serif; margin: 2px 0; } #nav a { background: #EEE; border: 1px solid #DDD; color: #000080; padding: 1px 7px; text-decoration: none; } #nav strong { background: #000080; border: 1px solid #DDD; color: #FFF; font-weight: normal; padding: 1px 7px; } #nav span { background: #FFF; border: 1px solid #DDD; color: #999; padding: 1px 7px; } </style> </head> <?php //Require the file that contains the required classes include("pmcPagination.php"); //PhpMyCoder Paginator $paginator = new pmcPagination(20, "page"); //Connect to the database mysql_connect("localhost","root","PASSWORD"); //Select DB mysql_select_db("tvguide"); //Select only results for today and future $result = mysql_query("SELECT programme, channel, airdate, expiration, episode, setreminder FROM epdata1 where airdate >= now() order by expiration GROUP BY airdate"); //You can also add reuslts to paginate here mysql_data_seek($queryresult,0) ; while($row = mysql_fetch_array($result)) { $paginator->add(new paginationData($row['programme'], $row['channel'], $row['airdate'], $row['expiration'], $row['episode'], $row['setreminder'])); } ?> <?php //Show the paginated results $paginator->paginate (); ?><? include("pca-footer1.php"); ?> <?php //Show the navigation $paginator->navigation(); ?> However, I have two tables in this, and they are epdata1 (where the airtimes for my show House M.D. are) and housemdep plus the setreminder table. How can I use foreign keys in relation to this? I'm not sure if this will work for my script, but am willing to try. What I would like to do is to select certain episodes from the table housemdep (episodes of the show) and if any are selected it shows them as this: House M.D. showing on Channel 1 June 6th - 8:00pm "Wilson" Set Reminder House M.D. showing on Channel 1 June 7th - 1:30am "Wilson" Set Reminder House M.D. showing on Channel 1 June 7th - 12:55pm "House's Head" Set Reminder or like this, if I have not selected an episode from the row: House M.D. showing on Channel 1 June 7th - 8:00pm "House's Head" Set Reminder House M.D. showing on Channel 1 June 8th - 9:00pm Set Reminder House M.D. showing on Channel 1 June 9th - 2:30pm Set Reminder House M.D. showing on Channel 1 June 7th - 8:00pm "Que Sera Sera" Set Reminder Foreign keys and relationship of interlinked tables are new to me, if anyone could help I'd appreciate this. I've tried some of what Google suggested on foreign keys in another version of this script (this is a clone of the original on my localhost server running Apache and PHP 5.28/MySQL), but am not sure how to implement this. Thanks.

    Read the article

  • preseeded installation keeps asking for confirmation while creating RAID-Partitions on certain hardware-platform

    - by Marc Shennon
    I am aware of the partman-md/confirm_nooverwrite thing, that was the solution to most of this problems in the past. The thing is, that the preseed-file works for almost all hardware-platforms I tested, but only for one (Primergy MX130) it keeps asking for confirmation, before writing the partition-layout to the disks. All machines I tested are running with two SATA Disks, nothing special. I'm not really sure, what information could be needed in order to investigate the cause of this behaviour, but I would of course be willing to provide more information, if someone has an idea. Relevant part of the preseed file is the following: d-i partman-auto/disk string /dev/sda /dev/sdb d-i partman-auto/method string raid d-i partman-md/confirm boolean true d-i partman-partitioning/confirm_write_new_label boolean true d-i partman-md/device_remove_md boolean true d-i partman/choose_partition select finish d-i partman-md/confirm_nooverwrite boolean true # Write the changes to disks? d-i partman/confirm boolean true d-i mdadm/boot_degraded boolean true # RECIPE # Next you need to specify the physical partitions that will be used. d-i partman-auto/expert_recipe string \ multiraid :: \ 500 10000 1000000000 raid $lvmignore{ }\ $primary{ } \ method{ raid } \ . \ 512 1000 786 raid $lvmignore{ }\ $primary{ } \ method{ raid } \ . \ 8192 10240 10240 raid $lvmignore{ }\ method{ raid } \ . # Parameters are: # <raidtype> <devcount> <sparecount> <fstype> <mountpoint> <devices> <sparedevices> d-i partman-auto-raid/recipe string \ 1 2 0 ext4 / /dev/sda1#/dev/sdb1 . \ 1 2 0 ext2 /boot /dev/sda2#/dev/sdb2 . \ 1 2 0 swap - /dev/sda5#/dev/sdb5 .

    Read the article

  • Problem in udp socket programing in c

    - by Md. Talha
    I complile the following C code of UDP client after I run './udpclient localhost 9191' in terminal.I put "Enter Text= " as Hello, but it is showing error in sendto as below: Enter text: hello hello : error in sendto()guest-1SDRJ2@md-K42F:~/Desktop$ " Note: I open 1st the server port as below in other terminal ./server 9191. I beleive there is no error in server code. The udp client is not passing message to server. If I don't use thread , the message is passing .But I have to do it by thread. UDP client Code: /* simple UDP echo client */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <stdio.h> #include <pthread.h> #define STRLEN 1024 static void *readdata(void *); static void *writedata(void *); int sockfd, n, slen; struct sockaddr_in servaddr; char sendline[STRLEN], recvline[STRLEN]; int main(int argc, char *argv[]) { pthread_t readid,writeid; struct sockaddr_in servaddr; struct hostent *h; if(argc != 3) { printf("Usage: %s <proxy server ip> <port>\n", argv[0]); exit(0); } /* create hostent structure from user entered host name*/ if ( (h = gethostbyname(argv[1])) == NULL) { printf("\n%s: error in gethostbyname()", argv[0]); exit(0); } /* create server address structure */ bzero(&servaddr, sizeof(servaddr)); /* initialize it */ servaddr.sin_family = AF_INET; memcpy((char *) &servaddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length); servaddr.sin_port = htons(atoi(argv[2])); /* get the port number from argv[2]*/ /* create a UDP socket: SOCK_DGRAM */ if ( (sockfd = socket(AF_INET,SOCK_DGRAM, 0)) < 0) { printf("\n%s: error in socket()", argv[0]); exit(0); } pthread_create(&readid,NULL,&readdata,NULL); pthread_create(&writeid,NULL,&writedata,NULL); while(1) { }; close(sockfd); } static void * writedata(void *arg) { /* get user input */ printf("\nEnter text: "); do { if (fgets(sendline, STRLEN, stdin) == NULL) { printf("\n%s: error in fgets()"); exit(0); } /* send a text */ if (sendto(sockfd, sendline, sizeof(sendline), 0, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0) { printf("\n%s: error in sendto()"); exit(0); } }while(1); } static void * readdata(void *arg) { /* wait for echo */ slen = sizeof(servaddr); if ( (n = recvfrom(sockfd, recvline, STRLEN, 0, (struct sockaddr *) &servaddr, &slen)) < 0) { printf("\n%s: error in recvfrom()"); exit(0); } /* null terminate the string */ recvline[n] = 0; fputs(recvline, stdout); }

    Read the article

  • Problem with executing dssp (secondary structure assignment)

    - by Mana
    I followed a previous post to install dssp on ubuntu How to install dssp (secondary structure assignments) under 12.04? After the installation I tried to execute dssp which was in /usr/local/bin/dssp But it gave me the following error bash: /usr/local/bin/dssp: cannot execute binary file Also I tried to analyse some trajectory files from a simulation using the code do_dssp -s md.tpr -f traj.xtc But it also failed giving me the error below Reading file md.tpr, VERSION 4.5.5 (single precision) Reading file md.tpr, VERSION 4.5.5 (single precision) Segmentation fault (core dumped) Please post me a solution for this problem. Thank you!

    Read the article

  • Project Euler 7: (Iron)Python

    - by Ben Griswold
    In my attempt to learn (Iron)Python out in the open, here’s my solution for Project Euler Problem 7.  As always, any feedback is welcome. # Euler 7 # http://projecteuler.net/index.php?section=problems&id=7 # By listing the first six prime numbers: 2, 3, 5, 7, # 11, and 13, we can see that the 6th prime is 13. What # is the 10001st prime number? import time start = time.time() def nthPrime(nth): primes = [2] number = 3 while len(primes) < nth: isPrime = True for prime in primes: if number % prime == 0: isPrime = False break if (prime * prime > number): break if isPrime: primes.append(number) number += 2 return primes[nth - 1] print nthPrime(10001) print "Elapsed Time:", (time.time() - start) * 1000, "millisecs" a=raw_input('Press return to continue')

    Read the article

  • F# on Mac: Syntax Error on Inner Function

    - by JBristow
    The following code: exception NoElements of string let nth(k, list) = let rec loop count list = match list with | head :: _ when count = k -> head | _ :: tail when count <> k -> loop (count+1) tail | [] -> raise (NoElements("No Elements")) loop 0 list ;; printfn "%A" (nth(2, [1, 1, 2, 3, 5, 8])) Produces the following errors when compiling on a mac, but not in Visual Studio 2010: nth.fs(10,0): error FS0191: syntax error. nth.fs(4,4): error FS0191: no matching 'in' found for this 'let'.

    Read the article

  • How to create a custom ADO Multi Dimensional Catalog with no database

    - by Alan Clark
    Does anyone know of an example of how to dynamically define and build ADO MD (ActiveX Data Objects Multidimensional) catalogs and cube definitions with a set of data other than a database? Background: we have a huge amount of data in our application that we export to a database and then query using the usual SQL joins, groups, sums etc to produce reports. The data in the application is originally in objects and arrays. The problem is the amount of data is so large the export can take 2 hours. So I am trying to figure out a good way of querying the objects in memory, either by a custom OLAP algorithm or library, or ADO MD. But I haven't been able to find an example of using ADO MD without a database behind it. We are using Delphi 2010 so would use ADO ActiveX but I imagine the ADO.NET MD is similar. I realize that if the application data was already stored in a database the problem would solve itself. Also if Delphi had LINQ capability I could query the objects and arrays that way.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >