Posts

Showing posts from February, 2011

interpolation - How to use R interp1 similarly as MATLAB's? -

i trying interpolate linearly in r. pseudocode u = interp1(u, linspace(1, numel(u), numel(u)-1)); in matlab extrapolation returns nan if point outside domain (default, more here ). approx rule=1 equivalent matlab pseudocode i not sure second interp1 parameter not required in matlab let unsuccessufully y <- x such interp1(x, y, xi, method = "linear") minimal code example (real 1 has > 500 k points linear work) , output @ top list of 2 $ : num [1:3] 1 2 3 $ : num [1:2] 1 2 num [1:2] 0 1 error in interp1(x, y, xi, method = "linear") : points 'xi' outside of range of argument 'x'. execution halted library("pracma") # http://finzi.psych.upenn.edu/library/pracma/html/interp1.html files <- vector("list", 2) files[[1]] <- c(1,2,3) files[[2]] <- c(1,2) str(files) # wanted, matlab: u = interp1(u, linspace(1, numel(u), numel(u)-1)); xi <- seq(0,1, len = length(files[[1]]) - 1) x <- files[[...

Save and show an image in android studio -

i want know how can save , show image in image view. my app have 2 buttons , depending on wich button pressed image view image. want save image , when open app again choosen image still there. the way know save shared preferences in case doesnt work. someone can my? thank this code: public class mainactivity extends appcompatactivity { imageview imagen; button boton; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imagen = (imageview) findviewbyid(r.id.imagen); boton = (button) findviewbyid(r.id.boton); sharedpreferences preferences= getsharedpreferences("preferencias", mode_private); string imagen= preferences.getstring("imagen", null); } public void boton1(view view){ imagen.setimageresource(r.drawable.imagen1); sharedpreferences preferences = getsharedpreferences("preferencias", context.mode_private); shared...

android - Realm query for all entities that have a field with a certain value -

sorry if title vague, didn't know how else describe it. i making android application in users can browse list of events @ festival, click on them more detailed overview of event , it's performance times. here's java model: public class festivalentity extends realmobject { @primarykey public string code; public string description; public string title; public int minimumage; public string squareimage; public string landscapeimage; public realmlist<performanceentity> performances; public date firstperformance; } public class performanceentity extends realmobject { public date start; public date end; public double price; public boolean favorite; } my question is: how make query finds festivalentity s have performanceentity favorite ? can't select individual performanceentity because there no primary key performanceentity table. what looking similar (invalid) query: //should return list of festival...

java - How do I find the users number using binary search -

prompt: player chooses range (both min , max), , thinks of number in range (no need type number program). game should use binary search systematically guess player’s number. player should tell computer “too high” or “too low” or “correct” between rounds. program should continue until computer gets answer, or detects cheating (or knows answer sure). before quitting, computer should how many “rounds” (how many guesses took). problem: after computer wrong first time , user declares high or low, can't ressign values upper , lower range import java.util.scanner; public class testpractice { public static void main(string[] args) { system.out.println("think of number"); scanner scan = new scanner(system.in); string x = null; string y = null; string = null; //get input player system.out.println("please maximum value"); if (scan.hasnext()) { x = scan.next(); } syst...

duplicates - C++ Calculating shipping cost based on weight -

part of program i'm working on implements function takes in package weight argument , calculates shipping cost based on weight. criteria cost/lb follows: package weight cost -------------- ---- 25 lbs & under $5.00 (flat rate) 26 - 50 lbs above rate + 0.10/lb on 25 50 + lbs above rate + 0.07/lb on 50 i used if-if else-if make calculations, feel bit repetitive: const int tier_2_weight = 25; const int tier_3_weight = 50; const float tier_1_rate = 5.00; const float tier_2_rate = 0.10; const float tier_3_rate = 0.07; float shippricef; if(shipweightf <= tier_2_weight) { shippricef = tier_1_rate; } else if(shipweightf <= tier_3_weight) { shippricef = ((shipweightf - tier_2_weight) * tier_2_rate) + tier_1_rate; } else { shippricef = ((shipweightf - tier_3_weight) * tier_3_rate) + ((tier_3_weight - tier_2...

javascript - External resource in jsfiddle is undefined -

i have made github repo https://github.com/hollowdoor/dom_autoscroller_demo for reason jsfiddle referencing repo doesn't work: http://jsfiddle.net/gh/get/library/pure/hollowdoor/dom_autoscroller_demo/tree/master/demo the external resources left undefined. i have looked @ other answers on stackoverflow, , none of seem address specific problem. let wtf = "stack overflow doesn't jsfiddle without code?" there redirect on external resouce loads dragula library. it seem js fiddle doesn't follow it. updating resource redirected link works. i.e. using https://unpkg.com/dragula@3.7.2/dist/dragula.js instead of https://unpkg.com/dragula/dist/dragula.js http://jsfiddle.net/3q9wjc2s/1/ yep, stackoverflow isn't suited debugging issues jsfiddle in situations due necessary protections against links.

ruby on rails - Rake assets:precompile failed with a Sass syntax error -

this seems awkward error. there lots of problems rake asset:precompile didn't find nothing similar issue having sass syntax error.i dont know file error occurs. i'm using rails 5. root@006230dae323:~/myhomerails# rake assets:precompile --trace rails_env=production ** invoke assets:precompile (first_time) ** invoke assets:environment (first_time) ** execute assets:environment ** invoke environment (first_time) ** execute environment ** execute assets:precompile rake aborted! sass::syntaxerror: invalid css after " color: ": expected expression (e.g. 1px, bold), ";" (sass):13586 this rest of log: rake aborted! sass::syntaxerror: invalid css after " color: ": expected expression (e.g. 1px, bold), ";" (sass):13586 /usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:1189:in `expected' /usr/local/bundle/gems/sass-3.4.22/lib/sass/script/lexer.rb:229:in `expected!' /usr/local/bundle/gems/sass-3.4.22/lib/sass/scr...

javascript - Passport JWT req.user is undefined in one of my routes -

i'm having absolute nightmare trying set jwt express app! think i've got working now, have register route , login route both work correctly , generate valid tokens , have route in '/users' route test authentication , fine. have file containing routes '/api' authentication important , have similar test route tries access req.user (just in other route) seems req.user undefined. through debugging looks user in req.account odd , don't understand why not in req.user i define jwt strategy in /config/passport.js 'use strict'; const user = require('../models/user'), config = require('./main'), jwtstrategy = require('passport-jwt').strategy, extractjwt = require('passport-jwt').extractjwt; //exported used passport in server set module.exports = function (passport) { const jwtoptions = { // telling passport check authorization headers jwt jwtfromrequest: extractjwt.fromauthheader(), // ...

python - matplotlib text logo - change width -

Image
i trying create logo (in matplotlib) looks this- the 2 letters have different heights have same width , stacked 1 above other. when try, ax = fig.add_axes([0., 0., 1., 1.]) ax.text(x, y1, 'c', fontsize=40) ax.text(x, y2, 't', fontsize=20) 't' smaller in both height , width. is there way create 'text' in matplotlib specific height , width? assuming there alternate way (other fontsize) define overall dimensions of matplotlib text area.

Trying to have macro filter everything in a column and save individual workbooks per sorted item in excel vba -

i have report sorted column c. need save individual workbooks based off of each item column c. there headers in row 1. below code believe should work isn't. unsure how site specifc folder save to. if target.address = "$c$2" fname = range("c2") activeworkbook.saveas filename:=fname end if here's macro handle targeting cells in sheet. must placed specific sheet's code. example of fname value stored in c2 cell is: c:\users\taisho\desktop\example.xlsx reason why macro not working not assigning variable type target . option explicit private sub worksheet_selectionchange(byval target range) dim fname string if target.address = "$c$2" fname = range("c2").value2 activeworkbook.saveas filename:=fname end if end sub

javascript - Get object that was destructured in parameter -

this question has answer here: es6 destructuring function parameter - naming root object 2 answers suppose have function takes destructured object parameter in arrow function: const myfunc = ({a, b, c}) => { }; is there anyway or syntax allow me whole object single value well? since arrow function doesn't bind arguments , can't use that. is possible name it, along lines of: const myfunc = (allargs: {a, b, c}) => { console.log(allargs); }; myfunc({a:1, b:2, c:3}); // output: {a:0, b:1, c: 2} obviously, isn't deal breaker , there plenty of workarounds (either don't use arrow function, don't destructure, or recreate object when need it), i'd know convenience sake. you destructure single param quite easily. lose advantage of terse destructuring syntax in arguments, it's easy , still clear: const myfunc = (allargs...

c++ - Sublime text 3 sublime input package -

python3 file input '''input </ ''' print(input()) output access denied. input '''input < ''' print(input()) input '''input > ''' print(input()) output the syntax of command incorrect. input '''input <s ''' print(input()) output the system cannot find file specified. input '''input <? ''' print(input()) output the filename, directory name, or volume label syntax incorrect. and on .. how rid off these. want give html , xml inputs. https://packagecontrol.io/packages/sublime%20input meanwhile use s=''' <html> <head> <head> </html> ''' s=s.splitlines() i=0 def input(): global i+=1 return s[i] print(input()) print(input()) print(input()) print(input()) output <html> <head>...

c# - Logging in .NET with Serilog -

in application, users can run multiple jobs, each of operations on files , output file. in course of these operations need log errors run in multiple log files, 1 per job. i know can set different sinks (i.e. multiple log files) in code serilog, i'm injecting service performing operations , logging there. service injected api controller calls service methods. what i'm not sure here how handle calling serilog logging methods within controller, since need logging in there while still using same sink i'm using in service. example, 1 job there 1 log file shared between controller , service duration of job. if expose interface method like public void setlogfile(string filename) { log.logger = new loggerconfiguration() .writeto.rollingfile(pathformat: _hostingenvironment.contentrootpath + "/" + filename + ".log", outputtemplate: "{timestamp:yyyy-mm-dd hh:mm:ss.fff zzz} {sourcecontext} [{level}] {message...

python - Run a block of code each time a condition is met -

first off, sorry wall of text. try explain issue as can. hello, title may think refer simple if statement , may true. i've done questions today project , want else. i'm doing bot using league of legends api. bot print stats current game of given player. unfamiliar game, there ranks. rank 1 of stats bot prints chat working on; stats ranked games, unlike normal games, ranked games ones count these stats. anyway; i'm getting data json , each time player unranked (not ranked player) 404 request , want handle 404 print else. right now, important part of code: ids_seen = set() y in range(0, 10): num += 1 = r_match['participants'][num] e_name = i['summonername'] e_id = i['summonerid'] team_id = i['teamid'] champ = i['championid'] r_team = requests.get("https://lan.api.pvp.net/api/lol/lan/v2.5/...

php - Call to undefined method CI_Encrypt::sha1() -

i follow tutorial youtube tutorial codeigniter - insert but, im getting error inside controller file browser when im using encryption library codeigniter 2. error code when using encryption. $paramusu['clave'] = $this->encrypt->sha1($this->input->post('txtclave')); but when im passing without encryption working fine. $paramusu['clave'] = $this->input->post('txtclave'); im getting error @ browser: fatal error: call undefined method ci_encrypt::sha1() in c:\xampp\htdocs\training\tutorialci\application\controllers\cpersona.php on line 31 a php error encountered severity: error message: call undefined method ci_encrypt::sha1() filename: controllers/cpersona.php line number: 31 backtrace: here code controller: <?php defined('basepath') or exit('no direct script access allowed'); class cpersona extends ci_controller { function __construct() { parent::__construct(); ...

sql server - Update column value in SQL without user interaction -

Image
i want update column value every day @ 12 in table without user interaction. example: have column status active , expired possible values. now everyday @ 12 am, column dateregistered checked. if dateregistered less current date, update status a (for active ), , e ( expired ) otherwise. is there way can in sql server 2014 without user interaction? you can create stored procedure , schedule same in sql job under sql server agent run @ every day 12am. please refer msdn link same. https://msdn.microsoft.com/en-us/library/ms191439.aspx

ruby on rails - Mocking chain of methods in rspec -

there chain of methods gets user object. trying mock following return user in factory girl @current_user = authorizeapirequest.call(request.headers).result i can mock object until call method i'm stuck @ mocking result method allow(authorizeapirequest).to receive(:call).and_return(:user) i found need use receive_message_chain so worked me. allow(authorizeapirequest).to receive_message_chain(:call, :result).and_return(user)

ios - Safariviewcontroller reloads content when open another app then return -

i trying implement sso scenario using sfsafariviewcontroller . scenario below. the user opens app, , login page displays in wkwebview . user clicks login button safariviewcontroller opens sso page. the user enters username , password presses login button in sso page. for two-step verification, user enters sms-pin in next sso page , presses done button. when verification completes, user automatically returns authorized state. the problem @ step 4. when user opens messages sms-pin , returns app, sfsafariviewcontroller reloads page initial url. user cannot enter sms-pin. why sfsafariviewcontroller reload page initial url every time? the implementation below. @interface webcontentviewcontroller()<sfsafariviewcontrollerdelegate> ... @end @implementation webcontentviewcontroller ... ... - (bool)decidenavigationflow:(nsurl *) url islinkclicked: (bool) islinkclicked { .... .... if(is_ios9_or_greater){ sfsafariviewcontroller *svc = [[sfsafariviewcon...

ios - Xcode8 Time Profile shows addresses, not code -

Image
environment: xcode 8.1 use time profiler test program。i set program build option debug dwarf dsym file time profiler display address not function. hope can me .thank much

mysql - LAMP Stack Setup on Ubuntu: What is 'localhost'? -

i'm total newbie world of web development. trying setup wordpress.org on ubuntu. the tutorial page here instructs: sql> grant on wordpress.* 'wordpressuser'@'localhost' identified 'password'; my computer name "a"(static hostname). should replace localhost above or local host work? localhost domain name resolves 127.0.0.1 special ipv4 address tells link layer trying connect own computer. this useful testing softwares work on internet. when using localhost address, latest mysql releases use unix-domain-socket doesn't use underlying network protocol communication takes place in os kernel itself. bonus not 172.0.0.1 127.0.0.1 through 127.255.255.254 loops-back packets machine. for ipv6: localhost resolves ::1.

wordpress - Manually setting focus keyword on website -

can please tell me how set focus keyword myself without yoast seo ? find header.php file of active theme. add following html line, inside < head>......< /head> before < link> tags. <meta name="keywords" content="focus keyword 1,focus keyword 2,focus keyword 3,focus keyword 4"> add focus keywords , comma separate them. important note: bad practice wordpress sites add keywords directly out plugin. because, using plugin allows have different keywords different pages posts. doing manually, of sites pages have same focus keywords,because have add meta tag themes header.php (one header.php file used pages). may lead bad ranking.

mysql - What is my error in php code -

Image
this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers what error in php code, following error, hope help warning: mysqli_num_rows() expects parameter 1 mysqli_result, boolean given in c:\xampp1\htdocs\blog\blog.php on line 45 because aren't supplying code, can't tell... error occurs when query invalid, resulting in "false" (thus boolean). in query, use mysqli_error(), example: mysqli_query($link, "select * blabla bla=3") or die(mysqli_error($link)); don't forget remove "or die " after debugging, because it's cheap way of displaying error.

javascript - How set Modal popup multiple image -

i'm try use w3s show multi images in modal popup: // modal var modal = document.getelementbyid('mymodal'); // image , insert inside modal - use "alt" text caption var img = document.getelementbyid('myimg'); var modalimg = document.getelementbyid("img01"); var captiontext = document.getelementbyid("caption"); img.onclick = function(){ modal.style.display = "block"; modalimg.src = this.src; captiontext.innerhtml = this.alt; } // <span> element closes modal var span = document.getelementsbyclassname("close")[0]; // when user clicks on <span> (x), close modal span.onclick = function() { modal.style.display = "none"; } /* style image used trigger modal */ #myimg { border-radius: 5px; cursor: pointer; transition: 0.3s; } #myimg:hover {opacity: 0.7;} /* modal (background) */ .modal { display: none; /* hidden default */ ...

typescript - add custom button in actions column in ng2-smart-table angular 2 -

in ng2-smart-table angular 2 want add new button in actions column , click on button route page add , edit , delete buttons tried make new button it's not working settings = { add: { addbuttoncontent: '<i class="ion-ios-plus-outline"></i>', createbuttoncontent: '<i class="ion-checkmark" ></i>', cancelbuttoncontent: '<i class="ion-close"></i>', confirmcreate: true, }, edit: { editbuttoncontent: '<i class="ion-edit"></i>', savebuttoncontent: '<i class="ion-checkmark"></i>', cancelbuttoncontent: '<i class="ion-close"></i>', confirmsave: true }, delete: { deletebuttoncontent: '<i class="ion-trash-a"></i>', confirmdelete: true }, , how can add button , searched in ng2-smart table do...

asp.net mvc - how to validate CaptchaMVC in Server side? -

i using captchamvc in asp.net mvc project. below client side code. posting captcha action method. stuck how validate captcha in server side. captcha control in view below <div class="form-group"> @html.hidden(mvcapplication.multipleparameterkey, 2) @html.captcha("refresh", "", 5, "<span style='color:red'>"+generals.captchrequired+"</span>", true, new parametermodel(mvcapplication.multipleparameterkey, 2)) <label class="text-danger">@viewbag.message</label> </div> you have add [captchaverify("captcha not valid")] filter above on action method below [httppost, captchaverify("captcha not valid")] public actionresult index(yourmodelclass obj) { if (!modelstate.isvalid) { return view("index", obj); } }

proxmox - Migrate and attach existing disk of a VM to another VM on remote machine -

there 2 physical servers proxmox (proxmox-ve 4.2) installed on them, each 1 handles few vms , containers. these servers (almost) isolated , there no cluster/shared storage/additional storage, etc. between them. a vm has been setup , configured it's os , application(s) on proxmox#1 should moved proxmox#2. in prior versions of proxmox, easy moving vm's disk image server using rsync or scp. in recent versions of proxmox, storage storing vm's disk separated parent host using lvmthin , there logical volume every single vm, state, snapshot, etc. as not want install os , setup applications, how can migrate existing vm disk image proxmox#1 proxmox#2 , attach vm created main disk? i found tricky way , it's easy can not believe. on source (proxmox #1): first, have use "move disk" in order access vm's disk raw or qcow2 file. using web interface, go datacenter --> storage , select local . click edit and in content drop down, select disk imag...

windows - Vagrant, error in vagrant up --provider=vmware_workstation. VMware version mismatch -

Image
i wanted vagrant --provider=vmware_workstation . however, error has occurred. $ vagrant --version vagrant 1.8.7 $ vagrant plugin install vagrant-vmware-workstation installed plugin 'vagrant-vmware-workstation (4.0.14)'! $ vagrant plugin license vagrant-vmware-workstation c:/license.lic installing license 'vagrant-vmware-workstation'... license 'vagrant-vmware-workstation' installed! $ vagrant --provider=vmware_workstation bringing machine 'default' 'vmware_workstation' provider... provider works vmware workstation 9.x, 10.x, 11.x, , 12.x. have workstation ''. please install proper version of vmware workstation , try again. i used vagrantfile: # vagrantfile api/syntax version. don't touch unless know you're doing! vagrantfile_api_version = "2" vagrant.configure(vagrantfile_api_version) |config| config.vm.box = "vmware_precise64" config.vm.provider "vmware_workstation" |v| v.gui = t...

php - Crypt int into 4-char String -

i'd crypt int 7'000'000 4-char string , decrypt back. any idea on how can easy achieved php? clarification i want create unique slug each wordpress user based on user id length of 4 chars. example.com/rdfy log2(7,000,000) = 22.7 or < 3 full bytes. make value 4-byte integer , cast 4-byte array , base64 encode least significant 3 bytes 4-bytes, encoding, not encryption may suffice. if need encryption encrypt byte array using substitution cipher, sure not strong encryption.

sed remove match and next lines -

not sure why redgex expression not working, i'm trying ommit match , next lines [example.com] 10.0.0.1 10.0.0.2 [example.net] 10.0.0.10 10.0.0.20 desired output [example.net] 10.0.0.10 10.0.0.20 here have tried far, matches more lines desired sed -e '/(\[example.com\])(.*\n)+/d' sed simple subsitutions on individual lines, all. else should using awk every desirable attribute of software (efficiency, clarity, robustness, portability, maintainability, etc., etc.): $ awk '/^\[/{f=/\[example\.com\]/} f' file [example.com] 10.0.0.1 10.0.0.2 $ awk '/^\[/{f=/\[example\.com\]/} !f' file [example.net] 10.0.0.10 10.0.0.20

java - Method that creates new array on every call? -

i trying create method creates new array recognizable name every time it's called. it's supposed create arrays of size 2 store 2 double values inside. public static double[] newarray(double x, double y) { double a[] = new double[2]; a[0] = x; a[1] = y; } basically this, name of array variable can create multiple arrays same function. for example first array a, next a1, a2, a3 , forth. set function this: public static double[] newarray(double x, double y) { return new double[]{x, y}; } then call this: double[] myarray1 = newarray(10d, 20d); double[] myarray2 = newarray(3d, 4d);

android - App always crashes when calling onClickListerner() -

app crashes when calling savedetails() function. don't know main reason. couldn't figure out. someone, please me. when remove savedetails() function app launches , calls contact_details layout when imagebutton clicked. when function added app crashes. log shows error on savebutton.setonclicklistener(). package com.bikram.contacts; import android.database.cursor; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.arrayadapter; import android.widget.button; import android.widget.edittext; import android.widget.imagebutton; import android.widget.listview; import android.widget.toast; import java.util.arraylist; public class mainactivity extends appcompatactivity { databasehelper databasehelper; edittext firstname, lastname, phonenumber; imagebutton imagebutton; button savebutton; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedins...

c++ - visual studio 2015 doesn't see the header -

Image
i'm trying compile project connected drivers, vs doesn't see header files ntddk.h , vadefs.h . i've found both of them located in: c:\program files (x86)\windows kits\10\include\10.0.14393.0\km added them in projects properties: but stil doesn't work.. you've got $ before path, it's getting confused , treating if want macro called $c:\program don't have. use this: c:\program files (x86)\windows kits\10\include\10.0.14393.0\km\;%(additionalincludedirectories)

android - NativeScript Splash Screen time -

i using nativescript starter app angular. it barebones starter app created cli. what want know how can change splash screen time app. i went through docs here https://github.com/nativescript/docs/blob/master/publishing/creating-launch-screens-android.md but unable find mention of splash screen time. you need first understand initial image display long takes app load initially. having said that,you can neither shorten time (unless optimize application - load resources lazily example), nor extend naturally. beginning nativescript 2.4 android apps created snapshots enabled default. means shorter initial loading times. that should noticeable improvement new apps, written in angular2

ios - How to check if an extention is installed -

we offer multiple imessage extensions. example extensiona , extensionb. extensionb offers inapp purchases inapppurchasea , inapppurchaseb. inapppurchasea should free, if extensiona installed on device. how check if extensiona installed?

scheduling - First Come First Served, Shortest Job First, Shortest Job First Remaining Time First - Do they have similarities? -

i thought that, did not find similarity shared 3 procedures. fcfs fair - sjf , srtf not fair. fcfs , sjf non preemptive - srtf preemptive fcfs not prefer processes short processing time - sjf , srtf prefer processes short processing time fcfs has high average waiting time - sjf , srtf have low average wating times

python - Django TemplateDoesNotExist {% extends base.html %} - where should template be? -

i'm starting simple django app having trouble extending html file. i have base.html , index.html both within my_site/my_app/templates/my_app . i.e. my_site/my_app/templates/my_app/base.html , my_site/my_app/templates/my_app/index.html . within index.html file have {% extends 'base.html' %} . my settings.py file has base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [os.path.join(base_dir, 'templates')], 'app_dirs': true, 'options': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ...

c# - How to get from Dictionary<char, Tuple <int, char>> int value for specific key? -

i have 2 dictionaries in first case used tuple key values , works fine dictionary<tuple<char, char>, int> pairpoints = new dictionary<tuple<char, char>, int>(); foreach (var items in this.pairpoints) console.writeline(items.key.item1); but in second case want value in tuple {int,char} cant find result.values.item1 dictionary<char, tuple <int, char>> result = new dictionary<char, tuple<int, char>>(); if(distance < result.values.item1) {//do things} is possible write or have use different array method? result.values collection of tuple<int, char> can access single item in collection dictionary key: result[somechar].item1 or can loop though values follows: foreach(var tuple in result.values) console.writeline(tuple.item1)

Create a customer search filter on the woocommerce order page -

how can create client search filter on woocommerce order page? example: search customer zip code or find customer phone number to list customer orders the woocommerce order admin allows search ordres following fields: order key billing first name billing last name billing company billing address 1 billing city billing postcode billing country billing state billing email billing phone order items if need search order field add functionality plugin or themes functions.php file: add_filter( 'woocommerce_shop_order_search_fields', 'woocommerce_shop_order_search_order_total' ); function woocommerce_shop_order_search_order_total( $search_fields ) { $search_fields[] = '_order_total'; return $search_fields; } with simple snippet active can search order total. using technique can search custom post meta may adding order records. credit skyverge docs on this

c# - Cannot resolve DataType MyApp.Model.Paper -

i'm trying bind class template. <usercontrol x:class="myapp.controls.paperselectcontrol" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:myapp.controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" d:designwidth="400"> <grid> <scrollviewer> <gridview x:name="papergrid" itemssource="{x:bind papers}" width="400" height="300" > <gridview.itemtemplate > <datatemplate x:datatype="myapp.model.paper" > <textblock text="{x:bind...

php - $_POST data not being sent -

i have simple form working , im finding post data isnt being sent , can't see problem <form role="form" name="challengeform" action="scripts/arena_setup.php" method="post" onsubmit="return confirm('are sure want attack player?');"> <input type="hidden" name="member_id" value="<? echo $member_id;?>"> <input type="image" src="img/map/attack.png" alt="attack" /> </form> which being handled by if(isset($_post['challengeform'])){ ... }else{ echo 'error'; } it shows error due post data being missing cant see i've done. ideas? if(isset($_post['challengeform'])) form names not part of post data. fields within form. try testing field itself if(isset($_post['member_id']))

What is the difference between Amazon ECS and Amazon EC2? -

i'm started on aws ec2, understand ec2 remote computer can pretty want. find ecs, know use docker confused relation between these two. is ecs docker install in ec2? if have ec2, start ecs, mean have 2 instance? your question is ecs docker install in ec2? if have ec2, start ecs, mean have 2 instance? no. aws ecs logical grouping (cluster) of ec2 instances, , ec2 instances part of ecs act docker host i.e. ecs can send command launch container on them ( ec2 ). if have ec2, , launch ecs, you'll still have single instance. if add/register (by installing aws ecs container agent) ec2 ecs it'll become part of cluster, still single instance of ec2. an amazon ecs without ec2 registered (added cluster) nothing. tl; dr an overview ec2 - remote (virtual) machine. ecs stands ec2 cluster service - per basic definition of computer cluster , ecs a logical grouping of ec2 machines/instances . technically speaking ecs mere configuration e...

ios - Detect Internet Connection and display UIAlertview Swift 3 -

i making app detects if there connection internet using if else statement, when there internet, nothing if there no internet connection, alert view app requires internet managed found reachability implement on viewdidload() uialertview seems not working. using this: public class reachability { class func isconnectedtonetwork() -> bool { var zeroaddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0)) zeroaddress.sin_len = uint8(memorylayout.size(ofvalue: zeroaddress)) zeroaddress.sin_family = sa_family_t(af_inet) let defaultroutereachability = withunsafepointer(to: &zeroaddress) { $0.withmemoryrebound(to: sockaddr.self, capacity: 1) {zerosockaddress in scnetworkreachabilitycreatewithaddress(nil, zerosockaddress) } } var flags: scnetworkreachabilityflags = scnetworkreachabilityflags(rawvalue: 0) if scnetworkreachabilitygetflags(defaultroutereachabi...

opengl es - Getters in Android Open GLES 2.0 don't work -

for quite long time looking answer in different forums why in below mentioned case getters not work. decided register in stackoverflow , try ask here. please, let me know doing wrong. have cube 27 class: public class cube27 { private floatbuffer vertexbuffer; // buffer vertex-array private shortbuffer indexbuffer; float x; float y; float z; float s; float xoff; float yoff; float zoff; private int colorhandle; private final string vertexshadercode = "uniform mat4 umvpmatrix;" + "attribute vec4 vposition;" + "void main() {" + " gl_position = umvpmatrix * vposition;" + "}"; private final string fragmentshadercode = "precision mediump float;" + "uniform vec4 vcolor;" + "void main() {" + " gl_fragcolor = vcolor;" + "}"; private int mvpmatri...