Posts

python - Key error in dna complement -

python - Key error in dna complement - import string import os,sys file=open("c:\python27\\new text document.txt",'r')\ seq =file.readlines() basecomplement = {'a': 't', 'c': 'g', 'g': 'c', 't': 'a'} def translate(seq): aaseq = [] str in seq: aaseq.append(basecomplement[str]) homecoming aaseq frame in range(1): rseqn= (''.join(item.split('|')[0] item in translate(seq[frame:]))) rseqn = rseqn[::-1] print(rseqn) print(seq) error here file "c:\users\ram\desktop\pythonhw\dnacomp.py", line 13, in <module> rseqn= (''.join(item.split('|')[0] item in translate(seq[frame:]))) file "c:\users\ram\desktop\pythonhw\dnacomp.py", line 10, in translate aaseq.append(basecomplement[str]) keyerror: 'agtctggcataccagtacagactatca' if utilize simple string getting sequence tried read file input shows next err...

java - Assigning a HashMap to a variable within JSP -

java - Assigning a HashMap to a variable within JSP - i have controller servlet creating object , placing hashmap , i'm forwarding jsp attribute, in jsp wish set hashmap variable, how able this? see code below: controllerservlet map<integer, post> posts = new hashmap<integer, post>(); // needs refactoring db query post p = new post(); p.setid(1); p.settitle("hello world!"); p.setbody("this first blog post!"); p.setauthor("jacob clark"); p.setpublished(new date()); posts.put(p.getid(), p); getservletcontext().setattribute("posts", posts); requestdispatcher rd = getservletcontext().getrequestdispatcher("/web-inf/index.jsp"); rd.forward(request, response); jsp getservletcontext().getattribute("posts") please not utilize servletcontext communicate between servlet , jsp page ! you'd improve utilize request attributes usage, servletcontext attributes mutual servlets , sessions. ...

mongodb not running properly due to recovery problems -

mongodb not running properly due to recovery problems - how repair mongodb, not running due recovery problems: journal dir=/data/db/journal recover : no journal files present, no recovery needed error: listen(): bind() failed errno:98 address in utilize socket: 0.0.0.0:27017 error: addr in utilize error: listen(): bind() failed errno:98 address in utilize socket: 0.0.0.0:28017 [initandlisten] exiting [websvr] error: addr in utilize dbexit: shutdown: going close listening sockets... mongodb

/etc/ssh/ssh_host_rsa_key.pub is not a public key file -

/etc/ssh/ssh_host_rsa_key.pub is not a public key file - can't check server rsa fingerprint. doing wrong? $ ls /etc/ssh moduli ssh_host_dsa_key ssh_host_key.pub ssh_config ssh_host_dsa_key.pub ssh_host_rsa_key sshd_config ssh_host_key ssh_host_rsa_key.pub $ ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_rsa_key.pub not public key file. $ ssh-keygen -lf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key not public key file. that file permissions problem. $ cat /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_rsa_key.pub: permission denied ssh ssh-keys openssh

excel - To Resolve - HRESULT : 800706BE exception -

excel - To Resolve - HRESULT : 800706BE exception - error: remote procedural phone call failed. (exception hresult:0x800706be) occurs when task/programming opens excel file during process. accessed excel file type macro enabled , loaded conditions of macro on workbook. purpose: in task when open excel file multiple times, @ point shows error , process fails. solution looking : want avoid happening , how resolve behaviour advice/suggestion. thanks in advance. excel excel-vba error-handling runtime-error hresult

matlab - vectorized block assign with overlopping values -

matlab - vectorized block assign with overlopping values - so ran bug today a_test(dest,:)=a_test(source,:)+a_test(dest,:); a_test(:,dest)=a_test(:,source)+a_test(:,dest); if dest non-unique, fails (which makes sense). quick prepare loop on dest for (k=1:numel(dest)) a(dest(k),:)=a(source(k),:)+a(dest(k),:); a(:,dest(k))=a(:,source(k))+a(:,dest(k)); end and matlab bad @ such loops. how 1 vectorize call? with following, show how rows. columns, it's similar approach different code, i'll explain why. to summarize, have matrix a, n rows , p columns. have list of integers in range [1,n] , src , , idem dst . i'm assuming both have same size, , might contain more n elements (so there repetitions in both potentially). grouping src s dst s, it's clear operation you're talking equivalent linear recombination of rows. equivalent pre-multiplication n x n matrix in element (i,j) = k means "the recombination corresponding destination r...

python 2.7 - Memory usage during and after drop_duplicates() -

python 2.7 - Memory usage during and after drop_duplicates() - i working info frame takes 2 gb of memory (according htop) dimensions (6287475,19). info frame heterogeneous in info type, not matter. after loading info frame drop duplicate rows using command df.drop_duplicates(inplace=true) during execution of command memory usage jumps 7 gb. after command completed memory reduced 5 gb, more twice memory required store single instance of info frame. if delete info frame del df memory usage decreases 3 gb. the behavior same if following: df2 = df.drop_duplicates del df del df2 running gc.collect() nil , memory usage returns baseline level after terminating python session. memory leak? has seen similar behavior? environment: 64-bit linux python 2.7.7 (64-bit) pandas 0.14.1 numpy 1.8.2 ipython 2.2.0 (behavior same cpython) python-2.7 pandas