Posts

Showing posts from February, 2015

python - SQLAlchemy Datetime Differences -

in sqlalchemy, can query similar to: self.session.query(jobsrunning).filter((datetime.datetime.utcnow() - jr.start_time) > datetime.timedelta(hours=3)).all() this fails because i'm assuming datetime.datetime.utcnow() returns double after being subtracted jr.start_time . there way around without pulling datetime.datetime.utcnow() outside of query itself? for some, may make query cleaner.

docker - How to mimic '--volumes-from' in Kubernetes -

Image
i'm looking pattern allows share volumes between 2 containers running on same pod in kubernetes. my use case is: have ruby on rails application running inside docker container. docker image contains static assets in /app/<app-name>/public directory, , need access assets nginx container running alongside in same pod. in 'vanilla' docker have used --volumes-from flag share directory: docker run --name app -v /app/<app-dir>/public <app-image> docker run --volumes-from app nginx after reading doc: https://github.com/googlecloudplatform/kubernetes/blob/master/docs/volumes.md tried (only relevant entries presented): spec: containers: - image: <app-image> name: <app-name> volumemounts: - mountpath: /app/<app-name>/public name: assets - image: nginx name: nginx volumemounts: - mountpath: /var/www/html name: assets readonly: true volumes: - n...

javascript - jQuery Text Editor (jqte), using change event -

i trying write code change() event using jquery text editor (jqte) , have 2 functions give jqte functionality textarea's one editors loaded javascript, when clicking elements in page function onloadeditor(){ jquery(".comment-editor").jqte({ // jqte params, such fsize: false,indent: false... change: function(){ observeeditor(); } }); } and other, generic function, pages 1 single editor jquery(function() { jquery(".comment-editor").jqte({ // jqte params, such fsize: false,indent: false... change: function(){ observeeditor(); } }); }); i want access id of concrete textarea (all textareas in page have id) has fired change() event how should write observeeditor() function achieve this? or... how should define function in jqte change property? after reading jquery blur event id , value have solved it, following code (simplified) function onloadeditor(){ jquery(".comment-editor...

Java_HOME not found when changed shell from Bash to Zsh on OSX? -

this weird, have set java_home mac can found when using bash shell, if change shell, message saying java_home not set. going on here? when set java_home in shell, active , available context, , gone when close shell. instead either change global environment (or) .bashrc include it. every time start shell, variable available. edit .profile or .bash_profile include java_home. export java_home=`/usr/lib....` and below command return path java home directory. /usr/libexec/java_home -v 1.7 where 1.7 version want.

Java 3D LWJGL collision -

i making 3d java game lwjgl library, , wondering how add collision detection, player not go through models. i using obj models. here objloader class, loads models: package renderengine; import java.io.bufferedreader; import java.io.file; import java.io.filenotfoundexception; import java.io.filereader; import java.util.arraylist; import java.util.list; import models.rawmodel; import org.lwjgl.util.vector.vector2f; import org.lwjgl.util.vector.vector3f; public class objloader { public static rawmodel loadobjmodel(string filename, loader loader){ filereader fr = null; try { fr = new filereader(new file("res/"+filename+".obj")); } catch (filenotfoundexception e) { system.err.println("couldn't load file!"); e.printstacktrace(); } bufferedreader reader = new bufferedreader(fr); string line; list<vector3f> vertices = new arraylist<vector3f...

javascript - How to hide JWPlayer 6 play button? -

i using jwplayer 5, right moving jwplayer 6. <script> jwplayer('myelement2').setup({ file: 'intro.mp4', image: 'intro.png', skin: 'stormtrooper', icons: 'false' // doesn't work on jwplayer 6 }); jwplayer('myelement2').getplugin("display").hide(); </script> on jwplayer 5 icons: 'false' , there no play button. the best way create own skin, , leave element out of definition. think can little brute-force css: <style> .jwdisplayicon { display: none !important; } </style> clicking video frame still start playback.

c# - How to set ItemsSource value of ColumnSeries? -

i not able set itemssource value of columnseries . following examples ( this , this ) seem out dated. here xaml : <charting:chart x:name="columnchart" horizontalalignment="center" verticalalignment="center" width="auto" height="auto"> <charting:columnseries title="georgi kyuchukov" margin="0" name="columnchartseries" independentvaluepath="name" dependentvaluepath="pts" isselectionenabled="true" /> </charting:chart> and here c# code: public class chartdata { public string name { get; set; } public int pts { get; set; } } protected override void onnavigatedto(navigationeventargs e) { list<chartdata> personaldata = (list<ch...

Explanation of "sed" in a shell command -

i used following command extract first "result" multiple files , write them in file. for file in *.xml; cat $file | grep result | sed -n 2p | sed s:"<result>":"": | sed s:"</result>":"": >> tmp.txt; done i looking @ after 2 years , can't remember how picked number in first "result"(0.018300606384717713) 2 of them (the second 1 -0.083118623723832552 )from files like: <?xml version="1.0" encoding="utf-8"?> <fit_results> <input_file>/users/hunululu/desktop/current/m203/ratios/tmp.xml</input_file> <time>fri oct 17 17:45:51 2014</time> <fit_converged>true</fit_converged> <iterations>3</iterations> <dof>1</dof> <chi_sqr_per_dof>0.088802954844880599</chi_sqr_per_dof> <q>0.76570450204332174</q> <parameter_values> <parameter> <name>a</name> ...

html5 - Html audio control dissapears after page load -

i have tried following code <audio controls> <source src="pop.wav" type="audio/wav" > browser doesn't support audio element </audio> but when open html file in browser audio control pops , disappears.why audio control not being displayed in page. thanks

Python psutil memory does not match linux command -

i want know why psutil's virtual memory used or active not match value linux command 'free -m' want know physical system memory used. virtual_memory().total / 1024 / 1024 = 29741 virtual_memory().used / 1024 / 1024 = 7967 virtual_memory().active / 1024 / 1024 = 2259 total used free shared buff/cache available mem: 29741 1148 21773 16 6819 28322 swap: 0 0 0 i'm guessing virtual_memory().used returns physical mem + shared mem + cached mem still, active memory should match 1148.

c - Segmentation faults while opening file -

i'm getting confused right now. want create file , write string created before. when following code gets executed there happens segmentation fault error , program terminates. file* output; output = fopen("test.txt", "w"); fprintf(output, line); fclose(output); the line declared following. char* line = null; line = malloc(1048576 + 1); first i've considered error appears because of malloc, code isn't working either: file* output; output = fopen("test.txt", "w"); fprintf(output, "lbasdhasd"); fclose(output); what doing wrong? in code runs before lines i've used file pointer file closed. your code bad not check errors. output null pointer (and one): #include <errno.h> #include <string.h> file* output; output = fopen("test.txt", "w"); if(!output){ //handle error printf("something went wrong: %s", strerror(errno)); exit(1); } fprintf(output, ...

mysql - How to write SQL Query for this condition -

i have 2 tables 1 "batch" , 1 "batchdetails". batch have columns batchid,batchname, , techid. batchdetails have columns batchdetailsid,batchid , subtechid. batchdetails table connected batch table "batchid". there 1 many relationship between "batch" , "batchdetail" table. 1 batch have multiple entries in batchdetails table. now want select batchname batch techid=1 , corresponding batchname, batchdetails table have subtechid=1 , subtechid=2. there's several approaches returning specified result. assuming specification return only rows batch have @ least 2 associated rows in batchdetails , , @ least 1 of associated rows subtechid=1 , @ least 1 subtechid=2 for mysql: select b.batchname batch b join batchdetail d1 on d1.batchid = b.batchid , d1.subtechid = 1 join batchdetail d2 on d2.batchid = b.batchid , d2.subtechid = 2 b.techid = 1 group b.batchid order b.batchname it...

c++ - Word variable when assigned to int type variable,it has ffff in front of it...why? -

short ab = 0x8400; word val = ab; int val1 = ab; cstring strmsg = _t(""); strmsg.format(_t("value of val1 = %x"), ab); afxmessagebox(strmsg); then ab has 0xffff8400 why? 0xffff come ? short ab = 0x8400; assuming short 16 bits, value 0x8400 (decimal 33792) cannot represented short , have overflow. value stored in ab is, strictly speaking, implementation-defined. in practice, actual value stored 33792 - 2 16 , or -31744 . word val = ab; assuming word typedef unsigned short (as on windows), converts value of ab , -31744 , short unsigned short . result 33792 , or 0x8400 . irrelevant, since never use value of val . int val1 = ab; i'll assume int typedef int . don't know why you'd use such typedef. if int same type int , there's no point in using int rather int . if int can possibly other int , it's horribly misleading name. anyway, converts value of ab short int . since value, -31744 , within range of int ,...

Puppet elasticsearch module (class vs define) -

i trying use following elasticsearch module puppet (with hiera). i trying configure node.name example, can seen in instance.pp file. elasticsearch::instance not class however, defined , seems used in other classes (specifically elasticsearch, in init.pp ). i have tried instantiating class, config through like: elasticsearch::elasticsearch::instance::node.name: 'myname' in .yaml, no avail. i try explain problems mentioned. class vs define . main difference classes singletons in puppet. if want create instance of elasticsearch::instance add puppet manifest: elasticsearch::instance { 'some_name': } exactly same in examples . the purpose of using hiera puppet provide proper values puppet manifests depend on deployment environment. cannot create resource defining in hiera. if define resource in hiera, use create_resource function create instance. please read following article . in example, equivalent of making instance in puppet man...

postgresql - MySQL -> Postgres -

using db designer , exporting sql got part of following file. it's in mysql format, need in postgres. trimmed first 3 lines work i'm struggling last 2 (the index lines). create table applications_interfaces ( swe_applications_id integer not null, ieo_applications_id integer not null, primary key(swe_applications_id, ieo_applications_id), index swe_applications_has_ieo_applications_fkindex1(swe_applications_id), index swe_applications_has_ieo_applications_fkindex2(ieo_applications_id) ); my question functionality 2 lines providing, , how rewritten work in postgres? turn code in this: create table applications_interfaces ( swe_applications_id integer not null, ieo_applications_id integer not null, primary key(swe_applications_id, ieo_applications_id) ); create index applications_interfaces_fkindex1 on applications_interfaces using btree (swe_applications_id); create index applications_interfaces_fkindex2 on applications_interfaces using btree...

java - Writing a parser which deals with big XML files, how to encapsulate data of downloaded files? -

i'm developing parser deals big xml files, can 100 files constantly, , every file around 15mb. parse using xom library. at beginning made decision upon downloading convert string , later understood wrong. first of convert later inputstream , parsed xom , second reason java string pool so, every xml file double amount of memory uses. but doubt right store downloaded data in inputstream ? possible there're approaches don't know about? thank you.

mongodb - How to optimize collection subscription in Meteor? -

i'm working on filtered live search module meteor.js. usecase & problem: a user wants search through users find friends. cannot afford each user ask complete users collection. user filter search using checkboxes. i'd subscribe matched users. best way ? i guess better create query client-side, send the method desired set of users. but, wonder : when filtering criteria changes, new subscription erase of old 1 ? because, if first search return me [usr1, usr3, usr5] , , after search return me [usr2, usr4] , best keep first set , add new 1 on client-side suscribed collection. and, in addition, if third research wich should return me [usr1, usr3, usr2, usr4], autorunned subscription not send me have whole result set in collection. the goal spare processing , data transfer server. i have ideas, haven't coded enough of yet share in comprehensive way. how advice me more relevant possible in term of time , performance saving ? thanks all. david it d...

ruby on rails - Faye + nginx. Client closed keepalive connection -

i using faye on production server passenger , nginx. write code nginx config file of site: location /faye { proxy_pass http://127.0.0.1:9292; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; } in chrome network/websocket see status 101. switching protocols as know means, have websocket connection. dont messages it. in nginx.error.log see: 2015/05/29 13:46:38 [info] 27188#0: *32 client closed keepalive connection how can fix it?

javascript - Google Maps and SQL Server LINESTRING length inconsistent -

google maps , mssql seem disagree on how calculate distance/length of polyline/linestring using srid 4326. mssql: select geography::stgeomfromtext('linestring(-98.78 39.63,2.98 27.52)', 4326).stlength() result: 9030715.95721209 then google maps: http://jsbin.com/niratiyojo/1/ result: 9022896.239500616 at first thought different radius of earth measure played around , turned out more. i need javascript interface match mssql report remain consistent , accurate. or how can find how mssql calculates stlength() , can replicated in javascript? update: i realized if do select geography::stgeomfromtext('linestring(-98.78 39.63,2.98 27.52)', 104001).stlength() * 6378137 then mssql returns 9022896.23950062 the new srid in mssql : new “unit sphere” spatial reference id default spatial reference id (srid) in sql server 2012 4326, uses metric system unit of measurement. srid represents true ellipsoidal sphere shape of earth. while representa...

Eigen & GCC 5 : class std::binder2nd is deprecated -

i restarted working on project has been on hold few months. last time compiled it working fine, without error nor warning. yet when tried compile earlier today got warning attention : ‘template<class _operation> class std::binder2nd’ deprecated [-wdeprecated-declarations] this warning literally appears hundreds of time when including eigen/geometry, use on project in file included [...]/include/eigen/src/core/arraybase.h:109:0, [...]/include/eigen/core:350, [...]/include/eigen/geometry:4, [...]/include/[myproject]/types.hh:8, [...]/include/[myproject]/voronoi.hh:8 since haven't updated eigen (is used 3.2.4 still last update today). however, since last time compiled it, gcc has been updated 5.1.0 (i'm using archlinux) question: is there issue gcc 5.1.0 telling me std::binder2nd deprecated should eigen updated ? how can silent specific warning without loosing verbosity of build ? an...

ios - Can a button contain a group in an Apple Watch app? -

i trying set image inside button (not background image) on apple watch. there way can put group inside button? know can other way around. yes, in interface builder, in attributes inspector, can change content type text group.

angularjs - $urlRouterProvider not working with ngClipProvider -

i'm using ngclip plugin attempt add "copy clipboard" option web app. using ui-router in module config. problem when add ngclipprovider dependency .config, $urlrouterprovider becomes undefined. when remove it, $urlrouterprovider object again. below code: var app = angular.module('app',['ui.router', 'ui.date', 'nganimate', 'angular-loading-bar', 'orders-directives', 'orders-controllers', 'orders-services', 'orders-factories', 'ngclipboard']); //config app.config(['ngclipprovider', function($stateprovider, $urlrouterprovider, ngclipprovider){ $urlrouterprovider.otherwise('/'); $stateprovider.state('/', { url: '/', templateurl: 'templates/admin-view.html', controller: 'orderscontroller ordersctrl' }).state('order', { url: '/order/:ordernum?id', templateurl: 'templates/o...

php - Limit main WordPress loop by category -

in archive.php file of custom theme, want show posts of category. suggested elsewhere add before if( have_posts() ): $posts = get_posts('category=1'); however, seems disregard other filtering may in place (such post date, post author, etc.). i don't want remove other filtering in place. want say: "and show posts category=1". doable? you try merging new filters existing filters: global $wp_query; $posts = get_posts( array_merge( array('category' => '1'), $wp_query->query ) );

java - Matrix multiplication using Jblas: Matrices need to have same length -

i using java + jblas (first time user) , trying multiply 2 matrices. 1 163x4 , other 4x1 matrix. expect result of such multiplication 163x1 matrix. using: floatmatrix = b.mmuli(c); i getting error: matrices must have same length (is: 652 , 4) now while assume, makes perfect sense program confused. same multiplication worked fine in octave (which of course applies magic). getting work need know kind of sorcery is? edit so here octave documentation says broadcasting (the sorcery): in case dimensions equal, no broadcasting occurs , ordinary element-by-element arithmetic takes place. arrays of higher dimensions, if number of dimensions isn’t same, missing trailing dimensions treated 1. when 1 of dimensions 1, array singleton dimension gets copied along dimension until matches dimension of other array. so means copy 4x1 matrix 163 times. can execute multiplication, instead of 163x1 matrix wanted, have 163x4 matrix. me strange. solution now? so ...

clang - Appropriate AST Matcher for class parent declaration -

given class hierarchy: class {}; class b {}; class c : public {}; class d : public c {}; i'm trying refactor class c inherit class b rather class a. can definition statement using recorddecl : recorddecl(hasname("c"), isdefinition()).bind("myclass") with associated matchcallback, can dump() class verify matched right node. have not found way bind instead public a or, better, a . what appropriate ast matcher capture either public a or a class c? edit: the output of clang -ast-dump filtered class c in situation show similar following: cxxrecorddecl [address] <line numbers> <loc> class c definition |- public 'class a' |- cxxrecorddecl [address 2] <columns> <loc> implicit referenced class c it's if there no ast node type represent parent class declarations in ast-dump. i found link providing context how drill down. notably, 1 tutorial suggested using recorddecl in match handler returned nod...

java - Anonymous inner classes JAXB serialization -

i tried use anonymous inner classes initializers syntax serialize jaxb generated objects, , noticed works on endpoints not resttemplate. wondering why working in 1 case , not other? to give example, sample endpoint in spring returns jaxb generated profile instance: @payloadroot(namespace = namespace_uri, localpart = service_name) @responsepayload public profile getprofile(@requestpayload getprofile request) { // stuff service returns profile return service.dostuff(request); } now, when have service returning anonymous instance of profile, there no serialization issues: return new profile() { { setbirthday(user.getbirthday()); setemailaddress(user.getemailaddress()); setfirstname(user.getfirstname()); setgender(user.getgen()); // , on } }; however, when try use anonymous inner classes argument resttemplate, jaxb error regarding not supported anonymous classes. "a non-static inner class, , jaxb can't h...

java - OpenGL Drawing to multiple textures -

i'm trying draw scene's data multiple textures. textures hold diffuse, normal, , position in color form. when scene rendered 1 of textures drawn to. gl_fragdata[0] ends in texture attachment gl_color_attachment2. if switch gl_fragdata[0] diffuse, normal. or position gl_color_attachment2 texture has data correct know data correct in shader first 2 textures end blank. int fbo = glgenframebuffer(); glbindframebuffer(gl_framebuffer, fbo); addtextureattachment(gl_color_attachment0); addtextureattachment(gl_color_attachment1); addtextureattachment(gl_color_attachment2); material.unbindalltextures(); public void addtextureattachment(int attachment) { int id = glgentextures(); glbindtexture(gl_texture_2d, id); glteximage2d(gl_texture_2d, 0, gl_rgba, width, height, 0, gl_rgba, gl_unsigned_byte, (bytebuffer)null); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear); glframebuffer...

three.js - Three js revision 71 at THREE.MeshFaceMaterial dont work proper -

while @ revision "66" when use three.meshfacematerial load textures of tree model works fine.. , when replace three.min.js r66 r71 meshfacematerial shows black model. any ideas r66-r71 changes? i found solution problem using r70 revision!(that quick)! :) same problem here. after blind investigation found materials have opacity 0. solution modify 3 r71 library where // modifiers if ( m.transparency !== undefined ) { console.warn( 'three.loader: transparency has been renamed opacity' ); m.opacity = m.transparency; } change to // modifiers if ( m.transparency !== undefined ) { console.warn( 'three.loader: transparency has been renamed opacity' ); m.opacity = m.transparency; } else { m.opacity = 1; } can't wait r72!

datetime - Java SimpleDateFormat issue with kk hour formatting -

i understand kk supposed cause hours range 1-24. however, there seems issue in how days change in formatting. here example code , it's output illustrate point: long hour = 3600000l; simpledateformat kkformat = new simpledateformat("yyyy-mm-dd kk"); simpledateformat hhformat = new simpledateformat("yyyy-mm-dd hh"); date date = kkformat.parse("2015-05-20 21"); for(int i=0; i<5; i++){ system.out.println(kkformat.format(new date(date.gettime() + * hour))); system.out.println(hhformat.format(new date(date.gettime() + * hour))); system.out.println(); } this generates following output: 2015-05-20 21 2015-05-20 21 2015-05-20 22 2015-05-20 22 2015-05-20 23 2015-05-20 23 2015-05-21 24 2015-05-21 00 2015-05-21 01 2015-05-21 01 the issue see "2015-05-21 24" should date not formatted "2015-05-20 24". thanks clarifications. edit: in answer dan getz i'm trying create file names iterate follows: 2015052...

pdo - php pagination security regarding INT -

i'm looking update pagination on page pdo. however, want make sure 100% free sql injection etc. below content of pagination script have found think work without issues. pulling data url i'm bit concerned regarding line: if (isset($_get["page"])) { $page = $_get["page"]; } else { $page=1; }; i can see isset there check if variable null (i think) can't see checks if not number. i thinking of changing to: if (isset($_get["page"])) { $page = (int)$_get["page"]; } else { $page=1; }; as think check if page variable number. or should be: if (isset((int)$_get["page"])) { $page = $_get["page"]; } else { $page=1; }; or use int on both? think in old mysql have used striptags etc not sure pdo (still learning). here full code before change mentioned above. <?php include('connect.php'); if (isset($_get["page"])) { $page = $_get["page"]; } else { $page=1; ...

sql - How to get the last record from Ms Access table -

i have 2 tables named reefers , alerts . want join these 2 tables. now, how result shows last record of each reeferno alerts table alerttype equal "temperatures" ? table 1: reefers reeferno transporter e-110 express1 e-111 express1 e-112 express1 a-001 a-trucking a-002 a-trucking table 2: alerts alertdatetime receiveddatetime alerttype reeferno temperature location 5/2/15 9:53 5/2/15 9:58 arrival e-110 5.2 warehouse 5/2/15 9:48 5/2/15 9:53 departure e-111 5.4 warehouse 5/2/15 9:40 5/2/15 9:45 temperatures a-001 11.37 warehouse 5/2/15 9:38 5/2/15 9:43 temperatures a-001 10.06 store 5/2/15 9:35 5/2/15 9:40 temperature...

how to use purchased domain name in blogger -

Image
i tried change domain name of blog. buy new domaine name ovh. when tried edit address of blog in blogger interface, error 14 displayed. i have continued in order reach others steps copied 2 cname in ovh account. , in order prove domaine name mine copied recording txt in same table in ovh account. my problem google didn't validate domaine. please? it looks there errors in zone file records, click on below link check errors: http://www.intodns.com/footnewsarabia.com you should try downloading "dns settings file" , import through dns zone file manager section/page also, refer https://support.google.com/domains/answer/6069231 if above solutions not provide complete dns setting screen shot investigate further!!

windows - vcvarsall - Using 64bit compiler and then switching back to 32bit for seperate build -

i'm using vcvarsall switch x64 compile tools vs2010, run memory issues build. i'd switch x86 tools regular builds. currently have batch file looks this: call "c:\program files (x86)\microsoft visual studio 10.0\vc\vcvarsall.bat" x64 set _isnativeenvironment=true "c:\program files (x86)\microsoft visual studio 10.0\common7\ide\devenv" "c:\development\projectx.sln" /build "debug|x64" call "c:\program files (x86)\microsoft visual studio 10.0\vc\vcvarsall.bat" x86 set _isnativeenvironment=true "c:\program files (x86)\microsoft visual studio 10.0\common7\ide\devenv" "c:\development\projectx.sln" /build "debug|x86" this works first build, second still launch 64bit compiler/linker - gives errors (why need use 32 it). in testing found work if open new command line after running x86 vcvarsall.bat - how can mimic in batch file? use setlocal , endlocal setlocal call "c:\program f...

Writing lines to a csv file in a for loop in python -

i have large csv file 5000 rows in it. first column contains identifying names each row i.e. lhgzz01 first 9 rows have lhgzz01 name next 10 have else , on. there no pattern such used np.unique find index name changes. i want write loop write each row of source csv new csv files containing same names in loop. datafile = open('source.csv','rb') reader = csv.reader(datafile) data = [] idx = [] dataidx = [] next(reader, none)#skip headers row in reader: d = row[0] idx.append(d) data.append(row) dataidx.append(row[0]) index =np.sort(np.unique(idx,return_index=true)[1]) nme = []#list of unique names row in index: nm = data[row][0] nme.append(nm) in np.arange(0,9): open(str(out_dir)+str(nme[0])+'.csv','w') f1: row = data[i] writer=csv.writer(f1, delimiter=',')#lineterminator='\n', writer.writerow(row) the code above writes first row of new csv , stops. my question how loop th...

elasticsearch - I don't know how to filter my log file with grok and logstash -

i have small java app loads logs similar these ones bellow: fri may 29 12:10:34 bst 2015 trade id: 2 status :received fri may 29 14:12:36 bst 2015 trade id: 4 status :received fri may 29 17:15:39 bst 2015 trade id: 3 status :received fri may 29 21:19:43 bst 2015 trade id: 3 status :parsed sat may 30 02:24:48 bst 2015 trade id: 8 status :received sat may 30 08:30:54 bst 2015 trade id: 3 status :data not found sat may 30 15:38:01 bst 2015 trade id: 3 status :book not found sat may 30 23:46:09 bst 2015 trade id: 6 status :received i want use elk stack analyse logs , filter them. @ least 3 filters : date , time, trade id , status. in filter part of logstash configuration file here did: filter { grok { match => { "message" => "%{day} %{month} %{day} %{time} bst %{year} trade id: %{number:tradeid} status : %{word:status}" } } and moment can't filter logs want. you have spaces between pattern, , status, parse entire message, using gr...

Doing an Android FPS counter -

i'm trying fps counter android app. means don't have source code app (i can't modify or that, have .apk). i've researched lot , i've found one app (it's called game bench, can find on google play), possible somehow. when app starts, has list games on phone, choose 1 , game bench automatically starts , calculates fps. need similar behaviour. now, asking is, if of has @ least idea of how calculate fps of app (without writing code in it). doing research found few vague ones, record screen , calculate fps of video, or somehow calculate fps using data collected systrace. on both these "ideas" there few info on internet. so please, if guys have information matter/ ideas/ opinions, i'll happy hear them. thanks! this example of how bench fps using surface view. @ run method see how fps works. 1: time before update , render screen. 2: after work done time again. 3: 1000 milliseconds second , 40 fps norm. 4: elaspedtime = start...

single page application - Skip "login.windows.net" and redirect to federated ADFS -

any suggestion on how skip selection of login url (home realm?) http://www.cloudidentity.com/blog/2014/11/17/skipping-the-home-realm-discovery-page-in-azure-ad/ in oauth2 , openid connect passing target domain in “domain_hint” parameter. in adal can pass via following: authenticationresult ar = ac.acquiretoken("https://developertenant.onmicrosoft.com/webuxplusapi", "71aefb3b-9218-4dea-91f2-8b23ce93f387", new uri("http://any"), promptbehavior.always, useridentifier.anyuser, "domain_hint=mydomain.com"); in owin middleware openid connect can same in redirecttoidentityprovider notification: app.useopenidconnectauthentication( new openidconnectauthenticationoptions { clientid = clientid, authority = authority, postlogoutredirecturi = postlogoutredirecturi, notifications = new openidconnectauthenticationnotifications...

jquery - Passing file data from .Net backend to Javascript front-end -

i have .net (vb/c#) backend on 1 server , javascript/jquery front-end on another. attempting pass file data backend front-end reading file in .net byte array, converting base64 string , passing js front-end along variable indicating file type. once data in js front-end attempt convert base64 string file blob in order read readasdataurl() can displayed in iframe or downloaded client. for testing using pdf file. process of passing data works file data not recognized pdf viewer. iframe loads viewer message file not being recognized pdf file. i have done tone of searching , have gotten lot of questions answered searching stackoverflow eludes me. any suggestions appreciated. thank you. update: here vb.net code: sub onreadfiletoviewer(byval filepath string) dim oktoview boolean = false dim fileblob string = string.empty dim fileencoded string = string.empty if (file.exists(filepath)) try using fread filestream ...

ruby - OpenSSL error in Rails Mailer -

openssl::ssl::sslerror (ssl_connect returned=1 errno=0 state=unknown state: unknown protocol): i got error in rails on digitalocean. yesterday works lately afternoon got error. google solution nothings happen. makes error?

c# - Connection String via IP Address For SQL Server -

i want create connection string can connect sql database remotely in c# code using oledb provider , server ip address. note 1 : i'm using oledb because want handle different database types. sql example. note 2 : database resides on machine (machine on network) i did setup connect machine (firewall,enable tcp/ip..etc), , can connect remotely using microsoft sql server management 2014 specifying (server name : computer name-pc\instance name) , using sql authentication entering username , password , press connect , goes well, connect successfully. but tried lot of combinations build connection string in c# code , none of them works except : oledbconnection conn = new oledbconnection(@"provider = sqloledb; data source = mycompname-pc\sqlexpress; initial catalog = database1 ; user id = myusername ; password = mypassword ;"); otherwise if try use server public ip address instead of mycompname in data source keeps giving me error : server not found or acces...

symfony - Symfony2 JMSSerializerBundle expose property in YML -

i want expose few properties of user class, using jmsserializerbundle , fosrestbundle. seems serializer bundle not reading configuration file. my user class in src/appbundle/entity/user , extends fosuserbundle user class. here user class: <?php namespace appbundle\entity; use doctrine\orm\mapping orm; use fos\userbundle\model\user baseuser; use symfony\component\validator\constraints assert; /** * user * * @orm\table(name="backoffice_user") * @orm\entity(repositoryclass="appbundle\entity\repository\userrepository") */ class user extends baseuser { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string * * @orm\column(name="lastname", type="string", length=70) */ private $lastname; /** * @var string * * @orm\column(nam...

javascript - Using .remove on a table row produces style of display:none -

i trying remove row table. each row contains text input, edit button , delete button. when click delete want entire row removed. jquery code: $(document).on('click', 'button#delete_x', function () { $(this).closest('tr').fadeout(500, function(){ $(this).parents('tr:first').remove(); }); }); i don't have access rows id's getting closest tr delete button. problem instead of removing row, new inline style of display:none appears in tr! wondering why happening? using safari browser on mac yosemite. you trying remove row parent of row animated instead of row itself. this because actual "this" value depends on call site or if, in of jquery methods, explicitly forced. in jquery "this" forced element acting on. when pass callback fadeout() method, inside callback, "this" point element faded out (in case row want remove). try instead: $(document).on('click', 'button#d...

codeigniter - $this->session->unset_userdata not working? -

so have login method: public function login(){ $this->form_validation->set_rules('username','username','trim|required|min_length[4]|xss_clean'); $this->form_validation->set_rules('password','username','trim|required|min_length[4]|xss_clean'); if($this->form_validation->run()== false) { //loading view $this->load->view('admin/layouts/login'); $username = $this->input->post('username'); $password = $this->input->post('password'); //validate username & password $user_id = $this->authenticate_model->login($username, $password); if($user_id){ $user_data = array( 'user_id' => $user_id, 'username' => $username, 'logged_in' => true ); //set session userdata $this->sess...

Excel formula to VBA code -

how go turning excel formula =b4/b5 vba code? far, code not work of course: activecell.formular1c1 = "=b4/b5" as can tell, not familiar r1c1. if needed, have created function col_letter() takes number , returns letter of corresponding column. appreciated! as pointed out in comments @siddarth looking for: activecell.formula = "=b4/b5" if in hurry , need make macro work, compromise on code readability may acceptable. in case following: start recording macro do need do stop recording , extract line macro code note work everything, may lead confusing code.

How do I watch a file, not a directory for changes using Python? -

the question: how watch file changes using python? suggests using watchdog, found able watch directory, not file. watchdog-test.py watchdog's sample script: $ python watchdog-test.py ab_test_res.sh & [1] 30628 fbt@fbt64:~/laike9m$ traceback (most recent call last): file "watchdog-test.py", line 15, in <module> observer.start() file "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 255, in start emitter.start() file "/usr/local/lib/python2.7/dist-packages/watchdog/utils/__init__.py", line 111, in start self.on_thread_start() file "/usr/local/lib/python2.7/dist-packages/watchdog/observers/inotify.py", line 121, in on_thread_start self._inotify = inotifybuffer(path, self.watch.is_recursive) file "/usr/local/lib/python2.7/dist-packages/watchdog/observers/inotify_buffer.py", line 35, in __init__ self._inotify = inotify(path, recursive) file "/usr/local/lib/pyth...

php - Shopping cart quantity count to show up after form is submitted -

i have code configured count quantity of items have in shopping cart display in area on site customer can see how many items have in cart. problem having if click add cart, when form redirects quantity not show right away @ redirect. starts showing when leave go next page. wanting show right when click add cart. the way have structured have file required load @ top of file in of pages. quantity count stored. //shopping cart quantity count if(isset($_session['shopping_cart']) && is_array($_session['shopping_cart'])) { $totalquantity = 0; foreach($_session['shopping_cart'] $product) { $totalquantity = $totalquantity + $product['quantity']; } } else { $totalquantity = 0; } i'm not sure if can done ajax or if can done through existing php code. not know hardly ajax, if way go will. i'm looking hear ideas , maybe step in right direction of how execute this. first hand look, site working on buyfarbest.com ...