Posts

Showing posts from September, 2015

python - cx_oracle unable to find Oracle Client -

i have installd python 2.7.3 on linux 64 bit machine. have oracle 11g client(64bit) installed. , set oracle_home, path, ld_library_path, , installed cx_oracle 5.1.2 version python 2.7 & oracle 11g. ldd command on cx_oracle unable find libclntsh.so.11.1. i tried creating symlinks libclntsh.so.11.1 under /usr/lib64, updated oracle.conf file under /etc/ld.so.conf.d/. tried possible solutions have been discussed on issue on forums, no luck. please let me know missing. the issue me installed python, cx_oracle root oracle client installation done "oracle" user. got own oracle installation , fixed issue. later ran pyunicodeucs4_decodeutf16 issues python , had install python —enable-unicode=ucs4 option

security - When is it acceptable to run app with no password on mysql? -

it's not crucial question, i'm still wondering, when it's possible have mysql connection settings some-user@localhost no-password. it's potential risk in case of shared web-provider: other user can access database (if know some-user name). is risky in case of vps(vds)? if run own server ip, assume approach safe? wrong? mimic localhost ip outside?

java - Configure JDBC Authentication in Spring Boot -

goal: add jdbc authentication spring boot default security configurations. source can found here per spring boot docs configure global authenticationmanager autowiring authenticationmanagerbuilder method in 1 of @configuration classes and spring security docs example: @autowired private datasource datasource; @autowired public void configureglobal(authenticationmanagerbuilder auth) throws exception { auth .jdbcauthentication() .datasource(datasource) .withdefaultschema() .withuser("user").password("password").roles("user").and() .withuser("admin").password("password").roles("user", "admin"); } given above, added following ( found here ): @configuration @enableauthorizationserver @enableresourceserver public class authenticationmanagerconfig { @autowired private datasource datasource; @autowired public void configure

stringtemplate - StringTemplate4 if conditional with length -

i need generate following kinds of code stringtemplate4: methodfoo0(connection conn); methodfoo1(connection conn, int arg1); methodfoo2(connection conn, int arg1, int arg2); etc. the "connection conn" part present passing method name , rest of arguments st template. template looks follows: <methodname>(connection conn, <args; separator=", ">); this works produces comma when there no arguments @ (except conn): methodfoo0(connection conn,); to eliminate comma tried using if conditional , length st4 function couldn't work although tried various combos following: <methodname>(connection conn <if (length(fieldsinfind) \> 0)>,<else><endif><fieldsinfind; separator=", ">) ... , others failed parsing-related error ( mismatched input ). in end, gave , resorted passing comma parameter template either "," or empty string "" based on pre-rendering logic. you check p

c# - Exchange 2010/2013 TransportAgent Content Conversion for Internal Recipients -

i trying create transportagent reroutes internal email remote server further processing, email comes on in microsoft's internal tnef format (no content conversion being applied). in same format used if email going external recipient. i using routingagent reroute internal emails remote server. if can explain why happens in terms of categorizer's pipeline, helpful too, if can't avoid it. agent implemented both exchange 2010 , 2013, in case answer differs based on version of exchange.

regex - Ruby on Rails exclude group elements in route constraints -

i wondering, how define constraints regex route, match if excludes every single element of group. for instance, so: get "list/:action", :constraints => {:action => [none of following: (new, edit, delete, update)} i know if want match of elements of list, have defined so: get "list/:action", :constraints => {:action => /(new|edit|delete|update)/}, don't know, how make work described above. i have tried using ^ , ! signs before group, no luck far - there has notation one, think. how exclude these elements ? try following. it'll exclude actions route. class excludeactions def matches? ["new", "edit", "delete", "update"].exclude? params[:action] end end "list/:id", :constraints => excludeactions.new this exclude new , edit , delete , update actions routes list

shader - OpenGL Shadow Map -

i trying basic shadow map reason doesn't render properly. video of problem i render house using flat shader: int shadowmapwidth = window_size_x * (int)shadow_map_ratio; int shadowmapheight = window_size_y * (int)shadow_map_ratio; // rendering shadow texture. glactivetexture(gl_texture0); call_gl(glbindtexture(gl_texture_2d, shadowtexture)); // bind framebuffer. call_gl(glbindframebuffer(gl_framebuffer, shadowfbo)); //clear call_gl(glclear(gl_depth_buffer_bit)); call_gl(glviewport(0, 0, shadowmapwidth, shadowmapheight)); call_gl(glcolormask(gl_false, gl_false, gl_false, gl_false)); //render stuff flatshader.use(); flatshader["basecolor"] = glm::vec4(1.0f,1.0f,1.0f,1.0f); flatshader["pvm"] = projectionmatrix*pointlight.viewmatrix*cursor.modelmatrix; cursor.draw(); //binds vao , draws // revert scene. call_gl(glbindframebuffer(gl_framebuffer, 0)); call_gl(glcolormask(gl_true, gl_true, gl_true, gl_true)); call_gl(glviewport(0, 0, window_size_x, window_s

c# - Reducing number of trips from Silverlight App to Database -

i working on silverlight application. have view allows user add new object. viewmodel bound view has collection of object type property. constructor of viewmodel has function, getdata() calls wcf service , fetches data database, adds fetched list collection. after adding new object database through wcf service, method getdata needs called again refresh collection having latest data in collection necessary. this process little slow every time 1 adds anything, entire data tables need fetched again. can more slower data grows more , more large , when joining of multiple tables may required data. i thinking of adding object pass service add database, directly collection in viewmodel. obviously, add object collection when service called has not returned error make sure has been added db. way can have latest data in collection without need fetch database. can 1 point out drawback approach or scenario may fail? also, please suggest if there other better ways of achieving goal.

c++ - How to avoid scientific notation and show full number instead? -

i have below code in 1 of library causing numbers shown in form of scientific notation. t value = 0; template<typename u> void process(u& buf, dataoption holder) const { if (holder == dataoption::types) { switch (type_) { case teck::proc_int: buf << "{\"int\":" << value << "}"; break; case teck::proc_long: buf << "{\"long\":" << value << "}"; break; case teck::proc_float: buf << "{\"float\":" << value << "}"; break; case teck::proc_double: buf << "{\"double\":" << value << "}"; break; default: buf << "{\"" << type_ << "\":" << value << "}"; }

java - use variable or textfield to pass as parameter to other textfield in jasper report -

i'm doing report showing balance sheet report completed, 1 thing remains showing final amount in words used java function int parameter convert amount words. now problem have calculated , stored final amount in textfield (say x ) , want pass amount java function tried out many ways, failed question how pass variable or 1 textfield other textfield parameter? suggest ways or ideas? googled same, tried search on jaspersoft forum also.

tail recursion - Return a sequence with the elements not in common to two original sequences by using clojure -

i have 2 sequences, can vector or list. want return sequence elements not in common 2 sequences. here example: (removedupl [1 2 3 4] [2 4 5 6]) = [1 3 5 6] (removeddpl [] [1 2 3 4]) = [1 2 3 4] i pretty puzzled now. code: (defn remove-dupl [seq1 seq2] (loop [a seq1 b seq2] (if (not= (first a) (first b)) (recur (rest b))))) but don't know next. i encourage think problem in terms of set operations (defn extrasection [& ss] (clojure.set/difference (apply clojure.set/union ss) (apply clojure.set/intersection ss))) such formulation assumes inputs sets. (extrasection #{1 2 3 4} #{2 4 5 6}) => #{1 6 3 5} which achieved calling (set ...) function on lists, sequences, or vectors. even if prefer stick sequence oriented solution, keep in mind searching both sequences o(n*n) task if scan both sequences [unless sorted]. sets can constructed in 1 pass, , lookup fast. checking duplicates o(nlogn) task using set.

How to throw exception when comparing with None on Python 2.7? -

in python 2.7: expression 1 (fine): >>> 2 * none traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: unsupported operand type(s) *: 'int' , 'nonetype' expression 2 (fine): >>> none none true expression 3 ( bad ): >>> 2 < none false expression 4 ( bad ): >>> none<none false expression 5 ( bad ): >>> none==none true i want somehow force expressions 3, 4 , 5 throw typeerror (same in expression 1). python 3.4 there - expression 5 returns true. i need in 2.7. my use case (if interested): i'v made application evaluates expressions (example): d = a+b e = int(a>b) f = if a<b else b if b<c else c expressions based on values (a, b , c) comes deserialized json. most of time values (a, b , c) integers, (when value missing) none. when value missing , used in expressions expression should return none (i thinking catching typeer

android - alpha calculation in complementary filter -

i using complementary filter sensor fusion. equation complementary filter using is angle=(1-alpha)*(angle+gyro*dt)+(alpha)*(accel_mag_angle) i have confusion calculation of alpha. read somewhere alpha calculated using formula alpha= da/(da+dt) where da rate @ want values change (which refers cutoff frequency of filter) , dt sampling time. using sensor_delay_ui. sampling rate of ui around 15hz. used alpha=0.2(by trial , error method) , app worked fine. later realised according equation cannot use alpha=0.2(theoretically) since give me cut off frequency of 60hz , sampling frequency 15hz. cut off frequency calculation wrong ? or understanding of equation wrong ? i wouldn't sweat it. if find alpha=0.2 satisfactory trial , error, use it. filters have tuned in practice anyway. theory helps start (usually) cannot avoid tuning. i don't see wrong 60 hz cut off frequency. means motions above frequency cut off. , thing, since noise anyway.

asp.net - editURL not being called - JQGrid -

i have editable jqgrid, inline editing events, editurl not being called. edit data web method in vb.net. when click on row row becomes editable , able make changes when hit enter editurl not being called. please suggest changes necessary. <scriptmethod(responseformat:=responseformat.json)> _ <webmethod()> _ public shared function loaddata() jqgridresult 'if mulist.selectedvalue <> "0" andalso mulist.selectedvalue <> string.empty ' hirnodemu = hirnodemu.parse(mulist.selectedvalue) 'else ' hirnodemu = 0 'end if 'dim hirnode integer = hirnodemu 'if hirnode = 0 ' hirnode = hirnodecurrent 'end if dim sidx string = "" dim sord string = "asc" dim page integer = 1 dim rows integer = 1000 dim entryfieldsonly integer = 1 dim hirnode integer = 5 dim fiscalyear integer = 2012 dim fiscalperiod integer = 3 dim dtwordata

c++ - forward compatibility of occi application -

we have occi application linked dynamically occi lib on solaris . during build linked occi of oracle 10.2.0.4 client want same build able run under oracle 10g client oracle 11g client. seems occi not backward compatible name of dynamic occi lib has version in it. e.g md1sisun26:/tools/oracle/10.2.0.4/lib->dump -lv libocci.so libocci.so: **** dynamic section information **** .dynamic: [index] tag value [1] init 0xc6110 [2] fini 0xc62b8 [3] soname libocci.so.10.1 [4] runpath tld_global [5] rpath tld_global [6] hash 0xe8 [7] strtab 0x10488 [8] strsz 0x1fb42 [9] symtab 0x41e8 [10] syment 0x18 [11] checksum 0x25a3 [12] pltsz 0x4c80 [13] pltrel 0x7 [14] jmprel 0x3c450 [15] rela 0x2ffd0 [16] relasz 0x11100 [17] relaent 0x18 [18] register 0x72 [19] register 0x86 [20] feature_1 parinit [21] flags 0 [22] flags_1 [ dispreldne ] [23] pltgot 0x1eb500 md1sisun26:/tools/oracle/10.2.0.4/lib->ls -lrt libocci.so lrwxrwxrwx 1 oracle 15 aug 10 2010 libocci.so -> libocci.so.10.1*

Linux how to start "sftp-server"? -

i'm not familiar there installed openssh/sftp-server (by vendor before) on rhel , running before reboot server. when check after rebooted: # ps aux | grep ftp no sftp running sshd is. so how do have sftp running please? you need add following line /etc/ssh/sshd_config file: subsystem sftp /usr/libexec/openssh/sftp-server or subsystem sftp /usr/lib/openssh/sftp-server

excel data formatting numbers -

my data coming database , populating in excel when data looks 65.90 excel shows 65.9 , if use formatting on facing issue : value 65 , shows 65.00 to maintain leading or trailing zeros, format cells text.

python - Matrix, index out of range -

i've declared matrix following code: matrix = [[' ' x in range(x1)] x in range(y1)] but when try find random element , change it's value following code: randomx = random.randint(0, x) randomy = random.randint(0, y) if matrix[randomx][randomy] == ' ': try: matrix[randomx][randomy] = 'g' scr.addstr(randomx, randomy, matrix[randomx][randomy]) scr.refresh() except indexerror: return i indexerror. tried write garbage code exit function if runs in indexerror. works once, still throws error. note, x1 same x in function. same goes y1 , y. any clue i'm doing wrong? your indices in wrong order. should access them by matrix[randomy][randomx] or change order in comprehension. matrix = [[' ' y in range(y1)] x in range(x1)] also, garrett pointed out in comments, randint() inclusive on both ends might want use randint(0,x-1) , randint(0,y-1) .

android - differentiate between update and inset in SQLite -

in sqlite how can if row exists update else createentry? want have table single row , update whenever single button pressed or so. entry.open(); if(the row exist) entry.updatecontact(1, double.tostring(db1), double.tostring(db2), double.tostring(db3)); else entry.createentry(double.tostring(db1), double.tostring(db2), double.tostring(db3)); entry.close(); sounds want insert or replace . there's blog post on topic @ http://www.buzzingandroid.com/2013/01/sqlite-insert-or-replace-through-contentprovider/

recursion - Recursive transposition cipher C -

i trying intake string of chars , split them recursively in half until char length 2. take char string of 2 , swap char string next it. code below: #include <stdio.h> #include <string.h> void encrypt(char *str, int size); int main(){ char input[8192]; int length; printf("input phrase: "); fgets(input, 8192, stdin); length = strlen(input) -1; printf("length: %d\n", length); encrypt(input, length); printf("encryption: %s\n", input); return 0; } void encrypt(char str[], int size){ int i; int k = size / 2; //encryption code here } some example outputs: sample input: 12345678 sample output: 34127856 sample input: test , often! sample output: aeyrlet sttf!enn aod i'm not asking assignments me. looking nudge in right direction having tough time wrapping head around how continuously split string swap. op: "i'm not asking assignments me. looking nudge in rig

razor - Orchard Shape Wrapper -

i'm following orchard documentation on wrappers couldn't wrap head around it. http://docs.orchardproject.net/documentation/understanding-placement-info#wrapper according documentation, create wrapper.htmlcontent.cshtml , insert following in it. <div class="htmlwrappercontent"> @model.html </div> but model.html ? shape ? know model shape itself. html not built-in property of shape or ishape figure must custom property done through code, example shapehelper.my_shape(html: "hello world") ? let's start beginning illustration of i'm trying achieve. have done following: placement.info <placement> <place my_shape="content:before;wrapper=my_wrapper" /> </placement> my.shape.cshtml <div class="myshape"> @* let's pretend line below prints "hello world" *@ @model.html </div> my.wrapper.cshtml <div class="htmlwrappercontent">

boost - How to compile Autodock Vina in Visual Studio? -

i'm trying compile autodock vina on visual studio , having trouble figuring out how that. thankful if can guide me through process! please follow bellow instructions: 1- download boos 1.41.0 following link: http://sourceforge.net/projects/boost/files/boost/1.41.0/boost_1_41_0.zip/download autodock vina compatible boost 1.41.0 2- extract zip file in computer: go boost directory , open cmd , run following command: bootstrap.bat after finish previous step, run following commands based on os: 32 bit: bjam --toolset=msvc-10.0 --build-type=complete stage 64 bit: bjam --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage step takes time! (for me 45 min). 3- download autodock vina following link: http://vina.scripps.edu/download/autodock_vina_1_1_2.tgz 4- extract folder on machine. 5- now, boost installed on machine , have vina code. should configure vs 2010 use it. you can fi

android - Switching roles between cengtral and peripheral -

i able to: 1. establish gap connection between central , peripheral devices 2. send data central peripheral writing characteristic. now ,i want send data central. how can done? peripheral start performing role of central?or response peripheral central sending data? please guide me on this. i guess want peer-to-peer bluetooth transfer mechanism. had followed following approach: every device listens incoming connection request. the device wants sent data, connects other device , transfers data. that means device must act in central , peripheral mode simultaneously @ times. if doesn't work simultaneously, need stop advertising if writing data.since writing data through ble guess must small.that means device won't advertising short amount of time. you can use hybrid approach in advertise using ble transfer data on classic bluetooth. alternative approach: from peripheral, advertise 2 characteristic..one characteristic(type write) on central write on

php - export jqplot to pdf, using the png image generated dynamically -

i using jqplot show charts in application. want export chart in pdf. accomplish this, planning generate runtime image of chart. there button in jqplot shows image generated jqplot using javascript. uses following code. btn.bind('click', {chart: $(this)}, function(evt) { var imgelem = evt.data.chart.jqplottoimageelem(); var div = $(this).nextall('div.jqplot-image-container').first(); div.children('div.jqplot-image-container-content').empty(); div.children('div.jqplot-image-container-content').append(imgelem); div.show(500); div = null; }); i want @ runtime using php had no idea of how acheive this. me on this.thanks

Call logs restore in android -

i creating application in android call logs backup , restore using csv file.backup created while restoring call logs not restored csv.here code writing backup while((row = csvreader.readnext()) != null) { restorecalllogs(row[0],row[1],row[2],row[3],row[4]); } public void restorecalllogs(string name,string number,string date,string type,string duration){ contentvalues values = new contentvalues(); values.put(calllog.calls.number, number); values.put(calllog.calls.date, date); values.put(calllog.calls.duration,duration); values.put(calllog.calls.type, type); if(name!="unknown") values.put(calllog.calls.cached_name, name); getcontentresolver().insert(calllog.calls.content_uri, values); } you have try-catch block hiding exception generated here: restorecalllogs(row[0],row[1],row[2],row[3],row[4]); you should not use try-catch

How to deal with enter to tab in vb6? -

public function entertotab(keyascii integer) if keyascii = vbkeyreturn sendkeys "{tab}" keyascii = 0 end if end function private sub txtusercode_keypress(keyascii integer) call entertotab(keyascii) end sub this code belongs log-in form. the txtusercode contains code of specific user stored in database. while running form, when enter number in txtusercode , press enter doesn't go next text box, it's keyascii became 49 not equal 13. the same thing happening pressing tab . what switching next text field using setfocus method instead of simulating tab ? private sub txtusercode_keypress(keyascii integer) if (keyascii = vbkeyreturn) txtnexttextfield.setfocus end if end sub you use controls array (array of text fields contained in form) , increment index. use code text fields of form without having write redundant code. so if user presses return in text field index 0, set focus index+1 (=1). create c

c# - Input string not in the correct format when reading a text file into a 2d Array -

i trying read text file 2d array. error of input string not in correct format. i have checked text file , should , cant see why error happening? int[,] numbermatrix = new int[10, 10]; string[] split = null; (int rowcount = 1; rowcount < 11; rowcount++) { int[] temp1darray = new int[10]; string filelocation = "c:\\week10\\one.txt"; string textfile = file.readalltext(filelocation); (int columncount = 1; columncount < 11; columncount++) { string delimstr = " "; char[] delimiter = delimstr.tochararray(); //string filelocation = "c:\\week10\\1-100.txt"; //string textfile = file.readalllines(filelocation); (int x = 0; x <= 10; x++) { split = textfile.split(delimiter, x); } } (int rowcount1 = 1

php - Simplexml get node by attribute -

i've got xml file: <?xml version="1.0" ?> <xml> <opis lang="en">my text</opis> <opis lang="cz">my text2</opis> </xml> i want "my text2" - node attribute lang "cz": $xml = simplexml_load_file($filename); $result = $xml->xpath('//xml/opis[@lang="cz"]') but instead of value get: array(1) ( [0] => simplexmlelement object { @attributes => array(1) ( [lang] => (string) cz ) } )) try using domdocument: $xml = new domdocument; $xml->load('yourfile'); $xpath = new domxpath($xml); foreach ($xpath->query('//xml/opis[@lang="cz"]') $rownode) { echo $rownode->nodevalue; // 'this item' }

How does haskell code remove my photos by rename? -

hello first haskell code import data.list import data.function import system.io import system.directory import system.filepath.windows import control.monad import text.printf main = <- getdirectorycontents "." cd <- takebasename `fmap` getcurrentdirectory let sorted = zip[1..] . sort . filter ((isprefixof `on` reverse) ".jpg") $ form_ sorted $ \(i,x) -> let z = if odd 1 else 2 let q = ceiling (fromintegral / 2.0 ) printf " %s --> %s.%d.%d.jpg\n" x cd (q::int) (z::int) renamefile x (printf "%s.%d.%d.jpg" cd (q::int) (z::int)) but works horrible d:\contrib\rnm\bin>rnm.exe bin.1.1 - копия (10).jpg --> bin.1.1.jpg bin.1.1 - копия (11).jpg --> bin.1.2.jpg bin.1.1 - копия (12).jpg --> bin.2.1.jpg bin.1.1 - копия (13).jpg --> bin.2.2.jpg bin.1.1 - копия (14).jpg --> bin.3.1.jpg bin.1.1 - копия (15).jpg --> bin.3.2.jpg bin.1.1 - копия (16)

JSP JSTL <a href call Onclick Javascript function -

i have following code in jsp <a href="<c:url value="mycontroller"> <c:param name="prod" value="${product.productno}"/> </c:url>">edit</a> how can call javascript onclick function open popup window , pass parameters? <script type="text/javascript"> function openpopup() { window.open('mycontroller','width=650, height=450'); } </script> try this <a href="javascript:{openpopup(\'parameter1\',\'parameter2\')}"></a>

dynamics crm 2011 - how to expand a text field in order to remove scrolling by using javascript -

i deal dynamics crm 2011 online , faced troubles printing documents there. if there scroll form in print window it'll , can't coz there editing function there. i'm interested resize/expand text field in order make text visible user without scrolling? is there method in javascript can remove scroll resizing field? in dynamics crm may use such functios on onload event. thanks in advance tried function textareaadjust(o) { o.style.height = "1px"; o.style.height = (25+o.scrollheight)+"px"; } got error: 'style' - null or it's not object not in supported fashion. supported extensions microsoft dynamics crm form scripting microsoft jscript functions associated through customization tools available events in form supported. interaction data in form supported when performed using documented objects , methods available within xrm.page.data object. interaction form appearance , behavior supported wh

c# - How do I refactor a switch-case using polymorphism? -

from console commands in format [command][position][value] e.g. multiply 2 3 , supposed manipulate array of integers according command. example if have int[] arr = new int[] { 0, 2, 0 }; after executing "multiply 2 3" command array should { 0, 8, 0 } the way i'm doing giving info method performs manipulation. static void performaction(int[] arr, string action, int position, int value) { switch (action) { case "multiply": array[position] *= value; break; case "add": array[pos] += value; break; case "subtract": array[pos] -= value; break; } } my question - how apply polymorphism and/or reflection can say: executecommand(int[] arr, string action, int position, int value) and maybe have class each command, every command knows how executed. a simple calculator us

copy - CMake import non-compiled files into build directory -

i use cmake that: $ mkdir build && cd build $ cmake .. && make && atf-run | atf-report but run atf need files (for example /atffile , test/atffile), i'm looking way import in build directory kind file. i tried this: file(copy ${project_source_dir}/.. destination ${project_source_dir}/..) but doesn't work. simple/cleaner way it? assuming "/atffile" , "/test/atffile" files , not folders, can use configure_file configure_file(atffile atffile copyonly) configure_file(test/atffile test/atffile copyonly) since commands here use relative paths throughout, input arg relative current source directory , output arg relative current binary (i.e. build) directory.

javascript - how to add hidden value in joint JS so that the value can be shown when the element is clicked? -

im confused why doesnt work... first make function: var member = function (x, y, rank, name, img, background, textcolor, proyek) { textcolor = textcolor || "#000"; var cell = new joint.shapes.org.member({ position: { x: x, y: y }, attrs: { '.card': { fill: "#fff", stroke: background }, image: {}, '.rank': { text: rank, fill: textcolor, 'word-spacing': '3px', 'letter-spacing': 0 }, '.name': { text: name, fill: textcolor, 'font-size': 11, 'font-family': 'calibri', 'letter-spacing': 0, 'text-align': 'left' }, mycustom: proyek } }); graph.addcell(cell); return cell; }; then function called in code... adding of parameter value loop var strname = member(positionx2, 200, 'proyek ' + name + ' (' + datalevel[i].total + ') ', '

javascript - Toggle show/hide div with button for multiple result -

Image
i developing classroom students attendance site, doing , expected php coding, working fine... when update attendance each student click on each student thumbnails students list page, working... my question had added add description button each students on thumbnails, invisible, when user hover mouse on student thumbnails show button, had added toggle show/hide div button, when user click visible button small form div display... this used toggle show/hide div button... html <div id='content'>form content here</div> <input type='button' id='hideshow' value='add description'> jquery jquery(document).ready(function(){ jquery('#hideshow').live('click', function(event) { jquery('#content').toggle('show'); }); }); its working when click add description button, problem if have more 2 or above students list when click button students form content div display now, need 1

class - C++ Call subclass method from superclass -

i have code of following style: class subclass; class superclass; class superclass { private: void bar() { subclass().foo(); } }; class subclass : superclass { public: void foo() {}; }; so have superclass want call method foo() of subclass. vs 2012 gives me following errors: error 1 error c2514: 'subclass' : class has no constructors. error 2 error c2228: left of '.foo' must have class/struct/union. what correct structure want do? you can't this. must (at least) declare method in base class. example: #include <iostream> class superclass { public: void bar() { foo(); } private: virtual void foo() // pure virtual, if { std::cout << "superclass::foo()" << std::endl; } }; class subclass : public superclass // not forget inherit public { public: virtual void foo() { std::cout << "subclass::foo()" << std::endl; } }; int

wkhtmltopdf - Page-break breaks the side borders on the page -

i have long page left , right side borders. , content forms different sections, inside those, have made page-break avoid. problem is, when page breaking, side borders breaking. means, there no borders @ end of page if there page break. thanks, -sovan

Change attr width on object -

how change attr width on object, i'm trying this, seems not work... jquery('.big').click(function(){ jquery('#flvplayer').attr("width", "100"); }); here code need change height , width on click <a class="big">100</a> <textarea><object id="flvplayer" height="665" width="425"></object></textarea> use .css instead of .attr . jquery('.big').click(function(){ jquery('#flvplayer').css("width", "100"); }); width css property. edit: in textarea have text. <object> not html element. text in text area. so, change text in textarea . $('.big').click(function(){ var text = "<object id=\"flvplayer\" height=\"665\" width=\"100\"></object>" $("textarea").val(text); }); also, suggest use $ instead of jquery . it's easier ,

design patterns - Location tracking react component - How to to handle listeners/updates -

i have "dumb" component displays approx. distance between 2 locations. import react "react" const cos = math.cos const p = math.pi / 180 function getdistance(lat1, lon1, lat2, lon2) { var = 0.5 - c((lat2 - lat1) * p)/2 + c(lat1 * p) * c(lat2 * p) * (1 - c((lon2 - lon1) * p))/2 return 12742 * math.asin(math.sqrt(a)) // 2 * r; r = 6371 km } let distance = ({from,to}) => { let distance = getdistance( from.latitude, from.longitude, to.latitude, to.longitude) if (distance < 1.0) { distance = (distance * 100) + "m" } else { distance = distance + "km" } return <span>{distance}</span> } } distance.displayname = "distance" i want enhance component updating component whenever browsers geo-location changes. created component class trackingdistance extends react.component { constructor(props) { super(props) this.updateposition =

scala - akka-streams with akka-cluster -

my akka-streams learn-o-thon continues. i'd integrate akka-streams application akka-cluster , distributedpubsubmediator . adding support publish straight forward, subscribe part i'm having trouble with. for reference, subscriber given follows in typesafe sample : class chatclient(name: string) extends actor { val mediator = distributedpubsub(context.system).mediator mediator ! subscribe("some topic", self) def receive = { case chatclient.message(from, text) => ...process message... } } my question is, how should integrate actor flow, , how should ensure i'm getting publish messages in absence of stream backpressure? i'm trying accomplish pubsub model 1 stream may publish message , stream consume (if subscribed). you want make actor extend actorpublisher. can create source , integrate stream. see docs on actorpublisher here: http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.3/scala/stream-integrations

Python - Multiple if statement get ignored -

i'm implementing bfs on 2d-array list serve "queue". add each unvisited neighbor of current cell(i, j) queue, , in each loop, pop head of queue current cell, until queue empty. standard stuff. the problem seems 1 "if" statement executed in each loop. can't see why happens. for tgroup in targets.keys(): #group of targets t in targets[tgroup]: #each target in group visited = [[false]*len(cells[0])]*len(cells) queue = [] cur = none queue.append(t) visited[t[0]][t[1]] = true cells[t[0]][t[1]].fields[tgroup-3] = 0 while len(queue) > 0: cur = queue[0] queue = queue[1:] if cur[0] > 0 , visited[cur[0]-1][cur[1]] false: queue.append((cur[0]-1,cur[1])) visited[cur[0]-1][cur[1]] = true cells[cur[0]-1][cur[1]].fields[tgroup-3] = min(cells[cur[0]-1][cur[1]].fields[tgroup-3], cells[cur[0]][cur[1]].fields[tgroup-3]+1

Ruby inside html-erb files issue -

i putting inside erb file <% @user_friend.each |friends| -%> <%= content_tag :p, :class => "popin" %> friends.email <% end %> <% end -%> and getting error message : compile error /var/www/gitorious/app/views/campaigns/new.html.erb:25: syntax error, unexpected ')' ..._tag :p, :class =>"popin" ).to_s); @output_buffer.concat ... ^ /var/www/gitorious/app/views/campaigns/new.html.erb:28: syntax error, unexpected kend, expecting ')' ; end ... could explain how can resolve ? friends.email ruby code, need below: <% @user_friend.each |friends| -%> <%= content_tag :p, friends.email,:class =>"popin" %> <% end -%>

mongodb java driver:com.mongodb.MongoException: can't find a chunk -

//to download files according filename //the arraylist list of filename i wondering if there has faced same issue , resolved it. try { mongo mongo = new mongo("10.16.66.107", 27017); db db = mongo.getdb("vt_dbfile"); (int = 0; < arraylist.size(); i++) { string dbfilename = arraylist.get(i); gridfs gridfs = new gridfs(db, "fs"); gridfsdbfile imageforoutput = gridfs.findone(dbfilename); imageforoutput.writeto("d:\\download_type" +"\\"+ arraylist.get(i)); } } catch (exception e) { // todo: handle exception e.printstacktrace(); } exception: com.mongodb.mongoexception: can't find chunk! file id: 56aa7a5665cd34935812aae5 chunk: 0 @ com.mongodb.gridfs.gridfsdbfile.getchunk(gridfsdbfile.java:65) @ com.mongodb.gridfs.gridfsdbfile.writeto(gridfsdbfile.java:53) @ com.mongodb.gridfs.gridfsdbfile.writeto(gridfsdbfile.

node.js - NodeJS , AngularJS not getting response when on different domain, getting success but without response data -

i developed application based on mean stack , works fine when ui , api on same domain-port. , when segregate ui , api , let deploying on different domain or local different port ,all api call successful no response data. fyi have access-control-allow-origin * , without behaviour same. as in case of cross origin browser first sends option request. if in response of option request if access-control-allow-origin found sends actual request, else gives cros error. you can add these lines of in app.js of nodejs code. solve purpose. app.use(function(req, res, next) { res.setheader('access-control-allow-headers', 'origin, x-requested-with, content-type, accept'); res.setheader('access-control-allow-methods', 'post,head,get,put,delete,options'); res.setheader('access-control-allow-origin', '*'); next(); }); app.options('*', function(req, res, next) { res.send(); });

json - D3 Pie Chart not showing -

i'm starting use d3 , i'm trying work example using own json. code not showing error doesn't show pie, don't know can be. this code: <!doctype html> <html> <head> <meta charset="utf-8"> <title>step 1 - basic pie chart</title> </head> <body> <div id="chart"></div> <script type=text/javascript src="{{url_for('static', filename='d3.min.js') }}"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script> (function(d3) { 'use strict'; var width = 360; var height = 360; var radius = math.min(width, height) / 2; var color = d3.scale.category20b(); var svg = d3.select('#chart') .append('svg') .attr('width', width) .attr('height',

python - 'NoneType' object has no attribute 'src' -

if i'm not wrong, think error mean i'm trying display doesn't exist. i've provided content, don't know why error. i'll explain in detail: i'm using django-ckeditor, , when try post image , text, grouped content. , i'm trying use image thumbnail front page, separate content. i'm using python goose extract image content. in models.py class post(models.model): content = richtextuploadingfield(config_name='default') @property def thumbnail(self): g = goose() thumbnail = g.extract(raw_html=self.content).top_image.src return thumbnail in html <img src="{{ post.thumbnail }}" /> the error dissapears if def thumbnail(self, content) (and nothing gets displayed) shouldn't since i'm extracting post model, , content self.content.

iphone - UICollectionView accumulating animations over different batch updates -

i have problem animations of uicollectionview on different batch updates. i'm using code: [collectionview performbatchupdates:^{ if (touched) { [collectionview deleteitemsatindexpaths:markeditems]; [collectionview insertsections:newsec]; } else { [collectionview deletesections:newsec]; [collectionview insertitemsatindexpaths:markeditems]; } } completion:nil]; here's video of i'm trying , problem . idea when touch on image it'll animate top, new main image , fade other images. problem is, when go , touch other image it'll animate new touched image and previous image. i believe it's uicollectionview bug , can't figure out workaround. here's sample project , if want. i contacted apple. engineers said it's bug in uikit , there's no know work around , should wait next major ios preview releases (ios 7) check if fixes problem.

jquery - How to use ternary operator in JavaScript? -

my case this: ... success:function(data) { jquery.each(data.searchcityresponse.nation.city, function(key,value) { console.log(value.citycode); city.append(jquery("<option value.citycod==\'ceb\')?\'selected\':\'\'></option>").val(value.citycode).text(value.cityname)); }); city.select2(); } ... i check in console: http://imgur.com/jio8nyk this seems problem writing ternary "<option value.citycod==\'ceb\')?\'selected\':\'\'></option>" string , it'll not parse variable or javascript operator. also, there typo, citycod should citycode . you can use concatenation + operator "<option " + (value.citycode === 'ceb' ? 'selected' : '') + "></option>" or, selected status can kept in variable , variable can used. var selected = value.citycode === 'ceb' ? 'selected' : '&#

android - Notification at specific time -

i have notification @ specific time, see code: //create alarm manager alarmmanager alarmmgr0 = (alarmmanager)getsystemservice(context.alarm_service); //create pending intent & register alarm notifier class intent intent0 = new intent(this, alarmreceiver_maandag_1e.class); intent0.putextra("uur", "1e"); pendingintent pendingintent0 = pendingintent.getbroadcast(this, 0, intent0, 0); //set timer want alarm work (here have set 8.30) calendar timeoff9 = calendar.getinstance(); timeoff9.set(calendar.hour_of_day, 8); timeoff9.set(calendar.minute, 30); timeoff9.set(calendar.second, 0); //set timer rtc wakeup alarm manager object alarmmgr0.set(alarmmanager.rtc_wakeup, timeoff9.gettimeinmillis(), pendingintent0); this works perfect except 1 thing. the notification set 8:30 alarm manager if launch app after 8:30, 9:00 example, notification still shows.. is there possibility alarm goes off @ 8:30 not later? edit for having same problem, here

android - Are their any negatives impacts of launching two continues services at the same time? What are some alternatives if so? -

i planning on having activity 2 check boxes. want tasks when screen off in background continuously based on user check marks. final checkbox checkbox = (checkbox) findviewbyid(r.id.checkbox_id); if ( checkbox1.ischecked() && myserviceisntrunning() ) { startservice(myservice1.class) if ( checkbox2.ischecked() && myservice2isntrunning() ) { startservice(myservice2.class) } if both checkmarks checked, wan't both tasks run in background forever using method. there harm in launching both services @ once? there doesn't appear documentation in optimization tips documentation, , saw page it: can start 2 services same activity , can run activity , 2 services parrallely in android? . so, starting 2 services parallely forever idea? as long not conflict, ok have more 1 service running. battery life , memory may affected, depending on code. if possible, can consider merging them 1 service handle 2 tasks.

javascript - Three.JS path across a plane -

Image
i have simple three.js scene: click by supplying series of vectors 2d space (plotted camera view 0, 0, 200) e.g. {from:{x,:0, y:10}, to:{x:50,y:50}} able draw path across face of plane object following example image depicts: i new three.js/ 3d in general , have looked @ vector3 , path object admit i'm little stuck on begin - can offer suggestions or ideally simple update jsfiddle posted? i have updated jsfiddle wanted (i think): http://jsfiddle.net/evgeni_popov/ubqns/3/ the path in path variable. lines drawn z=1 not stuck in plane, @ z=0. i have changed meshlambermaterial meshbasicmaterial can see lines better.

sql - Select unique records and display as category headers in rails -

i have rails 3.2 app running on postgresql, , have data want display in view, stored in database in structure: +----+--------+------------------+--------------------+ | id | name | sched_start_date | task | +----+--------+------------------+--------------------+ | 1 | "ben" | 2013-03-01 | "check debris" | +----+--------+------------------+--------------------+ | 2 | "toby" | 2013-03-02 | "carry out y1.1" | +----+--------+------------------+--------------------+ | 3 | "toby" | 2013-03-03 | "check oil seals" | +----+--------+------------------+--------------------+ i display list of tasks each name, , names ordered asc first sched_start_date have, should ... ben 2013-03-01 – check debris toby 2013-03-02 – carry out y1.1 2013-03-03 – check oil seals the approach starting taking run query unique names , order them sched_start_date asc , run query each name tasks. to list

json - Cannot display value in UITableView -

i getting error saying "nsstring not have member 'subscript'" on following line. cell.textlabel?.text = objname[indexpath.row] here code (error line @ bottom). func makegetrequest(){ var url : string = "http://apiairline.yome.vn/api/get-airport" var request : nsmutableurlrequest = nsmutableurlrequest () request.url = nsurl(string: url) request.httpmethod = "get" request.setvalue("1454310830", forhttpheaderfield: "timestamp") request.setvalue("f8675bfb33f792eeef665da66848623539978204b3b1b036c79aa38218dd7061", forhttpheaderfield: "hash") nsurlconnection.sendasynchronousrequest(request, queue: nsoperationqueue(), completionhandler:{ (response:nsurlresponse!, data: nsdata!, error: nserror!) -> void in var error: autoreleasingunsafemutablepointer<nserror?> = nil let jsonresult: nsdictionary! = nsjsonserialization.