Posts

Showing posts from July, 2015

time - How to convert a numeric number in R to timestamp in R? For example, from 62280 to 17:18:00 -

i have rdata file, 1 column in time. however, when load in r, shown in numbers. for example, 17:18:00 shown 62280 , 06:30:00 shown 23400 , 18:30:00 shown 66600 , 10:30:00 shown 37800 , 01:00:00 shown 3600 . i figure out number divided 3600 equal time, 23400/3600 = 6.5. but still stuck how in next step. give clue? also, "divided 3600" standard time conversion in r? if so, there function conversion? thank you! 1) using chron package gives "times" class object or if prefer character strings use format(times(...)) . library(chron) x <- c(62280, 23400, 66600, 37800, 3600) times(x / (24 * 60 * 60)) ## [1] 17:18:00 06:30:00 18:30:00 10:30:00 01:00:00 2) using posixct class , no packages can character strings this: format(as.posixct(x, origin = "1970-01-01", tz = 'utc"), "%h:%m:%s") ## [1] "17:18:00" "06:30:00" "18:30:00" "10:3...

html - object HTMLInputElement JavaScript error -

so basically, i'm doing webpage calculate school marks can't print result @ input value... instead, prints [object htmlinputelement] here's javascript code: <script type="text/javascript"> </script> <script> window.onload = function () { var quran = document.getelementbyid('quran').value; var islamic = document.getelementbyid('islamic').value; var arabic = document.getelementbyid('arabic').value; var english = document.getelementbyid('english').value; var games = document.getelementbyid('games').value; var pc = document.getelementbyid('pc').value; var maths = document.getelementbyid('maths').value; var chem = document.getelementbyid('chem').value; var phys = document.getelementbyid('phys').value; var bio = document.getelementbyid('bio').value; var social = document.g...

css - How to get a jQuery Mobile full-width horizontal controlgroup? -

i have horizontal controlgroup 2 buttons: right 1 icon-only button standard fixed width whereby first 1 shall elastic , fill remaining width. i'm aware similar question has been asked before, tried different solutions , none seems work me, or aren't working jqm 1.4.5: i can't put second button before first 1 in markup because jqm first-child , last-child styling break i can't set width percentage (as seen in many examples) because icon-only button has fixed width of 1.5em the controlgroup should not break @ smaller window sizes, shall in 1 row, first button ellipsis text is there way controlgroup has 1 (or more one) icon-only button on right side, fit 100% of parent div width? <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <link rel="stylesheet" href="https://code.jque...

R Gui crashes with Keras Tensorflow windows cuda gpu -

edit: solved. not using proper version of cudnn. after downloading , copying on cudnn v5.1 library windows 10, works fine far. should have followed tensorflow windows guidelines more closely. i spent time set windows system run r-tensorflow keras , tensorflow backend. i followed these blog instructions, , able hello world example work. however, when continue r keras examples , several crash , exit rgui during running training phase, e.g. mnist_cnn fails @ training model block. # train , evaluate model %>% fit( x_train, y_train, batch_size = batch_size, epochs = epochs, verbose = 1, validation_data = list(x_test, y_test) ) a visual studio jit popup shows "an unhandled win32 exception occured in rgui.exe[10456]." , vs editor shows, "unhandled exception @ 0x00007fffea2734be (ucrtbase.dll) in rgui.exe: fatal program exit requested." there little load on cpu , or gpu during runtime (less 30%). ideas on how further debug appreciated. h...

java - Return different type of data as per the condition -

i have problem in if in method, called rest end point, have errorlog method should return file. otherwise, if correct, should return json. is there way change return type of method per condition? i start saying wrong approach problem. correct approach throw exception if have error, , deal using exception handler. alternatively, use call-back handle error case before returning method. (that deal "generate errorlog" use-case.) having said .... here's "complex" object can use return 1 of 2 types: public class aorb { private final a; private final b b; private final boolean isa; public aorb(a a) { this.a = a; this.b = null; isa = true; } public aorb(b b) { this.a = null; this.b = b; isa = false; } public boolean isa() { return isa; } public geta() { if (isa) { return a; } else { throw illegalstateexcepti...

osx - Autofill password in one command on Mac -

how autofill root password in single command on mac? want run following command computer not sleep while downloading, computer shutdown. i run following still prompted password $ caffeinate -u -t 7200 && echo | sudo -s shutdown -h now

javascript - Add or Remove multiple list item on the basis of AND,OR,NOT conditions in angular js -

i want add multiple add or remove multiple rules on basis of and/or/not operators. example: rule1>12h && rule2<10h. how can that? <label class="control-label" for="field_notificationrules">notification filter rules:</label> <div class="form-group"> <table class="table table-stripped table-bordered"> <thead> <tr> <th><label class="control-label" for="field_filterruledefinition">rule definition</label></th> <th>&nbsp;</th> </tr> </thead> <tbody> <tr> <td> <input type="text" class="form-control" name="notificationfilterrulesdefinition" id="field_filterruledefinition" ng-model="vm.notificationrules.notificationrules.noti...

redux form - Get error values of fields -

i wanted error values name s of fields in form. wanted show "form-level" error saying "you need go @ field" , clicking individual messages scroll them field. i haven't been able figure out how other "form-level" error this.props.error . i had similar requirement , used getformsyncerrors selector returns object keys name of invalid fields , values corresponding error: { recipientaddress: "required", recipientcity: "required", recipientzip: "required" }

python - How to assert variable content in unit test (Flask, Python3, Nose2) -

i have flask app page content comes global variable. i'm trying set unit testing assert data, can't seem local variable work: test_string = foo self.assertin(b['test_string'], response.data) fails with: nameerror: name 'b' not defined if reference plain variable: self.assertin(test_string, response.data) i expected failure: typeerror: bytes-like object required, not 'str' the test succeeds if hard-code variable data test, i'd rather not have update test if variable changes. missing here? the problem bytes literal prefix b : bytes literals prefixed 'b' or 'b'; produce instance of bytes type instead of str type. may contain ascii characters; bytes numeric value of 128 or greater must expressed escapes. while sounds bytesprefix = bytes type, not seem work if data comes variable. the solution change b prefix bytes function bytes , states: bytes objects can created literals, see string , bytes...

android - Client side caching of specific content -

our site music streaming website aimed @ spas , wellness centers. the music content isn't changing, it's 1 or several playlists depending on customer chooses isn't live or dynamic content. the playlists update occasionally, every couple of months, removing tracks, adding new ones. we looking way cache music content on users machine/device.thus reducing our bandwidth overheads. the site built wordpress , there android app. i believe there .htaccess rule me, want avoid using plugin if out there can i'd eternally grateful. thanks in anticipation of brilliant responses.

Passing java jar output to python in an efficient way -

i trying speed way call java jar python saving resulting string (java system.out.println) in python list. used write directl file java, found slow, opening , closing file each time, trying speed up. i have: subprocess.call( ['java', '-jar', 'tensiontwoslices.jar', '-runtype', '"groundtruth"', '-inputwindow', inputwindow, '-outputwindow', groundtruth, '-inputfile', '"not.txt"', '-key', '"c"'],stdout=subprocess.pipe, stderr=subprocess.pipe); i read here can use stdout, tried: p = subprocess.popen( ['java', '-jar', 'tensiontwoslices.jar', '-runtype', '"groundtruth"', '-inputwindow', inputwindow, '-outputwindow', groundtruth, '-inputfile', '"not.txt"', '-key', '"c"'],stdout=subprocess.st...

Android EditText with text password input type doesn't select all character by double tap -

Image
i'm trying use edittext textpassword input type. faced situation in characters entering in field selected double tap in android version 5 , 4.4 while feature didn't work on android version 6. please me have feature in android versions? this xml file: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <edittext android:hint="text password input type" android:inputtype="textpassword" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout> this result: the general algorithm be: private long timelastclicked; private static final time_double_click_ms = 1000; private edittext passwordfi...

Oracle to SQL Server: Month + Year where clause -

i have oracle query goes follow: select ... ... ... , to_char(a.bill_date, 'mmyyyy') = '072017' ... order ... in sql server, have month() , year() functions. select ... ... ... , month(a.bill_date) = month(getdate()) , year(a.bill_date) = year(getdate()) ... order ... is there allows me apply month-year constraint oracle to_char through single step? have make parameterized , maintain compatibility both databases through common interface. now, 1 require 2 parameters , other one. i think closest thing oracle's to_char function in sql server convert . convert see no option request year , month. rather, need accept @ least day well, , possibly timestamp in addition this. convert accepts date format mask parameter third argument. 112 mask returns date in following format: yyyymmdd so date in question return this: 201707dd where have left dd undefined don't know day given record might have. can close want ta...

node.js - zsh: command not found: gulp Cannot run GULP -

it doesn't matter forum follow, cannot gulp work! error message: npm warn deprecated minimatch@2.0.10: please update minimatch 3.0.2 or higher avoid regexp dos issue npm warn deprecated minimatch@0.2.14: please update minimatch 3.0.2 or higher avoid regexp dos issue npm warn deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 , before fail on node releases >= v7.0. please update graceful-fs@^4.0.0 possible. use 'npm ls graceful-fs' find in tree. npm err! path c:\usr\local\node_modules\gulp npm err! code eexist npm err! errno -4075 npm err! syscall mkdir npm err! eexist: file exists, mkdir 'c:\usr\local\node_modules\gulp' npm err! file exists: c:\usr\local\node_modules\gulp npm err! move away, , try again. npm err! complete log of run can found in: npm err! c:\users\stole\appdata\roaming\npm-cache\_logs\2017-08-20t06_34_20_449z-debug.log { ~ } » gulp -v ...

extjs - GeoExt: Change Filter via changing field name -

in geoext 2, have form 1 field , 2 radio buttons. coded radio buttons change name of field correspond convention of geoext. items: [ { xtype: "numberfield", itemid: 'parcel', name: 'parcelatt__ge', fieldlabel: 'parcel number:' }, { xtype: 'radiogroup', fieldlabel: 'search type:', columns: 2, vertical:true, items: [ { boxlabel: 'greater than', name: 'option', inputvalue: '1', submitvalue: false, checked: true, listeners: { change: function (field, newvalue, oldvalue) { if (newvalue) mypanel.down('#parcel').inputel.dom.name = 'parcelatt__ge'; } } }, { boxlabel: 'lower then', ...

How to add font awesome icon in Custom HTML Helper in ASP.Net MVC 5 application -

Image
i want use font awesome icons in custom html helper not able so. below attempt: html helper public static mvchtmlstring menulink(this htmlhelper htmlhelper, string linktext, string actionname, string controllername, object routevalues, object htmlattributes) { var currentaction = htmlhelper.viewcontext.routedata.getrequiredstring("action"); var currentcontroller = htmlhelper.viewcontext.routedata.getrequiredstring("controller"); var currentarea = htmlhelper.viewcontext.routedata.datatokens["area"]; var builder = new tagbuilder("li") { innerhtml = htmlhelper.actionlink(linktext, actionname, controllername, routevalues, htmlattributes).tohtmlstring() }; if (string.equals(controllername, currentcontroller, stringcomparison.currentcultureignorecase) && string.equals(actionname, currentaction, stringcomparison.currentcultureignorecase)) builder.ad...

c# - Is it possible to bypass RichTextBox input -

i have richtextbox (rtb_inputfield). whenever type in rtb, , press enter, send string typed server. put same string rtb_inputfield , select programmatically (this way user can send same data quickly, pressing enter again - or send string starting type it.) , far. now want is: if numlock locked , press of numpad keys (0-9) want bypass rtb_inputfield completely. bypass mean: not type of numbers rtb, , instead handle these numbers directly elsewhere. (i'm planning send data server way, while last command user wrote in rtb remains unchanged.) but if numlock not locked want numpad put numbers rtb. is possible , how? here's code have @ moment: (i have modified see what's relevant question.) private list<keys> numpadlist = new list<keys>(); private void populatenumpadlist() { numpadlist.add(keys.numpad0); numpadlist.add(keys.numpad1); numpadlist.add(keys.numpad2); numpadlist.add(keys.numpad3); numpadlist.add(ke...

python web scraping - email protected -

not using scamming! - using scam bating trying scrape emails website, output looks this: [email protected]/* <![cdata[ */!function(t,e,r,n,c,a,p){try{t=document.currentscript||function(){for(t=document.getelementsbytagname('script'),e=t.length;e--;)if(t[e].getattribute('data-cfhash'))return t[e]}();if(t&&(c=t.previoussibling)){p=t.parentnode;if(a=c.getattribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).tostring(16)).slice(-2);p.replacechild(document.createtextnode(decodeuricomponent(e)),c)}p.removechild(t)}}catch(u){}}()/* ]]> */ here code: import requests bs4 import beautifulsoup r = requests.get("https://forum.419eater.com/forum/viewforum.php?f=18", headers={'user-agent': 'mozilla/5.0'}) soup = beautifulsoup(r.content, "html.parser") link in soup.find_all("a"): print(link.text) ...

geolocation - Cannot determine user position over GeoPoint.current() in Baqend -

i'm trying determine user's position in baqend, error every time: promise { <rejected> referenceerror: navigator not defined @ c:\users\user\documents\github\sunaware\node_modules\baqend\lib\geopoint.js:19:7 @ function.current (c:\users\user\documents\github\sunaware\node_modules\baqend\lib\geopoint.js:18:12) @ repl:1:13 @ siginthandlerswrap (vm.js:22:35) @ siginthandlerswrap (vm.js:73:12) @ contextifyscript.script.runinthiscontext (vm.js:21:12) @ replserver.defaulteval (repl.js:340:29) @ bound (domain.js:280:14) @ replserver.runbound [as eval] (domain.js:293:12) @ replserver.<anonymous> (repl.js:538:10) } (node:6652) unhandledpromiserejectionwarning: unhandled promise rejection (rejection id: 1): referenceerror: navigator not defined i'm exclusively working on terminal right now, these inputs: > node > var db = require('baqend') > db.connect('my-app') > db.login('user', 'password') > db.geopoint.cur...

javascript - Using multiple canvas with pdf.js -

i display in html page 4 canvas , each of them correspond page of pdf file. succeed display 1 page in 1 canvas, when want display 4 doesn't work : none of pages displayed. what i'm doing wrong ? edit : tried solve problem of promise (i edited code) got error : error: invalid page request pdf.js:2687:31 , here corresponding code (2697 line of return) : getpage: function workertransport_getpage(pagenumber, capability) { if (pagenumber <= 0 || pagenumber > this.numpages || (pagenumber|0) !== pagenumber) { return promise.reject(new error('invalid page request')); } here code : html file : <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta name="description" content="pdf viewer"/> <title>my page</title> </head> <body> <body> ...

java - Test if point is within line range on 2D space -

Image
this question bit hard formulate i'll start showing image: i want test if points (such p1 , p2 on image) within dotted lines perpendicular line @ limits. know coordinates of points test , line's limits. so p1 false, , p2 true. what computationaly efficient way calculate this? i'm working floats in java. this can efficiently done dot product : this positive if a has component parallel b , , negative if anti-parallel. therefore if have line segment defined points a , b , , test point p , need 2 dot product operations test: dot(a - b, p - b) >= 0 && dot(b - a, p - a) >= 0 edit: graphical explanation: the dot product can shown be: thus if θ > 90 dot(a, b) < 0 , , vice versa. problem: in case 1, when dot(a - b, p - b) > 0 p on correct side of dotted line @ b , , vice versa in case 2. symmetry can same operation @ a , swapping a , b .

Making a 2D simple RPG for Android- Android Studio or Unity? -

i'm making rpg, have started using android studio realised might not best platform use. should continue or switch unity, considering following facts: it's 2d, no 3d objects involved. i want make heavy use of pedometer function tracks steps when app shut- more feasible in or unity? i have no experience unity.

java - ResultSet getFetchSize() doesn't seem to work? -

i'm having trouble getfetchsize() function. i need know if sql query has returned 0 rows. i've tried simple statement: if (rs.getfetchsize()==0) system.out.println("headline"); where rs of resultset type. above code doesn't seem work. prints message whether rs empty or not. i checked sql query , correctly returned non-empty result when rows existed. any thoughts on how can determine whether query has returned 0 rows? googled , couldn't find answer. resultset.getfetchsize() doesn't return number of results! here : standard jdbc enables specify number of rows fetched each database round-trip query, , number referred fetch size you can iterate across result set , if don't have entries, can determine got no results. why can't result size ? because database returning pointer results , it's relying on iterate through (going server each row).

erlang lists:dropwhile weird result -

can please me understand what's going on here lists:dropwhile(fun(x) -> x < 8 end, lists:seq(1,10)). "\b\t\n" % ??? ? why not [8,9,10] lists:dropwhile(fun(x) -> x < 7 end, lists:seq(1,10)). [7,8,9,10] % correct your results correct in both cases. unexpected string in first case due fact in erlang strings lists of integers. therefore, erlang chooses interpret first list string, since contains printable ascii codes. in second case list contains code 7, not printable, erlang forced interpret integer list. you can print actual integer list using mylist = lists:dropwhile(fun(x) -> x < 8 end, lists:seq(1,10)), io:format("~w", [mylist]).

c# - Pivot table with more columns -

i trying pivot list of records, came across : public static datatable pivottable<t, tcolumn, tgrouprow, trow, tdata>( system.collections.generic.ienumerable<t> list, func<t, tcolumn> column, expression<func<t, trow>> row, func<ienumerable<t>, tdata> dataselector) { datatable table = new datatable(); var rowname = ((memberexpression)row.body).member.name; table.columns.add(new datacolumn(rowname)); var columns = list.select(column).distinct(); foreach (var col in columns) table.columns.add(new datacolumn(col.tostring())); var rows = list.groupby(row.compile()) .select(rowgroup => new { key = rowgroup.key, values = columns.groupjoin( rowgroup, ...

android - How to set Image from another api using Retrofit 1.9 in recyclerview -

i using retrofit 1.9 fetch data rest api show in recyclerview. far geting necessary information user. want show image of users on recyclerview. user information have 1 api. " https://sample.app.com/api/user ". in api not have image field. collect user image have api " https://sample.app.com/api/profileimage/ "+mail.i trying add image using 'com.squareup.picasso:picasso:2.5.2' . after running program , cannot see thing on recyclerview. here model class user. mention no impage filed there in json file. user api [ { "_id": "588797978", "dn": "cndfgdfgdfg", "sn": "das", "title": "title", "givenname": "tom", "whenchanged": "20170623093215.0z", "company": "company limited", "name": "soutrik das", "mail": "mail@com.de", "mobile"...

Google Analytics to Discord Server -

i own discord server , every week report publish on server. is possible ? i'm positive works, don't know how. depends on want report on. i've has seen bot counts messages post , gives exp , levels...

c++ - Difference in c_str function specification between C++03 and C++11 -

in c++ reference of c_str() in std::string following appears: return value pointer underlying character storage. data()[i] == operator[](i) every in [0, size()) (until c++11) data() + == &operator[](i) every in [0, size()] (since c++11) i not understand difference between two, except range increase 1 element since c++11. isn't former statement data()[i] == operator[](i) true latter? except range increment 1 element since c++11, there still big difference between: data()[i] == operator[](i) and: data() + == &operator[](i) that main difference & operator in prototypes. the old prototype, allowed copy made when write operation occur, since pointer returned point buffer 1 holding original string. the other difference in prototypes between data()[i] , data() + i , not critical, since equivalent . a difference between c++ , c++11 in former, std::string not specified explicitly standard whether have null terminator or...

ios - Variables from custom subclass aren't saved/won't load from Core Data -

i making drawing application allows users save , reopen drawings, hence why need use coredata. 1 of features ability change path colour. need store colour in each uibezierpath strokes right colour when gets drawn. hence subclassed uibezierpath: class colorpath: uibezierpath { var pathstrokecolor: uicolor? } i draw paths in draw(_ rect:) function: path in paths{ path.pathstrokecolor?.setstroke() path.stroke() } this works fine until close application , reopen it. pathstrokecolor has nil value, , draws in default colour -- black. the array of path arrays saved in core data entity jfile this. "thearray" of type transformable, convert colorpath nsobject: let context = (uiapplication.shared.delegate as! appdelegate).persistentcontainer.viewcontext let afile = jfile(context: context) afile.thearray = arrayofpages nsobject (uiapplication.shared.delegate as! appdelegate).savecontext() the array of path arra...

java - Picasso multiImage downloader get " target got garbage collected" -

i try make cache on code using flickr api want download image once try create custom picasso helper download image in request garbage collection error when loop item public class picassohelper { public static picasso mypicasso; private static final string tag = "picassohelper"; public static void init(context context){ picassohelper.mypicasso = picasso.with(context); } public static class downloadtarget implements target { public string filename; public runnable onbitmaploaded; public runnable onbitmapfailed; @override public void onbitmaploaded(bitmap bitmap, picasso.loadedfrom from) { log.i(tag, "onbitmaploaded"); searchactivity.protectedfromgarbagecollectortargets.remove(this); try { file picfile = new file(filehelper.getappexternaldir(), filename); if(picfile.exists()){ picfile.delete(); } picfile.createnewfile(); fileoutputstr...

python - PyCharm bugging when trying to have multi-inheritance -

Image
as try make multi-inheritance class, got pycharm freezing... oh, gave me feed back: i on mac book air, 8g of ram. did had same experience ? edit the code : from library.connect_to_people import connect_to_people library.get_infos import get_infos library.superdriver import superdriver class website(superdriver, get_infos, connect_to_people): def __init__(self, username, password): """ renvoie un objet avec un driver selenium. """ assert(type(username) == str) assert(type(password) == str) superdriver.__init__(self) get_infos.__init__(self) connect_to_people.__init__(self)

stanford nlp - Check for words in input text from words collection -

i have collection of noun phrases around 10,000 words. want check every new input text data these np collection , extract sentences contains of these np. don't want run loops every word because makes code dead slow. using java , stanford corenlp. a quick , easy way use regexner identify examples of in dictionary, , check non "o" ner tags in sentence. package edu.stanford.nlp.examples; import edu.stanford.nlp.ling.*; import edu.stanford.nlp.pipeline.*; import edu.stanford.nlp.util.*; import java.util.*; import java.util.stream.collectors; public class findsentenceswithphrase { public static boolean checkfornamedentity(coremap sentence) { (corelabel token : sentence.get(coreannotations.tokensannotation.class)) { if (token.ner() != null && !token.ner().equals("o")) { return true; } } return false; } public static void main(string[] args) { properties props = new properties(); props.setproperty...

php - How to build front-end multiple page website using ReactJS for a web-api service -

my original website developed in laravel framework, client wants separate back-end front-end in wants back-end work purely api based web-service. so decided build sample blog api service using lumen micro framework, api has following features:- login, register, post blog, post comment i tested api endoints using postman , working fine i new concept of front-end frameworks decided take @ reactjs, while going through facebook documentation liked framework, not able understand using webpack + bundle + reactjs how can make multiple page front-end website api-service plan host api-service on other server , host front-end website on other server my question based on goal expectation reactjs correct? or should use angularjs or other front-end framework front-end website have multiple pages, how decide react component render on particular page, apart apache need install anyother web-server make react work? all tutorials came across seems serve 1 page application, using webpac...

can't access apache from localhost using xampp -

hi new programming. trying access apache through localhost , using xampp. running, when type in localhost , show "it works!", when enter localhost/~alexpham/ shows not found! have created folder inside user. great. have tried everything. cd /etc/apache2/users directory "/users/alexpham/sites/"> options indexes multiviews allowoverride all require granted allow all /directory> alexs-macbook-pro:users alexpham$ sudo chmod 644 alexpham.conf alexs-macbook-pro:users alexpham$ sudo apachectl restart alexs-macbook-pro:users alexpham$ cd ~/sites/ alexs-macbook-pro:sites alexpham$ open . alexs-macbook-pro:sites alexpham$ nano index.html

printing - Can anyone generate file with logo using CoLOS create Professional? -

i want test image printing using markem imaje smartdate x40 printer. need example .itf file image. edit file without using colos create professional because don't have programm , programm myself, need example file. so have colos create professional or have .itf file image? if yes, write comment please. thanks!

ruby - Date column in mysql table not being updated -

i have following table updating ruby script, alough fact ruby script not think relevant unless bug in mysql gem (which seems unlikely). +---------------+---------------+------+-----+---------+-------+ | field | type | null | key | default | | +---------------+---------------+------+-----+---------+-------+ | venue_code | varchar(10) | no | mul | null | | | title | varchar(100) | no | | null | | | description | varchar(2000) | yes | | null | | | start_date | date | no | | null | | | start_time | time | yes | | null | | | date_modified | datetime | yes | | null | | | date_created | datetime | no | | null | | | url | varchar(500) | yes | | null | | | price | varchar(50) | yes | | null | | | url_ticket | varchar(500) | yes | | null | | +---------------+-...

mysql - When I run TIME_TO_SEC to modify a GENERATED column, it throws an error although TIME_TO_SEC works fine independently in a SELECT statement -

i running following mysql script , throws error, tell me wrong? "alter table class_sessions_archive modify column session_time_computed int(11) time_to_sec(ends_on-starts_on)" the error message in mysql remains cryptic, however, paste here: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'time_to_sec(ends_on-starts_on)' @ line 1 all need take difference of 2 dates , store in seconds in new column. made new column , want modify it. the expression should go in parentheses: alter table class_sessions_archive modify column session_time_computed int(11) (time_to_sec(ends_on - starts_on));

Vivado & Verilog: How to Use A Clock -

how use clock in verilog vivado? i've tried no avail. my project target artix-7 chip on arty artix-7 development board. from i've gathered online, ip integrator i'm supposed use... nobody has decent introduction using it. i've created design , created "clocking wizard," leaving every setting @ default [for now] (including input frequency being "auto"). then, in project manager, seems need tell design "create hdl wrapper." however, complains input clock pin not begin connected. but that's point: i'm trying access clock source. don't have clock. can't figure out how clock. google failing me. many google results have things nets , pins, if try declare variable net clock_out1 ; // clock output design it complains net unrecognized. assume design has turned hdl wrapper need use resultant module same way use other module, can't figure out how make work. how clock source ?

Apache configured to listen on port 80 only but instead listening on port 8080 as well -

Image
i not able use port 8080 because apparently used. in order see program using it, typed following command in terminal (on macos): sudo lsof -n -i :8080 here's result: httpd listening on port 80, found out using following command: sudo lsof -n -i :80 | grep listen here's result: so went find out "httpd"-process was. apparently web server installed on machine. web server installed on machine apache2. given fact concluded apache2 apparently configured listen on port 80 , on port 8080. but: here's crazy thing: went folder /etc/apache2 , opened file "httpd.conf". in file apache configured listen on port 80 !!! why hell listening on port 8080 ?! how can make listen on port 80 ?

javascript - Hicharts not plotting live points when out of view -

as per fiddle when pan out of live view, seems chart stops plotting points , when in view connects last visible point new point causing huge slope/line. rectifying appreciated. thanks. `code long, post here` setting cropthreshold: infinity, on series config did trick.

.net - Generic abstract argument for method C# -

i have code example. , don't why not compile. not allow convert d a<b> . d inherits a<c> . c inherits b , mean should able pass d a<b> method argument right? i'm missing obvious here. using system.collections.generic; public class program { public void main() { var d = new d(); foo(d); //cannot convert d a<b> } private void foo(a<b> bar) { } } public abstract class a<typeb> typeb : b { public abstract list<typeb> list { get; set; } } public abstract class b { } public class c : b { } public class d : a<c> { public override list<c> list { get; set; } } this question has been asked hundreds of times on site. suppose have bowl of fruit. bowl of apples? apple fruit, why bowl of fruit not bowl of apples? because bowl of fruit contain banana, , not bowl of apples. suppose have bowl of apples. bowl of fruit? want "an apple fruit, ther...

java - Cannot instantiate the type Pair although not abstract -

trying write iterator returns pair: part of pairiterator public pair next() { this.counter ++; pair p = new pair(this.l.get(counter - 1), this.l.get(counter)); //error occurs here } public class pair<e> { private e e1; private e e2; public pair(e e1, e e2) { this.e1 = e1; this.e2 = e2; } public e first() { return this.e1; } public e second() { return this.e2; } } getting cannot instantiate type pair ... although pair not abstract class/interface. why happening? check imports. (or ide) imported pair class.

How to create new database in neo4j? -

Image
i'm using linux 16.04 os. have installed fresh neo4j. referenced exegetic , digitalocean sites. by default there's graph.db database. my question how create new database , create nodes , relation ship between nodes? as show in picture default db name graph.db . since you're using neo 3.x, create new database without removing existing one, can edit neo4j.conf file in conf directory of $neo4j_home . search dbms.active_database= , should have default value of graph.db . replace other name , start neo4j again. now, new database created under directory name. switch previous db, repeat steps, replace new value graph.db in configuration file.

linux - Bash counting executed time -

i want write script in bash save file how long have been executed i want output this: 1 minute 2 minute ... requirements you need install time (not shell built-in). to validate have right one: $ time this expected output: $ time /usr/bin/time solution assuming have function called main , in main scripting code included function main() { echo "sleeping .." sleep(5) echo "this first arg: ${1}" echo "this second arg: ${2}" } to time function call, follows (arguments reference): main "hello" "world" | $(which time) -o "output_filename_for_time" -f "%e" $(which bash) explanation we piping /usr/bin/time function call time it. calling time using $(which time) because not want shell built-in. after passing -o argument define our output file , -f argument used define time format. in example, i used seconds . in end, pass shell using, , in our case using bash, $(which bash) . ...

html - Centering absolutely positioned element in CSS Grid -

on mozilla pen works. when switch chrome breaks. it's me or wrong browsers? .container { height: 500px; width: 500px; background-color: beige; display: grid; grid-template-rows: 1fr; grid-template-columns: 1fr; } .container h2 { position: absolute; justify-self: center; align-self: center; grid-row: 1; grid-column: 1; } <div class="container"> <h2>text</h2> </div> codepen link it appears chrome has deviated spec guidance on issue. the justify-self , align-self properties should work on absolutely-positioned child element of grid container. 9.2. grid container parent an absolutely-positioned child of grid container out-of-flow , not grid item, , not affect placement of other items or sizing of grid. the static position of absolutely-positioned child of grid container determined if sole grid item in grid area edges coincide padding edges of grid ...

asp.net - Is it possible to make prepaid internet accessing project in. NET? -

is possible make prepaid internet accessing project in. net? in user first notify when open wifi available or not.when available user can access in limited(reduced speed or limited mb). full access open wifi user need register can access open wifi. idea practically possible implement in. net???

shell - Unable to gzip the file in the same location on Solaris -

i trying find file bigger 1 gb , zipping content, , after file zipped, need delete tar file , nullify existing file. here while gzipping file, it's not gzipping same path; it's going user's home directory. on solaris servers. i running remote server. ssh -o stricthostkeychecking=no -qt 192.168.1.1 "$(<.fs1.sh)" this .fs1.sh contains: threshold="50" date=`date +"%m-%d-%y"` fs in $(df -k / /var /tmp| awk '{print $6}' | sed '1 d'); chk=$(df -k ${fs} | sed '1 d' | awk '{print $5}' | awk -f\% '{print $1}') if [ ${chk} -gt ${threshold} ]; /usr/local/bin/sudo rm -f /tmp/files.log /usr/local/bin/sudo rm -rf /var/core /usr/local/bin/sudo rm -rf /var/audit files=`/usr/local/bin/sudo /usr/bin/find /var/adm -xdev -type f -size +1000000000c -exec ls -lht {} \; | awk '{ print $9}'` files1=`/usr/local/bin/sudo /usr/bin/find /var/adm/log -xdev -type...

javascript - How to stop video after ajax? -

<head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-bvyiisifek1dgmjrakycuhahrg32omucww7on3rydg4va+pmstsz/k68vbdejh4u" crossorigin="anonymous"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <section id="top" class="clearfix"> <div class="wrapper"> <div class="ml-title" style="margin-bottom: 2em"> <span class="pull-left top">watch</span> <ul role="tablist" class="nav nav-tabs"> <li class="active"><a data-toggle="tab" role="tab" href=...

php - How can i create a user dashboard -

today have questions you, want create user dashboard site, include (obviously), users data, example -email -username -and others stuff how can information, , print them in html page? if can, how can these information via php sessions? shuld use session? example, if user login, , start new session ( session_start() ), how can data print in dashboard? should use php "project"? in advice, have day , thank time!

java - How to configure spring-boot with security for custom SQL schema user-role? -

i try configure spring-boot-security integrated sql schema: create table if not exists users ( id serial primary key, username varchar(20) unique not null, password varchar(20) unique not null, role integer not null, foreign key (role) references user_role (id) ); create table if not exists user_role ( id serial primary key, role varchar(10) ); i find many examples of integration database spring-boot-security , examples this: @autowired public void configauthentication(authenticationmanagerbuilder auth) throws exception { auth.jdbcauthentication().datasource(datasource) .usersbyusernamequery( "select username,password, enabled users username=?") .authoritiesbyusernamequery( "select username, role user_roles username=?"); } i don't understand how work methods usersbyusernamequery , authoritiesbyusernamequery . why select username ? password ? pas...

php - search data refine by different category count and location count in mysql -

ex . search word phone in classified portal have refine result count(result found if talk category 5 in computer , 15 in automobile , if talk location 7 in germany , 13 in france) below category computer (5) automobile(15) location germany(7) france(13) how query database . want show first 20 result need show data count category , location.