Posts

Showing posts from January, 2013

machine learning - Keras: model.evaluate vs model.predict accuracy difference in multi-class NLP task -

i training simple model in keras nlp task following code. variable names self explanatory train, test , validation set. dataset has 19 classes final layer of network has 19 outputs. labels one-hot encoded. nb_classes = 19 model1 = sequential() model1.add(embedding(nb_words, embedding_dim, weights=[embedding_matrix], input_length=max_sequence_length, trainable=false)) model1.add(lstm(num_lstm, dropout=rate_drop_lstm, recurrent_dropout=rate_drop_lstm)) model1.add(dropout(rate_drop_dense)) model1.add(batchnormalization()) model1.add(dense(num_dense, activation=act)) model1.add(dropout(rate_drop_dense)) model1.add(batchnormalization()) model1.add(dense(nb_classes, activation = 'sigmoid')) model1.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) #one hot encode labels ytrain_enc = np_utils.to_categorical(train_labels) yval_enc = np_utils.to

Android - compile Google play service and sync -

i'm struggling compile google play service. i've got updated , there problem can't understand. when put compile 'com.google.android.gms:play-services:11.0.4' and try sync there problem with compile 'com.android.support:appcompat-v7:25.3.1' it's giving me message: "all com.android.support libraries must use exact same version specification (mixing versions can lead runtime crashes). found versions 25.3.1, 25.2.0. examples include com.android.support:animated-vector-drawable:25.3.1 , com.android.support:mediarouter-v7:25.2.0 less... (ctrl+f1) there combinations of libraries, or tools , libraries, incompatible, or can lead bugs. 1 such incompatibility compiling version of android support libraries not latest version (or in particular, version lower targetsdkversion.)" this updated version of google play services. i'm not clear why wrong. from release notes: when upgrade app’s play services dependencies 11.2.0 or

css - How can I center my html form? -

so watched tutorial on how create contact me form. problem having trouble centering it. uses grid tags , responsive. keep responsive there when in full width want centered logo is. (new html & css learning) html code <div class="container"> <h1 class="brand"><span>acme</span> web design</h1> <div class="wrapper animated bounceinleft"> <div class="contact"> <h3>email us</h3> <form> <p> <label>name</label> <input type="text" name="name"> </p> <p> <label>company</label> <input type="text" name="company"> </p> <p> <label>email address</label> <input type="email" name="email"> </p> <p> <label>phone number</label&g

html - Refactoring Javascript Function inside a Function -

i tips on refactoring following code, honest, it's not complex i'm still learning best practices , conventions. html: <div class="joke-container"> <div class="joke-text"> "this boring static joke" </div> <div class="joke-control"> <button type="button" value="random">random</button> </div> </div> js: const jokes = [ '"this funny joke"', '"this super crazy joke"', '"omfg random"' ]; const randomjokebutton = document.queryselector( "button[type=button][value=random]" ); function randomjoke(jokes) { return (joke = jokes[math.floor(math.random() * jokes.length)]); } function printjoke(joke) { let joketext = document.queryselector(".joke-text"); return (joketext.textcontent = joke); } randomjokebutton.addeventlistener("click", () => { printjoke

hibernate - how to map a joined ResultSet to an object in java? -

i took example here map resultset object , , works great, realized problem can't map resultset join query. example have 2 tables, usr , vehicle . select query , join two. public class usr { public int id; public vehicle vehicle; } public class vehicle { public int id; public int year; public string model; public int user_id; } how can map resultset usr object? googled bit , found sqlresultsetmapping might solution, seems lot of work adopt hibernate, , i'm familiar pure java . example here , looks need rewrite query statements , put db structure in java . is there other ways can map joined resultset object without mess on current code? edited the query this; select * usr join vehicle on usr.id = vehicle.user_id; and want map usr object lets break whole thing in new way. approach following kind of handy comes limitations. handles primitive types of field. classes having association other objects or tables in db forei

oracle - Why does dbms_sql.parse containing incorrect PL/SQL block with bind variables succeed unexpectedly? -

the pl/sql block below fails expected: sql> declare 2 int; 3 begin 4 := dbms_sql.open_cursor; 5 dbms_sql.parse(i,'begin dontexist; dbms_output.put(''a''); end;',1); 6 dbms_sql.close_cursor(i); 7 end; 8 / declare * fout in regel 1: .ora-06550: regel 1, kolom 7: pls-00201: identifier 'dontexist' must declared. ora-06550: regel 1, kolom 7: pl/sql: statement ignored. ora-06512: in "sys.dbms_sql", regel 1120 ora-06512: in regel 5 because don't have procedure called dontexist. question why next pl/sql block complete successfully? sql> declare 2 int; 3 begin 4 := dbms_sql.open_cursor; 5 dbms_sql.parse(i,'begin dontexist; dbms_output.put(:a); end;',1); 6 dbms_sql.close_cursor(i); 7 end; 8 / pl/sql-procedure geslaagd. the difference use of bind variable instead of constant, i'd know why makes difference. this oracle 12.1.0.2 looks parse syntactic anon

ios - Non renewable in app purchases -

now i'm working non renewable in-app purchases . have several questions guys. user1 buy subscription 1 month, example. save expiration date of subscription in backend. ok, after 1 month user1 wants re-buy subscription. apple say: "user1, bought before, lets make restore" , extends subscription expiration date. how can solve problem? how can control expiration date of subscription? wiki

c# - VerifyAll() with Throws<T>() in Moq -

i have mock object method i'm trying setup throwing exception when executed, particular unit test case using moq framework. var mockmysvc = new mock<imysvc>(); mockmysvc .setup(x=>x.somemethod()) .throws<exception>(); //execution of code //at assertions mockmysvc.verifyall(); at runtime, code complains expections of mockmysvc not having been met despite exception being thrown. missing or .verifyall() method not work .throws() functionality. i don't know way of setting up, way: assert.throws<exception>(() => myclass.somemethod()); this way don't need verify anything. based on comment how make sure exception thrown inside method, can check code inside catch blocks. [test] public void test1() { _filmservice.setup(f => f.findbyid(it.isany<int>())).throws<exception>(); _filmcontroller.test(); _filmservice.verify(f => f.exists(it.isany<film>()), times.once); } actual code: publ

shell - Redirect output parameter of command to variable using bash script -

hello i developed program 1 can use flags output different kinds of data different files, example: $ ./program -csv file.csv -log file.log -out out.txt -result result.txt ... in case, csv output should saved on file file.csv , log file.log , on. want way save output directly bash variable can use later on script. example: $ ./program -csv $(write csv_var) \ -log $(write log_var) \ -out $(write out_var) \ -result $(write result_var) \ ... as result, want see csv output of program when call echo ${csv_var} . same should happen log_var , out_var , result_var , etc. how can this? i thought manually creating temporary file each variable, saving output file , reading back, i'm looking cleaner in example above (imagine lot of instances of program running in parallel, files may override others). also, important variable data exists while script running, in "solution" above, if kill script, temporary files / folders continue exist. thanks in

firebase - How to login just with "email" and "password" using identity-toolkit-php-client? -

how login "email" , "password" using identity-toolkit-php-client ? class gitkit_clien ask email ( getuserbyemail ) not ( getuserbypassword ). please me out here. pd: php support please, there firebase sdk por php , not have user authentication (well yeah, not 1 email , password) i did guzzle. xd https://firebase.google.com/docs/reference/rest/auth/#section-sign-in-email-password xd xd xd .... wiki

wordpress - align-items:center not working in custom CSS? -

Image
for reason align-items doesn't work in custom css. advice how can around this? picture of issue: this code: .list-view { display:flex; } .item-image { display:flex; align-items:center; } i guessing second part issue. align-items in white in custom css in wordpress whereas other properties display in navy blue, guessing can't read property, not sure why is. a working jsfiddle , have added flex: 1; item-image class. .list-view { border: 1px solid black; display: -webkit-flex; /* safari */ -webkit-align-items: center; /* safari 7.0+ */ display: flex; text-align: center; } .item-image { align-items: center; flex: 1; -webkit-flex: 1; /* safari 6.1+ */ } <div class="list-view"> <div class="item-image" style="background-color:coral;">red</div> <div class="item-image" style="background-color:lightblue;">blue</div>

node.js - nw-gyp build --target=0.24.3 is not work -

i trying build sqlite3 node-webkit. for installed(environment): python v2.7 node v8.4 nw.js v0.24.3 microsoft visual studio c++ 2015 windows step1 git clone https://github.com/developmentseed/node-sqlite3.git cloning 'node-sqlite3'... remote: counting objects: 4161, done. remote: total 4161 (delta 0), reused 0 (delta 0), pack-reused 4160 eceiving objects: 99% (4148/4161), 31.85 mib | 945.00 kib/s receiving objects: 100% (4161/4161), 32.10 mib | 883.00 kib/s, done. resolving deltas: 100% (2389/2389), done. setp2 nw-gyp clean gyp info worked if ends ok gyp info using nw-gyp@3.4.0 gyp info using node@8.4.0 | win32 | x64 gyp info ok setp3 nw-gyp configure --target=0.24.3 gyp info worked if ends ok gyp info using nw-gyp@3.4.0 gyp info using node@8.4.0 | win32 | x64 gyp info spawn c:\users\刘剑\.windows-build-tools\python27\python.exe gyp info spawn args [ 'c:\\users\\刘剑\\appdata\\roaming\\npm\\node_modules\\nw-gyp\\gyp\\gyp_main.py', gyp info spawn args

How does JavaScript .prototype work? -

i'm not dynamic programming languages, i've written fair share of javascript code. never got head around prototype-based programming, 1 know how works? var obj = new object(); // not functional object obj.prototype.test = function() { alert('hello?'); }; // wrong! function myobject() {} // first class functional object myobject.prototype.test = function() { alert('ok'); } // ok i remember lot discussion had people while (i'm not sure i'm doing) understand it, there's no concept of class. it's object, , instances of objects clones of original, right? but exact purpose of .prototype property in javascript? how relate instantiating objects? edit these slides helped lot understand topic. every javascript object has internal property called [[prototype]] . if property via obj.propname or obj['propname'] , object not have such property - can checked via obj.hasownproperty('propname') - runtime looks proper

php - Extended class gets only initial value of parent's variable -

class myappclass { protected $_config = array(); protected $_template = ''; public function init( ){ require_once('core_config.php'); // inside $_sc_config array of values $this->_config = $_sc_config; $this->_template = new template; echo $this->_template->echo_base(); } } class template extends myappclass{ public function echo_base() { var_dump($this->_config); // returns empty array } } $myapp = new myappclass; $myapp->init(); what's wrong code above var_dump($this->_config) in template class returns empty array after init function? thanks in advance. i think don't object programming yet. in myappclass::init method create new object of template class extends myappclass class. have no idea want acheve show snippet works. <?php class myappclass { protected $_config = array(); protected $_template = ''; protected

c# - Can't access mapped network drive -

i have consoleapp (not asp.net) takes files directories (the app runs on windows server 2012). app works fine local dirs , shared dirs (ex. "\\myshare\dest"). however, when map share (from "\\myshare x:) directorynotfoundexception. i have map drive because of files exceeding 260 letters limit. furthermore, when debug app on pc, don't error while accessing mapped drive. thanks in advance :) p.s: i've seen other posts problem app doesn't run right user privileges. app runs credentials map exists user.. edit: did little workaround , worked. instead of creating mapped network drive used mklink command , made shortcut share: mklink /d c:\myshortcut \\myshare thanks everyone if understood question , comments correctly, mapped drive cannot accessed mapping not visible application. understanding possible programmatically connect share using platform invoke, more precisely following 2 functions , structure. [dllimport("mpr.dl

unix - Need to remove the extra empty lines from the output of shell script -

i'm trying write code print files taking more min_size (lets 10g) in directory. problem output off below code files irrespective of min_size. getting other details mtime , owner later in code part doesnt work fine, whats wrong here ? #!/bin/sh if (( $# <3 )); echo "$0 dirname min_size count" exit 1 else dirname="$1"; min_size="$2"; count="$3"; #shift 3 fi tmpfile=$(mktemp /lawdump/pulkit/files.xxxxxx) exec 3> "$tmpfile" find "${dirname}" -type f -print0 2>&1 | grep -v "permission denied" | xargs -0 -i {} echo "{}" > "$tmpfile" in `cat tmpfile` x="`du -ah $i | awk '{print $1}' | grep g | sort -nr -k 1`" size=$(echo $x | sed 's/[a-za-z]*//g') if [ size > $min_size ];then echo $size fi done note : know can done through find or du need write shell script have email sent out regularly details. wiki

reactjs - React Storybook Fails on Demo -

i'm attempting use react storybook in project has extensive webpack 2 config. started storybook following basic steps: npm -g @storybook/cli getstorybook when run yarn storybook , breaks on jsx of demo component: error in ./stories/index.jsx module parse failed: /users/alexanderhadik/project/web/node_modules/@storybook/react/node_modules/babel-loader/lib/index.js??ref--0!/users/alexanderhadik/project/web/stories/index.jsx unexpected token (9:55) may need appropriate loader handle file type. | import { button, welcome } '@storybook/react/demo'; | | storiesof('welcome', module).add('to storybook', () => <welcome showapp={linkto('button')} />); | | storiesof('button', module) @ ./.storybook/config.js 4:2-23 @ multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/config/globals.js ./node_modules/webpack-hot-middleware/client.js?reload=true ./.storybook/config.js

asp.net - Google MAPS API: Marker icons are shown in development but is missing when published -

i trying show location of different teams on map. teams positions obtained databases. app runs 100% in development (visual studio). publish app, markers not displayed on map. think missing in javascript. icon images links full web addresses. if use default icon link outside website, markers displayed during development application published on webserver images disappear. after run in development, following error message displayed: "exception thrown @ line 119, column 78 in http://maps.googleapis.com/maps/api/js?key=aizasyccojqmidlvnqj5znoxwr0jgtduvvum988 " tells me there must wrong javascript. the code: <%@ page title="field team data display" language="c#" autoeventwireup="true" codefile="fieldteamdatadisplay.aspx.cs" inherits="fieldteamdatadisplay" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html x

php - JavaScript - How do I execute certain query from dropdown select? -

i'd simplify code execute query based on user choose the idea user show query based on base + group query when visit page first time. next, can decide data they'd see dropdown below //base $material = "select material, count(material) 'total' `khitable` "; $storagelocation = "select sloc ,count(sloc) 'total' `khitable`"; $verifstock = "select verif_stock ,count(verif_stock) 'total' `khitable`"; //tipe pipa $erw = "where material '%er%'"; $sp = "where material '%sp%'"; $acc = "where material '%acc%'"; //status pengerjaan $fg = "and material not '%sf-%'"; $wip = "and material '%sf-%'"; //ketersediaan $so = "and so_number not '%605%'"; $buffer = "and so_number '%605%'"; $fs = "and material '%-fs%"; //group $groupmaterial = "group material&q

Natural search the object array with numbers and text in Javascript -

i have array following, need apply natural sort on this, on text field. var data = [{ "text": "1001", "value": "212121" }, { "text": "1002", "value": "32435" }, { "text": "a101", "value": "324124324" }, { "text": "a12", "value": "567y54645" }, { "text": "a123", "value": "534534" }, { "text": "a21", "value": "34534534" }, { "text": "a210", "value": "5345345" }, { "text": "a33", "value": "234234234" }, "text": "b2", "value": "4234234" }, {

git branch - Git - Making Changes to Multiple Master Branches -

my small group of developers creates , maintains interfaces several different versions of our company's core product. different versions of our core product similar, there differences require keep our code in separate branch each version. in same repository. we required switch git, , trying determine best workflow when need make same change of our branches. far, have been relying on cherry pick every commit. cumbersome , there has better way. here example of we're doing: v1 master: ... (a1)--(b1)--(c1)---------(m) \ / v1 feature: (d)----(e) / v2 master: ... (a2)--(b2)--(c2) <--? before merging our v1 feature onto v1 master, rebase onto v1 master. simple , makes sense since v1 feature branched off v1 master. however, want same d , e commits applied v2 master. branches similar enough commits shouldn't cause conflicts. right cherry pick them individually, ,

ruby on rails - Inviting a friend to your app using Facebook API -

i have web app built rails backend , want users able invite friends use web app. i've been using koala gem interact graph api. this code looks like: @graph = koala::facebook::api.new(fb_token) @graph.get_connections("me", "friends") #returns empty array @graph.get_connections("me", "taggable_friends") #returns array of friend hashes here example of 1 of hashes: {"id"=>"aaipicqkrerndvdbb1e8w1zaonnzhii6yu5n-n8dchlb1ua88udffexf1enhtzjaxan9bnlv3s0ci2da6itdcerqbmyvhkyevlovd8ibxkv8fa", "name"=>"john smith", "picture"=> {"data"=> {"is_silhouette"=>false, "url"=>"https://url-for-profile-photo"}}} then when attempt do: @graph.put_connections("aaipicqkrerndvdbb1e8w1zaonnzhii6yu5n-n8dchlb1ua88udffexf1enhtzjaxan9bnlv3s0ci2da6itdcerqbmyvhkyevlovd8ibxkv8fa", "notifications", template: "foo&

javascript - How to return Latitude and Longitude to multiple text input fields with Google map API -

i have search form 2 search google places autocomplete inputs. i trying return valued of new position respective input field. success had able output position values both text fields. while need show on text field through location searched. also don't know why though ids different both fields still values return on both of them. code: function initmap() { var map = new google.maps.map(document.getelementbyid('map'), { center: {lat: -33.8688, lng: 151.2195}, zoom: 13, type: ['geocodes'] }); var card = document.getelementbyid('pac-card'); var input1 = document.getelementbyid('pac-input1'); map.controls[google.maps.controlposition.top_right].push(card); var autocomplete1 = new google.maps.places.autocomplete(input1); autocomplete1.bindto('bounds', map); var marker = new google.maps.marker({ icon: base_url + 'includes/images/pointer.png', icon: 'http

custom keyboard Radio Button Telegram JAVA -

i ?, how do in java? source = https://www.mql5.com/es/articles/2355 image ... i don't know how make object in java can provide idea on how that. show in keyboard, json should send this: ... ... 'reply_markup': json.stringify({ keyboard: [ [ {'text': 'radio button #1'} ], [ {'text': 'radio button #2'} ], [ {'text': 'radio button #3'} ], [ {'text': 'unlock'}, {'text': 'mute'} ] ], one_time_keyboard: true, resize_keyboard: true ... you need send keyboard json show keyboard image. search what's equivalent of json.stringify in java , how make request , how construct object in language. to put emoji in keyboard message, need search unicode code of emoji , write in keyboard text, this: ... {'text': '\u{270b} radio button #1'}, ... wiki

typescript - Wait for a Subscription and a Promise in Angular 4 -

i'm new angular 4, accept may better off changing approach. what have this: ngoninit() { this.route.parammap .switchmap((params: parammap) => { var id = +params.get('id'); return this.service.getone(id); }).subscribe(data => { if (data.clientid === 0) { data.clientid = +this.route.snapshot.queryparams["parentid"]; } this.model = data; },); // subscription this.lookupservice.getlist("clients").then(data => { this.clients = data; }); // promise } on client-side, need make server call, when have data both of calls above. in other words, need subscription complete (well, not complete set value) , promise complete. is there promise.all work ensure this.model has been set in subscription call? edit: run these in series, performance reasons, want run them in parallel. edit 2: promise intended load lookup data po

java - How do I deal with a ClassNotLoadedException while debugging? -

so i'm (remotely) debugging java/jboss application in eclipse, stepping through line line. @ 1 point, array of gridsquare objects ( gridsquare simple, standalone class, contains few properties , methods) created method call, i.e: gridsquare[] squares = this.thegrid.getsquares(14, 18, 220, 222); ...while when execute code, squares array populated gridsquare objects, odd when stepping through code , debugging. @ breakpoint on line following assignment shown above, if try view squares array, instead of value this: org.eclipse.debug.core.debugexception: com.sun.jdi.classnotloadedexception: type has not been loaded occurred while retrieving component type of array. ...anyone know that's about? basically means class loader has not loaded gridsquare[] class. being said sounds bug in debugger in way. breakpoint association code seems broken. either need recompile line numbers in sync or other issue going on. @ point in code (after assignment) needs loaded. u

Rails validations, mixing messages and full_messages -

for part, find rails default error messages of built-in validators work fine me. however, have few validations on models default "{{attribute}} {{message}}" full_message format doesn't make semantic sense. know can display messages instead of full_messages, mean have add in own messages every built-in validation, because otherwise attribute name chopped off. is there way use default full_message format, directly override full_message handful of validations use different format or particular string? there natural way mix default validation messages few custom ones don't start attribute name? you can add custom messages config/locales/en.yml wiki

mysql - How would you load a html page with <a href="page.php?id=10">Link</a> -

this question has answer here: fatal error: call member function prepare() on non-object in 2 answers how pull data link on different page mysqli (solved) 1 answer how mysqli error in different environments? 1 answer ok have site dynamically load pages, seem keep failing work. can set each page tell load id display associated id, cannot can click link load id. here have , cannot work... <?php $server = "localhost"; $user = "username"; $pass = "password"; $dbname = "dbname"; //creating connection mysqli $conn = new mysqli($server, $user, $pass, $dbname); //checking connection if($conn->connect_error){ die("connection failed:&quo

iis 7 - Query related to IIS server -

i have below queries regarding use of iis server:- is compulsory use web/application server (like tomcat) deploy war when using iis server? can use iis server standalone publish web site? can use iis server local file system not deployed on web/application server? wiki

Print all the lines between two patterns in shell -

i have file log of script running in daily cronjob. log file looks like- aug 19 line1 line2 line3 line4 line5 line6 line7 line8 line9 aug 19 aug 20 line1 line2 line3 line4 line5 line6 line7 line8 line9 aug 20 aug 21 line1 line2 line3 line4 line5 line6 line7 line8 line9 aug 21 the log written script starting date , ending date , in between logs written. now when try logs single day using command below - sed -n '/aug 19/,/aug 19/p' filename it displays output - aug 19 line1 line2 line3 line4 line5 line6 line7 line8 line9 aug 19 but if try logs of multiple dates, logs of last day missing. example- if run command sed -n '/aug 19/,/aug 20/p' filename the output looks - aug 19 line1 line2 line3 line4 line5 line6 line7 line8 line9 aug 19 aug 20 i have gone through site , found valuable inputs similar problem none of solutions work me. links link 1 link 2 the commands have tried - awk '/aug 15/{a=1}/aug 21/{print;a=0}a' aw

c# - Entity Framework: How to have 2 properties referring to same other table -

so imagine have simple database system can receive boxes (incoming) , send boxes (outgoing). 1 box has multiple boxcontent, "a" boxcontent can have incoming box (when arrived) outgoing box (when gets sent away). but when have structure this, entity framework adds "box_id" column database table of boxcontent. here's entities: public class boxcontentitem { public box incomingbox { get; set; } public box outgoingbox { get; set; } } public class box { public ilist<boxcontentitem> boxcontentitems { get; set; } } so how make ilist<boxcontent> boxcontent link either box incomingbox or box outgoingbox ? you can use inverseproperty attribute on box entity, need add additional property like: public class box { [inverseproperty("incomingbox")] public ilist<boxcontentitem> incomingboxcontentitems { get; set; } [inverseproperty("outgoingbox")] public ilist<boxcontentitem> outgo

passport.js - How do I allow email as an alternative to username while authenticating with PassportJS? -

how allow uses log in using username or email? authenticating using passport local strategy connected mongoose schema. currently, i'm able authenticate username (and password, of course). /login route looks this: // lib/authenticate.js router.post('/login', (req, res) => { passport.authenticate('local')(req, res, () => { // logged in, return user info token if (req.user) { const userdata = json.stringify(req.user); let token = jwt.sign({ username: req.user.username, firstname: req.user.firstname, lastname: req.user.lastname, email: req.user.email, img: req.user.img, }, process.env.jwt_secret); res.cookie('token', token); return res.send(userdata); } // otherwise return error return res.send(json.stringify({ error: 'there error logging in' })); }); }); the mongoose model passport hook

Function naming for R packages -

i writing r package , avoid using function names found in other packages. example, planned call function 'annotate', has been used in nlp package. evidently best avoid obvious name choices, there systematic way search exhaustive list of cran published function names avoid duplication? appreciate important cran shared packages can relevant when sharing locally in case there conflict loaded package. name clashes occur when 2 packages loaded contain functions same name. so, name clashes can avoided @ 2 places: when defining function names in package when calling functions package creating functions unique names at time of writing (23 aug 2017), incredible number of 11272 packages available on cran (the latest figure can found here ) , new packages being added every day . so, creating function names unique today may cause name clashes in future when other packages added. alistaire has mentioned option prefix functions. besides stringi , stringr , forc

c# - Xamarin Android: Recent Apps and Activities -

i've been developing first xamarin android app in c# few weeks. approach @ separating different aspects of app each other have multiple activities: 1 login 1 main menu 1 settings ... while navigating through app noticed each activity opened shown under recent apps. counter started finishing current activity before launching new 1 using intent aswell overwriting onbackpressed in each activity control activity loaded next. is bad design? how usual apps 1 know behave? never noticed app listed multiple times under recent apps feel wrong. state of art have 1 activity , handle fragments? this question difficult answer, there advantages , drawbacks of both strategies. in essence, people prefer use fragments nowadays multiple reasons: activities more memory intensive, it easier handle navigation stack using fragmentmanager fragments adaptable both phone , tables compared activities, fragments easier re-use a fragment cannot exist on own, must part of activity fra

Convert byte array of signed ints to file - Ruby -

i have message server in following format result = "123,-23,12,...,54,-53" that message represents array byte of image. how can convert actual image? i converted result array of ints , tried with: file.open( 'imagex.png', 'wb' ) |output| splited.each | byte | output.print byte end end but image not recognizable. missing? i suspect you'll want try like: file.write("imagex.png", result.split(',').map(&:to_i).pack('c*')) i hope helps. cheers! wiki

r - Creating Heat Map using Krigging -

Image
i'm trying create heat map using krigging missing values. i have following data, contains values have been measured rlevel. i followed following link tells how use krigging. https://rpubs.com/nabilabd/118172 this following code wrote. before these steps, had removed values diedata needed values tested. values need tested refered die.data.navalues in code. #**************************************************code***************** #step3: convert spatialpointsdataframe object coordinates(die.data) = ~x+y #step 4: prediction grid coordinates(die.data.navalues)=~x+y #using autokride method kr = autokrige(rlevel, die.data, die.data.navalues,nmax=20) predicted_die_values <- kr$krige_output predicted_die_model <- kr$var_model #get predictions. plot predicted on heat map. g <- gstat(null,"rlevel",rlevel~1,die.data, model=predicted_die_model,nmax=1) predictedset <- predict(g,newdata=die.data,blue=true) #plot krigging graph predicted_die_v

hadoop - export data to csv using hive sql -

how export hive table/select query csv? have tried command below. creates output multiple files. better methods? insert overwrite local directory '/mapr/mapr011/user/output/' row format delimited fields terminated ',' select fied1,field2,field3 table1 hive creates many files many reducers running. parallel. if want single file add order by force running on single reducer or try increase bytes per reducer configuration parameter: select fied1,field2,field3 table1 order fied1 or set hive.exec.reducers.bytes.per.reducer=67108864; --increase accordingly also can try merge files: set hive.merge.smallfiles.avgsize=500000000; set hive.merge.size.per.task=500000000; set hive.merge.mapredfiles=true; also can concatenate files using cat after getting them hadoop. wiki

ios - Is it possible to customise the section index list in a UITableView (such as font)? -

uitableview gives ability edit colors of section index list properties such as var sectionindexcolor: uicolor? { set } var sectionindexbackgroundcolor: uicolor? { set } is possible edit in other ways? looking swift implementations. it possible adjust if you're okay accessing private properties. believe pass store approval don't take word it. here properties/functions able access. https://github.com/nst/ios-runtime-headers/blob/master/frameworks/uikit.framework/uitableviewindex.h i've tested changing font following , worked. func viewdidload() { super.viewdidload() dispatchqueue.main.async { [unowned self] in if let tableviewindex = self.tableview.subviews.first(where: { string(describing: type(of: $0)) == "uitableviewindex" }) { tableviewindex.setvalue(*insert font here*, forkey: "font") self.tableview.reloadsectionindextitles() } } } wiki

machine learning - Apache Spark user-user recommendation? -

i have data set of questions , answers users have completed choices. i'm trying build user-user recommendation engine find similar users based on answers quesitons. important point questions shuffled , not in order , data streaming. so each user have data this: user_1: {"question_1": "choice_1", ...} user_2: {"question_3": "choice_4", ...} user_3: {"question_1": "choice_3", ...} i have found tutorials user-item recommendations, nothing user-user recomenndations. i've realized clustering , cosine similarity might options , i've found columnsimilarity efficient. rows = sc.parallelize([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) mat = rowmatrix(rows) sims = mat.columnsimilarity() i have 2 questions: is wise define each user column , question/choices rows result need? and how should vectorize kind of data numbers? if need clustering. thanks in advance :) unfortunately, that's

c# - Configuring CloudWatch as a target for NLog -

i have been trying set cloudwatch target nlog framework in .net application. haven't mentioned on documentation this. this nlog.config file <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/nlog.xsd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" throwexceptions="true"> <targets> <target name="aws" type="awstarget" loggroup="nlog.configexample" region="us-east-1"/> <target name="logfile" xsi:type="console" layout="${callsite} ${message}"/> </targets> <rules> <logger name="*" minlevel="info" writeto="logfile,aws" /> </rules </nlog> nothing major sample project says. have set aws credentials in environment variables. i have created loggroup in cloud watch wiki

elixir - In Phoenix ConnTest can you dispatch a conn without respecifying method and path -

phoenix.conntest includes function build_conn/3 ( link ). this allows build conn object path method set. cannot see way dispatch phoenix application without respecifying method , path. the dispatch/5 function in conntest requires conn method , path work. there equivalent of dispatch/5 use method , path set on conn object? wiki

c# - How to allow editing number on a filled masked text box? -

i have masked textbox , want edit number on middle of textbox changing number of right number typed. for example: 111.511-1/11 i want change number 5 9. i'll type de left arrow until near dot. when near dot , type 9, number 5 disappear , number 9 appear. 111.911-1/11 i thought need capture left arrow typing changing. dont know how capture it. any code suggestions? xaml <textbox textchanged="formataprocesso" keydown="numberonly"/> c# private void formataprocesso(object sender, eventargs e) { regex regex1 = new regex("[0-9]{4}$"); regex regex2 = new regex("[0-9]{3}.[0-9]{4}$"); regex regex3 = new regex("[0-9]{3}.[0-9]{3}-[0-9]{2}$"); } if (regex3.ismatch(process.text)) { isvalortratado = true; processo.text = string.format("{0}/{1}", process.text.substring(0, 9), process.t

html - Why my anchor link from a secoundary page is not working? -

i have following problem 1 of current projects. i achieve when click on link on secondarly page, sends home page but, not @ top of homepage (by default), sends specific id is. at moment have following url in special link doesn't work <a href="http://myweb.com/index.html#hcontact-anchor"> link </a> i have tried different ways saw in community didn't have luck. @ moment when click send homepage @ top , id @ end of page how can fix please? thanks kindly use below code on page load. make sure call once dom loaded. scroll page anchor. location.hash = "#contact-anchor"; wiki

Can't get the value of two numbers in C# to add after -

so i'm trying ask 2 numbers use after add later , call them console.write() , doesn't seem work. first created 3 intengers, int num1 = 0; int num2 = 0; int num3 = 0; and did this: console.writeline("what's first number?"); num1 = console.read(); console.writeline("what's second number?"); num2 = console.read(); num3 = num1 + num2; console.writeline(num3); and reason not working, giving me value of 60+ without me typing second number. any appreciated , in advance. console.read() returns character value, not number entered. plus, returns first character typed in. should using console.readline() instead. you can try following: console.writeline("what's first number?"); int num1 = convert.toint32(console.readline()); console.writeline("what's second number?"); int num

asp.net - castle.core.dll The located assembly's manifest definition does not match the assembly reference -

i've 'inherited' old website solution includes several projects. i've been unable build solution - in fact built once hasn't since , don't recall changing no idea why built 1 time.. anyway.. when attempting build, throwing error: could not load file or assembly 'castle.core, version=1.3.0.0, culture=neutral, publickeytoken=407dd0808d44fbdc' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) in web.config can see reference: <dependentassembly> <assemblyidentity name="castle.core" publickeytoken="407dd0808d44fbdc" /> <bindingredirect oldversion="0.0.0.0-1.2.0.0" newversion="1.2.0.0" /> </dependentassembly> through searching problem i've tried few things without luck. similar questions recommended trying fusionlog gave me following: the operation failed. bind result: hr = 0x801310

Using flowfile size as an argument in RouteOnAttribute nifi -

i want know if possible use flowfile size argument in routeonattribute want make expression : ${filename.filesize>500} but tells me expression ought return true , expression returns string should able make new connection in routeonattribute(p.s filename flowfile name) two ways check empty response present in flowfile. 1.using content-length attribute--> ${content-length} 2.using extract text processor extracts entire content in attribute. flow_content--(.*) then check ${flow_content:isempty():not()} it may helpful case. wiki

pretty print JSON Rails -

i'm new rails. i'm trying pretty print json output. there no view files involved. a method generates json output, , controller renders view of json. i've added json.pretty_generate inside method as: json.pretty_generate({"files" => list_files}.to_json) but didn't work. i've added in render in controller, such following: method: def list_files_json list_files = google_files.map |o| {title: o.title, id: o.id, size: o.size, created_at: o.created_time} end {"files" => list_files}.to_json end controller: def show google_list = discoursedownloadfromdrive::drivedownloader.new(nil).list_files_json respond_to |format| format.json {render json: json.pretty_generate(google_list)} format.html {render html: google_list} end end i've checked other threads related, , tried imitate solution (unsuccessfully). missing? instead of {"files" => list_files}.to_json return {&q