Posts

Showing posts from 2011

php - Different folder for views - Laravel 5.4 -

i'm trying make reusable dashboard apps, decided put in folder app/dashboard . i've managed have routes, controller, middlewares, etc. but, i'd have views in folder. added path in config/view.php , problem if have 2 views same name in app/dashboard/views , in default resources/views , of course view in default path loaded. do have better idea? can return view('dashboard:login') in controller using laravel standard tools? look @ part of documentation https://laravel.com/docs/5.5/packages#views . right, need use 2 colons return view('dashboard::login');

neural network - how / where weights and bias get value/updates in tensorflow -

from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("mnist_data/", one_hot=true) import tensorflow tf x = tf.placeholder(tf.float32, [none, 784]) w = tf.variable(tf.zeros([784, 10])) #weights! b = tf.variable(tf.zeros([10])) # bias! y = tf.nn.softmax(tf.matmul(x,w)+b) y_ = tf.placeholder(tf.float32, [none,10]) cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_*tf.log(y), reduction_indices=1)) train = tf.train.gradientdescentoptimizer(0.01).minimize(cross_entropy) sess= tf.interactivesession() tf.global_variables_initializer().run() in range(10): xs,ys = mnist.train.next_batch(100) sess.run(train, {x: xs,y_:ys}) print(sess.run(w,{x: xs,y_:ys} )) cross_validation = tf.equal(tf.argmax(y,1), tf.argmax(y_,1)) acu = tf.reduce_mean(tf.cast(cross_validation, tf.float32)) print(sess.run(acu, {x:mnist.test.images, y_: mnist.test.labels})) this tensorflow tutorial code. understand completely, don't understand intuit

python - How can I check if a warning was raised but still not to turn it into an exception -

i have method get_font can raise defaultfontwarning . want check if warning raised , run piece of code if it's case. my current solution is def set_font(self): warnings.catch_warnings(): warnings.filterwarnings("error") try: self.font = get_font(self.path, self.size) except defaultfontwarning: self.is_default = true this attaches is_default self , silences warning user cannot see it. how can check if warning raised still not turn exception , output it? raise warning (or type; such userwarning ), retain original traceback. def set_font(self): warnings.catch_warnings(): try: self.font = get_font(self.path, self.size) except defaultfontwarning e: raise warning(*e.args).with_traceback(e.__traceback__) none using from none rid of during handling ... message. can use own message such 'bad font' replacing *e.args : raise warning('bad font&#

Use code to set Suggestion Mode in Google Doc -

Image
i trying make code.gs file set editing mode "suggesting" in google doc changes seen group. other users (not me certainly) open document , forget set "suggesting" mode , after many edits, late go back. thanks in advance help.

java - 'webSecurityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.Unsat -

i looking convert spring boot + spring security + h2 https://github.com/szerhusenbc/jwt-spring-security-demo mongodb. did following changes see issue. please guide how can fixed ? please let me know how can fixed issue ? dont have idea left implement ? caused by: org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'websecurityconfig': unsatisfied dependency expressed through field 'userdetailsservice'; nested exception org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'jwtuserdetailsserviceimpl': unsatisfied dependency expressed through field 'userrepository'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'userrepository': cannot resolve reference bean 'mongotemplate' while setting bean property 'mongooperations'; nested exception org.springframework.beans.factory.unsatisfieddependencyexce

css - Force Spans to Wrap In Inline-Block Parent -

i'm writing app wrap individual characters in spans better handle click events. characters in div display: inline-block . how text wrap? i've tried: div { display: inline-block; word-wrap: wrap; word-break: break-all; } as as overflow-wrap: break-word; white-space: pre-wrap; to no avail. can see, works on normal text, not on text wrapped in spans. jsbin: http://jsbin.com/hugiqohawi/edit?html,css,output set width div elements. span s wrap @ point. for fluid width, use 100% : div { display: inline-block; word-wrap: wrap; word-break: break-all; width: 100%; }

postgresql - How do i use DataGrip to access a postgres instance behind a docker virtual network? -

Image
i have dockerized database micro services. can run manual queries using following: $ ssh user@foo.domain.com $ docker exec -it postgres bash docker$ psql -u postgres -h 127.0.0.1 -d postgres the web services talk 1 using docker bridged virtual network batman . networks: batman: driver: bridge in alignment postgres security best practices - not expose postgres port 5432 host machine @ foo.domain.com. sibling containers in 'batman' docker network allowed connect database. in traditional datagrip / postgres setup, ssh hosted box postgres served, , use local psql client (rules from: pg_hba.conf). a dockerized system requires 1 additional step (exec). seeing datagrip doesn't seem allow prefixed connection commands, how use datagrip access postgres instance behind docker virtual network? i think should possible: add simple container ssh server in same ( batman ) network set connection via ssh tunnel: configure connection if on network (so ho

python - Using requests module, how to handle 'set-cookie' in request response? -

i'm attempting open login page (get), fetch cookies provided webserver, submit username , password pair log site (post). looking @ this stackoverflow question/answer , think following: import requests import cookielib url1 = 'login prompt page' url2 = 'login submission url' jar = cookielib.cookiejar() r = requests.get(url1, cookies=jar) r2 = requests.post(url2, cookies=jar, data="username , password data payload") however, in r there set-cookie in header, isn't changing in jar object. in fact, nothing being populated jar linked question's response indicate. i'm getting around in code having headers dict , after doing or post, using handle set-cookie header: headers['cookie'] = r.headers['set-cookie'] then passing around header in requests methods. correct, or there better way apply set-cookie ? ignore cookie-jar, let requests handle cookies you. use session object instead, it'll persist

class - program needed that shows discount based on GPA -

i've been trying figure out day i'm getting nowhere. intro programming class have following problem; to encourage grades, hermosa high school has decided award each student bookstore credit 10 times student's grade point average. in other words, student 3.2 gpa receives $32 credit. create class prompts student name , grade point average, , passes values method displays descriptive message. message should use student's name, echo gpa, , display store credit amount. i know should easy enough after trying figure out brain fried i've come here looking help.

MDX same measure hierarchy on row -

i'm new mdx. i've been strugglin real hard on one. i'm trying compare same measure on 2 different week. have date dimension , total measure. want displayed following: monday tuesday wednesday thursday friday saturday sunday first week 120 54.21 128.87 1298 121 213 176 second week 98 67.21 62.32 1276 432 98 127 my query far looks this: member [measures].[firstweek] ([measures].[total], {[dim date].[date id].&[20160429]:[dim date].[date id].&[20160504]}) member [measures].[secondweek] ([measures].[total], {[dim date].[date id].&[20160505]:[dim date].[date id].&[20160512]}) select {[dim date].[week day].[week day]} on columns, ([measures].[firstweek] , [measures].[secondweek]) on rows [example] (...) the equivalent in sql simple somehow in mdx won't let me use twice same measure if it's based on different dimension time. hint appreciated ! t

c# - How to setup paging with Gridview and code behind (no data source) -

i looking on paging using gridview , data source set in code behind. want set queries database return 50 records @ time (about 20,000 in all). works except can't paging setup properly. think default paging work, don't see anywhere can tell gridview max number of pages show in navigation or overall number of records aside 50 knows about. i need blog or link step step instructions on how this. here gridview: <asp:gridview id="gvresults" cellpadding="4" headerstyle-backcolor="darkgray" runat="server" onpageindexchanging="gvresults_pageindexchanging" autogeneratecolumns="false" allowpaging="true" forecolor="#333333" showheaderwhenempty="true" pagesize="50" width="100%" enablesortingandpagingcallbacks="true"> <pagersettings pagebuttoncount="10" position="topandbottom" mode="numericfirstlast

ruby on rails - Load telegram chat history with Watir -

i writing first webscraper in rails , need retrieve chat history group part of in telegram. i know telegram written in react couldn't use mechanize decided try watir now. able have watir login , see group chats, last 100 or messages display unless scroll display more of history. when use browser.element(class: "im_history_messages_peer").text.strip i recent messages. see telegram has api, not sure how use log in account , day's worth of chat histories groups. watir viable option kind of scraping job?

c# - Azure Job BlobTrigger path to have year month day format in the path -

i writing web job processes data dumped azure storage account in format mystorage/data/{yyyy}/{mm}/{dd}/app.csv what want in blobtrigger following void foo( blobtrigger(" mystorage/data/{yyyy}/{mm}/{dd}/app.csv") stream message, textwriter log) { } is possible? want todays date parsed yyyy, mm, , dd. blob should triggered based on today's date part of path of file in blob yes, can trigger azure function such blobs. here sample function definition: [functionname("blob")] public static void blob( [blobtrigger("mystorage/data/{yyyy}/{mm}/{dd}/app.csv")] stream message, string yyyy, string mm, string dd, tracewriter log) { log.info($"found {yyyy}-{mm}-{dd}"); } it triggered if create blob called e.g. data/2017/09/12/app.csv in container mystorage . note won't validate date parts, take them plain strings: instance, data/a/b/c/app.csv processed. change type of input parameters i

c++ - gdb corefile not see function parameters -

my application crashed due uncaught exception (my c++ code throws uncaught exception under condition). trying gdb corefile. binary library "not striped". , stack trace shows function (my code) uncaught exception thrown, when try print function arguments, "no symbol xxx in current context". info args return "no symbol table info available". can shed light why ? due uncaught exception unwind/corrupts stack ? thanks, frank your binary lacks debug info. if built gcc , , want debug core have (if e.g. it's hard reproduce crash), may able recover rebuilding binary exactly same source , command lines, adding -g compile , link commands. (note: must use same compile lines; replacing -o2 -g wouldn't do.) if crash not hard reproduce, rebuild binary -g -o0 , run under gdb, , enjoy "easy" debugging. the binary library "not striped". this doesn't mean think means. not stripped means symbol table st

Having trouble with keys in a database model -

Image
i trying make database model, publish , subscribe features homework. using sqldbm modeling. can see model right below, i've got several tables connected tags . however, keys i'm worried about. in subscriptions table, tag_word , publisher_id should not displayed. other that, can describe model do, since homework , i'm not sure i've understood it. you can see database model here sql code: drop table [subscriptions]; go drop table [publisher]; go drop table [publications]; go drop table [subscribers]; go drop table [subscriber_interests]; go drop table [publication_tags]; go drop table [tags]; go drop schema dbo; go drop schema guest; go drop schema db_owner; go drop schema db_accessadmin; go drop schema db_securityadmin; go drop schema db_ddladmin; go drop schema db_backupoperator; go drop schema db_datareader; go drop schema db_datawriter; go drop schema db_denydatareader; go drop schema db_denydatawriter; go create

sum - Summing disctinct records MySQL -

i have table of inventory counts , need sum each item each location. count table log of counting +-----------+---------+---------+-------------+---------------------+ | record_id | item_id | count | location_id | time_stamp | +-----------+---------+---------+-------------+---------------------+ | 1 | 129 | 3.00 | 1 | 2017-08-23 16:56:05 | | 2 | 129 | 14.00 | 2 | 2017-08-23 16:57:28 | | 3 | 129 | 4.00 | 1 | 2017-08-31 16:59:39 | | 4 | 129 | 14.00 | 2 | 2017-08-31 17:01:27 | | 5 | 133 | 4.00 | 1 | 2017-08-23 17:02:21 | | 6 | 133 | 0.00 | 2 | 2017-08-23 17:03:22 | | 7 | 133 | 8.00 | 3 | 2017-08-23 17:03:55 | | 8 | 133 | 4.00 | 1 | 2017-08-26 17:04:22 | | 9 | 133 | 1.00 | 2 | 2017-08-26 17:05:08 | | 10 | 133 | 9.00 | 3 | 2017-08-2

How do I compare strings in Java? -

i've been using == operator in program compare strings far. however, ran bug, changed 1 of them .equals() instead, , fixed bug. is == bad? when should , should not used? what's difference? == tests reference equality (whether same object). .equals() tests value equality (whether logically "equal"). objects.equals() checks nulls before calling .equals() don't have (available of jdk7, available in guava ). consequently, if want test whether 2 strings have same value want use objects.equals() . // these 2 have same value new string("test").equals("test") // --> true // ... not same object new string("test") == "test" // --> false // ... neither these new string("test") == new string("test") // --> false // ... these because literals interned // compiler , refer same object "test" == "test" // --> true // ... should call objects.equals() o

c# - Working with Trees in Rx.NET / ReactiveUI -

how observe property changes on sublevel of tree? consider example class treenode properties name , childnodes . how observe name changes on sublevel of treenode ? the usage might this: rootnode.flattentreetoobservable(x => x.childnodes) .whenanyvalue(x => x.name) .subscribe(...) treenode example: // nuget: install-package reactiveui // in case of splat version issue: install-package splat -version 1.6.2 using reactiveui; public class treenode: reactiveobject { public string name { { return this._name; } set { this.raiseandsetifchanged(ref this._name, value); } } private string _name = ""; public reactivelist<treenode> childnodes { { return this._childnodes; } set { this.raiseandsetifchanged(ref this._childnodes, value); } } private reactivelist<treenode> _childnodes = new reactivelist<treenode>(); } i couldn't code run - ended dll versioni

UWP, Apply a converter to a ListView's item when the ListView's items source is a collection of strings -

i have following situation. want show list of strings. in order achieve that, have listview bound collection of strings. in collection, there empty strings. want show following text when empty string present: "-empty-". got far (the source code demonstration purpose only): emptystringconverter.cs public class emptystringconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, string language) { if (value string && string.isnullorwhitespace((string)value)) { return "-empty-"; } return value; } public object convertback(object value, type targettype, object parameter, string language) { throw new notimplementedexception(); } } mainpage.xaml <page x:class="app1.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/

c# - Modify Parameter Binding in ASP.NET Web API via Attribute Usage -

my goal have controller method i trying create attribute defaultvalue below: class modelclass { int modelid; string modelname; [defaultvalue("foo")] string modelstring; } class modelclass2 { string foobar; [defaultvalue("bar")] string otherstringvalue; } with controller: [httpput] public async task<httpresponsemessage> put(modelclass model) { ... } [httppost] public async task<httpresponsemessage> put(modelclass2 model2) { ... } the way defaultvalue work when user passes value in, if modelstring in modelclass null or empty string, populate "foo" (from constructor of attribute). else, user defined value used. same true of otherstringvalue in modelclass2 in asp.net mvc looks can accomplished using bindproperty method of imodelbinder interface, can't find similar webapi

PHP Remove specific URL from html string -

i trying remove specific url text string. have working part need include both http or https versions of link. $link = '&lt;a href=&quot;http://example.com/tool/document.php?id=208&quot; target=&quot;_blank&quot;&gt;document requirementsd&lt;/a&gt;'; $result = preg_replace('/<a href=\"http:\/\/' . $_server["server_name"] . '\/tool\/document.php\?id=(.*?)\">(.*?)<\/a>/', "\\2", htmlspecialchars_decode($html)); whats best way make sure both http , https links stripped? you can use (http|https):\/\/ match both http or https!

yahoo api - OAuth oauth_problem="OST_FORMAT_ERROR" Cause? -

earlier today error started come have not seen before since using yahoo oauth several years now. oauth oauth_problem="ost_format_error" any ideas on how fix this? there no documentation anywhere , google search comes nothing ost_format_error . this regression in yahoo's code. fixed few hours later. affecting clients using oauth 1.0 (they discontinuation support it) you should upgrade code use oauth 2.0

java - How can i rewrite this methods without duplication? -

how can make code without duplication? methods similar. method create phone numbers: private list<string> createphonenumbers(string sqlstatement, long id) { list<string> phones = new arraylist<>(); try (preparedstatement statement = this.connection.preparestatement(sqlstatement)) { statement.setlong(1, id); try (resultset resultset = statement.executequery()) { while (resultset.next()) { phones.add(resultset.getstring("phonenumber")); } return phones; } } catch (sqlexception e) { e.printstacktrace(); return null; } } method create friend list: private list<account> createfriendlist(string sqlstatement, long id) { list<account> friends = new arraylist<>(); try (preparedstatement statement = this.connection.preparestatement(sqlstatement)) {

node.js - node js call to confluence API returns null -

hi new using node , rest api calls. i found node js wrapper confluence apis: https://github.com/johnpduane/confluence-api#confluence+getspace var confluence = require("confluence-api"); var config = { username: "<user>", password: "<pw>", baseurl: "https://<page>.atlassian.net", }; var confluence = new confluence(config); confluence.getspace(<space name>, function(err, data) { // interesting data; instance, // data.results[0].body.storage.value contains stored markup first // page found in space 'space-name' matching page title 'page-title' console.log(data) console.log(err) console.log(data.results[0].id); }); the return of null. not sure means -- not connecting through confluence page? misunderstanding how use api calls?

c# - How to Insert Multiple rows having dropdownlist in asp.net MVC? -

Image
i searched lot , tried few things did not work out. need resolve problem. wanted instert multiple records in child1 table have foreign key(i.e. dropdownlist). i have table child1with following columns public int id_child1 { get; set; } public int parentid{ get; set; } public string data1{ get; set; } public datetime col1{ get; set; } parentid foreign key referring parent table. after following 1 of method youtube, wrote code below- controller- public class child1controller : controller { private testentities db = new testentities(); public actionresult bulkdata() { viewbag.parentid = new selectlist(db.parents, "parentid", "data"); // show default 1 row insert data database list<child1> ci = new list<child1> { new child1 { parentid = 0, data = "" ,col1=datetime.now} }; return view(ci); } [httppost] [validateantiforgerytoken]

php - Why do my [shortcodes] show as plain text from the WP editor? -

i'm trying use shortcodes execute tag-specific content loops on different pages of website. know shortcode function working properly, because when hardcode do_shortcode page template, shows perfectly. but when try add [shortcode] directly wordpress editor instead, shows plain text. ideas how can fix this? you can see i'm talking here - [showtag tag="seefour"] see plain text written directly wordpress text editor. it's not working correctly. below it, you'll see <?php echo do_shortcode("[showtag tag='seefour']"); ?> executing content loop page template. any ideas how can fix this? hardcoding do_shortcode not sustainable me. site has 2 active plugins, problem persists after deactivating them, i'm @ loss. for measure, content loop i'm trying execute: function showtag_shortcode( $atts ) { $atts = shortcode_atts( array( 'tag' => '', // default value. ), $atts ); $posts = get

IntelliJ Terminal - Support for cursor movement w/ ANSI escape codes -

i working on console app needs move cursor via ansi escape codes (the sole possibility afaik). terminal of intellij (the tab named "run", not os-dependent terminal) not seem support this. other features background/foreground color changing working fine. os-dependent terminal in intellij supports cursor movement (i use jansi library, should not matter). is there setting or plugin enables functionality? convenient.

c# - Displaying Column Headers As Dates Telerik Rad Grid -

Image
normally have code post. however, i'm not sure start on one. maybe incorrect request little different (from clients). so, needing new feature added page. want able run report shows employees total hours given set of weeks. use datepicker select start date , select , end date. then, click button run report. report have employee name first column , each column after have header date. if selected 8-5-2017 , 8-19-2017 column headers 8-5-2017| 8-12-2017| 8-19-2017. underneath columns total hours each employee worked given week. i've attached image of needing do. provide additional clarification. i've had similar situation , managed solve using datatable contained data. simple way fill datatable creating stored procedure. in example i'll every day between 2 given dates, should able change code have work once every 7 days, starting on monday/sunday, depending on requirement is. if need well, leave comment , i'll see can if find time. create type [dbo].

validation - Why does my model have bad val_loss results with good loss results and prediction? -

i developed model in keras , provides bad val loss results. achieved results post training has 0.11 loss , 1.4 val_los here input data inputsa = np.array([[ 1, 1, 1, -1, -1, -1,-1, -1,-1, 1, 1, 1]], dtype=float).reshape((12, 1)) inputsb = np.array([[-1, -1, -1, 1, 1, 1,-1, -1,-1, 1, 1, 1]], dtype=float).reshape((12, 1)) inputsc = np.array([[-1, 1, 1, -1, 1, 1,-1, 1, 1,-1, 1, 1]], dtype=float).reshape((12, 1)) inputsd = np.array([[-1, -1, 1, -1, -1, 1,-1, -1, 1,-1,-1, 1]], dtype=float).reshape((12, 1)) input_arra = inputsa[0:8].reshape((8, 1)) input_arrb = inputsb[0:8].reshape((8, 1)) input_arrc = inputsc[0:8].reshape((8, 1)) input_arrd = inputsd[0:8].reshape((8, 1)) this target data targets = np.array([[-1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1

angular - Display PDF file from C# to Angular2 view -

i'm trying display pdf uploaded server. pdf resides inside app_data folder. want fetch using c# web api 2 , display in angular 2 frontend view. c# code: httpresponsemessage response = request.createresponse(httpstatuscode.badrequest); string filename = "somefilename.pdf"; byte[] buffer = new byte[0]; memorystream memstream = new memorystream(); if (filename != "") { pdfreader reader = new pdfreader(path.combine(httpcontext.current.request.physicalapplicationpath) + "/app_data/uploads/pdfs/" + filename); pdfstamper stamper = new pdfstamper(reader, memstream); response = request.createresponse(httpstatuscode.ok); buffer = memstream.toarray(); response.content = new streamcontent(new memorystream(buffer)); response.content.headers.contenttype = new mediatypeheadervalue("application/pdf"); response.content.headers.contentlength = buffer.length; contentdispositionheadervalue contentdisposition =

node.js - karma, jasmine, typescript and requirejs all together? -

is there repo other there showing how karma, jasmine, typescript , requirejs work together? make contemporary sense use of these karma-with-jasmine testing? i see karma-requirejs-preprocessor [ repo ] , karma-typescript-preprocessor [ repo ] have not found , example of four---karma, jasmine, typescript , requires---working together. i assume can see these 4 working under influence of chosen technologies of aurelia without having dive aurelia repo .

java - How to Properly Close Raw RestClient When Using Elastic Search 5.5.0 for Optimal Performance? -

am using spring boot 1.5.4.release microservice connect elasticsearch 5.5.0 instance using low level rest client elasticsearch provides. pom.xml <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.5.4.release</version> </parent> <dependencies> <!-- spring --> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <!-- elasticsearch --> <dependency> <groupid>org.elasticsearch</groupid> <artifactid>elasticsearch</artifactid> <vers

Android: how to do background clickable effect by programmatically? -

i have background button. <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable="@android:color/transparent" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@color/whitetransparent50" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@color/whitetransparent50" /> <item android:drawable="@android:color/transparent" /> </selector> but not want. because have 1 main image. , image has 2 section call , b. when press section main image changing c image. , when press b section main image changing d image. solution is: a.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view view, motionevent motione

ruby on rails - Failed to build gem native extension nio4r in Vagrant SSH windows 7 32-bit -

i'm setting rails environment using vagrant box ubuntu/trusty32 in windows 7 32-bit host. i'm stuck bundle install --path=./vendor/bundle . got following error: gem::ext::builderror: error: failed build gem native extension. current directory: /vagrant/vendor/bundle/ruby/2.4.0/gems/nio4r-2.1.0/ext/nio4r /home/vagrant/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20170911-24730-8nkvsn.rb extconf.rb checking unistd.h... yes checking sys/select.h... yes checking poll.h... yes checking sys/epoll.h... yes checking sys/event.h... no checking port.h... no checking sys/resource.h... yes creating makefile text file busy @ unlink_internal - ./siteconf20170911-24730-8nkvsn.rb gem files remain installed in /vagrant/vendor/bundle/ruby/2.4.0/gems/nio4r-2.1.0 inspection. results logged /vagrant/vendor/bundle/ruby/2.4.0/extensions/x86-linux/2.4.0-static/nio4r-2.1.0/gem_make.out error occurred while installing nio4r (2.1.0), , bundler cannot continue. make sure `gem install nio4r

c++ - Can __cplusplus ever be defined and equal to zero? -

this question has answer here: how __cplusplus directive defined in various compilers? 2 answers the question came of whether 1 should wrap extern "c" using #if or #ifdef . i.e.: #if __cplusplus extern "c" { #endif or #ifdef __cplusplus extern "c" { #endif which begs question: there ever situation __cplusplus defined equal zero? according standard, __cplusplus macro must defined, exact definition depends on c++ standard being used not zero. for example, c++11 must 201103l , note "it intended future versions of standard replace value of macro greater value." historically, in ancient non-conforming compilers dig up, __cplusplus defined 0 indicate non-conformance standard. of historical interest. see: how __cplusplus directive defined in various compilers?

Compare two dates in c# from Mysql -

i have column in database named tblreburial , field reburialdate. type varchar , format of date (yyyy/dd/mm).in c# have query: string query = "select date_format(reburialdate,'%y/%d/%m') reburialdate tblreburial"; in while statement: while (myreader.read()) { string date = (myreader["reburialdate"].tostring()) if(date == datetime.now.tostring("yyyy/dd/mm")){ //some statements } } i tried many ways string not recognized valid datetime. you can convert datareader datetime , compare datetime.today var date = datetime.parse(myreader["reburialdate"]) if(date.date == datetime.today) { //some statements } you can optionally pass format information datetime.parse . here msdn documentation.

linux - How to "grep" in array with dot "." precisely? -

i'm trying check if user input $1 exist in array. , here code: array=( aaa.bbb.ccc ccc.ddd.aaa ) echo ${array[@]} | grep -o -w "$1" what expect "aaa.bbb.ccc" or "ccc.ddd.aaa" can found. however, in case, "aaa" or "ccc" can pass validation. seems dot not treated part of string. should use regex or other grep option? it sounds want: literal string matching against entire input lines. therefore, use -f (for literal matching) , -x whole-line matching: array=( aaa.bbb.ccc ccc.ddd.aaa ) printf '%s\n' "${array[@]}" | grep -fx "$1" now, literal strings aaa.bbb.ccc , ccc.ddd.aaa match, not substrings such aaa . since you're matching entire line, use of -o (to output matching part of each line) unnecessary. also note how printf '%s\n' "${array[@]}" must used print each array element on own line, whereas echo ${array[@]} prints elements on single

c++ - QOpenGLWidget move context to another thread crash -

i have simple example , program crashed when tried call context()->movetothread(render_thread_); . can help? class framerenderer: public qthread { q_object public: framerenderer(qglcanvas *parent):m_parent(parent), qthread(){} void run() q_decl_override; qglcanvas *m_parent; }; class qglcanvas : public qopenglwidget, protected qopenglfunctions { q_object public: qglcanvas(qwidget* parent = null); ~qglcanvas(); virtual void initializegl(); virtual void paintgl(); virtual void resizegl(int width, int height); void drawthreadentry(); framerenderer* render_thread_; }; void framerenderer::run() { m_parent->drawthreadentry(); } qglcanvas::qglcanvas(qwidget* parent) : qopenglwidget(parent) { render_thread_ = new framerenderer(this); donecurrent(); context()->movetothread(render_thread_); render_thread_->start(); } void qglcanvas::drawthreadentry() { while(true) { makecurrent();