Posts

Showing posts from September, 2010

Java Iterators. How to inspect the Iterator? -

i want know if there way inspect iterator object. kind of map? also, there a better way take contents of iterator object , put them in mapc? here code: import java.util.hashmap; import java.util.treemap; import java.util.map; import java.util.iterator; public class maps { public static void main(string[] args) { map mapa = new hashmap(); map mapb = new treemap(); mapa.put("key1", "element 1"); mapa.put("key2", "element 2"); mapa.put("key3", "element 3"); // 3 put() calls maps string value string key. can // obtain value using key. use get() method this: string element1 = (string) mapa.get("key1"); // why need type cast on right? system.out.println(element1); // lets iterate through keys of map: iterator iterator = mapa.keyset().iterator(); system.out.println(iterator); // how inspect this? kind of map? map mapc = new hashmap(); while(iter...

java - Failing to run ZK Spreadsheet on App Engine Managed VM -

i wrote simple application based on example here . when try run standalone jetty 9.2.10.v20150310 (which same version used gae managed vm) works fine (loading , saving). when try run google cloud sdk maven plugin or when deploy app engine, spreadsheet content loads, css fails download exception on server: [info] severe: failed load media, /view/z_obs/lgaq1/f14/0/ss_lgaq1_t0_sheet_0.css [info] java.lang.nullpointerexception [info] @ org.zkoss.zss.ui.spreadsheet.getmergematrixhelper(spreadsheet.java:2755) [info] @ org.zkoss.zss.ui.spreadsheet.preparebasicstylesheet(spreadsheet.java:4144) [info] @ org.zkoss.zss.ui.spreadsheet.getsheetdefaultrules0(spreadsheet.java:4603) [info] @ org.zkoss.zss.ui.spreadsheet.getsheetdefaultrules(spreadsheet.java:4597) [info] @ org.zkoss.zss.ui.spreadsheet.access$6200(spreadsheet.java:219) [info] @ org.zkoss.zss.ui.spreadsheet$extractrl.getmedia(spreadsheet.java:3041) [info] @ org.zkoss.zk.au.http.audynamediar.service(audynamediar.java:128) ...

scheduled tasks - Implement repeat interval of more than a day for parse.com background job -

i have created background job this: parse.cloud.job("resetleaderboard", function(request, response) { parse.cloud.usemasterkey(); var query = new parse.query("leaderboard"); query.find( { success: function(results) { response.success("success!"); }, error: function(error) { response.error(error); } }) .then( function(results) { return parse.object.destroyall(results); }); }); i want run job every 15 days. there no option available @ www.parse.com set time interval more day. i think need use time stamp , compare value current time. can show me standard way this? you're right job scheduling ui constrained single day. way solve problem have job run daily, have n...

openmodelica - Modelica vector parameters from a file -

is possible read vector of parameters file? i'm trying create vector of objects, such shown here: enter link description here starting on page 49. however, pull specific resistance , capacitance values text file. (i'm using example how read in). so, example fills in data this: a.basic.resistor r[n + 1](r = vector([re/2; fill(re,n-1); re/2]) ); a.basic.capacitor c[n](each c = c*l/n); but, instead have text file contains like, first column index, second r values , third c values: #1 double test1(4,3) #first set of data (row col) 1.0 1.0 10.0 2.0 2.0 30.0 3.0 5.0 50.0 4.0 7.0 100.0 i know can read data in using combitable1d or combitable2d. but, there way convert each column of data vector can analogous to: readintablefromdisk a.basic.resistor r[n + 1](r = firstdatacolumnofdataondisk ); a.basic.capacitor c[n](each c = seconddatacolumnofdataondisk); i recommend externdata library if want load external data files modelica tool. modelica library ...

android - Pulling values from an CSV file in java -

i having trouble pulling values csv file android app working on. csv file takes following format: acton town (district),acton town (piccadilly),2.00 aldgate (circle),aldgate (metropolitan),4.00 aldgate east (district),aldgate east (hammersmith , city),2.00 i trying import java class using following method: public arraylist<connection> importconnections(){ try { //gets lines.txt file assets in = this.getassets().open("connections.csv"); scanner scan = new scanner(in); textview linedata = (textview)findviewbyid(r.id.displayline); string connection = null; string startingstation = null; string endingstation = null; float duration = 0; { connection = scan.nextline(); string delimiter = ",\n"; stringtokenizer tokens = new stringtokenizer(connection, delimiter); ...

operating system - Explanation of state replication of barrelfish -

can tell how barrelfish os implementing state replication of kernel on each each core or closely-coupled "shared" on cores in case e have multi or many cores chip. trying understand point, tried check source code, no more documentation explain process of spawning kernel on whole cores. and if can offer me way understand source code of part great try trace source code, looks swim lone in ocean. thanks lot. abdo~ one example state replication in barrelfish capability system [1, section 5]. every core (in fact, every dispatcher) has own storage capabilities. many operations can done locally, without synchronizing other cores. if synchronization needed, capability system helps find replicas, since copy operations other cores explicit , can tracked. the barrelfish source code not place further this, since our capability system quite complex. if have further questions, please refer our mailing list [2] suggested deepthought [1] http://www.barrelfish.org/tn-01...

html - Fatal Error with PhP on submit -

i'm making form can add records database through browser. when press submit, comes error fatal error: call member function execute() on boolean in /srv/http/career.php on line 56 line 56 based of php line: $result->execute($_post); it's not related connection of database, works because able view made records. full code html <form method="post"> <label for="jobtitle">job title</label> <input type="text" name="jobtitle" /> <br> <label for="reference">reference</label> <input type="text" name="reference" /> <br> <label for="salary">salary</label> <input type="text" name="salary"/> <br> <label for="location">location</label> <input type="text" name="location"/> <br> <br> <label for="description...

c++ - Rotate around a point with a 3x3 matrix and a translation vector -

i have 3x3 matrix in opengl format , translation vector. confused when rotating around point because rotate function not consider translation. for rotating assumed change 3x3 matrix quaternion, rotate , change back. not work when rotating other objects current position. the normal procedure 4x4 matrcies is: translate point -(point - position) rotate translate point (point - position) optional advice: bullet physics uses format , why considering using data format store transformations. have convert 4x4 matrix projection, not matter much. bullet's format attractive because removes useless shear data. worth bother keep transformations in bullet format or no? came one. matrix math. create rotation matrix manually or quaternion , multiply them. bullet i'll show bullet internally too. *psuedo code void transform::rotatearoundpoint(axis, angle, point) { matrix3x3 mat = creatematrixfromquaternion(axis, angle); transform rotatetransform; trans.basis = mat;...

javascript - Three.js Mesh not animated with AnimationHandler -

i haven't been able blender exported mesh animate. not included buffalo 1 can see animated in example. (which i've been trying reproduce no avail. here's code, suspect it's simple missing thing, have no idea. doubt it's blender issue since haven't been able animate included meshes. <!doctype html> <html lang="en"> <head> <title>three.js webgl - blender</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <style> body { font-family: monospace; background-color: #000000; margin: 0px; overflow: hidden; } #info { color: #fff; position: absolute; top: 10px; width: 100%; text-align: center; z-index: 100; display:block; ...

file - What is the '.tt' extension? -

i work bunch of something.js.tt , bunch of html files have name, example: example.tt the infrastructure c backend perl serving api , use these .tt files show html , sever knockout js code via .js.tt file. whats .tt ? a tt file visual studio text template, developed microsoft.

java - Good way to close multiple resources across multiple methods -

i have class uses multiple closeable resources, opens them in constructor , want them closed in close() (inherited closeable interface) method. want use class in try-with-resources block similar java.io classes. example (this not actual code, shows problem 2 resources): public class foo implements closeable { private final reader first; private final reader second; public foo(reader first, reader second) { this.first = first; this.second = second; } ... @override public close() throws ioexception { first.close(); second.close(); } } the above code not correct, because if first.close() throws exception, second won't closed. adding try/finally around pita , if have more of unmanageable. basically question is: there library closing of multiple resources , logs exceptions , throws away last 1 found? i looked @ multiple (guava closeables , ioutils.closequitly() ) deal 1 resource, provide collection of ...

C fifo linked list char push -

i'm trying understand fifo linked list , found example here example , , i'm trying input char instead of int #include <stdio.h> #include <conio.h> #include <stdlib.h> struct node { char data; struct node* next; }*rear, *front; void delqueue() { struct node *temp, *var=rear; if(var==rear) { rear = rear->next; free(var); } else printf("\nqueue empty"); } void push(char *value) { struct node *temp; temp=(struct node *)malloc(sizeof(struct node)); temp->data=value; if (front == null) { front=temp; front->next=null; rear=front; } else { front->next=temp; front=temp; front->next=null; } } void display() { struct node *var=rear; if(var!=null) { printf("\nelements as: "); while(var!=null) ...

javascript - How to add regular expression in textarea tag -

this question has answer here: how validate pattern matching in textarea? 3 answers recently started working html5 tags , i'm new this. working textarea tag. want use regular expression don't see property (like pattern ). not available in textarea tag? if so, .js option? code: var regex = "^[a-za-z0-9 ]+$"; <textarea placeholder="add name or special instructions" title="add name or special instructions" id="whofor" maxlength=@specialinstructionsmaxcharlimit name="whofor" rows="2" cols="20">@model.menuitemmodel.whofor</textarea> html5 textarea element not support pattern attribute. even if add pattern attribute, won't work browser ignore it. you right, need js.

javascript - Angular directive inside ng-template with modal -

i curious way angular works preloading directives since have problem directive resides in <script> tag , ng-template . when pause execution in chrome dev-tools, during initial document load, can see code inside directive's controller not called if directive lies in arbitrary template. here example code, when e.g. mydirective included in index.html part of mymodule .js module, included both in index , in main app module: this other directive's html containing problematic mydirective <script type="text/ng-template" id="callthis"> <mydirective></mydirective> </script>` and call on click ngdialog ngdialog.open({ template: 'callthis', scope: $scope }); and can't run directive since doesn't have html work (thats error, html element missing). finally here code module holds mydirective angular.module('mymodule', ['mydirectivetemplates', 'mydirectivedirective']) angular...

reactjs - React: How to pass down context to a component generated on runtime -

i trying use modal android mkonicek's gist https://gist.github.com/mkonicek/1a8bd7253e3257687228 , seems show modal properly, seems crash when child component accepts context. i'm assuming reason displayed component modal not rendered using render method not pass context information down. anyone knows how pass down context down rendered component inside _createmodal https://gist.github.com/mkonicek/1a8bd7253e3257687228#file-modal-js-l90 function ? thanks help! nevermind found way using contextwrapper found solution reactrouter https://github.com/rackt/react-router/issues/982

ios - Healthkit: Data not showing first time running. -

i have strange problem when reading data out of healthkit. first time when press button weight printed 0, next times press button weight printed normal.i appreciate if me. thanks! i have following code. healtkitmanager.h #import <foundation/foundation.h> #import <uikit/uikit.h> #import <healthkit/healthkit.h> @interface healthkitmanager : nsobject @property (nonatomic) float weight; @property (nonatomic) hkhealthstore *healthstore; +(healthkitmanager *)sharedmanager; -(void) requestauthorization; -(double) readweight; @end healthkitmanager.m #import "healthkitmanager.h" #import <healthkit/healthkit.h> #import "startscreen.h" @interface healthkitmanager () @end @implementation healthkitmanager +(healthkitmanager *) sharedmanager{ static dispatch_once_t pred = 0; static healthkitmanager *instance = nil; dispatch_once(&pred, ^{ instance = [[healthkitmanager alloc]init]; instance.healths...

c# - Refresh a strongly typed DataSet -

i have typed dataset calls stored procedures.in 1 case add data in database using typed data set.the data gets added database reason new data not being displayed. this leads me believe have somehow refresh typed dataset after add new item.i not sure code should post here post code adds elements database: var addbookadapter = new queriestableadapter(); addbookadapter.addbook(book.name,book.author,book.description,book.publicationdate,book.categoryid); this stored procedure this: create procedure [dbo].[addbook] @name nvarchar(max), @author nvarchar(max), @description nvarchar(max), @date date , @categoryid int insert books (name , author , description , publicationdate , categoryid) values (@name , @author , @description , @date , @categoryid) as mentioned works.the new item gets added db not displayed if underlying data in database has changed, way load information dataset load manually. have couple of options here, depend...

javascript - indexOf in IE8 throwing error but works in all other browsers -

hey have following js code: for(var = choicesorder.indexof(cat)+1; i<choicesorder.length; i++) and throwing error: script438: object doesn't support property or method 'indexof' how can go fixing since works in other browsers? you can find prototype version can implement here: https://developer.mozilla.org/en-us/docs/javascript/reference/global_objects/array/indexof

c++ - Should I use goto statement here? -

a fine gentleman told me goto statements bad, don't see how can not use here: int main() { using namespace std; int x; int y; int z; int a; int b; calc: //how can here, without using goto? { cout << "to begin, type number" << endl; cin >> x; cout << "excellent!" << endl; cout << "now need type second number" << endl; cin >> y; cout << "excellent!" << endl; cout << "now, want these numbers?" << endl; cout << "alt. 1 +" << endl; cout << "alt. 2 -" << endl; cout << "alt. 3 *" << endl; cout << "alt. 4 /" << endl; cin >> a; if (a == 1) { z = add(x, y); } if (a == 2) { z = sub(x, y); } if (a == 3) { z = mul(x, y); } if (a == 4) { z = dis(x, y); } } cout ...

c# - AspxDocumentViewer XtraReport and empty data -

Image
i'm using xtrareport , aspxdocumentviewer. wrote codes show. i'm taking problem; empty data. how fix this? can't see what's wrong. by way "dsmast", it's dataset , there ten rows. still report empty. string fpth = server.mappath("."); fpth = fpth + "\\report\\rprftrlst22222.repx"; xtrareport report = xtrareport.fromfile(fpth, true); report.datasource = dsmast; report.loadlayout(fpth); report.createdocument(); string reportname = (string)"report"; aspxdocumentviewer1.report = report; aspxdocumentviewer1.databind(); session["reportname"] = reportname; i fixed problem. first of all, added code page_load if (session["report2"] != null) { aspxdocumentviewer1.report = session["report2"] xtrareport; } and used thoso codes. report.datasource = dsmast; report.loadlayout(fpth); report.createdocument(); aspxdocum...

javascript - Adjusting height according to dynamically added elements -

i have problem dynamically added div's , adjusting parent's height according dynamically added content. so, have div called #full-content-wrap , it's width divided 2 child elements. these element's called .doubled-wrap-content-left , .doubled-wrap-content-right ( let's call left wrap , right wrap ). so, then, have 2 links (or buttons, or whatever) when click on 1 of these links, javascript add element .doubled-table dynamically left or right wrap (according link clicked). so, have bit problem setting height of #full-content-wrap or left/right wrap. when set full-cont-wrap's height auto, , l-r wrap's height auto too, it's still 0px. when set 100% - auto it's still 100% , added elements overflowing off parent element. i've done way. have created function adjusts height of full-cont-wrap biggest height of it's content (left or right wrap) , when it's empty, window.innerheight . but, it's kinda uncomfortable , has 2 minuses....

node.js - Mongodb not starting on ubuntu 14.04 -

i trying install , start mongodb locally: i go through these steps (as shown in history): 1819 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7f0ceb10 1820 echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list 1821 sudo apt-get update 1822 sudo apt-get install -y mongodb-org 1823 sudo service mongod start but following error log in /var/log/mongodb/mongodb.log 2016-01-05t22:51:21.869+0000 control [main] ***** server restarted ***** 2016-01-05t22:51:21.874+0000 control [initandlisten] mongodb starting : pid=5394 port=27017 dbpath=/var/lib/mongodb 64-bit host=ip-172-31-45-129 2016-01-05t22:51:21.874+0000 control [initandlisten] db version v3.2.0 2016-01-05t22:51:21.874+0000 control [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7 2016-01-05t22:51:21.874+0000 control [initandlisten] openssl version: openssl 1.0.1f 6 jan 2014 2...

Implementing a delegate for wordwrap in a QTreeView (Qt/PySide/PyQt)? -

Image
i have tree view custom delegate trying add word wrap functionality. word wrapping working fine, sizehint() seems not work, when text wraps, relevant row not expand include it. i thought taking care of in sizehint() returning document.size().height() . def sizehint(self, option, index): text = index.model().data(index) document = qtgui.qtextdocument() document.sethtml(text) document.settextwidth(option.rect.width()) return qtcore.qsize(document.idealwidth(), document.size().height()) however, when print out document.size().height() same every item. also, if manually set height (say, 75) check things reasonable, tree looks goldfish got shot bazooka (that is, it's mess): as can see, text in each row not aligned in tree. similar posts similar issues have come before, no solutions problem (people reimplement sizehint() , , that's trying): qtreewidget set height of each row depending on content qtreeview custom row height of indi...

javascript - jQuery Validation giving error with every character entered -

i'm using jquery validator on form on site. functioning properly, every keystroke results in error: uncaught typeerror: object #<error> has no method 'call' i implementing validation through classes on each field , working - required fields, email fields, numbers, etc.. here validate code: if(jquery().validate) { //assign global var manual validation validator = $(".validated").validate({ errorclass: "help-inline text-error", errorelement: "span", invalidhandler: function(e, validator) { var errors = validator.numberofinvalids(); if (errors) { var message = errors == 1 ? 'please fix indicated field before saving form.' : 'please fix errors on indicated fields before saving form.'; $(".validation-message").text(message); ...

javascript - Angular promises fail to resolve in all subsequent unit tests (ngMock) -

we've upgraded angular 1.5-rc0. 1 recent change ngmocks destroys $rootscope after every test. however, i'm struggling figure out why promises use inside our app never fire after first time. here's test simulates right-click event test context menu directive. directive uses utility load html template, cache it, etc. service resolves promise when template loaded. however, angular/ngmock 1.5, promise resolves first "it" block. $rootscope should re-created every test don't understand what's holding up. describe('context-menu directive', function() { beforeeach(function() { module('templates', 'contextmenu'); inject(function(_$compile_, _$rootscope_) { var scope = _$rootscope_.$new(); scope.choices = [{ text: 'test', handler: function() {} }]; $template = _$compile_('<div context-menu="choices">...

ios - How to make a UIView or TableView to fit the preferredContentSize of a popover? -

this question has answer here: how dynamically change contentsize of uipopovercontroller? 8 answers i wanna show popover 100x100 imageview or tableview. have create imageview on corner of popoverview,like this. ( http://snappyimages.nextwavesrl.netdna-cdn.com/img/c7533f30a6ebef7c017521fd8f84452e.png ) but if change the preferredcontentsize,i have change the size of imageview too. q1: right way create content of popover ? q2: there way make imageview or tableview fit preferredcontentsize automatically? i've got anwser! impelement code in presentating controller. popovercontroller. preferredcontentsize = popovercontrooler.yourtableview.contentsize; popovercontroller. preferredcontentsize = popovercontrooler.yourimageview.frame.size; or implement code in popovercontroller (make sure yourview has been laid out) -(void) viewdidappea...

java - Mocking a static method which calls another static method of the same class -

i have write unit test static method requires mocking static method of same class. sample code: public class { public static boolean foo(){} public static boolean bar(){ return foo(); } } @preparefortest({a.class}) public atest{ testmethod(){ mockstatic(a.class); when(a.foo()).thenreturn(true); asserttrue(a.bar()); } } i have been trying unit test bar method far not been successful. issue : debug doesn't reach return foo(); statement in code , assertion fails. please advice. cannot modify code @ point of time any in mocking foo method appreciated.thanks! the fact false default value boolean played bad trick. expecting wrong foo called, while in fact bar not called. long story short: when(a.bar()).thencallrealmethod();

iphone - iOS Custom URL Scheme - get source URL -

i'm working on app launches custom url scheme. i've managed url , parameters , everything, however, our app launches web view. want when user clicks link scheme, same page on open in our web view (it's needed because other functions run in background, , allowing user keep browsing website on) is possible location of clicked url? know can source application, there way (other adding link scheme parameters) source link? thanks! if need information passed in application, information must somehow represented in url itself. adding generic interface purpose wouldn't make sense urls hosted inside email message or sms, example.

entity framework - How to map Tuple<something, something> to database using c# EF code first? -

i've been searching , can't find solve problem, here part of code: namespace domain { public class assessment { //other props public list<tuple<user, int>> usersmeanttosolvethisalongwithtimeeachspentonit { get; set; } } } when modify database using migrations mapped correctly, simple props "assessments" table perfectly, , props use other entities in "many many" way, correctly mapped new tables after using fluent api. yet don't know how map list of tuples... ideas? well, came solution, if has same problem, ended doing this: 1 - created new class public class userandtimehespentonsolvingassessment { public int id { get; set; } public user usersolvingtheassessment { get; set; } public int timespentbyusertosolvetheassessment { get; set; } } 2 - update disturbing property public list<userandtimehespentonsolvingassessment> usersmeanttosolvethisalongwithtimeeachspentonit { get; ...

CodeIgniter - execute function when session expires -

i'd update own database when session expires. modified codeigniter's session file , wrote own code in sess_destroy(). everytime user logouts, sess_destroy() called. works correctly database gets updated. problem though database doesn't update when session expires. test it, set sess_expiration in config.php file 20 seconds wouldn't have wait long expire. after expire, login details supposed displayed gone, meaning session gone. database, however, not updated @ all. i've tried inputting code in unset_userdata() , sess_gc() database still doesn't update. suggestions welcome. thank you the way call sort of cron job regularly scan database of sessions expired sessions , purge them or log them etc. nothing going trigger automatically.

jquery - how do i lookup an operator value in html, set it as a var and use it in a javascript function? -

i have span reads 1+2= : <span id="num1">1</span> <span id="op">+</span> <span id="num2">2</span> = i have javascript function: $(document).ready(function() { var num1 = parseint($("#num1").text()); var op = $("#op").text(); var num2 = parseint($("#num2").text()); console.log(num1 + op + num2); //doesnt work }); this purely experimental reasons, how go adding 1+2 using operator listed in html? can set operator var , use somehow? my thought console.log(num1 + op + num2); doesnt anything do not use eval() evil . kindly try mix , match operators. $(document).ready(function() { var num1 = parseint($("#num1").text()); var num2 = parseint($("#num2").text()); var op = $("#op").text(); switch (op) { case "+": console.log(num1 + num2); break; case "-": ...

json - What does 'records are values not objects' mean in tidyjson -

the json in following string correct json according http://jsonlint.com/ tidyjson objects: library(dplyr) library(tidyjson) json <- ' [{"country":"us","city":"portland","topics":[{"urlkey":"videogame","name":"video games","id":4471},{"urlkey":"board-games","name":"board games","id":19585},{"urlkey":"computer-programming","name":"computer programming","id":48471},{"urlkey":"opensource","name":"open source","id":563}],"joined":1416349237000,"link":"http://www.meetup.com/members/156440062","bio":"analytics engineer. work in hadoop space.","lon":-122.65,"other_services":{},"name":"aaron wirick","visited":1443078098000,"se...

android - DialogFragment Close Event -

i need handle end of dialogfragment (after call .dismiss) - example, show toast inside activity "contains" fragment after dismiss. how handle event? override ondismiss() in dialogfragment, or use setondismisslistener() in code block building fragment.

c++ - How to fix the Ubuntu 64 bit Linux bus error I get when trying to access the memory mapped address, m_pControl, returned by mmap? -

i fix ubuntu 64 bit linux bus error when trying access memory mapped address, m_pcontrol, returned mmap. tried memset did not prevent bus error on following source code line after memset. windows 7 version of code apparently not have bus error. bool cdatatransferserver::initialize(int ncameraid, cc_sampletype ndatatype, unsigned int nimagewidth, unsigned int nimageheight, unsigned int nmaxframes) { bool bokay = true; if (m_binitialized) return true; char buffer[256]; m_strmemoryname = l"global\\smartcammem"; size_t origsize = strlen(m_szobjnamesuffix) + 1; const size_t newsize = 100; size_t convertedchars = 0; wchar_t wcstring[newsize]; mbstowcs(wcstring, m_szobjnamesuffix,origsize); m_strmemoryn...

regex - Extracting specific fields from Data in Ruby -

this ruby program in have extract specific fields using regular expression data in file. data in file in following format: nov 13 01:46:57 10.232.47.76 qas-adaptiveip-10-232-47-76 2015-11-13 01:46:57 +0000 [info]: qas-296d1fa95fd0ac5a84ea73234c0c48d64f6ea22d has been deregistered adap_tdagt i need extract following values 1)2015-11-13 01:46:57 +0000 2)qas-296d1fa95fd0ac5a84ea73234c0c48d64f6ea22d i have written code it's not working properly. can please me out problem. class task5 def initialize # @f=file.open('c:/users/aroraku/desktop,boc-adap_td-agent.log-2.log',r) @count=0 end def check_line(line) if(line=~/deregistered adap_tdagt$/) line=~ (/.*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} +\d{4})/) puts "#{$1}" end end def file_read open("boc-adap_td-agent.log-2.log") { |f| while line=f.gets check_line(line) end } # return @count end end ...

php - XAMPP won't connect to my database -

i want test codes using xampp keep getting no database selected though right, ideas why won't connect database? have encountered warning on several occasions want test of codes using xampp. warning: deprecated: mysql extension deprecated , removed in future: use mysqli or pdo instead <?php //this works mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("testdb") or die(mysql_error()); ?> <?php $con=mysqli_connect("localhost","root","","testdb"); if (!$con) { die("connection error: " . mysqli_connect_error()); } ?> returns this: no database selected

java - How to combine the attributes in jsoup selector -

i have parts of html parsing: <a href="/res/" class="postbtn-reply-href" name="112309691"></a> <blockquote id="m112309691" class="post-message"> text </blockquote> how can different attributes? for <a> attribut ["name"] for <blockquote> text() something like: elements elements = doc.select("a [class=postbtn-reply-href]["name"], blockquote[class=post-message] [text()]"); what css selector? a.postbtn-reply-href[name], blockquote.post-message:contains(text) demo: http://try.jsoup.org/~kpbuk0rx6brmzfzzh-u-u9yvuky the initial css selector understood below jsoup: a // select node descendant of anchor node (a), [class=postbtn-reply-href] // having class named postbtn-reply-href ["name"] // , attribute called "name" , // or blockquote[cla...

javascript - Printing out hashed values? -

i trying print out int applied sha256 hash to, getting [object object] in server logs. any ideas how print / view object? meteor.methods({ twiliotest:function () { console.log("twilio test called!"); // time 2fa code var d = new date(); var seconds = d.gettime() / 1000; seconds = parseint(seconds); // large random int var largeint = math.floor(math.random() * (999999999 - 99999999999999999) + 99999999999999999); console.log("seconds value: " + seconds); console.log("largeint value: " + largeint); // combine values var combined = seconds + largeint; console.log("combined value: " + combined); // hash value combined = meteor.call('generatehash',combined); console.log("combined value hashed: " + combined); }, generatehash: function(val){ check(val, match.any); var hash = 0; var crypto = npm.require('crypto'); var key = 'abc123'...

arrays - Mongo+PHP Query How to check if an field is empty -

data: "field1" : { "sub_field" : [ ]} i want write query check if 'sub_field' empty or not. this tried: $cursor = $collection->find( array('field1.sub_field' => array('$ne' => null)) obviously gives results array not null (i have tried null , empty space in futility). i told '$size' operator can used achieve this. have had no luck far. any suggestions ? you approach in couple of ways. first use numeric array indexes in query object keys using dot notation , $exists operator search documents won't have @ least sub_field array element: var cursor = db.collection.find({ "field1.sub_field.0": { "$exists": false } }) which should translate php as $cursor = $collection->find( array("field1.sub_field.0" => array("$exists" => false)) the other way use $size operator $exists operator wrapped within $or operator find documents without sub_fiel...

In http2, if the client ignores the server's settings frame, what should the server do? -

when there many connections, want reduce dynamic table size through settings_header_table_size in settings frame. if client ignores settings frame, , not send settings frame ack flag , server use default value (4096 octets)?if so, client can send many requests 4096 octets dynamic table after receiving server settings frame. may cause server's memory used much.how avoid case? the client must apply settings promptness , send settings ack back, not optional. other behavior client non-compliant , in situations server can close connection. specific case client lingers long without acknowledging setting, server can close connection using goaway frame reason settings_timeout. the other thing hpack dynamic table "global" http/2 connection. so, way attacker can abuse default size opening many different connections, not making many requests on same connection. in opinion, want limit number of connections can come single ip address, otherwise attackers won't ne...

Clojure luminus framework how to call mongodb connect with mount -

i started develop using clojure luminus framework mongodb (with monger library). hard understand how implement mount library start db connection. i figured out code should put handler.clj 's init function. but cannot figure out how tell mount start database connection. please give me hand? here gores development config.clj (ns vippro.config (:require [selmer.parser :as parser] [clojure.tools.logging :as log] [vippro.dev-middleware :refer [wrap-dev]] )) (def defaults {:init (fn [] (parser/cache-off!) (log/info "\n-=[vippro started using development profile]=-")) :middleware wrap-dev}) and in handler.clj 's init function (defn init "init called once when app deployed servlet on app server such tomcat put initialization code here" [] (when-let [config (:log-config env)] (org.apache.log4j.propertyconfigurator/configure config)) (doseq [component (:started (mount/start)...

ios - AVAudioPlayer can't play while AVCaptureVideoPreviewLayer -

i'm generating .m4a video recorded during avcapturevideopreviewlayer session (using wonderful pbjvision). generate m4a file video captured: avassetexportsession *exportsession=[avassetexportsession exportsessionwithasset:myasset presetname:avassetexportpresetapplem4a]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory,nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *audiopath = [documentsdirectory stringbyappendingpathcomponent:[nsstring stringwithformat:@"%@.m4a",audiofilename]]; exportsession.outputurl=[nsurl fileurlwithpath:audiopath]; exportsession.outputfiletype=avfiletypeapplem4a; [exportsession exportasynchronouslywithcompletionhandler:^{ if (exportsession.status==avassetexportsessionstatusfailed) { nslog(@"failed"); } else { [_audiofilepaths setobject:audiopath forkey:audiofilename] } and try play avaudioplayer *player = [[avaudioplayer alloc] initwit...

ios - NSHTMLTextDocumentType not showing in attributed text view for paged VC -

i'm trying format text within uitextview using nshtmltextdocumenttype. uitextview on page/vc of pageviewcontroller. it works fine , when tested in simulator worked. except... when switched the device , started dragging between pages in pageviewcontroller text stopped showing. realised when using simulator on laptop click rather drag change pages. so formatting works/fails in following situations: work: clicking quick automatic pagecurl affect between pages work: programatically changing pages via timer fail: dragging pagecurl affect between pages interestingly, when page fails render text dragging next page: the code being called properly. debug , see being set. attributed text showing right values. when rotate device page redrawn puts text there (so vc has info viewdidload isn't run on orientation change). my theory rendering of html slow pagecurl effect get's vc before rendered , doesn't show text. my code rendering textview in viewdidload...

html - Want to make navigation button in jQuery photo gallery -

i've made photo gallery using jquery. when click on photo, photo display. want add navigation button, mean when click next, next image displayed, , when click previous, previous image displayed nicely. please me this. if possible, please give me full code clearly. my css: .gallery { border: 1px solid #5b6168; width: 162px; display:inline-block; margin:10px; border-radius:10px; } .img_head { border-bottom: 1px solid #5b6168; text-align: center; border-radius: 9px 9px 0 0; margin-top: -5px; background: linear-gradient(#698bf0, #0c101d); } .img_head h3{color:#ffffff; padding-top:5px;} img.album { height: 150px; width: 150px; margin: 5px; border-radius: 0; cursor: pointer; transition:.5s; } img.album:hover { height: 158px; width: 158px; margin: 1px; border-radius: 0 0 10px 10px; cursor: pointer; } .abs {position:fixed; z-index:9999;} #overlay { top: 0; left: 0; right: 0; height: 100%; bottom: 0; background: black;...