Posts

Showing posts from January, 2013

tiddlywiki5 - Why heroku app doesn't save new file with Tiddlywiki? -

have met issue me before? have deployed tiddlywiki5 heroku app @ https://jameswiki.herokuapp.com . displayed , worked expected @ runtime. however, after server (web dyno) sleeping , wakeup (often after 1 hour inactive), clear. have checked console in heroku when creating new tiddle, still said new tiddle has been saved, in fact, no new tiddle saved tiddlers folder. below script install , run it: in package.json { ... "scripts": { "start": "tiddlywiki . --server", "postinstall": "npm install -g tiddlywiki" } } in procfile web: tiddlywiki . --server $port $:/core/save/all text/plain text/html "" "" 0.0.0.0 help me fix issue. thanks. heroku's filesystem ephemeral - exists while dyno exists. when dyno restarts or ends (as when app goes sleep), new 1 have fresh, empty filesystem. if want files persist, need save them off database or amazon s3 long-term

sas - linking crsp and compustat in R via WRDS -

i using r connect wrds. now, link compustat , crsp tables. in sas, achieved using macros , ccm link table. best way approach topic in r? progress update: i downloaded crsp, compustat , ccm_link tables wrds. sql <- "select * crsp.ccmxpf_linktable" res <- dbsendquery(wrds, sql) ccmxpf_linktable <- fetch(res, n = -1) ccm.dt <- data.table(ccmxpf_linktable) rm(ccmxpf_linktable) i converting suggested matching routine wrds event study sas file r: ccm.dt[,typeflag:=linktype %in% c("lu","lc","ld","ln","ls","lx") & usedflag=="1"] setkey(ccm.dt, gvkey, typeflag) (i in 1:nrow(compu.dt)) { gvkey.comp = compu.dt[i, gvkey] endfyr.comp = compu.dt[i,endfyr] permno.val <- ccm.dt[.(gvkey.comp, true),][linkdt<=endfyr.comp & endfyr.comp<=linkenddt,lpermno] if (length(permno.val)==0) permno.val <- na suppresswarnings(compu.dt[i, "permno"] <- permno.val) } ho

javascript - Invalid ELF header Node js with couchbase db -

i've seen handful of posts issue results seem specific users configuration. i'm using couchbase db express js server. when run code locally (windows) works fine. database self hosted on linux server. when deploy code our testing environment ( linux ), i'm getting error when try run "node server.js": /var/www/html/btrnode/node_modules/couchbase/node_modules/bindings/bindings.js:83 throw 8 error: /var/www/html/btrnode/node_modules/couchbase/build/release/couchbase_impl.node: invalid elf header @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ module.require (module.js:364:17) @ require (module.js:364:17) @ .... i'm lost on in situation. mentioned before, seemed me fixes in other peoples situation system configuration. i'm not sure post here see configuration might help, can sure add if needed. if there more general solution or error i'm committing that'd helpful know to. question :

UPDATE query from Access to SQL Server -

i have query below access , need convert sql server: update (case_info inner join case_price on case_info.case_type = case_price.case_type) inner join [casechange|input] on case_info.case_number = [casechange|input].case_number set case_info.ff_revenue_amt = [ff_payment], case_info.cm_revenue_amt = [cm_payment] (( (case_info.scheduled_date) between [case_price].[pop_start] , [case_price].[pop_end]) , ((case_info.discontinue_30)=no)); access: update t1 inner join t2 on t1.foo=t2.bar set t1.field = t2.otherfield ... sql server: update t1 set t1.field = t2.otherfield t1 inner join t2 on t1.foo=t2.bar ... that should started. see update table using join in sql server?

asp.net mvc - EditorFor htmlAttributes not working for type bool (MVC 5.2) -

since mvc 5.1 possible add html attributes editor templates follows: @html.editorfor(m => m.foo, new { htmlattributes = new { id = "fooid", @class="fooclass" } }) if property foo of type string , generate input markup correctly, including custom attributes. but if property foo of type bool (or bool? ) attributes ignored... am missing here?. feature still not supported templates generates "select" markup? i know question asked while ago ran exact same issue now. turns out different developer had created custom editor template boolean in our solution able customize text of drop-down. code supposed work editors out of box not work automatically custom editors ... have implement yourself. if issue, need modify custom editor template fetch htmlattributes out of viewdata , pass them along underlying dropdownlistfor (or whatever helper using). here custom editor template looks now: @model bool? @using system.web.mvc; @{ var html

r - Why is the time complexity of this loop non-linear? -

why time complexity of loop non-linear , why slow? loop takes ~38s n=50k, , ~570s n=200k . there faster way this? rprof() seems indicate writing memory slow. df <- data.frame(replicate(5, runif(200000))) df[,1:3] <- round(df[,1:3]) rprof(line.profiling = true); timer <- proc.time() x <- df; n <- nrow(df); <- 1 ind <- df[1:(n-1),1:3] == df[2:n,1:3]; rind <- which(apply(ind,1,all)) n <- length(rind) while(i <= n) { x$x4[rind[i]+1] <- x$x4[rind[i]+1] + x$x4[rind[i]] x$x5[rind[i]+1] <- x$x4[rind[i]+1] * x$x3[rind[i]+1] x$x5[rind[i]+1] <- trunc(x$x5[rind[i]+1]*10^8)/10^8 x$x1[rind[i]] <- na <- + 1 };x <- na.omit(x) proc.time() - timer; rprof(null) summaryrprof(lines = "show") the purpose of algorithm iterate on data frame , combine adjacent rows match on elements. is, removes 1 of rows , adds of row's values other row. resulting data frame should have n less rows, n number of matching adjacent row

Complex table Join at sql -

Image
pls want data articles table according presskit table data i need how join between articles table , presskit table while have different intermediate tabled between them? i want data select articleid , articaletile articles dbo.magazineid in ( select dbo.magazines.magazineid dbo.magazines inner join dbo.presskitmagazines on dbo.magazines.magazineid = dbo.presskitmagazines.magazineid presskitid = @presskitid ) , classid in ( select class.classid dbo.class inner join dbo.presskitclass on class.classid = presskitclass.classid presskitid = @presskitid ) select articleid, articletitle articles join dbo.presskitmagazines pm on a.magazineid = pm.magazineid , pm.presskitid = @presskitid join dbo.presskitclass pc on a.classid = pc.classid , pc.presskitid = @presskitid you not need involve magazines , class or presskit because not need return name s associat

Angular 2 DataService in TypeScript for ASP.NET 5 not displaying data -

this displays hello world app.component.ts bootstrapping correctly. either no data returned dataservice or can't displayed. there no compiler errors. there popup window in typescript alert() in javascript check see if data being returned dataservice? app.component.ts import { component } 'angular2/core'; import { dataservice } './data.service'; @component({ selector: 'app', template: `<h1>hello world</h1> <li *ngfor="#customer of customers"> <span>{{customer.firstname}}</span> </li> ` }) export class appcomponent { public dataservice: dataservice; customers: any[]; constructor() { } ngoninit() { this.dataservice.getcustomers() .subscribe((customers: any[]) => { this.customers = customers; }); } } data.service.ts import { injectable } 'angular2/core'; import { http, response } 'angular2/http'; import 'r

java - how to use Iterator in object arraylist -

here got public class planet { arraylist<person> person = new arraylist<>(); iterator<person> itr = person.iterator(); public string getfemalename() { (int = 0;a < person.size();a++) { if (person.getgender == "female") { return person.get(a).getname(); } } } } now i'm having 2 problems, 1st want return female's name,but seems have return there no female in arraylist. 2nd how use iterator instead of using loop. for case when no female present , putting return null in end of function job, because first return statement won't executed @ all. for second question, using iterator .. replace for loop while(itr.hasnext()) { person newperson=itr.next(); if(newperson.getgender().equals("female") return newperson.getname(); }

javascript - How to determine if google auth2.signIn() window was closed by the user? -

im implementing auth using , showing loading icon in react when user clicks button sign in , auth2 account selection/login window shows. however if user closes window, there doesnt seem event fired i.e signin() function returns promise never resolves, have thought google return error promise if window closed. result there no way me stop showing loader icon , reshow login menu. i wondering if had solution this? although api provides mechanism detecting when user clicks deny button, there not built-in way detecting user abruptly closed popup window (or exited web browser, shut down computer, , on). deny condition provided in case want re-prompt user reduced scopes (e.g. requested "email" need profile , let user proceed without giving email). if response sign-in callback contains error, access_denied , indicates user clicked deny button: function onsignincallback(authresult) { if (authresult['error'] && authresult['error'] == '

php - I want to display different prices for logged in (wholesale) and logged out (retail) customers in woocommerce website -

i developing e-commerce website, want display different price loggedin users , different loggedout users. can please let me know how can in woocommerce. you need custom code. gets placed in theme functions.php file or custom plugin code. function custom_get_price( $price, $product ) { $discount = 0.5; if( is_user_logged_in() ) $price = $price * $discount; return $price; } add_filter( 'woocommerce_get_price', 'custom_get_price',10,2); this code hooks woocommerce get_price() function in abstract-wc-product.php file. some resources on adding custom code wordpress https://www.woothemes.com/2014/09/properly-add-woocommerce-custom-code/ https://dev7studios.com/adding-code-customisations-wordpress-the-right-way/ https://docs.woothemes.com/document/introduction-to-hooks-actions-and-filters/

java - Number list from a Map -

i have map simplifying in essense contains key values of data such as: yahya, 4 john, 4 blake, 2 jill 2 janoe, 6 jilly 12 zapon, 5 zoe, 4 hamed, 1 i need order following output: 1. jilly, 12 pts 2. janoe, 6 pts 3. zapon, 5 pts 4. john, 4 pts 4. yahya, 4 pts 4. zoe, 4 pts 7. blake, 2 pts 7. jill, 2 pts 9. hamed, 1 pts i have used comparator order map values according value: public <k, v extends comparable<v>> map<k, v> sortbyvalues(final map<k, v> map) { comparator<k> valuecomparator = new comparator<k>() { public int compare(k k1, k k2) { int compare = map.get(k2).compareto(map.get(k1)); if (compare == 0) return 1; else return compare; } }; map<k, v> sortedbyvalues = new treemap<k, v>(valuecomparator); sortedbyvalues.putall(map); return sortedbyvalues; } and read : how element position java map , order hashmap alphabetically value , more not sure h

visual studio - "Scanning new and updated MEF components" -

i can reproduce problem @ will. below steps: environment: windows 10 professional 64bit run vs_community_enu.exe install choose microsoft web , developer tools let done installing open first time, can see asp.net web application close visual studio open second time, show upgrade: "scanning new , updated mef components..." , 2 or 3 more of undated new project no long shows asp.net web application along other templates how can fix problem? uninstalled , reinstalled 5 times , same thing happen again. installed vs2015.1.exe nothing happened delete contents of following folder: %localappdata%\microsoft\visualstudio\14.0\componentmodelcache

bash - Redirecting output of list of commands -

i using grep pull out lines match 0. in multiple files. files not contain 0. , want output "none" file. if finds matches want output matches file. have 2 example files this: $ cat sea.txt shrimp 0.352 clam 0.632 $ cat land.txt dog 0 cat 0 in example files both lines output sea.txt , land.txt file "none" using following code: $ grep "0." sea.txt || echo "none" the double pipe ( || ) can read "do foo or else bar", or "if not foo bar". works perfect problem having cannot output either matches (as find in sea.txt file) or "none" (as find in land.txt file) file. prints terminal. have tried following others without luck of getting output saved file: grep "0." sea.txt || echo "none" > output.txt grep "0." sea.txt || echo "none" 2> output.txt is there way save file? if not there anyway can use lines printed terminal? you can group commands { }

Why android 5.0 occur error java.lang.RuntimeException: start smooth zoom failed? -

this code set zoom of camera: // 10 set zoom value camera if (p.iszoomsupported() && p.issmoothzoomsupported()) { // phones mcamera.startsmoothzoom(zoomvalue); } else if (p.iszoomsupported() && !p.issmoothzoomsupported()) { p.setzoom(zoomvalue); mcamera.setparameters(p); mcamera.setparameters(p); mcamera.startpreview(); } but occur exception on canvas spark (q380) android 5.0: java.lang.runtimeexception: start smooth zoom failed @ android.hardware.camera.startsmoothzoom(native method) jat android.app.activity.dispatchtouchevent(activity.java:2775) @ com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:2326) @ android.view.view.dispatchpointerevent(view.java:8687) @ android.view.viewrootimpl$viewpostimeinputstage.processpointerevent(viewr

c++ - Iterating through a list of a custom class -

i'm trying iterate through list contains objects of type 'window' (a custom class wrote). loop supposed use gettitle() method of window class on each element , print out title in console. for reason when try access method through iterator tells me method not exist.. this code: void center::printwindowlist() { (std::list<window>::iterator = windowlist.begin(); != windowlist.end(); ++it) std::cout << ' ' << *it.gettitle(); } hope can help it's issue of operator precedence. try doing it->gettitle() or (*it).gettitle() .

Realm: Swift `let` property cannot be marked as dynamic -

i using xcode 7.2, swift 2.1.1. have realm model object below class b: object { dynamic let lists = list<a>() } but swift compiler gives me error saying: property cannot marked dynamic because type cannot represented in objective-c i saw realm's documentation says: realm model properties need dynamic var attribute in order these properties become accessors underlying database data. there 2 exceptions this: list , realmoptional properties cannot declared dynamic because generic properties cannot represented in objective-c runtime, used dynamic dispatch of dynamic properties, , should declared let but declaring let doesn't seem solve case now. missing? the documentation quoted includes following (emphasis mine): list , realmoptional properties cannot declared dynamic because generic properties cannot represented in objective-c runtime, […], , should declared let . this means property should declared so: let lists

android - Cannot get URL (with sql query) to be handled by DefaultHttpClient in java -

i've been struggling half day trying learn , stuck. goal query finance data yql yahoo finance tables. have set code androidhive example , able running correctly sample query. sample query grabs json object directly main url provide. yql, need convert sql query format httpclient recognize, , app keeps hanging , never returning response. first, tried taking exact query string yql replicate search, me this: https://query.yahooapis.com/v1/public/yql?q=select%20symbol%2cchange%20from%20yahoo.finance.quote%20where%20symbol%20in%20(%22sh%22%2c%22dog%22%2c%22rwm%22)&format=json&env=store%3a%2f%2fdatatables.org%2falltableswithkeys&callback= that gives me null result when set url = above, , run following: defaulthttpclient httpclient = new defaulthttpclient(); . . . httpget httpget = new httpget(url); httpresponse = httpclient.execute(httpget); if androidhive example url in code, works fine. if enter above url in browser, works fine. clearly, url not being enter

google chrome - Why is SVG scrolling performance so much worse than PNG? -

a site i'm working on displays large number (>50) of complex svg images in scrolling dialog window. when viewing site in chrome, scrolling performance of dialog window poor - noticeably laggy , slow. however, if replace svg images png images, scrolling smooth , responsive. here's demonstration of difference: https://jsfiddle.net/nathanfriend/42knwc1s/ why svg scrolling performance worse png scrolling performance? after browser renders svg image, assume doesn't need rerender image until image manipulated in way (like resizing). scrolling element contains svg images cause images rerendered every frame of scroll animation? ` i think kind of chromium bug, i've found issue on so, because started experiencing on mac. works ok on opera instance. i don't think here able explain why it's slow if bug. i've created chromium bug, please star if want is

python - Testing point with in/out of a vector shapefile -

Image
here question. 1. intro a shapefile in polygon type represent study area http://i8.tietuku.com/08fdccbb7e11c0a9.png some point located in whole rectangle map http://i8.tietuku.com/877f87022bf817b8.png i want test whether each point located within/out polygon , further operation(for example, sum grid point amount within study area) 2. idea i have 2 methods information on stack overflow. 2.1 idea rasterize shapefile raster file , test. i haven't done yet, have asked 1 question here , answer. 2.2 idea b i have tried using poly.contain() test scatter point's location, result wasn't match reality. 3. code based on idea b: for example: original data represent pt (a pandas dataframe) contain 1000 grids x,y. shapefile shown study area, want filter original data leaving point within area. 3.1 preparation # map 4 boundaries xc1,xc2,yc1,yc2 = 113.49805889531724,115.5030664238035,37.39995194

How can I get Mono 2.11+ installed on Travis-CI? -

i build c# project on travis-ci like this : # .travis.yml before_install: - sudo apt-get update -qq - sudo apt-get install -qq mono-devel gtk-sharp2 install: - xbuild source/pash.sln travis uses precise (ubuntu 12.04 lts) seems choice them, includes mono 12.10. c# project hits bug in mono 2.10. bug appears fixed in mono 2.11+. i read ubuntu slow pick new builds of mono because depends on it, , can break much. that's fine, travis dependencies aren't problem - machine goes away @ end of build! i have considered compiling new mono in .travis.yml don't want put burden on travis servers. building mcs (mono c# compiler) fix. downloading , installing newer mono somewhere (where?) checking recent mono in git repo. suggestions? if you're going use higher standard distro packages provide, recommend go way , not use unstable 2.11.x series, official/beta 3.x ones. so, grab preview debian/ubuntu 3.0.6 packages ppa: http://www.meebey.net/pos

node async - Meteor didn't stop fibers execution -

i want upload csv file , insert db after huge validation , process. using fibers asynchronous call. fiber process keep executing fiber returns future.wait(); . meteor.methods({ uploadcsv: (calender) { if (meteor.isserver) { var future = npm.require('fibers/future'); var future = new future(); calender = parse(calender); future["return"](savecalender(calender)); //huge process , validation console.log(future); // { value: 1, resolved: true } return future.wait(); } } }); savecalender function executes every time. did missed stop fiber execution or how stop fiber execution?

java - How to make sprites move from one place to another place -

i'm using libgdx create game got problem: how make sprite move 1 location marked click location marked click? need smooth animation. here's code have done: main application implements applistener , inputlistener. public class lgame implements applicationlistener { public static field field; private spritebatch bat; private listener listener; @override public void create() { field = new field(); bat = new spritebatch(); listener = new listener(); gdx.input.setinputprocessor(listener); } @override public void render() { bat.begin(); bat.draw(field.gettexture(), 0, 0); for(int = 0; <= 31; i++) if(!field.getfigure(i).iseaten()) bat.draw(field.getfigure(i).gettexture(), field.getfigure(i).getposx()*64, field.getfigure(i).getposy()*64); bat.end(); } "render" method iterate collection "field" contained objects on scene. public class listener implements inputprocessor { private int inx; private i

Does a JavaScript Anonymous function have access to other parameters passed along with it? -

let's have function takes 2 parameters, regular variable , function. function example(vara, function(){ //do vara? }) can use vara in definition of anonymous function? if run function , pass in vara, anonymous function know vale of vara is? answer no! your definition incorrect. function example(vara, function(){ //do vara? }); during function definition, not know callback , should be: function example(vara, callback){} now in following example: function test(vara){ function notify(){ console.log(vara); } notify(); } test(10) vara accessible because in same scope, if this: function test(vara, callback){ callback(); } test(10, function(){ // throw error, because there no variable called vara console.log(vara); }) and have pass arguments callback. function test(vara, callback){ callback(vara); } test(10, function(vara){ console.log(vara); })

css - CSS3/jQuery Flip Down animation -

i saw elegant , neat animation on site: http://adam.co/ notice how 'i making great ideas happen' comes view. trying figure out how that. could guide me on how produce similar effect website? it simple without libraries etc.. can pretty done css3. apply 'loaded' class or when page loads , define animation animate width (or scalex) , background positions. @-webkit-keyframes flip-in { 0%{ background-position: 5px -80px; -webkit-transform:scalex(0); } 50% { background-position: 5px -80px; -webkit-transform:scalex(1); } 100% { background-position: 5px 5px; } } .loaded #text-block { -webkit-animation-name: flip-in; -webkit-animation-duration: 0.75s; -webkit-animation-timing-function: ease-in-out; } take (i put webkit styles in example, use chrome or safari): http://jsfiddle.net/adamco/guju4/ the staggered effect simple enough too. can reuse same animation , incr

math - php multiply int values seperated by comma and dot -

in current application user can have "prepaid" amount of money on account. value stored in cents. in case of user tries transfer money 1 account should able use values like: "1,53", "1.53" , "1". need check if entered amount below amount he's able transfer. if (($request->amount * 100) <= $user->calculateamount()) the function $user->calculateamount() returns values example "351" stands 3,51€ (saved in cents). know problem ",", using "." works fine, user should able use both. there better way or did need use str_replace()? you can use this: http://codepad.org/nw4e9hqh currently there no other method parse float.

Project not synced in android studio 22.0.1 buildversion tool ubuntu -

i want sync project in build 22.0.1 when set gradle file below taking process sync continuously android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.example.sphere65.myapplication2" minsdkversion 15 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:22+' compile 'com.android.support:design:22+' }

c++ - C++Builder does not call destructor on throw-catch-continue -

for code: #include <stdio.h> int constrcalls=0, destrcalls=0; struct z { z() { constrcalls++; } ~z() { destrcalls++; } }; int main(int argc, char**) { bool startup= true; { z z; try { if( startup ) { startup= false; throw( 1 ); } else { break; } } catch(int) { continue; } } while(true); printf( "constrcalls=%d destrcalls=%d", constrcalls, destrcalls); return 0; } g++ output "constrcalls=2 destrcalls=2" , ok embarcadero c++builder 2010, c++builder 10 seattle output "constrcalls=2 destrcalls=1" , after throw-catch-continue destructor not called! can c++builder works right? thanks. sadly... the c++builder 6, rad studio 2009 , xe7 update 1, c++ compiler generates bad exception handling code (and in likelihood compilers in between--those com

c++ - "Private" variable in namespace scope in cpp file -

in source file (not header file), have habit of placing state implementation can work with: //.cpp namespace foo{ sometype bar; //... functions , objects might use bar ... } because bar declared in cpp file, not possible other code files use it, correct? note, however, have not placed static before it. in case, though, should make no difference? without static , difference variable accessed (and set) code file if in other file -- either header or cpp -- had extern declaration same variable name? (and of course, declaration within namespace of same name) since not have such extern declaration anywhere else in code base, gather makes no difference whether mark static or not -- wanted make sure thinking correct. you correct, static on variables in namespace scope controls visibility of variable other translation units (internal vs. external linkage ). apart that, behavior of variable going remain same. example, storage class remain static. differenc

python - PostgreSQL and MySQL with Django -

i able create first app django using default sqlite3. checking tutorials on how install mysql , postgresql , connect django can develop more advanced application. thing cannot understand, models.py still same in term of syntax? mean syntax in creating table in mysql different on how create table in models.py. mean, need clarification please in matter. thank you. exactly karlson says in comments, django abstracts models away database engine, changing your settings , changing database backend used handles conversion model fields database field types

javascript - Alternative writing method to create DOM elements and append -

if want append button pic document, write: $('#story_pages').append('<div><button value="'+window_value+'" onclick="reload_to_canvas(this.value)" > <img id= "w'+window_value+'", src="../pic/white_img.png", width="110px", height="110px"/> </button></div>'); it's long , hard debug. how can create img tag, wrapping button tag , div tag... please suggest clear , simple method jquery's help. update : story_pages jquery ui dialog's id. don't know if affects or not. update: found problem. want image shown above on button instead of button , image. the script give me result this: <div> <button value="1"></button> <img ......./> </div> the img tag has wrapped button tag like: <button> <img.../> </button> so image attach on button. if string passed parameter $(

java - LibGdx:Tween Callback on Tween Engine -

i following following tutorial have created button when write tweencallback should display button @ end of animation. not working , ends splash screen fading in , out. code splash screen. public class splash implements screen{ private sprite splash; private spritebatch batch; private tweenmanager tweenmanager; @override public void render(float delta) { gdx.gl.glclearcolor(0, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); tweenmanager.update(delta); batch.begin(); splash.draw(batch); batch.end(); } @override public void resize(int width, int height) { } @override public void show() { tweenmanager = new tweenmanager(); tween.registeraccessor(sprite.class, new spriteaccessor()); batch = new spritebatch(); texture splashtexture = new texture ("backgrounds/openingscreen.png"); splash = new sprite(splashtexture); splash.setsize(gdx.graphics.getwidth(), gdx.graphics.getheight()); tween.set(splash, spriteaccessor.a

c# - TextBox.Clear() or TextBox.Text = string.Empty -

is there difference between them? thank you textbox.clear(); textbox.text = string.empty; in practice: nope. internally, there is. both clear text in different ways. i wouldn't dare tell 1 better, if want follow sources, here's clear() , here's when change text

git - fatal: Could not read from remote repository. Private repo -

i have access private repository. can see in github. after use git clone , make changes on local machine. now try make git push on repo , can see: fatal: not read remote repository. i saw .git/config , urls good. how solve problem? solved firstly needed create fork of private project. next clone project local machine , add git remote add uppstream githuburl next commit, add files , push. after pull request. first: need check remote server of local repository. you can list of configured remote urls command git remote -v second: if remoter server ok, need check whether have permission push github, there 2 ways access github server, 1 using email , password, other using ssh more convenient. github ssh keey

javascript - Django and Ajax - Implementing an Array from Ajax to the template -

currently i'm trying implement ajax django in order refresh sections of web app. i'm having trouble in 2 parts. first getting value input template views.py. seems when passes , print out in cmd sure value passed correctly, none . i'm not sure why going in that. know managed pass correctly when directly views.py without going in javascript file first. secondly don't know how implement view.py returns ajax function in javascript file. mean when whole instruction set in views , return informaation needed ajax, dont know command use implement in template. currenly i'm returning array of chars changes order depending on user input. @ first loading, alphabet in order when user enters number, letters shift according input. got part going i'm stuck @ taking template after been shifted. also recommendation welcome. if see not right done or implemented in better way, please let me know. code ethics highly appreciated! my code here: forms.py class caesarc

java.lang.NoClassDefFoundError When Creating New Android Project -

i've tried installing (and re-installing) android studio several times now, , each time, studio isn't able create new android project. when attempt initial android studio window (ie. basic 'create', 'open', 'import' etc options), i'm asked of questions in wizard, brief progress dialog, followed nothing @ all. if open incomplete project process creates choosing 'open' list, can try choosing create new android project menu. this has same issue, error message in output console time... java.lang.noclassdeffounderror: com/sun/xml/internal/bind/v2/model/annotation/annotationreader (wrong name: com/sun/xml/internal/bind/v0/model/qnnotation/annotationreader) note: when installed android studio, installed incompatible jdk (1.8, not 1.7). have had go default project settings change jdk uses 1.8. does know how can avoid this? there place should downloading jxb classes? missing in java paths? this appears have been caused cor

c# - Invalid column name TableName_ID error -

i have 2 tables propertylisting - stores details of property user add, fk propertyavailability - it's table stores property status ( available, after 3 months, ...) i trying enforce one-to-many relation these 2 tables (fluent api) this public partial class propertylisting { [key, databasegenerated(databasegeneratedoption.identity)] public int id { get; set; } public string streetaddress { get; set; } //the column links propertyavaibility table pk public byte? availability { get; set; } public bool status { get; set; } public virtual propertyavailability propertyavailability { get; set; } } public partial class propertyavailability { public byte id { get; set; } public string status { get; set; } public virtual icollection<propertylisting> propertylistings { get; set; } public propertyavailability() { propertylistings = new list<propertylisting>(); } } i calling on onmodelcreating modelbuild

azure - Web Publishing Extension not installed in Visual Studio 2015 -

i'm using visual studio 2015 trying publish app, when try error: the web publishing extension not installed required publish. can install http://go.microsoft.com/fwlink/?linkid=208120 i tried repairing visual studio , reinstalling azure sdk vs 2015 problem persists. wanted try solution posted here don't have folder named publish  in c:\program files (x86)\microsoft visual studio 14.0\common7\ide\extensions\microsoft\web tools\ any idea can problem? found lot of post in problem can't find solution when there isn't folder named publish . i'm on windows 10. solved reinstalling microsoft asp.net , web tools using visual studio extensions , updates menu (tools -> extensions , updates...)

android - Network image view's center_crop not working -

i creating networkimageview programmatically this: final networkimageview niv = new networkimageview(context); niv.setlayoutparams(new viewgroup.layoutparams(viewgroup.layoutparams.match_parent, viewgroup.layoutparams.match_parent)); niv.setscaletype(imageview.scaletype.center_crop); niv.setimageurl("www.example.com/images/example.jpg", imageloader); but scaletype.center_crop feature not working. have idea? thank you. you using scaletype imageview, should using networkimageview niv.setscaletype(networkimageview.scaletype.center_crop); i set image url before scale image.

ios - Referencing the class in it self in Class method -

i access class methods inside class self. know use self keyword in class instance so: class instanceclass { var testproperty = "testing" func testmathod() { print(self.testproperty) } } // initiate let newinstance = instanceclass() newinstance.testmathod() // result testing what's keyword accessing class in static property in below example: class baseclass { static let testproperty = "test" class func printproperty () { // here want access testproperty } } i aware baseclass.testproperty in above example want keep abstract. i have swift 2.11 running. my bad.. self keyword works class methods also. example: class baseclass { class var testproperty: string { return "original word" } static func printtestpropery() { print(self.testproperty) } } class childclass: baseclass { override class var testproperty: string { return "modified word" } } c

c++ - Performance - iterating over vector with iterator or pointer? -

i'm writing application needs perform can be. i'm using vs2012 ide (and compiler). i've noticed, i'm iterating on vectors, pointer solution in contrast iterator, quicker in terms of speed. why that? mean, iterator basicly same thing. should @ least. take @ example: std::vector<int> v; (std::vector<int>::iterator = v.begin(); != v.end(); it++) { // stuff *it } (int* = &v[0], <= &v[v.size()-1]; i++) { // stuff *i } is there optimization needed compiler? i'm using standard settings, -o2 enabled. in advance. edit: i'm compiling in release, , running ctrl+f5 (without debugging is). edit2: actual source-code implementation of quicksort. here link full source , short check out. i'm writing application needs perform can be. then grab profiler , real bottlenecks are. in optimized code (release mode), of course. -o2 not in vs2012: there several #defines manipulate behavior of standard container iterat

java generic method fundamentals -

i running tests better understand java generic methods, , came across following problem. have following simple class: 1 public class someclass<o extends object> { 2 3 o somevar; 4 5 public someclass() { 6 somefunc(new number(1)); 7 } 8 9 public void somefunc(o arg) { 10 // code 11 } 12 } as stands, compiler not line 6. eclipse suggests either cast number instance o, or change argument type number on line 9. i avoid both if possible. know modifying class takes care of problem: 1 public class someclass { 2 3 o somevar; 4 5 public someclass() { 6 somefunc(new number(1)); 7 } 8 9 public <o extends object> void somefunc(o arg) { 10 // code 11 } 12 } but brings new problem line 3. so can done original code? thank time!!! the problem in first example creating class someclass o can extends object (or object).

python - Finding words in phrases using regular expression -

i wanna use regular expression find phrases contains 1 - 1 of n words (any) 2 - n words (all ) >>> import re >>> reg = re.compile(r'.country.|.place') >>> phrases = ["this place", "france european country, , wonderful place visit", "paris place, s capital of country.side"] >>> phrase in phrases: ... found = re.findall(reg,phrase) ... print found ... result: [' place'] [' country,', ' place'] [' place', ' country.'] it seems messing around, need specify need find word, not part of word in both cases. can pointing issue ? because trying match entire words, use \b match word boundaries: reg = re.compile(r'\bcountry\b|\bplace\b')

No QGIS data provider plugins found -

i installed qgis via osgeo4 installation. verified vector , raster data providers working (i have own application use qgis lib display maps). however, when tried launch qgis itself, works except complains no qgis data provider plugins found in c:\osgeo4w64\plugins. don't know gets path necessary libs seem in apps\qgis\plugins folder. i've tried set qgis_pluginpath etc no avail. so, question how "redirect" qgis @ right place gis plugins. i tried run qgis-bin.exe, instead should run qgis.bat launching qgis

c# - Using a custom Stream in Windows Store app -

i have .net code dealing custom stream need port winrt. motivation is, app reads file encrypted (the custom stream ). in full .net use var readfilestream = file.openread(bookpath); var readdecryptedstream = new mystream(password, readfilestream); //it zip file var readzipfile = new zipfile(readdecryptedstream); //extract files zip file mystream inherits stream , encoding , decoding in read / write methods, full code here http://dl.dropbox.com/u/73642/mystream.cs . code works fine in .net. my winrt implementation is var file =await applicationdata.current.localfolder.getfileasync(bookpath); //i copied same file local folder var filestream = await file.openstreamforreadasync(); var readdecryptedstream = new mystream(password, readfilestream); ziparchive z = new ziparchive(readdecryptedstream , ziparchivemode.read); the problem code new ziparchive(readdecryptedstream , ziparchivemode.read); never finishes reading stream. when set breakpoint in mystream read method,

objective c - why does this code keep coming up with errors. xCode 4.6 -

nsimagecell *imagefrombundle; nsdata *imagedata; nsurl *imageurl = [nsurl urlwithstring:@"http://www.greatwhatsit.com/wp-content/uploads/2012/03/jeremiah1.jpg"]; nslog(@"url"); nslog(@"data"); nsimage *imagefrombundle = [[nsimage alloc] initwithdata:imagedata]; why doesn't code work. xcode 4.6 you have have same type definition , init of imagefrombundle nsimagecell *imagefrombundle; nsimage *imagefrombundle = [[nsimage alloc] initwithdata:imagedata]; change to: nsimage *imagefrombundle; nsimage *imagefrombundle = [[nsimage alloc] initwithdata:imagedata]; also, zakhej sais, need init imagedata

swing - Labeling buttons and maintaining dimensions -

i struggling jbutton s, keeping them same size, seems adding button causes stretch accommodate said addition. as result, button labeled 'yes' won't same size button labelled 'no', if while blank both buttons should have been more large enough comfortably contain either string. essentially, know whether there way label buttons without altering dimensions of said buttons. i employing gridbaglayout , here relevant sample of code reference: edit i managed effect looking using icons... won't able see in it's entirety, calling icons directly hard drive... regardless, i'll leave completed code reference... game.java: package com.sitrom.words.window; import java.awt.canvas; import java.awt.graphics; import java.awt.event.keyevent; import java.awt.event.keylistener; import java.awt.event.mouselistener; import java.awt.event.mousemotionlistener; import java.io.ioexception; public class game extends canvas implements runnable{ private stati