Posts

c# - Splitting a JSON key based on regex to store in multiple variables -

{"key":"abc/1"} i want store value in 2 fields instead of one. can following. [jsonproperty(propertyname = "key", required = required.always)] public string value { get; set; } however, want have 2 fields use jsonproperty to serialize , deserialize them combined string. example, if define following fields: public string valuescope { get; set; } public int valueid { get; set; } i want use jsonproperty or other tag populate fields while deserializing. possible that, i.e. populate valuescope "abc" , valueid 1 ? yes, can implement get , set of 2 properties manipulate underlying jsonproperty . here's quick example of how might go (warning: wrote out in notepad, please excuse typos). public string valuescope { { var values = (this.value ?? "").split('/'); if (values.length == 2) return values[0]; else return null; } set { this....

machine learning - When doing cross validation, what changes if you ensure that the class distribution in the training and test set is equal to the whole set? -

let's take binary classification problem. when doing k-fold cross validation, when separate randomly shuffled dataset k chunks, how have same label distribution function of k? if class distribution uneven, 95% of dataset negatives , 5% positives, seems pretty there low values of k label distribution uneven. of course true values of k such k = (size of dataset), low values of k, such 5. my main fear may occur don't have enough positive examples in training set in phase of cross validation. on other hand, if go , ensure equal label distribution in chunks, seems me may bringing bias problem. basically want ask is, gain , lose, if ensure label distribution in chunks? or bad? , importantly, why? seems similar question here https://stats.stackexchange.com/questions/117643/why-use-stratified-cross-validation-why-does-this-not-damage-variance-related-b anyways, you'll have different models if have 1% 6% positives. better build on balanced data set. how the...

ruby gem require_relative cannot load such file -

i've looked around online , on , of answers question should using require_relative using don't know problem might be. i'm trying build ruby gem , folder structure looks this --xmlmc-rb/ --lib/ --xmlmc-rb/ api.rb interface.rb version.rb xmlmc-rb.rb within xmlmc-rb.rb requiring 3 of files under xmlmc-rb/ directory this require_relative "xmlmc-rb/version" require_relative "xmlmc-rb/interface" require_relative "xmlmc-rb/api" require 'net/http' require 'nokogiri' require 'base64' but keep getting error /library/ruby/gems/2.0.0/gems/xmlmc-rb-0.1.1/lib/xmlmc-rb.rb:2:in `require_relative': cannot load such file -- /library/ruby/gems/2.0.0/gems/xmlmc-rb-0.1.1/lib/xmlmc-rb/interface (loaderror) /library/ruby/gems/2.0.0/gems/xmlmc-rb-0.1.1/lib/xmlmc-rb.rb:2:in `<top (required)>' /library/ruby/site/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require' /libra...

google bigquery - Big query update or delete issue -

i can't update or delete operation big query api via php. have techniques complete task. 2016-08: bigquery support update , delete :) does bigquery support update, delete, , insert (sql dml) statements? you can achieve updates , deletes bigquery - it's not native operation. to delete rows table, re-materialize without un-desired rows: select * [my.table1] not id in (19239,192392139,129391) (set options "allow large results" , "write results my.table1") to update rows, can similar: select * ( select * [my.table1] not id in (select id [my.updated_rows] ), ( select * [my.updated_rows] ) in other words: bigquery analytical database, delete , update not optimized operations - pull them off single select statement overwrites original table.

playframework 2.4 - (Play 2.4.2, Play Slick 1.0.0) How do I apply database Evolutions to a Slick managed database within a test? -

i write database integration tests against play slick managed database , apply , unapply evolutions using helper methods described in play documentation namely, evolutions.applyevolutions(database) , evolutions.cleanupevolutions(database) . these require play.api.db.database instance not possible hold of can see. jdbc library conflicts play-slick how database instance slick? use following slick database def running slick queries: val dbconfig = databaseconfigprovider.get[jdbcprofile]("my-test-db")(fakeapplication()) import dbconfig.driver.api._ val db = dbconfig.db thanks, leanne here how dow guice: i inject guice: lazy val appbuilder = new guiceapplicationbuilder() lazy val injector = appbuilder.injector() lazy val databaseapi = injector.instanceof[dbapi] //here important line (you have import play.api.db.dbapi.) and in tests, following (actually use other database tests): override def beforeall() = { evolutions.applyevolutions(databasea...

css - How to make centered fixed width body responsive? -

i have simple css layout, restrict body width , center on screen: body { max-width: 38em; margin: auto; } i expected responsive: on huge screens lines stay short , body centered, on small screens body take hold of of screen can get. works in web browser's "responsive design view". on mobile devices, page displayed if huge screen: tiny text, big margins on side. how can tell mobile browsers stop behaving stupid? you need specify viewport width when working mobile browsers. <meta name="viewport" content="width=device-width, initial-scale=1"> read more: mdn

create usercontrol using javascript or winJS or angularJS for Windows8 -

i developing windows 8.1 application using html5/javascript. need create usercontrols create in native windows application. reason:single page has code of multiple pages/modules, code cleanup , better understanding. how create usercontrols or there other way same? yes there possibility same. winjs has fragments can load , unload, in same manner usercontrols in windows forms. pages behave in same way, if using windows javascript template application "navigator.js"-file. here image msdn site how navigator.js switches pages default.html example: in main html file define button loads fragment testing purpose , div id fragment loaded: <div class="box"> <button class="win-button action" id="basicfragmentloadbutton">load fragment</button><br /> <div id="basicfragmentloaddiv"></div> <br /> <div id="status"></div> </div> in javascript ...