Posts

Showing posts from June, 2013

ionic framework - Libtool Cordova Building Failed -

i seem getting problem xcode on ionic based project. know way around problem? not find answers online regarding issue. libtool /users/austinsweat/library/developer/xcode/deriveddata/riveloper,_llc-fftaaqxtekkzntdimgercgfdvnmb/build/products/debug-iphoneos/libcordova.a normal arm64 cd /users/austinsweat/desktop/riveloper-mobile-app-new/newapp/platforms/ios/cordovalib export iphoneos_deployment_target=6.0 export path="/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -syslibroot /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos9.3.sdk -l/users/austinsweat/library/developer/xcode/deriveddata/riveloper,_llc-fftaaqxtekkzntdimgercgfdvnmb/build/products/debug-iphoneos -filelist /us

.net - How do I know which version of asp.net mvc one project is? -

i want know checking asp.net mvc project version is. notice not talking .net framework version... thanks each project based on asp.net mvc consists of various number of packages (libraries, extensions, etc.). information versions gathered in file packages.config in root of project.

wordpress - How to return results from single category in this query? -

how can return latest post category 84 in query? <?php /*$args = array('post_type'=>'post', 'posts_per_page'=>'10', 'post_no_in'=>$do_not_duplicate);*/ $args = array('post_type'=>'post', 'post_no_in'=>$do_not_duplicate); $query = new wp_query($args); query_posts("cat=84&showposts=1&orderby=desc"); if($query->have_posts()){ while(have_posts()) : the_post(); /*$do_not_duplicate[] = get_the_id();*/ ?> <div> <?php the_post_thumbnail(); ?> <div class="instruction"> <div class="home_title">most read</div> <div class="home_title_desc"><h3><a href="<?php the_permalink(); ?>"><?php echo the_title(); ?></a></h3><

java - How can I edit source lookup path using Mockito -

i'm having trouble debugging using mockito due impossibility of finding source when stepping in debugger. it won't find class right inside project. the scenario this: have class , class atest 1 using mockito test class a. once class atest tested, there's line in class calls method in class b, debugger cannot find source class b right in project. any suggestions? thanks! as @sureshkoya alludes, ides provide way @ attach sources java .class file. depending on whether b yours or third-party, , ide you're using, may easy fix. please provide further problem details.

java - Documenting existing JAX-RS implementation with Swagger without annotating it -

i generate swagger documentation existing jax-rs implementation without having modify code @ all. i'd love not have introduce kind of swagger annotations decorating classes. here https://github.com/swagger-api/swagger-core/wiki/swagger-core-jax-rs-project-setup-1.5.x . they seem suggest after configuring application use swagger have annotate code swagger able generate swagger.json. right? annotations needed? if not, don't understand purpose is magic of documenting existing jax-rs application without modifying code possible? i've found http://www.adam-bien.com/roller/abien/entry/jax_rs_get_swagger_json . could solution? swagger annotations required add documentation jax-rs implementation. purpose define api operations , parameters, meaning , purpose. the link shared appears sort of hack mechanism. don't see how code can find out intent of api unless explicitly declare it. if need minimize swagger annotation usage, there 2 ways this: only u

Android OpenGL equivalent of Matrix.mapPoints() -

i converting 2d android game open gl android game , part of collision detection system depends on mapping points based off matrix. need equivalent of mappoints take in array of x,y,z triplets , return values when they've been put matrix coordinate system. try method: android.opengl.matrix.multiplymv(float[] resultvec, int resultvecoffset, float[] lhsmat, int lhsmatoffset, float[] rhsvec, int rhsvecoffset)

recursion - unification with recursive datatypes -

following suggestion use recursive datatypes nested structure tree tried make said recsurive datatyep work in test program encountered (yet another, cryptic me) error. my program this: datatype 'a tree = leaf of { value : 'a } | node of { value : 'a, left: 'a tree, right: 'a tree } fun recursivetreebuilder n = if n = 0 leaf else node (a, recursivetreebuilder(a, n-1), recursivetreebuilder(a, n-1)) so, function supposed build binary tree of depth n , recursively calling decremented n s until n 0. but getting error: can't unify {left: 'a tree, right: 'a tree, value: 'a} {value: 'b} * (int32.int/int -> 'c) * (int32.int/int -> 'c) (field 1 missing) found near if <( n, 0) leaf(a) else node( a, recursivetreebuilder( ...), ......) using recursive datatypes intended solve unification issue when using nested lists. maybe should able see problem given explanation other question, don't yet. what

How to zoom out an image by Bilinear Interpolation in java? -

i trying read image, zoom in 80*60 , zoom out resulted image 5 times bilinear interpolation method. error : exception in thread "main" java.lang.arrayindexoutofboundsexception: 4800 . can me please? this have done : import java.awt.color; import java.awt.graphics2d; import java.awt.image; import java.awt.renderinghints; import java.awt.image.bufferedimage; import java.awt.image.databufferbyte; import java.awt.image.writableraster; import java.io.bytearrayinputstream; import java.io.file; import java.io.ioexception; import java.io.inputstream; import javax.imageio.imageio; public class biinterpolationtest { public static int zh; public static int zw; public static void main(string[] args) throws ioexception { // todo auto-generated method stub int[][] savedimage; file f = new file ("f:\\java\\gray scale images\\3.jpg"); savedimage = readimage(f); bufferedimage grayimage = new bufferedimage(saved

Having two different sort of validate, from user or app itself in rails -

my program trying create groups automatically, prefix of 'automated_group', won't show when loading groups, can't edited, , more stuff. have limit users doing it. if make validate function, won't let app , group.save returns false. when updating other attributes, won't let me save it, cause name won't validate. is there other way? use validation, or maybe check who's changing value? thanks in advance you can use permission system cancan ( https://github.com/ryanb/cancan ). can define someting this: can :manage, group, automated_group: false

android - App not showing in Playstore for some model, but shows for other models that belongs to the same version -

i have developed game using unity 4. my game not show in play store galaxy s7, s7 edge, , note 5 when sort through game category. can find through search, when try download, says not compatible. however, able download in different galaxy s7. s7 comes android 6, not os difference. what should focusing on find cause of issue? update: coworker going through multiple electronics stores , trying download app. found 1 s6 works , s6 doesn't work. unfortunately, 1 doesn't work android 5.1.1 while s6 work 6.0.1, it's not fair comparison atm. 1 thing interesting though had gotten message google saying have unproper use of webviewclient.onreceivedsslerror handler. , 2 have different security versions. 1 works has "mdf v2.0 release 6" , "vpn v1.4 release 6.1" while 1 doesn't work has "mdf v2.0 release 3" , "vpn v1.4 release 5.2". trying figure out if that's issue or not update2: found 1 6.0.1 cannot download app. compared aga

c++ - Directed Graph Adjacency Matrix Finding the Path -

i trying use bfs method search through graph , determine if there path between 2 nodes. understand , can implement linked list, having trouble grasping matrix instead. i believe going wrong in looping section, feel iterating on wrong thing, or maybe comparing wrong values. help. here code have: #include <iostream> #include <queue> #include <string.h> #include <stack> #include <list> using namespace std; class graph{ private: int total_routes; int total_stations; public: int adjmatrix[100][100]; graph(int routes, int stations); void addroute(int from, int to, int weight); void printgraph(); bool isroute(int from, int to); }; graph::graph(int routes, int stations) { for(int = 0; < stations; i++){ for(int j=0; j < stations; j++){ adjmatrix[i][j]=0; } } total_routes = routes; total_stations = stations; } void graph::printgraph(){ cout << "\n" <

iphone - PageviewController DataSource Method -

i have 2 pageviewcontroller data source methods this - (uiviewcontroller *)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller viewcontrollerafterviewcontroller:(uiviewcontroller *)viewcontroller - (uiviewcontroller *)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller viewcontrollerbeforeviewcontroller:(uiviewcontroller *)viewcontroller and want add 1 more using willturntopageatindex:(nsuinteger)currentindex , have written given below pointer not hitting noticed after adding breakpoint it i think coding datasource method name written wrong - (void) pageviewcontroller:(pageviewcontroller *)pageviewcontroller willturntopageatindex:(nsuinteger)currentindex if can me in correcting pointer should hit method when execute project. will appreciate help. thanks is method? – pageviewcontroller:willtransitiontoviewcontrollers:

Python operator overriding: __ge__ result is not as expected -

problem python operator overriding: __ge__ (corresponding '>=') result not expected class book: title = '' pages = 0 def __init__(self, title='', pages=0): self.title = title self.pages = pages def __str__(self): return self.title def __radd__(self, other): ''' enables book1 + book2 ''' return self.pages + other def __lt__(self, other): ''' less ''' return self.pages < other def ___le__(self, other): ''' less or equals ''' return self.pages <= other def __eq__(self, other): ''' equals ''' return self.pages == other def __ne__(self, other): ''' not equals ''' return self.pages != other def __ge__(se

delphi - Is there a way to escape a closing bracket for comments? -

i'm adding comments delphi code documentation. 1 of things i'm trying document json structure, i'm trying put sample json data commented in code. however, json uses squiggly brackets { } , coincidentally used comments in delphi. because of this, can't figure out way add these comments. documentation comment blocks use { } , example: { unit , that. use tsomecomponent bla bla } when try document json data, closing bracket } ends comment - if line prefixed single-line comment // , doesn't work: { how json structure looks: // { // "some_string": "value", // "some_object": { // "something": 123 // }, //<-- compiler detects comma // "something_else": "some other string" // } } as there's closing bracket } , commented line becomes uncommented, if it's prefixed 2 slashes. delphi picks comma after bracket. in end, cannot figure out way in can documen

Polymer Change :host {} dynamically when html5 video is fullscreen -

is possible dynamically switch :host block inline when user hits fullscreen in html5 video? when html5 video full screen, there nothing on element :host(element-attribute) . i'm scratching head trying figure out way. <dom-module id="video-player"> <template> <style> :host { display: block; width: 100%; position: relative; margin-left: 100%; } .v-center { @apply(--layout-horizontal); @apply(--layout-center-center); padding-top: 5%; background-color: black; overflow-y: scroll; height: 100%; } video { padding-bottom: 300px; } video:-webkit-full-screen { padding-bottom: 0; } video:-webkit-full-screen * { display: inline; } </style> <iron-media-query query="(max-width: 600px)" query-matches="{{smallscreen}}"></iron-media-quer

How to parse a list of Json objects in Haskell? -

i have data class: data mydata = mydata { :: int, b :: string } instance tojson mydata .... instance fromjson mydata .... i can parse single object json: get :: io (maybe mydata) = res <- getsingleitemhttp return $ decode $ responsebody res how can list of mydata? get2 :: io [mydata] get2 = res <- getmanyitemshttp --???? return $ decode $ responsebody res -- doesn't compile how go parsing responsebody list ? it should work once pass in array (and decode list) have change signature get2 :: io (maybe [mydata]) : {-# language derivegeneric, overloadedstrings #-} module json import ghc.generics import data.aeson import data.text import data.bytestring.lazy data mydata = mydata { :: int, b :: string } deriving (generic, show) instance fromjson mydata example :: bytestring example = "[{ \"a\": 1, \"b\": \"hello\" }, { \"a\": 2, \"b\": \"world\" }]" ex

solr - Retrieve JSON facet with SolrJ -

i use solrj along json facet api facets. solrj query response object contained documents, no facets. facet nested structure. solrj support json facets or i'll need parse self? furthermore, facets on child objects contained counts, no values. how can facet terms, france, italy below example? facets={ count=57477, apparels={ buckets= { val=chanel, count=6, madein={ count=6 } } } } you must parse facet result since not obvious parse it. may use response.getresponse().get("facets"); or may request server directly , parse result yourself. direct request may done method below. public static inputstream getinputstreamwithpost(final string url) throws exception { final url obj = new url(url); final httpurlconnection con = (httpurlconnection) obj.openconnection(); // optional default post con.setrequestmethod("post"); //

python - Can't show animation for bar graph in Matplotlib -

i have text file updating single value. i'm trying display value using matplotlib's animation i'm having lots of issues. example want show value that's changing every second on text file (value ranges 0 150) , want height of bar graph increase , decrease value. i want same horizontal graph. want show dot moving around circle different values (between 0 , 360). i've tried many things broke code or matplotlib froze. i've been trying use matplotlib's animation. any appreciated. when run code don't see bar graph import matplotlib.pyplot plt import mpl_toolkits.mplot3d.axes3d p3 import matplotlib.animation animation import random mf = r"data.txt" fig = plt.figure() ax = p3.axes3d(fig) xpos = 0 ypos = 0 zpos = 0 dx = 1 dy = 1 def update_bars(): mmf = open(mf) lines = mmf.readlines() depth_1 = lines[3] dz = depth_1 bars = ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color= 'b') return bars ## add bars

html - Nav goes whole way down webpage and displays between elements. What do? -

as can see red nav seems poke out between elements, looks terrible. how can fix this? i've been doing web dev week hoping veteran can help! if wants see code ask, i'm having problem posting directly on here.. thanks in case bring nav in front of elements can give z-index:-1 , position:relative . also refer fiddle.hope may you. http://jsfiddle.net/xb2ut/4/

javascript - jQuery with Input Type = "Number" -

simple question, looking right way handle this. i've broken down simplistic example still shows problem. let's have basic html table: <table id="customertable"> <caption class="bg-primary h4">customer overview</caption> <thead> <tr> <th>customer id</th> <th>customer name</th> <th># projects</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>enterprise management</td> <td>14</td> </tr> <tr> etc ... </tr> </tbody> </table> then have input type: <input id="colorcolumnred" type="number" /> the jquery follows, redtext being basic css change color red. i'm handling both change , keyup events try capture 2 situations

Trying to post a user's email address to a membership table in rails -

https://github.com/jtrinker/highlands i'm building app allows user sign in , join group. when click on group , click 'join' user's email address posted memberships table , users have joined group saved. i have user, group, , membership model. things got little hairy once added membership table. models: class membership < activerecord::base belongs_to :user belongs_to :group attr_accessible :user_email end class user < activerecord::base belongs_to :group # include default devise modules. others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # setup accessible (or protected) attributes model attr_accessible :email, :username, :password, :password_confirmation, :remember_me end class group < activerecord::base has_many :memberships has_many :users, :through => :m

php - Multiple Image Upload in Laravel 5.2 -

finally can upload , move images, want create multiple upload images on laravel. possible? did have use array make it? can modify little bit code? it's on productcontroller.php $picture = ''; if ($request->hasfile('images')) { $file = $request->file('images'); $filename = $file->getclientoriginalname(); $extension = $file->getclientoriginalextension(); $picture = date('his').$filename; $destinationpath = base_path() . '\public\images/'; $request->file('images')->move($destinationpath, $picture); } if (!empty($product['images'])) { $product['images'] = $picture; } else { unset($product['images']); } thank you. note: code above kindhearted person on stackoverflow, again ;) at frontend form you'll have use field attribute name name="images[]" and controller code this. $picture = ''; if ($request->hasfile('im

Android studio's emulator has an error "can't connect to camera" -

Image
i'm connecting webcam emulator setting front camera "webcam0" in avd manager. when launch webcam android studio's avd manager or using emulator -camera-front webcam0 , following window: and when emulator has showed error please me how fix that. go android virtual device manager>>select emulator>>click edit>>select advanced setting>>camera select emulated rather webcam0 . if answer helped ,please upvote.

c# - Value cannot be null or empty.\r\nParameter name: name -

Image
when go cshtml page error occur: an exception of type 'system.argumentexception' occurred in system.web.mvc.dll not handled in user code in cshtml code : <div class="form-group"> @html.label("model", new { @class = "control-label col-md-4" }) <div class="col-md-8"> @html.editor("model") </div> </div> but on other hand if change code in @html.editor("propertymodel") it working no error occur . update: in model: public class propertyassign { public int propertyassignid { get; set; } public string propertyname { get; set; } public string model { get; set; } public datetime assigndate { get; set; } } in controller: public actionresult create() { return view(); } the reason exception thrown htmlhelpers inspect viewdata values bind to. viewdata typeof viewdatadictionary contains property mod

ios - Present the current View Controller with different data -

i have view controller, , when button selected, current view controller should present version of can go back. here have: func buttontapped(sender: uibutton){ let controller = myvc() controller.txt = txts[sender.tag] self.presentviewcontroller(controller, animated: true, completion: nil) } this doesn't seem work. when run code "unexpectedly found nil while unwrapping optional value" error message coming storyboard items. you not need present controller again. change data. if there changes in ui can hide , show or can add or remove super view. , if require presentviewcontroller compulsory use new viewcontroller present. can't present presenting controller. hope :)

mongodb findAndModify update element in array -

there bson document: { "_id" : objectid("5718441f5116a60b08000b8c"), "mails" : [ { "id" : 2, "a" : [ { "a" : 1 }, { "a" : 2 } ] }, { "id" : 1, "a" : [ { "a" : 1 }, { "a" : 2 } ] } ] } i need return , clear array "a" belong "mails.id == x" given document. use findandmodify like: db.mail.findandmodify({query: {"_id":objectid("5718441f5116a60b08000b8c")}, update: {$set:{"mails.$.a":[]}}, new: false, fields:{"mails":{$elemmatch:{"id":1}}}}) however don't work. problem $set should

shell - How to store a user password using BASH script and access it in scripts it invokes -

i have script: setup.sh read -s -p "enter password use in script: " password echo -e $password | sudo -s brew cask install junk echo "done installing junk, running step 1..." ./step1.sh step1.sh echo -e $password | sudo -s some-other-command obviously $password empty in step1.sh, , export variable use globally in other scripts invokes: export password or can use script argument: setup.sh read -s -p "enter password use in script: " password echo -e $password | sudo -s brew cask install junk echo "done installing junk, running step 1..." ./step1.sh $password step1.sh echo -e $1 | sudo -s some-other-command i'm assuming first example using export isn't idea security perspective (however, i'm not sure). second usable , secure? also, if not, there better way without relying on sudo caching password (i have large list of scripts take time execute , cache timeout , want entire script unattended)? do

c# - Search box in treeview with keyword search in asp.net -

i have treeview populated using database connection. want add search box treeview keyword search , returns parent nodes of trreview have keywords entered in search box. do have make new treeview , apply search on , display treeviw if keyword in search box matches or can search in original treeview , show matched nodes , make visibility false others. i have far written code only string searchtxt = txt_search.text.trim(); foreach (treenode node in folderstructure.nodes) { if (node.text.startswith(txt_search.text.trim())) { node.select(); txt_search.text = ""; } } every suggestion welcomed. thanks

java - Android numberpicker edge scrolling glitch -

i've created number picker string values. public void setvalues() { boolean defaultavaliable = false; int defaultrow = 0; string[] values = new string[pickvalues.size()]; (int = 0; < pickvalues.size(); i++) { if (pickvalues.get(i).equals("01:00")) { defaultavaliable = true; defaultrow = i; } values[i] = pickvalues.get(i); } timepicker.setmaxvalue(values.length - 1); timepicker.setminvalue(0); timepicker.setwrapselectorwheel(false); timepicker.setdisplayedvalues(values); if (defaultavaliable) { timepicker.setvalue(defaultrow); } } and when scroll edge values (first or last) picker first jumps item in weird, not smooth way , after when try go other values doesn't scroll. picker glitches on edge value , after time goes back. in way looks scroll on edge value , needs scrolling back. has else had problem or have suggestions check? edit 1: so i've got p

nhibernate - Strategies for DRY when using ViewModels instead of Entities -

a lot of our pages use custom view models cut versions of nhibernate-mapped entities. when have global set of entities, reusing small pieces of entity-centric business logic straightforward logic can added entities. however, once have view-specific view models, becomes harder. here contrived example: // entity public class sale : entity { public guid id { get; set; } public decimal tax { get; set; } public decimal saleprice { get; set; } public int totalprice { { return tax + saleprice; } } ... more properties ... } // view model public class saleview { public guid id { get; set; } public decimal tax { get; set; } public decimal saleprice { get; set; } } public class controller { public action viewsale(guid id) { return session.query<sale>() .where(x => x.id == id) .select(x => new saleview { id = x.id, tax = x.tax,

javascript - Can two servers access a common mongoDB database -

i have 2 webservers have created on ports 3000 , 4000. 1 of webservers created database , has 3 collections.. show dbs local 0.000gb sensor_db 0.000gb use sensor_db switched db sensor_db show collections sensors templategroups templates can 2nd server access database created ? if yes, not able access collections ..is there syntax it? 1st server: var express = require('express'); var app= express(); var path = require('path'); var bodyparser= require('body-parser'); var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/sensor_db'); var schema = mongoose.schema; var sensorschema = new schema({ value:{ type:number, default:0}, format:{type:string, default:"default"}, id:{type:number,required:true,unique:true}, description:{type:string}, type:{type:string}, groupid:{type:number}, users:{type:array,default:[]}, admin:{type:string,default:'undefined'}, statu

r - GGPlotly: downloadHandler giving empty plot -

i having difficulties plotly . able download plotly pdf. while adding code x , y axis parameters (cause if transfer ggplot plotly , titles of x , y axis cut) this code working download pdf file: library(shiny) library(dt) library(ggplot2) library(plotly) shinyapp( ui = fluidpage( fluidrow(downloadbutton('downloadplot',label='download plot')), plotlyoutput('plot1') ), server = function(input, output) { testplot <- function(){ <- ggplot(mtcars, aes(x = interaction(cyl, carb, lex.order = t), y = mpg,fill = interaction(cyl, carb, lex.order = t))) + geom_boxplot() } output$plot1 <- renderplotly({testplot()}) output$downloadplot <- downloadhandler( filename ="plot.pdf", content = function(file) { pdf(file, width=12, height=6.3) print(testplot()) dev.off() })}) and addition of code fix titles of ggplotly fails: a <- ggplot(mtcars, aes(x = interactio

unsupervised learning - Restricted Boltzmann Machine for real-valued data - gaussian linear units (glu) - -

i want restricted boltzmann machine learn new representation of real-valued data (see: hinton - 2010 - practical guide training rbms ). i'm struggling implementation of gaussian linear units. with gaussian linear units in visible layer energy changes e(v,h)= ∑ (v-a)²/2σ - ∑ bh - ∑v/σ h w . don't know how change contrastive divergence learning algorithm. visible units won't sampled more linear. use expectation (mean-fied activation) p(v_i=1|h)= +∑hw + n(0,1) state. associations left unchangend ( pos: data*p(h=1|v)' neg: p(v=1|h)*p(h=1|v)' ). leads random noise when want reconstruct data. error rate stop improving around 50%. finally want use gaussian linear units in both layers. how states of hidden units then? suggest using mean-field activation p(h_i=1|v)= b +∑vw + n(0,1) i'm not sure. you take @ gaussian rbm hinton himself has provided please find here. http://www.cs.toronto.edu/~hinton/code/rbmhidlinear.m

ASP.NET MVC - Dependency Injection -

i going on dependency injection. have asp.net mvc project model named customers: public class customers { public id get; set; private customer customer public customers() { customer = new customer(); } } now suppose add classes in order eliminate dependency in above class. example, customer dependency of customers class. customers should depend on abstraction. created interface (or abstract class) named istoragecustomer public interface istoragecustomer { } now changed customers class following below: public class customers { public id get; set; private istoragecustomer customer; public customers(istoragecustomer customer) { this.customer = customer; } } i need know if dependency has been eliminated in above class. else need do? please help. appreciated. thank you. you can install ninject mvc. (be aware there different version each version of mvc) this nuget manages dependency injection you.

How to write a unicode object into a file in Python? -

i try write "string" file , following error message: unicodeencodeerror: 'ascii' codec can't encode character u'\xcd' in position 6: ordinal not in range(128) i tried following methods: print >>f, txt print >>f, txt.decode('utf-8') print >>f, txt.encode('utf-8') none of them work. have same error message. what idea behind encoding , decoding? if have unicode object can write file directly or need transform string? how can find out codding used? how can know if utf-8 or ascii or else? added i think have managed save string file. print >>f, txt print >>f, txt.decode('utf-8') did not work print >>f, txt.encode('utf-8') works. no error message , see chinese characters in file. i posted another answer addresses issue. key quote: for overview of difference, read one of joel's articles , gist bytes are, well, bytes (groups of 8 bits without further meanin

how to use removeSheet and insertSheet on kendo Spreadsheet? -

i read documentation in http://docs.telerik.com/kendo-ui/api/javascript/ui/spreadsheet#methods-insertsheet but on link didn't see example using function. can give me example insertsheet method , removesheet method? thanks.

c# 4.0 - Uploading and retrieving image and video url in ASP.NET MVC4 Internet Application -

i have following model in mvc 4 internet application public class eventmodel { public int eventid { get; set;} public string eventtitle { get; set;} public string imageurl { get; set;} public string videourl { get;set} } here's create.cshtml code image , video @using(html.beginform()) { @html.antiforgerytoken() @html.validationsummary(true) <div> @html.labelfor(model =>model.imageurl) </div> <div> @html.editorfor(model =>model.imageurl) @html.validationmessagefor(model =>model.imageurl) </div> <div> @html.labelfor(model =>model.videourl) </div> <div> @html.editorfor(model =>model.videourl) @html.validationmessagefor(model =>video.imageurl) </div> } this controller code post method on create [httppost] [validateantiforgerytoken] public actionresult create(eventmodel eventmodel) { if (modelstate.isvalid) { _db.eventmodels.a

c# - Delphi XE2 DLL crashes when called from Web API running on Azure App Service -

my c# web api project calling native delphi dll using p/invoke. everything works fine on windows 10 development machine until publish project azure app service web app. when dll invoked app service , tries create hidden form access violation occurs , website crashes. in example below test form empty delphi vcl form. // delphi xe2 dll: function testfunc: boolean; stdcall; begin result := opentestform(nil); end; function opentestform(aowner: tcomponent): boolean; begin frmtest := tfrmtest.create(aowner); // access violation here !!! try result := true; frmtest.free; end; end; // c# [dllimport("test.dll", callingconvention = callingconvention.stdcall)] public static extern bool testfunc(); c# web api project: .net core rc1 (1.0.0-rc1-final) using .net framework 4.5.1 delphi xe2: 32 bit dll works fine on windows 10 (dev machine) , on windows server 2012 r2 (azure vm). azure app service running 32 bit process.

c# - How to compare three column in sql -

this question has answer here: how compare 2 columns equality in sql server? 5 answers i want compare 3 column value comparison value col2 in table. col1 col2 col3 12 < 25 true 25 > 20 true 15 = 25 false select (case when col2 = '<' col1 < col3 else col1 end) can me ? advanced thanks. you can try using case , this: case when col2 = '<' col1 < col3 when col2 = '>' col1 > col3 when col2 = '=' col1 = col3 end case the query be select case when col2 = '=' case when (col1 = col3) 1 else 0 end when col2 = '>' case when (col1 > col3) 1 else 0 end when col2 = '<' case when (col1 < col3) 1 else 0 end el

ios - Mirror SpriteKit node that has pinned children -

the question be: how mirror pinned spritekit node along nodes axis? i'm developing 2d platform game spritekit. hero sknode functions container body parts. hero:sknode --- leftarm:skspritenode --- rightarm:skspritenode --- body:skspritenode leftarm , rightarm pinned body node (through skphysicsjointpin). i want mirror hero horizontally when changes direction. when change xscale -1 gets mirrored pinned nodes mirrored along own axis , not along bodies axis/parent nodes center. i tried manually adjust pinned nodes position without effect (seems not allowed pinned nodes). how can mirror pinned nodes along body nodes axis or change position independently? i found approach worked me change pinned node's position independently. adjust pinned nodes position get pinned nodes joint(s) (through pinnednode.physicsbody.joints) remove joint physicsworld create new joint same parameters removed 1 , add world

javascript - Bootstrap list-items activating on embedded span -

Image
sorry title, found no better way describe it. i have list-group , want buttons show specific color when active. somehow, embedded spans capture click , seem not count part of a . how can fix this? want button change color, no matter click (on span or anywhere else) the code here: https://jsfiddle.net/zj6uwmvu/ thanks here revised code click handler. if event target not link, means child badge clicked. if case, find closest link (the parent) , assign target. $('.location').find('.location-picker-list .list-group-item').on('click', function(e) { var target = $(event.target); if (!target.is('a')) { target = target.parent('a') } e.preventdefault() target.closest('.list-group').children(".active").removeclass('active') target.addclass('active') }) https://jsfiddle.net/zj6uwmvu/11/

cordova - Ionic: Connection to server was unsuccessful -

when try run ionic app in emulator or device. following error: the connection server unsuccessful ( http://192.168.0.8:8100 ) however, works alright in browser through ionic serve . i hope not due content security tag or cordova whitelist plugin settings follows: <meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"> <allow-navigation href="http://*/*"/> <access origin="*"/> possible issues: check if device under same wi-fi. check if firewall not blocking 8100 , 35729 ports. check following tags: <content src="index.html"/> <access origin="*"/> <allow-navigation href="http://ionic.local/*"/> <allow-navigation href="*"/> <allow-navigation href="http://192.168.0.8:8100"/> <allow-intent href

python - Installing via `setup.py develop` fails - pip works -

my python package footools needs html5lib via install_requires in setup.py . setup.py develop fails installing via setup.py develop fails: cd src/footools/ python setup.py develop processing dependencies footools==2016.205 searching html5lib==0.9999999 reading https://source.example.com/pypi/simple/html5lib/ download error on https://source.example.com/pypi/simple/html5lib/: [errno 185090050] _ssl.c:354: error:0b084002:x509 certificate routines:x509_load_cert_crl_file:system lib -- packages may not found! couldn't find index page 'html5lib' (maybe misspelled?) pip works but direct download works: bar@workdevel123:~/src/footools> pip install html5lib==0.9999999 /home/bar/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: insecureplatformwarning: true sslcontext object not available. prevents urllib3 configuring ssl appropriately , may cause ssl connections fail. more information, see https://urllib3.readt

browser - Does the per-host connection limit is raised with HTTP/2? -

browsers have per-host limit regarding number of parallel xhr (about 6 nowadays). does restriction apply multiplexed http/2 connections? browsers impose per-domain limit of 6-8 connections when using http/1.1, depending on browser implementation. allows @ 6-8 concurrent requests per domain. with http/2, browsers open 1 connection per domain. however, multiplexing feature of http/2 protocol, number of concurrent requests per domain not limited 6-8, virtually unlimited. it virtually unlimited in sense browsers , servers may limit number of concurrent requests via http/2 configuration parameter called settings_max_concurrent_streams . typical limits around 100 (firefox's default value network.http.spdy.default-concurrent - note spdy name here: protocol ancestor of http/2 protocol) larger (or, less commonly, smaller), depending on browser implementation , on server connect to. expect these limits vary on years evolution , more widespread usage of http/2 (in

ios - Swift unwrapping optional giving error with data -

Image
my ios application fetch data server , render images data using 'kingfisher', problem whenever add or replace new image on server application crashes due code below error : " fatal error: unexpectedly found nil while unwrapping optional value " let prfix:string = "my_prefix_url /\(org.image)" celimage.kf_setimagewithurl((nsurl(string: prfix))!) please check sceeenshot more detail don't undestand why getting error, because can see prfix got value. i think due prefix contain unnecessary characters, can fix urlhostallowedcharacterset you can fix prefix malformed url (swift 2.x). let urlstr : nsstring = prfix.stringbyaddingpercentencodingwithallowedcharacters(.urlhostallowedcharacterset())! celimage.kf_setimagewithurl((nsurl(string: urlstr string))!) this make sure url contains string.

mysql - Sort and Join two tables by date -

i have following tables: posts post_id | text | posts_date 1 | blabla | 06-06-2013 2 | bababa | 09-06-2013 ... and comments comment_id | post_id | user_id | text | comments_date 1 | 1 | 55 | this... | 06-08-2013 2 | 1 | 66 | yeah, me also! | 06-07-2013 3 | 2 | 55 | this... | 06-10-2013 4 | 2 | 66 | yeah, me also! | 06-11-2013 ... i need sql statement returns columns both tables , orders them first posts_date , comments_date post. so resulting table query should be post_id | text | posts_date | comment_id | user_id | text | comments_date 1 | blabla | 06-06-2013 | 2 | 66 | yeah, me also! | 06-07-2013 1 | blabla | 06-06-2013 | 1 | 55 | this... | 06-08-2013 2 | bababa | 09-06-2013 | 3 | 55 | this... | 06-10-2013 2 | bababa | 09-06-2013 | 4 | 66 | yea

c++ - Operator overloading as friend function error -

i'm trying use + add 2 vector (mathematical vector). here's code: class vector{ double v[max_size]; int dim; public: int getdim() const; vector(); vector(int n); vector(const vector& a); vector add(const vector&b); friend vector operator+(vector summand1, vector summand2); }; operator overloading: vector operator+(vector summand1, vector summand2){ int dim1 = summand1.getdim(); int dim2 = summand2.getdim(); assert(dim1 == dim2); vector sum(dim1); int i; for(i = 0; < dim1; i++){ sum.v[i] = summand1.v[i] + summand2.v[i]; } return sum; } and how use it: vector m = v+t; when run code, shows m (0,0) (2d vector), default value generated constructor. what's wrong it? thanks! your copy constructor: vector::vector(const vector& a){ dim = a.dim; vector(dim); } correctly sets value of dim member, has not other side effect. you should have variant of following

javascript - How to increase image size based on table contents using html? -

i have created 1 table.again create 1 table table created @ inside of first table. first table : added 1 image. second table : write content. content large second table increase first table , images not increased.so how increase image size. i used following code : <html> <head> <style type="text/css"> body { font-family: calibri; } table tr { border: none; } a, a:link, a:visited, a:active { text-decoration: none; color: #09b0ce; } img { border: none; width: 100%; height: auto; } </style> </head> <body> <table cellspacing="1" cellpadding="0" align="center" id="main-panel" style="width: 100%; background-color:#f2f2f2; color: rgb(75, 75, 75); border-collapse: collapse; border: 1px solid

couchdb - Querying on map key/value pair in couch db -

i've been reading on documentation couch db views ( http://wiki.apache.org/couchdb/http_view_api#http_view_api , http://www.barkingiguana.com/2009/01/22/filtering-and-ordering-couchdb-view-results/ ) i'm not finding i'm looking , i'm beginning think not supported. i have 2 records in couch database { "_id": "uuid", "_rev": "rev", "status": "complete", "csv": [ { "lower": 0.09, "upper": 0.31 } ], "tags": { "get_info": { "duration": "24", "location": "south" } } } and { "_id": "2-uuid", "_rev": "2-rev", "status": "complete", "csv": [ { "lower": 0.01, "upper": 0.70

maven - Adding third party libraries to Sonatype Nexus repository OSS -

procedure adding third party libraries sonatype nexus central repository. this explained in nexus documentation : http://blog.sonatype.com/2008/11/adding-a-jar-to-a-maven-repository-with-sonatype-nexus/