Posts

Showing posts from July, 2014

sql - Fastest way to find count of selected items in MySql? -

i know how find count,avg functions works want i'm trying achieve here operation after count found please see code below. article::where('id','=',130) ->select( 'articles.*', db::raw('(select avg(rating) rating rateable_id = articles.id , type = "article" ) avgrating'), db::raw('(select count(*) comments commentable_id = articles.id , commentable_type = "article") commentcount'), db::raw('(select count(*) article_favourites article_id = articles.id ) favouritecount') ) ->get(); using above query, can 'avgrating', 'commentcount', 'favouritecount', want sum of these three.. i.e. like: (avgrating + commentcount + favouritecount) sum what best way this? ps: have solution db::raw('( (select avg(rating) rating rateable_id = article.id , type = "article")+(select co

python - Force shutil copy to continue through list when encountering missing source file -

i'm using shutil copy output upstream process based on user supplied files. files aren't compatible upstream process, , such final file i'm attempting move won't created. i'm handing shutil list of verbose file paths, want continue move items in list when 1 or more of source files missing. source = ['/home/desktop/folder/subfolder/file.ext', '/home/desktop/folder/subfolder2/file2.ext', '/home/desktop/folder/subfolder3/file3.ext'] dest = ['/home/desktop/target/file.ext','/home/desktop/target/file2.ext', '/home/desktop/target/file3.ext'] sou, des in zip(source, dest): shutil.copyfile(sou, des) one approach add exception handling around call, example: import shutil source = ['/home/desktop/folder/subfolder/file.ext', '/home/desktop/folder/subfolder2/file2.ext', '/home/desktop/folder/subfolder3/file3.ext'] dest = ['/home/desktop/target/file.ext','/home/desktop/tar

docker - Do --limit-xxx options of service command limit resource per service or per container? -

service create command of docker 1.12 has 2 options limit cpu , memory follows: --limit-cpu value limit cpus (default 0.000) --limit-memory value limit memory (default 0 b) do limit resource per service or per container? you can see in api/client/service/update.go taskresources().limits = &swarm.resources{} updateint64value(flaglimitcpu, &task.resources.limits.nanocpus) --limit-cpu introduced in commit 12a00e6 considering swarmkit/manager/scheduler/nodeinfo.go has, when removing task, following code: nodeinfo.availableresources.nanocpus += reservations.nanocpus it appears limit-cpu per node managed service.

javascript - No margin on elements next to each other on multiple lines -

Image
i have colorpicker right margin of 6px. want white square (with black check marker) have no right margin won't wrap next line. because want use complete width . don't want use class margin on 0 because when choose 1 of colors 8th element black square. , on smaller devices wrap can @ 3th element instead of 8th element. i'm looking automatic detection method. prefer css solution javascript/jquery good. elements list-items float left ul.colors li, ul.colors li.chosen { margin: 0 !important; padding: 3px 6px 3px 0 !important; } ul.colors li .colorbox { height: 18px; width: 18px; border: 1px solid #dbdbd1; } ul.colors, ul.colors li { float: left; list-style: none } ul.colors { width: 180px; background: #ccc; padding: 10px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div class="ajax-layered"><ul class="colors show-count&qu

Python: DictWriter overwrites rows when file reaches certain size -

i've encountered strange problem when using dictwriter add rows end of csv inside loop. when file reaches 12288 bytes, rows no longer added , replaced instead. check this, ran simple test: import pandas pd import csv test=pd.dataframe(columns=('key1','key2','key3','key4','key5')) test.to_csv("testwrite.csv",index=false) in range(500): headers={} data={} words={'key1':'col1','key2':'col2','key3':'col3','key4':'col4','key5':'col5'} k,v in words.items(): headers[k]='keyval'+str(i) data[k]='colval'+str(i) open("testwrite.csv", 'r+',newline='\n') f: header=next(csv.reader(f)) dw=csv.dictwriter(f, header) dw.writerow(data) f.close() has encountered similar problem or have solution this?

android - setCardview Background color to match the response that I get from Json -

i make cardview background color match color api provided. here item_details.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="0dp" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:layout_margintop="9dp" card_view:cardcornerradius="3dp" card_view:cardelevation="0.01dp"> <relativelayout android:id="@+id/top_layout&

html - How to center a child element in CSS, even if it is larger than the parent? -

i create css class div can placed in center of parent. code using is: .centered { position: absolute; margin: auto; bottom: 0px; left: 0px; top: 0px; right: 0px; } it works if parent larger child element, or has same size: https://jsfiddle.net/cy8dn1km/ but if child larger, center not positioned @ center of parent. instead left borders @ same place, , child element extended right: https://jsfiddle.net/797l7nce/ something wrong horizontal centering. how possible fix using css ( without using css 2d/3d transformations ), without adding new container elements? here solution without using css 2d/3d transformations. can use display: flex flex-direction: column (this important ) on parent element , display: table on child element. body, html { width: 100%; height: 100%; margin: 0; } body { display: flex; align-items: center; justify-content: center; background: green; } .centered.d1 { display: flex; a

Python how to show text in a tkinter application on a none-button -

i'm extremely new python , has started small project learn stuff. anyways, says in title, how show text in tkinter application without creating buttons? here's code if need it import tkinter tk ulo = 1 hoho = 0 def lul(): global ulo #ulo = ulo + 1 global hoho hoho = hoho + ulo print(hoho) class application(tk.frame): def __init__(self, master=none): tk.frame.__init__(self, master) self.pack() self.createwidgets() def createwidgets(self): self.hi_there = tk.button(self, fg="green") self.hi_there["text"] = "pressing buttons fun,\n isn't it?" self.hi_there["command"] = self.lel self.hi_there.pack(side="top") def lel(self): lul() root = tk.tk() app = application(master=root) app.mainloop() there couple options using label s fitting 1 since label's job showing text/image. the label widget standard tkinter wi

java - Reset Buttons shows 0 score but doesn't really clean the answers -

i have simple quiz app users can see score scorebutton , reset score resetbutton. questions in radioboxes.the problem when user clicks on resetbutton, button shows 0 doesn't clean radioboxes user had choose start beginning. miss in code can't figure out. appreciated lot! mainactivity.java public class mainactivity extends appcompatactivity { string name; int score = 0; button submitbutton; button resetbutton; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //user input name final edittext namefield = (edittext)findviewbyid(r.id.namefield); name = namefield.gettext().tostring(); //submitbutton shows user score submitbutton = (button) findviewbyid(r.id.submitbutton); submitbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view

android - Parsing xml tags with colons inside using C# -

i'm working in xamarin on 1 android app parsing xml webiste: http://video.cazin.net/rss.php , , populate listview , in particular have problem getting value tag: <media:thumbnail url="http://video.cazin.net/uploads/thumbs/2d07f1e49-1.jpg" width="480" height="360"/> i created namespace: xmlnamespacemanager.addnamespace("ab", "http://search.yahoo.com/mrss/"); and tried value url attribute: xmlnodelist xmlnode = document.selectnodes("rss/channel/item"); if (xmlnode[i].selectsinglenode("//ab:thumbnail[@url='http://video.cazin.net/rss.php']", xmlnamespacemanager) != null) { var thumbnail = xmlnode[i].selectsinglenode("//ab:thumbnail=[@url='http://video.cazin.net/rss.php']", xmlnamespacemanager); feeditem.thumbnail = thumbnail.value; } i tried this: //ab:thumbnail/@url but got value of first imag

matplotlib - Python plot of a piecewise defined surface -

Image
i trying make 3d plot of surface defined in different ways different regions. example, take f(x,y) defined 1 if x > y , x^2 if x <= y. i defined f logical operators, , tried plot "plot_surface" function, evaluating in grid. unfortunately, got error saying "the truth value of array more 1 element ambiguous". do know way of solving this? taking link posted serenity need define f using np.piecewise import numpy np import matplotlib.pyplot plt mpl_toolkits.mplot3d import axes3d, axes3d num_steps = 500 x_arr = np.linspace(0,100, num_steps) y_arr = np.linspace(0,100, num_steps) def zfunc(x, y): return np.piecewise(x, [x>y, x<=y], [lambda x: 1, lambda x: x**2]) x,y = np.meshgrid(x_arr, y_arr) z =zfunc(x,y) fig=plt.figure() ax=fig.add_subplot(1,1,1,projection='3d') ax.set_xlabel('x axis') ax.set_ylabel('y axis') ax.plot_surface(x,y,z,cmap='viridis') #cmap make easier see ax.view_init(30, 70) plt.show(

email - How to flush the queue in DragonFly Mail Agent (DMA) -

dma keeps on trying send email: $ dma -bp id : c08be.177cb00 from: example@foo.bar : example@foo.bar how can flush queue? this might helpful someone: retrieve pid , kill process $ ps -ef | grep dma mail 6922 1 66 jun28 ? 15:31:04 /usr/sbin/dma -q1 $ kill -9 6922

How do I pair values from two differently long columns in R? -

i have 2 data frames in format similar this: name1 1 retta mclennon 2 deloras wurm 3 tristan partee 4 lashonda swayne 5 christiane bendel and name2 1 christiane bendel 2 tristan partee 3 ronni sugrue 4 lashonda swayne 5 alvaro fahey 6 tamie kalinowski 7 jefferson levitt 8 retta mclennon 9 haywood neu 10 deloras wurm i create new column in name1 in value "yes" ascribed rows contained in name2. > df1 name 1 retta mclennon 2 deloras wurm 3 tristan partee 4 lashonda swayne 5 christiane bendel > df2 name 1 christiane bendel 2 tristan partee 3 ronni sugrue 4 lashonda swayne 5 alvaro fahey 6 tamie kalinowski 7 jefferson levitt 8

r - Find the indices of top n elements in a row after ignoring selected indices -

i have dataframe df1 , list l1 : df1 <- data.frame(c1 = c(4.2, 1.2, 3.0) , c2 = c(2.3, 1.8, 12.0 ) ,c3 = c(1.2, 3.2, 2.0 ) , c4 = c(2.2, 1.9, 0.9) ) l1 <- list(x1 = c(2,4) ,x2 = c(3) ,x3 = c(2)) where l1 contains list of indices ignore in df1. now, want find indices of top 2 (can higher) elements after excluding indices in list l1 every row. actual data has more rows , columns. so, expected output : [1,] 1 3 [2,] 2 4 [3,] 1 3 where df1 : c1 c2 c3 c4 1 4.2 2.3 1.2 2.2 2 1.2 1.8 3.2 1.9 3 3.0 12.0 2.0 0.9 if indices can in order of values of placeholders, helpful . expected output : [1,] 1 3 [2,] 4 2 [3,] 1 3 we can use rank lapply(seq_len(nrow(df1)), function(i) { x1 <- unlist(df1[i,]) i2 <- l1[[i]] i3 <- seq_along(x1) %in% i2 which(rank(-x1*na^i3) %in% 1:2) }) #[[1]] #[1] 1 3 #[[2]] #[1] 2 4 #[[3]] #[1] 1 3 update if need in order lapply(seq_len(nrow(df1)), function(i

Right click and copy content menu on c# WPF datagrid -

so have wpf data grid 8 cells in each row, i've included relevant 1 simplicity i'd user able right click cell , copy contents windows clipboard without left clicking , selecting first. i've tried many code snippets can't seem work. each row binded item. the majority of things i've been trying mouserightbuttondown event. have tried xy position, have used e.originalsource frameworkelement can't seem work. not sure if because datagridhyperlinkcolumn opposed other types used in examples? i'm c# n00b! appreciated. <datagrid x:name="eventsdatagrid" autogeneratecolumns="false" isreadonly="true" itemssource="{binding}" horizontalalignment="left" margin="10,143,0,0" verticalalignment="top" height="295" canuseraddrows="false" canuserreordercolumns="false" canuserresizecolumns="true" canusersortcolumns="false" borderthickness="1

java - Calculate width of Views so that they always fit on screen -

Image
i need dynamically calculate width of bars in diagram drawing. the minimum width has 4 pixels , maximum 50 pixels. how calculate width when need more bars dynamically set width , fit on screen? right hardcoded either 4 or 50 pixels if suggest thankful. thanks in advance! edit 1 public void drawbars(int numberofrates) { this.removeallviews(); final viewgroup nullparent = null; this.addview(minflater.inflate(r.layout.layout_bar_diagram, nullparent)); linearlayout parentview = (linearlayout) findviewbyid(r.id.parentview); int width, height, horizontalmargin, verticalmargin, textbottommargin; verticalmargin = calculatedpi(16); if (((numberofrates * calculatedpi(50)) + (numberofrates * calculatedpi(5))) < displaymetrics.widthpixels) { width = calculatedpi(50); horizontalmargin = calculatedpi(5); } else { width = 0; horizontalmargin = 0; } (int = 0; < numberofrates; i++) { if (i ==

How to check net connection when i connected to mobile hotspot iOS Swift -

in app, have integrated rechability.swift . working fine when wifi connected, want test scenario when i'm connected mobile (hotspot no internet connection). when code executes connected, because status connected wifi, need check if network available or not. other way standard way ? please help. using rechability same result let reachability: reachability { // reachability = try reachability.networkreachable() reachability = try reachability.reachabilityforinternetconnection() if (reachability.isreachableviawifi()) { _label.text = "wifi connected" } else if (reachability.isreachable()) { _label.text = "reachable" } else if (reachability.isreachableviawwan()) { _label.text = "connected via wan" } else { _label.text = "not connected " } } catch { print("unable create reachability&qu

logstash mail to multiple recipients -

at logstash conf filter , assigned multiple email id variable(variable name = targetmailid) , output field , trying use variable. however, assiging multiple email id's cc field in output. please suggest. filter { kv { field_split => "," value_split=>":" } if [ref_type] =~ /tag/ { ruby { code => "tag= event['ref'] targetmailid = 'testuser1@mail.com,testuser2@mail.com,testuser3@mail.com' } } } output { if "tagcreate" in [tags] { email { body => "test messgage" => "admin@emil.com" => "admin2@email.com" cc => "targetmailid" subjec

c# - Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AI" and "Latin1_General_CI_AI" unified on code level -

ive got question cannot resolve collation conflict between "sql_latin1_general_cp1_ci_ai" , "latin1_general_ci_ai", know can set in sql using collate sql_latin1_general_cp1_ci_ai, have app connects different dbs , not throwing exception. there way support on code level? not ideal include data joins in script: collate database_default

broadcastreceiver - set multiple Proximity Alerts using broadcast receiver android -

consider 3 locations home, office , playground. whenever entering , exiting location shows message alert. main activity add multiple proximity points mainactivity.java protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { snackbar.make(view, "replace own action", snackbar.length_long) .setaction("action", null).show(); } }); locationmanager = (locationmanager) getsystemservice(context.location_service); latitudeedittext = (edittext) findviewbyid(r.id.point_latitude); longitudeedittext = (edittext) findviewbyid(r.id.point_longitude);

Matlab: Display Vectors side by side in a structure -

Image
how can display (in variable viewer) 2 vectors in structure side-by-side in matrix? shows me this: edit: how should look: this want achieve, converting table struct: i.a(1:150,1)=[0]; i.b(1:150,1)=[0]; a=table(i.a,i.b) b=table2struct(a) the variable viewer shows contents of fields "side side" when it's structure-array, constructed following commands: a.a = 0; a.b = 0; b = repmat(a,[1 100]);

matplotlib - How to set more margins -

Image
i have pyplot code. since want group multiple bars, trying write text in graph using plt.annotate. however, can see in picture, word 'something' in left bottom gets cropped. know how can fix this? here code #!/usr/bin/python import matplotlib matplotlib.use('agg') import matplotlib.pyplot plt import matplotlib.cm cm import operator o import numpy np n_groups = 5 means_men = (20, 35, 30, 35, 27) std_men = (2, 3, 4, 1, 2) means_women = (25, 32, 34, 20, 25) std_women = (3, 5, 2, 3, 3) fig, ax = plt.subplots() index = np.arange(n_groups) bar_width = 0.35 opacity = 0.4 error_config = {'ecolor': '0.3'} rects1 = plt.bar(index, means_men, bar_width, alpha=opacity, color='b', yerr=std_men, error_kw=error_config, label='men') rects2 = plt.bar(index + bar_width, means_women, bar_width, alpha=opacity, color='r', yerr=std_women, error_kw=error_config,

magento 1.8 - PayPal Parallel vs. Adaptive functionality -

definition of proper paypal-method on our marketplace. it dental marketplace customers can buy several products multiple sellers (merchants) @ same time. need payment show different sellers on paypal payment interface (incl. tax, shipping etc. on each seller/merchant) when customer submit order. important dentlet (our marketplace) not figure on customer payment page (due legal considerations). furthermore need autorize payment during customer checkout. important don’t want customer transfer payment seller/merchant before actual item shipped/invoiced (or part of items shipped/invoiced).capture should on invoice generated our marketplace based on shipment. instantly when/after payment has been captured, need commission seller/merchant paypal account dentlet paypal account. earlier on have been suggested go express checkout in scenario, due challenges implementing have been advised go with: pre-approval adaptive chained payment. somehow seems need functionality both parallel , a

python - I need to calculate the range of the max overlapping occurances not the max number of them -

assume have dataset numbers (start, stop): 4556745 , 4556749 4556749 , 5078554 … , on i want make chunk of code in order print range (start, stop) in max overlapping occurred. till have managed calculate max number of occurrences not range in in. my pseudocode – logic : maxoverlap = 0 currentoverlap = 0 equals 0 j equals 0 m equals len(in_mumbers) n equals len(out_numbers) while (i less_than m , j less_than n): if (in_numbers[i] less_than out_numbers[j]) currentoverlap equals currentoverlap + 1 maxoverlap equals max(maxoverlap, currentoverlap) equals + 1 else: currentoverlap equals currentoverlap - 1 j = j + 1 print maxoverlap is there idea, suggested readings e.t.c? the maximum overlapping range maybe (quase surely) not whole tuple (start, stop) of input data. so i'd transform tuple (start, stop) in range containing range between start , stop: (4556745, 4556749) → range(4556745, 4556749) and

Maven dependencies are not getting downloaded, proxy issues? -

current winhttp proxy settings: direct access (no proxy server) in windows machine. , in settings.xml . but, jars not getting downloaded , getting below error. [error] plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or 1 of dependencies not resolved: failed read artifact descriptor fo r org.apache.maven.plugins:maven-clean-plugin:jar:2.5: not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central ( https://repo.maven.apache.org/maven2 ): connect repo.maven.apache.org:443 [repo.maven.apache.org/151.101.24.215] failed: connection timed out: con nect -> [help 1] as per maven documentation have add settings.xml setting in mentioned here guide proxies . <settings> <proxies> <proxy> <id>example-proxy</id> <active>true</active> <protocol>http</protocol> <host>proxy.example.com</host> <port>8080</port>

performance on xml column in sql server -

i have normalized tables keep data in following format. first table name logbook columns journeyid, locationid, positionid, id, second table logbookevents columns logbookid, lifecodeid, lifecode, lifecodevalue, totalvalue the first table has 3.4 million records , second table has 17.3 million records. i found performance on these tables big heavy have necessary indexes on tables. therefore have designed new table has xml format new table is.. logbooklifecodes, columns journeyid, lifecode (xml type) by doing this, have reduced number of records 900,000 and lifecode hold data in following format <logbooklifecodeevents><lifecodes> <logbookid>11</logbookid> <locationid>0</locationid> <positionid>0</positionid> <lifecodeid>4</lifecodeid> <lifecode>fh</lifecode> <lifevalue>0.0000</lifevalue> <lifetotal>0.0000</lifetotal> and using following query return data in table

c# Create generic list dynamically at runtime -

following example on this post , found out how create list of generic types dynamically. now, issue want add items created list unknown source list - there way achieve this? edit start source list containing business objects, absolutely need right type of output list, because of downstream bindings require it. my non-compiling code follows: ilist<object> sourcelist; // list containing custom objects type t = typeof(ilist).makegenerictype(sourcelist[0].gettype()); ilist res = (ilist)activator.createinstance(t); foreach (var item in sourcelist) { reportds.add(item); // not compile } i recommend moving code generic class or function, moving reflection higher level: private static list<t> clonelistas<t>(ilist<object> source) { // here can want t // t == source[0].gettype() return source.cast<t>().tolist(); } to call it: ilist<object> sourcelist; // list containing custom objects // sourcelist = ... methodinfo m

Delphi Datasnap - How to customize JSON marshalling -

in delphi 10.1 berlin datasnap rest application, need customize json serializaton of object. i find solution makes use of jsonreflect attribute, , doesn't involve creation of converters , reverters every specific field, described in this article daniele teti. in particular, i'm trying serialize object contains: a binary file, convert in json representation - byte array some tdatetime fields, convert in string iso format i have found technical pdf document marco cantù, talks jsonreflect attribute enable conversion of fields, cannot find documentation it. anyone can me, please? use of jsonreflect attribute automatically implies use of converters , reverters. delphi xe6 ships sample project marshallunmarshall json serialization covered. rad studio demo code available online . if want serialize object contains tdatetime field in string iso format, can use standard tjson class defined in rest.json unit. contains objecttojsonstring method. in aoptions p

python - Edit tensorflow inceptionV3 retraining-example.py for multiple classificiations -

tldr: cannot figure out how use retrained inceptionv3 multiple image predictions. hello kind people :) i've spent few days searching many stackoverflow posts , documentation, not find answer question. appreciate on this! i have retrained tensorflow inceptionv3 model on new pictures, , able work on new images following instructions @ https://www.tensorflow.org/versions/r0.9/how_tos/image_retraining/index.html , using following commands: bazel build tensorflow/examples/label_image:label_image && \ bazel-bin/tensorflow/examples/label_image/label_image \ --graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt \ --output_layer=final_result \ --image= image_directory_to_classify however, need classify multiple images (like dataset), , stuck on how so. i've found following example at https://github.com/eldor4do/tensorflow-examples/blob/master/retraining-example.py on how use retrained model, again, sparse on details on how modify multiple classifications.

sql - Select rows by applying whatever condition(if or case) -

i have set of records suppose below: id name status date 1 xx 1 2016-06-27 14:05:17.447 2 yy 2 2016-06-27 14:05:17.447 3 zz 1 2016-06-27 14:05:17.447 4 aa 2 2016-06-27 14:05:17.447 5 bb 2 2016-06-27 14:05:17.447 i want select rows above rows have status=1, want apply condition that select if status=1 , date<=getdate how can that? select id, name, case when status =1 , date<getdate() 'i want select row' else don't want select row end statuss ,date yourtable update: per edit,you need apply conditions in clause select * yourtable status=1 , date<getdate()

guide to use caffe convert_imageset.cpp and making lmdb -

i new caffe , appreciate if guide me. going make lmdb jpg using convert_imagenet.cpp, cannot succeeded. content of create.sh follows: #!/usr/bin/env sh # create caltech101 lmdb inputs # n.b. set path caltech101 train + val data dirs example=examples/caltech101 data=data/caltech101 tools=build/tools train_data_root=examples/caltech101/caltech101_train/ val_data_root=examples/caltech101/caltech101_train/ # set resize=true resize images 256x256. leave false if images have # been resized using tool. resize=true if $resize; resize_height=256 resize_width=256 else resize_height=0 resize_width=0 fi if [ ! -d "$train_data_root" ]; echo "error: train_data_root not path directory: $train_data_root" echo "set train_data_root variable in create_caltech101.sh path" \ "where caltech101 training data stored." exit 1 fi if [ ! -d "$val_data_root" ]; echo "error: val_data_root not path directory: $val_data_root&quo

javascript - How to push data to a nested Object -

how can push element variables property below object? var request = { "name": "name", "id": 3, "rules":[ { "name": "rule name", "tags": [ { "tagid": 1, "variables":[ { "variable": "var1", "matchtype": "regex", "value": ".*" }, { "variable": "var2", "matchtype": "regex", "value": ".*" } ], "condition": false, }, { "tagid": 1, "condition": false, } ], "rulesetid": 3, } ] } for exaple, need add {"variable&qu

twitter - TwitterAPI for Python: using result from request in a new request -

i want collect user data followers specific twitter user. first, collect user_id's of followers user using followers/id. thereafter want use users/lookup in order collect user data collected user_id's @ once (with maximum of 100). stuck, don't seem results. think has input user_ids since inputting them manually gives me results expect. from twitterapi import twitterapi import json consumer_key = "..." consumer_secret = "..." access_token = "..." access_token_secret = "..." api = twitterapi(consumer_key, consumer_secret, access_token, access_token_secret) r = api.request('followers/ids', {'screen_name':'elonmusk'}) r = json.loads(r.text) r = list(r['ids']) f = api.request('users/lookup', {'user_id': r }) print(f.text) i've tried several devious ways solve it, above mentioned far beginner python knowledge ranges reliable. although not work. i managed fix myself. fir

linux - Restrict logging for a particular child shell script -

i'm running bunch of scripts through 1 main parent script. have added logging code in parent script below: exec 3>&1 4>&2 trap 'exec 2>&4 1>&3' 0 1 2 3 exec 1>logfilename 2>&1 this generates logs child scripts. want skip log generation 1 particular script, since logs can heavy @ times. is there way this? many thanks! my parent script looks this: mkdir -p $scriptfolder/log logfile="$scriptfolder/log/$(echo "$4" | tr -d '\n\r')_log_importmain_$datetime.log" exec 3>&1 4>&2 trap 'exec 2>&4 1>&3' 0 1 2 3 exec 1>$logfile 2>&1 source $scriptfolder/shellscripts/1.copyfilesfromftp.sh source $scriptfolder/shellscripts/2.import.sh source $scriptfolder/shellscripts/3.export.sh source $scriptfolder/shellscripts/4.copyfilestoftp.sh i want skip logging 3.export.sh, there way possible this? you not running scripts subprocesses, question implies "pare

php - Create a search filter based on custom variable product field -

i'm trying find out how create custom search filter woocommerce products. have added 2 custom fields product variations: _min_height , _max_height . set min , max height fields example 1000 , 3500. i need build custom search filter user can fill-in min , max height , filters products values in _min_height , _max_height . i hope can me out this! thanks.

apache - Glassfish - Domain wise redirection to application -

i running glassfish server on linux 6 oracle apex applications running on port 8080 , 8181(for https) . now, suppose domain mydomain.com, and when access a.mydomain.com -> should redirected application 1 (i.e a.mydomain.com:8080/apex/f?p=1) b.mydomain.com -> should redirected application 2 (i.e b.mydomain.com:8080/apex/f?p=2) and on... if hard figure out glassfish, can move apache tomcat if required. any advice/idea appreciable. i don't know glassfish, might try proxypass inside virtual host config proxypass / http://a.mydomain.com:8080/apex/f?p=1 similar b.mydomain.com domain. if want redirect, i.e. browser's url changes, use redirect instead redirect / http://a.mydomain.com:8080/apex/f?p=1

Android isScreenOn Nullpointerexception -

i used code keep screen on on android 4.4.2. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); } the code work, after time app crashes (maybe 1 time in 24 hours) java.lang.nullpointerexception @ android.os.powermanager.isscreenon(powermanager.java:739) @ android.view.viewrootimpl.&lt;init&gt;(viewrootimpl.java:454) @ android.view.windowmanagerglobal.addview(windowmanagerglobal.java:250) @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:69) @ android.app.activitythread.handleresumeactivity(activitythread.java:3028) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2395) @ android.app.activitythread.handlerelaunchactivity(activitythread.java:3930) @ android.app.activitythread.access$900(activitythread.java:151) @ android.app.activitythread$h.handlemessage(a