Posts

Showing posts from August, 2012

java - Sending string to Activity and then to a Fragment of Activity -

i having trouble simple app. app starts in mainactivity can press camera icon. opens implicit intent taking photo. when photo taken, activity displayimageactivity opened. activity consists of 2 fragments: 1 holds imageview displaying photo , 1 holds textviews displays information photo (filename, size, location etc.). use viewpager having horizontal swipe capabilities. now problem. should note not consistent problem. app crashes, works fine. problem lies in getting image path onactivityresult in mainactivity 2 fragments can image , info. here onactivityresult method: @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == 42 && resultcode == result_ok) { log.d(tag, "mainactivity onactivityresult method called."); intent intentshowpicture = new intent(this, displayimageactivity.class); intentshowpicture.putextra(picture_

osx - How to load launch daemon to have an access to WindowServer in LoginWindow context? -

i developing application osx can access windowserver. application (lets call agent) first loaded every user logged in. searching running loginwindow processes, , load plist each user (with of bsexec set proper context). ps -ef | grep loginwindow 501 90425 1 0 10:46am ?? 0:01.21 /system/library/coreservices/loginwindow.app/contents/macos/loginwindow console 502 90721 90426 0 10:54am ?? 0:00.36 /system/library/coreservices/loginwindow.app/contents/macos/loginwindow 0 91103 90426 0 11:01am ?? 0:02.57 /system/library/coreservices/loginwindow.app/contents/macos/loginwindow here have 3 loginwindow processes 2 logged users (not active), 1 login window (active). i run: sudo launchctl bsexec 90721 sudo -u 502 launchctl load -wf -s aqua /library/launchagents/com.myagent.plist for each of logged users. and sudo launchctl bsexec 91103 launchctl load -wf -s loginwindow /library/launchagents/com.myagent.plist for login window. the p

How to test that a route does not exist in Rails 4.x -

if have route not defined, how test returns 404? here relevant part of routes.rb resources :reservations, only: [:index,:create,:destroy] you can create, destroy , list reservations, not change them. the test is: patch :update, id: @reservation, reservation: { somefield: "data" } assert_response :missing this should pass, since lack of route should return 404. instead, urlgenerationerror: actioncontroller::urlgenerationerror: no route matches {:action=>"update", :controller=>"reservations", :id=>"980190962", :reservation=>{:somefield=>"data"}} i it; patch call test cannot generate url. how test such url call generate 404? you assert error has been thrown, sufficient you? assert_raise actioncontroller::urlgenerationerror patch :update, id: @reservation, reservation: { somefield: "data" } end

css - Nested divs background colour anomaly -

i've small anomaly ('problem' not permitted word ;-)) setting background colour in nested divs driving me potty. manage site @ www.teachtoo.org wordpress-driven. i'm trying set (using handy jetpack css editor) background colour of 'bar' page title, , i've been partly successful can seen. the page title appears in following html: <div class="page-title-wide"> <div class="page-title-wrap"> <h2 class="left-title entry-title">home</h2> </div> </div> i've tried following (ungainly, know) css overwrite theme styles , set background colour: /* set background colour of 'bar' page title purple } */ .page-title-wide { background-color: #645274; } .page-title-wrap { background-color: #645274; } the second selector's changing colour, not first. first selector works in that, if put " font-size: 300%;", happens. this 1 of these 'issues

c# - ConfigureAwait for IObservable<T> -

i'm experiencing deadlock when use blocking code task.wait() , waiting async method inside awaits rx linq query. this example: public void blockingcode() { this.executeasync().wait(); } public async task executeasync() { await this.service.getfooasync().configureawait(false); //this rx query doesn't support configureawaitawait await this.service.receiver .firstordefaultasync(x => x == "foo") .timeout(timespan.fromseconds(1)); } so, question if there equivalent configureawait on awaitable iobservable ensure continuation not resumed on same synchronizationcontext . you have comprehend "awaiting observable" means. check out this . so, semantically, code await this.service.receiver .firstordefaultasync(x => x == "foo") .timeout(timespan.fromseconds(1)); is equivalent to await this.service.receiver .firstordefaultasync(x => x == "foo") .timeout(timespan.f

mysql - how to apply one-many and many-one annotations(Java Persistence) -

i have 2 tables follows: table1: create table `product` ( `id` int(11) not null auto_increment, `typename` varchar(255) default null, `typecode` varchar(55) default null, ) engine=innodb auto_increment=396 default charset=latin1; table2: create table measurements ( id int(11) not null auto_increment primary key, age_group varchar(20) not null, articletype not null, dimension text , createdon int(11) not null, updatedon int(11) not null, createdby text not null, )engine=innodb auto_increment=396 default charset=latin1; now how can join 2 tables join column measurements.articletype = product.typename in java persistence. i know concept of using 1 many , many 1 using foreign key( http://en.wikibooks.org/wiki/java_persistence/onetomany ). above tables not have foreign key. i'm here assuming want many-to-many. in java, if want bidirectional, use @manytomany(mappedby = "products") public list<product> getproduc

Streaming output java -

i have servlet, mapped url, long task , outputs data while it's working. what want call url , see output in real-time. let's take example: package com.tasks; public class longtaskwithoutput extends httpservlet { private static final long serialversionuid = 2945022862538743411l; @override protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.addheader("content-type", "text/plain"); printstream out = new printstream(response.getoutputstream(), true); for(int i=0; i<10;i++) { out.println("# " + i); out.flush(); try { thread.sleep(1000); } catch(exception e){} } } } with following in web.xml : ... <servlet> <servlet-name>longtaskservlet</servlet-name> <servlet-class>com.tasks.longtaskwithoutput</servlet-class>

mysql - How do I export a table that contains Hindi text into Excel using php? -

this question has answer here: how can output utf-8 csv in php excel read properly? 28 answers i trying export hindi data excel using php. after having exported hindi data, shown in different format "????????? ????". previous code <?php include 'config.php'; setlocale(lc_all, "en_us.utf-8"); $db_tblname = "feedback"; //mysql table name $filename = "feedback"; //file name /*******you not need edit below line*******/ //create mysql connection $sql = "select * $db_tblname"; $connect = @mysql_connect($db_server, $db_username, $db_password) or die("couldn't connect mysql:<br>" . mysql_error() . "<br>" . mysql_errno()); //select database $db = @mysql_select_db($db_dbname, $connect) or die("couldn't select database:<br>" . mysql_error()

python - Open multiple files and immediately accept the prompt -

i'm trying create application using pygtk. in application i'm downloading multiple files , opening them application. each opening of file results in prompt confirmation open file. goal make confirmation automatically app, way user won't obliged repeatedly confirm each file. there way ? the opening part of application: if platform.system().lower().startswith('linux'): subprocess.call(["xdg-open", path]) elif platform.system().lower().startswith('windows'): os.startfile(path) thanks lot !

email - ASP JMail 4.5 SMTP Authentication for Office365 -

we have old apps written in classic asp send mail using jmail (w3jmail v 4.5). in process of moving local microsoft exchange server office 365. need these old apps continue work, using jmail send e-mail. our current asp code (which references exchange server ip): set objmail = server.createobject("jmail.message") objmail.mailserverusername = "domain\username" objmail.mailserverpassword = "password" objmail.contenttype = "text/plain" objmail.from = "name1@domain.co.uk" objmail.addrecipient "name2@domain.co.uk" objmail.subject = "test" objmail.body = "test" objmail.send("10.10.10.1") set objmail = nothing this new version have try , use our office 365 account: set objmail = server.createobject("jmail.message") objmail.silent = true objmail.logging = true objmail.mailserverusername = "name1@domain.co.uk" objmail.mailserverpassword = "password" objmail.content

mysql - Spring MVC-showing object values in jsp -

Image
i using spring mvc,mysql, jdbctemplate in project. when fetching data db using drop down list box in jsp page instead of showing number upto 0-9. showing encrypted values. the data type i've passed here int. my controller class: @requestmapping(value="/index.htm", method = requestmethod.get) public string executesecurity(modelmap model, principal principal,@modelattribute searchfiller searchfiller) { list<searchfiller> adultslist=searchflightdao.adultslist(); model.addobject("adultslist", adultslist); string name = principal.getname(); model.addattribute("author", name); return "welcome"; } my part of jsp page: <form:form action="index" method="get" modelattribute="searchfiller"> . . . <tr> <td>adults</td> <td><form:select path="adults">

Password encoding with Spring Data REST -

how should encode automatically subbmitted plain password field of entity spring data rest? i'm using bcrypt encoder , want automatically encode request's password field, when client send via post, put , patch. @entity public class user { @notnull private string username; @notnull private string passwordhash; ... getters/setters/etc ... } first tried solve @handlebeforecreate , @handlebeforesave event listeners user in it's argument merged, can't make difference between user's new password, or old passwordhash: @handlebeforesave protected void onbeforesave(user user) { if (user.getpassword() != null) { account.setpassword(passwordencoder.encode(account.getpassword())); } super.onbeforesave(account); } is possible, use @projection , spel on setter method? you can implement jackson jsondeserializer : public class bcryptpassworddeserializer extends jsondeserializer<string> { public string deserialize

Rails another encoding hell in emails -

i have struggled utf8 encoding issues on past, time it's html email template being processed. for reason ignore, rails tries parse .html.erb email file ascii 8-bit, , therefore cannot add variables contain utf8 chars actionview::template::error (incompatible character encodings: ascii-8bit , utf-8): 1: <h1>bonjour <%= @first_name %>,</h1> (when first name michaël ë) i have used several tricks, adding config/environment.rb encoding.default_external = encoding::utf_8 encoding.default_internal = encoding::utf_8 config/application.rb config.encoding = "utf-8" using stupid debian 6 linux production server / ruby 2.0.0p353. works fine on local dev installation windows, joke... what can force loading html email view utf-8 ?

c# - Razor and half finishing html tags -

how make possible? @if(item.i % 2 == 0) { <div class="row"> } @if(item.i % 2 == 0) { </div> } without complaining haven't finished tag off , thinking haven't put } @ end of if statement you need prefix both lines @: prevent razor parser parsing html tags. @if(item.i % 2 == 0) { @:<div class="row"> } @if(item.i % 2 == 0) { @:</div> }

matlab - to find mean square error of two cell arrays of different sizes -

i have 2 cell arrays. 1 'trans_blk' of size <232324x1> consists of cells of size <8x8> , 'ca' of size <1024x1> consists of cells of size <8x8>. want compute mean square error (mse) each cell of 'ca' respect every cell of 'trans_blk'. i used following code compute: m=0; ii=0:7 jj=0:7 m=m+((trans_blk{:,1}(ii,jj)-ca{:,1}(ii,jj))^2); end end m=m/(size of cell); //size of cell=8*8 disp('mse=',m); its giving error. bad cell reference operation in matlab. a couple of ways figured go: % first define mse function mse = @(x,y) sum(sum((x-y).^2))./numel(x); i'm big fan of using bsxfun things this, unfortunately doesn't operate on cell arrays. so, borrowed singleton expansion form of answer here . % singleton expansion way: mask = bsxfun(@or, true(size(a)), true(size(b))'); idx_a = bsxfun(@times, mask, reshape(1:numel(a), size(a))); idx_b = bsxfun(@times, mask, reshape(1:nu

java - Play/Pause Multiple MediaViews With One Controller JavaFX FXML -

at moment have single scene multiple mediaviews, each own play , pause buttons, in fxml. wondering if there way play/pause ever mediaview had button clicked without making play/pause controller each mediaview. below example of tedious way not wish with. the fxml <stackpane alignment="center"> <mediaview fx:id="mediaview" styleclass="mediaview"> <mediaplayer> <mediaplayer fx:id="mediaplayer" autoplay="false"> <media> <media source="@../vid/vid1.mp4"/> </media> </mediaplayer> </mediaplayer> </mediaview> <button fx:id="btn_play1" onaction="#handl

Use of the JavaScript 'bind' method -

what use of bind() in javascript? bind creates new function have this set first parameter passed bind() . here's example shows how use bind pass member method around has correct this : var button = function(content) { this.content = content; }; button.prototype.click = function() { console.log(this.content + ' clicked'); } var mybutton = new button('ok'); mybutton.click(); var looseclick = mybutton.click; looseclick(); // not bound, 'this' not mybutton - global object var boundclick = mybutton.click.bind(mybutton); boundclick(); // bound, 'this' mybutton which prints out: ok clicked undefined clicked ok clicked you can add parameters after 1st ( this ) parameter , bind pass in values original function. additional parameters later pass bound function passed in after bound parameters: // example showing binding parameters var sum = function(a, b) { return + b; }; var add5 = sum.bind(null, 5); console.log(add5(10)

jsf - Can't drop TreeNode on empty <p:tree> component -

i'm using 2 separated <p:tree> components. when click commandbutton application adds new node first tree. part works fine. now want drag , drop nodes between these trees. works if there @ least 1 element in target tree, nothing happens if tree empty -and yes, both trees must empty @ beginning-. thing know can done because of example . code same , can't figure out reason doesn't work me. both trees this, except value attribute of course: <p:tree value="#{signlineslists.createdsignlinesroot}" var="node" draggable="true" droppable="true" dragdropscope="signlinesscope" selectionmode="single"> <p:ajax event="dragdrop" listener="#{signlineslists.ondragdrop}" /> <p:treenode> <h:outputtext value="#{node}" /> </p:treenode> </p:tree> the listener in ajax event debugging purposes , has no effects on bean a

vb.net - Method/Property Error on New SQL Server Connection -

i'm running vb .net in vs2013, on windows 8 on sql server 2008 r2, , creation of sql connection failing error: property access must assign property or use value. here's code: dim ocnn sqlconnection dim scnn string dim bsuncnnok boolean try if vssunserver <> "" scnn = "provider=sqloledb.1;" & _ "integrated security=sspi;" & _ "persist security info=false;" & _ "initial catalog=sunsystemsdata;" & _ "data source=" & vssunserver ocnn = new sqlconnection(scnn) ocnn.open() bsuncnnok = true end if catch ex exception bsuncnnok = false end try _vssunserver_ string being passed in sub, , has run-time value of "svrsun07" . the error being raised on line: ocnn = new sqlconnection(scnn) so @ run-time, scnn holds: "provider=sqloledb.1;integrated security

Youtube video API using playerVars: { 'rel': 0 } for removing but it not working -

i try remove suggested video youtube player, using code given below still no luck. have try find solution searching site can't able find solution. please me. function onyoutubeiframeapiready() { player = new yt.player('player', { height: '390', width: '640', playervars: { 'autoplay': 1, 'controls': 1, 'rel': 0, 'showinfo': 0, 'modestbranding': 1, 'autohide': 1, 'enablejsapi': 1, 'html5': 1 }, videoid: '<?php echo youtube_id_from_url(get_post_meta(get_the_id(),"mvyt_url",true)); ?>', events: { 'onready': onplayerready, 'onstatechange': onplayerstatechange } }); } i have try remove related video video , not work me . try , 're

Compile c file by source code -

i'm writing code got path c file, , want compile file program code. meaning compile not in command line like: gcc -o a.out file.c there way it? if trying compile c source file in programmatic manner, can try this: execlp("gcc", "gcc", "file.c", "-o", "a.out", null); execlp has advantage of searching dirs stored in environment $path find required executable. returns -1 if call fails. don't forget #include <unistd.h> work. you can away simple call: system("gcc file.c -o a.out"); this requires #include <stdlib.h> , execute gcc invoking /bin/sh .

parsing - Getting tokens based on length and position inside input -

on input have stream of characters not separated delimiter, this: input = "150001" i want make parser(using jison), tokenize based on position , length, should tokens: 15 - system id (first 2 numbers) 0001 - order num (4 numbers after) can give me advice how can accomplish this, tried add tokens this: %lex %% [0-9]{2} return "system_id" [0-9]{4} return "order_num" \lex %% but expected not working :) is there way parse kind of inputs, parse length of characters ? you can make simple parser using state-declarations, , assigning state each of rules. referring jison's documentation , change (noting lexer still incomplete because nothing identifier or "="): %lex %s system_id order_num %% /* more logic needed accept identifier, "=", each own state, , beginning "system_id" state. */ <system_id>[0-9]{2} this.begin("order_num"); return "s

r - Using calipers in GenMatch to enourage more pairs -

so following example matching package , in particular genmatch example link package here following example in genmatch library(matching) data(lalonde) attach(lalonde) x = cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74) balancemat <- cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74, i(re74*re75)) genout <- genmatch(tr=treat, x=x, balancematrix=balancemat, estimand="ate", m=1, pop.size=16, max.generations=10, wait.generations=1) genout$matches genout$ecaliper y=re78/1000 mout <- match(y=y, tr=treat, x=x, weight.matrix=genout) summary(mout) we see 185 treated observation paired 270 non-treatment observation. want relax allow more flexible pairing on age criteria. we can generate table teatment cases , age on left , control case , age on right by: pairs <- data.frame(mout$index.treated, lalonde$age[mout$index.treated], mout$index.control, lalonde$age[mout$index.contr

Posting message using Facebook SDK for PHP -

hello i'm working php code using facebook sdk post message on facbook page admin it's ok when work in localhost when hosted page on web server gives me following error: fatal error: class 'facebook\facebooksession' not found in /var/www/simo/index.php on line 48 the lines of code cause problem: use facebook\facebookredirectloginhelper; use facebook\facebooksession; use facebook\facebookrequest; require "vendor/autoload.php"; session_start(); $appid='358738637667835'; $appsecret='92841aa4b36c9c37a4d779e801db3d6f'; facebooksession::setdefaultapplication($appid,$appsecret);//(line 48) the thing should noted version of server’s php “php 5.4.39” understands instruction "use". thank giving me solution or suggestion. this problem happens result of incorrect paths. if downloaded php sdk , make sure contains file called "autoload.php", add following line require __dir__ . '/facebook-php-sdk/autoload.p

c# - Use a Nop Service outside of a controller? -

i'm writing custom validation attribute validating zip\postal codes. work absolutely need know selected country. turns out surprisingly difficult do. in view models nop passes country using id, means need decipher it. way use countryservice since can translate id country name, problem how that. if create new countryservice object have create , pass number of dependencies (cacheservice object etc.) , sounds wrong way of achieving result. how use nop service outside controller (in case inside custom validation attribute)? you don't need create object instance service locator. something this: var countryservice= enginecontext.current.resolve<icountryservice>(); you can check attribute in nopcommerce wwwrequirementattribute , check how uses locator pattern.

php - wp.uploadFile XML RPC : image size zero -

i trying upload image wordpress xml-rpc: $dir = getcwd().'/upload/post/'; $thumbnail_img = $post['thumbnail_img']; $mime_type = mime_content_type($dir.$thumbnail_img); $thedata = file_get_contents('http://tf_test.local/upload/post/'.$thumbnail_img); $data = array( 'name'=>'ddd.txt', 'type'=>$mime_type, 'bits'=>new ixr_base64($thedata), 'overwrite' => false ); $client = new ixr_client($media['url'].'xmlrpc.php'); $params = array(0, $media['media_id'], $media['password'], $data); if (!$client->query('wp.uploadfile', $params)) { print ($client->geterrorcode().":".$client->geterrormessage()); } return $client->getresponse(); there no errors, uploaded image size zero! text files uploaded without problems (ex: log.txt).

model view controller - foreach loop inside another foreach loop using Custom PHP MVC -

i have table 1 products , table 2 suppliers the tables structure way: products create table if not exists `products` ( `id_product` int(11) not null auto_increment, `id_supplier` int(11) not null, `name_product` varchar(20) not null, primary key (`id_product`) ) engine=innodb default charset=utf8 auto_increment=1 ; suppliers create table if not exists `suppliers` ( `id_supplier` int(11) not null auto_increment, `name_supplier` varchar(11) not null, primary key (`id_supplier`) ) engine=innodb default charset=utf8 auto_increment=1 ; model: ( suppliers_model.php ) class suppliers_model extends model{ public function fetchsuppliers(){ stmt = $this->db->prepare("select * suppliers"); $stmt->setfetchmode(pdo::fetch_obj); $stmt->execute(); return $stmt->fetchall(); } } controller ( suppliers.php ) class suppliers extends controller{ function __construct(){ parent::_

javascript - Hide a row if value returned is empty -

i feel little stupid asking question reason cant life of me think on how want. i have <div class="row"> has field label , field in it. i want hide row if value of field returned empty. html (held in cms system): <div id="rollnumber" class="row"> <label class="col-sm-offset-2 col-sm-3 control-label">[!rollnumberlabel]</label> <div class="col-sm-2 form-control-static">[!rollnumber]</div> </div> view code: if (newbankdetails.rollnumber != null && newbankdetails.rollnumber != "") { template.nvc.add("[!rollnumberlabel]", "roll number"); template.nvc.add("[!rollnumber]", newbankdetails.rollnumber); } i tried doing: template.nvc.add("[!rollnumberlabel]", ""); template.nvc.add("[!rollnumber]", ""); but adds white space between row above , below row. i'm suggestions whe

javascript - Slowing the speed of a Jquery Scroll -

i've been using jquery scroll enhance parallax scrolling page. specifically, one. jquery scroll next section i new jquery, (and have used basic javascript in past). can work out how change , adapt code found needs, don't know how slow scroller down. the problem, accommodate of content in page, needs 17000px high. want scroller scroll bottom of page top (without stops inbetween), when clicked takes 1 second scroll 17000px. means can't read of text displayed. want scrolling animation max out @ 1000px per second. how this? html <div class="background fixed"></div> <div class="trigger-scroll">&gt;</div> <!-- sections id'd 1 through 5 --> <section id="slide-6" class="homeslide"> <div class="bcg center fixed" data-0="top:200%; opacity:0;" data-16000="top:200%; opacity:1;" data-17000="top:90%;" data-end=&

Simulate Amazon Kindle in a virtual machine -

i simulate amazon kindle in vm. is there way simulate kindle on computer, can see how created books on kindle? assuming you're talking e-ink kindles, amazon previewer (available both windows on mac) want. here's list of features, , there more faqs on site. * highlights of kindle previewer functionality * ability preview content across kindle devices , apps * support previewing kindle text pop ups , kindle panel views * accurate rendering of content across kindle devices , apps * faster previewing through features auto flip mode, image flip mode * auto updates future enhancements

Overriding issues in Scala -

i let code speak: import scala.concurrent.future trait somerequest trait someresponse trait apistandard { def apicall[req <: somerequest, resp <: someresponse](request: req): future[resp] } case class xxrequest() extends somerequest case class xxresponse() extends someresponse class xxstandard extends apistandard { override def apicall(request: xxrequest): future[xxresponse] = ??? } basically have couple of data traits (somerequest, someresponse) , behaviour trait apistandard. there case classes xxrequest , xxresponse override data traits. trying create concrete implementation of of apistandard called xxstandard. it's not syntactically correct. being scala beginner, can't understand why. please throw light. thanks. apistandard defines method apicall accepts parameter more flexible xxstandard provides. to illustrate, if have val something: apistandard = ??? you know can call val req: somerequest something(req) if ??? able new xxst

php - Phpmyadmin export issue -

my shared host not allow ssh access. trying export database using phpmyadmin , import onto new server. keep getting error , not sure how fix it. appreciated. error sql query: -- -- indexes dumped tables -- -- -- indexes table `ewrporta_blocks` -- alter table `ewrporta_blocks` add primary key ( `block_id` ) , add key `title` ( `title` ) ; mysql said: documentation #1068 - multiple primary key defined i have run issue multiple times, , modonoghue has 1 valid way of handling dropping tables , recreating them. problem & general solution basically happening trying run insert statements inserting values primary keys exist - thereby giving error of duplicate keys. database has no clue how handle having multiple entries same key, sql logic based around every 'row' having primary key unique. what want save values exported sql file, in query that, when import file again, deletes existing values (assuming want restore point , aren't worrying data saved

c# - get object ID after insert in database in asp.net MVC with oracle databse -

please, need retrieve id(primary key) of object have inserted in oracle database, many suggestion said: context.entity.add(myobject); context.savechanges(); int x=myobject.id; but didn't work. when tries print x in following statement in controller: return view(x.tostring()); (since can't print value in way), receive value "0", when open database found value id (not "0") oracle database has sequence , trigger assign id myobject. don't know problem is, in database? or compatibility problem between database , mvc? thank in advanced:) the problem on model. ef needs know field in question set in db. in model, add databasegenerated option this: public class myobject { [key] [databasegenerated(databasegeneratedoption.identity)] public int id { get; set; } ... } the options can used databasegeneratedoption computed (generated on insert , update), identity (generated on insert), , none (not generated). once th

GDB command to know whether the program is running or stopped -

i trying automate gdb debugging session, want know whether there command or other way in gdb me know whether program running or stopped ? use gdb.selected_inferior().threads()[0].is_running() gdb python api: $ gdb -q /bin/true (gdb) python __future__ import print_function (gdb) python print([ t.is_running() t in gdb.selected_inferior().threads() ]) [true] references gdb python api: threads , inferiors

C++ build - namespace and no member -

i have code: mymathutils.h #ifndef my_math_utils_h #define my_math_utils_h #include "./ray.h" #include "./raytriangleresult .h" #include "./triangle.h" namespace mymath { class mymathutils { public: static bool raytriangleintersection(const mymath::ray & ray, const mymath::triangle & t, mymath::raytriangleresult * out); //other code }; } #endif and triangle.h #ifndef my_triangle_h #define my_triangle_h namespace mymath { struct triangle { //code }; } #endif but during compile, have got error: d:\c++\c++\mymath\header./mymathutils.h(71): error : namespace "mymath" has no member "triangle" static bool raytriangleintersection(const mymath::ray & ray, const mymath::triangle & t, mymath::raytriangleresult * out); i using intel c++ 15.0 compiler

Is it possible to use Poedit to read from XML files but only the labels? -

i've found working code lang definitions xml files code: language: xml list of extensions separated semicolons: *.xml parser command: xgettext -lc --extract-all -o %o %c %f item in keywords list: item in input files list: %f source code charset: --from-code=%c however code gives name part too, don't want. have idea how filter "label" only?

java - Type safety error with generic class -

edit: setup there parser call methods programfactory, factory uses expressions, statements, types , programs seen in header implementation below. programfactory implements iprogramfactory interface looks public interface iprogramfactory<e, s, t, p> the problem seem have expression generic , not know how right in implementation (in header , in methods) it seems work when return type of type expression seen here @override public expression<boolean> createtrue(sourcelocation sourcelocation) { true expr = new true(); return expr; } but not when variable of type expression i made wildcards return type , argument type not have same public abstract class binaryexpression<t, r> extends expression<t>{ expression<r> left; expression<r> right; } in implementation of interface seem have same problem on , on again. expression raw type. references generic type expression<t> should parameterized the problem when p

Visual Studio 2013 Community - is it a trial only? -

Image
i looking @ version of vs 2013 upgrade to, , discovered company qualified sufficiently small enough use vs 2013 community edition. on 19th march, downloaded it, , took test-drive, building small app. but tonight when need rebuild app, tells me 30-day trial has expired. 30-day trial? mentioned? any suggestions how around this? have demo within matter of hours, , i'm beginning panic... the wording bit bad, once sign in microsoft account temporary license assigned visual studio try refresh in background. if refresh fails reason, message , need click "check updated license" button on visual studio account screen. this screenshot visual studio 2015 rc, way licensing works same:

c# - How to pass method (class) into ApiController? -

i have class called query contains function calls data using sql query. public static userdetails[] binddatatable() { datatable dt = new datatable(); list<userdetails> details = new list<userdetails>(); using (sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["###"].connectionstring)) { using (sqlcommand cmd = new sqlcommand("select top 3 deal, [property], [event] [dbo].[database_cre_events]", con)) { con.open(); sqldataadapter da = new sqldataadapter(cmd); da.fill(dt); foreach (datarow dtrow in dt.rows) { userdetails user = new userdetails(); user.deal = dtrow["deal"].tostring(); user.loanproperty = dtrow["property"].tostring(); user.events = dtrow["event"].tostring

write python object __str__ to file -

class c: pass file = open("newfile.txt", "w") j in range(10): c = c() print c file.write(c) file.close() is there wrong in code? new python , want write content that's outputted 'print c' file ? you can use str() function convert object string same way print does: for j in range(10): c = c() print c file.write(str(c)) this not include newline, however. if need newline well, can manually add one: file.write(str(c) + '\n') or use string formatting: file.write('{}\n'.format(c)) or use print statement redirection ( >> fileobject ): print >> file, c

asp.net - 2 listviews working together -

i have created asp.net page 2 listviews. 1 name , message date , 1 message in when click first highlight message in other listview don't know how work. hope somone give me hint here. i have method first listview. protected sub lswberichten2_selectedindexchanged(sender object, e eventargs) handles lswberichten2.selectedindexchanged dim lblmsgid label = ctype(lswberichten2.items(lswberichten2.selectedindex).findcontrol("msgid"), label) hiddenmessageid.value = lblmsgide.text end sub im not entirely sure looking for, im not sure intent entirely clear. believe binding data 2 lists (i assume same datasource, different fields), , when item in list 1 selected, corresponding item in list 2 selected. here take: first listboxes must have data assigned; binding display , value differently, can allow data id field included. listbox1.datasource = yourdatasource; listbox1.valuemember = youridfield; listbox1.displaymember = yourmessageoverview; lis

objective c - Reverse Geocoding using google maps api iOS -

i doing reverse geocoding using following code - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { curloc=newlocation; if (curloc != nil) { latitude=curloc.coordinate.latitude; longitude=curloc.coordinate.longitude; //[self loadmap:latitude second:longitude]; [self markerpoint:latitude+0.04 second:longitude+0.1 third:latitude-0.04 forth:longitude-0.1]; nserror *error; nsstring *lookupstring = [nsurl urlwithstring:[nsstring stringwithformat:@"http://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&sensor=false",latitude,longitude]]; nslog(@"url: %@",lookupstring); lookupstring = [lookupstring stringbyreplacingoccurrencesofstring:@" " withstring:@"+"]; nsdata *jsonresponse = [nsdata datawithcontentsofurl:[nsurl urlwithstring:lookupstring]]; nsdiction

python - Regex not matching pattern between quotes? -

i have simple regex parse source code files , each line extract content enclosed in double quotes, use in gettext.po file here regex: gettext_subject = re.compile(r"""[subject: |summary: ]\"(.*?)\"""").findall here sample input file: exports.onappointment = (appt, user, lang, isnew) -> if not user return promise.reject "appointment has no user." moment.locale(lang) start = moment(appt.when) cal = new ical() console.log appt.when cal.addevent start: start.todate() end: moment(start).add(2,"hours").todate() summary: "continental showroom visit" mail = to: user.emailid subject: if isnew "new appointment" else "appointment updated" alternatives: [ contenttype: "text/calendar", contents: new buffer(cal.tostring()), contentencoding: "7bit" ] template = name: "booking" lang: lang

In Shiny for R, why does Sys.Date() return yesterday's date inside a dateInput? -

Image
i have dateinput in ui.r follows: dateinput("asofdatetime", label = "as of", value = sys.date(), max = sys.date()) for 2015-05-15 , gives dateinput default value of 2015-05-14 . however, when run sys.date() in console on 2015-05-15 , correct value: 2015-05-15 . why shiny give yesterday's date inside app? that sound weird. starting on shiny not know sure. could be timezone?? maybe sys.timezone() different on servers? have tried formatting date timezone? caching problem?? could value cached old instance? take running within shinyserver{ ... code} not above. try rebuild in dashboard? but here solution set value null ( see helpfile ) value starting date. either date object, or string in yyyy-mm-dd format. if null (the default), use current date in client's time zone. it default date in timezone. dateinput("asofdatetime", label = "as of", value = null,

asp.net mvc 5 - Unable to apply sorting in MVC 5 -

i'm trying apply sorting in mvc 5 application. used code here apply sorting. unfortunately, not working , won't sort. missing something? datatypes used strings btw. here code: //controller public actionresult index(string sort) { viewbag.extsortparm = string.isnullorempty(sort) ? "ext_desc" : ""; viewbag.dtssortparm = sort == "dts" ? "dts_desc" : "dts"; var sales = s in db.sales1 select s; switch (sort) { case "ext_desc": sales = sales.orderbydescending(s => s.extserial); break; case "dts": sales = sales.orderby(s => s.dts); break; case "dts_desc": sales = sales.orderbydescending(s => s.dts); break; default:

c# - Finding position of (sub) image in parent image in base64 encoded strings -

i hoping me figuring out (if possible) whether location of image within larger image can determined using base64 encoded string representation. if not, best (quickest) method of finding sub image within image. example created 50x50 sample image , 22x12 subimage , converted each of them base64 encoded string, how find location of subimage? as side note. working in c# .