Posts

Showing posts from 2011

How to lock desktop screen in Qt? -

is there function in desktop qt performs screen locking(an alternative pressing windows + l in windows os). need work on platforms win, mac, lin. for windows found platform function lockworkstation() job. i want make small app kids lock pc after time make them rest pc.

powershell - SharePoint CSOM Copy - RoleAssignment -

hope can me out. i'm working on powershell script performing serveral modifications on sharepoint environment. i want copy roleassignments on web other in same site collection. basicly works when run commands manual in console doesent work while running script. what this. $roleassignmentmember = $roomwebroleassignment.member $rolebindings = $roomwebroleassignment.roledefinitionbindings $ctx.load($roleassignmentmember) $ctx.load($rolebindings) $ctx.executequery() $web.roleassignments.add($roleassignmentmember, $rolebindings) $ctx.executequery() running $web.roleassignments.add($roleassignmentmember, $rolebindings) in console works.. not in script .. got error collection not ready .. acutally is^^.. any ideas ? hope can greetz sorry, silly me. for people interested: # load $ctx.load($web.roleassignments.add($roleassignmentmember, $rolebindings)); $ctx.executequery();

php - SilverStripe ModelAdmin -

i new silverstripe framework , trying fetch list of menu in admin panel. i found lots of example show menu on front-end menu(1) , menu(2) etc. did not sample code fetch same menu array in admin model. the code tried is: public function getcmsfields() { $fields = fieldlist::create(tabset::create('root')); $fields->addfieldstotab('root.main', array( textfield::create('name'), dropdownfield::create('url') ->setsource(sitetree::get()), )); return $fields; } modeladmin there manage dataobjects , not pages. have @ docs , lesson learn more modeladmin. but if want manage pages in modeladmin, that class mypageadmin extends modeladmin { ... ... private static $managed_models = array( 'page' ); public function getlist() { $list = parent::getlist(); if($this->modelclass == 'page'){ $list = $list->filter('parentid', '1'); ...

javascript - Jquery .load / .empty not loading and emptying content from div -

im trying load select content hidden on page content div. came across jquery's .load , .empty . it seems have gone wrong somewhere, far can see should work,ideas im going wrong on ? , wider question .load / .empty right functions use or there simpler way ? ive attached html , js below, , created jsfiddle here : https://jsfiddle.net/poha5cb2/3/ ive setup following : <a id="op-1">open 1</a><br> <a id="op-2">open 2</a><br> <a id="op-3">open 3</a><br> <hr> <h2>content</h2> <div id="content"> </div> <hr> <div class="hidden-content-to-be-loaded" style="display: none;"> <div id="one"> <h3>one</h3> </div> <div id="two" class="initial-close"> <h3>two</h3> </div> <div id="three" class="initial-clo...

Kurento media server DTMF and VAD detection -

we building poc kurento media server , looking how implement dtmf , voice activity detection in kurento. dtmf detection possible on gstreamer rtpdtmfdepay , dtmfdetect elements , vad looking @ vad plugin??? so example dtmf detection, has done on kurento side implement such functionality - develop kurento models based on gstreamer, enough? has tried that share insight/example/code? regards!

php - Getting at variables from CMS block insertions -

magento 1.9 i trying add form several times onto cms page code similar to: {{block type="core/template" template="page/html/jobappform.phtml"}} but want pass variable thru php in jobappform.phtml can differentiate between different forms. i have tried using: {{block type="core/template" template="page/html/jobappform.phtml?a=1&b=2"}} in hope get @ variables $_get , if use form doesn't appear. is there way of doing this: {{block type="core/template" template="page/html/jobappform.phtml" a="1" b="2"}} and in jobappform.phtml can @ variables a , b ? this markup correct: {{block type="core/template" template="page/html/jobappform.phtml" a="1" b="2"}} this how access parameters inside block: $a = $this->getdata('a');

python - Limiting amount read using readline -

i'm trying read first 100 lines of large text files. simple code doing shown below. challenge, though, have guard against case of corrupt or otherwise screwy files don't have line breaks (yes, people somehow figure out ways generate these). in cases i'd still read in data (because need see what's going on in there) limit to, say, n bytes. the way can think of read file char char. other being slow (probably not issue 100 lines) worried i'll run trouble when encounter file using non-ascii encoding. is possible limit bytes read using readline()? or there more elegant way handle this? line_count = 0 open(filepath, 'r') f: line in f: line_count += 1 print('{0}: {1}'.format(line_count, line)) if line_count == 100: break edit: as @fredrik correctly pointed out, readline() accepts arg limits number of chars read (i'd thought buffer size param). so, purposes, following works quite well: max_bytes = 1...

browser - ActiveX project in Browzer get Zoom Settings -

i'm maintaining existing vb6 application. it's built acitvex control. build process builds cab file fired browser htm file. my question is, there way detect zoom setting once application loaded in browser? it's not webbrowser project so, can't use object query setting, @ least don't think so... during activex initialization process guaranteed setclientsite callback, among many others, give iwebbrowser2 pointer. there may timing issues regards zoom, starting point.

ruby on rails - has_one :through association incorrectly returns nil for a new_record -

i have following models. yes, design convoluted, because we're revamping our architecture in stages; nonetheless, think principles here should work: class translation < activerecord::base belongs_to :translation_service_option belongs_to :service, inverse_of: :translation, class_name: "translationservice" # have tried belongs_to :translation_service, inverse_of: :translation, foreign_key: :service_id end class translationservice < service # service < activerecord::base has_one :translation, inverse_of: :service # have tried inverse_of: :translation_service in conjunction above has_one :translation_service_option, through: :translation end i trying build before_save callback on translationservice needs access translation_service_option, however, returning nil new record: t = translation.last #=> #<translation id: 154, translation_service_option_id: 5, [...] t.service = translationservice.new #=> #<translationservice id: nil [.....

java - HTML5 Server Sent Event Servlet on Tomcat 7 buffers events until socket close -

i'm trying add server side event servlet web application. below code servlet: ( several different versions ) using getoutputstream(): @webservlet(urlpatterns = {"/hello"}, asyncsupported = true) public class helloservlet extends httpservlet { private static final long serialversionuid = 2889150327892593198l; public void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("text/event-stream"); response.setheader("cache-control", "no-cache"); response.setheader("connection", "keep-alive"); response.setcharacterencoding("utf-8"); servletoutputstream out = response.getoutputstream(); try{ for(int i=0; i<10; i++) { out.print("id: "+ +"\n"); out.print("data: "+ system.currenttimemillis() +...

Is there a way to sort only the selected columns in an Excel Pivot Table? -

i want have first 3 columns locked due nature of values, when sort horizontally, columns don't want sorted end in middle of chart. there way around this? thanks. in vba function proabbly then: sub sortltable() range("d2:g10").sort key1:=range("d1:g1"), order1:=xlascending, orientation:=xllefttoright end sub where range want sort , key determines values sorted

Cypher Neo4j query -

i developing kind of social trivia game main db neo4j. having hard time in specific use-case. i have challenge node 2 opponents nodes related: (opponent1)-[:opponent]->(challenge)<-[:opponent]-(opponent2) the challenge relate subject node: challenge-[:subject]->subject each subject relate many questions: subject-[:has]->question if opponent answered specific question before bellow relation exist: opponent-[:answer]->question the use-case: need retrieve x questions (which never been answered both opponents) challenge i have following cypher query: start challenge=node({0}) , subject=node({1}) match (opponent1)-[:opponent]->(challenge)<-[:opponent]-(opponent2) opponent1,opponent2,subject match (subject)-[:has]->(question) length(opponent1-[:answer]->question) = 0 , length(opponent2-[:answer]->question) = 0 return question limit {2} the above query works fine , retrieve possible questions challenge. the problem questions re...

netlogo - Two turtles running 'similar' code at the same time -

ive got strange issue code going on. in model have female (set female true) , males (set male true). upon particular trigger each 'become' disperser (set disperser true). dispersers , non dispersers have different behaviour. i have tried solving different breeds representing 2 classes has not worked. the problem 1 of turtles e.g. male, operate accordingly , set disperser 'false' upon meeting opposite turtle. other not, , continue disperser set 'true' im sure because once 1 of turtles operates code, no longer 'disperser' , therefore no longer applys search criteria of later turtle every work around ive tried has resulted in same problem or nobody errors. to search-for partner if male = true [ set potential-mates other turtles [female = true , disperser = true] if female = true [ set potential-mates other turtles [male = true , disperser = true] let chosen-mate min-one-of potential-mates [distance myself] if any...

Nested For loop in R -

Image
this simple question taking time new in r. i'm trying write code variance of portfolio. for example, have following :- weight=c(0.3,0.2,0.5) cov = matrix( c(0.2, 0.4, 0.3, 0.4, 0.5, 0.3,0.3,0.3,0.4),nrow=3, ncol=3, byrow = true) (i in 1:3){ (j in 1:3) { port = sum((weight[i]^2) * (cov[i,i]^2)) + sum(weight[i] *weight[j]* cov[i,j]) }} the answer if calculate manually should 0.336 . r gave me port=0.12 wrong. mistake? first calculate matrix product w %*% t(w) : tcrossprod(weight) # [,1] [,2] [,3] #[1,] 0.09 0.06 0.15 #[2,] 0.06 0.04 0.10 #[3,] 0.15 0.10 0.25 then multiply variance-covariance matrix , take sum of elements: sum(tcrossprod(weight) * cov) #[1] 0.336 or loop (inefficient): port <- 0 (i in 1:3){ (j in 1:3) { port <- if (i == j) { port + sum((weight[i]^2) * (cov[i,i])) } else { port + sum(weight[i] *weight[j]* cov[i,j]) } } } port #[1] 0.336 note variance-covariance matrix typically contains varia...

c# - find all elements with data - attribute using html-agility-pack -

i using html-agility-pack parse html block of text. possible find list of elements attributes / attribute values ? for example, below sample html text. using html-agility-pack how find elements has "data-glossaryid" attribute? <p> sample text <a href="" data-glossaryid="f776eb48bd"></a> <p><img alt="my pic" src="/~/media/images/mypic.jpg" /></p> sample text <a href="" data-glossaryid="5d476eb49e"></a> <p> more sample text </p> <span data-glossaryid="f776eb49ef"> </span> // html block of text parse var = @"<p> sample text <a href="""" data-glossaryid=""f776eb48bd""></a> <p><img alt=""my pic"" src=""/~/media/images/mypic.jpg"" /></p> sample text <a href="""" data-glossary...

environment variables - Class 'Dotenv\Loader' not found laravel 5.2? -

i have both .env , .env.example file in root still throwing error,please me this exception has nothing .env file. says program can not find dotenv\loader class. try run composer update composer dump commands.

php - How to create http basic Authentication in Laravel 5? -

how create http basic authentication in laravel 5? i have read documentation here: https://laravel.com/docs/5.0/authentication#http-basic-authentication i want create fixed password, meaning 1 password complete site. but still not clear me how create it. i understand have create middleware this: public function handle($request, closure $next) { return auth::oncebasic() ?: $next($request); } but not sure else do. example, want protect route: route::get('/', function () { return view('welcome'); }); and also, store http basic password on server ? thanks i use package: intervention/httpauth then in controller want auth protect, add: httpauth::secure();

.net - How to add namespace in soap envelope of request in c# -

i have created proxy class using wsdl.exe. sending soap envelope listed below not work since other end of router expecting different set of namespaces inside it <?xml version="1.0" encoding="utf-16"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> <sayhelloworld xmlns="http://aonhewitt.com/hro/benefits/helloworld/xsd/"> <brokerheader> <brokeruserid xmlns="http://my.com/hro/benefits/cm/xsd/v2_0">test</brokeruserid> <clientid xmlns="http://my.com/hro/benefits/cm/xsd/v2_0">010666</clientid> <callerrefid xmlns="http://my.com/hro/benefits/cm/xsd/v2_0">01066633934717</callerrefid> </brokerheader> <greeting>hello</greeting> <sleep>0</sleep...

ios - When updating store, I get following error: NSUnderlyingException = "Cannot update object that was never inserted." -

my core data objects following: author (name) >> book(title) >> notes(text, dateofnote) relation boksbyauthor >> notesonbook +(void)persistbookstodisk:(nsmanagedobjectcontext *)workercontext subclass:(eecorestack*)eecorestack fromurl:(nsurl*)fileurl{ [workercontext performblock:^{ nsarray * array = [ap_textextract componentseperatedbybooksfromtxtfile:fileurl]; (nsstring *body in array) { note *note = (note *) [nsentitydescription insertnewobjectforentityforname:@"note" inmanagedobjectcontext:workercontext]; note.dateofnote = [ap_textextract dateofnotefromstring:body]; note.text = [ap_textextract notetextfromstring:body]; book *book = (book *) [nsentitydescription insertnewobjectforentityforname:@"book" inmanagedobjectcontext:workercontext]; book.title = [ap_textextract booknamefromstring:body]; [book addnotesinbook: note]; author *author = (author*)[nsentitydescri...

Is Redis ZADD or ZSCORE atomic? -

this question has answer here: is redis list or set pop method thread safe? 1 answer if 2 redis clients issue zadd or zscore commands concurrently, have race condition , mess set value? if not thread-safe, need protect commands lock, right? i read zset api reference . maybe missed it, saw mentions thread-safety of zset commands. i found answer here . redis single threaded , commands queued , serialized, there no parallel command execution worry about.

android - Keeping a receiver alive after the service get killed -

i'll start telling story first .. i have service mservice, receiver mreceiver, preferencefragment switch . now, switch run service, register screen.off receiver, when screen off, receiver called, , check if screen locked, if yes output log message . so, locking means killing service, receiver called twice , go off, i've registered receiver , unrigstered in ondestory in mservice . i've added boolean, , thought adding "if" statement in ondestroy, if it's on , getting killed, run service when device unlocked . another thought, it's making service alive ( drain battery ) . what want, keep listen screen.off, , don't want start use 1 of them without advice using, or maybe understood in wrong way ? . codes basic one, register / unregister / class extends service. if need keep receiver working - need hosts receiver. yes, need keep service alive.

openshift private docker registry Unable to push [docker-maven-plugin] -

i have little problem docker-registry on openshift-origin installation. i have created docker-registry pods : oc pods name ready status restarts age docker-registry-3-h46uj 1/1 running 0 14m created route : oc routes docker-registry docker-registry.vagrant.f8 docker-registry created service : oc service docker-registry 172.30.14.216 <none> 5000/tcp docker-registry=default 3d master of openshift on 10.0.2.235 single node, have created spring-boot application use maven-plugin-docker build , push image. when run locally (on master machine) maven push work fine, have problem if run maven push machine, during maven push obtain: [info] docker> ... push refers repository [docker-registry.vagrant.f8/fabric8/springboot-webmvc] (len: 1) [info] docker> ... sending image list [error] docker> error: status 503 trying push repository fabric8/springboot-webmvc: and [error] failed execu...

Copying data from one excel workbook to another -

i trying write code uses button click grabs data input workbook , pastes in output workbook. problem cant figure out input workbooks name changes date in same naming convention. want code pull latest date input file , paste in output workbook. have no idea start.. appreciate. thanks i agree ken: ask in single question. "grabs data input workbook , pastes in output workbook" mean anything. however, function use solve first part of requirement. parameters folder name , file template. returns name of newest file within folder matches template. function newestfilename(byval path string, byval filetemplate string) string ' * finds, , returns name of, newest file in folder path name ' matches filetemplate. returns "" if no matching file found. ' * path folder in search files ' * filetemplate file name specification of file required. example: ' myfile*.xls ' 25jul11 copied riskreg...

vb.net - How do I get system.byte to MySQL Bit type? -

i have mysql database (5.6 community) column of type bit(60). field holds values such 1001, 0011, etc. trying pass string of "1010" database through vb.net adapter. if use regular query this: insert my_table (my_bit_field) values (b'1010'); this works , inserts string shown need use data adapter can't send query directly. when using data adapter in vb.net, getting error saying expecting byte array. tried using that: system.text.encoding.ascii.getbytes("1010") but converted ascii representation of bytes (49,48,49,48). is there better way go through data adapter , there way this? thanks. in case, try following convert string byte array: dim bytes() byte = { convert.tobyte("1010", 2) } however, breaks once have more 8 bits in string. (perhaps should) break string byte-sized sections , convert each byte, such this question . since have bit(60) column cheat little , use this: dim inputvalue string = "000100...

PHP - output associate array into HTML <div>s with labels/headings -

i have php function returns single row localhost mysql table so: <?php //include database connection process require_once("includes/conn.inc.php"); //prepare statement $stmt = $conn->prepare("select * races raceid = ?"); $id = 1; $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); ?> what array output data individual fields in own html <div> or <p> heading indicating mean in separate div. user print_row method outputs in one. data want there, i'd separated out name/value paragraphs or divs. //what have <?php print_r($row); ?> is there way this? thanks in advance, mark i didn't understand question think understand need. use while iterate trough each row. while($row = $resultdesc->fetch_assoc()) { echo '<p><strong>description:</strong></p> '; echo '<p>'. $row['...

java - Is it possible add multiple edges using TreeLayout? -

i've display graph tree level in hierarchy use treelayout included in jung, don't know if it's possible use layout add multiple edges between nodes. , if it's not possible, how recommend me that? thanks! public class visualizacion extends japplet { /** * graph */ graph<string,string> graph; forest<string,string> tree; funciones f=new funciones(); /** * visual component , renderer graph */ visualizationviewer<string,string> vv; string root; layout<string,string> layout; layout<string,string> layout2; ; public visualizacion(org.graphstream.graph.graph grafito) { graph= new directedsparsemultigraph<string, string>(); createtree(grafito); minimumspanningforest2<string,string> prim = new minimumspanningforest2<string,string>(graph, new delegateforest<string,string>(), delegatetree.<string,string>getfactory(), new constanttransformer(1.0)); tree =...

Spark process failing to receive data from the Kafka queue in yarn-client mode -

i trying run following code using yarn-client mode in getting slow readprocessor error mentioned below code works fine in local mode. pointer appreciated. line of code receive data kafka queue: javapairreceiverinputdstream<string, string> messages = kafkautils.createstream(jssc, string.class, string.class, stringdecoder.class, stringdecoder.class, kafkaparams, kafkatopicmap, storagelevel.memory_only()); javadstream<string> lines = messages.map(new function<tuple2<string, string>, string>() { public string call(tuple2<string, string> tuple2) { log.info(" &&&&&&&&&&&&&&&&&&&& input json stream data " + tuple2._2); return tuple2._2(); } }); error details: 016-02-05 11:44:00 warn dfsclient:975 - slow readprocessor read fields took 30 011ms (threshold=30000ms); ack: seqno: 1960 reply: 0 reply: 0 reply: ...

python - Merging dataframes together in a for loop -

i have dictionary of pandas dataframes, each frame contains timestamps , market caps corresponding timestamps, keys of are: coins = ['dashcoin','litecoin','dogecoin','nxt'] i create new key in dictionary 'merge' , using pd.merge method merge 4 existing dataframes according timestamp (i want completed rows using 'inner' join method appropriate. sample of 1 of data frames: data2['nxt'].head() out[214]: timestamp nxt_cap 0 2013-12-04 15091900 1 2013-12-05 14936300 2 2013-12-06 11237100 3 2013-12-07 7031430 4 2013-12-08 6292640 i'm getting result using code: data2['merged'] = data2['dogecoin'] coin in coins: data2['merged'] = pd.merge(left=data2['merged'],right=data2[coin], left_on='timestamp', right_on='timestamp') but repeats 'dogecoin' in 'merged', if data2['merged'] not = data2['dogecoin'] (or similar data)...

android - Is there any way to "hide" a View to Screen Readers, like "aria-hidden" does in HTML? -

i need screen readers voiceover don't recognize (or don't "read") <view> . for example, let suppose have simple app template code: <view><text>events</text></view> . when run app, can see "events" on screen. if enable voiceover, says : "events". well, want cannot "events". in other words, want cannot read events. "aria-hidden" in html. is possible? to show/hide view in react-native conditionally, use separate render function check condition: render: function(){ return ( {this.renderoncondition()} ); }, renderoncondition: function(){ if(whatevercondition){ return (<view />); } }

android - SVG as image view in different location -

i have read questions here svg in android , comparing each answer , found out answers similar in each other. question is, possible use svg format in imageview in different locations?many answers in common location // parse svg resource "raw" resource folder svg svg = svgparser.getsvgfromresource(getresources(), r.raw.android); what want not getresources(), r.raw.android . wanted locate in specific folder string mpath = environment.getexternalstoragedirectory().tostring() + "/juniefolder/junie_screenshot" + + ".png"; i wanted change change images in imageview dynamically. possible achieve this? ` below code view svg format string path = environment.getexternalstoragedirectory().tostring() + "/juniefolder/junie_screenshot" + + ".svg"; file file = new file(path); uri uri = uri.fromfile(file); svgimageview.setimageuri(uri); imageview imageview = new imageview(this); imageview.setbackgroundcolor(color.whi...

Serial Port on Shutdown and power on the PC not working for the first time in windows 7 -

in windows 7, creating serial port on com1 programmatically in win32. connecting serial device port. when shutdown terminal , power on again, first time when writing port, not able response device. second time on wards, able response. might reason write serial port fails first time? it's possible when first write port, connection port gets configured. if there method checks if port reachable or if there actual connection it.

Add Footer only to last page of the word document using open XML sdk with C# -

i new open xml sdk 2.5 using c#. created doc table in , contents in table may go more 500 rows. document may have multiple pages. have added header , footer successfully. want need add footer last page in document. how this. please find attached sample code. hope question clear using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using documentformat.openxml; using documentformat.openxml.packaging; using documentformat.openxml.wordprocessing; namespace consoleapplication8 { class program { static void main(string[] args) { string filename = @'c:\temp\headerfooterdocument.docx'; createtable(filename); } public static void applyheader(wordprocessingdocument doc) { // main document part. maindocumentpart maindocpart = doc.maindocumentpart; headerpart headerpart1 = maindocpart.addnewpart<headerpart...

android - Retrieving String From Java Class -

i new java / android programming , have been following tutorials / reading. have 2 classes called mainactivity , homeactivity, mainactivity user logs in , homepageactivity opened via intent if login correct. the username passed through edit text have used following code in main class string currentuser = edittextusername.gettext().tostring(); public string getcurrentuser () { return currentuser; } and in homepage class mainactivity testing = new mainactivity(); string x = testing.getcurrentuser(); currentusername.settext(x); this seems should work me, how ever when launching application crashes, , without lines of code in main activity works fine any ideas im doing wrong here guys the string may null during setting textview check before setting textview string currentuser = edittextusername.gettext().tostring(); public string getcurrentuser () { if(currentuser.length...

java - Job started with MapReduce gets killed .Why? -

i try several days start wordount(mapreduce) job oozie. normal(cmd: "hadoop jar *.jar mainclass input output") job start things goes fine . current oozie configuration : /applicationdir/lib/wordcount.jar /applicationdir/workflow.xml /text-in /text-out workflow.xml <action name='wordcount'> <map-reduce> <job-tracker>${jobtracker}</job-tracker> <name-node>${namenode}</name-node> <prepare> <delete path="${outputdir}" /> </prepare> <configuration> <property> <name>mapred.job.queue.name</name> <value>${queuename}</value> </property> <property> <name>mapred.mapper.class</name> <value>hadoopjobs.wordcound.wordcountmr.map</value> </property> ...

java - How to find similar lines in two text files irrespective of the line number at which they occur -

i trying open 2 text files , find similar lines in them. code correctly reading lines both text files. have used nested for loops compare line1 of first text file lines of second text file , on. however, detecting similar lines have same line number, (eg. line 1 of txt1 cc cc cc , line 1 of txt2 cc cc cc , correctly finds , prints it), doesn't detect same lines on different line numbers in files. import java.io.*; import java.util.*; public class featureselection500 { public static void main(string[] args) throws filenotfoundexception, ioexception { // todo code application logic here file f1 = new file("e://implementation1/practise/comupdatusps.exe.hex-04-ngrams-freq.txt"); file f2 = new file("e://implementation1/practise/top-300features.txt"); scanner scan1 = new scanner(f1); scanner scan2 = new scanner(f2); int = 1; list<string> txtfileone = new arraylist<string>(); ...

validate accordion form section with jquery -

my form set accordion. want validate each section instead of total form on submit. can't work. a bit of form (i left hidden fields out): <form id="test"> <div id="accordion"> <h3 class="frm_pos_top"><a href="#">header</a></h3> <div> <div id="frm_field_179_container" class="frm_form_field form-field frm_required_field form-group frm_top_container frm_first frm_half"> <label for="field_lz5ptt" class="frm_primary_label control-label">question1 <span class="frm_required">*</span> </label> <select name="item_meta[179]" id="field_lz5ptt" data-frmval="(blanco)" class="form-control" > <option value="(blanco)" selected="selected"> </option> <option value="10" >1</option> <option value="11" >...

Referencing Visual studio variables from cmake -

i'm using cmake generate visual c++ project , want add visual studio variable include path. for normal variables hardcoded path can include_directories(pathtofolderiwanttoinclude) however want same thing variable visual studio knows about. $(kit_shared_includepath) i tried doing include_directories($(kit_shared_includepath)) however yields c:\path\to\my\project\$(kit_shared_includepath). tried storing value in variable , using variable instead didn't work either. how prevent cmake prepending current path onto include path? the problem cmake doesn't have straight way pass relative path in include_directories , have not preppended value of cmake_current_source_dir variable(setting nothing doesn't either). given vs macros expand absolute paths try circumvent cmake guards providing vs macro follows: include_directories("\\\\?\\$(kit_shared_includepath)") it trick because absolute path sure , correct path added additional include path co...

jquery - jqGrid - cell data dispappears after sorting -

i'm generating jqgrid table in each cell displays data multiple data elements. example first column of each row contains name, group, subgroup, , personid, each displayed on new line. each of these data elements part of jsonstring pass in server. example data: {"rows":[ { "name":"barnes, bill alan", "group":"11111", "subgroup":"11", "personid":"050" }] } i'm setting datatype: jsonstring , gridview: true , loadonce: true the table loads fine initially, when sort table, group, subgroup, , personid data elements displayed undefined . i'm using custom formatter format display , when step thru code see third param (i named rowobject) doesn't contain group, subgroup, or personid data did on initial load. my formatter function: function col1formatter(value, options, rowobject) { return rowobject.name + "<br/>" + rowobj...

matplotlib - Drawing histogram with too many variables using barchart in python -

i'm trying draw histogram x calculate before draw histogram have sort them. problem x long(like 2 million variables). there method reduce time of drawing histogram. think drawing many bars takes time how can reduce number of them without losing shape? x = somefunctioncreatingalistofvariables() x.sort(reverse = true) plt.bar(left = np.arange(len(x)), height = x, color='b')

python - How to test for nan's in an apply function in pandas? -

i have simple apply function execute on of columns. but, keeps getting tripped nan values in pandas . input_data = np.array( [ [random.randint(0,9) x in range(2)]+['']+['g'], [random.randint(0,9) x in range(3)]+['g'], [random.randint(0,9) x in range(3)]+['a'], [random.randint(0,9) x in range(3)]+['b'], [random.randint(0,9) x in range(3)]+['b'] ] ) input_df = pd.dataframe(data=input_data, columns=['b', 'c', 'd', 'label']) i have simple lambda this: input_df['d'].apply(lambda acode: re.sub('\.', '', acode) if not np.isnan(acode) else acode) and gets tripped nan values: file "<pyshell#460>", line 1, in <lambda> input_df['d'].apply(lambda acode: re.sub('\.', '', acode) if not np.isnan(acode) else acode) typeerror: not implemented type so, tried testing nan values pandas adds: np.isnan(input_df['d'].values[0]...

orm - Django retrieve data from multiple tables -

i have 2 mysql models: class registration(models.model): name = models.charfield(max_length=30) email = models.emailfield() password = models.charfield(max_length=30) company = models.charfield(max_length=30) class personal_details(models.model): reg = models.foreignkey(registration) job = models.charfield(max_length=30) experience = models.integerfield(default=0) i want filtering details using both experience , company keyword. want fetch , display details(name, email, company, job, experience) both tables in html page. details = personal_details.objects.filter(experience=1, reg__company="yourcompany").select_related() {% detail in details %} name: {{ detail.reg.name }} email: {{ detail.reg.email }} company: {{ detail.reg.company }} job: {{ detail.job }} experience: {{ detail.experience }}<br/> {% endfor %}

boost - C++ Permission Denied Error -

Image
i'm new c++, i've been coding in java few years. week ago tried getting boost library work codeblocks, , have run error after error after error. i've managed fix of them 1 driving me wall. code returns 2 errors when compiled: ld.exe||cannot find c:\boost_1_60_0\stage\lib: permission denied| ||error: ld returned 1 exit status| i cannot figure out how fix this, i've been searching online days. i've been able figure out, permission denied error due (as error suggests) lack of permission access directory, none of fixes i've found online have worked. here code, although don't think code related error. #include "complex.h" #include <cmath> using namespace csis3700; #define boost_test_module complextests #define boost_test_dyn_link #include <boost/test/unit_test.hpp> const double tol = 0.01; boost_auto_test_case(zero_arg_constructor_should_not_crash) { complex c; } the complex class class simulates complex numbers, righ...

javascript - How do I get my components to return a serialization of themselves? -

i still learning react , javascript thank patience. i trying serialize form data can send ruby on rails end processing. using vanilla react no additional depedencies flux, redux, etc. it seems child components not returning , not quite sure why. i have tried: exposing values through use of refs (but failed , read isn't idea anyway) exposing parent method within child components gather information each individual component (what see in jsfiddle). updating component states through onchange methods , trying access states of each child component my jsfiddle: https://jsfiddle.net/morahood/0ptdpfu7/91/ i missing key element of react design patterns here. way off track? how can on track? able serialize form data in following format { "service_request" : { "services" : [ { "service_item" : ["oil change", "new windshield wipers"], "customer" : "troy", ...

cors - Why does my JavaScript get a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error when Postman does not? -

i trying authorization using javascript connecting restful api built in flask . however, when make request, following error: xmlhttprequest cannot load http://myapiurl/login . no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. i know api or remote resource must set header, why did work when made request via chrome extension postman ? this request code: $.ajax({ type: "post", datatype: 'text', url: api, username: 'user', password: 'pass', crossdomain : true, xhrfields: { withcredentials: true } }) .done(function( data ) { console.log("done"); }) .fail( function(xhr, textstatus, errorthrown) { alert(xhr.responsetext); alert(textstatus); }); if understood right doing xmlhttprequest different domain page on. browser blocking allows request in same origin securi...