Posts

Showing posts from May, 2011

c# - .NET OData Web api -

i have 2 ways use model generated entity framework. can not find use when , why. method 1 odataqueryoptions<key_result> options (passed function argument) private odataquerysettings settings = new odataquerysettings(); iqueryable<key_result> result; try { result = options.applyto(dataaccessfunction.key(keyids), settings) iqueryable<key_result>; } method 2 iqueryable<log> result; try { result = accessmodel.log; } so far, have used them in code without knowing correct or why both used. can't find material me too. also, first 1 using in odata endpoints created using table valued functions in sql while second 1 using endpoints created using simple tables , views. but if entity framework consistent, shouldn't matter. , should able use 2 approaches interchangeably. can used interchangeably, difference makes them preferred 1 situation (table value

tfs - Ability to vote on User Story? -

i stake holders able vote on user stories or features in tfs 2013 (or 2015 if coming?). end result can see how interest there in given idea , prioritize work. seems should implemented not sure called able search it. is feature in tfs? can extend tfs this? or there 3rd party product can integrate tfs , provide this? thanks you can integrate uservoice this. there feature called service hooks allows trigger integration them , allows same http://visualstudio.uservoice.com you extend tfs simple voting webpage , single numeric field. or "hot or not" implementation provide data alternative.

java - Android: How to find width and height of screen? -

i trying find width , height of screen none of ways have tried work in class created, code below. does know how find it? cannot use way trying below because .getwidth() deprecated? public class crate { public int acrosscrate; public int updowncrate; context thecontext; windowmanager wm = (windowmanager)thecontext.getsystemservice(context.window_service); display display = wm.getdefaultdisplay(); int width = display.getwidth(); public crate() { acrosscrate = 650; updowncrate = 650; //int width = ; //int height = ; } } use below code private int getscreenheight(context context) { int height; if (android.os.build.version.sdk_int >= 13) { windowmanager wm = (windowmanager) context.getsystemservice(context.window_service); display display = wm.getdefaultdisplay(); point size = new point(); display.getsize(size); height = size.y; } el

settimeout - Remove childElements one-by-one in pure JavaScript -

i have: <div id="alerts"> <div class="alert">alert 1</div> <div class="alert">alert 2</div> </div> and want remove these alerts one-by-one after 4000 ms interval of 500 ms in pure javascript . i have this: window.onload = function(){ alerts = document.getelementbyid( 'alerts' ); if( alerts ){ alert = alerts.getelementsbyclassname( 'alert' ); settimeout( function(){ for( var i=0; < alert.length; i++ ){ ( function( ){ settimeout( function(){ alerts.removechild( alert[i] ); }, 500); } )(i); } }, 4000); } } i think not right way of using settimeout . the getelementsbyclassname returns live collection means when selected element removed or changed in dom referred collection changes. so in example when

choose the proper clustering method for Latent Semantic Analysis -

i want cluster text document find document same concept. i've done semantic similarity using latent semantic analysis (lsa), confuse clustering method should choose purpose . thank you you can use hierarchical clustering. there package in r called rclusterpp efficient hierarchical clustering of large data (it parallel computation). can cut dendrogram tree different number of cluster within possible range , check cluster profiles using cross-tab.

bash - ssh script to connect to server -

i have basic script file.sh connects server name=username routerip=172.21.200.37 echo "$name""@""$routerip" ssh "$name""@""$routerip" sample output: $ ./file.sh username@172.21.200.37 username@172.21.200.37's password: what wondering how best handle password requested in script. should use expect ? or there way. if password in script should encrypted security? and maybe silly question but, there way connect server haveing username? if care security, don't want embed password in script. , can't "encrypt" password, either, because script have know how decrypt it, , reading script see how did (and decryption key was, etc.). if have script running on machine authorized log in machine b, way i've done set private ssh key on machine a, , put public key in user's authorized_keys file on machine b. (in answer last question, no, there's no way sort of login without userna

Javascript iMacros nested while loop (two loops in macro) -

i have been trying loop inside of loop work. mean i'm going multiple pages in website, clicking links in table , extraction information next page after following link. i've found question here http://www.stackoverflow.com/questions/18402012/nested-loop-in-imacros-2nd-loop , yet can not work me. problem happening @ "while(true)" or "n = 1" section think. code looks this: const l = "\n"; var macro; macro = "code:"; macro += "set !errorignore yes" + l; macro += "set !datasource dailycitysummaries.csv" + l; macro += "set !datasource_line {{i}}" + l; macro += "set !waitpagecomplete yes" + l; macro += "set !extract_test_popup no" + l; macro += "url goto=http://{{!col1}}" + l; macro += "frame f=0" + l; macro += "tag pos=1 type=a attr=href:/page/results.cfm?type=location=* extract=txt" + l; macro += "saveas type=extract folder=/root/desktop/ file=ci

Update an array php mysql -

i'm trying update in database 2 array depends on each others. want know if possible use foreach() update data? [reponse] => array ( [0] => reponse 1 [1] => reponse 2 [2] => reponse 3 ) file.php foreach ($reponse $key=>$value) { $values= mysql_real_escape_string($value); $valuesch= mysql_real_escape_string($chimp[$key]); $query2 = mysql_query("update reponses set nom_reponse=$values,id_categorie='$categorie',correct='$valuesch' id_question='$id_question' ") or die(mysql_error()); } if ($query2) { echo "<br><div class='alert alert-info alert-dismissable'><button aria-hidden='true' data-dismiss='alert' class='close' type='button'>×</button>"; echo "reponse modifer avec succes!! "; echo "</div> "; } else { echo " erreur reponse!! "; } i w

how to use SIFT features for bag of words in opencv? -

i have read lot of articles implementing bag of words after taking sift features of image, i'm still confused next. do? thank in advance guidance. this code have far. cv::mat mat_img = cropped.clone(); mat grayforml; cvtcolor(mat_img, grayforml, cv_bgr2gray); iplimage grayimageforml = grayforml.operator iplimage(); //create copy of iplgray iplimage *input = cvcloneimage(&grayimageforml); mat matinput = cvarrtomat(input); // mat matinput = copy_gray.clone(); cv::siftfeaturedetector detector; std::vector<cv::keypoint> keypoints; detector.detect(input, keypoints); //add results image , save. cv::mat output; cv::drawkeypoints(input, keypoints, output); //sift output result //resize , display cv::mat output_reduced; cv::resize(output, output_reduced, cv::size2i(output.cols / 2, output.rows / 2)); imshow("sift result", output_reduced); training bag of words system goes follows: compute features each image of training set cluster featur

linux - How to find out the user of parent shell inside a child shell? -

suppose user of parent shell foo . if run sudo -u bar -i , in child shell user bar . so, how can find out user of parent shell inside child shell? namely, in case above, how can know user of parent shell foo ? update understand that, hack, possible achieve using ps . however, more interested in less hacky , more standard way, if possible. update 2 answers, resorted following solution: # parent shell, user foo $ sudo -u bar -i parent=foo # child shell, show parent user foo $ ps u -p $ppid | grep parent | cut -d= -f2 you can use $ppid variable assist along command or two: #!/bin/bash user=`ps u -p $ppid | awk '{print $1}'|tail -1` echo $user

google cloud datastore - Comparing two different properties in GQL -

Image
the following 2 gql queries work: select * customer firstname = "john" select * customer rating > 4.0 but, when combine them... select * customer firstname = "john" , rating > 4.0 ... empty result set though running queries individually finds entity looking for. how compare more 1 property? here's i've done: i made sure @ least 1 entity exists both true. i created index properties: patrick costello @ google answered question: you need index on (firstname, rating). current index cannot answer query. basically, problem created index on properties. however, each "type" of query (in case, query comparing firstname , rating) needs own index (i.e. index firstname , rating). hope helps someone!

dynamic - Call a python variable that runs a function which returns a variable for the original python variable -

i'm trying create variable when call or use variable, runs function stuff , return variable. example make more sense: def establish_client(): = none if true: = 'a' return >>> print establish_client 'a' it possible this? there way of running method , returning without using parenthesis? in general case: no. but there techniques might come close. properties allow members in object. class demo(object): @property def establish_client(self): = none if true: = 'a' return d = demo() print d.establish_client but properties don't work local or global variables. also can use __str__ string conversion, works when need behavior when variable used in way converts string. not case. see mescalinum answer how that.

javascript - Angular routes for a detailed view, using Foundation -

problem new angular , i'm using "foundation apps: building business directory in angular. i'm looking create routes detailed view each of businesses, http://localhost:8080/nameofbusiness . i've been reading angular docs , this example pretty i'm trying do, i've tried using in similar snippet (see below) app.js , doesn't seem compiling correctly. github: https://github.com/onlyandrewn/angular snippet phonecatapp.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/phones', { templateurl: 'partials/phone-list.html', controller: 'phonelistctrl' }). when('/phones/:phoneid', { templateurl: 'partials/phone-detail.html', controller: 'phonedetailctrl' }). otherwise({ redirectto: '/phones' }); }]); app.js 'use strict'; var myapp = angular.module('application',

java - error about returning a string from a String method -

this question has answer here: how convert number words in java 23 answers why getting error in both of these methods 'this method must return type string...when returning type string. trying stupid ninety-nine bottles of beer on wall question i'm sure had learning java. in book instead of outputting numbers (ie.99) has print out words(ninety-nine). tried break down in these 2 methods, saying needs return string , are. had them bracketed out, nothing changed. public string rounds() { if(beer>89) return "ninety"; else if(beer>79) return "eighty"; else if(beer>69) return "seventy"; else if (beer>59) return("sixty"); else if (beer>49) return ("fifty"); else if (beer>39) return("forty"); else if(beer>29)

ios - save a label from Xcode to a user in parse using swift -

im trying save label app user class thats created parse when use sign , sign in format. i've tried multiple different ways can't seem find away save data user section. class name user , i'm trying save label column labeled score in user class. code last thing tried do. @iboutlet weak var label: uilabel! override func viewdidload() { super.viewdidload() var gamescore = pfobject(classname:"_user") gamescore["score"] = self.label.text gamescore.saveinbackgroundwithblock { (success: bool, error: nserror?) -> void in if (success) { } else { } } if me awesome because i'm beyond stumped on this. tried looking on google , youtube , going through parse docs on way but, can't seem figure out. have checked if object saving? what saving user class use pfuser.currentuser() obtain user table , save object there. let currentuser = pfuser.currentuser(); currentuser.setobject(self.label.tex

c# - Constructing my own HttpRequest object -

firstly let me state we not using iis our web server , not intend to, please no answers telling me use iis. application working on's strength not require iis server installed. secondly, not making request (i'm not client), server , accepting requests via 3rd party embedded lightweight web server. to keep things .net based , don't have reference 3rd party web server library dynamically loaded modules, use system.web namespace iis uses, it's there in .net. what having problems cannot create own system.web.httprequest object, nor can extend own (it's sealed) overcome problem. how build system.web.httprequest object can translate information (such headers, cookies, contenttypes, etc) 3rd party web server's handled requests .net framework version? you can use constructor internal httprequest(httpworkerrequest wr, httpcontext context) . pry open using reflection. have manufactore other objects well. httpworkerrequest made inherited from

Is this an appropriate use of const qualifiers in C? -

i have simple vector implementation in c, holds array of void*. it's user take care of actual type. i want 'promise' vector not alter contents, store data as: struct _vector{ uint32 used; uint32 size; const void** arr; }; i don't know if it's considered "overdoing it" constness correctness, try maintain const correctness accessors/modifiers: void vector_add(vector *v, const void* const elem); void vector_set(vector *v, const uint32 idx, const void* const elem); when return element vector, pointer user's data let user modify data being pointed to, casting away constness in internal array. void* vector_get(const vector *v, const uint32 idx){ if ( idx >= v->used ) exitaterror("vector","array out of bounds"); return (void*)v->arr[idx]; } instead of returning const void* , return void* instead. idea internally, want ensure not changing data being pointed to, don't care happe

CGAL way for storing are retrieving geometric information a for full cell in the triangulation -

i'm planning on using cgal triangulation , delaunay triangulation classes backbone geometric structure robot motion planning algorithms. main difficulty have encountered far in assigning geometric data full cells in abstract complex. example, in order find shortest path through full cell need compute set of normal vectors facets. purpose, use expensive pseudo inverse procedure. since, these computations have done several times in each full cell, prefer store data once computed, , retrieve during successive computations. in addition, store collision data each full cell instead of recomputing on again after refining given triangulation. browsing answers here , trying understand structure of cgal, reached understanding on subject: it bad idea rewrite geometric kernel this... i've seen examples of using vertex base class info in points augmented indices here . although using triangulation_cell_base_with_info seems easy workaround, consider inelegant hack because requires

symbolic math - Multifold integration with Matlab -

this question may seem silly cannot find way solve myself. need multifold integrations (at least 4 fold) range infinite matlab, , did not found suitable functions. for example, how should following integral: integrate[f(x,y,z,w),{x,-\infty,\infty},{y,-\infty,\infty},{z,-\infty,\infty},{w,-\infty,\infty}] where function f may defined as f=1/(x-y)*1/(z-w) exp(-0.25 (x^2+y^2+z^2+w^2)) in matlab, 1 needs add dot behind arguments function can executed, confused about. i appreciate if help. i assume mean symbolic integration. that define symbolic variables . define function of symbolic variables. apply int repeatedly integrate respect each variable. assumes function satisfies hypotheses of fubini's theorem (which example function). so: >> syms x y z w %// step 1 >> f = exp(-x^2-y^2-z^2-w^2) %// step 2 f = exp(- w^2 - x^2 - y^2 - z^2) >> f = f f = exp(- w^2 - x^2 - y^2 - z^2) >> f = int(f,

Trying to show/hide an element when clicked using JavaScript and jQuery -

im trying use if/else statement show/hide element when button clicked. problem have when code runs element gets shown , hides again. code in if block , else bock both executing. <html> <head> <meta charset="utf-8"> </head> <body> <section class="variation"> <h2 id="btn">show , hide</h2> <div class="maincontent"> <p>nam tincidunt erat et purus porttitor bibendum.</p> </div> </section> <script type="javascript"> var $maincontent = $('.maincontent'); var $variation = $('.variation h2'); $maincontent.hide(); $('#btn').click(function() { if ($maincontent.css('display') == 'none') { $maincontent.show('fast'); } e

2d - Flash CC Make layer invisible by using the code? -

i trying make 2d shooter game , need make bullet image invisible while not being shot. possible? if not, there other way make bullet? notice: bullet png image, not rectangle or sphere. if put image in movieclip, can access via actionscript , like: bullet.visible = false;

dplyr and lubridate chain crashing r -

i'm stuck why following code crashing r on machine (both in rstudio , basic r gui) - appreciated! library(dplyr) library(lubridate) dates <- data.frame(date = seq(ymd('2015-01-01'),ymd_hms('2019-06-20 23:00:00'),by = "hour")) # run section few times (simulate many calls in shiny app) for(i in 1:10) test_df <- dates %>% mutate(month = month(date), year = year(date)) my session info: r version 3.1.3 (2015-03-09) platform: x86_64-w64-mingw32/x64 (64-bit) running under: windows 7 x64 (build 7601) service pack 1 locale: [1] lc_collate=english_united states.1252 lc_ctype=english_united states.1252 lc_monetary=english_united states.1252 [4] lc_numeric=c lc_time=english_united states.1252 attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] lubridate_1.3.3 dplyr_0.4.2 loaded via namespace (and not attached): [

javascript - Verifying input to form -

i’m trying add additional verification requirement form works correctly. right javascript checks make sure form has following values before submitted. a first name must entered field. a last name must entered field. an id number must entered here. value must begin “v” followed “0” (zero) followed 7 numbers. a user name must entered field. my concern #3. i’d add additional requirement produces dialog message if value of field not begin “v” followed either “0” or “9” , followed 7 numbers. for example, these values work: v01234567 v91234567 these not work: v0wewewew v11234567 i have tried changing: if(rid.charat(0) != 'v' || rid.charat(1) != '0'){ to this if(rid.charat(0) != 'v' || rid.charat(1) != '0' || rid.charat(1) != '9'){ but doesn’t work. i appreciate help. thanks, mike <script type="text/javascript"> function checkrequired(which) { var fn = document.getelementbyid("fn")

Wait 20 Seconds In Timer Before Executing Next Line Without Thread.Sleep.C# -

i'm trying wait 20 seconds before adding + 1 value (int), want without thread.sleep . this code, way i'm not pro programmer. private void refresh_app_timernh_tick(object sender, eventargs e) { label18.text = "timer activated"; int = 0; = + 1; if (i == 16) { = 0; } else { } if (i == 1) { webbrowser1.refresh(); useridlabel1.backcolor = color.red; label20.text = "+1"; //**i want add 20 second gap here** = + 1; } else { } if (i == 2) { webbrowser2.refresh(); useridlabel2.backcolor = color.red; label20.text = "+2"; = + 1; } else { } if (i == 3) { webbrowser3.refresh(); useridlabel3.backcolor = color.red; label20.text = "+3"; = + 1; } else { } if (i == 4) { webbrowser4.refresh(); useridlabel4.bac

Kotlin JS - Accessing HTML DOM properties -

what canonical way access html dom properties in kotlin. don't see of dom properties offsetheight & offsetwidth exposed in element var e : element? = document.getelementbyid("text") e.offsetheight //error just cast e htmlelement , gets properties expect. (e htmlelement).offsetheight it not feature of kotlin, found in normal js documentation: https://developer.mozilla.org/en-us/docs/web/api/htmlelement/offsetheight also you right ask 'canonical' way things, since kotlin quite different javascript internally. here how code snippet: val e = document.getelementbyid("text")!! htmlelement e.offsetheight use val instead of var in code. states fixed reference , allows code optimizations. http://kotlinlang.org/docs/reference/properties.html#properties-and-fields don't use nullable types element? if don't need it. in case may pretty sure dom structure, getelementbyid("text") must return element, not null. p

vb.net - referencing a dll in a windows service -

i wrote opc client using interop.opcautomation.dll. wrote windows form in vb 2010 express. working well. wanted make windows service though. problem having not connect opc server when run service. following exception "object reference not set instance of object.- opc connect error" exception @ end of code trying connect. below code. input, appreciated. imports system.serviceprocess imports system.threading imports system.text imports system.windows.forms imports system imports system.io imports system.io.file imports system.net imports opcautomation public class service1 inherits system.serviceprocess.servicebase dim withevents opcserver opcautomation.opcserver dim withevents connectedgroup opcautomation.opcgroup dim batch string dim group string dim press string dim line string dim swidth string dim sheight string dim sbifold string dim score string dim startup integer dim ihandle integer dim serror string

html - Bootstrap 3 Navbar with Icons & Carousel -

i working on creating site bootstrap3. unfortunately, after watching many videos still having problems. i logo on navbar remain on left side (which have) , other additional icons links other area of page toward left - unfortunately have not figured out via html/css. please check out www.frobot.net see attempting emulate. essentially, there multiple icons next text. i white background navbar , have definitive bottom rather meshing rest of website, if makes sense. of right now, there not consistent horizontal white area navigation tools. i set carousel 3 images , first image appears. can please point out issues in code? html: <!doctype html> <html> <head> <!-- website title & description search engine purposes --> <title>the best yogurt</title> <meta name="description" content="frozen yogurt"> <!-- mobile viewport optimized --> &

python - Is there a way to tell what makes a particular numpy array singular? -

i trying generate few large arrays, , @ least 1 ending being singular, made obvious familiar error message: file "c:\anaconda3\lib\site-packages\numpy\linalg\linalg.py", line 90, in _raise_linalgerror_singular raise linalgerror("singular matrix") linalgerror: singular matrix of course not want array singular, more interested in determining why array singular. mean have way answer following questions without manually checking each entry: is array square? (i believe returned separate error message, convenient, i'll include singularity property anyway) are rows populated zeros? are columns populated zeros? are rows not linearly independent of other rows? for relatively small arrays, first 2 conditions answered visual inspection. however, because arrays substantially large, not want have go in , manually check each array element see if of conditions met. i tried pulling linalg.py script see if see how determines matrix singular, not tell

vb.net - How to populate a ComboBox based on another ComboBox through SQL Server? -

this question exact duplicate of: how populate combobox based on combobox using connection string (sql server, vb.net) 1 answer i want able have 2 comboboxes 1 parent or owner of second one, through connection string on sql server. means whenever select value in first combobox , second combobox filter it's results display corresponding values related first combobox . if see code below, error states: error 1 method 'private sub cboclient_selectedindexchanged(sender object, e system.eventargs, envname string)' cannot handle event 'public event selectedindexchanged(sender object, e system.eventargs)' because not have compatible signature. goal: change database connection query proper user data correct database populate user combo box user data my code: private sub cboclient_selectedindexchanged(sender object, e eventargs, byval

postgresql - Can't generate database from .edmx (Npgsql 2.2.5/EF6) -

i can connect postgresql database fine (i generated .edmx way in first place), can't generate database .edmx. the error indicates no provider invariant name 'npgsql' has been found, , entityframework section of web.config should checked it, far can tell it's here. this asp mvc5 application, here's web.config: <configuration> <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <connectionstrings> <add name="pgarcher" connectionstring="host=localhost;database=archerie;user=postgres;password=***" providername="npgsql" /> <add name="archerieentities" connectionstring="metadata=res://*/archerieedm.csdl|res://*/archerieedm.ssdl|res://*/arc

java - issue while converting BigDecimal to Integer -

i'm facing problem while converting big decimal integer. process description is, first sending list of integers dao method validate whether integers valid proceed further. valid list of integers processed in place. core process list<integer> payments = dao.checkstatus(payments); //payments list of integer if(payments!=null){ //do other operation dao.changestatus(payments); //here payments list of integer got above dao method implementation checkstatus(list<integer> payments){ list<integer> finalpayments = null; //i have hibernate query details database string hql_query = "select a.py t_status a.status = 4 , (a.py=:payments)"; query query = session.createquery(hql_query); finalpayments = query.list(); return finalpayments; } in database py column bigdecimal one. in table defined number. type. while execution of query i'm getting bigdecimal values finalpayments list. there no error/exception. bigdeci

json - How to serialise many to one relationship from the many side hibernate jpa -

i have many 1 relationship in hibernate models. there many people 1 role. have model "schools" 1 many join people model. schools 1-* people *-1 role i want , post schools model, should contain list of schools many people each 1 role. can not serialise roles people. i need able serialise many 1 side (people-roles). when put @jsonmanagedreference on many 1 side, "404 validation error" trying post. when change jsonbackreference not serialised. i have tried using @jsonidentityinfo, after googling try bidirectional relationship. @jsonidentityinfo(generator = objectidgenerators.propertygenerator.class, property = "id") public class role { ... } however when put in both models infinite recursion , tomcat times out. how can implement this?

run python script with arguments on a remote linux host -

i have python script i'm trying run on remote host. however, script requires 2 arguments. example, python script.py --port 4000 --service status now when run script locally on machine works fine. how can run same script on remote linux machine. i've tried ssh user@remotehost python script.py --port 4000 --service status doesn't work. arguments not passed in. thank you you should use following - ssh user@remotehost "python script.py --port 4000 --service status" please notice " double quotes, has double quotes.

PHP - Joomla 3.4.1 redirect for urls that contain missing categories -

i using redirect plugin included joomla 3.5. works regular urls when there older 'missing category' url fails. short of adding own rewrite rule there php code fix in index.php? this happening. unlike usual behavior of no longer existing page, page hitting this: if ($category == false) { return jerror::raiseerror(404, jtext::_('jglobal_category_not_found')); } if ($parent == false) { return jerror::raiseerror(404, jtext::_('jglobal_category_not_found')); } which hard coded 404 found in /libraries/legacy/view/category/ . this because of weird aspect of api though says com_content doesn't check article first, checks category first. think it's bug in support of long deprecated url structures , should fixed encourage migration, that's me, question can do. so want think intercept before happens , allow normal operation of plugin. how approach depends on how many of urls structure expect have support. if couple, hard code

python - unsupported operand type(s) for +=: 'int' and 'NoneType' -

def movewall (paddlewall, paddlewalldiry): paddlewall.y+=paddlewalldiry return paddlewall def main(): pygame.init() global displaysurf ##font information global basicfont, basicfontsize basicfontsize = 20 basicfont = pygame.font.font('freesansbold.ttf', basicfontsize) fpsclock = pygame.time.clock() displaysurf = pygame.display.set_mode((windowwidth,windowheight)) pygame.display.set_caption('pong') #initiate variable , set starting positions #any future changes made within rectangles wallx = windowwidth/2 - linethickness/2 wally = (windowheight)/2 - linethickness/2 ballx = windowwidth/2 - linethickness/2 bally = windowheight/2 - linethickness/2 playeroneposition = (windowheight - paddlesize) /2 playertwoposition = (windowheight - paddlesize) /2 score = 0 #keeps track of ball direction balldirx = -1 ## -1 = left 1 = right balldiry = -1 ## -1 = 1 = down paddlewalldirx =

sql - Populate Excel userform listbox with query data - listbox is blank -

i'm attempting populate listbox on userform in excel document query sql server, listbox blank. i'm trying list of locations populate use define parameters follow on query. here code: option explicit sub populate_listbox_from_sql() dim cnt adodb.connection dim rst adodb.recordset dim stdb string, stconn string, stsql string dim xlcalc xlcalculation dim vadata variant dim k long 'set sql connection , connection string set cnt = new adodb.connection stconn = "provider=sqloledb.1;integrated security=sspi;persist security info=false;initial catalog=dw;data source=use-rptdw-00;use procedure prepare=1;auto translate=true;" _ & "packet size=4096;workstation id=pi-l-c03rtrd;use encryption data=false;tag column collation when possible=false" cnt.connectionstring = stconn 'your sql statement stsql = "select ldesc fin.location order ldesc" cnt .cursorlocation = adusecli

if statement - c# nested if/else in a for loop -

i have nested if/else statement in loop determine whether or a value valid array value. returns values fine, if if correct, still else additional 3 times. thought once equal 1 time, stop, suppose missing here. any thoughts? string sectionchoice; int ticketquantity; double ticketprice, totalcost; string[] section = { "orchestra", "mezzanine", "balcony", "general" }; double[] price = { 125.25, 62.00, 35.75, 55.50 }; bool isvalidsection = false; sectionchoice = getsection(); ticketquantity = getquantity(); (int x = 0; x < section.length; ++x) { if (sectionchoice == section[x]) { isvalidsection = true; ticketprice = price[x]; totalcost = calcticketcost(ticketprice, ticketquantity); console.write("\n\ntotal cost tickets are: {0:c2}", totalcost); } else console.write("\n\ninvalid entry, {0} not exsist", sectionchoice);

ruby - Rails associating multiple :has_many -

i'm new rails , trying understand associating entities. i have 3 entities right now: users, companies, , productlines. company.rb: class company < activerecord::base has_many :users has_many :productlines end user.rb: class user < activerecord::base # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable belongs_to :company end productline.rb: class productline < activerecord::base belongs_to :company end i've done migration scrips associate them, when click company on rails admin, i'm getting this: sqlite3::sqlexception: no such column: productlines.company_id: select "productlines".* "productlines" "productlines"."company_id" = ? extracted source (around line #91): # def prepare sql stmt = sqlite3::statement.new(

actionscript 3 - Why is my flash movie terminating with the message "Test Movie terminated" immidiately after launch in Flash CC 2015? -

since updating flash cc 2015 flash project terminating after initializing. not happening in cc 2014, , no error messages printed. if you're using air: had same issue, , cause air version had defined in project-app.xml. i used use air 16, , due custom definitions in xml needed turn read-only mode flash wouldn't overwrite it. when updated cc 2015, air 17 came along , needed update air version in xml too. if not case, it's similar simple.

javascript - Chrome extension to check a link and redirect to another website -

i building 1 extension in want block website urls chrome/firefox browser. lets have list of urls want make blacklist. whenever chrome user wants join them, extension redirect url of choice (inside code determine url want be) through research managed make chrome one manifest.json { "name": "url block", "description": "redirect site", "version": "1.0", "manifest_version": 2, "background": { "scripts": [ "background.js" ] }, "permissions": [ "webrequest", "*://facebook.com/*", "*://www.facebook.com/*", "*://apple.com/*", "*://www.apple.com/*", "*://iptorrents.com/*", "*://www.iptorrents.com/*", "webrequestblocking" ] } background.js

jquery - Loosing active class of bootstrap thumbnail when clicking any other control of the page -

loosing css of bootstrap thumbnai link when clicking other control or page css- a.thumbnail:hover, a.thumbnail:focus, a.thumbnail.active { border-color: gray; color:#003300; background-color:#addea } you can run below jquery force active class current anchor. $('a.thumbnail').click(function(){ //remove active a.thumbnail $('a.thumbnail').removeclass('active'); //add current active item $(this).addclass('active'); }); http://jsfiddle.net/seanwessell/cbrr5mwc/

c# - Linq to Sql Update on extracted list not working -

i having issues updating database using linq sql. have master query retrieves records in database (16,000 records) postdatacontext ctxpost = new postdatacontext(); int n = 0; var d = (from c in ctxpost.pwc_gs c.status == 1 select c); i take first 1000, , pass to object after modification using following query: var cr = d.skip(n).take(1000); i loop through records using foreach loop foreach (var _d in cr) { // stuffs here _d.status = 0; } i call submitchanges ctxpost.submitchanges(); no record gets updated thanks all. missing primary key on id field in dbml file.

Can't run nodetool on my vagrant virtual cassandra cluster -

basically i'm trying run simple 2 node virtual cassandra cluster experiment with. i'm trying set need run vagrant up , have cassandra , running. i've managed actual cluster working (i know because in 1 node create keyspace , table , inserted value able access other node) can't seem nodetool work. when run nodetool -h 192.168.10.11 -p 7000 status i error nodetool: failed connect '192.168.10.11:7000' - socketexception: 'connection reset'. the reason i've changed ports around avoid port collisions. (so changed jmx_port 7000 1 node , 7001 another, changed rpc_port , native_transport_port each node using unique port) ok figured out needed fix nodetool working. firstly don't need modify jmx port setting @ all. don't need expose forwarded_port. now on how working: in cassandra-env.sh there line commented out says: #jvm_opts="$jvm_opts -djava.rmi.server.hostname=<hostname> uncomment line , put either hos

sql - Getting all Employees under a Manager C# -

i trying list of of employees under manager in table. manager can go webpage , view every single person under him/her including hierarchies. an employee consists of this: public class employee { int id {get; set;} string firstname {get; set;} string lastname {get; set;} int employeenumber {get; set;} int manageremployeenumber {get; set;} } currently, getting a managers direct reports want show every single person under manager. example: (firstname: "aaron", employeenumber: 1, manageremployeeno: null) (firstname: "jack", employeenumber: 2, manageremployeeno: 1) (firstname: "roger", employeenumber: 3, manageremployeeno: 1) (firstname: "nat", employeenumber: 4, manageremployeeno: 2) (firstname: "fred", employeenumber: 4, manageremployeeno: 4) this example , managers can go lot deeper this. this have: public list<employee> getmanagedemployees(employee manager) { var managedemployees =_e