Posts

Showing posts from May, 2015

reactjs - What's the cleanest way to get my react web app using push notifications on iOS? -

doing rapid prototyping app running in browser , on ios/android/etc. @ point may have build native versions, not necessary @ moment. we need native push notifications working @ least on ios (which isn't supported browser, may getting worked on future release supports progressive web apps). looking cleanest solution issue still allows keep our single code base , won't bloat our working environment. from cursory investigation looks reactnative require device specific branching. may fine down road, wait until through of our initial prototyping. is phonegap/cordova way go? speed on device isn't big issue keeping our code base clean can move fact it's in webview doesn't matter much. haven't touched phonegap in ages, can isolate code base cleanly wrapper? another option thinking of writing lightweight ios wrapper webview , basic bindings handle push notification aspect. not sure if tricky though, , may have hidden pitfalls. would love recommendations c

switch off html wrapping of errors in nginx -

i use nginx on ubuntu forward requests spring boot -driven api server. api returns body 4xx , 5xx errors, client application consumes. e.g. in api code might return: { "message": "blah" } however nginx seems wrap errors html , embeds response within them. there way disable behavior? , there way en masse (i.e. 4xx , 5xx errors, without explicitly writing them out error_page example) similar question , accepted answer here , seems bit of hack. i'm sure there's better way of doing this... edit: config looks this: server { listen 80; server_name my.domain.com; location / { proxy_pass http://127.0.0.1:9001; } } you need add error_page directive inside location server { listen 80; server_name my.domain.com; location / { error_page 404 = 404; proxy_pass http://127.0.0.1:9001; } } what cancel error_page previous directives set @ http block. , pass result client is.

How to create a pointer in Swift? -

i'm working swift 3. i have c syntax : int myvar; int *pointer = &myvar; so modifying pointer or myvar same exact same thing. don't know if makes difference, in case myvar array containing elements of class , pointer pointer 1 element of array. (assuming understand you're asking for....) try following code in playground. should print "99" 3 times. class row { var rownumber = 0 } var rows = [row]() let testrow = row() testrow.rownumber = 1 rows.append(testrow) let selectedrow = rows[0] selectedrow.rownumber = 99 print(testrow.rownumber) print(selectedrow.rownumber) print(rows[0].rownumber) by default, there's no copying of objects part of assignment statement. if struct, different. adding bit completeness: if want similar effect scalar values instead of objects, swift supplies various types of wrappers. let intpointer = unsafemutablepointer<int>.allocate(capacity: 8) // should 1, not 8 according comment

c# - How can I check if all the rows in DataGridView is not null? -

i had problem quite while. what planned if of cell[0] has value, trigger event. if there null , it'll change value of textbox . here's code: private void button1_click(object sender, eventargs e) { (int = 0; < datagridview1.rows.count; i++) { if (datagridview1.rows[i].cells[0].value.tostring() == null) { textbox.text = "null"; break; } else { messagebox.show("no null"); } } but whats happening here example have 3 rows in datagridview , if first row not null lunch messagebox . want messagebox triggered when of row's cells not null. try this: bool anynull = false; (int = 0; i<datagridview1.rows.count; i++) { if (datagridview1.rows[i].cells[0].value.tostring() == null) { textbox.text = "null"; anynull = true; break; } } if (!anynull) messagebox.show("");

apache - 2 rewrite rules not working together -

i have rewrite rule product detail page instead of url being /product-detail.php?id=3765 it instead: /blue-jeans this rewrite rule: rewriterule ^([0-9a-za-z-]+)$ product-detail.php?slug=$1 [nc,l] however, need 1 regional dealers. add .htaccess, product detail rule stops working in blank page displayed when navigating product. how can them both work? rewriterule ^([0-9a-za-z-]+)$ dealers.php?slug=$1 [nc,l] it's because matching regex identical, , first 1 of them matches , you're done. need wrapping php script can sort out or have other token in regex limit scope. example products under /products , dealers under /dealers, , like: rewriterule ^/dealers/([0-9a-za-z-]+)$ /dealers.php?slug=$1 [nc,l] rewriterule ^/products/([0-9a-za-z-]+)$ /products.php?slug=$1 [nc,l]

python - Scraping Multiple Pages On A Website -

i'm trying scrape list of coaching instiututes on thsi url: https://www.sulekha.com/entrance-exam-coaching/delhi the following python code: import bs4 urllib.request import urlopen ureq bs4 import beautifulsoup soup my_url = 'https://www.sulekha.com/entrance-exam-coaching/delhi' uclient = ureq(my_url) page_html = uclient.read() uclient.close() x page_soup = soup(page_html, "lxml") insti = page_soup.findall("div", {"class": "list-title"}) filename = "entrance_institutes.csv" f = open(filename, "w") headers = "institute \n" f.write(headers) ins in insti: ins_name = ins.div.a["title"] f.write(ins_name + "\n") f.close() this code runs fine. attached image of csv generates. how should go scraping listings 1 page after other ? thanks output csv i'm not 100% sure mean. if you're asking how fix bug in code need change loop to: for ins in insti:

html - How to find .css file location according to class name(under div tag) in notepad++ -

.html <ul class="post-categories"> <li> <a href="category/fruits-fresh/index.html" rel="category tag">fruitfresh</a> </li> </ul> i want find css file include "post-categories" class inside folder structure. had waste time this.is there simple way find this. do following steps press ctrl+f open find , replace tool. open find in files tab . fill in find what: field , select directory search (folder site files, template package, theme folder, etc.) click find all check referemce

azure - Creating load balancer diagnostic log rule does not generate logs -

we have single load balancer load balancing 2 vm's, , we're trying pull loadbalancerprobehealthstatus logs it, hoping figure out things how load balancer redirecting traffic. i've created diagnostic setting rule specifies: archive storage account: (storage account name) enable loadbalanceralertevent, retention 0 (forever) enable loadbalancerprobehealthstatus, retention 0 (forever) and i've saved rule. i'm expecting kind of log container show in storage account specified, it's been whole day, , nothing has shown up. i'm not sure expect, should have shown now, or have missed configuration somewhere that's necessary enable load balancer logs? these logs event logs , occur when status changes , available public load balancer resources ( https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-monitor-log ). if not see logs when have instances signal probe failures, please reach out support investigate further.

django - Adding a button to Wagtail Dashboard -

Image
is possible add additional button( buttons ) on top panel shown in picture? i did't find in google , here. it not clear on screenshot whether use modeladmin or snippet s expose model user i'll assume former. i don't know hook allows add buttons directly header, template uses blocks should allow overwrite part. we can take advantage of resolution order of templates , create /modeladmin/app-name/model-name/index.html take precedence on /modeladmin/index.html . given app called feedler , model called entry , create /modeladmin/feedler/entry/index.html following content: {% extends "modeladmin/index.html %} {% block header_extra %} <a href="#">my new button</a> {{ block.super }}{% comment %}display original buttons {% endcomment %} {% endblock %} right button doesn't much. create action interact model admin, you'll need create button/url/permission helpers , view. let's action exporting objects cs

node.js - Sequelize and peer authentication for Postgres? -

my postgres database has been set use peer authentication , not sure how tell sequelize use method? currently using following: new sequelize("postgres://127.0.0.1/dbname", {}); i tried following did not work new sequelize("postgresql:///dbname?host=/var/lib/postgresql"); in both cases error: sequelizebaseerror: password authentication failed user" can help? a bit more exploration shows following job: new sequelize('mydb', undefined, undefined, { host: '/var/run/postgresql' dialect: 'postgres' }); the actual connection handled package 'pg' , documented in issue . note, have tested work pg@6.4.1 , sequelize@4.4.2.

You may need an appropriate loader to handle this file type babel and webpack -

so file structure pretty straight forward. ~ /dist /node_modules /src .babelrc index.js package.json webpack.config.js what trying accomplish trying run command "webpack" have build dist folder compiled code. module.exporting out use it. however, keep running error says may need appropriate loader file type. feel if have of dev devependies need compile. here following webpack.config.js package.json { "name": "test", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"error: no test specified\" && exit 1", "webpack": "webpack" }, "keywords": [], "author": "", "license": "isc", "dependencies": { "babel-preset-stage-1": "^6.24.1", "lodash": "^4.17.4"

r - ggtern + geom_interpolate_tern + expand.formula with unexpected output -

Image
this followup my previous question , so given following data, > foo resp b c 1 1.629 0.3333333 0.3333333 0.3333333 2 1.734 0.1666667 0.6666667 0.1666667 3 1.957 0.0000000 1.0000000 0.0000000 4 1.778 1.0000000 0.0000000 0.0000000 5 1.682 0.6666667 0.1666667 0.1666667 6 1.407 0.1666667 0.1666667 0.6666667 7 1.589 0.0000000 0.5000000 0.5000000 8 1.251 0.0000000 0.0000000 1.0000000 9 1.774 0.5000000 0.5000000 0.0000000 10 1.940 0.5000000 0.0000000 0.5000000 > i trying reproduce chart this article (private access). article claims use special cubic model however, when try use notation value ~ (x + y + z)^3 -1 , get object 'z' not found which assume because z linearly dependent on x , y . when try recreate special cubic model x , y , tried using cubics , quad functions expand.formula , > expand.formula(resp ~ cubics(a,b) + quad(a,b)) resp ~ (a + b)^3 + i(a * b * (a - b)) + (a + b)^2 + i(a^2) + i(b^2)

c# - Display album art in GridGView and show the list of song files each album on click of each album art (GridView item) -

i working on uwp music player , want display each album art music library on launch of application in gridview , on click of each album art list of song files album displayed on new page in uwp c# you should able create album class included observablecollection of song . for example: class album { public string albumname { get; set; } public observablecollection<song> songs { get; set; } } public class song { public string songname { get; set; } public string filepath { get; set; } } you can set album observablecollection can set collection itemssource of gridview . to current selected album , can add gridview.selectionchanged event. in event can use gridview.selectedindex index of album collection. to send album new page, can use navigate(type sourcepagetype, object parameter) method. causes frame load content represented specified page, passing parameter interpreted target of navigation. in new page, should able override onnavig

python - How to find panda3d source directory? -

i'm trying install panda3d keep running errors. says "after placing thirdparty directory inside panda3d source directory, may build panda3d using command following: bash python makepanda/makepanda.py --everything --installer " when run on terminal error python: can't open file 'makepanda/makepandacore.py': [errno 2] no such file or directory i'm not sure "source directory" may problem. put downloaded file panda3d folder. i followed process outlined on github repo macos , worked no problems: 1.download precompiled third party packages macos: wget https://www.panda3d.org/download/panda3d-1.9.4/panda3d-1.9.4-tools-mac.tar.gz 2.clone panda3d's github repo: git clone https://github.com/panda3d/panda3d.git 3.navigate repo root directory: cd panda3d 4.make thirdparty directory under panda/src : mkdir panda/src/thirdparty extract contents of downloaded file thirdparty folder inside of src folder: tar -xvzf ..

java - How can I save UTF-8 strings in an ObjectDB JPA database? -

Image
i'm trying save utf-8 strings in objectdb database following code: resourcebundle entries = utf8classloader.getbundle("localization/language", "fa-ir"); // fa-ir utf-8 , rtl language enumeration<string> keys = entries.getkeys(); (string key = keys.nextelement(); keys.hasmoreelements(); key = keys.nextelement()) { resourceentity entity = new resourceentity(); entity.setid(new resourceentity.pkc(key, locale)); entity.setvalue(entries.getobject(key)); resourcedao.persistorupdate(entity); } the model: @entity public class resourceentity { @embeddedid private pkc id; private object value; // getters , setters omitted @embeddable public static class pkc { string key; string locale; public pkc() {} public pkc(string key, string locale) { this.key = key; this.locale = locale; } // getters , setters omitted } } localization/language_

Telegram inline bot - can it be restricted to one supergroup? -

can telegram inline bot restricted 1 supergroup? in other words, want bot used in 1 supergroup - else. possible? thanks! no, inline mode works in every chat. can allow use inline bot ristrect number of people checking user's id. $inline_user_id = $update[inline_query][from][id]

My website is not loading its images and the CSS file. Looks empty and stuck in index.html -

i built website on dreamweaver , although looks fine locally, online doesn't work. here link it: http://www.migueltoroe.com problems have identified are: no images displayed. css files not loaded. none of internal links work. in fact anytime index.html links within itself, doesn't work. can't off index.html test other pages.

LUIS pre-built entity datetimeV2 does not resolve properly? -

recently (i'd since around 2 weeks ago) luis has been getting of dates wrong us. , indeed: datetimev2's start date seems off month. bug or misunderstanding value? ex: "since august" returns start date of 2017-09-01 instead of 2017-08-01. { "entity": "since august", "type": "builtin.datetimev2.daterange", "startindex": 15, "endindex": 26, "resolution": { "values": [ { "timex": "xxxx-08", "type": "daterange", "start": "2017-09-01" }, { "timex": "xxxx-08", "type": "daterange", "start": "2018-09-01" } ] } } i can confirm issue. since being handled same regex being used handle after reason of

java - How can I get the sum of a column from my JSON Array -

this inside response.listener on stringrequest. try { jsonobject jsonobject = new jsonobject(response); jsonarray array = jsonobject.getjsonarray("cart"); (int = 0; i<array.length(); i++){ jsonobject o = array.getjsonobject(i); cartitem item = new cartitem( o.getstring("cardno"), o.getstring("product_id"), o.getstring("name"), o.getstring("quantity"), o.getstring("price"), o.getstring("category") ); cartitems.add(item); } adapter = new cartadaptor(carti

Fatal error occured while running program in java netbeans only for some videos -

i trying extracting frames video using xuggler media writer working fine low quality videos found error when tried same code high quality videos. run: fatal error has been detected java runtime environment: exception_access_violation (0xc0000005) @ pc=0x000000006ee76520, pid=2624, tid=0x000000000000052c jre version: java(tm) se runtime environment (8.0_131-b11) (build 1.8.0_131- b11) java vm: java hotspot(tm) 64-bit server vm (25.131-b11 mixed mode windows- amd64 compressed oops) problematic frame: c [xuggle4343153701617739894.dll+0x736520] failed write core dump. minidumps not enabled default on client versions of windows error report file more information saved as: c:\users\pc\documents\netbeansprojects\javaapplication2\hs_err_pid2624.log if submit bug report, please visit: http://bugreport.java.com/bugreport/crash.jsp crash happened outside java virtual machine in native code. see problematic frame report bug. c:\users\pc\appdata\local\netbeans\cache\8.2\executor-snippets

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 what's solution basic problem? well, problem variable i , within each of anonymous functions, bound same variable outside of function. what want bind variable within each function separate, unchanging value outside of function: var funcs = []; function createfunc(i) { return function() { console.log("my value: " + i); }; } (var = 0; < 3; i++) { funcs[i] = createfunc(i); } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see }

Reverse a character array using recursion in C -

here's code , can't seem figure out how make function array argument. #include <stdio.h> #include <math.h> #include <stdlib.h> int main(int argc, char *argv[]) { char strarray[30] = "print string backward."; puts(""); stringreverse(strarray); return(0); } void stringreverse(char strarray[]) { if(strarray != "\n") { stringreverse(&strarray) printf("%s", strarray) } } first, need return value. then, algorithm should do? run until final of string , return variable variable in reverse 1 parameter, need pass parameter shorter every loop. like this: #include "stdafx.h" #include "stdio.h" #include "stdlib.h" #include "string.h" void stringreverse(char strarray[], int i) { if (strarray[0] != null) if (strarray[0] != '\0') { int c = 0; char str[30]; while (c < strlen(

hadoop - Why Spark Attempt ID Increase? -

i managing hadoop ecosystem cluster includes hadoop, spark, kafka, nifi , on. recently, attempt id of spark app has been increased.i limited attempt id 10. because attempt id reached limit per 5 days, should re-start spark app. so research reason in configuration of nifi, kafka, spark publishkafka of nifi processor changed roundrobinpartitioner in configuration. not work. problem don't know should focus on. if have similar experience, please give me tip. thank you.

uiviewcontroller - Basic Transitioning Between View Controllers in Swift -

i working implement code move between 2 view controllers, vc1 , vc2. vc1 toggles between 2 skviews, , vc2 displays simple things in uiview. vc1 , vc2 both in main storyboard. vc1 displayed first, @ point in skscene segues vc2: let currentviewcontroller: uiviewcontroller = (self.view?.window?.rootviewcontroller)! currentviewcontroller.performsegue(withidentifier: "vc1tovc2", sender: currentviewcontroller) after short delay in vc2, segues vc1: self.performsegue(withidentifier: "vc2tovc1", sender: self) these segues work. then, same code above (using same segue): let currentviewcontroller: uiviewcontroller = (self.view?.window?.rootviewcontroller)! currentviewcontroller.performsegue(withidentifier: "vc1tovc2", sender: currentviewcontroller) ...the 2nd time not work segue vc1 vc2. there's no exception, vc2 not display. i found other posts don't address issue, example: * swift segue not working? - suggests ui updating has in m

Downloading MP4 files with PHP CURL -

i trying download video 1 of servers of servers. using curl because copy() did not download audio video. however, curl downloaded corrupted files (?) , not. how i'm downloading mp4 file right now: $source = "https://link.com/video.mp4"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $source); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_sslversion,3); $data = curl_exec ($ch); $error = curl_error($ch); curl_close ($ch); $destination = "video/video.mp4"; $file = fopen($destination, "wb"); fwrite($file, $data); fclose($file); is there special mp4 files download properly? array(26) { ["url"]=> string(60) "https://link.com/video.mp4" ["content_type"]=> null ["http_code"]=> int(0) ["header_size"]=> int(0) ["request_size"]=> int(0) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(1) ["redirect_count"]=> int(

c - Free memory before returning -

this question has answer here: using pointer after free() 5 answers suppose have following program #include <stdlib.h> #include <stdio.h> #include <string.h> char *returnsomething() { char *mystring; mystring = malloc(sizeof(char) * 50); strcpy(mystring,"hello"); free(mystring); return mystring; } int main(int argc, char const *argv[]) { char *mystring = returnsomething(); printf("%s",mystring); return 0; } why print "hello" when free'd before returning? thought woudn't print since free'd memory returned string afterwards. assumed had free in main after printing it. is mac compiler being nice? when call free(mystring), memory mystring points being freed, value of mystring stays untouched, making mystring dangling pointer. accessing memory has been freed ca

powershell - How do I create a new user in Windows with a user-data script on AWS? -

i never use windows; bear me here. i'm trying make simple; want create new user, defined password, can use rdp instance on aws. i've put following user-data script (and tried 40 other different ways well) no avail. <powershell> cmd.exe /c net user /add developer myp@ssword1 cmd.exe /c net localgroup administrators developer /add cmd.exe /c net localgroup "remote desktop users" developer /add </powershell> my end-goal here want use provision ami packer, believe working - can never login aws' means of "get windows password" never resolves. any solution me past step extremely helpful. solution wrap in <script></script> instead while dropping cmd.exe ; , looks if adding rdp group not necessary. <script> net user /add developer myp@ssword1 net localgroup administrators developer /add </script>

amazon web services - AWS S3 Put not getting picked up by Lambda -

i have lambda job detecting s3 put bucket , moving bucket b. have lambda job detects s3 put bucket b , actions file. for reason, automatic put bucket b bucket lambda job not getting triggered. if upload manually bucket b, lambda job triggered. it exact same code, , presumably same action of s3 put, , have no idea why may happening. do guys have inputs? thank you! it exact same code, , presumably same action of s3 put nope. there 5 different events, representing 4 different ways create object, , wildcard. s3:objectcreated:put s3:objectcreated:post s3:objectcreated:copy s3:objectcreated:completemultipartupload s3:objectcreated:* you want last one, unless deliberately want restrict actions fire events... sounds tied event first one. "moving" object 1 bucket done copy operation... not always. go wildcard unless have specific reason not to. http://docs.aws.amazon.com/amazons3/latest/dev/notificationhowto.html#notification-how-to-event-types-and

facebook - I cannot collect data response.location.name in FB.api -

"function checkloginstate if (response.status === 'connected') { fb.api('/me', 'get',{"fields":"id,name,email,location"}, function(response) { document.getelementbyid('status').innerhtml = json.stringify(response.location.name); } div class="fb-login-button" scope="public_profile,email,user_birthday,user_location,user_hometown,user_relationships,user_education_history,user_work_history,user_likes,user_religion_politics,user_managed_groups,user_relationship_details,user_friends" data-max-rows="1" data-size="large" data-button-type="continue_with" data-show-faces="false" data-auto-logout-link="false" data-use-continue-as="false" onlogin="checkloginstate;" /div when test using other user facebook, location set public, still cannot location?

android - how to reload fragment on adapter class after item delete -

how can reload fragment adapter class after button click deleted item in database, fragment has recyclerview populated json array database. because 1 of item deleted want recyclerview refresh item heres code cartfragment , heres adapter button click comming. i tried start same fragment fragmentmanager manager = getsupportfragmentmanager(); manager.begintransaction() .replace(r.id.layout_for_fragment, new cartfragment()) .commit(); but getsupportfragmentmanager(); doesn't work inside adapter class, or there way around start same fragment on button click inside adapter. call method inside holder.deleteitem.setonclicklistener(new view.onclicklistener() , pass object remove private void removeitem(cartitem cartitem) { int currposition = cartitems.indexof(cartitem); cartitems.remove(currposition); notifyitemremoved(currposition); }

aem - "http error:404 Prblem accessing/.Reason not found" while accessing any page/url AEM6.3 -

i working in aem6.3 on redhat linux system. getting blank page when try access aem after startup message- http error: 404 problem accessing /. reason: not found powered jetty:// also, when use curl command- curl http://localhost:4503/ i below output- <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/> <title>error 404 </title> </head> <body> <h2>http error: 404</h2> <p>problem accessing /. reason: <pre> not found</pre></p> <hr /><i><small>powered jetty://</small></i> </body> </html> i not getting error in error.log , stdout.log. below stdout file- 13.09.2017 22:46:33.947 *info * [apache sling control listener@/127.0.0.1:41783] /127.0.0.1:36152>stop 13.09.2017 22:46:33.948 *info * [apache sling control listener@/127.0.0.1:41783] /127.0.0.1:36152<ok 13.09.2017 22:46:33.952 *info * [

api - $expand filters on OData returning 19 values -

i trying group members using below query - https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayname,'ci-')&$top=100&$expand=members members of each group returning 19 values, though actual values should 268. returns groups, members inside group limited 19, dont see documentation on odata expand talking members. if run each group separately getting values. https://graph.microsoft.com/v1.0/groups/group_id/members?$top=999 json response -

cordova - Technology Stack for Hybrid Mobile Application using ASP.NET -

i'm in process of deciding technology stack hybrid mobile application asp.net. i want use close microsoft technology(we using web apis, ms sql db planning use mvc, phonegap). can 1 recommend best fit in aspects? if have samples should us there no best. of technologies/frameworks have pros , cons. on other hand there no difference have on backend when talk in rest. my personal "best" ionic framework since work angular, , angular (not angularjs) me smth usercontrols in webforms again personal thoughts. for other people "best" react native . to choose best you should ask self team skills , choose comfortable you and sum up, hybrid apps has nothing asp.net server side , part must separated.

javascript - Promise.reject().catch(console.log) got an `Illegal invocation` on my Android 5.1 phone -

i've try on chrome before , works well, on android 5.1 phone got illegal invocation in browsers, console.log doesn't being invoked in global context. can 1 of these: promise.reject().then(function (error) { console.log(error); }); or promise.reject().then(console.log.bind(console));

java - Text Color Not Changing in AlertDialogue -

Image
i trying apply custom color in alertdialogue. changing text color background color in not changing singlechoiceitems text color. can see black color in page number below image. i using style below code <style name="alertdialogtheme" parent="theme.appcompat.light.dialog.alert"> <item name="colorprimary">@color/colorprimary</item> <item name="android:textcolor">@color/textcolorlite</item> <item name="android:background">@color/colorprimarydarklite</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="coloraccent">?attr/mainaccentcolor</item> <item name="android:buttonbarbuttonstyle">@style/dialogbuttonstyle</item> </style> <style name="dialogbuttonstyle" parent="@style/widget.appcompat.button.buttonbar.alertdialog"

compilation - Compile Rebol code to executable -

i downloaded rebol/view (vesion 2.7.8) linux x86 libc6 2.3 version http://www.rebol.com/downloads.html , working right interpreter on linux (debian stable 9). possible compile code executables? tried checking options, , compile executable option not seem there: $ rebol -v --help command line usage is: rebol <options> <script> <arguments> fields optional. supported options are: --cgi (-c) check cgi input --do expr evaluate expression --link url connect link --help (-?) display usage information --nowindow (-w) not open window --noinstall (-i) not install (link, view) --quiet (-q) don't print banners --reinstall (+i) force install (link, view) --script file explicitly specify script --secure level set security: allow ask throw quit --trace (-t) enable trace mode --uninstall (-u) uninstall rebol (link, view) --version tuple minimum version of script, when url (vie

java - Why a .term() of Jeromq blocks infinitely even I have called .close() to close all the sockets? -

i tried use 0.4.2 of jeromq in android app , added compile 'org.zeromq:jeromq:0.4.2' build.gradle, .connect( string addr ) in zmq crash, no matter if server program available. so tried use 0.4.0 of jeromq , .connect() can work, .term() of jeromq never return when server program not available. please see simple version of code below in android , following codes run in thread of intent service. zmq.context context = zmq.context(1); zmq.socket client = context.socket(zmq.req); client.connect("tcp://192.168.31.10:13587"); client.send("android"); final int request_timeout = 3000; zmq.poller items = context.poller(1); items.register(client, zmq.poller.pollin); items.poll(request_timeout); if (items.pollin(0)) { string reply = client.recvstr(); } client.close(); context.term(); a call client.connect

session - No cookie received on Elastic Beanstalk with Elasticache -

Image
problem: after logging deployed node app on elastic beanstalk, never receive cookie, , whenever refresh page through browser, logged out. here express-session setup: app.use(session({ store: new redisstore({ client: redisclient, host: process.env.redis_host, port: process.env.redis_port }), secret: process.env.session_secret, resave: false, saveuninitialized: false // no cookie received until successful login })); in development (after login): in production (after login): so while able "log in", unable have persistent session through refresh because there never cookie sent back. possible reasons have ruled out: elasticache: have set elasticache instance redis. security groups: have configured inbound security group accept incoming tcp connections elastic beanstalk security group. i've tested using ssh connect beanstalk, installing redis-cli, , connecting primary endpoint successfully. load balancer: elastic be

Methods in Class for Java program -

i started learning java , having difficulty understanding classes. 1 of recent assignments create class called triangle - given user input main method - take in input test if input see if hypothetical "triangle" equilateral, isosceles, or scalene , return main. able program work not 100% within guidelines of assignment's requirements (which specified having 2 additional methods calculated largest , smallest side-length). wondering, after fact, if can @ did , let me know if can see , or explain - in beginner terms - why having 2 methods needed if works without them (i.e. program somehow @ disadvantage nature of not having them) , if so, doing wrong kept throwing errors when tried implement methods? i'll include both assignment guidelines (for reference since not assume mind reader) , code: "your assignment write class definition (not program, there no main method) named triangle (saved in file triangle.java). triangle has 3 instance variables: int side1, s

pivot - error in my procedure while pivoting table -

i have following procedure delimiter $$ create definer=`root`@`localhost` procedure `samp`() begin declare startdate date; declare enddate date; set session group_concat_max_len = 3000000000; select min(from_date) startdate requestor_employees emp_code=2145; select max(to_date) enddate requestor_employees emp_code=2145; call fill_calendar(startdate,enddate); set @test =(select concat('select concat(em.fname,'',em.mname,'',em.lname) project_manager,pm.project_name,re.req_id,re.from_date,re.to_date requestor_employees re inner join requestor_master rm on re.req_id=rm.req_id inner join project_master pm on rm.project_auto_id=pm.project_auto_id inner join employee_master em on pm.pm_emp_code=em.emp_code re.emp_code=@id , re.flag in("na","ma","nd","md") group pm.project_name')); set @result= (select distinct concat('select project_name,',group_concat(months),' (',@test,') `e`')from( sel

handler - The onCreate() method in android -

i know handler.post() method, causes runnable r added message queue. runnable run on thread handler attached. but question if use handler.post inside oncreate() method runnable in message queue executed after completion of oncreate() method, ?? please can clear doubt

ios - Can't import Obj-C framework in Swift -

Image
i install lgsidemenucontroller swift project cocoa pods. created bridging header, , added following: #import <lgsidemenucontroller/lgsidemenucontroller.h> #import "uiviewcontroller+lgsidemenucontroller.h" however, xcode highlight #import "uiviewcontroller+lgsidemenucontroller.h" , says file not found. but file exist in pods directory. how fix that? note. fix issue #import "lgsidemenucontroller.h" , maked #import <lgsidemenucontroller/lgsidemenucontroller.h> instead #import "uiviewcontroller+lgsidemenucontroller.h" have no effect , error isn't gone. did set bridging header in build settings

javascript - angular4 import html file -

i want save test.svg in component variable 'a' or svgicon.component.html. so, create svgicon.component.ts file. not working. should do? svgicon.component.ts import { component, oninit } '@angular/core'; import { svgs } './svg/test.svg'; @component({ selector: 'app-svgicon', templateurl: './svgicon.component.html', styleurls: ['./svgicon.component.css'] }) export class svgiconcomponent implements oninit { public a: string = svgs; constructor() { } ngoninit() { } } test.svg <svg version="1.1" width="10" height="14" viewbox="0 0 10 14"> <path fill="#d4d4d4" d="m5,0.024c-2.761,0-5,2.269-5,5.069c0,1.139,0.37,2.19,0.996,3.036l-0.02,0.039l2.664,3.856l1.349,1.953 l1.339-1.953l2.62-3.82c9.607,7.345,10,6.265,10,5.093c10,2.293,7.761,0.024,5,0.024z m5,7.024c-1.105,0-2-0.895-2-2s0.895-2,2-2 s2,0.895,2,2s6.105,7.024,5,7.024z" /&

centos7 - vim special mark behavior? -

i started looked @ vim plugin , trying write 1 myself. want use marking features of vim. found following snipped in book as: nnoremap <leader>g :set operatorfunc=grepoperator<cr>g@ vnoremap <leader>g :<c-u>call grepoperator(visualmode())<cr> function! grepoperator(type) if a:type ==# 'char' normal! `[v`]y else return endif echom shellescape(@@) endfunction the behavior of `[ , `] mentioned in vim , here in function not same. vim says as: `[ first character of changed or yanked text. `] last character of changed or yanked text. when type following command in normal mode in vim: normal! `[v`]y with file yanked lines based on have done previously(how many lines above or below have changed text or yanked). but if call same command above function bonded motion-operator behavior not same echos character under current cursor. the motion used is: vi(<leader>g why both be

node.js - NodeJs : Using async for request url - Post method sending response before execution of all urls -

i have post method, request input list of newlink objects (newlink attributes linkurl , status) using async.map iterating on urls check if links active or not. newlinks contains links {www.google.com,www.nourl.com,www.xyz.com} expecting after request processed , setting corresponding status true or false, want send using res.send(newlinks) but console giving below results: "www.google.com up", calling res.send(), executing "www.nourl.com up" , "www.xyz.com up" so here, after first url request , code below executing function outside async loop. thought async allow next piece of code execute after urls validated. app.post('/myposturl', function(req , res){ var request = require('request'); let linkdetails= req.body.linkdetails; var = 0; async.map(linkdetails, function(newlink, callback) { var url = "url"; var url = newlink.linkurl; var proxiedrequest = request.defaults({'proxy': url}); proxiedreq

java - GWT migration from 2.6.1 to 2.7 compilation error at asm library -

i migrating gwt higher version (from 2.6.1 2.7). app mutlimodule maven build on top of stack like: hibernate, spring, gwt. i've done lot of stuff make work. struggle asm library, base on error: [info] [error] unexpected internal compiler error [info] java.lang.arrayindexoutofboundsexception: 8192 [info] @ org.objectweb.asm.classreader.readutf8(unknown source) [info] @ org.objectweb.asm.classreader.accept(unknown source) [info] @ org.objectweb.asm.classreader.accept(unknown source) i've done lot of exclusion of asm spring. here asm occurence in dependency tree: +- com.google.gwt:gwt-dev:jar:2.7.0:provided | +- (org.ow2.asm:asm:jar:5.0.3:provided - omitted duplicate) | +- org.ow2.asm:asm-util:jar:5.0.3:provided | | \- org.ow2.asm:asm-tree:jar:5.0.3:provided | | \- (org.ow2.asm:asm:jar:5.0.3:provided - omitted duplicate) | \- org.ow2.asm:asm-commons:jar:5.0.3:provided | \- (org.ow2.asm:asm-tree:jar:5.0.3:provided - omitted duplicate) \- org.ow2.asm:asm:j

.net - Smart Tags appear for all controls on form but not the actual form itself (VS 2010) -

smart tags appear controls on form, not actual form itself. looking @ link (walkthrough: adding smart tags windows forms component) https://msdn.microsoft.com/en-us/library/ms171829.aspx it seems overly cumbersome have modify code surely setting somewhere? have missed something? i haven't put code against of controls on form (listbox, combobox etc.) , display smart tags , action lists little arrows perfectly. thanks i resolved adding 'form assistant' component project.

dataframe - Optimize an R code having for loop -

here code, trying convert data wide format may or may not have duplicate data. tried use for-each , parallel still takes more time, can suggest change this data processing:- param1: 1, , 753360af0c8949c0aeab64d520599656 param2: value2 param3: value3 param4: value4 param1: 2, , 8c8c659813d842c5bab2ddba9483ea5a param2: value5 param4: value6 param3: value7 so need wide format the above example contains 4 parameters. file can have 10 varying number of parameters text file comes different sources. the result should this:- param1 param2 param3 param4 1 753360af0c8949c0aeab64d520599656 value2 value3 value4 2 8c8c659813d842c5bab2ddba9483ea5a value5 value6 value7 here code same:- f <- read.table("./sample.txt",header = false, sep = ":",fill=true, row.names=null) f[,2] <- paste(f[,2],f[,3],f[,4]) c <- unique(f[,1]) rw <- round(nrow(f) / length(c)) + 1 result <- data.frame(matr

python 2.7 - Matplotlib - Changing line color above/below hline -

Image
i have line plot , 2 hlines, using different colors, , i'm filling areas main line crosses hlines color of hline. in addition that, i'd use same color main line in areas. in nutshell, current output: desired output: and relevant code i'm using: lower, upper = 20, 80 self.indicatorplot.axhline(lower, color="red") self.indicatorplot.axhline(upper, color="green") self.indicatorplot.plot(self.charttimes, self.indicatordata, color="blue") self.indicatorplot.fill_between(self.charttimes, self.indicatordata, lower, where=(self.indicatordata <= lower), facecolor="red", interpolate=true) self.indicatorplot.fill_between(self.charttimes, self.indicatordata, upper, where=(self.indicatordata >= upper), facecolor="green", interpolate=true) in principle may split plot 3 parts, values above upper , values below lower , values in middle. in sense question has been asked , answered, e.g. python: possible chang