Posts

Showing posts from June, 2011

java - Selenium Webdriver. Error 'org.openqa.selenium.StaleElementReferenceException: Element is no longer valid' -

selenium webdriver + java. code: public list<userdata> getusers() { list<userdata> users = new arraylist<userdata>(); webelement userlist = driver.findelement(by.id("users")); iselementdisplayed(by.xpath("//table[@id='users']/*/tr[position() > 1]"), 10); list<webelement> tablerows = driver.findelements(by.xpath("//table[@id='users']/*/tr[position() > 1]")); (webelement tablerow : tablerows) { list<webelement> cells = tablerow.findelements(by.tagname("td")); userdata user = new userdata(); user.fio = cells.get(2).gettext(); user.login = cells.get(3).gettext(); user.rank = cells.get(4).gettext(); user.cabinet = cells.get(5).gettext(); users.add(user); } return users; } after delete user table, method throws: org.openqa.selenium....

java - How to disable message "Parameter x is not assigned and could be declared final" in Eclipse? -

i cannot find place in eclipse preferences can disable message: parameter pjp not assigned , declared final where place? your warning message never produced eclipse's built-in checks. produced eclipse plug-in called pmd, supports wider range of code checks. the specific pmd rule name methodargumentcouldbefinal .

Compute mean from the object returned by "getSymbols()" in R package "quantmod" -

i compute moments object returned "getsymbols()" in r package " quantmod ". object isn't vector or matrix, there error. how can that? following code: > library(quantmod) > getsymbols("axp", = "2007-01-01", = "2013-12-31") > returns = diff(axp[,6]) / lag(axp[,6]) * 100 # calculate simple return adjusted prices > mean(returns) [1] na > var(returns) axp.adjusted axp.adjusted na how can calculate sample mean , variance? thanks!

Lucene Index: Missing documents -

we have pretty basic lucene set up. noticed documents aren't written index. this how create document: private void addtodirectory(specialdomainobject specialdomainobject) throws ioexception { document document = new document(); document.add(new textfield("id", string.valueof(specialdomainobject.getid()), field.store.yes)); document.add(new textfield("name", specialdomainobject.getname(), field.store.yes)); document.add(new textfield("tags", jointags(specialdomainobject.gettags()), field.store.yes)); document.add(new textfield("contents", getcontents(specialdomainobject), field.store.yes)); (language language : getallassociatedlanguages(specialdomainobject)) { document.add(new intfield("languageid", language.getid(), field.store.yes)); } specialdomainobjectindexwriter.updatedocument(new term("id", document.getfield("id").stringvalue()), document); specialdom...

page refresh - Primefaces tab not updating properly -

i have dialogue commandbutton, , i'm trying do: do java work update primefaces tab make dialogue box disappear go tab. this code i'm using: <p:commandbutton value="submit" action="<some java work>" oncomplete="dialogue.hide(); sidetabs.select(1)" update="<update side tab"> </p:commandbutton> the problem is, works once between refreshes. mean is, click button, , works fine-the tab changes requested tab, tab updated, , dialogue disappears. when click button again, requested tab indeed selected, isn't refreshed until hit f5. once that, can click dialogue button again , tab refresh again, once again, once - until hit f5 again. so, this: click button -> see 1 item in tab click button again -> still see 1 item in tab hit f5 -> see 2 items in tab click button -> see 3 items in tab click button again -> still...

ruby on rails - form tag just one value pass instead of multiple -

i have form_tag in form contains 2 drop down boxes. when submit form both fields id isn't pass dont know did wrong... <%= form_tag '/daily_report' -%> <label>search</label> <%= select_tag "id", options_from_collection_for_select(user.all, "id", "firstname",:selected => @s) %> <%= select_tag "id", options_from_collection_for_select(project.all, "id", "name",:selected => @s) %> <%= submit_tag "search", :name => nil %> <% end -%> if use same name values overwritten , 1 result. change name , make different. <%= select_tag "users", options_from_collection_for_select(user.all, "id", "firstname",:selected => @s) %> <%= select_tag "projects", options_from_collection_for_select(project.all, "id", "name",:selected => @s) %> you can access using names, :users , :project...

python - Replacing a character in Django template -

i want change &amp; and in page's meta description. this tried {% if '&' in dj.name %} {{ dj.name.replace('&', 'and') }} {% else %} {{ dj.name }} {% endif %} this doesn't work. still shows &amp; dj.name.replace('&', 'and') can not invoke method arguments.you need write custom filter. official guide here: https://docs.djangoproject.com/en/1.9/howto/custom-template-tags/#registering-custom-filters ok, here example, say, in app named 'questions', want write filter to_and replaces '&' 'and' in string. in /project_name/questions/templatetags, create blank __init__.py , , to_and.py goes like: from django import template register = template.library() @register.filter def to_and(value): return value.replace("&","and") in template , use: {% load to_and %} then can enjoy: {{ string|to_and }} note, directory name templ...

Transforming keys of a map in Clojure -

i'm working rest api represents account following json: { "username": "foo", "password": "bar", "emailid": "baz" } i have clojure function create account can called this: (create-account :username "foo" :password "bar" :email "baz") what want map nice keys create-account takes funky ones rest api expects. current solution this: (def clj->rest {:username :username :email :emailid}) (apply hash-map (flatten (map (fn [[k v]] [(or (clj->rest k) k) v]) args))) ;; args arguments create-account, above is there more idiomatic way accomplish this? (clojure.set/rename-keys args clj->rest) ... mimics solution, producing ... {:emailid "baz", :username "foo", :password "bar"} i take you've worked out how change required json.

android - SubMenu showAsAction when added at runtime -

i'm adding submenu @ runtime , works great. have problem: how set showasaction="always" on runtime-added submenu? there no method achieve , if don't set can't find way have shown in action bar. helping don't know if late or not, submenu has function called getitem() returns menuitem. can menuitem, , call setshowasaction() afterwards. hope helps!!!

cocoa - Display Contents of Symbolic Link using NSURL -

example path: /users/mike/desktop/media i create symbolic link "media" folder , name "my media." that checks out. want show contents of my media folder confirm successful creation of symbolic link. a "targetfield" textbox displays correct path string symbolic link lastpathcomponent: /users/mike/desktop/my media prior mavericks following code show contents of symbolic link folder in finder window: nsstring *path = [targetfield stringvalue]; nsurl *fileurl = [nsurl fileurlwithpath:path]; nsarray *fileurls = [nsarray arraywithobjects:fileurl, nil]; [[nsworkspace sharedworkspace] activatefileviewerselectingurls:fileurls]; in mavericks code opens original target folder, not symbolic link folder. realize technically contents of both folders same. point code no longer reflects symbolic link last component in new path. reverts target folder (media) , opens instead. does description make sense? there way make work did prior mavericks? thank...

Rails 4 Routing - undefined local variable -

i have payments table. in index view list payments in table , in show view i'd show form of payments user can select ones further process. above table in index action view have: <%= link "customise", show_payment_path %> then in controller: def show @payments = payment.all end in routes file: resources :payments the error getting is: undefined local variable or method `show_payment_path' i have tried <%= link_to 'customise sepa mandate', show_payments_path %> as gives same error. using url instead of path. for make own routes , create own path variable such resources :payments, except: [:show] '/show' => "payments#show", on: collection, as: :show end

css3 - CSS add a image vertical center with text in a div -

i tried v-align image text in link. until have used background image v-center image of text css .label { margin: 0 0 0 15px; padding: 0; color: #fff; } a.moreinfo { background: url(../images/gallery/add.png) no-repeat left center; cursor: pointer; } html <a class='moreinfo'><span class='label'>more info</span></a> now want try not use background images, insert image in html code (img src). tried using vertical-align: middle, image not aligned precisely 1 in background. how same thing image included in html code? thanks here how can center element in another: .absolute-center { margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; } you can find more in link: http://blog.themeforest.net/tutorials/vertical-centering-with-css/ .

powershell - remove-computer cmdlet access denied -

i trying create script remove computer domain using remove-computer -unjoincredentials domain\admin -passthru however, consistently receive error stating remove-computer : failed unjoin computer 'web140127105714' domain 'domain.com' following error message: access denied. @ line:1 char:1 + remove-computer -unjoindomaincredential domain\admin -passthru + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : operationstopped: (web140127105714:string) [remove-computer], invalidoperationexception + fullyqualifiederrorid : failtounjoindomain,microsoft.powershell.commands.removecomputercommand the account using domain administrator full access. have confirmed account can manually unjoin domian. sounds op found answer, here powershell self elevating example future readers. add top of scripts , re-launch elevated don't have right click , 'run administrator'. $wid=[system.security.principal.win...

MS Access turn off shortcut menu on subform -

i have ms access form has subform. subform in datasheet view , sorted , sorted date column. have button comparison checks using first row in subform before performing update, , works fine. problem whenever user right click in subform , resort data causes problems. there way can prevent users sorting subform? also, if should turn off data still sorted date field? the form should have property shortcut menu controls ability right-click when form in browse mode. set property false disable right-click (and sorting etc). data should still sorted controlled order by , order on load properties.

Java Swing & Socket Messenger StackOverflow Error -

i making simple client-server messenger pair sockets , jswing, , have run stackoverflow error. know(or @ least think) it's caused recursive functon(which don't think have, may) doesn't have correct termination condition(does mean return; in switch statement?) here's of error(since it's stackoverflow, repeats itself, of course) exception in thread "awt-eventqueue-0" java.lang.stackoverflowerror @ java.util.hashmap.getentry(unknown source) @ java.util.hashmap.get(unknown source) @ sun.awt.appcontext.get(unknown source) @ com.sun.java.swing.swingutilities3.getdelegaterepaintmanager(unknown source) @ javax.swing.repaintmanager.getdelegate(unknown source) @ javax.swing.repaintmanager.adddirtyregion(unknown source) @ javax.swing.jcomponent.repaint(unknown source) @ java.awt.component.repaint(unknown source) @ javax.swing.jcomponent.setbackground(unknown source) @ javax.swing.lookandfeel.installcolors(unknown source) @ javax.swing.lookandfeel.installcolor...

python - IMDB suggestions -

i'd make kind of homemade algorithm, list of movies have, return accurate suggestions of movies haven't seen , like. need know if imdbpy can return "suggestions" part. indeed, when search movie on web site, given list of movies matching kind movie searched for. but can't find answer on doc of imdbpy. there way suggestions ? since get_movie_recommendations doesn't work wish (e.g. doesn't return 12 years slave), scrape recommendations beautifulsoup. import bs4 import imdb import requests src = requests.get('http://www.imdb.com/title/tt2024544/').text bs = bs4.beautifulsoup(src) recs = [rec['data-tconst'][2:] rec in bs.findall('div', 'rec_item')] print recs this prints: ['1535109', '0790636', '1853728', '0119217', '2334649', '0095953', '1935179', '2370248', '1817273', '1210166', '0169547', '1907668'] after can...

mysql - Access folder and select filename using PHP -

i have written code, user selects profile picture , picture stored in localhost/user/$username/photos/photo1.gif . after that, assigned filename ( photo1.gif ) session variable can display php scripts. working fine. can display picture in every php script accessing session variable. the problem have when trying login login page: in login page connect database, retrieve email , password, check them , if ok redirect user home.php . problem user's photo not linked email cannot know filename of photo. thing know sure directory (because can retrieve username database well). lets user has uploaded 4 photos (photo1, photo2, photo3, photo4 - photo4 uploaded last). makes sense using photo4 profile picture. there way me access folder , retrieve filename of picture uploaded last? also, general question, better, store photos(or files) in database or server? a few options: it 'better' create photo table , store user_id , photo location in table. storing actual pho...

php - How do I link to authors post outside of the loop in wordpress -

i using ubermenu , have been helpful, have not been able figure out. they have shortcode display recent post in menu image , title. i want add author of post under title linked authors post. here current code: function ubermenu_recent_posts($atts){ global $ubermenu; extract(shortcode_atts(array( 'num' => 3, 'img' => 'on', 'img_width' => 85, 'img_height'=> 55, 'excerpt' => 'off', 'category' => '', 'default_img' => false, 'offset' => 0, ), $atts)); $args = array( 'numberposts' => $num, 'offset' => $offset, 'suppress_filters' => false ); if(!empty($category)){ if(is_numeric($category)){ $args['category'] = $category; } else $args['category_name'] = $category; } $posts = get_posts($args); $class = ...

javascript - Disable error handling for mocha.js -

does know if there way disable error handling mocha? i'd let exception bubble , handled browser during debugging. update: context this. - code throw's unexpected error. - disable "try/catch" (something jasmine's tests do) , thrown debugger in chrome. this way can inspect current state of application @ moment. sounds there isn't built in, , need manually each time odd error in test. maybe wrapping code with try { somethingthatbreaks(); } catch(e) { debugger; } mocha installs own onerror handler trap exceptions may occur in asynchronous code. can disable with: window.onerror = undefined; this dangerous . should when must absolutely so. if make routine thing, mocha miss errors happen in asynchronous code. if want let exceptions in synchronous code bubble up, i'm not seeing accomplish. if want inspect exception before mocha touches it, try...catch block wrapping test this.

python - How to color letters in gtktextview with gtkcssprovider -

hey wondering if it's possible color specific letters in gtktextview css style sheet. for example. .t { color: blue; } .a { color: red; } etc.. i have this, gtktextview { color: blue } but makes textview blue! dont know if possible, or if there's quick way this. doing tags takes processing power lot of text. i'm looking faster alternative , css looks promising. thanks! what suggest not possible. suggest using gtksourceview , creating special syntax highlighting language letters. (this, of course, use tags under hood, again css take processing power under hood too.) i don't know if it's possible style gtktexttag s css; might want that.

performance - High Memory Usage Using Python Multiprocessing -

i have seen couple of posts on memory usage using python multiprocessing module. questions don't seem answer problem have here. posting analysis hope 1 can me. issue i using multiprocessing perform tasks in parallel , noticed memory consumption worker processes grow indefinitely. have small standalone example should replicate notice. import multiprocessing mp import time def calculate(num): l = [num*num num in range(num)] s = sum(l) del l # delete lists option return s if __name__ == "__main__": pool = mp.pool(processes=2) time.sleep(5) print "launching calculation" num_tasks = 1000 tasks = [pool.apply_async(calculate,(i,)) in range(num_tasks)] f in tasks: print f.get(5) print "calculation finished" time.sleep(10) print "closing pool" pool.close() print "closed pool" print "joining pool" pool.join() print "joined p...

html - How to reduce the height of my div element, relative to the other div element -

i trying reduce height of div element contains content smaller it's corresponding div content not overflow other elements method executing type of problem. <!doctype html> <html> <head> <script> .atlas.region-map { border: 2px solid #716e64; max-width: 500px; overflow: hidden; margin: 0; float: left; } .atlas .map-content .info-col { margin-left: 549px; width: 335px; } .atlas .map-content .info-col p { color: #5c5642; margin-top: 15px; font-size: 12px; } .atlas_test { height: 300px; font-size: 14px; overflow-y: scroll; } </script> </head> <body> <div class="info-col"> <p>content go here</p> </div> </body> if not working, isn't executing! you need place css coding in style element not in script . script element js codes. however, lessen size of div can ...

c# - Ordering by attribute XML file with nested elements -

i order xml file, i'm having troubles in understanding how. noticed lot of suggestions similar case. var bookstore = xdoc.element("bookstore") .elements("book") .orderbydescending(s => (int) s.attribute("id")); my xml made this: <?xml version="1.0" encoding="utf-8"?> <rank> <difficulty template="gamer"> <car type="formulaa" /> <car type="formulac" /> <car type="gt2" /> <car type="formulab" /> </difficulty> <difficulty template="racer"> <car type="formulaa" /> <car type="formulac" /> <car type="gt2" /> <car type="formulab" /> </difficulty> <difficulty template="pro"> <car type="formulaa" /> <car type="formulac" /> <car type="gt2" /> <car...

r - Subset data in ddply -

i have following data , trying summarize have id, tone, , count of tone each name. however, want have tone rate (tone_cnt / sum of id name). unfortunately, i've messed around , have had little luck. df = data.frame(name=c("a","a","a","a","a","b","b","b","b","b","b"), id = c(35, 35, 35, 36, 36, 35, 35, 35, 36, 36, 36), tone=c(0,1,1,2,2,3,2,1,2,2,2)) df sum = ddply(df, .(name, id, tone), summarise, tone_cnt=length(tone), tone_rate=tone_cnt/sum(tone_cnt)) sum have messed around length(), sum(), sum(length()) , nothing seems trick done. currently, spits out 1 everyone. here's how should like: > sum name id tone tone_cnt tone_rate 1 35 0 1 1 / (1+2) 2 35 1 2 2 / (1+2) 3 36 2 2 2 / (2) 4 b 35 1 1 1 / (1+1+1) 5 b 35 2...

scala - How to ensure that same random element is not selected twice -

i'm using below code randomly select 2 elements : scala.util.random.shuffle(mylist).take(2) how can ensure 2 elements not selected twice ? could remove random element list, create new list , use same code above ? a bit more context nice; in, why not converting list easier handle task, iterator or array? keeping list, see 2 options: use length of list pick 2 random numbers array of indices, check 2 random numbers aren't same , pull list. take 1, remove it, take instead of taking 2 @ once.

php - Displaying links for similar articles -

i have page want display articles 1 you're reading (randomly chosen articles same subcategory). want use php script server says have error. here script: $article = mysqli_query($con,"select * sources id = '$id'"); while($row = mysqli_fetch_array($article)) { code works $samecat = $row['subcategory']; } $samecats = explode(', ', $samecat); foreach($samecats $similar){ $scat[] = "subcategory %".$similar."%"; } echo implode(' or ',$scat); $samearticle = mysqli_query($con, "select * sources (".implode(' or ',$scat).") , not id='$id' order rand() limit 0,3 "); while($row2 = mysqli_fetch_array($samearticle)) { echo "<a href='article.php?id=".$row2['id']."'>&raquo " .$row2['headline']."</a>"; } the connection works because works other components have bug here :((( any alternative so...

auto responder - Check if Fiddler's AutoResponder is enabled via FiddlerScript -

is possible check if autoresponder enabled using fiddlerscript? i have code modifies request headers, want code fire when autoresponder on. looked through api didn't see obvious. thanks! look @ fiddlerapplication.oautoresponder.isenabled

tsql - SQL Server 2005: Procedure much slower than function -

edits: 1. string literals have n prepended on them, e.g. n'' , n'%' . has had no impact on timing. 2. including links execution plans. execution plan function: https://drive.google.com/file/d/0bxunjkb4d8y6elv1ohvuawvruu0/edit?usp=sharing execution plan procedure: https://drive.google.com/file/d/0bxunjkb4d8y6cm9sszfznwdovke/edit?usp=sharing i'm trying re-implement inline table-valued function stored procedure, can dynamically control columns compare while searching (you can see details below). unfortunately, procedure many (4-5) orders of magnitude slower function, makes unusable, i'm coming here guidance. can see procedure guts below, have accounted parameter sniffing (via with recompile ), , i'm pretty sure i've accounted ansi_nulls . my question is, "why stored procedure slower function, , how speed @ least fast?" before comes up, reason terribly slow double-wildcard searching underlying view cannot indexed multiple reas...

.net - MSBuild WebFileSystemPublish step does not run on build server -

i'm using following powershell script build web project: $tools = @() $tools += "c:\windows\system32" #xcopy $tools += "c:\windows\microsoft.net\framework\v4.0.30319" #msbuild $env:path = [string]::join('; ', $tools) msbuild ros.edi.web/ros.edi.web.csproj ` /p:deployonbuild=true ` /p:publishprofile=$config ` /p:configuration=$config ` /p:platform=anycpu ` /p:defineconstants=$constants ` /property:applicationversion=$env:build_number ` /property:applicationrevision=$env:build_vcs_number the script completes , msbuild runs without error on both dev machine , build server. however, step publishes web project local file system not run on build server. here relevant output msbuild on dev machine pipelinepredeploycopyallfilestoonefolder: publish pipeline deploy phase stage ... webfilesystempublish: ... and on build server pipelinepredeploycopyallfilestoonefold...

class - Interfaces: Java Language Specification -

Image
please explain: 3rd bullet point 5th line (in bold) 2nd last line every class in java implicitly (or explicitly) sub type of java.lang.object . the class object superclass (§8.1.4) of other classes. because of this, can invoke method declared in object on variable of class type. string var = ...; var.hashcode(); this has true interface type variables well someinterface var = ...; var.hashcode(); for reason, interface must implicitly declare (as abstract ) methods declared in java.lang.object . you can't override final methods, interface declares methods must implemented in sub types, compile time error thrown if interface declares method declared final in java.lang.object . an interface can declare classes, interfaces, , fields in body. if sub interface declares of same name, hiding those. therefore doesn't inherit them. for example, public static void main(string[] args) throws exception { system.out.println(parent.answer);...

sql - #Name? on form after requery in Access 2010 -

i using vba , sql re-query main form based on criteria entered in several controls on pop form. far can tell code running correctly, database re-queried based on criteria enter, 2 of controls on main form show #name? or blank after re-querying based on criteria. know how can fix this??? the code runs re-query is: public sub superfilter() on error goto err_advancedfilter_click dim strsql string dim strcallnumber string dim strasgntech string dim strclientid string dim strcallgroup string dim strpriority string dim stropenstatus string if isnull(forms![frmtips&tricks].txtcallnumber) = false strcallnumber = " (((callinfo.callnumber) = forms![frmtips&tricks].[txtcallnumber])) , " else strcallnumber = "" end if if isnull(forms![frmtips&tricks].cboasgntech) = false strasgntech = " (((callinfo.asgntech) = forms![frmtips&tricks].[cboasgntech])) , " else ...

domain driven design - Building models in NOSQL -

we trying nosql document database (ravendb) , asking ourselves questions. our models : public class user { public guid id {get;set} public string name {get;set;} } public class video { public guid id {get;set;} public string nom {get;set;} public datetime publishdate {get;set;} public user publisher {get;set;} public uri adress {get;set;} } by default, video can not read anyone. can add rights see video @ user or group of user. can recommand video user or group of user(the rights see video added automatically). what best way design models nosql document database considering following use case : a user publishing video can choose group(s)/user(s) can see video , recommend video user(s)/group(s) a user withdraw rights see video @ user(s)/group(s) get last n videos user has been authorized read get last n videos have been recommended user we considering following : add 2 list each model (videosreadable, videosrecommended , user...

sql - Standard approach when mixing several INNER with several LEFT OUTER JOINs -

if have several loj s , several inner joins there correct standard syntactical structure should use? example scenario 5 tables #a - #e userid column , each additional column measure - measurea in table #a, measureb in table #b etc. tables #a, #b, #c have same set of userids tables #d , #e have different subsets of set of userids in #a-#c. is correct structure use: select #a.userid, #a.measurea, #b.measureb, #c.measurec, d = coalesce(#d.measured,0.), e = coalesce(#e.measuree,0.) #a join #b on #a.userid = #b.userid join #c on #a.userid = #c.userid left outer join #d on #a.userid = #d.userid left outer join #e on #a.userid = #e.userid or should lojs applied within subquery on #a? select x.userid, x.measurea, #b.measureb, #c.measurec, x.d, x.e ( select #a.userid, #a.measurea, d = coalesce(#d.measured,0.), e = coalesce(#e...

datepicker - HTA Time Picker -

i'm building hta (userform) , add time picker have been unsucessful getting work. i'm using jquery date picker successfully, website not have reference using time picker, or manipulating date picker show time. since hta stand alone applicaiton know options limited, knows i'm missing here. thanks! <head> <meta charset="utf-8" /> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <style type="text/css"> .ui-datepicker { background: #035c7e; border: 1px solid #555; color: #eee;} </style> <script> $(function() { $( "#datepicker1" ).datepicker(); }); </script> </head> <body> shift date: <input type="text...

java - Hibernate Spring security modified design how to -

i'm designing db model want have: user(id, role_id) (userdetails) permission(role_id, permission) (grantedauthority) role(id, description) i'm using hibernate , spring security. want every role have list of permissions (grantedauthorities) using role_id rather specific user having that. i'm kinda lost designing that. i've came far: public class user implements userdetails, serializable { @id @generatedvalue @column(name = "id") private int id; @column(name = "role_id", insertable = true, updatable = false) private int roleid; @onetomany(fetch = fetchtype.eager, mappedby = "user", cascade = cascadetype.all) private list<permission> permissions; } public class permission implements grantedauthority, serializable { @id @generatedvalue @column(name = "id") private int id; @column(name = "role_id", insertable = false, updatable = false) private in...

maven - m2e or eclipse ignoring given timestamped snapshot version number of dependencies -

before this: yes, know shouldn't using snapshot dependencies in production code , yes, know shouldn't referencing specific timestamped snapshot versions. that said, need to. we're using framework still in development , needed use snapshot version our product working. however, working on framework in active development , changing daily. given need snapshot version @ time period not want of new changes, we've specified specific timestamped snapshot in our pom dependencies. works fine when execute maven console: delete maven repository (~/.m2/repository) execute maven clean install via command line observe proper timestamp versions being dowloaded maven repository however, when open eclipse, during project update, decides ignore version number , go ahead , download latest snapshot version. causing many problems , wondering how can eclipse (m2e) honer timestamped version number have provided. thank you. edit: forgot mention have searched internet answer n...

java - Convert File Hierarchy to MutableTreeNode in Jtree -

i have hierarchy of file structure in java.. how convert defaultmutabletreenode heirarchy. tried fetching each file individually, checked each if directory or not, did recursive loop , formed file structure. now, convert defaultmutabletreenode, have utilities or again need top-down approach check , convert them again node-by-node.? do have utilities such already? need suggestions! there no built-in utilities create jtree model filesystem snippet. there file chooser if after. otherwise approach seems reasonable me. convert files defaultmutabletreenode in 1 pass. like: public class filenode extends defaultmutabletreenode { private file file; public filewrapper(file file) { super(this); this.file = file; if(file.isdirectory()) { for(file file : listfiles) { add(new filenode(file)); } } } private string tostring() { return file.getname(); } private file getfile() { return file; } }

python - Add x and y labels to a pandas plot -

Image
suppose have following code plots simple using pandas: import pandas pd values = [[1,2], [2,5]] df2 = pd.dataframe(values, columns=['type a', 'type b'], index=['index 1','index 2']) df2.plot(lw=2,colormap='jet',marker='.',markersize=10,title='video streaming dropout category') how set x , y-labels while preserving ability use specific colormaps? noticed plot() wrapper pandas dataframes doesn't take parameters specific that. the df.plot() function returns matplotlib.axes.axessubplot object. can set labels on object. in [4]: ax = df2.plot(lw=2,colormap='jet',marker='.',markersize=10,title='video streaming dropout category') in [6]: ax.set_xlabel("x label") out[6]: <matplotlib.text.text @ 0x10e0af2d0> in [7]: ax.set_ylabel("y label") out[7]: <matplotlib.text.text @ 0x10e0ba1d0> or, more succinctly: ax.set(xlabel="x label", ylabel="...

Display "Choose Option" label in Django ModelForm ChoiceField -

i have django modelform choicefield , display text "choose option" in dropdown when user visits page. ("choose option" wouldn't actual "value" rather "label") any thoughts how can add code below? i appreciate time. class exerciseform(forms.form): def __init__(self, *args, **kwargs): super(exerciseform, self).__init__(*args, **kwargs) exercises = exercise.objects.all().order_by('name') exercise_choices = [(exercise.youtube_id, exercise.name) exercise in exercises] self.fields['exercise'] = forms.choicefield(choices=exercise_choices) just use label argument , like: self.fields['exercise'] = forms.choicefield(choices=exercise_choices, label="choose option") or if present inside dropdown without being actual choice insert first option: exercises = exercise.objects.all().order_by('name') exercise_choices = [(exercise.youtube_id, exercise.name) e...

asp.net mvc - The configured maxUrlLength value is not being used -

i received error "the length of url request exceeds configured maxurllength value.". went web.config file, under configuration - system.web . added attribute on httpruntime section follows: <httpruntime targetframework="4.5" maxurllength="1083" relaxedurltofilesystemmapping="true" /> i still error. i've rebuilt, republished, stopped , started iis, can think of. url using has 600 characters in it. else can here? sorry all. trying use oauth returned url. found it's in form of http://www.foo.com/&foo=bar?foo2=bar2 . ampersand , question mark reversed. looks i'm getting bad url intuit. didn't notice because url long. (i think error message iis wrong). investigate more.

c++ - gcc linker: which input libraries are used? -

i'm debugging linker issues ("undefined reference" symbols supposed in library i'm linking with), , i'm not sure whether compiler using right shared library. the output i'm looking 1 produced ldd , is, list of libraries full paths... can't use ldd compilation fails before producing output. the closest have far dumping library search path , checking directories 1 one shared lib in question; wondering whether better way of doing this? i'm debugging linker issues you much better answers if show actual error , link command line used. most did this: gcc -lfoo main.c where libfoo.so library defines necessary symbol. read this understand why above command line wrong. but can't use ldd compilation fails before producing output your earlier statement said link stage fails. compilation , linking not same thing, please don't mix them up. i wondering whether better way of doing this to find out libraries li...

python - Biopython HSExposure Module 'NotImplemented' Error -

i trying calculate hsexposure values using biopython lib(1.63), however, returns error somthing 'notimplemented object not iterable'. when checked out module found out 1 of function in hsexposure module following: def _get_cb(self, r1, r2, r3): """this method provided subclasses calculate hse.""" return notimplemented what wrong guys think? cheers the method not implemented, exception intention. and in python method names, start "_" (underscore) internal use, convention. not meant call it, made calls library itself. (i not familiar library , can not offer alternative).

membership - Verify if a PC is a member of a specific SCCM collection -

i looking script in powershell or vb check current pc verify member of specified sccm 2012 collection. we want can create multiple deployment types , assign them different collections, use deployment type requirements make sure deployment types deploy correct collection. not want create multiple applications same media when there slight variations in installation parameters. i believe there should basic script check if current pc member of collection dr100038 (as example) , return 1 or 0. with colleague, had luck following (powershell , wmi inside), sccm not providing @ moment right commandlets : for device, id: $deviceid=(get-wmiobject -computername -namespace root\sms\ -class sms_r_system -filter "name=''").resourceid search collections linked : get-wmiobject -computername -namespace root\sms\ -class sms_collectionmember_a -filter "resourceid='$deviceid'" filter resulting list i found solution, digging in https://s...

c - Pointer to Structure Given Integer Value -

i'm looking @ code project contains pointer structure sdl library: struct sdl_window *screen = 1; i take mean screen pointer sdl structure. how can pointer assigned integer value? mistake in code? in many architecture, pointer , integer stored using same number of bits. assigning integer pointer legal in c. whereas practice different question ! on gcc 4.8 warning: bla.c:2:18: warning: initialization makes pointer integer without cast [enabled default] struct toto *t = 1;

ios - Having a single image view to show different images -

my app requires characters except can customized. possible have 1 image view change actual image else? here example: there item 1 , item 2. item 1 default. if click buy item 2, image view of showing item 1 replaced picture of item 2. is there way can , if not how developers have customization that? unless missing something, seems simple as: uiimageview *myimg = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"myfirstimage"]]; and if want change image myotherimage , can set below [myimg setimage:[uiimage imagenamed:@"myotherimage"]]; if need image component, subclass uiimageview , call functions swap between images.

nested excel functions with conditional logic -

Image
just getting started in excel , working database extract need count values if items in column unique. so- below starting point: =sumproduct(countif(c3:c94735,{"sharable content object reference model 1.2","authored scorm/aicc content","authored external web content"})) what i'd figure out syntax this- =sumproduct (countif range1 criteria..., range2 criteria="is unique value") am getting right? syntax bit confusing, , i'm not sure i've chosen right functions task. i had solve same problem week ago. this method works when can't sort on grouping column (j in case). if can keep data sorted, @miked 's solution scale better. firstly, know frequency trick counting unique numbers? frequency designed create histograms. takes 2 arrays, 'data' , 'bins'. sorts 'bins', creates output array that's 1 longer 'bins'. takes each value in 'data' , determines bin belongs ...

java - Another time complexity issue -

i've done these problems, not looking straight answer. looking guidance on whether or not doing correctly , if not, possibly explanation on why incorrect. :) so have these 2 problems. i've commented logic in why got answers. if please verify doing correctly? public static integer findtripleb(int[] anarray) { //method variable: n if (anarray.length <= 2) { return false; } //time complexity: 1 // use insertion sort sort anarray (int = 1; < anarray.length; i++) {//tc 1+(n+1)+n // insert anarray[i] int j = i-1; //tc 1 int element=anarray[i]; //tc 1 while (j >= 0 && anarray[j] > element) {//tc log(n) anarray[j+1] = anarray[j]; //tc 1 j--; //tc 1 } anarray[j+1] = element; //tc 1 } //total tc: (2n+2)(1+1+log(n)(2)) = (2n+2)(2+2log(n)) = 4n+(2log(n))(2n)+4+4log(n) // check whether anarray contains 3 conse...