Posts

Showing posts from May, 2014

asp.net - Update dropdown after Items.Clear() -

i populate dropdown several items. when user chooses 1 of these items, second dropdown gets populated. when user clicks on "x" button on first dropdown, 2 dropdown must cleared. first dropdown gets cleared automatically, , clear second dropdown using "dropdown.items.clear()". it happens when load again data first dropdown, second dropdown not update. this code: protected void dropdowndiagstati_selectedindexchanged(object sender, eventargs e) { int selectedindex = this.dropdowndiagstati.selectedindex; populateddlstates(selectedindex); } private void populateddlstates(int selectedindex) { // ottengo diagrammi di stato in sessione arraylist diagrammistato = session["statediagrams"] arraylist; if(selectedindex > 0) { // ottengo il diagramma di stato selezionato docspawr.diagrammastato currdiagstato = (docspawr.diagrammastato)diagrammistato[selectedindex - 1]; ...

sqlite3 insert from php 5.3.6 doesn't commit, leaves "-journal" file -

i have 3 web pages on yahoo hosted web site use sqlite3 databases. working fine until week ago. of sudden inserts , updates no longer being saved in database files. also, in same directory database files, there "-journal" file left over. file permissions on database file , directory , parent directory 777. can read database fine, no updates occurring. have tried several things: pulled down database home computer , ran python sqlite3 test see if insert data database. worked fine - record inserted via python , no "-journal" left over. tried switching on pdo instead of sqlite3. still not saving data - still "-journal" left over. tried adding transactions ($db->exec('begin;') , $db->exec('commit;');). did not work. added try/catch try {...} catch (exception $e) {error_log($e);}. no errors logged. tried adding logging after each step. log messages printed, including error_log('last row id inserted: ' . $db-...

How to setup a VSTS build definition to publish Azure Functions with this configuration? -

Image
we using vs 2017 on single solution multiple projects , right mouse click , deploy 3 c# azure function 2 different azure function apps slots. how set vsts build definition accomplish on every check in? we using dlls , setting function.json way. don’t know if need deploy differently based on type of configuration. "scriptfile": "..\\bin\\target.dll", "entrypoint": "target.application.run" i able create vsts deployment through following steps solutions structure build configuration steps sync master branch added nuget restore using default options added msbuild step followign optons project : vstssolution.sln (selected using '...') msbuild version: latest msbuild architechture: msbuild x86 clean: checked create log file: checked added app service deploy function app1 azure subscription: target subscription app service name: target function app deploy slot: if check allows select actual slot want dep...

java - Fill ArrayList with objects fills with same values -

i trying fill empty arraylist "circles" objects circle random sizes , random locations, later on paint. for loop fills array normally, reason when copy circ.addall(circles) doesn't work. tried use .clone() , circ = circles ,... ended either nullpoint exception error or circles having same values. code. public class board { public static int size = 400; public static arraylist<circle> circles; public static void fillarray(arraylist<circle> circ){ random r = new random(); int rand = r.nextint(10)+5; circles = new arraylist<circle>(rand); system.out.println("random ="+ rand); for(int = 0; i< rand; i++){ circles.add(new circle(circle.x, circle.y,circle.size)); system.out.println(i+". "+ circles.get(i).x +" "+ circles.get(i).y +" size je "+ circles.get(i).size); //fills normaly } circ.addall(circles); system.out.println("aaaaa"+c...

git - Can I live-preview the results of a pull request before accepting it? -

my boss has idea our website , i'm wondering how possible is. we want bring on non-technical people approval process pull-requests on github. example, have who's job assure accuracy of things saying, , have else who's job make sure website has design. the problem neither of these people technical , can't read code nor use software git bash. them somehow able preview changes of pull request see how looks (rather seeing code itself). possible git? if not how else can integrate them yes, can. called, "have proper release channel" once that, can build release git branch , install it. as long "deploying via git checkout" you'll never want. problem order of operations work against you. with proper release channel, order of operations like commit code build installable install installable but since building installable own step, can reorder steps: build installable (pre commit) install installable (pre commit) comm...

Cofused with regex in Python -

this question has answer here: difference between 2 regular expressions: [abc]+ , ([abc])+ 5 answers i have following code: re.findall(r'(\w)*','2sq') why result of programme is: ['q', ''] ? i thought ['2','s','q',' '] . remove * , you'll expected result. * greedy, looks want each \w , findall that.

cmake - CPack install OPTIONAL files -

i'm trying use cpack generate rpm file , i'm using install this: install(files ${project_binary_dir}/some_file destination /tmp/ optional) but seems cpack ignores optional flag , reports error file not exist. there option cpack set optional files?

inheritance - Why can't CSS padding be partially inherited using shorthand? -

from time time when browsing through stylesheets, have seen rules such following: padding: 10px inherit; i didn't know if valid css made 3 jsfiddles. 3 fiddles have <p> child of <div> parent (and tested in chrome 59.0). in first jsfiddle , child inherits parent padding (a single inherit keyword) , inspection of elements show both <p> , <div> have 10px padding in both x- , y-directions: div {padding: 10px 10px} p {padding: inherit} in second jsfiddle , child <p> has both x , y padding explicitly inherited (1 actual <length> , 1 inherit keyword): div {padding: 10px 10px} p {padding: 10px inherit} inspection of <p> shows css has broken (i.e., no padding inherited); in third jsfiddle (for completeness), child <p> has both x , y padding explicitly inherited, in case there 2 separate inherit keywords: div {padding: 10px 10px} p {padding: inherit inherit} and css breaks <p> (i.e., no padding inherited)...

android - How to install Fastlane on Buddybuild -

i try install fastlane in pre build step on buddybuild. my pre build script looks this: #!/bin/bash if ! fastlane >/dev/null; echo "installing fastlane may need sudo" sudo gem install fastlane else echo "updating fastlane may need sudo" sudo gem update fastlane fi i following error: error: error installing fastlane: error: failed build gem native extension. /usr/bin/ruby2.1 mkrf_conf.rb . building native extensions. take while... /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': error: failed build gem native extension. (gem::ext::builderror) . /usr/bin/ruby2.1 extconf.rb . mkmf.rb can't find header files ruby at /usr/lib/ruby/include/ruby.h extconf failed, exit code 1 how can solve this? rest of log gem files remain installed in /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2/ext/gems/gems/unf_ext-0.0.7.4 inspection. results logged /var/lib/gems/2.1.0/gems/unf-0....

python - what do psycopg2's server connection status values mean? -

i trying output status of connection after open connection , after close it. getting output of 1 when open , 2 when close it, there no talk these values mean in psycopg2's documentation. know different status values mean? i using status function connection status values. those documented status constants , can find them here: http://initd.org/psycopg/docs/extensions.html#connection-status-constants this not tell numeric representation/value of it, though. if print each constant, did, should this: from psycopg2 import extensions ext print(ext.status_ready) #1 print(ext.status_begin) #2 print(ext.status_in_transaction) #2 (this alias status_begin) print(ext.status_prepared) #5 note documentation states: "the status undefined closed connectons (sic) ." http://initd.org/psycopg/docs/connection.html#connection.status

Simple C example of add/sub/mul/div operations in double-precision floating-points using a single-precision Floating-point system -

i working on algorithm requires calculations in large numbers, upto e+30. using 32 bit system compiler support of 32 bits long/float/double. far, searching online, i've learned single-precision floating points (fps) can used double-precision fps. from question asked earlier ( emulate “double” using 2 “float”s ) found paper has algorithm work double-precision fps in gpus. confusing me implement in c. need 4 basic mathematical operations. there way find example me understand better? thanks in advance. here code working on. might have errors can not see, suggestions appreciated rectify error preety trying implement. in algorithm, polynomial_order should able go forth order (can settle @ third order if standard deviation smaller). few things not sure 1) procedures make_float() , make_float() correct or not, 2) use of make_float() in program. #define polynomial_order (3) #define tc_table_size (14) typedef struct vector_float2{ float x; float y; }float2; typedef struct...

python - Why is dnspython giving me this error? -

here simple code: print host rdata in dns.resolver.query(host, 'cname') : prod_host = str(rdata.target) i'm pulling host out of file. when run this, following: "www.maizena.es" traceback (most recent call last): file "lexparse.py", line 488, in <module> dfs(rules_tree) file "lexparse.py", line 486, in dfs dfs(child) file "lexparse.py", line 486, in dfs dfs(child) file "lexparse.py", line 471, in dfs rdata in dns.resolver.query(host, 'cname') : file "build/bdist.macosx-10.11-intel/egg/dns/resolver.py", line 1132, in query file "build/bdist.macosx-10.11-intel/egg/dns/resolver.py", line 1051, in query dns.resolver.nxdomain: none of dns query names exist: \"www.maizena.es\"., \"www.maizena.es\".masked.domain.com., \"www.maizena.es\".domain.com., \"www.maizena.es\".netarch.domain.com., \"www.maizena.es\".fr.ads...

php - Select multiple equals from same table mysql -

creating database search system searches input value fixed element dropdown using php , mysql e.g. select * mytable fname '%input%' or lname '%input%' , city = 'dublin'; the problem last part being executed, results display dublin , ignores first part. how structure query properly? a or b , c may not evaluate want: select 1 or 0 , 0; -- 1 instead: (a or b) , c where: select (1 or 0) , 0; -- 0

python - No such file or directory error? -

i'm using else's code rename files in folder sequentially. import os _src = ("/path/to/directory") i,filename in enumerate(os.listdir(_src)): newname = ('test-' + str(i).zfill(3)) os.rename(filename, newname) print('renaming "%s" "%s"' % (filename,newname)) what error in above snippet? you not specifying qualified path when calling os.rename . need: os.rename(os.path.join(_src, filename), os.path.join(_src, newname))

I want remove scroll mode from Navigation Drawer Android -

i want remove space navigation drawer i want remove scroll mode navigation drawer or solution create custom navigation drawer without menu here layout code. <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:overscrollmode="never" tools:opendrawer="end"> <include layout="@layout/app_bar_live" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.navigationview android:id="@+id/nav_view" andro...

python - Beautiful Soup find first <a> whose title attribute equal a certain string -

i'm working beautiful soup , trying grab first tag on page has attribute equal string. for example: <a href="url" title="export"></a> what i've been trying grab href of first found title "export". if use soup.select("a[title='export']") end finding tags satisfy requirement, not first. if use find("a", {"title":"export"}) conditions being set such title should equal "export", grabs actual items inside tag, not href. if write .get("href") after calling find() , none back. i've been searching documentation , stack overflow answer have yet found one. know solution this? thank you! what i've been trying grab href of first found title "export". you're there. need is, once you've obtained tag, you'll need index href. here's more bulletproof version: try: url = soup.find('a', {title : 'ex...

selenium - Android: Add apps to "Choose an action" prompt -

Image
as means handle file upload android app testing, i've chosen third-party app called "terminal emulator (by jack palevich)", since working fine webdriver\appium script on xiaomi redmi note 2 miui7 above android 5.1. so worked fine, choose action prompt looked this: unfortunately, stage version of app uses crash on device, tried old samsung galaxy sii+ , nexus4 in android virtual device. though app worked ok now, there no prompt required file manager, looked same in both new options (android 5.1 , 7.1.1) next, testing device we're having samsung android 4.4, however, believe there kind of samsung firmware there, because not pure android @ all: so, logical assume firmware somehow handles possible app associations on file upload action. the question is: how modify default "choose action" prompt on vanilla android? if no how, know better way upload file using webdriver\appium stack in native android application asks me so? thanks. ...

mongodb - Remove MMS and "Unmanage all" menu option -

i'm trying rid of mms , clicked on "unmanage all" menu option. after mms displayed panel multiple changes listed , button "confirm , deploy". why has asked me deploy changes when i'm trying put mongo cluster in unmanaged mms state? can keep mongo settings , unmanage it?

jquery - Bootstrap mobile menu instantly collapse back -

i need add mobile menu toggle 990px bootstrap v3.3.7. this changes navbar breakpoint. when click menu button shows menu list instantly collapse back. menu doesn't stay open after button clicked. how can menu stay open after button clicked? @media (max-width: 990px) { .navbar-header { float: none; } .navbar-toggle { display: block; } .navbar-collapse { border-top: 1px solid transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); } .navbar-collapse.collapse { display: none!important; } .navbar-nav { float: none!important; margin: 7.5px -15px; } .navbar-nav>li { float: none; } .navbar-nav>li>a { padding-top: 10px; padding-bottom: 10px; } } from fiddle posted , should organize according bootstrap, , follow there guidelines.

Posting data to django rest framework using javascript fetch -

i'm trying post data django rest framework using javascript fetch. i've set , liked drf model , got set backend. used postman app ensure "get", "post" etc working interned. however, i'm having problem posting data using javascript post data using fetch. want add data article model has "headline", "tag", "content", "background_image" , user posted article. this how code looks data = json.stringify({ headline: "testing", tag: "testing", background_image: "testing", content: "testing", user: 1 }) fetch( "http://127.0.0.1:8000/api/v1/articlesapi/", { method: "post", headers: {"authorization":"token ed73db9bf18f3c3067be926d5ab64cec9bcb9c5e"}, body: data } ).then(function(response) { return response.json(); }).then(function(dat...

java - Reader properties file with latin characters -

i have properties file latin characters in it. when read properties file through spring using @resource map getting populated last character not in proper format. please can let me know reason , how fixed? á=a é=e entries in properties file above. java uses unicode define non-asci characters, need replace them unicode equivalent text or html code: char| code | html ----+--------+------- á | \u00e1 | &#225; é | \u00e9 | &#233;

css - Collapse 3 columns on mobile device -

i have bootstrap layout so: <div class="container"> <div class="row"> <div class="col-sm-4 top-col-left"> <h4>24 hour high</h4> <h1>$7.88</h1> </div> <div class="col-sm-4 top-col-center"> <h4>24 hour low</h4> <h1>$1.88</h1> </div> <div class="col-sm-4 top-col-right"> <h4>24 hour change</h4> <h1>$2.88</h1> </div> </div> </div> when viewed on mobile device layout become 3 rows of 1 column. possible display 1 row of 2 columns , 1 row of 1 column instead? this become 2 rows 2 , 1 columns respectively on xs (<768px) devices <div class="container"> <div class="row"> <div class="col-sm-4 col-xs-6...

laravel 5 - Passing values from one controller to another -

been @ ages, can't find solution. i've searched , none of posts help, possibly me not getting i'm new laravel (5.4) i want able able access $site_settings 1 controller another. $site_settings need accessible on controllers , views. need variable url (hence request in __construct( request $request ) ) doesn't work either. would appreciate assistance. thanks. see code below: //basecontroller class basecontroller extends controller { public function __construct( request $request ) { $slug = $request->slug; $site_settings = \db::table('sites_settings')->where('slug', $slug)->first(); view::share( 'site_settings', ['slug' => $slug, 'color' => $color] ); } } class settingscontroller extends basecontroller { // settingscontroller public function index( ) { //how access $site_settings here , pass on view? // return vi...

css - Loop won't finish executing when a function is called within - JavaScript -

i using function below create , link stylesheet in <head> tag depending on url passed. function create(file) { var link = document.createelement("link"); link.href = "https://example.com/" + file; link.rel = "stylesheet"; document.head.appendchild(link); } i have loop won't stop running whenever function called. for(i=0; i<array.length; i++){ thefile = array[i]; create(thefile); } within array list of css files - "bootstrap.min.css", "font-awesome.min.css" i have tested out function on own , seems work fine: create("style.css"); create("style.css"); the code above manages create 2 stylesheets in <head> tag.

java - Android to Windows Socket File Transfer Through Browser -

i trying transfer file android device windows pc. ip , port used browser. want send file in way browser show user save file prompt. current code using this: socket socket = new socket(ip, port); socket.setsotimeout(1000*10); outputstreamwriter writer = new outputstreamwriter(socket.getoutputstream()); writer.write("hello world!"); writer.flush(); writer.close(); socket.close(); i connectionexception (timeout). of course, open suggestions ways make possible, or easier. thanks lot in advance!

python - Pandas: Insert New column to dataframe and populate values within new column based on if then logic -

i have dataframe 2 country descriptions. match, don't. country desc1 country desc2 1 2 uk 3 uk 4 uk uk i need 1.) insert column (country desc3) row values populated 2.) rule returns country desc1 if matches country desc2. df['country desc3'] = \ df['country desc1'].mask(df['country desc1'] != df['country desc2']) df country desc1 country desc2 country desc3 0 1 uk nan 2 uk nan 3 uk uk uk

Shell script (bourne and/or bash) RegEx over Multiple Lines -

how achieve following in shell script ( bourne and/or bash )... similar can, using regex on file (content sample below) i need match pattern, , - capture content right side of 'ld_preload=' variable. file content: blah blah blah #some comment ld_preload=/usr/lib64/libstdc++.so.6 export ld_preload #more comments the following regex works fine on online regex builder ( https://regex101.com/r/xw0jvr/1 ) /ld_preload=(\s+)[\n\r]+^\s*export\s+ld_preload/gm i tried following using shell script, doesn't work... #!/bin/bash envvars_stdfile="tempenvvarsstd" regex="ld_preload=(\s+)[\n\r]+^\s*export\s+ld_preload" if [[ "${envvars_stdfile}" =~ "${regex}" ]] cpplib="${bash_rematch[1]}" echo "cpplib is: $cpplib" else echo "regex pattern (${regex}) doesn't match in file: $envvars_stdfile" fi it produces: regex pattern (ld_preload=(\s+)[\n\r]+^\s*export\s+ld_preload) doesn't...

R: Average by every N value in 3-dim matrix -

i have matrix hourly data (on monthly period) , dim [116 152 744] trying create matrix b daily data , dim [116 152 31] every dim tstep in b average of first 24 tsteps in matrix a. i successful in creating matrix c monthly data simple apply c <- apply(a, c(1,2), function (x) mean(x)) but can't quite figure out average on every n values. thanks. take 1 vector only, mean every 24 values, can do: mean24 <- function(x) { dim(x) <- c(24, length(x) / 24) colmeans(x) } x <- 1:48 mean24(x) [1] 12.5 36.5 so, in case, have do: apply(a, c(1, 2), mean24)

Eclipse IDE High Memory Footprint -

why ide eclipse consuming memory? though followed optimizations posted here the big problem jvm don't give memory o.s, use g1 gc. the java process consuming 2gb memory, committed memory of jvm smaller. kind of behavior perceived after long period running ide. memory consumption increasing while using eclipse, why happen? jvm memory footprint analysis png

Update value in array in Mongodb using Meteor gives error 403 -

i hope can me problem of mine. please forgive me if i'm not expressing correctly want. i have mongodb collection arrays holding objects , need change value of 1 of these objects variables. found correct answer in mongodb when using in meteor complain being able update _id my collection this { _id: 'akjsdakudsh', subs: [ { name: 'name1', seen: false, }, { name: 'name2', seen: false, } ] }, { _id: 'ako0iqwjeqasdf', subs: [ { name: 'name1', seen: false, }, { name: 'fantastic', seen: true, } ] } therefore if want change seen true 1 called name2 in mongodb db.coll.update( { _id : 'akjsdakudsh', 'subs.name': 'name2' }, { $set: { 'subs.$.seen': true } } ); and works charm. problem comes when trying in meteor because throw error 403 not permitted. untrusted co...

c# - How to use UIViewControllerTransitioningDelegate with MvxIosViewPresenter? -

i have view controller a , view controller b , want navigate a b (present modally) custom transition ( uiviewcontrollertransitioningdelegate ), how mvxiosviewpresenter ? do need write custom presenter myself or there way how in elegant way? it possible use custom transition mvxiosviewpresenter . have create custom uiviewcontrollertransitioningdelegate , assign viewcontroller ( viewdidload place it). something should work: [mvxmodalpresentation(modalpresentationstyle = uimodalpresentationstyle.overfullscreen, modaltransitionstyle = uimodaltransitionstyle.crossdissolve)] public partial class modalview : mvxviewcontroller<modalviewmodel> { public modalview(intptr handle) : base(handle) { } public override void viewdidload() { base.viewdidload(); transitioningdelegate = new transitioningdelegate(); } } public class transitioningdelegate : uiviewcontrollertransitioningdelegate { public override iuiviewcontrolleran...

android - How can we get count of parameters passed in doInBackground(String... args) -

i searched many posts got meaning of (string... args) problem how can count of these parameters inside function. appreciated... you can use length method. array can treat array . public void doinbackground(string… args) { int count = args.length; } for getting value index - use string value = args[index];

postgresql - Updating OSM local database after a regular interval in Rails -

i have setup local version of osm database using osm2pgsql in slim mode. have following tables planet_osm_lines planet_osm_nodes planet_osm_point planter_osm_roads planet_osm_ways i used following command migrate database osm2pgsql -c -d database_name --slim planet.osm.pbf every thing working fine. want update these regularly , stay date latest changes. -- since using rails there way update these tables programatically? mean can run schedulized job , update latest changes without having download entire osm files? -- secondly since interested in us, canada , mexico there way fetch these countries data? thanks

Excel VBA - Search column for text in a String, Copy text into adjacent cells down -

Image
i'm attempting simplify excel sheet work on weekly basis, vba improving problem has stumped me. i'm trying create vba macro following: 1 - search column b text "associate", when found want copy entire cell contents adjacent column filling down data related..aghh??? essentially want 1 table rows have complete information, can pivot etc. please see screenshots of before , after. before: after: that small sample of data have 3 people, have 100 people , cant carry on doing manually driving me bonkers. any advice or appreciated, have no idea start problem. thanks untested: dim c range, each c in range(range("b1"),cells(rows.count,2).end(xlup)) if c.value "associate:*" = c.value else if c.value<>"" c.offset(0,-1).value=a end if next c

How to display Jupyter notebook output in external window -

i new jupyter-notebook, display output of jupyter-notebook cell in separate window. i able handle mouse event on external window future step. can please? thank you. here code : import fresnel import math matplotlib import pyplot %matplotlib inline device = fresnel.device() scene = fresnel.scene(device=device) scene.light_direction = (4,3,8) # note: api temporary position = [] in range(6): position.append([2*math.cos(i*2*math.pi / 6), 2*math.sin(i*2*math.pi / 6), 0]) geometry = fresnel.geometry.sphere(scene, position = position, radius=1.0) geometry.material = fresnel.material.material(solid=0.0, color=fresnel.color.linear([1,0.874,0.169])) geometry.outline_width = 0.12 scene.camera = fresnel.camera.fit(scene, view='front', margin=0.2) tracer = fresnel.tracer.direct(device=device, w=300, h=300) out = tracer.render(scene) out[100,100] out i display object out in separate window. thank you

paypal - Income split before (or after) recipient receives? -

i want setup website others sell on platform. (yes, know there zillions of these out there.) each seller have income go paypal accounts direct. is possible deduct fee on website before share? don't want receive , send recipient - importantly, recipient should receive in accounts. let's charge 10%. want 10% cut sent me , other 90% goes directly seller. surely can't first person think of this? i'm hoping other clever person has thought of , has solution. maybe solution seller receive, instantly, 10% sent hits seller account. make sense? thanks!

jquery - How to pass values from json_encode using PHP to Ajax -

this json file after php encode values: /database/database.php [{"id":"1","title":"text","text":"ttexte","image":"dsgdsgs","user_id":"1"},{"id":"2","title":"titles","text":"sfsf","image":"safasfa","user_id":"1"}] this ajax code /js/database.js $.ajax({ url: "/database/database.php", type: "get", datatype: 'json', crossdomain: "true", success: function(result) { if (result.type == false) { alert("error occured:" + result.data); return false; } $.each(json.parse(result.data), function(index, obj) { $("#get-all").append( "<div class='span12'><div class='row'><div class='span8'><h...

Matrix to list of matrix group by column names in R -

i have matrix 6000 columns , each column belongs 1 of 100 "groups" need. need convert matrix list 100 smaller matrices. toy example of have: mat = cbind(c(2,2,2),c(3,3,3),c(4,4,4),c(1,1,1)) colnames(mat) = c("2018.3 1","2018.3 2","2019.1 1","2019.2 2") so "group" identified last name of each colname, here there 2 groups. result need like: list(cbind(c(2,2,2),c(4,4,4)),cbind(c(3,3,3),c(1,1,1))) i've been thinking , think should this: lapply(do.call(cbind,sapply(something here find columns in each group))) but haven't figure out how it. #obtain last part of each column names groups = sapply(strsplit(x = colnames(mat), split = " "), function(x) x[2]) #go through each unique column name , extract corresponding columns lapply(unique(groups), function(x) mat[,which(groups == x)]) #[[1]] # 2018.3 1 2019.1 1 #[1,] 2 4 #[2,] 2 4 #[3,] 2 4 #[[...

javascript - How does hastebin/pastebin hide their tags? -

okay i'm working on hastebin/pastebin type application. need little tho. how can display raw paste pre tags hidden in source shown on elements in chrome? example if goto https://hastebin.com/raw/mikepucegu see raw. if view source shows text " <?php hi ?> " okay question how can that? here image of elements http://prntscr.com/g06s9l doesnt show in source? i'm confused want this. heres got far:: <?php $con=mysqli_connect("localhost","root","","blazebin"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $result = mysqli_query($con,"select * pastes id=".$_get['id'].""); while($row = mysqli_fetch_array($result)) { echo "<script>document.write('<pre>');".$row['paste']."</pre>"; } mysqli_close($con); ?> btw know snippet wont work acting weird when inputting c...

javascript - How to solve Uncaught TypeError: $(...).carouFredSel is not a function at -

i have mvc project, , have created actionresult, code in view: @{ layout = string.empty; } <div class="weather-widget-container"> <!--<div class="weather-widget-title">Метео</div>--> <ul style="margin-top: 5px; float: left" id="vremenska"></ul> <img id="weather-loading" style="height:16px; width:11px; margin-top: 5px; float: right; margin-right: 5px; " src="/vremenskax/ikoni/loading.gif" /> </div> <script> window.rostusefunction = []; </script> <script> (var = 0, length = window.rostusefunction.length; < length; i++) { window.rostusefunction[i](); } </script> <script src="../scripts/jquery-3.1.1.min.js"></script> <script type="text/javascript" src="../vremenskax/js/jquery.caroufredsel-6.2.1-packed.js"></script> <script typ...

matplotlib - Using basemap to plot tax trips in Python -

Image
i'm trying use basemap function create plot 1 shown here , using this data. this code: west, south, east, north = -74.26, 40.50, -73.70, 40.92 fig = plt.figure(figsize=(14,10)) m = basemap(projection='merc', llcrnrlat=south, urcrnrlat=north, llcrnrlon=west, urcrnrlon=east, lat_ts=south, resolution='c') x, y = m(df['pickup_longitude'].values, df['pickup_latitude'].values) m.hexbin(x, y, gridsize=1900, cmap=cm.ylorrd_r) however, result nothing weird. i'm wondering i'm missing. thanks. it seems data comprises more data in range inside basemap plot. desired plot using lot more gridpoints, e.g. gridsize=10000 . cost lot of memory. a better option first select dataframe values in range shown in map. import pandas pd import matplotlib.pyplot plt mpl_toolkits.basemap import basemap matplotlib import cm df = pd.read_csv("train.csv") west, south, east, north = -74.26, 40.50, -73.70, 40.92 df = d...

html - Change color of text in a tag? -

.myactive{ background:white; color: red; } .navbar > li > a:hover, .navbar > li > a:focus{ background: ; color: #333; } <ul class="navbar"> <li> <a href="index.html">home</a></li> <li> <a href="#">categories</a></li> <li> <a href="#">about us</a></li> <li class="myactive"> <a href="#">contact</a></li> </ul> i want change color of text in <a> tag write class change background of li tag it's not changed color text in li. after little research understand need add <span> text. don't understand why need this, <a> , <span> inline elements. .navbar > li > a:hover, .navbar > li > a:focus{ background: white; color: #333; } and why pseudo class focus work ? assuming html this <ul> <li><a ...

convert each sub-dictionary in a nested dictionary to defaultdict in Python -

class mydict(dict): pass def nest_dict(dct): dct = mydict(dct) k, v in dct.items(): if isinstance(v, dict): dct[k] = mydict(v) nest_dict(v) return dct dct = {'a':{'b':{'c':'d'}}} print(type(nest_dict(dct)['a']['b'])) here's piece of code have now. want covert each sub-dictionary in nested dictionary child class of dict, mydict. however, recursion logic change first level of sub dictionary. how modify recursion function? you're not updating nested structures properly, try: def nest_dict(dct): dct = mydict(dct) k, v in dct.items(): if isinstance(v, dict): dct[k] = nest_dict(v) return dct dct = {'a': {'b': {'c': 'd'}}} print(type(dct['a']['b'])) # <class 'dict'> my_dct = nest_dict(dct) print(type(my_dct['a']['b'])) # <class '__main__.my...

database - Electron local storage options to deal with large data upto 1gb -

my electron application saving data in settings.json file using 'electron-settings' library. data has many records relatively short strings each. since possible data can grow upto 1gb, concerned getting , setting values large json file may introduce performance issues in future. searched options , found "nedb" , "leveldb" local database. wish know if there can performance gain in getting , setting values if implement such local databases on manipulating json file. update: complex queries not necessary use case. application needs execute operations such db.set('people.record', 'string_value') on large volume of records.

javascript - Android WebView HTML input keypress doesn't fire -

Image
on devices (mostly samsung, others too) , combinations of: android version, webview version (even evergreen webview in android 7) , keyboard, there number of issues: keypress isn't fired keydown , keyup contain keycode=229 keypress , input fired don't contain key textinput isn't fired maxlength attribute isn't honored on input[type=text] while user types (more maxlength chars allowed , input validated when form submitted) is there way fix these issues? i found if extend webview , override oncreateinputconnection , of issues fixed: public class webviewextended extends webview { @override public inputconnection oncreateinputconnection(editorinfo outattrs) { return new baseinputconnection(this, false); } } before overriding oncreateinputconnection : after overriding oncreateinputconnection ( g pressed):

c# - Serilog structured data pretty print? -

is there way make serilog format structured data formatted output? i've been using structured data structures in serilog lately , though there advantage of being compact large data structures (5 properties or more) hard read in console/file without formatting later. hypothetically i'd enable on dev. https://github.com/serilog/serilog/wiki/structured-data from this: { "fruit": ["apple", "pear", "orange"] } to this: { "fruit": [ "apple", "pear", "orange" ] } edit: i'm using jsonconvert.serializeobject({...}, formatting.indented) i'd move away reasons proper coloring console package, faster serialization, deferred serialization etc. i seem recall had custom formatter @ work few years ago modify default json output serilog. not remember exact problem had. you take at, https://github.com/serilog/serilog/wiki/formatting-output , if haven't alre...

get angularJS controller in javascript -

i have controller defined this: var servicesinstance = angular.module('myapp'); servicesinstance.controller('servicesviewcontroller', function() { console.log("servicesviewcontrollerconstructor."); this.initialize = function() { console.log("servicesviewcontroller initialize."); }; }); and instance of dynamically in code this: var instance = $injector.get('servicesviewcontroller'); note: please ignore hardcoded strings. post, hardcoded strings. however, in reality, controller name come configuration data (eg: json object). the instance variable null. $injector.has('servicesviewcontroller') returns false. why case? correct way controller instance? thank matt edit : throwing in more info kept out because trying keep question simple. using requirejs load javascript code creates controller. eg: define([], function(servicesviewcontrollerprovider) { 'use strict'; va...

Syntax for passing parameters in HTTP POST Request -

right have working poc api returns product based on product id. can test api using swagger. vb6 code follows: public function webrequestpost(surl string) string dim xmlhttp msxml2.xmlhttp set xmlhttp = createobject("msxml2.serverxmlhttp") xmlhttp.open "post", surl, false xmlhttp.setrequestheader "content-type", "application/x-www-form-urlencoded" xmlhttp.send "{""id"":2}" webrequestpost = xmlhttp.responsetext set xmlhttp = nothing end function private sub command2_click() dim result string dim url string dim productid string url = "http://localhost:1112/api/products" result = webrequestpost(url) msgbox result end sub i have used similar code method , passing parameter through url success, can't seem post method working. have feeling lies in xmlhttp.send method. it worked reformatting: xmlhttp.setrequestheader "content-typ...

javascript - CKEditor: Plug-in button won't appear -

using latest ckeditor, i'm attempting add example plugin, "timestamp" documentation. downloaded of code github @ link provided , put in proper location. the docs: http://docs.ckeditor.com/#!/guide/plugin_sdk_sample github link: https://github.com/ckeditor/ckeditor-docs-samples/tree/master/tutorial-timestamp ckeditor/plugins/timestamp/plugin.js ckeditor/plugins/timestamp/icons/timestamp.png ckeditor/plugins/timestamp/samples/timestamp.html in config.js file, put in line: config.extraplugins = 'timestamp'; i've closed browser, used other browsers haven't used in months, etc, , no matter what, button icon never appears. i've googled this, , read several q's here on stackoverflow. many have talked misnamed icons or missing icons or whatever, time, it's there, , it's came github. once works, can attempt move on plugins have older ckeditor v4.0 installation. thanks! you need add plugin ckeditor.replace well. simple...

node.js - Converting Shape Files to TopoJSON using the TopoJSON 2.0 API -

i'm trying create app allow interact of zip codes in of states. i'm accomplishing using topojson , d3 draw maps. i've had lot of trouble finding topojson file has data need, i've used gqis create own shapefiles of states. the last step have converting shape file create topojson file. i've watched tutorials used old version of topojson command line, , able transform shapefiles topojson files running command this: topojson -p -o illinois.zcta.json -- illinois.shp my understanding anatomy of request is: topojson (invoking node module) -p(all properties) -o(all objects) illinois.zcta.json(name of file want) -- illinois.shp(name of file convert) however, topojson api appears have been updated , no longer supports request. i've installed topojson globally using npm , trying run function above alerts me topojson not function. i've dug the documentation surrounding new version of topojson command line , appears more complicated. there ton more ways ...

c++11 - Resolve circular dependency of std::functions in C++ -

i'm trying implement parser combinators educational purposes. parser defined std::function<t(input&)> . have come point able define simple expression grammar, using code: auto expression; // type not matter context auto factor = number | (token('(') >= expression >= token(')')) ; auto term = factor >= *( (token('*') | token('/')) >= factor ); expression = term >= *( (token('+') | token('-')) >= term ); as can seen, problem circular dependencies. can not figure out way resolve circular dependency grouped factor causes. operators constructing factor parser need expression parser constructed @ end. how resolve this?

regex - PowerShell -replace to get string between two different characters -

Image
i current using split need, hoping can use better way in powershell. here string: server=ss8.server.com;database=cssdatabase;uid=ws_cssdatabase;pwd=abc123-1cda23-123-a7a0-cc54;max pool size=5000 i want server , database out database= or server= here method using , doing: $databaseserver = (($details.value).split(';')[0]).split('=')[1] $database = (($details.value).split(';')[1]).split('=')[1] this outputs to: ss8.server.com cssdatabase i simple possible. thank in advance replacing approach you may use following regex replace: $s = 'server=ss8.server.com;database=cssdatabase;uid=ws_cssdatabase;pwd=abc123-1cda23-123-a7a0-cc54;max pool size=5000' $dbserver = $s -replace '^server=([^;]+).*', '$1' $db = $s -replace '^[^;]*;database=([^;]+).*', '$1' the technique match , capture (with (...) ) need , match need remove. pattern details : ^ - start of line server= - literal sub...

javascript - Store files in mongodb with Nodejs -

i saving files on fs of server , want save them in mongodb.(for easier backup , stuff).i want store files 4-5mb maximum , tried save them mongoose buffer type.i saved them , retrieved them noticed significant slow performance when save , retrieve files 4 or 5mb. my schema: let fileschema = new schema({ name: {type: string, required: true}, _announcement: {type: schema.types.objectid, ref: 'announcements'}, data: buffer, contenttype: string }); how retrieve them expressjs server: let name = encodeuricomponent(file.name); res.writehead(200, { 'content-type': file.contenttype, 'content-disposition': 'attachment;filename*=utf-8\'\'' + name }); res.write(new buffer(file.data)); my question should use zlib compress functions 'deflate' compress buffer before saving them in mongodb , uncompress binary before sending them client? make whole proccess faster?am missing something?

python - Do Column Headers Exist in Row of Dataframe? -

here example dataframe: cols = ["report_suite", "productid", "manufacturer", "brand manager", "finish"] data = [["rs_1", "productid", "manufacturer", "finish", np.nan], ["rs_2", "productid", "manufacturer", "brand manager", "finish"], ["rs_3", "brand manager", "finish", np.nan, np.nan]] df = pd.dataframe(data, columns = cols) what want have pivot table boolean in each column whether column header in row of data (not including report_suite column). final output want this: cols = ["report_suite", "productid", "manufacturer", "brand manager", "finish"] data = [["rs_1", 1, 1, 0, 1], ["rs_2", 1, 1, 1, 1], ["rs_3", 0, 0, 1, 1]] final_df = pd.dataframe(data, columns = cols) in [185]: df.set_index('report_suite') \ ...

networking - How to curl endpoint on Docker Container -

Image
i have stack named ms_billing deployed on swarm cluster using docker stack deploy . i want curl endpoint on service ms_billing_api running on host called dev-ms-slave1 which has ip: 192.168.99.101 so opened new bash , tried curl 192.168.99.101:8080/billing/api/v1/health-check , endpoint, got (7) failed connect 192.168.99.101 port 8080: connection refused did miss something?

sql server - SQL is it possible to use AND/OR with HAVING clause -

so have these tables: products -------- product id | quantity and orderslines ----------- product id | amount --(multiple lines same id) i'm using select: select p.productid, p.quantity, sum(ol.amount) ordered atbl_sales_products p inner join atbl_sales_orderslines ol on ol.productid = p.productid group p.productid, p.quantity having p.quantity > sum(ol.amount) the select works if productid used in both tables. however, if productid not used in orderslines table or amount in table null - such rows not included. when want join across tables need include records 1 side of join or other, need use 1 of outer join s opposed inner join in sql. if want include record atbl_sales_products when there may no matching record in atbl_sales_orderlines same productid should use left join . as mentioned in comments can use operators use in where clause having clause.

webpack dev server - Proxy is appending target, not replacing it -

so i'm using webpack dev server comes packaged create-react-app, , use bunch of fetch requests post data backend on server, when i'm working on localhost, i'm trying redirect requests simple file returns "true" fetch request: fetch('/validate/validate/from-zipcode', { method: 'post', credentials:'include', headers: new headers({ 'accept': 'application/json, text/javascript, */*', 'content-type': 'application/x-www-form-urlencoded; charset=utf-8', 'x-requested-with': 'xmlhttprequest' }), body:'zip_from='+this.props.fromzip }).then((res)=>{ return res.text(); }).then((res)=>{ if(res==="true") this.props.choosefromzip(this.props.fromzip,this.fromcity,this.fromstate); else this.setstate({error:'block'}) }); proxy code: "proxy":{ "/validate/validate/*":{ ...