Posts

Showing posts from March, 2010

xml - No declaration found for element -

i have simple xml , xsd files. using xerces generate .h/cpp files when run application gives error: no declaration found element 'x:books' my xml file is: <?xml version="1.0"?> <x:books xmlns:x="urn:books" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="urn:bookstore books.xsd"> <book id="bk001"> <author>writer</author> <title>the first book</title> <genre>fiction</genre> <price>44.95</price> <pub_date>2000-10-01</pub_date> <review>an amazing story of nothing.</review> </book> <book id="bk002"> <author>poet</author> <title>the poet's first poem</title> <genre>poem</genre> <price>24.95</price> <pub_date>2001-10-01</pub_date> ...

cakephp 3.0 - DebugKit not working -

on cakephp 3.1.7 debugkit 3.0.0-beta2 installed. debug set true, pdo_sqlite installed if load page on browser /tmp/debug_kit.sqlite created no error message @ /logs, no error message in apache log, no errors on firebug. but still can not see debugkit panel. missing?

javascript - How to handle onblur event with selenium webdriver -

i have onblur event need trigger when click away. using js as ((javascriptexecutor)getdriverprovider().executescript("document.getelementbyxpath('xpath here').onblur();"); but doesn't work. can suggest how handle case? my proposal use js script (the js function fireevent): function fireevent(el, type){ if ((el[type] || false) && typeof el[type] == 'function') { el[type](el); } } $(function () { $('#mybtn').mouseover(function(e) { fireevent(document.getelementbyid('myinput'), 'blur'); }); $('#myinput').blur(function(e) { alert('ok'); }) }); <script src="http://code.jquery.com/jquery-1.11.3.js"></script> <input id="myinput"> <button id="mybtn">click me</button>

javascript - How can I access the 'until' object directly in Protractor? -

i writing middleware framework testing angularjs web app , want able wait conditions met before move on action in tests. new protractor , have found in doc , other forums, there few different ways using browser.driver.wait or similar techniques use condition or promise including answer . what trying achieve follow page object model design in framework , allow each page provide own function determines whether page visible in browser or not. in order that, ended writing page objects below: var pages = { home: { name: 'home', url: server + '/#/home', title: 'home', isvisible: until.titleis(this.title) }, ... } there 2 issues trying wrap head around , fix: first , foremost, error saying until undefined. have not been able find right way use object yet , searches lead alternative ways waiting element visible or expected condition true. how can access object directly? and, considered bad/obsolete design? assuming find way use un...

ruby on rails - How to require authentication for all pages with Devise? -

i have started use devise gem , trying implement code, web app require login each , every page on app. have added following code routes.rb according this instruction : authenticated :user root to: 'home#index', as: :authenticated_root end root to: redirect('/users/sign_in') but doesn't work. when go page - open page, , doesn't forward me sign_in page. please clarify missed? appreciated. add app controller class applicationcontroller < actioncontroller::base ... before_action :authenticate_user! end

javascript - Resolve promise when multiple writeFile functions finished after for-loop in node.js -

first of all, here part of current code: return new promise(function(resolve, reject) { (var = 1; <= variables; i++) { fs.writefile("file-" + + ".txt", datastring + ' ' + + ' 0', "utf-8"); } if (i == variables) resolve('files have been written'); else reject('some error occured'); }) my problem don't know how tell promise resolve after files have been written writefile() async. want use these files in next then() when written drive. can me out here? i'm kind of lost right , new node.js please bear me :) thanks in advance! #update 1: var promises = []; (var = 1; <= variables; i++) { promises.push(promise.resolve( new promise(function(resolve, reject) { fs.writefile('file-' + + '.cnf', dimacs2 + ' ' + + ' 0', 'utf-8', function(err) { ...

c# - RestSharp RestRequest.AddBody not using Newton.Json attributes -

var obj = new myobject(); i having issue getting restsharp restrequest.addbody(obj) ; serialize object correctly. class myobject { [jsonproperty(propertyname="a")] public a{get;set;} [jsonproperty(propertyname="b")] public b{get;set;} } problem addbody serializer not taking account jsonproperty attributes , can seem figure out how set serializer on restrequest or restclient? i have used answer of tafaju , implemented serializer json this. public class customjsonserializer : iserializer { public customjsonserializer() { contenttype = "application/json"; } public string serialize(object obj) { return jsonconvert.serializeobject(obj); } public string rootelement { get; set; } public string namespace { get; set; } public string dateformat { get; set; } public string contenttype { get; set; } } and works me, reads attributes , serializes types correctly. didn't...

math - Modelling a Pendulum in C -

this code attempting while loop model pendulum swing, values produced don't seem me: #include <stdio.h> #include <math.h> #define pi 3.14159265 main() { float theta = 0; // initial value angle float omega = 0.2; // initial value angular speed float time = 0; // initial time float dt = 0.01; // time step while (theta < 2 * pi && -2*pi) { time = time + dt; theta = theta + omega*dt; printf("theta=%i, omega=%i, time=%i, , dt=%i\n", theta, omega, time, dt); } system("pause"); } how can modify more helpful? while condition have use should stop when pendulum has made 1 revelation either forwards or backwards (-2pi or 2pi). need use formula 'omega=omega-(g/l) dt sin(theta)' , not make assumption theta approximately equals sin(theta). while(theta <2*pi&&-2*pi) in c if want combine multiple expressions can combine them using logical operators ...

regex - Is there an equivalent to emacs' rx macro in python? -

the rx macro in emacs (see http://www.emacswiki.org/emacs/rx , http://doc.endlessparentheses.com/fun/rx ) makes possible specify regular expressions in modular , readable way (at least don't have take care quoting issues). example: (rx "a" (optional "c") "b") results in "ac?b" is there comparable in python? imo, using lisp syntax define regex not classic usage. how can 1 maintain that? regex language standard; readable everyone; rx not. know omnimark ? has pretty verbose syntax. forgotten now… to can define simple function, eg.: def optional(regex): return regex + "?" def regex(*args): return "".join(args) regex = regex("a", optional("b"), "c") print(regex) you'll get: ab?c

Can I shutdown chromedriver.exe before execution of tests using selenium (C#)? -

Image
i know close selenium chromedriver need use driver.quit() issue when i'm creating tests through debug mode, stop tests quite bit halfway through execution using breakpoints. fix whatever need , stop debugging can rerun test leaves chromedriver.exe running. is there way automate shutting driver down before running tests? have tried put before piece of code starts browser error: error 11 not copy "c:\localwork\ecommerce\qaautomation\uiautomation\branches\mealcustomization\packages\selenium.webdriver.chromedriver.2.19.0.0\driver\chromedriver.exe" "bin\debug\chromedriver.exe". exceeded retry count of 10. failed. onlineorder.uitests has figured out how automate shutting down prior running tests? if using visual studio, can add command kill process in pre-build event. taskkill /f /fi "pid gt 0" /im chromedriver.exe

python 3.x - Seaborn Heatmap Colorbar Label as Percentage -

Image
given heat map: import numpy np; np.random.seed(0) import seaborn sns; sns.set() uniform_data = np.random.rand(10, 12) ax = sns.heatmap(uniform_data) how go making color bar values display in percent format? also, if wanted show first , last values on color bar? thanks in advance! iterating on solution of @mwaskom, without creating colorbar yourself: import numpy np import seaborn sns data = np.random.rand(8, 12) ax = sns.heatmap(data, vmin=0, vmax=1) cbar = ax.collections[0].colorbar cbar.set_ticks([0, .2, .75, 1]) cbar.set_ticklabels(['low', '20%', '75%', '100%'])

c# - MVC Validation on Production Site Fails -

on localhost validation user's billing address works, before submitted. once pushed project production. validation not initiate , receive following error "sequence contains no elements . points controller "model.address = db.addresses.where(a => a.addressid == model.addressid).single();". screenshot of code causing error view @using (html.beginform()) { @html.validationsummary(true) @html.hiddenfor(m => m.userid) @html.hiddenfor(m => m.acceptsms) @html.hiddenfor(m => m.isactive) @html.hiddenfor(m => m.lastlogindate) @html.hiddenfor(m => m.addressid) <div class="editor-label"> name </div> <div class="editor-field"> @html.editorfor(m => m.firstname) @html.validationmessagefor(m => m.firstname) </div> <div class="editor-field"> @html.editorfor(m => m.lastname) @html.validationmessagefor(m => m.lastname) </div> <div class="editor-labe...

angular - *ngIf and *ngFor on same element causing error -

i'm having problem trying use angular's *ngfor , *ngif on same element. when trying loop through collection in *ngfor , collection seen null , consequently fails when trying access properties in template. @component({ selector: 'shell', template: ` <h3>shell</h3><button (click)="toggle()">toggle!</button> <div *ngif="show" *ngfor="let thing of stuff"> {{log(thing)}} <span>{{thing.name}}</span> </div> ` }) export class shellcomponent implements oninit { public stuff:any[] = []; public show:boolean = false; constructor() {} ngoninit() { this.stuff = [ { name: 'abc', id: 1 }, { name: 'huo', id: 2 }, { name: 'bar', id: 3 }, { name: 'foo', id: 4 }, { name: 'thing', id: 5 }, { name: 'other', id: 6 }, ] } toggle() { this.show = !this.show; } l...

javascript - Angular VS 2015 MVC Custom Directive unexpected identifier and expected ; errors -

this question has answer here: what rules javascript's automatic semicolon insertion (asi)? 4 answers i missing boat on error. simplistic of implementation of custom directive throws precompiler errors , on execution throws same errors. since version issue here think relevant if not tell me , i'll add info. angular 1.4.8 angular.min.js angular-route.min.js vs 2015 & .net 4.5 app-mainnav.js 1. (function () 2. { 3. "use-strict"; 4. 5. angular.module("app-mainnav", []) 6. .directive("dashboard-main-nav", function () 7. { 8. return 9. { 10. restrict:"e", 11. templateurl:"/navigation/getdashitems", 12. link:function(){} 13. } 14. }); 15. })(); at colon of line 11 & 12 expected ; errors. @ line 12 expected id...

php - How can I change the login time cookie in a password protected page in wordpress? -

i know set 10 days , 15 minutes. i've seen lot of answers on internet wp-pass file appears file doesn't exist anymore in wordpress 3.5 would know how change ? thanks, if using latest wordpress can use auth_cookie_expiration filter. it: add_filter('auth_cookie_expiration', function($expiration){ return 900; /*15 minutes*/ }); you'd have add plugin.

java - Spring transactions in unit tests and annotation based configuration -

i have trouble getting transactions working in unit test. transactiontest class contains necessary spring configuration. starts up, initializes database , executes 2 runnables in parallel (inserter , selector). logged output visible test executes, records inserted , selected database in correct order, there no transaction isolation. what expect see in log like: 2016-01-16 00:29:32,447 [main] debug transactiontest - starting test 2016-01-16 00:29:32,619 [pool-2-thread-2] debug selector - select 1 returned: 0 2016-01-16 00:29:33,121 [pool-2-thread-1] debug inserter - inserting record: 1 2016-01-16 00:29:33,621 [pool-2-thread-2] debug selector - select 2 returned: 0 2016-01-16 00:29:34,151 [pool-2-thread-1] debug inserter - inserting record: 2 2016-01-16 00:29:34,624 [pool-2-thread-2] debug selector - select 3 returned: 2 2016-01-16 00:29:34,624 [main] debug transactiontest - terminated however, see is: 2016-01-16 00:29:32,447 [main] debug transactiontest - starting te...

html - Href link to div on same page only works once -

my problem have href link which, upon clicking, should bring user down div id corresponds href value. although link works fine on first time gets clicked, doesn't work after that. link seems go dead. if scroll page , click link again, nothing. i've tried search on answer can't find anything. appreciated.

Google Compute instance won't mount persistent disk, maintains ~100% CPU -

during routine use of web server (saving posts via wordpress), instance jumped 400% cpu usage , wouldn't come down below 100%. restarting , stopping/starting instance didn't change anything. looking @ last bit of serial output: [ 0.678602] md: waiting devices available before autodetect [ 0.679518] md: if don't use raid, use raid=noautodetect [ 0.680548] md: autodetecting raid arrays. [ 0.681284] md: scanned 0 , added 0 devices. [ 0.682173] md: autorun ... [ 0.682765] md: ... autorun done. [ 0.683716] vfs: cannot open root device "sda1" or unknown-block(0,0): error -6 [ 0.685298] please append correct "root=" boot option; here available partitions: [ 0.686676] kernel panic - not syncing: vfs: unable mount root fs on unknown-block(0,0) [ 0.688489] cpu: 0 pid: 1 comm: swapper/0 not tainted 3.19.0-30-generic #34~14.04.1-ubuntu [ 0.689287] hardware name: google google, bios google 01/01/2011 [ 0.689287] ffffea0000...

vb.net - Check if file exist before counting the length of the string in text file -

i having hard time figuring why code of mine gives me unhandled exception error in fact if statement.. if (not system.io.file.exists("c:\file.txt") , system.io.file.readalltext("c:\file.txt").length <> "20") messagebox.show("code executed!") else messagebox.show("failed execute!") end if can please tell me have missed? it better break down code shown below makes detecting , debugging whole lot easier. better write few lines happen here not happen @ all. dim filename string = "c:\file.txt" dim filetext string = "" if io.file.exists(filename) filetext = io.file.readalltext(filename) if filetext.length <> 20 messagebox.show("code executed!") else ' recover end if else messagebox.show("failed execute!") end if

javascript - Angular: Run some JQuery against a selection of views -

i wrote code this, way did felt so inelegant had ask if had basic advice me. want run jquery modify attributes of buttons in sub-set of views (they're in same directory). wrote jquery i cannot figure out put code . right i'm shoving .js file in views' directory , using include statement toward end of each view file. not mvc...... situation several buttons appear in interface no visible label. info them in popover attribute. fine (or maybe it's bad ui or whatever) long you're not blind , using screen-reader, won't pick popover text. want copy contents of popover text aria-label adding labels "manually" right button in question created within angular framework. jade button looks this: button.customize-option(class='pet_egg_{{::egg}}', ng-class='{selectableinventory: selectedpotion && !(user.items.pets[egg+"-"+selectedpotion.key]>0) && (content.dropeggs[egg] || !selectedpotion.premium)}', ...

Removing an Object from an Array of Objects in Java -

i working on school project learning use arrays of objects. have come across 2 separate issues along way address. using netbeans ide code mention below. firstly, after have added values array, attempt use list button should display values in jtextarea. there no noticeable errors pop-up although, values "null" instead of user inputted values should say. since there 5 values program displays "null null null null null". not sure why , input appreciated. secondly, attempting allow user remove information based on 1 of 5 values have been stored. in case of program user must enter "employee id" remove of said employee's data program list. having trouble doing able see in code below. so sum things up: how can correct random "null" error imputed data displayed? how can remove values of given index based on user input idnumber? things keep in mind: - need use array of objects - new coding please excuse possible ignorance - appears missing ...

python - Import statement flow -

my app layout my_app __init__.py my_app __init__.py startup __init__.py create_app.py create_users.py common_settings.py core __init__.py models.py views.py errors __init__.py errors.py inner __init__.py from flask import flask flask_script import manager flask_sqlalchemy import sqlalchemy app = flask(__name__) # wsgi compliant web application object db = sqlalchemy(app) # setup flask-sqlalchemy manager = manager(app) # setup flask-script my_app.startup.create_app import create_app create_app() create_app.py def create_app(extra_config_settings={}): # load blueprints manager commands, models , views my_app import core return app core/__init__.py # . import views views.py from my_app import app, db flask imp...

android - Back Key code not working -

hey have following code within application, when use button close music activity or main menu not seem work music still plays when button has been pressed exit app. work film activity/film clips explain may problem? i not errors: @override public boolean onkeydown(int keycode, keyevent event) { if ((keycode == keyevent.keycode_back)) { this.finish(); } return super.onkeydown(keycode, event); } you can use in activity @override public void onbackpressed() { this.finish(); }

xcode - Updating objects on parse - [Error] object not found -

i trying update object on parse, error message: [error]: object not found update (code: 101) let query = pfquery(classname: "answers") query.findobjectsinbackgroundwithblock { (objects, error) -> void in if let objects = objects { object in objects { object["upvoters"] = ["one","two"] object.saveinbackground() } } } what causing this, , how fix it? the cause of issue acl settings of object trying edit. trying edit object wasn't created me, , acl did not have public write access true. see parse acl

MVC in php, model for categories? -

i building first little app php , trying mvc. my website requires quite large arrays of cities , categories. my question simple 1 arrays data website php arrays, should arrays placed own models? from understood models used business logic , accessing data, cities , categories data justify them having model? and if answer no why , should do? thanks model responsible retrieving, editing, deleting , manage data. data comes static sources such databases, xml files , such. you should create model classes interface data. that's model supposed do. can hold data in private members way want, arrays, other classes etc. you wondering why idea? well, data should stored in classes because can set visibility class members. data items private can decide actions allowed, leading general better design , security. also models don't contain logic in them. it's controller deals logic. it's in mv (model / view) architecture models implements logic. you can take...

Parsing XML data in C# and show into ListBox -

i trying parse xml file in c# using visual studio , show data in listbox, don't know how parse when i'm dealing nested xml file. this code xml file: <?xml version="1.0" encoding="utf-8" ?> <!doctype root [ <!element root (persons*)> <!element persons (name)> <!element ismale (#pcdata)> <!element age (#pcdata)> <!element name (#pcdata)> <!element likedperson (name)> ]> <root> <persons name ="bob"> <ismale>true</ismale> <age>30</age> <likedperson name ="iulia"> <ismale>false</ismale> <age>32</age> </likedperson> </persons> </root> the code i've written in c# return me name, gender , age every person, don't know how write show me person_liked: private void loadpersons() { xmldocument doc = new xmldocument(); doc.load("baza_...

Is it possible to add a javascript variable into a JQuery .css()? -

i have javascript function loop in it function blackout() { 'use strict'; (i = 100; > 0; = - 1) { $("body").css(); } } i want add css code using jquery function .css() -webkit-filter: brightness(i); filter: brightness(i); such screen blackout. what write inside .css() allow me have variable 'i' inside well? this should make trick: function blackout() { 'use strict'; $body = $("body"); (i = 100; > 0; = - 1) { $body.css('-webkit-filter', 'brightness('+ +')'); $body.css('filter', 'brightness('+ +')'); } }

python - flask unable to run db migrate - NameError: name 'conn_uniques' is not defined -

every time update models have delete , reinitialize database. ./manage.py db init , initial ./manage.py db migrate work every subsequent ./manage.py db migrate fails following error: info [alembic.migration] context impl sqliteimpl. info [alembic.migration] assume non-transactional ddl. traceback (most recent call last): file "manage.py", line 110, in <module> manager.run() file "/home/sergi/.virtualenvs/flaskvenv/lib/python3.4/site-packages /flask_script/__init__.py", line 405, in run result = self.handle(sys.argv[0], sys.argv[1:]) file "/home/sergi/.virtualenvs/flaskvenv/lib/python3.4/site-packages /flask_script/__init__.py", line 384, in handle return handle(app, *positional_args, **kwargs) file "/home/sergi/.virtualenvs/flaskvenv/lib/python3.4/site-packages /flask_script/commands.py", line 145, in handle return self.run(*args, **kwargs) file "/home/sergi/.virtualenvs/flaskvenv/lib/python3.4/site-packages ...

java - Hibernate/JPA - NullPointerException when accessing SingularAttribute parameter -

i'm trying use jpa2 type-safe criteria queries hibernate 5.0.7.final. ... criteria.where( builder.equal( root.get(singularattribute.attr), value )); //where parameters //criteria.where( builder.equal( root.get(person_.name), "can" )); ... the root.get throw nullpointerexception . metamodel class person_ person generated org.hibernate.jpamodelgen.jpametamodelentityprocessor . a similar problem asked in jpa/hibernate static metamodel attributes not populated -- nullpointerexception time both classes in same package. stack trace: java.lang.nullpointerexception @ org.hibernate.jpa.criteria.path.abstractpathimpl.get(abstractpathimpl.java:123) my code: interface use make sure have getid(); . package it.unibz.db.hibernate.model; public interface modelinterface<pk extends serializable> extends serializable { pk getid(); } model class package it.unibz.db.hibernate.model; @entity @table(name ="person") public class person implements ...

scheme - fetch n-elements from a list Racket -

how can fetch n-elements list, know first, rest etc, if want first 3 elements in list, i.e (get-first 3 (list 1 2 3 4 5 6)) -> (list 1 2 3) (get-first 5 (list 54 33 2 12 11 2 1 22 3 44)) -> (list 54 33 2 12 11) this not homework, code me complete bigger picture of assignment, stuck , need few hints. not allowed use lambda or build-list , no recursion, somehow need b able map, filter, foldr etc... as mentioned @alexisking, can use take procedure that's built-in in racket: (take '(1 2 3 4 5 6) 3) => '(1 2 3) (take '(54 33 2 12 11 2 1 22 3 44) 5) => '(54 33 2 12 11) if reason that's not allowed can still roll own version using higher-order procedures , no explicit recursion, do notice not using lambda impossible, allowed procedures mention ( map , filter , foldr ) all receive a lambda as parameter , , anyway all procedures in scheme lambda s under hood. here's contrived solution, passing accumulator remembers in inde...

r - Convert a string with concatenated indices and values to a vector of values -

i have data frame this: v2 v3 1.000 2:3,3:2,5:2, 2.012 1:5,2:4,6:3, the second column v3, consists of 'index-value' pairs, each pair separated , . within each 'index-value' pair, number preceeding : vector index. number after : corresponding value. e.g. in first row, vector indices 2, 3, , 5, , corresponding values 3, 2, , 2. indices not represented in string should have value 0 in resulting vector. i wish convert 'index-value' vector vector of values. thus, 2 strings above expected result is: v2 v3 1.000 c(0,3,2,0,2,0) 2.012 c(5,4,0,0,0,3) we make use of data.table package use tstrsplit function. removes intermediate step. try this: require(data.table) df$v3<-lapply( lapply(strsplit(as.character(df$v3),",",fixed=true),tstrsplit,":"), function(x) {res<-numeric(6);res[as.numeric(x[[1]])]<-as.numeric(x[[2]]);res}) # v2 v3 #1 1.000 0,3,2,0,2,0 #2 2.012 ...

Difference between dot operator and fully qualified named call in Clojure -

i'm learning clojure. still have no understanding language , philosophy. but want more familiar language. hence have started read clojure core api documentation , found interesting stuffs in clojure.core/get source code. (defn "returns value mapped key, not-found or nil if key not present." {:inline (fn [m k & nf] `(. clojure.lang.rt (get ~m ~k ~@nf))) :inline-arities #{2 3} :added "1.0"} ([map key] (. clojure.lang.rt (get map key))) ([map key not-found] (. clojure.lang.rt (get map key not-found)))) to value given key code uses clojurelang.rt/get function. code calls dot operator - (. clojure.lang.rt (get map key)) . my question why author wrote (. clojure.lang.rt (get map key)) instead of (clojure.lang.rt/get map key) . is there technical difference? or benefit? the dot in clojure used host interop (with java class clojure.lang.rt in case). idiomatic form static method (classname/staticmethod args*) gets exp...

ios - adjustsFontSizeToFitWidth not working when change constraints? -

i have costview holds uilabel dollarsign , uilabel cost . this how dollarsign being constrained. this how cost being constrained. in addviewcontroller changed of constraints, including height of costview class addviewcontroller: uiviewcontroller { @iboutlet weak var costview: uiview! @iboutlet weak var statusbarheight: nslayoutconstraint! @iboutlet weak var navigationbar: uinavigationbar! @iboutlet weak var dollarsign: uilabel! @iboutlet weak var cost: uilabel! @iboutlet weak var keyboardheight: nslayoutconstraint! @iboutlet weak var costviewheight: nslayoutconstraint! override func viewdidload() { super.viewdidload() //set size of cost view & numbers keyboard let halfviewheight = (view.bounds.height - statusbarheight.constant - navigationbar.bounds.height)/2 costviewheight.constant = halfviewheight/cgfloat(4) keyboardheight.constant = halfviewheight - costviewheight.constant //adjust font size of dollar sign & cost cost.adjustsfon...

hadoop - Spark Execution of TB file in memory -

let assume have 1 tb data file. each node memory in ten node cluster 3gb. i want process file using spark. how 1 terabyte fits in memory? will throw out of memory exception? how work? as thilo mentioned, spark not need load in memory able process it. because spark partition data smaller blocks , operate on these separately. number of partitions, , size depends on several things: where file stored. commonly used options spark store file in bunch of blocks rather single big piece of data. if it's stored in hdfs instance, default these blocks 64mb , blocks distributed (and replicated) across nodes. files stored in s3 blocks of 32mb. defined hadoop filesystem used read files , applies files other filesystems spark uses hadoop reed them. any repartitioning do. can call repartition(n) or coalesce(n) on rdd or dataframe change number of partitions , size. coalesce preferred reducing number without shuffling data across nodes, whereas repartition allows specify ...

When using ASP.NET MVC and LINQ, should you be creating stored procedures in your SQL database? -

this don't understand. conventional wisdom stored procedures create them if know know query executed part of application , can describe in terms of paramaters (which 99.9999% of time .. other 0.0001% being if create application in queries unpredictible because user writing queries or something). if -- set triggers, cascade deletes, sprocs -- when create database, point of having model? purpose model serves in case tell database "go!" , database performs logic. makes m in mvc irrelevant. sorry if seems opinion-based quesiton, feel i'm not getting gist of asp.net mvc if on 1 hand i'm being told "make database handle logic possible" , other hand have these tools linq, entity, etc., creating c# way of querying database. are asp.net mvc , stored procedures antonyms? firstly, asp.net mvc , stored procedures not antonymous. not related. not mean cannot both in same application. i'd think of mvc design pattern presentation/ui. m in mvc ent...

swift - got error on xcode7... I can't use 'new()' on xcode7? -

the error said 'new()' unavailable swift::use object initializers instead. don't know how fix... func showimage(notif:nsnotification) { if let userinfo = notif.userinfo nsdictionary! { //the code below 1 got error let photos:nsmutablearray = nsmutablearray.new() let photo:idmphoto = idmphoto(image: userinfo["img"] as! uiimage!) photos.addobject(photo) let browser:idmphotobrowser = idmphotobrowser(photos: photos [anyobject]!) browser.delegate = self browser.displayactionbutton = false self.presentviewcontroller(browser, animated: true, completion: nil) } } simply change nsmutablearray.new() nsmutablearray() .

php - Wordpress custom permalinks using .htaccess -

Image
currently added custom structure posts premalinks /post/%post_id% through permalinks settings in admin. since need rewrite permalinks categories, tags , author pages follow: categories current /post/category/category_name /category_name tags current /post/tag/tag_name tag/tag_name author current /post/author/author_username /author/author_username i tried create custom rewriterule in .htaccess, didn`t work @ all: rewriterule ^/([^/]*)$ ./post/category/$1 [l] rewriterule ^/tag/([^/]*)$ ./post/tag/$1 [l] rewriterule ^/author/([^/]*)$ ./post/auhtor/$1 [l] any .htaccess rules coding achieve such permalinks appreciated. make sure have rewrite engine on in apache configuration login wordpress administrative rights , go settings -> permalinks shown attached 3 images. if permalink not updated, don't have write access root of website or rewrite module of apache not enabled. if permalink message appears, means created .htaccess in root of wordpress...

swing - Java JTable combobox validation -

Image
there 3 things trying here: first trying make combo box show "not feed" when u lanuch program, @ moment when launches shows nothing, when click on combo box shows option "feed" , "not feed". secondly trying validation combobox, when click jbutton next, validate if combobox "feed" if go next, else have pop saying "check again" lastly, make cells on first 4 col uneditable , last column editable. public class dosagetablehelper { private static jtable todotable; private static jscrollpane jpane; private static int counter=1; public static defaulttablemodel getelderlyfromquerydos(string timing,string position) throws sqlexception { sqlobject = new sqlobject(); resultset rs = null; if(timing.equalsignorecase("morning")){ preparedstatement stmt = so.getpreparedstatementwithkey("select morningdosage et_elderly name = ?"); stmt.setstring(1,position); stmt.executequery(); ...