Posts

Showing posts from January, 2013

ios - Boolean for UIAlertController Objective-C -

a button triggers alert; alert "one-time", appearing once never appearing again after user hits "ok". if boolean 0, alert triggered; if 1, alert not triggered. if user hits "ok", value of bool set 1. which best way set one-time alert in objective-c? i use nsuserdefaults store boolean flag you're talking about. so: static nsstring * const alerthasbeenshownuserdefaultskey = @"alerthasbeenshownuserdefaultskey"; -(void)showalert { nsuserdefaults *userdefaults = [nsuserdefaults standarduserdefaults]; if (![userdefaults boolforkey:alerthasbeenshownuserdefaultskey]) { //show alert [userdefaults setbool:yes forkey:alerthasbeenshownuserdefaultskey]; } } nsuserdefaults keep bool value across launches. value reset if user reinstalls app though.

opencv - How to include and use OpenCv3.1.0 library to CUDA file(.cu)? -

i tried implement own kernel median filter pseudo code: //main.cpp #include "opencv2/opencv.hpp" cv::mat inputmat = cv::imread() cudamediancaller (inputmat, kernelmat) //medianfilter.h #include "opencv2/opencv.hpp" cudamediancaller (const cv::mat& inputmat, cv::mat& kernelmat); //medianfilter.cu cudamediancaller (const cv::mat& inputmat, cv::mat& kernelmat) { kernelmedianfilter<<< , >>> (uchar3* d_inputmat, uchar* d_kernelmat) } __global__ void kernelmedianfilter (uchar3* d_inputmat, uchar* d_kernelmat) { } i compile error : c1083: cannot open include file:'opencv2/opencv.hpp' : no such file or directory i know .cu file compile nvcc , not compile opencv header filess. 1) how can include opencv3.1.0 library .cu file? you don't need include opencv in .cu file. need caller api raw pointers , basic data types parameters. main.cpp #include "opencv2/opencv.hpp" #include "...

How to removing space between home (and up) button and title on android action bar? -

Image
in app, there space i dont want between icons , action bar title . menu button default 1 when 1 creates navigation activity. , arrow brought including <activity android:name=".shipmentlist" android:label="shimpment" android:parentactivityname=".mainnavigationactivity"> <meta-data android:name="android.support.parent_activity" android:value="com.mobile.mainnavigationactivity" /> </activity> in androidmanifest. on each version upgrade found issues ui changes. issue android version 24. happened when installed , upgraded build it. maybe new default design android.. can build toolbar instead of builtin actionbar, able padd wish. or, if don't mind - can downgrade 23.0.3 , appcompat 23.3.0 *by way- if downgrade 23.0.0 - 23.2.0 have issue colorstate = contextcompat.getcolorstatelist(chatactivity.this,r.color.myco...

How to share functionality in Rust? -

struct vector { data: [f32; 2] } impl vector { //many methods } now want create normal behave vector need differentiate type. because example transforming normal different transforming vector. need transform tranposed(inverse) matrix example. now this: struct normal { v: vector } and reimplement functionality impl normal { fn dot(self, other: normal) -> f32 { vector::dot(self.v, other.v) } .... } i think phantomdata struct vectortype; struct normaltype; struct pointtype; struct vector<t = vectortype> { data: [f32; 2], _type: phantomdata<t>, } type normal = vector<normaltype>; but need way implement functionality specific types. it should easy implement example add possible add point + vector . or functionality specific type impl vector<normaltype> {..} // normal specific stuff not sure how implement functionality subrange. example maybe dot product makes sense normals , vectors not points....

html - How to move the column to the center position, and bring it to the place of another column in Bootstrap? -

world! i have question changing position of columns in bootstrap i have change position of first column logo center , show @ left of window hamburger menu icon on mobile. for more information @ image under post: image on imgur here it better if upload code but far understood image, can try following : <div class="col-xs-2 hidden-md">navigation</div> <div class=" col-md-2 col-xs-8 ">logo section </div> <div class="col-md-8">navigation</div> <div class="col-md-2 col-xs-2">search box</div>

javascript - how can i show only iframe when click on the URL -

following code, want make search list show results of tube , when click on url, video start on same page along searching results, want iframe. <head> <title>youtube playlist search</title> <link rel="stylesheet" type="text/css" href="new 2.css" media="screen"> </head> <body> <script src="http://www.yvoschaap.com/ytpage/ytembed.js"></script> <form id="tfnewsearch" method="get" onsubmit="ytembed.init({'block':'youtubedivsearch','type':'search','q':document.getelementbyid('ytsearchfield').value,'results': 20,'meta','_self':false}); return false;"> <span>yout </span> <input type="text" id="ytsearchfield" placeholder="search video here" name="q" size="21" maxlength="120"...

Prepared SQL Statement in PHP Not Updating MySQL Database Row -

i attempting update mysql database table new rows php script. script called frontend html form gets seralised , passed php $_post variables. $stmt = $con->prepare("update blog set tag = ?, datestamp = ?, title = ?, content = ?, views = ?, shares = ? id=?"); $stmt->bind_param("ssssiii", $tag, $datestamp, $title, $content, $views, $shares, $postid); $stmt->execute(); / check whether execute() succeeded if ($stmt->errno) { echo "failure! " . $stmt->error; } else { echo var_dump($stmt); printf("%d row updated.\n", $stmt->affected_rows); } the request not throw error, database row not updated, , outputs "0 rows updated". serialised data being sent right types (strings , ints appropriate). know might causing issue? echo var_dump($stmt) returns : object(mysqli_stmt)#2 (9) { ["affected_rows"]=> int(0) ["insert_id"]=> int(0) ["...

css - SCSS: multiple box-shadow declaration in mixin -

i have following mixin box-shadow: @mixin box-shadow($horizontal, $vertical, $blur, $spread, $r, $g, $b, $a, $inset:"") { -webkit-box-shadow: $horizontal $vertical $blur $spread rgba($r, $g, $b, $a) unquote($inset); box-shadow: $horizontal $vertical $blur $spread rgba($r, $g, $b, $a) unquote($inset); } it works fine if use this, example: @include box-shadow(0px, 2px, 4px, 0px, 0, 0, 0, 0.4) but how can chain 2 shadows? eventually want have css that, example: -webkit-box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.4), 0px 0px 6px 2px rgba(255,255,255,0.5) inset; i tried following code: @include box-shadow(0px, 2px, 4px, 0px, 0, 0, 0, 0.4), box-shadow(0px, 0px, 6px, 2px, 255, 255, 255, 0.5, inset); but didn't work. so, possible? a simple solution change mixin use variable parameter. this. @mixin box-shadow($params...) { -webkit-box-shadow: $params; -moz-box-shadow: $params; box-shadow: $params; } this allow use commas in argumen...

Import/export users/partners data in odoo -

i'm trying export odoo's user data... can't it... when exportation, i've try export data using "database id" when try import them again, can't because don't have option "database id" in options import. so, try export data using "external id", but, relative ids doesn't match, , it's imposibble it. also, i've try export/import information settings > sequences & identifiers > external identifiers because thought related, doesn't so, doing wrong?? is there chance full exportation user-partner's information actual odoo another?? if want migrate whole database including models, fields, menu items, fields etc. can check answer if want through export , import have validate , have remove error. helpful if share screenshot of validation.

java - What is the use of createing an Interface array assign to instantiated object -

here have created object of b , assigned reference variable of interface.what means actually?. purpose of interface used implementation classes.what can interface when create array. means actually?. interface i1{} class implements i1{} class b implements i1{} class c extends b {} class d{} public class lab1 { public static void main(string[] args) { i1 i1[] = new b[4]; i1[0] = new a(); i1[1] = new c(); i1[2] = new b(); //i1[3] = new d(); } } it allows perform same operation on instances in array (by calling methods of interface). for example : for (i1 inst : i1) { i1.dosomething (); // dosomething() method declared interface i1 } to make less abstract, here's more concrete example - if interface called shape , has draw() method, can draw shapes writing : for (shape shape : shapesarray) { shape.draw (); } this code doesn't care if actual instances stored in array circles, rectangles...

python - Django bootstrap3_datetime widget in admin site doesn't pass form data -

Image
i'm trying replace standard adminsplitdatetime widget in admin site better functionality (basically want display 'available' dates in calender couldn't find how default picker). decided use bootstrap3_datetime widget. after overriding field use new widget, doesn't seem transferred 'clean' method (isn't in self.cleaned_data) validation. models.py publish_time = models.datetimefield('date publish') admin.py class myform(forms.modelform): def __init__(self, *args, **kwargs): super(myform, self).__init__(*args, **kwargs) bad_dates = [] #populating bad_dates application logic def clean(self): # return none when using new widget. # when working default widget, have correct value. publish_time = self.cleaned_data.get('publish_time', none) publish_time = forms.datetimefield(widget=datetimepicker(options= {"format": "dd-mm-yyyy hh:mm", ...

ios - AFNetworking URL parameter encoding for datetime with + and : sign -

i'm using afnetworking ios , want send request query parameter has datetime value. wanted behavior should be: original: 2016-07-04t14:30:21+0200 encoded: 2016-07-04t14%3a30%3a21%2b0200 example: .../?datetime=2016-07-04t14%3a30%3a21%2b0200 afnetworking string encoding doesn't include special characters + / & : , few more ( wikipedia: percent-encoding ), fine since reserved. have encode value of datetime way escape plus , colon sign. when manually encode value before afnetworking escapes % twice obviously. puts %25 each % 2016-07-04t14%253a30%253a21%252b0200 i want afnetworking use percent encoding query allowed characters like: query.stringbyaddingpercentencodingwithallowedcharacters(nscharacterset.urlpathallowedcharacterset()) i didn't find solution change or disable encoding afnetworking manually. have suggestions? after little more research i've found place inject encoding want. way didn't work: encoding not working init requ...

python - PyQt5 error during "python3 configure.py": fatal error: 'qgeolocation.h' file not found -

mac osx 10.9, python 3.5, sip-4.17, pyqt-gpl-5.5.1, qt5.5.1 hi, trying build pyqt on system did following steps: download/install qt5.5.1 libraries download/unpack sip download/unpack pyqt install sip: python3 configure.py -d /library/python/3.5/site-packages --arch x86_64 make sudo make install tried install pyqt: python3 configure.py -d /library/python/3.5/site-packages --qmake /.../qt5.5.1/5.5/clang_64/bin/qmake configuration stopped with: /users/werner/opensource/pyqt/sip/qtpositioning/qgeolocation.sip:28:10: fatal >error: 'qgeolocation.h' file not found #include <qgeolocation.h> ^ 1 error generated. make[1]: *** [sipqtpositioningcmodule.o] error 1 make: *** [sub-qtpositioning-make_first-ordered] error 2 i tried finish installation doing make sudo make install anyway. installation doesn't seem complete (e.g. uic, pyuic5 missing). h...

Using REGEX to removed Closed Captions from a SRT Subtitles file in Notepad++ -

Image
i editing srt subtitles file in notepad++ , need remove "closed captions" parts (which used hearing disabled) eg. 354 00:03:11,108 --> 00:03:12,608 [bang] 355 00:03:25,956 --> 00:03:27,248 have not arrived 356 00:04:59,967 --> 00:05:02,301 [television plays] 357 00:03:25,956 --> 00:03:27,248 mama. 358 00:03:27,332 --> 00:03:30,001 mama! 359 00:04:25,641 --> 00:04:26,557 [bang] 360 00:04:59,967 --> 00:05:02,301 [car door closes] so in above text, lines " [.....] " removed, understand can done regular expressions? make sure "regular expressions" option checked. try replacing regex: ^\[.*\]$ with empty string. if want delete newlines (to remove space/lines), instead: ^\[.*\]\r\n

c++ - Differentiate between 1D and 2D container in template class constructor (SFINAE) -

so, have class, has array of arrays private member. wish have 2 constructors each case (1d or 2d). of course declaration happens same, template deduction can't job without me doing it. here's code: edit: need work stl containers vector or c++ array. why overcomplicating , not going "arrays" fix. #include <iostream> #include <array> template<class t, std::size_t rows_t, std::size_t cols_t> class test { private: std::array<std::array<t, cols_t>, rows_t> _data; public: auto begin() { return this->_data.begin(); } auto end() { return this->_data.end(); } //constructor template<class type_t> test(const type_t &arr) { std::size_t j = 0; (const auto &num : arr) this->_data[0][j++] = num; } template<class type_t> test(const type_t &arr) { std::size_t = 0; (const auto &el : arr) { std::si...

nginx - Multiple upstream proxies failing -

i've been playing around using docker setup group of web applications sit behind nginx container. i'm using docker-compose manage different services , of individual web service containers work fine when try access them nginx container 1 of them works , it's first 1 try access. if start container group , access app1 page expected if go app2 50x error. if restart group , go app2 first page expected if go app1 50x error now. i'm not sure i'm doing wrong in nginx config. assistance appreciated. here nginx config: upstream app1_backend { server app1:8000; } upstream app2_backend { server app2:8000; } server { listen 80 default_server; server_name localhost; charset utf-8; #location / { # root /usr/share/nginx/html; # index index.html index.htm; #} #error_page 404 /404.html; # redirect server error pages static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x....

docusignapi - DocuSign callback after user signs a document -

is there callback docusign posting in background know whether user signed specific document or not? yes can setup webhooks docusign, can use docusign connect module or eventnotifications object in envelope definition configure callback url etc. you can poll docusign platform asking status of specific envelopes there hourly api rate limits in place should avoid polling when possible. see status , events page in api docs more info on these 3 methods.

Deleting and reinstalling SVN via homebrew leads to catch 22 -

i tried deleting , reinstalling svn via homebrew. after deleting tried reinstall, said had version. tried access , not link it. ideas? thanks! ~ $ svn /usr/bin/svn ~ $ sudo rm /usr/bin/svn password: ~ $ brew install svn warning: subversion-1.8.13 installed, it's not linked ~ $ brew link command requires keg argument ~ $ brew link --overwrite subversion linking /usr/local/cellar/subversion/1.8.13... error: not symlink share/man/man8/svnserve.8 /usr/local/share/man/man8 not writable.

java - Udp how to get integer from the server? -

i shall implement udp-based client/server application , im new in world of java. server implements simple request-acknowledge protocol upon udp protocol. received string identifier (command) optional parameters server returns specified result. example "thread" returns random integer number between 1 , 5 , length returns random integer number between 5 , 25. the questions did implementation right , how can fix problem (length nr between 1 , 5). think problem in server class if statements not checked. there other way send comand server tried here sending strings trying check if statements? and thats code (server): public class server { public static void main(string[] args) throws ioexception, interruptedexception { datagramsocket skt; try { skt = new datagramsocket(1252); byte [] buffer = new byte[1000]; while(true){ datagrampacket request = new datagrampacket(buffer, buffer.length); skt.receive(request); ...

gcc - C Field has incomplete type, without forward declaration -

i keep getting "field has incomplete type error," can't find forward declarations type in code, or of types in it's struct--aside pointer fields. tried recursive grep folder, , still couldn't find forward declarations. how make gcc tell me thinks forward declaration is? or why it's incomplete? trying compile file: https://github.com/pdjeeves/creatureslib/blob/master/src/biochemistry/emitter.c gets error on include: https://github.com/pdjeeves/creatureslib/blob/master/src/creature/creature.h with member "struct brain brain" your brain.h , organ.h both start #ifndef _organ_h_ #define _organ_h_ this means second 1 not included after include first one. it's unusual used #ifndef _something_h_ @ several places inside brain.h . should include relevant headers, instead of redefining contents. i.e. #include lobe.h , instead of declaring empty forward declaration struct brainlobe; .

encoding - Decoding UTF-8 to URL with Python -

i have following url encoded in utf-8. url_input = u'https://www.gumtree.com//p/uk-holiday-rentals/1bedroon-flat-\xa3250pw-all-bills-included-/1174092955' i need scrap webpage , need have following url_output (unicode not read). url_output=https://www.gumtree.com//p/uk-holiday-rentals/1bedroon-flat-£250pw-all-bills-included-/1174092955 when print url_input, url_output: print(url_input) https://www.gumtree.com//p/uk-holiday-rentals/1bedroon-flat-£250pw-all-bills-included-/1174092955 however not find way transform url_input url_output. according forums print function uses ascii decoding on python 2.7 ascii not supposed read \xa3 , url_input.encode('ascii') not work. does know how can solve problem ? in advance ! after tests, can confirm server accepts url in different formats: raw utf8 encoded url: url_output = url_input.encode('utf8') %encoded latin1 url url_output = urllib.quote_plus(url_input.encode('latin1'), '...

javascript - Assigning a reducer for a dynamic store property -

i'm trying figure out how set reducer property in state tree gets created user events. my state tree looks this: { session: { session object }, dashboard: { id: 'id001', charts: { 'cid001': { dimensions: { ... }, more objects... }, 'cid002': { dimensions: { ... }, more objects... } } } } new charts properties come in through redux when user clicks add chart button. key set chart id, cid . i'm using combinereducers() set reducer tree. import session './session'; import charts './charts'; const rootreducer = combinereducers({ session, dashboard: combinereducers({ charts }); }); i able nest reducers if know property names ahead of time. however, i'd avoid having massive reducer charts property, since each chart inside have 20 more objects on need reducing, dimensions 1 example. is there way set reducer charts['cidxxx'].dimensions , , other sub-properties? there wild...

ios - How to relate objects which are subclassed from PFObject? -

i have 2 classes person , address. these 2 classes subclassed pfobject. how can make relation between these classes? below code: person: @interface person : pfobject<pfsubclassing> @property(strong,nonatomic)nsstring *lastname; address: @interface address : pfobject<pfsubclassing> @property(strong,nonatomic)person *person; @property(strong,nonatomic)nsstring *lastname; in address file, have done make relation shows me null value: both of them created singleton because wanted make relations. address.person.lastname= person.lastname; please me how make relation. appreciated. thanks.

mysql - Get last "active" day from last week -

in tool users can set workdays (example: monday friyday).when save settings, stored in mysql user table. in next week (this week) "last workday". in case friday. how can last workday every user mysql? currently save workdays in csv (2,3,4,5,6 - 2 = monday...) can change that. i tried stuff weekday(), doesnt work. can me? dayname(concat('1970-09-2', substring_index(workdays, ',', -1))) explanation: this mysql string function substring_index : substring_index(workdays, ',', -1) ...will give number of last workday listed. (what find positions there's comma , returns after last comma, e.g., substring_index('1,2,3', ',', -1) returns 3.) and trick here , using dayname , concat : dayname(concat('1970-09-2', dayindex)) ...gives day name. (since dayname requires date, technique picks date in past sunday , ends in 0, in case 1970-09-20 , , replaces last digit returned index determine corresponding...

python - Plot a data frame -

Image
i have data frame this: reviewdate_month,productid,reviewer 01,185,185 02,155,155 03,130,130 04,111,111 05,110,110 06,98,98 07,101,92 08,71,71 09,73,73 10,76,76 11,105,105 12,189,189 i want plot it, reviewdate_month in x, product id , reviewer in y ideally. start 1 line either product id or reviewer. tried: df_no_monthlycount.plot.line got below error msg: file "c:/users/user/pycharmprojects/assign2/main.py", line 59, in <module> 01 185 185 02 155 155 03 130 130 04 111 111 05 110 110 06 98 98 07 101 92 08 71 71 09 73 73 10 76 76 df_no_monthlycount.plot.line attributeerror: 'function' object has no attribute 'line' 11 105 105 12 ...

Compare LastWriteTime in an 'if' statement in PowerShell -

i want run below script every 10 minutes. i have file , file b. every 10 minutes, want check if file newer file b. if so, want set lastwritetime of file b current date. believe if statement wrong... how can fix it? $a = get-item c:\users\testuser\desktop\test.xml | select lastwritetime $b = get-item c:\users\testuser\desktop\test.swf | select lastwritetime if($a < $b) { $b.lastwritetime = (get-date) } i think in above example, i'm setting variable $b current date...i want set lastwritetime of actual file current date. you similar following change last write time of file: $file1 = get-childitem -path "c:\temp\test1.txt" $file2 = get-childitem -path "c:\temp\test2.txt" #system.io namespace of file class in .net , getlastwritetime/setlastwritetime methods of class. if ([system.io.file]::getlastwritetime($file1) -lt [system.io.file]::getlastwritetime($file2)) { write-output "file1 lastwritetime less file2, setting la...

meteor - nginx and meteorjs - how to rewrite the URL to include port? -

Image
i confused on how rewrite url meteorjs requests has http address of http://ip/<lettershere>meteor_js_resource=true http://ip:3000/<lettershere>meteor_js_resource=true . if access site's url:3000, can static files meteor application. however, if tried nginx configuration file route url:3000 url/someurl when people access site, don't need 3000 port number, instead /someurl : server { listen 0.0.0.0:80; server_name domain.com; location /youtube-channel-search { proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-nginx-proxy true; proxy_pass http://localhost:3000; proxy_redirect off; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; rewrite http://domain.com http://domain.com:3000 permanent; } } then error js...

vba - Parsing the Parameters of a Function -

i trying create udf within vba go through function syntax , treat text. the function : functiona( param1 , param2 , param3 , param 4 ) i trying develop udf pull out value of param based on position input udf function. getn( functiona , 3 ) = "param3" getn functiona , 1 ) = "param1" here's function far it's off.... it's behaving : getn( functiona , 0 ) = param2 here's function: function getn(sinputstring string, n integer) string dim sfindwhat string dim j, finda, findb integer application.volatile sfindwhat = "," finda = 0 j = 0 n finda = instr(finda + 1, sinputstring, sfindwhat) findb = instr(finda + 1, sinputstring, sfindwhat) if findb = 0 findb = instr(finda + 1, sinputstring, ")") if finda = 0 exit next getn = trim(mid(sinputstring, finda + 1, findb - finda - 1)) end function thank help split should work, though...

javascript - jQuery function $.post with .remove -

trying build simple jquery allows user click button within table row should run separate php script delete item db row , remove table row in 1 action. (will migrate prepared statements once working.) html <tr id="wish_list_row2"> <td class="text-center"> <a href="#" data-toggle="tooltip" data-placement="bottom" title="click download resource" style="margin-right:15px;"><i class="fa fa-download"></i></a> <a onclick="deletewishlist(3,1)" data-toggle="tooltip" data-placement="bottom" title="click remove resource wish list"><i class="fa fa-gift"></i></a> </td> </tr> <tr id="wish_list_row3"> <td class="text-center"> <a href="#" data-toggle="tooltip" data-placement="bottom" title="click download r...

java - Can't connect to sqlite from eclipse? -

hello guys have simple java , trying connect sqlite database eclipse doesn't work @ all. here code: import java.sql.connection; import java.sql.drivermanager; import java.sql.sqlexception; import java.sql.statement; public class databaseconnection { private string pathdb="c:\\sqlite\\test.db"; private connection connection=null; private statement statement=null; public databaseconnection(string path){ pathdb= path; } public void connect () { try { class.forname("org.sqlite.jdbc"); connection= drivermanager.getconnection("jdbc:sqlite:" + pathdb); statement= connection.createstatement(); system.out.println("connection " + pathdb + " "+ "successful"); } catch (classnotfoundexception notfoundexception) { notfoundexception.printstacktrace(); system.out.println("connection error!"); } catch (sqlexception sqlexception) {...

Does Firebase Analytics support geographic drill down? -

i've created firebase account , integrated app. in firebase console, can see map of world, , yes, there's app running in usa(where am). there not seem finer geographic granularity "country". similar feature in google analytics lets click on country , see data city level. missing something, or country-level usage finest granularity available firebase analytics? and if can better, how? currently, can't see finer granularity in firebase analytics. however, finer-grained granularity (region , city) available in bigquery, if need level of detail, can link firebase app bigquery , access there.

clisp - Lisp: to perform set union operation -

i 'am beginner in lisp.i use clisp in ubuntu .i have code here in lisp carry out union operation on 2 lists.the logic correct.but stuck @ error is: *** - append: proper list must not end t my code is: (defun set-union (l1 l2) (cond ((null l2) ;if l2 null union l1 itself. l1) ((not (member (first l2) l1)) ;check if first member of l2 in l1 or not (setq l1 (append (set-union l1 (rest l2)) (list (first l2))))) ;if not append union of l1 , rest of l2. (t (set-union l1 (rest l2))) )) ;if second condition not true carry out union on l1 , rest of elements of l2 (setq l1 (list 'a 'c 'b 'g)) (setq l2 (list 'd 'g 't)) (set-union l1 l2) (print l1) i need help!!thanks. (append (set-union l1 (rest l2)) (first l2)) at point of logic tries append (a c b g . t) , e, fails because first not proper list. either use (append (set-union l1 (rest l2)) (list (first l2))) or, better (cons (first l2) (set-union l1 (rest l2))) ...

javascript - What is the 'the default user interface' referred to by the aShowDefaultUI parameter in element.execCommand()? -

according api element.execcommand() function, says has 3 parameters: acommandname, ashowdefaultui, avalueargument. the api's description of first , third parameters clear i'm unsure meaning of second parameter. this api says: ashowdefaultui : boolean indicating whether default user interface should shown. not implemented in mozilla. what referring when says 'the default user interface'? for reference, i'm using element.execcommand() create own wysiwyg web text editor ever need work in google chrome.

javascript - How to output when I use wp_handle_upload_prefilter, Wordpress -

simple request, how can find got in $file ? (array ?) when add print_r or echo, wordpress show me error messeage. i googled, found nothing, because poor english maybe. function wp_modify_uploaded_file_names($file) { $info = pathinfo($file['name']); $ext = empty($info['extension']) ? '' : '.' . $info['extension']; $name = basename($file['name'], $ext); $file['name'] = uniqid() . $ext; // uniqid method print_r($file); return $file; } add_filter('wp_handle_upload_prefilter', 'wp_modify_uploaded_file_names', 1, 1); typically on filters, can't output print_r or echo...or var_dump() in cases. can if want, output end somewhere else expect be. what use var_export() , set 'return' true , include in return statement of filter. however, in case of wp_handle_upload_prefilter() if include other formatted $file variable in return statement, you'll error saw. t...

c# - Monogame on Windows Phone 8 wrong backbuffer size -

i have created monogame project windows phone 8.0 template. when deploy app (that should show blue screen), backbuffer size wrong (it small). when changed grid drawingsurfacebackgroundgrid, backbuffer size fine, project not in landscape - in portrait. how can fix it? i use lumia 635 windows mobile 10. in game constructor, specify backbuffer size want use. example: public game1() { graphics = new graphicsdevicemanager(this); graphics.preferredbackbufferwidth = 800; graphics.preferredbackbufferheight = 600; content.rootdirectory = "content"; }

qt - QFileDialog : get file name -

i using qt 5 , qfiledialog. want restrict user give forward slash (/) in file name. i have below code qfiledialog save file name. qfiledialog saveasdialog(this); qstring filename = saveasdialog.getsavefilename(this, tr("save file"), ".", tr("files (*.csv)")); in dialog, if user gives file name "abc.csv" in "download" folder "getsavefilename" returns "/home/user/downloads/abc.csv" correct. but question when user give forward slash in file name (/) not behaving correctly. e.g. if user want give file name "abc/xyz.csv" not getting correct file name. how correct file name "abc/xyz.csv" when user click "ok"? please watch on wikipedia link . as can see, / character prohibited in file name. file name abc/xyz.csv incorrect. also can check wich current directory in file dialog, , based on information can track selected file name. try this: qfiledialog saveasdialo...

python - In tkinter how do I assign the entry function to a variable -

i trying use in if statment check if username equal accepted answer. used .get() on ent_username try name choosen did not work. it never gets entered username need more code button. please help.... import tkinter action = "" #create new window window = tkinter.tk() #name window window.title("basic window") #window sized window.geometry("250x200") #creates label uses ut lbl = tkinter.label(window, text="the game of life time!", bg="#a1dbcd") #pack label lbl.pack() #create username lbl_username = tkinter.label(window, text="username", bg="#a1dbcd") ent_username = tkinter.entry(window) #pack username lbl_username.pack() ent_username.pack() #attempting ent_username info store username = ent_username.get() #configure window window.configure(background="#a1dbcd") #basic enter password lbl_password = tkinter.label(window, text="password", bg="#a1dbcd") ent_password = tkinter.entry...

xml - JAX-WS client-side Java Soap send a Jav List of the client to the server (lack of generation in list.add JAXB) -

i have soap service sending following values: @xmlrootelement(name = "person") @xmltype(proporder = {"id","name","address", "telephones", "telephone2", "durations", "langage"}) @xmlaccessortype(xmlaccesstype.field) public class person { @xmlelement(required=true) public uuid id; //public list<uuid> listid; private string name; private string address; @xmljavatypeadapter(durationadapter.class) @xmlelement(name="duration") private java.time.duration durations; @xmlelementwrapper(name="telephones", nillable=true) @xmlelement(name="telephone", required=true, type=telephone.class) public list<telephone> telephones; private telephone telephone2; private langage langage; //getter setter example xml : s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:body> <ns...

java - After 9 queries to database, the time to perform the same query is multiplied by 7 -

i using postgresql (9.4.8) on windows 7 32. accessing database via eclipselink 2.6.3 , jdbc driver 9.4.1208 on jdk 8u72. i performing simple count query (build criteria api). first query taking times, no problem that, after that, next 8 queries taking less time, , great. 9th query response taking 7x times of previous query, , never go down. here extract of logs : [el fine]: sql: 2016-07-04 17:19:42.658--serversession(13112008)--connection(27980113)--select now() info - select now() = 2016-07-04 17:19:41.8 [el fine]: sql: 2016-07-04 17:19:42.691--serversession(13112008)--connection(27980113)--select version() info - select version() = postgresql 9.4.8, compiled visual c++ build 1800, 32-bit info - jdbc version = postgresql 9.4.1208 [el fine]: sql: 2016-07-04 17:19:42.738--serversession(13112008)--connection(27980113)--select count(distinct(id)) recorder.records ((channel_number in (?, ......, ?, ?)) , (rec_start between ? , ?)) bind => [10, 11, 12, ......, 299, 2016...

c# - MassTransit consumer hard to test -

Image
i having 2 issues testing masstransit consumers: sync issue messagedata the first 1 this: var testconsumer = testfactory.forconsumer<imageuploadconsumer>().new( test => { test.useconsumerfactory(new instanceconsumerfactory<imageuploadconsumer>(imageconsumer)); test.publish(message, (scenario, context) => { }); }); testconsumer.execute(); //is non blocking the following line (below) fails, because line: moqfilemetarepo.verify(_ => _.add(it.isany<ifilemeta>()),times.once ); is executed 9.9/10 before... line ever did: public async task consume(consumecontext<imageuploadwiththumb> context) my fix has been do moqfilemetarepo .setup(repo => repo.add(it.isany<ifilemeta>())) .callback(() => { autoevent.set(); ...

amazon web services - Why aws lambda within VPC can not send message to SNS? -

my lambda function can send message sns publish method "no vpc", timeout when put in vpc has access public internet route , internet gateway. edited i have lambda in public subnet has 0.0.0.0/0 routed internet gateway, can not route again nat. possible assign eip lambda function you have add nat gateway vpc in order lambda functions (and other things in vpc don't have public ip) access outside vpc. should read things know section of this aws announcement .

javascript - Trying to find if a number is a palindrome in JS -

i'm trying learn js , have few exercises i'm trying solve in order improve. @ moment, i'm trying find out if number palindrome, , have code, doesnt seem work, since numbers insert in inputs palindromes. <input type="text" class="screen"> <button type="button" class="btn">check</button> var strg = document.queryselector(".screen").value; var pal = strg.split("").reverse("").join(""); document.queryselector(".btn").addeventlistener("click", function(){ if (strg == pal) { console.log(strg+" palindrome"); } else { console.log(strg+" not palindrome"); } }) https://jsfiddle.net/lw6uk8kb/ appreciate help. you have move first 2 lines inside handler well: document.queryselector(".btn").addeventlistener("click", function(){ var strg = document.queryselector(".screen").val...

process - Operating system processes in .c -

can explain me argc , argv in code , why variables parameters in main function? had in lectures example showed both variables i'm using them without knowing do. main (argc, argv) char *argv[]; { int fd; extern int errno; if(argc < 2){ fprintf(stderr, "no file\n"); exit(1); } if((fd = creat(argv[1], 0777)) < 0){ fprintf(stderr, "cannot creat file %s\n", argv[1]); exit(1); } switch (fork()) { case -1: fprintf(stderr, "fork error\n"); exit(1); case 0: close(1); dup(fd); close(fd); execl("/bin/pwd", "pwd", null); perror("exec"); break; default: close(fd); } exit(0); } argc int giving program number of arguments passed program operating system. ...

xml - Align a RelativeLayout to bottom in android -

i've following code create element of chat, imageview shows unaligned respect design. layout shows this when run program, ¿how can aling view named "avatar" bottom of relativelayout? <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginleft="@dimen/stixchat_margin_8" android:layout_marginright="@dimen/margin_item_chat_right" android:layout_margintop="@dimen/stixchat_margin_8" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/content_avatar" android:orientation="vertical" > <com.trongphuc.emoappchat.friendprofileimageviewlast android:id="@+i...

jquery - Rubaxa sortable causes scroll and weird behaviors on some android mobile devices i.e. s4 -

using jquery sortable rubaxa, , detected in devices impossible sort list, causing while sorting page scroll. after adding scroll options situation improved in devices s5, no improvement @ on others. this options using far. <ul> <li id="1" class="listsort">item 1</li> <li id="2" class="listsort">item 2</li> <li id="3" class="listsort">item 3</li> <li id="4" class="listsort">item 4</li> <li id="5" class="listsort">item 5</li> ... ... <li id="20" class="listsort">item 22</li> </ul> var sortable_settings = { handle: '.listsort', animation: 0, ghostclass: "ghost", scroll: true, scrollsensitivity: 300, scrollspeed: 5, //forcefallback: true, //fallbackclass: "draggedghost", //fallbackonbody: true, ...

google maps - Move a GMSPolyline in iOS -

i have requirement in cases gmspolyline moved 1 location another. here scenario: a user opens gmsmapview , creates gmspolyline feature. then user changes map position the user taps button center newly created polyline in new view position, is, newly created line feature moved center of new camera view. so far can find no resources how this. there plenty of examples creating , editing gmspolyline features, not finding 1 moving entire feature. can point me example doing this? thanks! you have change coordinates of locations make gsmpath base of gmspolyline. each location can calculate new point using gmsgeometryoffset , draw new polyline. or can use -(instancetype) pathoffsetbylatitude:longitude: of gmspath on gmspath describes polyline. you use 1 or other according data have available (as example start , end target of gmscameraposition after pan)

statistics - Netlogo model result conveying method -

i have designed netlogo model outputs number of turtles in each run. number of turtles increases ticks , becomes constant value n. run model 50 times , have data 50 different n values varying 9 12. have report result graph showing number of turtles increasing ticks. 1 simulation become constant @ 9 (n = 9) , other become constant @ 10 (n = 10). for simulation out of 50, should draw graph for? or should take average of 50 values each tick, , draw graph that? what right approach convey in result, confirmed 50 simulations, number of turtles increases ticks , becomes constant (which varies in range of (9 - 12) different simulations) ? thank you. the point of doing multiple simulations average out stochastic effects. without seeing data, appropriate graph 1 averages variable of interest (eg final turtle count, or turtle count @ each tick). average should taken across simulations running same scenario (that is, have same starting parameters) if want compare scenarios. ...

javascript - Prestashop set catalog mode ON/OFF if user unlogged/logged -

i'm working on prestashop module set catalog mode on or off if user unlogged or logged. works great got problem. i don't want unlogged users see prices @ , allowed order. solution found, when first connection (mode catalog off) unlogged user load page, catalog mod turn on, can see prices (has reload hide prices) so, first load set catalog mode on , second load display real catalog mode. i found js script reload automatically take effect new mode obviously, loading time of page 2 times longer. here function : public function hookheader() { $logged = $this->context->customer->islogged(); if (!$logged) { configuration::updatevalue('ps_catalog_mode', true); } else { configuration::updatevalue('ps_catalog_mode', false); } // reload page once more echo ' <script type="text/javascript"> (function() { if( window.localstorage ) { ...

Python regex remove all character except 4 digitals -

+1511 0716 +4915 czechy +3815/0616 port mo, ao _3615 usa *, suv run on flat +4515 port suv *, suv +3215 usa *, suv +4414 +4815 niem _0616 niem * / mo +2115 niem j i need first 4 digits + 3715 niem please help. you haven't described data well, looks have 2 types of lines: (one or 0 characters)(four digits)(other stuff) or (other stuff no set of 4 digits) i propose using re package. here documentation module in python 3, should read able solve these problems on own in future. i'll assume have lines in list (or other iterable) named lines : import re regex = re.compile(r'^.?([0-9]{4})') line in lines: match = regex.match(line) if match: number = match.group(0) # stuff `number`, string. this assumes there ever 1 character ahead of four-digit number, , don't care whatever comes afterward. if wanted any first 4 digits appear (with number of characters in advance), instead use regex = re.compile(r...

java - Android app to upload to Flickr - Flickrj? -

good afternoon everybody, i'm trying android app upload images flickr . far i'm attempting work these examples: https://github.com/luminousman/flickr https://github.com/yuyang226/flickrjapi4android based on not having gradle files , both being @ least few years old, i'm under impression these both done in eclipse . i'm attempting things working within android studio . both have many imports this: import com.googlecode.flickrjandroid.xxx; is there way import https://github.com/yuyang226/flickrjapi4android library or similar within android studio , or necessary copy/paste every java file? work? i'm having hard time getting started here, if has had success working above in android studio , can provide direction helpful.

c# - Show asp:Panel stored in different file -

i have asp page (.aspx) page, , asp:panel in it. use telerik library irrelevant, think. i need move asp:panel tag outside main file, another, stand-alone, .aspx due file size , work organization. i moved aspx content new file, , related code in .cs file, separated principal one. on load_page of main 1 instantiate, through constructor, separate panel - constructor instantiates every control in panel, , has method .show(). every member work in new class, since new in asp not know how put separate aspx code in former file, since when call mymodalpopup.show() have effect of page reload extract of panel in separate file: <asp:panel id="panelid" runat="server"> <asp:hiddenfield id="control1" runat="server" /> <ajax:modalpopupextender id="extid" runat="server" targetcontrolid="control1"> </ajax:modalpopupextender> //html/controls stuff </asp:panel> the mypanel....