Posts

Showing posts from August, 2014

html - Does the aria-labelledby attribute require a label tag? -

on form, can aria-labelledby attribute work on own or require label tag? example: work this aria-labelledby="name" read browser "name"? "the aria-labelledby attribute used indicate ids of elements labels object." ( mdn ). it not contain text label. so no, doesn't work on own. it doesn't require <label> element, if <label> correct html element context should use one. (start correct, semantic html, build aria on top of it).

sql server - LocalDb - starting a shared instance as other user -

i using sql server 2012 localdb instance shared users. have created sql server login can used users. commands using (executing 'administrator'): sqllocaldb.exe create test sqllocaldb.exe share test testshared sqllocaldb.exe stop test sqllocaldb.exe start test // sql commands create login {0} password = '{1}' exec master..sp_addsrvrolemember @loginame = '{0}', @rolename = 'sysadmin' but when performing system restart, seems the instance not started automatically. connecting instance 'user' brings following error: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 40 performing "sqllocaldb start .\testshared " non-owner of database instance not help, need execute statement owner (which of course not available upon each restart)

CSS Bottom Margin Issue -

i creating list name, job description, , location. list contains 30 or names. last item-location in list have 20px of margin below separate names. like: name job description location name job description location name job description location etc. i'm having issues text color, main issue spacing. jsfiddle below code: <style> .hed_brown { font-family:"trebuchet ms", arial, helvetica, sans-serif; font-size: 16px; color: #996633; line-height: 18px; margin-left: 15px; } .hed_green { font-family:"trebuchet ms", arial, helvetica, sans-serif; font-size: 16px; color: #7f9c99; line-height: 18px; margin-left: 15px; } .hed_blue { font-family:"trebuchet ms", arial, helvetica, sans-serif; font-size: 16px; color: #011e41; line-height: 18px; margin-left: 15px; margin-bottom: 20px; } </style> <span class=&

objective c - iOS UIPickerView how to get the selected row outside the delegate method -

i know uipickerview has method: - (void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component but inside method, want selected row of other components. how on earth can that? you can selected row number anywhere using selectedrowincomponent method of uipickerview . such like nsstring *yourselectedtitle = [self.yourarrayname objectatindex:[self.yourpickername selectedrowincomponent:0]]; nslog(@"%@", yourselectedtitle);

qt - C++ - QListWidget select first item -

in qmainwindow constructor read database , fill qlistwidget items. apparently there no item selected have on own. have slot called when click on item in list. i tried setcurrentrow( const int ) if slot won't called. i've seen function setcurrentindex( const qmodelindex & ) i'm not familiar qmodelindex. how tell qlistwidget select first item , call on_list_clicked(const qmodelindex& index) slot? edit: also, cannot use other slot clicked because currentrowchanged(int) , itemselectionchanged() both make program crash when remove index list. so somehow need perform click on list... calling setcurrentrow() emits signal currentrowchanged() , accepts int instead of qmodelindex . simply connect signal instead of itemselectionchanged() . sample code: mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); ui->listwidget->setcurrentrow(1); } void mainwindow::on_lis

python - How to avoid global variables in command function call -

i'm still working on code moves around 2 planets , shows gravitational force between them. tried make easier use showing 2 buttons allow select planet want move. can click in canvas , selected planet move you've clicked. the programm works, i'd know if there better way write using chngb , chngo functions global statements. still can't believe in python forced use function without parameters when assigning command parameter of button. basically i'd know if it's possible write command = (a=1) (i know doesn't work, idea.) also, there way of doing having use variable know planet selected (which button has been pressed last). i use python 3. from tkinter import * import math x, y = 135, 135 = 0 def gravitation (obj1,obj2):#showing gravitational force between planets a, b, c, d = can.coords (obj1) e, f, g, h = can.coords (obj2) dist = math.sqrt ((((a+c)/2)-((e+g)/2))**2+(((b+d)/2)-((f+h)/2))**2) if dist != 0: grav = 6.673

php - Can you run PHPUnit if you just download it from Github and link to it in your script -

ive got custom selenium scripts working in similar way might use curl (theirs ton of js encryption being done on post data on 3rd party site more complex reverse engineer them , use curl), these selenium scripts work require phpunit, ive gone around trying install via command line / pear, life of me cant work. i noticed can download files .zip github page run trouble if downloaded them placed them in same folder selenium scripts , linked them correctly via require() ?

docusignapi - Attachments on iPad in iFrame docusign -

i using iframe document signed clients on ipad. there attachments each signer, before attaching captured image, want resize it. there way resize image before attaching document. currently there no functionality built in docusign platform allow re-sizing of attached image, docusign esignature company , when allow attachments on top of documents signed should not modified in way alter important aspects legally binding agreement being signed. however think might still have few options here solve issue. 2 obvious ones come mind are: get captured image recipients before start signing process. use conditional tab not allow recipient add attachment unless it's within size. for first solution use embedding feature design whatever ui around signing experience you'd , in case can control order of operations (i.e. have them upload image first before clicking button sign) , can resize image , add envelope. for second solution, use radiogrouptabs add 2 grouped r

parsing - A fast and optimize way to extract inner repeated identifiers using Scala parser -

i have defined these grammatic rules in scala: def root = rep(block) def block = ("block" ~ blockname ~ "{" ~ definition ~ "}") def blockname = ident def definition = creation ~ destruction ~ upgrades def creation = "creation" ~ "{" ~ duration ~ cost ~ "}" def destruction = "destruction" ~ "{" ~ duration ~ "}" def upgrades = "upgrades" ~ "{" ~ rep(ident ~ "{" ~ duration ~ cost ~ "}") ~ "}" def duration = "duration" ~ "=" ~ wholenumber def cost = "cost" ~ "=" ~ repsep(resource, ",") def resource = (resourcetype ~ "*" ~ wholenumber) def resourcetype = "wood" | "metal" | "food" and input string """ block citytown { creation { duration = 100 cost = food * 10, wood * 10 } destruction { duration = 100 } upgrades {

css - Aligning paragraphs and sub-paragraphs horizontally -

Image
is there way present data follows using css? an article divided paragraphs, , each paragraph has (usually smaller) box/sub-paragraph right of it, horizontally aligned respective paragraph. yes, possible. here example of how can achieve http://jsfiddle.net/sptzh/1/ html: <section class="content"> <article class="row"> <p>paragraph a</p> <div class="teaser"> text related text related text related text related text related text related </div> </article> <article class="row"> <p>paragraph b paragraph b paragraph b paragraph b</p> <div class="teaser"> text related b </div> </article> </section> css: .content { width: 500px; } .row { clear: both; padding: 10px; border-top: solid 1px #000; } .row:after { content: ""; d

How to load SVM model fitted/ensembles with libsvm in R -

how can load svm model thas ensabled ensemblesvm referenced here ? i can export fitted models in r (e1071) 'libsvm' format write.svm(model1, svm.file = "model1.svm") write.svm(model2, svm.file = "model2.svm") then build ensemble ( doc ) merge-models -model1 model1.svm -model2 model2.svm -o model.ensable.svm the output result in 'libsvm' file format. now how can load ensemble r , predict new data it? i author of ensemblesvm package. unfortunately, package not have r interface yet. currently, option call esvm-predict via command line on test data , load file containing predictions (set using -o flag). note ensemble not in exact libsvm format. though looks similar, cannot read ensemble model using libsvm tools. you can use r's system() invoke esvm-predict via command line. it's worth, interfaces r, matlab , python under development currently. hope have them ready end of year, along bunch of other goodies.

sharepoint - SSRS 2008 vs SSRS 2012 -

i've been trying figure out if makes sense use ssrs 2012 powerview vs using ssrs 2008. i've following questions: what's better in ssrs 2012 without powerview(ie without using sharepoint)? what edition of sharepoint need make powerview work ssrs 2012? does make sense learn , use sharepoint if can barely utilize pluses of sharepoint or powerview instead of ssrs 2008 or ssrs 2012 without powerview/sharepoint? i can address overall question not first 2 bullet points have not used sharepoint enough give version differences on it. powerview have ever done dll allows report object created add on excel. these objects can hosted in sharepoint in library. downside need have dll's , add on sharepoint use it. far know committing user's going sharepoint option. make kind of neat though make believe call 'powerpivot' client dataset made in excel file report off of. option shop works sharepoint extensively. have not heard of many places using

java - Tomcat7 can't find classes in WEB-INF/lib/lookHere.jar -

very weird problem tomcat7. i migrated data objects out of web app , jar file. everythings works fine when deploy tomcat7 on local development machine. however, when try deploy same code test, tomcat cannot find data object classes have been migrated jar file. don’t understand why happening. it’s if tomcat still expecting find data object in web app , therefore isn’t bothering in jar file. does know way force tomcat in web-inf/lib/lookhere.jar class files not finding? i’ve tried clearing working directory no avail. here’s example of kind of errors i’m getting when try invoke servlet utilizes 1 of these data objects: example 1: root cause java.lang.error: unresolved compilation problems: import com.alpine.data.http.image cannot resolved postimageresponse cannot resolved type postimageresponse cannot resolved type</pre> but class there in jar file ... com/alpine/data/http/image/postimage/response/postimageresponse.class example 2: java.lang.err

xamarin.android - MvvmCross Android Dialog - behaviour of nested RootElements -

i'm confused capabilities of mvvmcross dialog builder code. i have settingsview inherits basesettingsview. the following code, on ios, shows dialog single section. when section clicked on, produces panel has section in rootelement: root = new rootelement("settings") { new section() { (element) new rootelement("location settings") { new section("details") { new entryelement("name", "location name"), }, }, } }; however, on android, settingsview has same code, when section clicked on, no other panel or view appears. wondering whether possible have sort of "nested view" on android, or whether should creating click handler

javascript - Getting Compiled HTML from AngularJS -

i'm having trouble getting compiled html of page in angularjs. here's code: js: <script src="http://code.angularjs.org/1.2.0rc1/angular.min.js"></script> <script> var app = angular.module('main', []); app.directive("compile", ['$compile', function ($compile) { return { link: function(scope, elem, attr){ var compiledhtml = $compile(elem.contents())(scope); console.log(compiledhtml); var returnstring = ''; for(i=0; i<compiledhtml.length; i++) returnstring += compiledhtml[i].outerhtml; console.log(returnstring); } }; }]); </script> html: <html ng-app="main" compile> <body> {{3 + 4}} </body> </html> what strange in first console.log(),

Ant error: <buildfile> is not an absolute path -

i'm trying use ant 1.7 running problem. in current directory, have build file called warupdate.xml. within directory, execute: /opt/apache-ant-1.7.0/bin/ant -f warupdate.xml i following error: buildfile: warupdate.xml build failed ./warupdate.xml not absolute path any ideas? thanks! matt why name other build.xml ? it's standard, ant expect , can run ant directory without specifying build file.

ember.js - Ember Data: Automatically set belongsTo association -

i using ember data 1.0 (beta 1) , confused default behavior of associations in ed. assume book model has many ( hasmany ) chapters each chapter belonging ( belongsto ) book. expectation instances of book's chapters property automatically have reference book instance through belongsto association, appears not case. is indeed default behavior in ember data or overlooking something? if indeed default behavior, mean need create custom serializer accomplish this? no ember-data not should possible achieve. in both cases ember-data sideload properties. (in past versions setup mapping embedded, no longer can this) in example have following: app.book = ds.model.extend({ chapters: ds.hasmany('chapter') }); app.chapter= ds.model.extend({ book: ds.belongsto('book') }); once setup ember-data default data structured this: { "book": { "id": "1" "chapters": ["1", "2

Rails 4, Devise Routes -

i've created custom routes route devise login , logout paths: devise_scope :admin "logout" => "devise/sessions#destroy", as: :logout "login" => "devise/sessions#new", as: :login end this works. problem if the login fails redirects admins/sign_in instead of /login . any ideas? according this answer , this description , seems proper way achieve you're attempting make use of :path_names option. according description devise wiki: devise_for :admin, :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'} will create normal admin routes you, , assign /sign_in , /sign_out route /login/ , /logout respectively. using :path option, can further alter url, such using :path=>"admins" yield routes /admin/login , etc.

vb.net interface signature syntax -

this code below makes vs complain 2 things: icomparer interface must implement compare(...) implements... not valid within method/multiline lambda (inside function). so what's wrong it? signature correct, making function lambda oneliner didn't help. it's same syntax in documentation anyway: public class colorsorter : implements collections.icomparer public function compare(x object, y object) integer implements collections.icomparer.compare dim cx drawing.color, cy drawing.color dim hx single, hy single, sx single, sy single, bx single, single cx = directcast(x, drawing.solidbrush).color cy = directcast(y, drawing.solidbrush).color sx = cx.getsaturation() sy = cy.getsaturation() hx = cx.gethue() hy = cy.gethue() bx = cx.getbrightness() = cy.getbrightness() if hx < hy : return -1 elseif hx > hy : return 1 else if sx < s

Suffix array DC3 algorithm -

i going on dc3 algorithm, linear time algorithm construction of suffix arrays. unable understand technique in paper can found here . i unable understand how renaming, mentioned on page 6 of paper, done. how renaming done per step 1. relevant section of code appendix is: for (int = 0; < n02; i++) { if (t[sa12[i]] != c0 || t[sa12[i]+1] != c1 || t[sa12[i]+2] != c2) { name++; c0 = t[sa12[i]]; c1 = t[sa12[i]+1]; c2 = t[sa12[i]+2]; } if (sa12[i] % 3 == 1) { r[sa12[i]/3] = name; } // write r1 else { r[sa12[i]/3 + n0] = name; } // write r2 } please me understand portion. (this code page 20 of pdf) after radix sort, adjacent element in sa12[] may equal, there if in loop, r1 , r2, give example: original array [y b b d b b d o], n = 12, index range [0,11] r1 = [1,4,7,10] r2=[2,5,8,11], "if (sa12[i] % 3 == 1) " indicates sa12[i] belong r1, else belong r2, r concentration of r1 ,

java - Why doesn't the MOVE_CURSOR show up on OSX Mountain Lion? -

i'm working on project , want see each of cursors provided swing like. public class test { public static void main(string args[]){ jframe frame = new jframe(); frame.setcursor(new cursor(cursor.move_cursor)); frame.setsize(400, 400); frame.setvisible(true); } } however, when use crosshair cursor works. frame.setcursor(new cursor(cursor.crosshair_cursor)); when mouseover frame, shows default cursor. doesn't change move cursor. cursor implementations platform dependent?

ios - Changing a Table View Controller to a View Controller -

Image
i have table view controller displays information using json. want change styling of app, , don't want have "table" view has now. whats easiest way change table view controller regular view controller, biggest problem have code uses tableview , dont know how work regular view controller. i using storyboard tableviewcontroller thats linked controller called upcomingreleasesviewcontroller. i want app: to this: my original answer assuming wanted convert uitableviewcontroller uiviewcontroller . looking @ screen snapshots, infer want switch uitableviewcontroller uicollectionviewcontroller (which ios 6 feature allows precisely want). in case, change base class uicollectionviewcontroller , , replace uitableviewdatasource methods uicollectionviewdatasource methods. , redesign scene using collection view controller. see collection view programming guide more information. or see wwdc 2012 sessions introducing collection views or advanced collection vie

asp.net mvc using ajax, but the callback won't redirect -

i'm using ajax 2 different partial views in same parent view. ajax request submitted successfully, , onsuccess() function called, page won't redirect. here's code. i've made sure returnurl absolute address. view: @{ viewbag.title = "log in/register"; } <hgroup class="title"> <h1>@viewbag.title.</h1> </hgroup> @section customscripts { <script type ="text/javascript"> function onsuccess(){ var returnurl = @viewbag.returnurl window.location = returnurl } </script> } <section id="loginform"> @{ if(!websecurity.isauthenticated){ <h2>use creative works account log in.</h2> @html.action("_loginpartial", new {returnurl = viewbag.returnurl }) } } </section> <section id ="registerform"> @{ if(!websecurity.isauthenticated){ <span>don't have account? make one!</span> @html.action(&

r - Error in Parts of Speech Tagging using openNLP -

i have ubuntu quantal 12.10 server 64-bit instance. using opennlp pos tagging of sentences. i using pos tagging using opennlp “parallel lapply setup”. running fine in rstudio environment. in ubuntu environment showing following error. error in do.call(c, clusterapply(cl, x = splitlist(x, length(cl)), fun = lapply, : second argument must list any suggestion problem i’m facing? this code using: tagpos <- function(x, ...) { s <- as.string(x) word_token_annotator <- maxent_word_token_annotator() a2 <- annotation(1l, "sentence", 1l, nchar(s)) a2 <- annotate(s, word_token_annotator, a2) a3 <- annotate(s, pta, a2) a3w <- a3[a3$type == "word"] postags <- unlist(lapply(a3w$features, `[[`, "pos")) postagged <- paste(sprintf("%s/%s", s[a3w], postags), collapse = " ") list(postagged = postagged, postags = postags) } cl <- makecluster(mc <- getop

android - How to get the weekday of a Date? -

i want day of week java date object when have array of date in string me. simpledateformat sourcedateformat = new simpledateformat("yyyy-mm-dd"); public string[] temp_date; public int[] day = new int[5]; date[] d1= new date[5]; calendar[] cal= new calendar[5] try { d1[i]= sourcedateformat.parse(temp_date[i].tostring()); cal[i].settime(d1[i]); // not compiling line..showing error on line day[i]= cal[i].get(calendar.day_of_week); } catch (parseexception e) { e.printstacktrace(); } does know answer this? you can day-integer that: calendar c = calendar.getinstance(); c.settime(yourdate); // yourdate object of type date int dayofweek = c.get(calendar.day_of_week); // example return 2 tuesday if need output "tue" rather 2, instead of going through calendar, reformat string: new simpledateformat("ee").format(date) (ee meaning "day of week, short version") taken here: how determine

java - For Loop checking player locations -

this bukkit plugin, minecraft, using api. i'm trying check if player in specified location, , if are, don't teleport player there. instead, check location, , spawn player there if it's empty. it may better explained code below: player player = (player) sender; list< player> prisoners = new arraylist< player>(); (int = 0; < prisoners.size(); i++) { //loc(1-12) coords in form of location variable. wanted save room. if (!(loc1 == prisoners.get(i))) { player.teleport(loc1); } else if (!(loc1 == prisoners.get(i).getlocation())) { player.teleport(loc2); } else if (!(loc2 == prisoners.get(i).getlocation())) { player.teleport(loc3); } else if (!(loc3 == prisoners.get(i).getlocation())) { player.teleport(loc4); } else if (!(loc4 == prisoners.get(i).getlocation())) { player.teleport(loc5); } else if (!(loc5 == prisoners.get(i).getlocation())) { player.teleport(loc6); } else if (!(

css3 - Create A responsive Pear Shape using CSS or responsive Images -

for project have create pear-shaped container. tried doing using css3 rounded corners doesnt it. used image @ bottom, need responsive (scalable image). i want code like: http://tinypic.com/view.php?pic=98fxid&s=5 but minimize browser screen, layout breaks , pear shape not scalable. know if there way using css3 or better way using scalable images. by way, i'm using bootstrap , first attempt @ making website using bootstrap, guidance appreciated. you create pear shape using 2 intersecting circle segments, 1 left-hand side , 1 right-hand side. circle segments created limiting circle parent container via overflow: hidden; . simplify markup, can create child circle elements using :before and/or :after pseudo elements. html: <div class="content-form"> <div class="pear-shape left"></div> <div class="pear-shape right"></div> </div> css: .content-form { width: 75%; max-width:

Get Android Updated Application -

i have been searching around site , google couple of hours now, , can't find this. maybe because use wrong search terms, don't know. i making application list app of mine, , part easy enough. problem when come across updated system application, need information original package file (the 1 in /system/app rather updated 1 in /data/app), information version , file name. now, extract root /data/system/packages.xml, thought there might better native solution using packagemanager rest of application list?

javascript - Using Ajax with JSF command button or form -

i might not tackling issue correctly, here going on. have few restful webservices want call. code call them in javascript. called so: <h:body onload="smainit();"> <h:form onsubmit="smasignup();"> whenever page loads, make 2 ajax calls. these calls succeed. want make 2 more ajax calls whenever form submitted. however, these calls fail. not see errors firebug, stuck happening. to elaborate on mean when fail, in netbeans, have breakpoints rest calls. hit breakpoints when onload event triggered. not hit breakpoints when onsubmit event triggered. my theory right ajax calls dont work on page submit. correct? page changing cause ajax calls killed before can finish? anyway, insight good. here javascript being called: function geturlvars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) { vars[key] = value; }); return vars;

c# - Refresh a listbox to display new values -

this newb question i'm sorry. i'm filling out text box values im grabbing on line , passing them listbox so: // textbox1.text = test.tostring(); string[] names = result.split('|'); foreach (string name in names) { listbox1.items.add(name); } however i'm trying click on folder , have files displayed there shown in listbox1. i've tried: using (var testy = new webclient()) { test = testy.downloadstring("http://server.foo.com/images/getdirectorylist.php?dir=test_folder"); string[] names1 = test.split('|'); foreach (string name in names1) { listbox1.items.clear(); listbox1.items.add(name); listbox1.update(); } } but happens listbox empties , doesn't refreshed. how can achieve want do? your lines foreach (string name in names1)

scalac - How can I find a description of scala compiler flags/options? -

how can find of flags latest scalac version? after googling hours have found outdated docs . (for example, don't mention "-feature" flag). is there way obtain list of compiler flags descriptions scalac, or else? the closest have been able find relevant source files compiler. unfortunately options spread among several files. of writing, breaks down so: standardscalasettings (for basic flags) scalasettings (for advanced flags) these of course current development version of compiler, if want options specific version of scalac , you'll need use "branch" drop-down menu view correct version tag.

Parallel sieve of Eratosthenes - Java Multithreading -

i wanted write sieve of eratosthenes work using specific number of threads. figured out, work in following way: 2 threads 17. thread-1 takes 2, , starts remove multiple of 2 list. parallel thread-2 takes 3 , same. after thread-1 takes 5( because there no 4 in list) , thread-2 takes 7 , on until reach end. wrote following piece of code: private list<integer> array = new arraylist<integer>(); private list<integer> results = new arraylist<integer>(); public synchronized void run(){ while(array.size() > 0){ integer tmp = array.get(0); for(int = 1; < array.size(); i++){ if( (array.get(i).intvalue() % tmp.intvalue()) == 0) array.remove(i); } results.add(array.get(0)); array.remove(0); } } public void setarray(int x){ for(int = 2; < x; i++) array.add(integer.valueof(i)); } public void printarray(){ for(integer i: results){ system.out.println(i); } }

python - How to get input from SocketServer MyTCPHandler to another class -

i trying input mytcphandler class network in following program. ideally like, example, take self.data mytcphandler , change self._title in network. usual, apologize simple question, new classes in python , struggling bit one. help! from tkinter import * import time import math import lockfile import functions import socketserver import threading class network(frame): """ implements stop watch frame widget. """ def __init__(self, parent=none, **kw): frame.__init__(self, parent, kw) host, port = "192.168.2.3", 9999 self._server = socketserver.tcpserver((host, port),mytcphandler) t = threading.thread(target=self._server.serve_forever) t.setdaemon(true) t.start() self._title="hello" self.makewidgets() def makewidgets(self): """ make

magento - Updating custom block in CMS page -

i'm having bit of trouble understanding how update custom block include in cms page. i using standard shortcode in cms page, works fine: {{block type="catalog/product_list" category_id="16" template="catalog/product/slider_list.phtml"}} i trying set column count of custom custom block, i've found need following piece of code: <block type="catalog/product_list" name="catalog.product.slider_list" template="catalog/product/slider_list.phtml"> <action method="setcolumncount"><columns>4</columns></action> </block> i'm not sure under <reference /> block should place code... looked in catalog.xml, , if try place between <reference name="root" /> , not correct behavior. thank you. edit: use of incorrect terminology; calling block static, in fact custom block. if want call on home page reference name should in local.xml or

javascript - Node sequelize callback promises expect a function, is there a method for removing declared function with a function call -

i'm having issue node sequelize library. when using success promise shown below: for (index = 0; index < models.length; index++) { model = models[index]; model.drop().success(function() { droptablecompletecheck(); }); } jshint complains , rightly highlights code issue "don't make functions within loop". overcome issue i've tried replacing above code following: for (index = 0; index < models.length; index++) { model = models[index]; model.drop().success(droptablecompletecheck()); } this removes jshint issue, node sequelize throwing following uncaught exception: error: uncaught application error: typeerror: listener must function i'm trying call function on success promise callback, , remove jshint issue @ same time. there way of doing both, i'd happy pointers. thanks time. omit parentheses: for (index = 0; index < models.length; index++) { model = models[index]; //don't _i

opencl - Is there a good way to choose the right platform on the fly? -

because computer using has amd, nvidea, , intel platforms. how can know right platform use on users computer? have loop tries create platform, device, context, , queue every platform. if fails @ point tries next platform. readkernel(); numplatforms = getnumplatforms(); test platforms = getplatforms(); test for(int = 0; < numplatforms; i++) { numdevices = getnumdevices(platforms[i]); test_and_continue devices = getdevices(platforms[i], numdevices); test_and_continue context = createcontext(platforms[i], devices); test_and_continue queue = getcommandqueue(context, devices[0]); test_and_continue // setup. can post info here -> getdeviceinfo(devices[0]); break; } program = createprogram(context, source); test buildprogram(program); test kernel = buildkernel(program, appname); test is way or there better way? as usual kind of question, answer is: depends on need. or in other words,

python - Django ModelChoiceField has no plus button -

i'm making django app custom users. i've outlined key components of problem below, missing code denoted '...'. custom user model has foreign key relationship follows: class mycustomuser(models.abstractbaseuser, models.permissionsmixin) ... location = models.foreignkey(location) class location(models.model) name = models.charfield(max_length=50, blank=true, null=true) i've written custom user form includes field follows: class mycustomusercreationform(models.modelform) ... location = forms.modelchoicefield(location.objects.all()) this appears working correctly, however, there no plus button right of select field location. want able add location when create user, in same way can add polls when creating choices in django tutorial . according to question , might not see green plus if don't have permission change model, logged in superuser permissions. idea i'm doing wrong? you need set relatedfieldwidgetwrapper wrapper

Git way of handling floating branch like in StarTeam -

in project have folder contains lot of data needs versioned. of time don't need it, do: $ git clone myrepo $ cd myrepo sometimes need latest stuff data branch, in it's own folder $ git checkout databranch -- datadir when checkout data branch, need latest stuff. data branch should not contain versioning of own content , master branch should not contain data branch stuff default. this sounds git-submodule, must keep contained in single repository. , i'd keep data-branch, when selected, floating on top of master starteam able (if recall correctly). is possible in git? kind of workflow suggest alternative? git checkout databranch -- datadir git rm -r --cached datadir and you're done.

Changing xDateFormat in highchart tooltip programatically -

i'm attempting change tooltip xdateformat programmatically. i'm calling: chart.tooltip.options.xdateformat = getdateformatstring(newvalue.timeinterval); chart.redraw(); however, that's not doing need do. i'm playing around jsfiddle (pardon lack of knowledge of jquery, i'm writing in angular). http://jsfiddle.net/2et8j/ thanks! here's example changes formatter instead of trying change xdateformat. http://jsfiddle.net/eyyh6/ $("button").click(function() { $(this).attr('disabled','disabled'); chart.tooltip.options.formatter = function() { var s = '<b>'+ highcharts.dateformat('%b %e %y %h:%m', this.x, true) +'</b>'; $.each(this.points, function(i, point) { s += '<br/>'+ point.series.name +': '+ point.y +'m'; }); return s; } }); edit: undocumented way change xdateformat

r - Nested data frame -

i have got technical problem which, seems, not able solve myself. ran estimation mcmcglmm package. results$sol access estimated posterior distributions. applying class() tells me object of class "mcmc". using as.data.frame() results in nested data frame contains other data frames (one data frame contains many other data frames). rbind() data frames within main data frame in order produce 1 data frame (or rather vector) values of posterior distributions , name of (secondary) data frame rowname., ideas? grateful every hint! update: didn't manage produce useful data set purpose of stackoverflow, these sampling chains these data sets large. if want me, please consider run following (exemplaric) model require(mcmcglmm) data(plodiapo) result <- mcmcglmm(po ~ plate + fsfamily, data = plodiapo, nitt = 50, thin = 2, burn = 10, verbose = false) result$sol (an mcmc object) chains stored. want rbind chains in order have vector values of posterior distributions , vari

Visual Studio--Alter Variable While Debugging -

is possible alter variable while debugging? say example have code: string x = "foo"; //would passed-in variable in real world. var y = "x equals " + x; ==>[breakpoint] return x; is there way manually enter or otherwise change value of "x" when hit break point? , possible "step back" in code in same way can press f11 , step through it? yes, there 2 ways change variable: use immediate window . typing x = "a new value" change it. also, if want check value of x use ?x you can hover on variable, , when value displays in quickwatch pop-up thing, click on manually change it. (you can add variable watch, or select quickwatch change it). if step different instruction, there 2 ways too: you can right-click on line want go , select ' set next statement '. works if have hit exception while debugging you can drag yellow arrow indicates current instruction wherever need

java - Netbeans, creating custom table model from drag and drop gui designer. -

i have application use inventory of items, trying add jtable jframe in code. have created extension of abstracttablemodel object called itemtablemodel . have dragged , dropped jtable onto designer view in netbeans respective jframe, , renamed m_jttable . public class itemtablemodel extends abstracttablemodel { inventory inv; int rowcount = 0; int colcount = 3; public itemtablemodel(inventory in) { inv = in; } @override public int getrowcount() { return inv.itemlist.size(); } @override public int getcolumncount() { return colcount; } @override public boolean iscelleditable(int row, int col) { return false; } @override public object getvalueat(int rowindex, int columnindex) { item = inv.itemslist.get(rowindex); object reto = null; switch(columnindex) { case 0: reto = (object)it.getitemnumber(); break;

reflection - how to make array with given name(string) in golang with reflect -

i want make array name in golang, got error here code package main import ( "fmt" "reflect" ) type struct{ name string id int } func main() { := &my{} mytype := reflect.typeof(my) fmt.println(mytype) //v := reflect.new(mytype).elem().interface() // want make array //a := make([](mytype.(type),0) //can compile //a := make([]v.(type),0) ////can compile fmt.println(a) } i believe you're looking for: slice := reflect.makeslice(reflect.sliceof(mytype), 0, 0).interface() working example: http://play.golang.org/p/jiyluu52ae as side note, in cases nil slice more suitable 1 capacity zero. if want nil slice, instead: slice := reflect.zero(reflect.sliceof(mytype)).interface()

php - Convert associative array to key=>value -

i have following array array ( [0] => array ( [id] => 5 [name] => 44 ) [1] => array ( [id] => 9 [name] => 55 ) ) i need convert to array( '5' => '44', '9' => '55' ) i tried function of arrays php.net not figure out how it did try foreach ? $result = array(); foreach($yourarray $entry) { $result[$entry['id']] = $entry['name']; }

Why does jQuery.keydown not fire the first letter I type? -

why jquery.keydown not fire first letter type? http://jsfiddle.net/astrc/ <input id="foo" type="text"> <div></div> $("#foo").on('keydown', function(e){ $("div").text(this.value); }); i see fire on 2nd keydown press, not first. when keydown event being fired, value in textbox hasn’t changed yet. seems you’re looking input event anyways (use 'input keyup' backwards compatibility). updated fiddle

ios - Calling [UIImage imageWithData:xxx] multiple times -

my model comes core data. beans have images stored in model nsdata. to display images, need : [uiimage imagewithdata:bean.imagedata] is ok if everywhere ? mean, view #1 display image creating [uiimage imagewithdata:], go on view #2 need display same image, pass bean between 2 views, recreate uiimage [uiimage imagewithdata]. i wondering whether takes many cpu or memory if this... need manage cache myself ? think might quite common use case coredata there common pattern handle ? imagewithdata not cache image (as per docs, uiimage method cache imagenamed) here algorithm caching images, though.

ms access - How to make a query or macro to alter another table -

i have table in access 2007 has list of students , total unit score. i have query finds students unit values totalled less 17 (if have less 17 points cannot graduate). i have query finds students unit values totalled more 17 (they can graduate). how go adding column original table says whether graduate? basically have this: ______|student|___|points| johnny 18 markus 5 and want this: ______|student|___|points|___|graduation status|______ johnny 18 y markus 5 n how can achieve above? you can create 2 queries: adds column updates column y or n query add column alter table table_name add column gradution_status text query update newly added column y or n update table_name set graduation_status = iif (points < 17, "n", "y") if accidentally ran both queries 2 times, first inform there field existing in table. query stop there, no harm done. 2n

android - Facebook ProfilePictureView did not goes blank after logout -

i trying make make app integrated facebook , followed instruction facebook. however, "profilepictureview" did not return blank after logout. there ways "blank" profilepictureview or don't provide such function? my code following: package com.nick.militarycounter; import android.app.activity; import android.app.alertdialog; import android.content.intent; import android.os.bundle; import android.util.log; import android.widget.button; import android.widget.edittext; import android.widget.textview; import com.facebook.facebookauthorizationexception; import com.facebook.facebookoperationcanceledexception; import com.facebook.request; import com.facebook.response; import com.facebook.session; import com.facebook.sessionstate; import com.facebook.uilifecyclehelper; import com.facebook.model.graphuser; import com.facebook.widget.loginbutton; import com.facebook.widget.profilepictureview; public class registeractivity extends activity { private static final s