Posts

Showing posts from February, 2010

Delphi TDBGrid edit inplace with drop down list -

i have maintenance old delphi v7 application uses tdbgrid allowing inplace editting drop down lists. the issue is: grid show values present @ data source. without editting, no problem @ all. if change value, grid show newly set value after updating underlying register (until "old" value displayed). this applies drop down lists. other input types (checkboxes, text edits) work without problems. the edit works fine: changed values reflected in datasource when register update'd. problem displaying not-yet-update'd value. i have no idea how debug this, or further inspect behavior. if don't have complete answer, please indicate else can find solution. update the project used tdb3dgrid (whose source i'm not aware of), simplify things i've changed tdbgrid. no avail. change true/false columns displayed text, , edited text boxes (displaying , accepting "true" , "false" strings); tdb3dgrid showed checkboxes. other columns (not ed

Serial communication programs - C vs Python -

i have mcu, responds through serial communication. issue following: code worked last week. ser = serial.serial(3,115200) b = ser.write('\x5a\x03\x02\x02\x02\x09') print b time.sleep(1) c = ser.read(7) print c.encode('hex') this supposed print bunch of bytes read mcu. today, reading random bytes not supposed read. once in while read exact bytes supposed read. thought problem laptop serial ports. friend program written in c on same laptop - able read properly. so, dont know question here - problem dont know how troubleshoot. python code basic, should work. thoughts on going on appreciated.

css - How to extend Bootstrap color classes -

i using bootstrap 3.3.0 on site. the 1 thing run contextual classes of primary , info , success , warning , danger can limiting. for instance, have app going require several other colors such purple, yellow , possibly hues in between primary , info . now, before start rolling own color-wheel .css file, know if there , known bootstrap extension on contextual classes. then integrate existing color scheme perfectly. thank you! edit so far nobody has answered post... well, want not myself many others have gone "jeez... wish had 'yellow' color or 'brown' color or 'purple' color..." when using bootstrap, invite color-savvy person scientifically come extension extend these color classes. it shouldn't difficult - there science color-codification (of not particularly trained in) , if proper extension, should done per these standards others may use too. actually, think bootstrap provide 5 contextual colors default , never

node.js - ejs include on click -

i'm trying create dynamically included in ejs page (using <%- include('partials/content') %> ) on node.js project. there way can create variable to-be-included page , change on button click? let's assume partials/content file includes content like: <h1>lorem ipsum dolor sit amet</h1> a file named partials/content2 : <h1>consectetur adipiscing elit<h1> your main template file wrap partials content <div> id result , include script file select <div> using var $result = $('#result'); have in variable. can register click handler on button. on click request wished template file , replace content. main template: <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> </head> <body> <div id="result"> <%- include partials/content.ejs %> </div> <button id="

twitter bootstrap - AngularJs Jquery ng-repeat accordion is not working -

i trying use ng-repeat jquery accordion following how not work @ all: i tried use change cdn order not work well... (html) <html> <head> <script src="https://code.jquery.com/jquery-3.1.0.js" integrity="sha256-slogkvb1k3vokzai8qitxv3vzponkenvskvtkylmjfk=" crossorigin="anonymous"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"> </script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/angular.bootstrap/2.1.2/ui-bootstrap-tpls.min.js"></script> <script type="text/javascript" src="angular.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"> <title>teste</ti

ember.js - Ember Piping Feature -

does ember have similar feature angular2's piping ( https://angular.io/docs/ts/latest/guide/pipes.html )? closest thing found transforms, strictly datastore (ds). want convert text "cat" "dog" everywhere, , don't want stick if statements everywhere. can create utility function this, if there specific feature use that. looking this: let = "cat"; let b = | animal; //animal should convert variable dog console.log(a); // cat console.log(b); // dog i realize can , stick in utilities, want ember way if there one: let animal = function(string) { if(a == "cat") { return "dog"; } } is there built in feature of ember nicely me?

r - Trouble with Slope of a Regression Line in ggplots2 -

Image
i want bubble plot regression line analysis did predicting proportion of votes hillary clinton on bernie sanders in each county's democratic primary. however, geom_smooth() keeps making line wrong slope , intercept. lm out put this: estimate std. error t-value p-value (intercept) 0.146790 0.058166 2.524 0.011737 * assocareer -0.102984 0.020378 -5.054 4.97e-07 *** but graph comes out looking this: my code looks this: ggplot(data, aes(x=assocareer, y=prop.h, color="green")) + geom_point(aes(size =bins, shape="solid",alpha=.2),pch=21, bg='cyan1') + geom_text(hjust = 1, size = 2, label=' ') + coord_cartesian(ylim=c(0,1.5)) + geom_smooth(method="lm", na.rm=t)+ xlab("county level explicit association career-men")+ ylab("proportion of hillary voters")+ ggtitle(paste('proportion of votes clinton on bernie')) can tell why might happening?

mongodb - Can i use replica set name to connect via mongo-connector -

i know, there way can replicate 1 mongo replica set via mongo-connector? per mongo documentation can connect 2 mongo instances via mongo-connector using command in example below, pass replica set name or use configuration file instead of passing server:port name in command line. mongo connector can replicate 1 mongodb replica set or sharded cluster using mongo docmanager. basic usage following: mongo-connector -m localhost:27017 -t localhost:37017 -d mongo_doc_manager i tried config.json option creating below config.json file has failed. { "__comment__": "configuration options starting '__' disabled", "__comment__": "to enable them, remove preceding '__'", "mainaddress": "localhost:27017", "oplogfile": "c:\dev\mongodb\mongo-connector\oplog.timestamp", "verbosity": 2, "continueonerror": false, "logging": {

c# - Entity Framework Eager Loading - pass data to ViewModel -

in asp.net mvc core app, action method shown below, i'm passing blogs data , related data posts table view return view(await _context.blogs.include(p => p.posts).tolistasync()); since i'm passing data 2 tables, need use viewmodel shown below. question : how can use viewmodel pass related data controller action method test() view shown below? in code below i'm getting obvious error : invalidoperationexception: model item passed viewdatadictionary of type 'system.collections.generic.list'1[asp_core_blogs.models.blog]', viewdatadictionary instance requires model item of type 'system.collections.generic.ilist'1[asp_core_blogs.models.blogpostviewmodels.blogswithrelatedpostsviewmodel]'. model : public class bloggingcontext : dbcontext { public bloggingcontext(dbcontextoptions<bloggingcontext> options) : base(options) { } public dbset<blog> blogs { get; set; } public dbset<post> posts { get; s

How to delete an element from an array based off the user input in Ruby? -

i'm not sure i'm going wrong this. have array , user prompted question number should deleted array. number stored , result new array gets outputted deleted value. def delete(number) = [1, 2, 1, 3, 1, 4, 2, 5] puts "please type number deleted?" number = gets result= a.delete(number) puts result end a.delete(number) maybe ? def delete(num,array) array.reject { |el| el == num } puts array end = [1, 2, 1, 3, 1, 4, 2, 5] puts "please type number deleted? array #{a}" number = gets delete(number.to_i,a)

java - Temp 3d array not working -

i making program acts net of 2x2x2 rubik's cube. in method, plan make if statement each of 12 possible moves (up clockwise, counterclockwise, down clockwise, etc.), code turning clockwise not working. "move" string designated in main class , "cube" , "temp" both 3d char arrays containing current state of rubik's cube. "getturn" method rotates face clockwise , takes "cube" twice (once cube editing , once temp variable indeed work), int value of face being turned, , boolean value way being turned. working intended, when try create movement of sides of rubik's cube, temp variable "cube", called "temp" somehow altered code goes, creating incorrect outputs. believe there wrong way temp set up, because not behaving properly. thank helping me out! public char[][][] getmove(char[][][] cube, char[][][] temp, string move) { //0 = u //1 = d //2 = l //3 = r //4 = f //5 = b if(move.

push notification - OneSignal.setSubscription(true) not working on Android? -

when user uninstalls app, onesignal subscribed status changed no (not subscribed) . when user reinstalls app, can add , remove tags , change other info can't change subscribed status yes . in application, i'm calling method onesignal.setsubscription(true) seems not working. doing wrong? public class myapplication extends application { public void oncreate(){ onesignal.startinit(this).init(); onesignal.sendtag("tag", "change_tag"); // working onesignal.setsubscription(true); // not working } ... } i configuring wrong google project number in gradle file. seems onesignal can add/remove tags without google project number, can't subscribe user (which makes sense). manifestplaceholders = [manifestapplicationid: "${applicationid}", onesignal_app_id: "88888888-88888-8888-8888-888888888888", onesignal_google_project_number: "888888888888"

How to launch an F# console app from VS Code -

given simple f# console app: [<entrypoint>] let main argv = printfn "hello world" console.readline() |> ignore 0 what need start console app in same manner ctrl f5 in visual studio. have tried running form fake build script using fake.processhelper: target "run" (fun _ -> let exe = @"c:\source\code\fs_console_app\build\fs_console_app.exe" let errorcode = shell.asyncexec(exe, "", builddir) () ) hitting ctrl f5 receive following build report: target duration ------ -------- build 00:00:00.3916039 run 00:00:00.0743197 total: 00:00:00.5605493 status: ok but no sign of console application starting , waiting input. i have preferred comment long, consider more of workaround answer, i'm not familiar fake. guess run target being executed being swallowed asyncexec or shows in fake output window (try exec) doesn't start new window.

c - MPI - Segmentation fault EXIT CODE: 139 -

i have simple mpi code runs before terminating shows following error. === = bad termination of 1 of application processes = exit code: 139 = cleaning remaining processes = can ignore below cleanup messages =================================================================================== application terminated exit string: segmentation fault (signal 11) typically refers problem application. below source code. /* author ::: khayam anjam */ #include <stdio.h> #include <stdlib.h> #include <mpi.h> int main (int argc, char *argv[]) { int rank, size, ball_value, ball_present; mpi_init (&argc, &argv); mpi_comm_rank (mpi_comm_world, &rank); mpi_comm_size (mpi_comm_world, &size); srandom(rank); int delta = rand() % 13; int random = rand() % 5; if (random == 0) delta = -1*delta; if (rank == 0) { ball_present = 1; ball_value = 0; } else ball_present = 0; while (1) {

javascript - height computation with ie11 -

i have 4 divs, in 2x2, , height of 4th div calculated such: 4th.style.height = 2nd.offsetheight + 1st.offsetheight - 3rd.offsetheight. the first 3 div's heights calculated based off of content. in firefox , chrome, works expected. however, in ie 11 works sometimes. browser width increases (and heights of other divs change), line perfectly, , right column (divs 3 , 4) pushed down small amount. logged heights console, , changed browser size tiny amount toggling between working , not working, , log 4 heights stayed same?? prone think there rounding error going on here, quite confused.

java - CQEngine In Clause with MultiValueNullableAttribute -

i have class object1 has list of longs called tags. have list of longs called tagstosearch. how can construct query using cqengine following: select * object1 tags in (tagstosearch) if knows how using cqengine please let me know. this should trick: package com.googlecode.cqengine; import com.googlecode.cqengine.attribute.*; import com.googlecode.cqengine.query.query; import com.googlecode.cqengine.query.option.queryoptions; import com.googlecode.cqengine.query.parser.sql.sqlparser; import java.util.*; import static com.googlecode.cqengine.codegen.attributebytecodegenerator.*; import static com.googlecode.cqengine.query.queryfactory.*; import static java.util.arrays.aslist; public class tagsexample { static class myobject { final string name; final list<long> tags; public myobject(string name, list<long> tags) { this.name = name; this.tags = tags; } static final attribute<myobjec

python - Unable to calculate exact cube root -

this question has answer here: is floating point math broken? 20 answers i'm solving cryptographic problem, i need cube root of 4.157786362549383e+37 , gives me 3464341716380.1113 using x = x ** (1. / 3) i thought weird @ first, did try: x=1000 print(x) x= pow(x,1/3) print(x) but got 9.99999998 i have tried somewhere else . got same result. there wrong? how can calculate true cube root? due floating-point arithmetic, hard represent. using decimal resolves still problematic in numbers, , allows rounding integrals. try using decimal so: >>> (1000 ** (decimal(1)/3)).to_integral_exact() decimal('10')

How to construct petsc matrices? -

i'm using petsc4py , face problems. have number of small petsc dense matrices mij, , want construct them big matrix m this: [ m11 m12 m13 ] m = | m21 m22 m23 | , [ m31 m32 m33 ] a mcve code showing below, , i'm using python wrap of petsc, however, grammars similar. import numpy np petsc4py import petsc msizes = (5, 8, 6) mij = [] # create sub-matrices mij in range(len(msizes)): j in range(len(msizes)): temp_m = petsc.mat().create(comm=petsc.comm_world) temp_m.setsizes(((none, msizes[i]), (none, msizes[j]))) temp_m.settype('mpidense') temp_m.setfromoptions() temp_m.setup() temp_m[:, :] = np.random.random_sample((msizes[i], msizes[j])) temp_m.assemble() mij.append(temp_m) # have 4 sub-matrices. # construct them big matrix m. m = petsc.mat().create(comm=petsc.comm_world) m.setsizes(((none, np.sum(msizes)), (none, np.sum(msizes)))) m.settype('mpidense') m.setfr

Coq adding a new variable instead of using the correct one -

i'm working on own implementation of vectors in coq, , i'm running bizarre problem. here code far: inductive fin : nat -> type := |fz : forall n, fin (s n) |fs : forall n, fin n -> fin (s n). definition emptyf(a : type) : fin 0 -> a. intro e; inversion e. defined. inductive vec(a : type) : nat -> type := |nil : vec 0 |cons : forall n, -> vec n -> vec (s n). definition head(a : type)(n : nat)(v : vec (s n)) : := match v |cons _ => end. definition tail(a : type)(n : nat)(v : vec (s n)) : vec n := match v |cons _ w => w end. fixpoint index(a : type)(n : nat) : vec n -> fin n -> := match n n return vec n -> fin n -> |0 => fun _ => emptyf _ |s m => fun v => match |fz _ => head v |fs j => index (tail v) j end end. everything tail compiles fine, when try compile index , receive following error: error: in environment ind

How can I trace the root cause of Neo4j 404 transaction errors? -

we seeing frequent occurrence of neo4j transaction 404 errors transaction being rolled back. i've checked , tried correlate http , message logs aside http , message logs, there other ways can try find root cause of transaction 404 errors? there other logs available? should looking in logs?

ssh - running rsync in crontab with keys -

i having issues running rysnc in crontab. it's own users's crontab runs user, , i've set passwordless rsa keys. when run rsync job on shell console, works. when import crontab, says ran in /var/log/syslog, don't see folder synced. my crontab super simple: * * * * * rsync -av --delete myuser@mybox:/home/backup/ /home/backup i believe crontab not picking user's environment. if following, can see environment variables: * * * * * env >> /tmp/my_env_variables this outputs cat /tmp/my_env_variables language=en_us.utf-8 home=/home/myuser logname=myuser path=/usr/bin:/bin lang=en_us.utf-8 shell=/bin/sh pwd=/home/myuser i don't have env variables such as: ssh_auth_sock=/tmp/ssh-uapl7niovj/agent.103170 what's right way import env variables need in cron? from man 5 crontab : an active line in crontab either environment setting or cron command. environment setting of form: name = value however, requiring ssh agent present

Correct xml escaping in Java -

i need convert csv xml , outputstream. rule convert " &quot; in code. input csv row: {"test":"value"} expected output: <root> <child>{&quot;test&quot;:&quot;value&quot;}</child> <root> current output: <root> <child>{&amp;quot;test&amp;quot;:&amp;quot;value&amp;quot;}</child> <root> code: file file = new file(filepath); bufferedreader reader = null; documentbuilderfactory domfactory = documentbuilderfactory.newinstance(); documentbuilder dombuilder = domfactory.newdocumentbuilder(); document newdoc = dombuilder.newdocument(); element rootelement = newdoc.createelement("root"); newdoc.appendchild(rootelement); reader = new bufferedreader(new filereader(file)); string text = null; while ((text = reader.readline()) != null) { element rowelement = newdoc.createelement("child"); rootelement.appendchild(rowelemen

big o - intersection algorithm O(n) better way? -

let s1 , s2 2 sets of integers, such |s1| = |s2| = n. all integers obtained domain [1, 20n]. give algorithm report integers in s1 ∩ s2 in o(n) worst-case time. i'm confused, why have given me domain? know count sort both lists in o(n) + o(n) time, , use 2 pointer method compare elements in o(n) time. i feel if i'm missing or there better way? your way works, here way feel little less complicated sorting , iterating. follows idea of count sorting, or radix sorting, slight twist. create array of size 20n. iterate through first , second set , increment each index match value on in array created. iterate through array created , print out indices value of 2 in them. this o(n).

functional programming - How to best declare a val being a Seq of previously declared vals in the block in Scala? -

a quite typical use case: object (or class) declares several public vals of related types, , declare accessor returning collection containing of them: case class ball(dia :int) object balls { val tennis = ball(7) val football = ball(22) val basketball = ball(24) val balls = seq(tennis, football, basketball) } this example violates dry , error prone. can quite solved using mutable state (such adding implicit builder[ball, seq[ball]] parameter ball constructor. solution isn't without issues, either. particularily once try generalize solution and/or have class hierarchy every class declares values, moment when should switch mutable partial summary final immutable value not clear. more intellectual exercise , out of curiosity trying come purely functional variant, without success. best came is object balls { import shapeless.{::, hnil} val (balls @ tennis ::football::basketball::hnil ) = ball(7)::ball(22)::ball(24):

TCP TIME_WAIT Assassination -

i looked rfc1337 time_wait assassination , portion of it. figure 1 shows example of time-wait assassination. segments 1-5 copied figure 13 of rfc-793, showing normal close handshake. packets 5.1, 5.2, , 5.3 extension this sequence, illustrating twa. here 5.1 any old segment is unacceptable tcp a. might unacceptable because of its sequence number or because of old paws timestamp. in either case, tcp sends ack segment 5.2 current snd.nxt , rcv.nxt. since has no state connection, tcp b reflects rst segment 5.3, assassinates time-wait state @ a! ** rfc 1337 tcp time-wait hazards may 1992 tcp tcp b 1. established established (close) 2. fin-wait-1 --> <seq=100><ack=300><ctl=fin,ack> --> close-wait 3. fin-wait-2 <-- <seq=300><ack=101>&

python - Installing BioPython and Numpy -

i working python 2.7.11. i've working problems on rosalind.com scratch, decided try using tools openly available- in order start familiarizing myself finding , using said packages , extensions. thing too, because can't figure out how of third party extensions python installed. let's start numpy. pdf i'm following install biopyton suggests use. http://biopython.org/dist/docs/install/installation.pdf i'm going in circles looking isntruction. wants send me other app uses numpy or biopython, installed anaconda , took off. i hear talk of using 'the terminal', think windows command prompt. i've downloaded files sources both programs. need put files somewhere special first? before opening cammand prompt , issuing command of form "python setup install"? i placed both sets of files in python folder, before trying command prompt realized both have setup files. i looking executable setup file, double-clicking on setup files downloaded does

maven - how to upgrade package in npm -

i new maven/npm , use maven build project. error occurs when execute mvn clean install -dskiptests : [info] unpacking /usr/local/mavenrepository_be/org/opendaylight/odlparent/odl-license/0.0.1-beryllium/odl-license-0.0.1-beryllium.jar /home/chenxing05/beryllium/dlux/dlux-web/target/classes includes "" , excludes "meta-inf/**" [info] [info] --- frontend-maven-plugin:0.0.24:install-node-and-npm (npm) @ dlux-web --- [info] node v0.12.7 installed. [info] found npm version 3.1.3 [info] [info] --- frontend-maven-plugin:0.0.24:npm (npm) @ dlux-web --- [info] running 'npm install --color=false' in /home/chenxing05/beryllium/dlux/dlux-web [error] npm warn deprecated minimatch@0.4.0: please update minimatch 3.0.2 or higher avoid regexp dos issue [info] underscore@1.4.4 node_modules/jshint/node_modules/underscore -> node_modules/grunt-contrib-jshint/node_modules/underscore [info] minimatch@0.4.0 node_modules/jshint/node_modules/minimatch -> node_modules/gru

c# - How to update multiple rows in a table without using a loop? -

i'm there must way this, executenonquery wouldn't exist if couldn't alter more 1 row @ time, can't figure out how. @ moment i'm updating values in customer table code: (int = 0; < datagridview1.rowcount; i++) { string connectionstring = @"data source = a103-17\sqlexpress17; initial catalog = carrental; integrated security = true"; string myupdate = "update [carrental].[dbo].[customer] " + // "set [customerid] = @customerid, " + "set [firstname] = @firstname, " + "[lastname] = @lastname, " + "[streetno] = @streetno, " + "[streetname]= @streetname, " + "[suburb] = @suburb, " + "[state] = @state, " + "[postcode] = @postcode, " + "[mobphone] = @mobphone, " + "[driverlicno] = @drive

unity3d - Getting error saying MissingReferenceException in unity 5 c# -

in unity car game project, have four car(one player car) respective four indicators (one main indicator) . indicator moves vertically upward on update function , each indicator move random speed. in case of car, player car not move upward , downward, moves left , right user . other car not move left,right,forward,backward. rather other car shows forward , backward move animation difference between indicators(there 4 indicator, indicators means 3 indicator references 3 cars other player car) , main indicator position(main indicator reference player car). i have 2 scene, 1 user interface ( contain play button,exit button etc.). , scene game play . when click on play game button goes game scene , racing game start no error. after completion of game, user interface scene loads automatically saying "replay game", "exit game". in case if click on "replay game" button, game scene opens , indicator start move car not move( not show animation) respect

Ant WsImport throwing errors during compiling generated java files in gradle -

i generating web service clients using gradle ant wsimport task , packaging clients -clientjar option -xnocompile set false . during compilation of generated java code xcompile option, throwing exception ( [ant:wsimport] compilation failed, errors should have been reported ) due dependencies (package abc.customdateadapter not exist) on generated java files not resolved. i supplying jaxb global binding file wsimport task in have customized xsd:date bindings customdateadapter. package import of customdateadapter not resolved on generated java files during ant wsimport. the unresolved customdateadapter package in projecta compile time , buildscript classpath dependency current project. still ant wsimport not picking classpath dependency during compiling generated java files. can please suggest how add external project classpath dependency ant wsimport task. i have figured out issue on own. created custom dependency configuration ant wsimport , declared required ja

javascript - How to pass value of radio button to another form field using jquery? -

i want pass value either no or 1 input name="auth[]" below. <td> send <input type="radio" name="authorized[]'.$c.'" id="send'.$c.'"value="1" checked> </td> <td> no <input label="no" type="radio" name="authorized[]'.$c.'" id="no'.$c.'"value="no" > <input name="auth[]" type="hidden" class="mailclass" id="auth'.$c.'" value="" /> </td> this code pass no value, if reverse decision , re-select send, not switch value 1 . $(document).ready(function() { var x='1' $( "input:radio" ).each(function() { $(this).click(function() { x=$(this).val(); alert(x); $(this).next('.mailclass').val(x); }) }) }) it's selector. $(this).next... isn't w

Couldn't find Docker Tool Window IntelliJ IDEA 2016.2.4 (Ultimate) -

Image
i not able find docker tool window on intellij idea 2016.2.4 docker integration plugin installed on ide, however, not able find docker tool window . tried re-installing docker integration plugin no luck. how make docker tool window avaiable? version docker integration plugin: 2.3.3 edit 1 docker clouds config docker registry config docker machine config that plugin ( see documentation ) still requires prerequisites (it not standalone product) in particular, need docker installed first. see " docker installation windows ". the docker tool windows documentation mentions : for tool window available, docker integration plugin must installed , @ least 1 docker configuration must defined.

python - reading data in tensorflow - TypeError("%s that don't all match." % prefix) -

i trying load following data file (with 225805 rows) in tensor flow. data file looks this: 1,1,0.05,-1.05 1,1,0.1,-1.1 1,1,0.15,-1.15 1,1,0.2,-1.2 1,1,0.25,-1.25 1,1,0.3,-1.3 1,1,0.35,-1.35 the code reads data is import tensorflow tf # read in data filename_queue = tf.train.string_input_producer(["~/input.data"]) reader = tf.textlinereader() key, value = reader.read(filename_queue) record_defaults = [tf.constant([], dtype=tf.int32), # column 1 tf.constant([], dtype=tf.int32), # column 2 tf.constant([], dtype=tf.float32), # column 3 tf.constant([], dtype=tf.float32)] # column 4 col1, col2, col3, col4 = tf.decode_csv(value, record_defaults=record_defaults) features = tf.pack([col1, col2, col3]) tf.session() sess: coord = tf.train.coordinator() threads = tf.train.start_queue_runners(coord=coord) in range(225805): example, label = sess.run([features, col4]) coord.request_stop() coord.jo

How to perform linear regression in BigQuery? -

bigquery has statistical aggregation functions such stddev(x) , corr(x, y), doesn't offer functions directly perform linear regression. how can 1 compute linear regression using functions exist? the following query performs linear regression using calculations numerically stable , modified work on input table. produces slope , intercept of best fit model y = slope * x + intercept , pearson correlation coefficient using builtin function corr. as example, use public natality dataset compute birth weight linear function of duration of pregnancy, broken down state. write more compactly, use several layers of subqueries highlight how pieces go together. apply dataset, need replace innermost query. select bucket, slope, (sum_of_y - slope * sum_of_x) / n intercept, correlation ( select bucket, n, sum_of_x, sum_of_y, correlation * stddev_of_y / stddev_of_x slope, correlation (

groovydsl - Groovy DSL with IDE support for completion -

i in need of dsl has known structure , lot of only known @ runtime structure. for eg: test "name goes here"{ description : """ description """ create user { id : 1 fn : """ x """ ln : """ y """ } assert user.name == "x" delete user { id = 1 } user1 = user (1) assert user1 == null } in above snippet, keywords test , create , get , delete etc known during development of dsl/tooling. but, when user invokes content assist after create . want download schema files (rather, have downloaded schema first step of processing , cache schema) , offer entities, of user 1 of entities. , when user invokes content assist properties, again entity definition , offer fn , ln etc possible entries there. is doable groovy , gdsl? thank you

mongodb - Pymongo cursor returns incomplete results -

i have 2 following scenarios using pymongo: cursor = db.col.find({'_id':{'$in':list_of_ids}}) returns 87 records, while list_of_ids 335 in length. stuff = [] item in list_of_ids: stuff.append(list(db.col.find({'_id':item}) returns of 335. don't want hit db 335 times, need records. couldn't find in documentation. exhaust cursor seems nice couldn't figure how set it. next() method iterates 1 one. list(cursor) still returns 87. does have suggestions?

ios - UIScreen class is gone in ios10 simulator sdk -

i used [[uiscreen mainscreen] bounds].size.width code before ios10. when build code using ios10 simulator sdk, occurs error "receiver 'uiscreen' class message forward declaration no known class method selector 'mainscreen'". and know uiscreen class not existed in ios10 simulator sdk not ios10 sdk. first, different built in ios10 sdk ios10 simulator ?? , second, how can handle compile error.

android - what is the use of enterAlwaysCollapsed -

Image
i studing support design liabrary.i cannot understand use of enteralwayscollapsed.it seems influece on pull down,but tried , find nothing changed. so,what use of enteralwayscollapsed,could show me demo? let me answer myself. first activity theme apptheme. <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <!-- customize theme here. --> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="coloraccent">@color/coloraccent</item> </style> and don't set fitssystemwindows in xml. last use scroll flag scroll|enteralways|enteralwayscollapsed. final effect below

How to implement delegate and datasource methods for UICollectionView when it is inside a custom TableViewCell in iOS, objective C -

note : don't want use third party libraries i have tableview with custom table view cell (table view working fine). now inside table view cell want implement collection view . now problem , should implement delegate methods , data source methods collection view, inside custom table view cell . below have tried. tabel view controller implementation - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return 5; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { firsttableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"tvcell"]; return cell; } working properly now inside firsttableviewcell there collection view . this firsttableviwecell.h file #import <uikit/uikit.h> @interface firsttableviewcell : uitableviewcell<uicollectionviewd

java - android broadcast receiver and service to get notification -

hi have used following code in receiver class public class alarmreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { log.e("the time right","yay!"); intent = new intent(context, alarmservie.class); context.startservice(i); } } here code used in service class public class alarmservie extends service { @nullable @override public ibinder onbind(intent intent) { return null; } @override public void onstart(intent intent, int startid) { super.onstart(intent, startid); log.e("onstart:","came" ); /* notificationmanager notifyman = (notificationmanager) getsystemservice(notification_service); intent main_activity = new intent(this.getapplicationcontext(), mainactivity.class); pendingintent o = pendingintent.getactivity(this, 0, main_activity, 0); /*notification noti = new notific

jsf - How to update primefaces attribute? -

i have <p:commandbutton disabled="#{scannerstatus.disabled}" actionlistener="#{scannerstatus.activate}" id="button-id"/> in scannerstatus have: private boolean disabled; // plus geters , setters public void activate() { this.setdisabled(true); boolean status = doanaction(); // takes seconds if (!status) { dosomething(); } else { this.setdisabled(false); } } the problem disabled attribute of commandbutton not change when this.setdisabled(true) line activate method called. i need seconds disabled attribute commandbutton true . the disabled property set false , disabled attribute commandbutton updated. update in commandbutton takes place after function ends. how can update attribute of commandbutton when this.setdisabled(true) in method activate? i have tried use requestcontext.getcurrentinstance().update("button-id"); after this.setdisabled it&#

java - Spring MVC HandlerInterceptor : Redirect Failed -

i have created simple webmvc application - handler interceptor configured. interceptors responsibility simple - should check if valid session exists in httprequest - , if true, redirect registration page. the issue encounter on redirect - browser throwing message: the page isn't redirecting properly firefox has detected server redirecting request address in way never complete. the interceptors code follows: public class logininterceptor extends handlerinterceptoradapter{ // used checking session management user. @override public boolean prehandle(httpservletrequest request, httpservletresponse response, object handler) throws exception { system.out.println(" <interceptor> - pre handle"); return true; } @override public void posthandle(httpservletrequest request, httpservletresponse response, object handler, modelandview modelandview

jdbc - Run dbisql in Java Program -

i build sybase-iq 16.0 on red-hat 7 server. i try use dbisql bulk load data in sybase. and successful command in sybase server: dbisql -nogui -c "uid=dba;pwd=sql;dwn=iqtry;host=172.16.50.137:2643;" -onerror continue read /ext_load/load_test_data.sql but need in java program project requirement, program below: import java.io.*; import java.sql.*; import java.util.*; import java.sql.connection; import java.sql.date; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; public class test { public static void main(string[] args) throws sqlexception { string dburl = "dbisql -nogui -c 'uid=dba;pwd=sql;dwn=iqtry;host=172.16.50.137:2643;' -onerror continue read /sybase/iq_load/load_dba.atest.sql"; // connect sybase database connection con = drivermanager.getconnection(dburl); statement statement = con.createstatement(); }} and can compile in syabse server, when run class, got followin

angular - How to configure Mathjax in Ionic 2 -

we have requirement display equations in mobile app developing in ionic 2. is else tried same , it's working? how include external javascript libraries in ionic 2? i tried mathjax in sample ionic app , it's working fine. https://github.com/prithivirajg/ionic2mathjaximpl link sample project tried, it's working online mathjax impletation i.e., work internet. wanted make offline, open make changes code , make offline , others can benefit on it.

sql server 2012 merge values from two tables -

i have 2 tables tbla(sn, id int pk, name varchar(50), amounta decimal(18,2)) and tblb(id int fk, amountb decimal(18,2)) here: tbla occures once , tblb may occure multiple time need query display data like: sn id name amounta amountb balance 1 1001 abc 5000.00 5000.00 2 1002 xyz 10000.00 1002 4000.00 6000.00 (amounta-amountb) 3 1003 pqr 15000.00 1003 4000.00 1003 3000.00 1003 2000.00 6000.00 (amounta-sum(amountb)) please ask if confusion tried using lag , lead function couldnot desire result, please help. since using sql server 2012, can use partition aggregate function ( sum ): select t.sn, t.id, t.name, t.credits amounta, t.debits amountb, sum(t.credits - t.debits) on (partition t.id order t.debits, t.credits) balance ( select sn, id, name, amounta credits, 0 debits tbla union select 0 sn,

date - My Logic is working fine, but seems too vague.Is there any other easy way to convert "Aug/2016" to "08/2016" in java? -

is there other easy way convert " aug/2016 " " 08/2016 " in java? my logic working fine, seems vague. string mydate = "aug/2016"; string str = mydate.split("/")[0]; date date; try { date = new simpledateformat("mmmm").parse(str); calendar cal = calendar.getinstance(); cal.settime(date); system.out.println("##### ----- month in number : " +cal.get(calendar.month+1)); int year = calendar.getinstance().get(calendar.year); int mnth = cal.get(calendar.month) + 1; str = string.valueof(mnth+"/"+year); system.out.println("##### ----- new selected date : " +str); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } suggestions please!... simply

php - DateTime period issues -

i've got strange behaviour datetime's in php. reason code produces wrong result: $period = new dateperiod( new datetime('2017-03-20'), dateinterval::createfromdatestring('1 day'), new datetime('2017-03-31') ); foreach($period $dt){ $a[] = $dt->format('y-m-d'); } so expected result period 20 31, it's not. here actual result: array ( [0] => 2017-03-20 [1] => 2017-03-21 [2] => 2017-03-22 [3] => 2017-03-23 [4] => 2017-03-24 [5] => 2017-03-25 [6] => 2017-03-26 [7] => 2017-03-27 [8] => 2017-03-28 [9] => 2017-03-29 [10] => 2017-03-30 ) so i'm missing here, or that's php bug? following this user statement on official php documentation dateperiod:: [...] example include end date using datetime method 'modify' this class seems ignore end date. need modify end date include gap (of +1

python - Should a connection to Redis cluster be made on each Flask request? -

i have flask api, connects redis cluster caching purposes. should creating , tearing down redis connection on each flask api call? or, should try , maintain connection across requests? my argument against second option should try , keep api stateless possible, , don't know if keeping persistent across request might causes threads race conditions or other side effects. however, if want persist connection, should saved on session or on application context? this performance , scale. 2 buzzwords buzzing you'll in fact need persistent connections. eventual race conditions no different reconnect on every request shouldn't problem. rcs depend on how you're using redis, if it's caching there's not room error. i understand desired stateless-ness of api client sides pov, not sure mean server side. i'd suggest put them in application context, not sessions (those become numerous) whereas app context gives optimal 1 connection per process (and crea

ios - Parsing JSON with dynamic keys in Swift -

this question has answer here: how obtain values without key of dictionary? 1 answer i trying parse json files url. json has key dynamic, in changes per file. right code looks this: let json = try nsjsonserialization.jsonobjectwithdata(data!, options:.allowfragments) // parsing if let stations = json["observations"]!!["-10019482"] as? [[string: anyobject]] { observation in stations { if let name = observation["stationname"] as? string { if let temperatuuri = observation["temperature"] as? string { if let windspeed = observation["windspeedms"] as? string { print(name, temperatuuri, windspeed,"m/s")

android - Navigation Drawer RTL lang -

i'm using navigation drawer in 1 of app activity it's open left right how can change right left , icon direction try layout_gravity:right; force closed happened during running app did not answer other question app minimum sdk set 15 here activity_main.xml <?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:fitssystemwindows="true" tools:opendrawer="start" > > <include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="match_parent&q