Posts

Showing posts from June, 2013

mysql - How to show column name and nested aggregation result -

i want nested aggregation can choose whether aggregate max, min, or avg of nested avg aggregation. i want result this: (genre, max or min or avg of nested avg) current have nested aggregation query returns maximum average price of genre, can't seem select genre corresponding maximum. consider table games(gameid, gamename, genre, price) , disregard gameid , gamename. the nested query have right now: select max(avggenreprice) maxavg ( select genre subgenre, avg(price) avggenreprice games group subgenre ) sub; example result of query: |maxavg| | 368.22| i want this | genre | maxavg | | racer | 368.22 | ive tried : select sub.subgenre, max(avggenreprice) maxavg ( select genre subgenre, avg(price) avggenreprice games group subgenre ) sub ; but gives me error code 1140 select top 1 subgenre genre , avg (price) maxavg games group subgenre order avg (price) desc

ios - Swift unrecognized selector sent to instance segmented control -

i trying add selector uisegmentedcontrol. segmentedcontrol = uisegmentedcontrol(items: items) segmentedcontrol.layer.cornerradius = 12.0 segmentedcontrol.layer.bordercolor = uicolor.purplelight.cgcolor segmentedcontrol.layer.borderwidth = 1.0 segmentedcontrol.layer.maskstobounds = true segmentedcontrol.backgroundcolor = .white self.contentview.addsubview(segmentedcontrol) segmentedcontrol.addtarget(self, action: selector(("changecolor:")), for:.valuechanged) then: func changecolor(sender: uisegmentedcontrol) { switch sender.selectedsegmentindex { case 1: segmentedcontrol.backgroundcolor = uicolor.green case 2: segmentedcontrol.backgroundcolor = uicolor.blue default: segmentedcontrol.backgroundcolor = uicolor.purple } } however, when tap it, got error - unrecognized selector sent instance 0x7fcf5f049000 replace action argument - selector. since

scala - How to embed Play 2.6 using Akka HTTP Server? -

play 2.5 used netty default , allowed easy embedding. https://www.playframework.com/documentation/2.5.x/scalaembeddingplay how done akka http server, default server backend? the page https://www.playframework.com/documentation/2.6.x/scalaembeddingplay missing. the documentation split in 2 pages: for akka http server: https://www.playframework.com/documentation/2.6.1/scalaembeddingplayakkahttp for netty server: https://www.playframework.com/documentation/2.6.1/scalaembeddingplaynetty you should use akkahttpservercomponents avoid deprecated apis: import play.api.{ builtincomponents, nohttpfilterscomponents } import play.api.mvc._ import play.api.routing.router import play.api.routing.sird._ import play.core.server.akkahttpservercomponents val server = new akkahttpservercomponents builtincomponents nohttpfilterscomponents { // avoid using deprecated action builder while // keeping `action` idiom. private val action = defaultactionbuilder override def

amazon ec2 - How to gather information of all the EC2 volumes using ansible? -

i new ansible , trying figure out solutions. can me : getting detailed info running instances of ec2 and find out security groups , policies attached. segregate based on vpcs. i assuming can achieved writing playbook. appreciated. thanks. use ec2 dynamic inventory http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script

KAA Machine learning -

how machine learning algorithm(present in spark mllib) can applied data collected sensors in kaa. haven't found such use case built on kaa. requirement collect live streams of data, processing , cleaning same , applying machine leaning algorithm in kaa. have done collecting data using apache nifi , through kafka passing data spark streaming application on applying machine learning algorithm. i want perform same in kaa iot platform.

getstream io - What is the difference between an Activity's "Target" and "To" fields? -

what difference between activity feed's "target" , "to" fields? can use "target" , "to" interchangeably? if not happens if use target , interchangeably? how impact data , view? also, can have multiple "target"s? the "target" field supplemental field noting activity meant user/list, it's purely reference , field optional. the "to" field send activity other feeds, cc function of email client. it's optional we'll include empty list in activities when fetch feed.

bash - grep regex not returning result when regex stored in shellscript variable -

let's helloworld.txt contains function( '100'); now want search occurence of '100' after ( may have space in between. now, unix command: case-i: grep "[(][ ]*'100'" helloworld.txt i correct match found in helloworld.txt. but when write simple shellscript: case-ii: key="100" key="\"[(][ ]*'$key'\"" echo $key grep $key helloworld.txt it correctly prints: "[(][ ]*'100'" but, doesn't return match found in helloworld.txt i think you're overcomplicating things bit. original command can written this: grep "( *'100'" helloworld.txt and if want number 100 come variable, use this: grep "( *'$key'" helloworld.txt if want store whole regular expression in variable, be: regex="( *'$key'" grep "$regex" helloworld.txt note syntactic quotes (like ones around string literal, or variable) no

sql - Summing particular data in db column table and printing it to jtable -

Image
i have newspaperorder table , wanted display sum of orders , subtotal of each newspaper listed in newspaper column in jtable. database: so first, tried sum orders , total money earned specific newspaper , display newspapertable jtable. string x ='bulletin'; string sql = "select newspaper,price,sum(orders),sum(subtotal) newspaperorder newspaper='"+ x +"'"; pst = sqliteconn.preparestatement(sql); rs = pst.executequery(); newspapertable.setmodel(dbutils.resultsettotablemodel(rs)); rs.close(); pst.close(); this works fine. one data, jtable: then, when attempted average orders , money earned of newspaper listed : templist = new arraylist<>(); string sql = "select * orderform"; pst = sqliteconn.preparestatement(sql); rs = pst.executequery(); while(rs.next()){ templ

c++ - How to see values of std::list in CLion debugger -

i cannot see values of std::list in clion debugger (my clion version 2017.2). example, @ following code; int main() { int myarray[4] = {0,9,8,7}; std::vector<int> myvec(4); std::list<int> mylist(4); return 0; } if run code in debug mode, can see values of std::vector , array not std::list. what's solution except getting iterator list (e.g "it") , add watch "*it" in watch window below; for (auto it=mylist.begin(); != mylist.end(); ++it) { ... }

javascript - setTimeout() not working called from vueJS method -

i trying allow user reset or shutdown given server app. im working on interface right now, , want give user messages happening. display message defined in data object indicate action taken. thene use settimeout switch resetting.... message reset message. see following method. systemreset: function(){ this.message = this.server + ': resetting'; settimeout(function(){ this.message = this.server + ': reset'; }, 2000); } in browser can trigger message , message of "resetting" displays, following "reset" message never output. have formatting errors? to put method in context here entire component. <template> <div> <p>{{message}}</p> <button @click="systemreset">reset server</button> <button @click="systempowerdown">poweroff server</button> </div> </template> <scrip

android - Why the unsigned application does not find the Application class? -

the application developing crashing in mobiles when not signed. when sign application, works on same devices made application crashes. the error is: process: com.my.application, pid: 10293 java.lang.runtimeexception: unable instantiate application com.my.application.di.base.app: java.lang.classnotfoundexception: didn't find class "com.my.application.di.base.app" on path: dexpathlist[[zip file "/data/app/com.my.application-1/base.apk"],nativelibrarydirectories=[/data/app/com.my.application-1/lib/arm, /vendor/lib, /system/lib]] @ android.app.loadedapk.makeapplication(loadedapk.java:563) @ android.app.activitythread.handlebindapplication(activitythread.java:4526) @ android.app.activitythread.access$1500(activitythread.java:151) @ android.app.activitythread$h.handlemessage(activitythread.java:1364) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5254) @ jav

jquery - why sometime ajax success function doesn't work in asp.net mvc? -

Image
in project, i've used datatable crud operation.but have problem didn't work success function, of course, saw network tab received { status":true} datatable didn't reload , redirected blank page.i've added alert function success function alert function didn't work.sometimes got error the required anti-forgery form field "__requestverificationtoken" not present. when want delete record table. , create , edit give me { status":true} message. // get: admin/users/delete/5 public actionresult delete(string id) { if (id == null) { return new httpstatuscoderesult(httpstatuscode.badrequest); } user user = db.user.find(id); userviewmodel userviewmodel=new userviewmodel(); userviewmodel.userid = user.id; userviewmodel.username = user.username; userviewmodel.firstname = user.firstname; userviewmodel.lastname = user.lastname; userviewmodel.email = user.email; userviewmodel.isactive = user.isac

Android 8: WebView - vertical scrollbar - incorrect work -

Image
i has activity webview. here layout xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <webview android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" /> </linearlayout> here activity code: public class testactivity extends appcompatactivity { public static final string html_text = "html_text"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.test_activity); string htmltext = getintent().getextras().getstring(html_text); webview webview = (webview) findviewbyid(r.id.webview); w

nuget - Facebook Authentication API error: Method not found -

i trying implement facebook authentication. have upgraded nuget packages abp 2.1.3 except abp.castle.log4net. getting error error: method not found: 'void abp.authorization.authorizationhelperextensions.authorize(abp.authorization.iauthorizationhelper, system.reflection.methodinfo)' i downloaded fresh template of asp.net boilerplate , upgraded abp.* nuget packages v2.2.1 , resolved runtime error. got error post in seperate thread.

javascript - Merging JS array of objects -

ok have 2 objects want merge wondering best way is... obj1 = [ { id: 123, list: [ {id:1}, {id:2}, {id: 3} ] }, { id: 456 list: [ {id:99}, {id:98}, {id: 97} ] } ] obj1 = [ { id: 123, list: [ {id:1}, {id:4}, {id: 5} ] }, { id: 456 list: [ {id:99}, {id:100}, {id: 101} ] } ] i able call merge(obj1, obj2) , result like: resultobj = [ { id: 123, list: [ {id:1}, {id:2}, {id:3}, {id:4}, {id: 5} ] }, { id: 456 list: [ {id:99}, {id:98}, {id:97}, {id:100}, {id: 101} ] } ] you can use foreach() group elements id on first level , 1 more foreach() , find() check objects in list , push array or assign existing object same id. var obj1 = [{"id":123,"list":[{"id":1},{"id"

c# - Searching String or StringBuilder with a pattern range /start/ /end/ -

i want create function (w/ set of helper functions if needed) in c# perform similar thing awk '/start/,/end/' file - except include last matches, rather terminating on first. lets have: # cat text "13:08:30:5276604 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:5736962 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:6227343 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:6757752 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:7208103 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:7668739 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:8129079 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" expected: "13:08:30:6227343 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:6757752 main: 41044 - 48.7617 m-- other pids 2 - 79.1016 m" "13:08:30:7208103 main: 41044 - 48.7617 m-- oth

Silex 2/Symfony: Check CSRF token from security login form -

i not use "form service provider" , manually output csrf token twig login form: $csrf_token = $app['csrf.token_manager']->gettoken('token_id'); //'token' and in login.html.twig: <input type="hidden" name="_csrf_token" value="{{ csrf_token }}"> the manual ( https://silex.symfony.com/doc/2.0/providers/csrf.html ) says, it's possible check token this: $app['csrf.token_manager']->istokenvalid(new csrftoken('token_id', 'token')); but whole login process handled security component. how add csrf check it? this firewall setup: $app['security.firewalls'] = array( 'login' => array( 'pattern' => '^/user/login$', ), 'secured_area' => array( 'pattern' => '^.*$', 'anonymous' => false, 'remember_me' => array(), 'form' => array( 'login_path' =&g

java - If Condition is Not Working in JSTL -

i trying set 2 variable using 2 if condition not working. code snippet given below: <c:foreach items="${user.roles}" var="role"> <span>value : ${role.id }</span> **<!-- print value perfectly-->** <c:if test="${role.id == 3}"> <c:set var="admin" value="${role.id}"></c:set> <span>value : ${val }</span> </c:if> <c:if test="${role.id == 2}"> **<!-- not work condition here -->** <c:set var="supporter" value="${role.id}"></c:set> <span>value : ${val }</span> </c:if> </c:foreach> <input type="checkbox" name="roles" value="3" ${admin ==3 ? 'checked' : ''}> supporter <input type="checkbox" name=&q

gridview - grid pagination in bootstrap -

this question has answer here: how change bootstrap 3 column order on mobile layout? 5 answers swap 2 column stacking order @ small scrn- bootstrap push pull class or float fix? 2 answers i have 2 divs <div class="col-sm-10">5/6 in left</div><div class="col-sm-2">1/6 on right</div> can show col-sm-2 before (higher than) col-sm-10 if it's mobile/tablet view?

ios - Draw lines in swift 3.0 -

i used following code no avail in swift 3.0 - gives me blank screen on simulator - don't know what's happening. import uikit class drawexample: uiview { override func draw( _ rect: cgrect) { let context = uigraphicsgetcurrentcontext() context!.setlinewidth(3.0) context!.setstrokecolor(uicolor.purple.cgcolor) //make , invisible path first fill in context!.move(to: cgpoint(x: 50, y: 60)) context!.addline(to: cgpoint(x: 250, y:320)) context!.strokepath() } update class below: import uikit class drawexample: uiview { override init(frame: cgrect) { super.init(frame: frame) } required init?(coder adecoder: nscoder) { fatalerror("init(coder:) has not been implemented") } override func draw( _ rect: cgrect) { let context = uigraphicsgetcurrentcontext() context!.setlinewidth(3.0) context!.setstrokecolor(uicolor.purple.cgcolor)

c# 4.0 - oracle query execution time out using c# programming -

Image
i wanted restrict oracle query execution. whenever given time exceeds, query (which takes more time specified time) should come out of execution. below code using c#, error attached if use connection timeout=900;

android - Map.setCenter sometimes causes OutOfMemory crashes -

once in while, outofmemoryexception when calling map.setcenter. stack trace : java.lang.outofmemoryerror @ java.util.concurrent.copyonwritearraylist.add(copyonwritearraylist.java:267) @ com.nokia.maps.mapimpl.a(mapimpl.java:587) @ com.nokia.maps.mapimpl.a(mapimpl.java:2939) @ com.here.android.mpa.mapping.map.setcenter(map.java:865) @ com.cirrios.smartnavigationlib.ui.mapcontroller$1.run(mapcontroller.java:84) @ android.os.handler.handlecallback(handler.java:733) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5001) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:801) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:617) @ dalvik.system.nativestart.main(native method) i'm using here premium sdk v3.3.0 any clue on how prevent ?

amazon web services - What settings on HAProxy needed to work with AWS ALB (Application Load Balancer)? -

currently, have 200 containers(several different applications) running in mesos-marathon cluster. behind haproxy instances , works on http/https protocol. internet --> aws elb --> haproxy --> docker containers now have requirement make 1 existing application run on websocket protocol. thinking add new aws alb achieve this. hence setup like (websocket) internet --> new aws alb --> haproxy --> docker containers (http/s) internet --> aws elb --> haproxy --> docker containers what setting need make haproxy work current http/s , new websocket?

r - Complex/Mixed sort column in data frame -

i have column in dataframe this... retention_completion_variable_name <- data.frame( retention_completion_variable_name = c( "completed degree in 1 year", "retained midyear year 1", "completed degree in 2 years", "retained midyear year 2", "retained start of year 2" ), retention_completion_value = c(0, 0, 0, 1, 1), stringsasfactors = false ) i want sort column retained midyear year 1 0 retained start of year 2 1 retained midyear year 2 1 completed degree in 1 year 0 completed degree in 2 years 0 this 1 of few cases feel factor() useful: lvls <- c("retained midyear year 1", "retained start of year 2", "retained midyear year 2", "completed degre

c# - How to populate database table from a gridview? -

my question depends upon need populate table in database, gridview. i've populated gridview datatable viewstate. can me? string str = configurationmanager.connectionstrings["constr"].connectionstring; sqlconnection con = new sqlconnection(str); con.open(); sqlcommand cmd = new sqlcommand("select top 1 * bookings", con); sqldatareader reader = cmd.executereader(); if(reader.read()) { bookingid = convert.toint32(reader["id"]); } booking_tax(bookingid);//here have multiple entries taxes same bookingid ok, here go: in code behind foreach loop on grid view rows, this: foreach (gridviewrow rw in gridview1.rows) { var o = new object //in case booking object { id = convert.toint32(gridview1.datakeys[rw.rowindex].value), field1 = rw.cells[1].text.tostring(), field2 = convert.toint32(rw.cells[2].text.tostring()) } using (var context = new yourentities()) {

c++14 - C++ gcc _builtin function gives unexpected answer -

int64_t n=7; after printing __builtin_clz(n) answer 29 rather expected answer 61 . that signature intrinsic using: int __builtin_clz (unsigned int x) as can see works on 32-bit unsigned. treat 64 bit integer 32 one. since 7 has 4 bits set return 32-3 = 29 try __builtin_clzl; or __builtin_clzll instead. details here

SharePoint onprem Rest API calls From Java Application -

getting unauthorized exception, while trying access sharepoint rest apis post requests java web application.as per msdn, formdigest mandatory post requests.how consume sharepoint rest apis non-microsoft applications? i recommend reading post post sharepoint 2013 java . credentials, have used ntlm (windows) authentication so: registry<authschemeprovider> authschemeregistry = registrybuilder.<authschemeprovider>create() .register(authschemes.ntlm, new jcifsntlmschemefactory()) .register(authschemes.basic, new basicschemefactory()) .register(authschemes.digest, new digestschemefactory()) .register(authschemes.spnego, new spnegoschemefactory()) .register(authschemes.kerberos, new kerberosschemefactory()) .build(); closeablehttpclient httpclient = httpclients.custom() .setdefaultauthschemeregistry(authschemeregistry) .build(); ntcredentials creds = new ntcredentials(user, password, workstation, domai

ios - Freeform Width affects the loaded view -

Image
i have defined .xib file 2 buttons of freeform style. when load view view either there space left @ right phones iphone 7 plus , in phones iphone 5s half button visible. this .xib file. this image after loading in iphone5s this image after loading in iphone 7plus

java - Jsoup cleaning my html -

i'm trying learn how use jsoup cleaning html code. i want remove <body> tag example <p> tag must stay: public class prb { public static void main(string[] args) throws exception { string = "<p>text 1234 <body>wow</body> text 1234</p><p>text 1234</p>"; system.out.println(getstringwithouthtmltags(i)); } public static string getstringwithouthtmltags(string text) { whitelist asd = new whitelist(); asd.addtags("<p>", "</p>"); asd.removetags("<body>, </body>"); return jsoup.clean(text, asd); } } but removes tags. output is: text 1234 wow text 1234 text 1234 what doing wrong? thank in advance. you made mistake on writing tags , because asd.addtags("<p>", "</p>"); heavy because have twice p , <,>,/ useless so documentation says : asd.add

python - Retrieving all iterator values from generator function -

let's have generator function yields 2 values: def gen_func(): in range(5): yield i, i**2 i want retrieve iterator values of function. use code snippet purpose: x1, x2 = [], [] a, b in gen_func(): x1.append(a) x2.append(b) this works me, seems little clunky. there more compact way coding this? thinking like: x1, x2 = map(list, zip(*(a, b a, b in gen_func()))) this, however, gives me syntax error. ps: aware shouldn't use generator purpose, need elsewhere. edit: type x1 , x2 work, however, prefer list case. if x1 , x2 can tuples, it's sufficient do >>> x1, x2 = zip(*gen_func()) >>> x1 (0, 1, 2, 3, 4) >>> x2 (0, 1, 4, 9, 16) otherwise, use map apply list iterator: x1, x2 = map(list, zip(*gen_func())) just fun, same thing can done using extended iterable unpacking: >>> (*x1,), (*x2,) = zip(*gen_func()) >>> x1 [0, 1, 2, 3, 4] >>> x2 [0, 1, 4, 9, 16]

Need to know how to search in ES using c# searching in arrays -

hello newbie on elasticsearch , need help. i'm working c# (thought use queryraw in string think...). below scenario: data { "id": "1", "title": "small cars", "tagscolours": ["grey", "black", "white"], "tagscars": ["suzuki", "ford"], "tagskeywords": [] }, { "id": "2", "title": "medium cars", "tagscolours": [], "tagscars": ["vw", "audi", "peugeot"], "tagskeywords": ["sedan"] }, { "id": "3", "title": "big cars", "tagscolours": ["red", "black"], "tagscars": ["jeep", "dodge"], "tagskeywords": ["van", "big"] } objective id' ap

socialauth - How to whitelist all domain urls in Facebook auth settings -

i have feature when users of website can send emails links posts users (link like: domain/post/[post_id] ). however, when facebook logged user trying open link there information exact link not whitelisted in facebook auth settings: "url blocked: redirect failed because redirect uri not whitelisted in app’s client oauth settings." so question is, how can whitelist website, including dynamic links. for have http://domain set in "valid oauth redirect uris"

java - Difference between processors and threads -

this question has answer here: threads configuration based on no. of cpu-cores 8 answers i using parallel stream of java 8, don't understand 1 thing: i have machine 8 processors... intstream.range(0, 9).parallel().foreach(i -> { int cnt = 0; while (system.currenttimemillis() < rununtil) cnt++; system.out.println(i + ": " + cnt); }) does mean can use 8 threads? the above code runs 8 in parallel , next waiting, if use custom thread pool using forkjoinpool tasks more 8 running in parallel. forkjoinpool forkjoinpool = new forkjoinpool(17); forkjoinpool.submit(()->intstream.range(0, 17).parallel().foreach(i -> { int cnt = 0; while(system.currenttimemillis() < rununtil) cnt++; system.out.println(i + ": " + cnt); })).get(); the above code runs 16 in parallel. if can use more 8 thread

utf 8 - Convert ANSI txt file into UTF8 (Visual FoxPro) -

good day i need on converting ansi txt file utf8 txt file. using foxpro programming language. or xbase the thing creating , writing on txt file using foxpro, need save file utf8 because it´s supossed read system. mycursor alias , strtofile() alias meaningless. trying achieve this: strtofile( strconv(filetostr( "c:\test.txt" ),9), "c:\test_utf8.txt" )

angular2 directives - Angular 2/4. How to disable a checkbox for few seconds when a checkbox is clicked -

i new angular2/4 , angular typescript. want disable checkbox 3 second when user clicks on checkbox make server call. how can in angular 2/4? have included code snippet below: wiz.component.html <div class="table-header header-eligible"> <div class="select-all"> <md-checkbox name="chkselectall" [(ngmodel)]="isselectall" (change)="onselectall()"></md-checkbox> </div> <div>account number</div> <div>client name</div> <div>account type</div> <div class="datatype-numeric">long market value</div> <div class="datatype-numeric">estimated borrowing power</div> </div> <div *ngfor="let e of eligiblearray; let = index;" > <div class="table-content content-eligible"> <div> <md-checkbox name="chkselec

JavaFX Text in TextFlow ignores StyleClass? -

i try use javafx textflow view styled text. following code not text styling. public node createtext(string t,string cls){ text ret = new text(t); ret.getstyleclass().add(cls); return ret; } when replace text label works properly, things \n not work anymore. how can use text class css classes? edit: requested short example of default.css .defaultelementattr{ -fx-text-fill:#48a711; } -fx-text-fill css property of label not css property of text . if want change color of text object css, use -fx-fill property: .defaultelementattr { -fx-fill:#48a711; }

pie chart - Google Piechart -

i try create pie chart on website, found example code <div id="piechart"></div> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // load google charts google.charts.load('current', {'packages':['corechart']}); google.charts.setonloadcallback(drawchart); // draw chart , set chart values function drawchart() { var data = google.visualization.arraytodatatable([ ['task', 'hours per day'], ['work', 8], ['eat', 2], ['tv', 4], ['gym', 2], ['sleep', 8] ]); // optional; add title , set width , height of chart var options = {'title':'my average day', 'width':550, 'height':400}; // display chart inside <d

python-pptx table - keep row height as small as possible -

i want create table short can possibly be, i.e. have smallest row height possible, while fitting prescribed text @ prescribed size. using code: i initialize table: init_table_width = prs.slide_width - inches(0.2) graphicframe = slide.shapes.add_table(rows = len(biosets) + 1, cols=5, left=inches(0.1), top=inches(.76), width=init_table_width, height=prs.slide_height - inches(.76 + 3.2)) table = graphicframe.table i populate table , set cell properties this: for in range(len(biosets)): new_row = ['bioset'+str(i+1)+': '+biosets[i], studies[i], correlation[i], common_genes[i], pvals[i]] rownum += 1 col_index, col_name in enumerate(new_row): cell = table.cell(rownum, col_index) cell.text = col_name cell.margin_left = cell.margin_right = cell.margin_top = cell.margin_bottom = 0; cell.text_frame.paragraphs[0].font.size = pt(7.5) when open ppt presentation, table taller i’d like. can drag bottom of table , reduce height o

node.js - Crypto module is not working with latest node 7.10 -

the following code snippet working in node 0.12.18 (replace buffer.from new buffer ) it's not working latest node version (7.10.0) can explain me why happening?? missing in below code. /* node.js */ var crypto = require('crypto'); var algorithm = 'aes-256-ctr'; var data = "dhanet-kalan-chittorgarh" var encryption_key = "vhuz1dxrhsowweygqunpce4wvayz7vmb"; var encryption_data = _encrypt() console.log('data encryption :: ' + data); console.log('encrypted data :: ' + encryption_data); console.log('decrypted data :: ' + _decrypt(encryption_data)); function _decrypt(_encryption_data){ var decipher, dec, chunks, itr_str; // remove itr string itr_str = _encryption_data.substring(_encryption_data.length-24); _encryption_data = _encryption_data.substring(0, _encryption_data.length-24); decipher = crypto.createdecipheriv(algorithm, encryption_key, buffer.from(itr_str, "base64"));

Parsing SQL query in Java -

i know using prepared statement can set column values. here want is, have list of queries written execute on same table different column values. e.g. select * tablename t1 t1.tablecolumnid=4 , t1.tablecolumnname='test' inner join tablename2 t2 on t1.tablecolumnid=t2.tablecolumnid select * tablename t1 t1.tablecolumnid=6 , t1.tablecolumnname='test' inner join tablename2 t2 on t1.tablecolumnid=t2.tablecolumnid as can see both queries same except tablecolumnid value. want save in collection select * tablename t1 t1.tablecolumnid=? , t1.tablecolumnname='test' inner join tablename2 t2 on t1.tablecolumnid=t2.tablecolumnid so won't have duplicate queries (where values not considered). how can this? one approach consist in defining subset of sql grammar sufficient parse queries, write parser grammar, compare queries , find parts identical, , differ, locate literal values 4 , 6 , 'test' in queries, build (flat) syntactic tree, , c

javascript - How to calculate angle between two planes? -

i have 2 planes, how can calculate angle between them? possible calculate angle between 2 object3d points in case of planes? heres example fiddle: https://jsfiddle.net/rsu842v8/1/ const scene = new three.scene(); const camera = new three.perspectivecamera(45, window.innerwidth / window.innerheight, 1, 1000); camera.position.set(25, 25, 12); var material = new three.meshbasicmaterial({ color: 0x00fff0, side: three.doubleside }); window.plane1 = new three.mesh(new three.planegeometry(10, 10), material); scene.add(plane1); plane1.position.set(0.3, 1, -2); plane1.rotation.set(math.pi / 3, math.pi / 2, 1); window.plane2 = new three.mesh(new three.planegeometry(10, 10), new three.meshbasicmaterial({ color: 0x0fff00, side: three.doubleside })); scene.add(plane2); // setup rest var pointlight = new three.pointlight(0xffffff); pointlight.position.x = 10; pointlight.position.y = 50; pointlight.position.z