Posts

Showing posts from May, 2012

VB Window Services batch not executing -

i executing batch file using vb run method connect ftp. when executing vb code in debugging mode batch file executing without issue , ftp successful. but, after building exe file , tried run thorough windows service batch file not executing. command = chr(34) & "ftpconnection.bat" & chr(34) & " " & moreportfile a.run command, 0, true

angularjs - Using bower_components with Grunt -

Image
i created simple data listing app using angular js. used bower , grunt. grunt serve project specific port. have error.. when i'm serve project grunt, bower_components not working. mean jquery , angular parts 404. here attach link project. get project here - https://github.com/chanakade/demoapp first clone it, "npm install" , "bower install". please tell me how make them work. 404 errors http://localhost:1701/bower_components/jquery/dist/jquery.js 404 you're specifying ./src root of server in gruntfile. unfortunately, bower installs it's dependencies folder above it, in root of project. html has couple of script tags ../bower_components/[path files] , not work. you need try install bower dependencies in src folder. add .bowerrc file in root of project following content: { "directory" : "src/bower_components" } then reinstall bower dependencies doing: $ bower install check if folder bower_components h

c++ - QT : Passing QString to QThread -

i want pass qstring thread.using this answer, here code: in mainwindow.cpp : mmthread = new mythread; mmthread->start(); connect(this,signal(sendtothread(qstring)),mmthread,slot(getfrom_main(qstring)),qt::queuedconnection); emit sendtothread(mystr); in mainwindow.h : signals: void sendtothread(qstring); in mythread.cpp : void mythread::getfrom_main(qstring str) { //something } in mythread.h : public slots: void getfrom_main(qstring); but seems getfrom_main not called @ all. mistake? edit: i have 3 similar threads this: in mythread.cpp : mythread :: mythread() { movetothread(this); } void mythread::run(){ //something1 } void mythread::getfrom_main(qstring comm) { comment = comm; emit message(comment); } in mythread.h : class mythread : public qthread { q_object public: explicit mythread(); void run(); signals: void message (qstring); private: qstring comment; public slo

php - Catch exception from guzzle -

i'm using laravel , have setup abstract class method response various apis i'm calling. if api url unreachable throws exception. know i'm missing something. great me. $offers = []; try { $appurl = parse_url($this->apiurl); // call api using guzzle $client = new client('' . $appurl['scheme'] . '://' . $appurl['host'] . '' . $appurl['path']); if ($appurl['scheme'] == 'https') //if https disable ssl certificate $client->setdefaultoption('verify', false); $request = $client->get('?' . $appurl['query']); $response = $request->send(); if ($response->getstatuscode() == 200) { $offers = json_decode($response->getbody(), true); } } catch (clienterrorresponseexception $e) { log::info("client error :" . $e->getresponse()->getbody(true)); } catch (servererrorresponseexception

amazon s3 - How to generate a unique (random) output path in Pig? -

is possible generate unique output folder (s3 bucket), maybe contacting random number of sort? this workaround case, concatenate current timestamp: %declare cts `date +"%s"` store data '/path/$cts' using pigstorage(); im not familiar s3, above example show idea of concatenating random string unique path.

Custom (multi-column) <div> in AsciiDoctor? -

i'd layout (and maybe print) asciidoctor document, cheatsheet tables. what best way multi-column html output , multi-column pdf printing? i've found that #col {-moz-column-count: 2;-webkit-column-count: 2;column-count: 2;} can used in html <div> , far modified html manually. (i'm guessing bit do, since i'm not web-developer.) is there way include style , div in asciidoctor source file? what best way multi-column pdf?

javascript - can't load an array to ngTable -

Image
i tried write small , simple ngtable demo, got problem: when try put array ngtable, browser shows head line of table, not data. result in screenshot: all code in plunker here "data": var books = [ { "name": "html start give up", "price": 2, "comment": "an awesome book pillow", "available": true }, { "name": "angularjs start give up", "price": 2, "comment": "too hard pillow", "available": false }]; and here way created ngtable vm.booktable = createtable(books); var initpagesize = number(localstorage.getitem('page_size') || 20); vm.pagesize = initpagesize; vm.pagesizes = [10,20,30,50,100]; function createtable(data){ var initparams = { sorting: {name: "asc"}, count: vm.pagesize }; var initsettings = {

css - Why is my bootstrap header covering other content? -

this question has answer here: twitter bootstrap - top nav bar blocking top content of page 14 answers i have problem using bootstrap's grid system, what's happening nav bar seemingly covering other content, intended underneath it! i'm using asp.net mvc in project, i've done set layout page this; <!doctype html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>you hire ltd</title> <script src="~/scripts/jquery-2.2.4.js"></script> <script src="~/scripts/bootstrap.js"></script> <link href="~/content/bootstrap.min.css" rel="stylesheet" /> <link href="~/content/style.css" rel="stylesheet" /> </head> <body> <div class="container-

javascript - Ajax for login check not working and submitting form -

i know there many answers problem i'm new ajax , javascript point me problem causing script fail. made login check ajax based on answer check if user logged in on ajax page change . when submit button clicked function checks if user logged in or not. want display alert if not , proceed next page if is. javascript: $('#bookform').submit(function(){ $.ajax({ url : '<?=base_url?>user/logged.php', success : function(response){ if (response.logged == true) { return true; }else{ alert('you need log in'); //e.preventdefault(); return false; } } }); }); my php script checks if user logged: $response = array(); if(!isset($_session['userid'])) { $response['logged'] = false; }else{ $response['logged'] = true; } $response = json_encode(

python - dateutils rrule returns dates that 2 months apart -

i new python , dateutil module. passing following arguments: disclosure_start_date = resultsdict['fd_disclosure_start_date'] disclosure_end_date = datetime.datetime.now() disclosure_dates = [dt dt in rrule(monthly, dtstart=disclosure_start_date, until=disclosure_end_date)] here disclosure_start_date = 2012-10-31 00:00:00 converted datetime datetime.datetime(2012, 10, 31, 0, 0) end date of now. when use: disclosure_dates = [dt dt in rrule(monthly, dtstart=disclosure_start_date, until=disclosure_end_date)] i dates every other month or 2 months apart. result is: >>> list(disclosure_dates) [datetime.datetime(2012, 10, 31, 0, 0), datetime.datetime(2012, 12, 31, 0, 0), datetime.datetime(2013, 1, 31, 0, 0), datetime.datetime(2013, 3, 31, 0, 0), datetime.datetime(2013, 5, 31, 0, 0), datetime.datetime(2013, 7, 31, 0, 0), datetime.datetime(2013, 8, 31, 0, 0), datetime.datetime(2013, 10, 31, 0, 0), datetime.datetime(2013, 12, 31, 0, 0), date

PHP String Index $str["test"] same as $str[0]? -

this question has answer here: why strings behave array in php 5.3? 1 answer when referring element inside php string array, using square brackets [ ] can use number [2] select specific character string. however, when using string index ["example"], returns same result [0]. <?php $str="hello world."; echo $str; // echos "hello world." expected. echo $str[2]; // echos "l" expected. echo $str["example"]; // echos "h", not expected. $arr=array(); $arr["key"]="test." echo $arr["key"]; // echos "test." expected. echo $arr["invalid"]; // gives "undefined index" error expected. echo $arr["key"]; why return same result [0]? php uses type juggling convert variables of non fitting type fitting one. in case, php expects index numeric

c# - Cannot get HttpClient working with PCL -

Image
i'm trying hard use httpclient lib in project. i can't figure out what's going on... i tried local urls, examples online, on xamarin.forms pages , nothing. doesn't work , can't figure out doing wrong here. this code: (taken here, btw: https://github.com/conceptdev/xamarin-forms-samples/blob/master/httpclient/httpclientdemo/earthquake/geonameswebservice.cs ) the second breakpoint never hit. this references section: i tried manually inserting system.net.http saw in examples, doesn't work: any ideas? edit to add more information. if use local server , set breakpoint there, never hit well. looks request never "leaves" application. , think related not being able add system.net.http . don't know... it's stressing me out... waiting resolve: fiddler: # result protocol host url body caching content-type process comments custom 3675 200 http api.geonames.org /earthquakesjson?north=44.1&

MySQL insert trigger only for new rows -

i want trigger in mysql inserts information of table in table b if it´s new entry. my trigger inserts entrys of table table b if new entry in table made: create trigger trigger_insert after insert on tablea each row begin insert `tableb` ( `id`, `active`, `created_at`, `updated_at` ) select `id`, `active`, `created_at`, now() tablea; end; my problem is, have second trigger inserts entrys of tablea after update. can´t make id unique. result should tableb kind of history insert , update statements in tablea would thankfull help! your problem select rows tablea . assume intend: insert `tableb`(`id`, `active`, `created_at`, `updated_at`) select new.id, new.active, new.created_at, mnw() the more general answer question add unique constraint on tableb . assuming id defines duplicate entry: alter table tableb add constaint unq_tableb_id unique (id); then c

c# - Exception on loading main window XamlParseException on startup -

getting , exception thrown: 'system.windows.markup.xamlparseexception' in presentationframework.dll additional information 'the invocation of constructor on type 'wpf.controller' matches specified binding constraints threw exception.' where wpf.controller controller class.... so, i've re-targeted wpf app dll, , have environmental wpf applications using xaml dll core ui. (minor changes wpf.exe deployment). this error isn't happening wpf.exe projects... (3 of 5 running without issue - code same, outside app.config , properties have deployment differences. when re-targeted wpf.exe wpf.dll, didn't change it's name, wpf.dll , wpf.exe project clashed. once renamed dll else, worked. error made sense, gotcha.

tsql - Concate Primary Keys in SQL -

i want concate primary keys of multiple tables in sql directly. used below query concate 3 primary keys hyphen between them sql skipped hyphen , sum primary keys , result in single value. select cid + '-' + rid + '-'+ cgid [idcombination] ... where cid , rid , cgid primary keys of 3 sql tables. how skipped string part in query ? any highly appreciated. updated for example : values of cid , rid , cgid 3 , 4, 3 respectively. should 3-4-3 result 10. what happening? remember + means both addition , string concatenation. happens - can interpreted number (like -0 ), sql server prefers interpret + addition. normally, when type of operation, separation character cannot interpreted number, , error. amused don't error in case. one method explicitly cast values strings: select cast(cid varchar(255)) + '-' + cast(rid + varchar(255)) '-'+ cast(cgid varchar(255)) [idcombination] in sql server 2012+, can more

objective c - how to add row line for the tableview in ios -

Image
i want display table details in tableview in form of rows , columns show below. i have implemented uitableview in viewcontroller , , added custom cell , displayed data shown now dont want space between cell .instead need vertical line between cell in image. here code -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { attendencetableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell"]; attendencetableviewcell*cell=[[attendencetableviewcell alloc]init]; if (cell == nil) { cell = [[ attendencetableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"]; } cell.textlabel.textcolor=[uicolor colorwithred:0.24 green:0.67 blue:0.94 alpha:1.0]; _attendencetableview.tablefooterview = [[uiview alloc] initwithframe:cgrectzero]; cell.datelabel.text=@"date"; cell.timeinlabel.text=@"in"; cel

python - cant close last opened file -

hello if have following code: n = len([name name in os.listdir(dir) if os.path.isfile(os.path.join(dir, name))]) in range(0, n): dat_file = r'c1/c10000' + str(i).zfill(2) + '.dat' csv_file = r'c1_conv/c10000' + str(i).zfill(2) + '.csv' in_dat = csv.reader(open(dat_file, 'rb'), delimiter = '\t') out_csv = csv.writer(open(csv_file, 'wb')) out_csv.writerows(in_dat) the problem have is, last file stays opened. tried close in_dat.close()...., have read not possible because parser. i have read 'with' function, don't know how put in. show me proper code, please? thanks :d you need track opened file in separate variable, , close after finishing write operation. better convention use with open(fname) syntax, close file you. you may consult following code snippet understand things in better way: with open(infile, 'w') datfile, open(outfile, 'w') csvfile: do_som

magento2.0.2 - Why I can't see magento connect and magento connect manager in admin page? -

Image
i finished install magento 2.1 version latest currently,and want install theme (template) magento.but cannot see magento connect , magento connect manager install template.i searching on google , youtube these old version magento.its not same features. see image : new in magento.help me out please.thanks. magento connect , connect manager used install extension in magneto 1. but in magento 2, extensions can installed system -> web setup wizard. here nice tutorial out. you can enable extension in magento 2 through cmd prompt following below steps : step 1: download/purchase extension step 2: unzip file in temporary directory step 3: upload magento installation root directory step 4: disable cache under system­ >> cache management step 5: enter following @ command line, root folder of magento installation: php ­-f bin/magento setup:upgrade

p4v - How to ignore all target folders while reconciling in perforce? -

i want ignore target folders while reconciling offline work in perforce. have tried adding in .p4ignore file following statements- target **\target**.* target**.* and few other combinations none of them seems working. what should in order ignore target folders , contents? according command reference ( https://www.perforce.com/perforce/r15.2/manuals/cmdref/p4ignore.html ) syntax want is: target/ example: c:\test\local\dvcs>cat p4ignore.txt target/ c:\test\local\dvcs>p4 reconcile -n foo/... foo/... - no file(s) reconcile. c:\test\local\dvcs>p4 reconcile -n -i foo/... //stream/main/foo/target/bar#1 - opened add

macros - Kentico8 - New boolean field in existing page type, default value not set -

on our website want add "print" button on pages. goal add boolean field page type let's choose if want button on page or not. this works fine little code in ' visible ' checkbox of webpart containing print button: {% currentdocument["printbutton"]#%} my problem this: pages of type that exist automatically print button, tho field default value set 'no' if check pages in 'pages' application, checkbox unchecked. when save , submit pages again, print button gone. but, might guess, don't want resubmit hundreds of pages... it looks pages exist have no value in new boolean field, , therefor automatically resolve visible. anyone clue how solve this? when added field should have marked field required , set default value true. default have set fields true. next, if don't want have default value of true, go in , set false, subsequent pages added false default unless checks true. another way set these run simpl

html - How to get direction between two dropped markers using Google API and JavaScript -

i trying path between 2 dropped markers user , did before using 2 input fields trying direction between 2 dropped markers user. 2 markers dropped randomly user <div style="margin-bottom: 10px;"> <label>location a: </label> <label id="start" ></label> </div> <div style="margin-bottom: 10px;"> <label>location b :</label> <label id="end" ></label> </div> <div style="margin-bottom: 10px;"> <button onclick="javascript:calculateroute()" type="button" style="width: 150px">calculate distance</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label style="color: red; font-weight: bold" id="lbldistance"></label> </div>

How to programatically disable options in ui-select angularjs -

i have 2 ui-select in view. want disable values in second ui-select respect first. means when change values first, of values in second related selected item in first, disabled. if database-driven, there field relates data able dynamically check values (e.g., types > subtypes)? if so, can use ng-if="" selectively load select items. you need sort of relationship between values able programmatically (dynamically) perform task. otherwise, you'd have manually it.

teamcity - How to add an icon to a nuget package? -

we hosting our own nuget server through teamcity. there other way add icon .nuspec file other specifying web url ( http://... .)? or there place in teamcity these icons hosted? no, option using iconurl property - see nuspec reference i choose host shared images on cdn service rather teamcity - cloudflare provide free service.

ajax - file_get_contents (“php://input”) returning one long string -

i tryng send json on ajax php $_post has nothing , file_get_contents(“php://input”) returns 1 long string. ajax code: function senddata(userdata) { alert(userdata); $.ajax({ type: 'post', url: 'testlogin.php', datatype : 'json', data: userdata, success: function (msg) { if (msg.error) { alert("error:" + msg.msg); showerror(msg.msg); } else { // send redirection page alert("do here"); } }, error : function (xmlhttprequest, textstatus, errorthrown) { alert("ajaxerror:::" + textstatus + ":::" + errorthrown); } }); } the alert before ajax shows {"username":"user","password":"long hash here","op":"login"} php code: $user = $_post('username'); $pass = $_post["pass"]; $logstring = "user: ".$use

hibernate - How do I use DISTINCT ON in queryDSL with booleanBuilder parameter? -

in spring data jpa have created filtered search booleanbuilder . queries in project either @query or querydsl . i'm having hard time formulating query when i'm faced distinct on , dynamic filters. i'm having hard time constructing equivalent of in querydsl. select distinct on (name) * foo_table <my filtered booleanbuilder> order name, version_number desc; is possible? alternative or appreciated. thanks! distinct on postgresql vendor-specific sql clause. cannot use jpa (except native queries). use sql directly.

android - Firebase notification onMessageReceived show the same notification as when app in background -

i sending messages app console , managed have app react want, when in background. there notification shown sdk , when user taps , app starts, have custom data fields use build dialog message. since want app react when on foreground i've added service , i've noticed remotemessage contains getnotification() method returns remotemessage.notification suppose used sdk show notification when app in background. is there easy way use retrieved notification , display it, when app in background? there sure is. override firebasemessagingservice.onmessagereceived , notification body in example firebase cloud messaging documentation: @override public void onmessagereceived(remotemessage remotemessage) { // todo(developer): handle fcm messages here. // if application in foreground handle both data , notification messages here. // if intend on generating own notifications result of received fcm // message, here should initiated. see sendnotification meth

c++ - Invalid conversion from int to wchar_t -

this file code. file1.cpp void cime::addexceptkey(wchar_t key) { m_exceptkey.push_back(key); } file2.cpp pyobject *imeaddexceptkey(pyobject *poself, pyobject *poargs) { int key; if(!pytuple_getinteger(poargs, 0, &key)) { return py_buildexception(); } cpythonime::instance().addexceptkey(key); return py_buildnone(); } and warning: warning c4242: 'argument': conversion 'int' 'wchar_t', possible loss of data and warning on line : cpythonime::instance().addexceptkey(key); what wrong ? tried wchar_t key no chance. the size of int may 2 or 4 bytes depending on implementation , size of wchar_t varies between 2,3 or 4 bytes of data. warning there may loss of data. have debug , see if there loss.

java - Finding min and max point in a series -

i got series this: 20 22 25 27 30 31 30 25 22 19 21 25 28 30 28 27... as numbers reach near 30, start moving negatively, , reach near 20, start moving positively. i need find these 2 points using sort of algo. i'm totally lost. i can't sort because 31 max , 19 min. in real implementation, numbers can change, , can float well, instead of int. can this: 55.20 57.35 54.30 59.25 61.00 58.20 55.40 53.50 58.75 60.10 55.15 53.40 50.00 51.10 52.00 in case 53 , 60 points, , additionally, third lower point 50.00. how go ahead on this? import java.util.list; import java.util.arraylist; public class getextrema { public static <t extends comparable<t>> list<t> getextrema(t[] series) { list<t> extrema = new arraylist<t>(); extrema.add(series[0]); boolean upelsedown = series[1].compareto(series[0]) > 0; (int = 2; < series.length; ++i) { if (series[i].compareto(series[i-1]) > 0 != upelsedown) {

Vim LaTeX \begin autocomplete -

i writing mathematical paper using latex , pretty content vim, however, thing miss texmaker automatically generated \begin{}\end{} blocks. wondering how might implement such functionality using inoremap command in same way texmaker, after you, example, type \begin extends \begin{<env>} \end{<env>} , places cursor between braces , after replace <env> environment replaces both in \begin{} , in end{} command. i s possible vim script? this command take word under cursor , make block wanted :noremap \b cw\begin{<c-r>"}<cr>\end{<c-r>"} keep cursor @ start of word , press \b in normal mode desired output.

ibm midrange - How to get list of used UDTF's in SQLRPGLE -

i'm trying list of udtf's used in given sqlrpgle program. not find article/post on getting kind of information. appreciated. thanks i hoping there's in sysroutinedep ...but doesn't appear case. you try sysprogramstmtstat select * sysprogramstmtstat statement_text '%my_udtf%'; but that's not better searching source code (assuming have source). also not above find static use of udtf. if you're building dynamic statement uses udtf, won't shown.

Using VBA to hide rows in Excel if a Value returns 0 -

i'm trying create automated proposal document, , when value returns 0 in spreadsheet, want hide bunch of extraneous rows/graphics in rows reduce clutter , make clean pdf send out. private sub worksheet_change(byval target range) if .range("f15").value = "0" rows("7:25").entirerow.hidden = true elseif range("f15").value rows("7:25").entirerow.hidden = false end if end sub where should go here? if f15 returns value greater 0, wish rows shown. try this, holp works private sub worksheet_change(byval target range) if .range("f15").value = "0" rows("7:25").entirerow.hidden = true else rows("7:25").entirerow.hidden = false end if end sub

javascript - how to insert text(<textarea> to <p>) with js -

how can inject text textarea p element, using javascript? i have got far code see below. <button id="btn" onclick="show()">click</button> <textarea placeholder="text..." id="textarea"></textarea> <p id="sp"></p> <script> function show() { var textarea = document.getelementbyid("textarea"); var p = document.getelementbyid("sp"); var text = document.createtextnode(textarea.innerhtml); p.appendchild(text);//insert textarea } </script> var text = document.createtextnode(textarea.innerhtml); the innerhtml of element represents child nodes inside it. textarea set default value. to current value need read value property instead.

Using a buildroot distro as a docker *host* -

Image
i have arm based board can run specific buildroot based distro provided manufacturer. try run docker on board. any time combine buildroot , docker in google search, wind getting pages explain how use buildroot create container, not how alter buildroot use host. can point me documentation? the keyword you're missing "engine". it's docker engine allows host os support docker containers. there's submitted 3-part patch add docker engine support buildroot. [buildroot] [patch v6 0/3] add docker engine support series adds runc, docker-containerd, , docker-engine support. patch 1 adds runc, new minimal cli running linux containers. patch 2 adds docker-containerd, daemon , api runc. patch 3 adds docker-engine, cli , api docker application engine.

ios - How to lower brightness with UISlider so that it is lower than the lowest brightness setting available to the user? -

i making clock application designed used display time @ night. want find way make brightness lower user can make it, such done in app ( https://itunes.apple.com/us/app/night-clock/id293660080?mt=8 ). have tried uiscreen.mainscreen().brightness = cgfloat(0), goes dark user can make it. help? just dim contents displayed app. instead of adjusting colors can same effect adding overlay view. set backgroundcolor of view black alpha 0.5 , , play alpha value.

datetime - Android: Getting date using day of the year number -

how can create date integer representing day of year? you can set day of year in calendar object, can date object it: calendar cal = calendar.getinstance();// make sure it's right year cal.set(calendar.day_of_year, dayofyear); date date = cal.gettime();

debugging - What code executes to halt a program at a breakpoint within a debugger? -

trying understand behind covers of breakpoint. what kind of code executes halt execution? most ides provide nice front end doesn't explain much. i using gdb , eclipse-cdt, standard across debugging environments ide. it specific platform, specific processor. it ranges anywhere debugger replaces instruction(s) in question causes fault or event debugger can trap, to, hardware/chip support looks address fetch , generates event debugger catch, stops execution. the front end of gdb doesnt know nor care how works. when port end system, not depends on processor how connected. via jtag, via rom monitor, etc, each specific jtag solution may need different backend. software (gdb, etc) makes generic want break point @ address function call, , backend target can try implement best can or return fail cant whatever reason. so have dig specific processor , possibly system , connection system more details. broad single answer.

java - Inject @AuthenticationPrincipal when unit testing a Spring REST controller -

i having trouble trying test rest endpoint receives userdetails parameter annotated @authenticationprincipal . seems user instance created in test scenario not being used, attempt instantiate using default constructor made instead: org.springframework.beans.beaninstantiationexception: failed instantiate [com.andrucz.app.appuserdetails]: no default constructor found; rest endpoint: @restcontroller @requestmapping("/api/items") class itemendpoint { @autowired private itemservice itemservice; @requestmapping(path = "/{id}", method = requestmethod.get, produces = mediatype.application_json_utf8_value) public callable<itemdto> getitembyid(@pathvariable("id") string id, @authenticationprincipal appuserdetails userdetails) { return () -> { item item = itemservice.getitembyid(id).orelsethrow(() -> new resourcenotfoundexception(id)); ... }; }

ios8 - Can iPhone 6S run iOS 8? -

my app supports ios 8 9. user told me app keeps freezing on iphone 6s running ios 8. seen apple's spec, 6s supports ios 9 , xcode not have iphone 6s ios 8 simulator. officially, can ios 8 run on iphone 6s? it can't, user owns iphone 6 or 6 plus.

Python: Certain unicode characters do not display correctly -

i trying set label of gui-element display greek letter python. str(u'\u0054'.encode('utf8')) correctly produce unicode character 't', unicode number 0054. writing str(u'\u03b6'.encode('utf8')) not display greek letter small zeta this thing instead. i tried writing str(u'\uceb6'.encode('utf8')) (ceb6 utf-8 encoding of character want), got similar, strange looking character wasn't greek letter zeta. according this site character available in common fonts. might gui-toolkit uses strange font? using fox toolkit. any appreciated. edit: trying create text label fxlabel(parent, string) supply string str(u'\u03b6'.encode('utf8')) . , mentioned, supplying string unicode number of capital t produce expected label. your output encoding wrong. make sure terminal correctly configured utf-8 output. if interpret (rather muddy) image correctly, ce b6 being displayed Î‎¶‎ consistent 1 of numb

javascript - How to use SetState to get data after submit some information in a form? -

import react 'react' export default class form extends react.component{ /// handle submit handlesubmit(e){ e.preventdefault(); } /// handle patientname handlepatientname(e) { this.setstate({ patientname: e.target.value }) } // handle patient disease handlepatientdisease(e){ this.setstate({ patientdisease: e.target.value }) } // handle patient present illness handlepatientpresentillness(e){ this.setstate({ patientpresentillness: e.target.value }) } render () { return ( <form> <ul> <li> <label> patient name</label> <input type="text" name="patientname" placeholder="nome paciente" onchange={this.handlepatientname} /> </li> <li> <label> patient disease <input type="text" name="patientdisease" placeholder="disease"/>

java - context is null in custom view -

i'm working on custom view extends horizontalscrollview , i'm doing following code: public bottomnavigation(context context) { super(context, null, 0); } public bottomnavigation(context context, attributeset attrs) { super(context, attrs, 0); } public bottomnavigation(context context, attributeset attrs, int defstyleattr) { super(context, attrs, defstyleattr); this.context = context; } @override protected void onsizechanged(int w, int h, int oldw, int oldh) { super.onsizechanged(w, h, oldw, oldh); createitems(); } public void createitems() { if (items < 4) { return; } height = getheight(); width = getwidth(); paddingtop = height / 7; itemsheight = height - paddingtop; itemswidth = width / 4; requestlayout(); views.clear(); removeallviews(); linearlayout linearlayout = new linearlayout(context); linearlayout.setorientation(linearlayout.horizontal); linearlayout.layoutparams layoutpa

html - Textbox size reduces/shrinks on focus -

on focus size of textbox seems reduced/shrinked. but, if border-width set 2px such reduction can't observed. want set border-width 1px without such reduction effect. how can done? #name:focus{ outline:none; border:1px solid rgba(81, 203, 238, 1); box-shadow:0 0 5px rgba(81, 203, 238, 1); } #name2:focus{ outline:none; border:2px solid rgba(81, 203, 238, 1); box-shadow:0 0 5px rgba(81, 203, 238, 1); } <!doctype html> <html> <head> </head> <body> border-width changes 1px on focus<br> <input type="text" id='name'><p> border-width changes 2px on focus<br> <input type="text" id='name2'><p> default textbox no effects added<br> <input type="text" id='check'> </body> </html> you have multiple approaches here. example set default border-width 1px( #name2 ) or increase padding

java - What are standard rgb colors for SWT progress Bar -

what standard rgb colors eclipse swt progress bar every state: swt.normal swt.error swt.paused unfortunately, can not find anywhere , don't want use color picker paint or photoshop. the progress bar drawn native control , looks substantially different (and has different colors) on each platform. there isn't simple way these colors.

php - Laravel SQL missing data from Join table -

i'm using following code create query join. $query = rs_vehicles::select( 'rs_vehicles.id', 'rs_vehicles.type', 'rs_vehicles.make', 'rs_vehicles.model', 'rs_vehicles.year', 'rs_vehicles.status', 'rs_vehicle_regs.registration' ); $query ->leftjoin('rs_vehicle_regs', function($join){ $join->on('rs_vehicle_regs.rs_vehicles_id', '=', 'rs_vehicles.id') ->where('rs_vehicle_regs.registration_date', '=', db::raw("(select max(registration_date) rs_vehicle_regs rs_vehicles_id = rs_vehicles.id)")); }); $rsgr

SQL Server database design for high volume stock market price data -

i writing application store , retrieve stock market price data data inserted on daily basis. storing data each asset (stock) , of market in world. current design of tables country table: create table [dbo].[list_country] ( [countryid] [char](2) not null, [name] [nvarchar](100) not null, [currenycode] [nvarchar](5) null, [currencyname] [nvarchar](50) null constraint [pk_dbo.list_country] primary key clustered ([countryid] asc) ) asset table: create table [dbo].[list_asset] ( [assetid] [int] identity(1,1) not null, [name] [nvarchar](max) not null, [countryid] [char](2) not null, constraint [pk_dbo.list_asset] primary key clustered ([assetid] asc) ) foreign key constraint on country : alter table [dbo].[list_asset] check add constraint [fk_dbo.list_asset_dbo.list_country_countryid] foreign key([countryid]) references [dbo].[list_country] ([countryid]) on delete cascade go stock_price table: cre

hadoop - What should be flume.conf parametres for save tweets to single FlumeData file per hour? -

we saving tweets in directory order /user/flume/2016/06/28/13/flumedata... .but each hour creates more 100 flumedata file.i have changed twitteragent.sinks.hdfs.hdfs.rollsize = 52428800 (50 mb) same thing happened again.after tried changing rollcount parametre didnt work.how can set parametres 1 flumedata file per hour. twitteragent.sinks.hdfs.channel = memchannel twitteragent.sinks.hdfs.type = hdfs twitteragent.sinks.hdfs.hdfs.path = hdfs://hpc01:8020/user/flume/tweets/%y/%m/%d/%h twitteragent.sinks.hdfs.hdfs.filetype = datastream twitteragent.sinks.hdfs.hdfs.writeformat = text twitteragent.sinks.hdfs.hdfs.batchsize = 1 twitteragent.sinks.hdfs.hdfs.rollsize = 0 twitteragent.sinks.hdfs.hdfs.rollcount = 10 twitteragent.sinks.hdfs.hdfs.rollintinterval = 0 twitteragent.channels.memchannel.type = memory twitteragent.channels.memchannel.capacity = 10000 twitteragent.channels.memchannel.transactioncapacity = 1000

Java code to find Upper and Lower number of each element in an array -

i have array [22,30,32,36,40] i want find nearest lower , upper value each element. ex. 22 , lower value 22 ani upper value 30. 30 , lower value 22 , upper 32. 32 ,lower value 30 , upper value 36. 36, lower 32 , upper 40.and last element 40 ,lower value 36 , upper 40. array becomes [ 22-30,22-32,30-36,32-40,36-40] put items treemap . loop on items in original array , each of them lowerkey() in treemap predecessor , higherkey() successor. if either of them null mean it's lowest/highest , have take current element itself.

functional programming - Pattern matching on two records with the same fields -

say have record: type alias rec = { : int } and, example, function takes 2 of these , sums integers. f: rec -> rec -> int this can implemented using record accessors (i.e. f x y = x.a + y.a ), there way use pattern matching extract both integers? obviously, these 2 not work because binding 2 different numbers same variable: f {a} {a} = + f x y = case (x, y) of ({a}, {a}) -> + there's no way currently. there pattern aliasing ( as ) works whole pattern, invalid: type alias rec = { : int } f: rec -> rec -> int f { xa } { ya } = xa + ya main = f { = 1 } { = 2 } results in: detected errors in 1 module. -- syntax problem -------------------------------------------------------------- ran unexpected when parsing code! 4| f { xa } { ya } = xa + ya ^ looking 1 of following things: closing bracket '}' whitespace

c# - Byte array getting corrupted when passed to another method -

i have bunch of jpg images in byte array form. want add these zip file, turn zip file byte array, , pass somewhere else. in method, have code: var response = //some response object hold byte array using (var ms = new memorystream()) { using (var ziparchive = new ziparchive(ms, ziparchivemode.create, true)) { var = 1; foreach (var image in images) // collection holds byte arrays. { var entry = ziparchive.createentry(i + ".jpg"); using (var entrystream = entry.open()) using (var compressstream = new memorystream(photo.imageoriginal)) { compressstream.copyto(entrystream); } i++; } response.zipfile = ms.toarray(); } using (var fs = new filestream(@"c:\users\myname\desktop\image.zip", filemode.create)) { ms.position = 0;

android - Fail to connect to camera service cause null -

using twilio , when receiving call front camera fail load. note : works fine when calling. error message : unable open camera camera 1, facing front, orientation 270:fail connect camera service cause null code cameracapturer= cameracapturerfactory.createcameracapturer(this, cameracapturer.camerasource.camera_source_front_camera, capturererrorlistener()) /* * cameracapture error listener */ public capturererrorlistener capturererrorlistener() { return new capturererrorlistener() { @override public void onerror(capturerexception e) { log.e(tag, "camera capturer error: " + e.getmessage()+" cause "+e.getcause()); } }; }

git - List all commits since last release when the tag points to a commit on other branch -

i need list commits made master branch since last release. have implement functionality using pygit2 . situation bit different here. the release made on master branch using tag on commit other branch. naive approach find sha of last tagged commit , move down history head till sha . tagged commit not made master branch in case, made other branch. interestingly, following gives correct output when run on master branch: $ git log sometag..head --oneline here, sometag points commit made on other branch. so, want know how implement programmatically, if have list of commits made on master branch. one solution coming mind find timestamp of tagged commit , filter commit list. how git log doing this, ideas? i think you: first, use repository.walk() walker (commit iterator), , modify ( walker.hide() ) exclude commits reachable sometag : from pygit2 import repository pygit2 import git_sort_time repo = repository('.git') start = repo.revparse_sing

R sweep-equivalent with integer division -

is there way use sweep(dataframe) integer division, or equivalent such? this minimal example of sweep not using integer division - want replace integer division: sweep(x = mtcars, margin = 2, stats = unlist(mtcars[1,]), fun = '/') some limitations need stick to: i need preserve column names of dataframe, done in example above. i cannot use round , floor , ceil , or similar - needs equivalent of integer division ( floor have different effects on negative numbers integer division). if possible, i'd prefer not store information in additional variables during process. i'm dealing relatively large dataframe, turn out slow solutions might not option here. does know way of achieving in r? pass '%/%' function, integer division. see arithmetic operator docs . sweep(x = mtcars, margin = 2, stats = unlist(mtcars[1,]), fun = '%/%')

excel - Write an SQL query selecting data from filtered Date columns -

Image
i trying query crosstab table/recordset in access (tried ado on excel sheet), columns having dates in them e.g. if want pull limited data having columns year 2014, how write such query? please note, these columns may vary. something this, there may simpler method though sub akward_query() dim strsql string dim strsql2 string dim rst adodb.recordset dim fld adodb.field dim intyear integer intyear = 2014 strsql = "select top 1 * tbl_test" set rst = new adodb.recordset rst.open strsql, currentproject.connection, 1 strsql2 = "select " each fld in rst.fields if instr(1, fld.name, "week ending") > 0 , instr(1, fld.name, intyear)>0 strsql2 = strsql2 & "[" & fld.name & "]," end if next fld if right(strsql2, 1) = "," strsql2 = left(strsql2, len(strsql2) - 1) strsql2 = strsql2 & " tbl_test" end sub

php - Having issues saving the dynamic state of a checkbox (Javascript, jQuery) -

i'm trying make form allows proceed webpage if checkbox has been checked, , prompts alert otherwise. my issue checkbox won't save state dynamically. result, have refresh page everytime check checkbox in order proceed next webpage. there need add code? i've attached javascript function, php page changes state in sql, line call function itself. javascript function: //this function handles clicking of checkboxes in list //it sends ajax post message separate php file handles database updating function checkboxclicked(checkboxtype, ticketnumber){ $.ajax({ type: "post", url: 'updatecheckbox.php', datatype: 'json', data: {checkboxtype: checkboxtype, ticketnumber: ticketnumber}, success: function(result, status){ if (status != "success"){ console.log("status: " + statu

javascript - What is the length of an array after both pushing to it, and assigning key-value pairs like an object -

this example : var myarray = [] myarray.push('a string') console.log(myarray.length) // got: 1 myarray['arandomkey']='an other string' console.log(myarray.length) // got: 1 so second element not added array length have not changed. when log array : console.log(myarray) // got: ["a string", arandomkey: "an other string"] i see myarray has 2 elements ... what's going on ? jsfiddle demo var myarray = [] myarray.push('a string') console.log(myarray.length) // got: 1 myarray['arandomkey']='an other string' console.log(myarray.length) // got: 1 few more things myarray[1] = "2nd string"; console.log(myarray.length);// you'll 2 console.log(myarray.arandomkey); // other string console.log(myarray["arandomkey"]); // other string console.log(myarray) // ["a string", "2nd string", arandomkey: "an other string"] by looking @ above statements, if

delphi - SharePoint ClientContext.ExecuteQuery works in c# application but crashes in DLL -

Image
i have written c# code search specific file types in sharepoint lists within site , display file names in listview. code works in c# windows application, when compiled c# dll , called delphi2007 application crashes when hits first call clientcontext.executequery(). there no exception or error message - delphi application stops running. the weird part delphi test application has web browser component, , if use navigate top level list on site dll works ok. the question therefore why first executequery call fail in dll if haven't logged on site first? this c# code: public void listfiles() { string lcontains = "<contains><fieldref name='fileleafref'/> <value type ='text'>{0}</value></contains>"; string lnotequal = "<contains><fieldref name='fileleafref'/><value type ='text'>{0}</value></contains>"; string lwher