Posts

Showing posts from April, 2013

coldfusion - Is it possible to use C++ CFX tags in Railo? -

i had move several older websites running in coldfusion mx7 onto server running railo 4.2.1. these sites use either cfx_image or cfx_openimage tags resizing uploaded images. looks rewrite them use cfimage, i'm hoping these older sites working is, @ least know. does know of way use c++ cfx tags in railo 4.2.1? railo 4.2 supposed compatible cf 10 doesn't support c++ tags. it's intended compatible far cfml syntax goes there few things railo doesn't support, c++ cfx tags being 1 of them. support java cfx tags. read this but can use cfimage tag perform various image manipulation operations including image resizing. this <cfimage action = "resize" height = "number of pixels|percent%" source = "absolute pathname|pathname relative web root|url|#cfimage variable#" width = "number of pixels|percent%" destination = "absolute pathname|pathname relative web root" isbase64 = "y...

cron - Strange output of bash script -

i have bash script running on centos 6 cron sh /a/mem1.sh >/a/mem1.txt; if [ -s /a/mem1.txt ] ; mail -s "server low memory" < /a/mem1.txt server@example.com ; fi but under centos 7 works cron - issues strange 3-line additional output tput: no value $term , no -t specified tput: no value $term , no -t specified tput: no value $term , no -t specified so receive 2 emails - 1 normal script output should , email strange outputs above i checked line-by-line script commands inside - works without errors or warnings. google did not lot. in advance hint , how solve it. something running tput in script (presumably colorize output when can) , centos 7 has no term value set in cron environment tput complaining it. either remove calls tput script or set value term process via cron or add -t flag calls force particular term type.

Mysql entries by mutiple line file in Shell -

i can read file, problem insert of string read in file in mysql language. tried add strings contained file database (phpmyadmin). here shell : apps="/test/list.txt" app in $apps; mysql -utoto -ptiti -h localhost test << eof insert rpm (applications) values('$app'); eof done the problem result in database not values of file path of file. help...!

python - Is it possible to serve a static html page at the root of a django project? -

i have django app hosted on pyhtonanywhere. app resides @ username.pythonanywhere.com/myapp . serve static html page @ username.pythonanywhere.com . possible? serve index linking /myapp , /myapp2 , , other future apps. i can't seem find info on how this, assume have modify mysite/mysite/urls.py navigating root gives me 404 messages failing find match in urls. urlpatterns = [ url(r'^/$', ???), url(r'^admin/', include(admin.site.urls)), url(r'^myapp/', indluce('myapp.urls')). ] the previous best guess (a bad 1 know). should (correct me if i'm wrong) match root url, have no idea how "hey django static file", or static html should live, or how tell django lives. try not cut head off. i'm brand new django. p.s. i'm using django 1.8 in virtualenv on pa of course can. in cases need render template, use templateview . example: url(r'^$', templateview.as_view(template_name='yo...

java - Attempting to update ListView Items -

i working on listview starts off containing 4 items: event a, event b, event c, , event d. these 4 events stored in arraylist<event> called mevents , on button click filter out event b arraylist , update listview accordingly through adapter using notifydatasetchanged() . i using second arraylist<event> named newevents store events should displayed (event a/c/d) , clear mevents , set equal newevents . when button pressed, reason last list item gets deleted (event d) regardless of event attempt filter out. below relevant code, appreciated. listview code: public class listactivity extends fragmentactivity { private usercustomfilters musercustomfilters = new usercustomfilters(); // our database hostname , credentials string url = ; // string user = ; string pass =; sqlutils sqlu ; //the sqlutil object type initialized later depending on credentials given above. arraylist<event> mevents; //the array hold events pass around(to adapter,the li...

r - Meta-analysis with metafor package: Strange difference between rma and rma.mv -

i working on meta regression using metafor package. simple trial estimation is: m1<-rma(yi=coeff, sei=stderr, mods = ~ mt_timeseries + mt_bivariate, method="reml", data=y) next estimate same model rma.mv() , use random term rid factor identifying each single observation (no clusters of observations): m2<-rma.mv(yi=coeff, v=stderr^2, random= ~ 1|rid, mods = ~ mt_timeseries + mt_bivariate, method="reml", data=y) estimations m1 , m2 should yield same results (this idea supported note package author on http://www.metafor-project.org/doku.php/tips:rma.uni_vs_rma.mv ). but in fact, don't: > summary(m1) mixed-effects model (k = 886; tau^2 estimator: reml) loglik deviance aic bic aicc -4847.7988 9695.5976 9703.5976 9722.7309 9703.6431 tau^2 (estimated amount of residual heterogeneity): 0.0000 (se = 0.0000) tau (square root of estimated tau^2 value): 0.0007 i^2 (residual heterogeneity / una...

debian - Raspberry Pi Operating System Update? -

i have 2 pis, b+ , 2. have operating system (debian) use on b+ i'd use on 2. there way can make operating system work pi 2 without downloading fresh one? did try put sd card b+ r-pi new r-pi 2 ? i'm not sure when put sd card r-pi 2 r-pi b+ works. how old raspbian on old r-pi ? maybe helps : (article preparing sd card os r-pi 2) : http://thepihut.com/blogs/raspberry-pi-tutorials/16982376-updating-raspbian-on-your-microsd-for-the-raspberry-pi-2

c# - How do I throw an Exception from inside a Parallel.ForEach loop? -

i have parallel.foreach loop downloads files so: try { var paralleloptions = new paralleloptions(); paralleloptions.maxdegreeofparallelism = 8; int failedfiles = 0; parallel.foreach(filestodownload, paralleloptions, tile => { bool downloaded = downloadtile(file); if (downloaded) { //downloaded :) } else { failedfiles++; if (failedfiles > 10) { throw new exception("10 files failed download. failing download"); } } paralleloptions.cancellationtoken.throwifcancellationrequested(); }); } catch (exception ex) { throw; //this throws main method cancels program } and wondering correct way throwing exception inside parallel.foreach method? in instance think going see exception thrown 8 times first exception thrown. what correct way throw exceptions in parallel.forea...

I am very new to Scala / SBT. Is there a test program I use to see I set everything up correctly? -

i trying scala / sbt test things. using notepad++ , command line, no ide. is there "hello world" tests program? following sbt website example hello world this: object hi { def main(args: array[string]) = println("hi!") } does have simple example test can run using sbt? have directories setup correctly still getting hang of using sbt basic tests , simple example greatly. thanks. edit: i had tried using intellij idea ide @ first scala / sbt , scalatest try test example. this saved in main scala directory. class hello { def sayhello(name: string) = s"hello, $name!" } this saved in test scala directory. import org.scalatest.funsuite class hellotest extends funsuite { test("sayhellomethodworks") { val hello = new hello assert(hello.sayhello("scala") == "hello, scala!") } } this test runs fine in ide , shows green. how able run same test using command prompt / text ...

c# - How to find project type guid of existing projects -

i have solution containing multiple projects. went properties -> application -> in assembly information found 1 guid, checked guid on multiple sites find out type of project it. isn't matching of those. think guid need project type guid , not able find this. can project type guid ? (i using vs-2013) there no place in visual studio explicitly shows "project type guid", implicitly shown set of features available particular project. the value found in "properties->application-> assembly information" value used assembly level guidattribute assembly id com interop: supplies explicit system.guid when automatic guid undesirable. this id not related "project type guid" used vs enable/disable functionality. note: partial lists of project types can found on multiple sites http://www.codeproject.com/reference/720512/list-of-visual-studio-project-type-guids , discussed in what project guids in visual studio solution file use...

python - Screen capture error - what does it mean? -

i'm using call: driver.save_screenshot('/tmp/screen1.png') which results in error: selenium.common.exceptions.webdriverexception: message: not convert screen shot base64 - error: unable load canvas base64 string i can't find information on error. this selenium bug report has exact error message reporting , marked duplicate of this bug report . in both bug reports, cause of failure take screenshot size of web page, apparently large browser handle. people commenting on reports have reported chrome seems work in cases firefox fail.

applescript - Apple Script : Cleaning textedit text -

i want clear text textedit text half working me tell application "textedit" set documenttext text of document 1 set {oldtid, text item delimiters} {my text item delimiters, "administration"} set textbits text items of documenttext set text item delimiters "" set text of document 1 textbits text set text item delimiters oldtid set documenttext text of document 1 set {oldtid, text item delimiters} {my text item delimiters, "new search"} set textbits text items of documenttext set text item delimiters "" set text of document 1 textbits text set text item delimiters oldtid set documenttext text of document 1 set {oldtid, text item delimiters} {my text item delimiters, "advanced"} set textbits text items of documenttext set text item delimiters "" set text of document 1 textbits text set text item delimiters oldtid set documenttext text...

excel - calling a function to return an array - type mismatch -

i have custom type shown below, public type typefieldcolumn icol integer drow double end type i have following sub routine private sub populateworksheet() dim wsts worksheet dim clsdata new clsdatabase dim rsts new adodb.recordset dim fields() typefieldcolumn set wsts = thisworkbook.sheets(somename) set rsts = clsdata.somemethod() fields = findfactorcolumns(rsts, wsts) end sub which calls function below private function findfactorcolumns(rsts adodb.recordset, wsts worksheets) typefieldcolumn() dim integer dim index integer dim factorname string dim flds() typefieldcolumn redim flds(1 rsts.fields.count - 1) = 1 rsts.fields.count - 1 factorname = rsts.fields(i).name index = mapbloombergindextofactorname(factorname) if index > 0 factorname = pmap(index).mapname flds(i).icol = application.worksheetfunction.match(factorname, wsts.range("1:1"), 0) next findfactorcolumns = flds end function i run time erro...

python - Serve dynamic data to many clients -

i writing client-server type application. server side gathers changing data other hardware , needs pass multiple clients (say 10) display. server data gathering program written in python 3.4 , run on debian. clients built vb winforms on .net framework 4 running on windows. i had idea run lightweight web server on server-side , use system.net.webclient.downloadstring calls on client side receive it. multi-threading async stuff done me web server. questions: does seem approach? having data gathering program write text file web server serve seems unnecessary. there way have data in memory , have server serve there no disk file intermediary? setting ramdisk 1 solution thought of seems overkill. how web server deal data being updated, say, once second? webservers deal elegantly or there chance file served whilst being written to? thanks. 1) not familiar python, .net application want push change notifications it, rather pull. system.net.webclient.downloadstri...

oracle - EXECUTE IMMEDIATE PL/SQL? -

create or replace trigger p88 after insert on reparation each row declare vope number; begin select observation_reparation vope repartion; if(vope null)then execute immediate 'alter table ' || reparation.observations_reparation || ' modify libelle_piece nvarchar2(50)'; end if; end; / i this: error:table or view not exist. create or replace trigger p88 after insert on reparation each row declare vope number; begin select observation_reparation vope repartion; if(vope null)then execute immediate 'alter table reparation rename column observations_reparation libelle_piece'; end if; end; if need change declaration of column need alter statement alter table reparation modify (libelle_piece nvarchar2(50))

Retrieve data in Couchbase Lite without JSON -

how retrieve data db having particular key in couchbase lite without json?(ios framework) you need expound on question. ideally use model object, stores json. remember sort of data can stored in json, if has little bit of overhead in end easiest work with. if more complicated architecture question, may want post on official couchbase forum on website, technicians can answer.

Migration from JIRA to a file -

Image
my organization moving away jira , i've been given task archive or our jira tickets out asap. how can migration file/doc? idea please can't find useful resource internet well can perform jira backup generate backup can used later restore doesn't make useful in terms of viewing. or can perform issue search , results perform sort of export: really depends on number if issues have, how custom jira , useful data wish retain.

java - iText on a 10G database (1.4 JVM) generates a stacktrace -

i merge different pdfs itext 2.1.3. when in eclipse 1.6 jvm version works fine. when try run on 10g database (jvm 1.4) error. doing since have new version of file. error targed on line : list bookmarks = simplebookmark.getbookmark(reader); the stacktrace : message : essage: null stacktrace: java.nio.charset.charset charset.java class$ (-1) java.nio.charset.charset$1 charset.java <init> (-1) java.nio.charset.charset charset.java providers (-1) java.nio.charset.charset charset.java access$000 (-1) java.nio.charset.charset$2 charset.java run (-1) java.security.accesscontroller accesscontroller.java doprivileged (-1) java.nio.charset.charset charset.java lookupviaproviders (-1) java.nio.charset.charset charset.java lookup (-1) java.nio.charset.charset charset.java issupported (-1) java.lang.stringcoding stringcoding.java lookupcharset (-1) java.lang.stringcoding stringcoding.java decode (-1) java.lang.string string.java <init> (-1) java.lang.string string.java <in...

java - Apache Camel: How to test for instance of Set<CustomObject> -

does know how test different types of collection in route? // processor returns collection of 2 sets // 1. set<goodmessage> // 2. set<badmessage> .process(new mygoodbadmessageprocessor()) // split result list .split(body()).choice() // how test set<goodmessage>?? .when(body().isinstanceof(set<goodmessage>) .to("direct:good") .otherwise() .to("direct:bad") .endchoice() background : (in case can see better way of doing this) have processor works follows: @override public void process(exchange exchange) throws exception { message message = exchange.getin(); set<unknownmessage> unknownmessages = message.getbody(set.class); set<goodmessage> goodmessages = new hashset<goodmessage>(); for(unknownmessage msg: unknownmessages) { // simplified logic here if (msg.isgood()) { goodmessages.add(msg.getgoodmessage()); } } message.setbody(goo...

debugging - Eclipse find source file from library -

for debugging helpful read library's source code. when pointing @ library function want inspect , opening context menu , click on 'open declaration' in own written code have @ corresponding header file. how show corresponding source/cpp file in eclipse? if search file in source folders (using os tools) can't use eclipse methods 'open call hierarchy', so, won't satisfying solution. thanks. you can tell debugger find source files. in run or debug configurations dialog, there source tab when select particular configuration. that's can specify so-called source containers . more details, see eclipse cdt page .

mysql - how can I update a table but needing to get the update value from another select of the same table and other one? -

i have problem: i have tablea , tableb tableb needs tablea's id in field. tableb , tablea have common field 'email' ive tried this update tableb set tableb.reference = (select a.id tablea a, tableb b a.email = b.email) unfortunately when run query says cant specify target 'tableb' updates in clause. any idea how solve or run query this? update tablea, tableb set tableb.id = tablea.id tablea.email = tableb.email or one: update tableb inner join tablea using (email) set tableb.id = tablea.id your query possible, need fix it: update tableb set tableb.id = (select a.id tablea a, tableb b a.email = b.email)

php - Jquery refresh select lists each second -

i working on e-commerce project , set 2 dropdown lists linked in ajax. first list contains products , second 1 contains quantity of each product. there problem when user selects product , quantity, and, in same time user selects product , quantity => quantities not correct. try explain mean. imagine first product named "a" 2 quantities. first user choses product , selects 1 quantity. there 1 quantity left product. @ same moment, if user selects same product, quantities show "2" ! difficult explain wonder if timeout function should fix this. you use settimeout update quantity drop down items every based on product user has selected think bit overkill. you have set , store on server quantity values every time user changed selection. it do-able re-validate quantity user has selected still available once submit form.

substr - Identify continuously occurring stretch of specific letters in a string using R -

i identify if string column in data frame below repeats letters "v" or "g" @ least 5 times within first 20 characters of string. sample data: data = data.frame(class = c('a','b','c'), string = c("asadsasavvvvgvgggsdasssdddfgdfghfghfgggggddffddfgdfgtyj", "aweertgvthrgefgdfsdfsggggggdawsdfaasdadaadwerweqwd", "grtvvggvvvggswergervgegddfasdggvqweqweqwereryryer")) for example string in first row has "vvvvg" within first 20 character positions. string in third row has "vvggv". data # class string #1 asadsasavvvvgvgggsdasssdddfgdfghfghfgggggddffddfgdfgtyj #2 b aweertgvthrgefgdfsdfsggggggdawsdfaasdadaadwerweqwd #3 c grtvvggvvvggswergervgegddfasdggvqweqweqwereryryer the desired output should this: # class string result # 1 asadsasavvvvgvgggsdasssdddfgdfghfg...

javascript - Sharepoint Check In Rest API Error 'Not well formatted JSON stream' -

the same check in rest api working in sharepoint provider hosted low trust app in high trust app gives error 'not formatted json stream' var spurl = appweburl + "/_api/sp.appcontextsite(@target)/web/getfilebyserverrelativeurl('" + fngetserverrelpath(sfileref) + "')/checkin(comment='check-in',checkintype=0)?@target='" + hostweburl + "'"; var executor = new sp.requestexecutor(appweburl); executor.executeasync( { url: spurl, method: "post", headers: { "accept": "application/json; odata=verbose" }, binarystringresponsebody: false, success: function (data) { }, error: function (data) { fnupdatefilefailure(data) }, state: "update" }); i change...

javascript - How to use SystemWorker to execute PowerShell commands? -

i'm trying achieve systemworker of wakanda server-side api. cannot achieve it. i'm sure missing on workflow of systemworker . i want launch powershell windows , run 2 commands inside. manually, run powershell in cmd.exe , can start write powershell commands , data. in wakanda have set ssjs file code: var powershell = new systemworker(['powershell'],null); powershell.postmessage('add-type -assemblyname "presentationcore"'); powershell.endofinput(); powershell.postmessage('[windows.media.fonts]::systemfontfamilies'); powershell.endofinput(); powershell.onmessage = function (event) { var data = event.data; debugger; }; powershell.onerror = function (event) { debugger; }; powershell.onterminated = function (event) { // potentially check event.exitstatus or event.forced debugger; exitwait(); }; wait(); i have systemworkers.json file containing this: [ { "name" : "powershell...

javascript - Cannot get body from DELETE request with Slim Framework -

i'm working in app using backbone.js , slim framework. issue here: need delete record executing mysql stored procedure receives, besides id of record delete, parameter execute business logic. problem receive id of record. $app->request()->getbody(); blank. here code: /rest/folder/index.php <?php require_once '../../vendors/slim/slim.php'; \slim\slim::registerautoloader(); $app = new \slim\slim(); $app -> get('/categories/', function() use ($app) { require_once ('../../libs/auth.inc'); $auth = new authentication(); $user_id = $auth -> sessionauthenticate(); require_once ('categories.php'); $categories = new categories(); $categories -> getcategories($app, $user_id); }); $app -> post('/categories/', function() use ($app) { require_once ('../../libs/auth.inc'); $auth = new authentication(); $user_id = $auth -> sessionauthenticate(); require_once ('categories....

What is the difference between SQLite and xerial JDBC driver for SQLite? -

what differences when using original sqlite , xerial jdbc driver sqlite? sqlite written in c use in java. have downloaded xerial jdbc driver sqlite 3.8.6. can expect have same functions original sqlite? in official documentation version 3.8.6 same jdbc version? xerial/sqlite-jdbc java bindings c sqlite 3 library; it's thin layer of code takes c api of sqlite , makes them available java code.

google api - Urlshortener and 403 error on Android App -

this first question on stackoverflow , brain burned out due post have read , tests made. at app add short url's service of google. had read post , have generated api-key android application in google api console, put key in manifest, enable url shortener api , set quota per-user limit 50 (in moment i'm user of app on physical smartphone) method short url give me this: com.google.api.client.googleapis.json.googlejsonresponseexception: 403 forbidden { "code": 403, "errors": [ { "domain": "usagelimits", "message": "daily limit unauthenticated use exceeded. continued use requires signup.", "reason": "dailylimitexceededunreg", "extendedhelp": "https://code.google.com/apis/console" } ], "message": "daily limit unauthenticated use exceeded. continued use requires signup." } this code of method import android.os.asynctask; import android.util.log; import ...

c++ - Filter operation from vector to vector -

i'm trying implement filter operation takes vector v , creates vector d filtered elements of v. result can't pointer , i'm not allowed use regular loop/while. thinking of using: for_each, copy, copy_if none seem work. vector<car> fin; vector<car> all(repo->getall()); for_each(all.begin(), all.end(), [=]( car& cc) { if ( cc.getmodel() == model) { car c(cc.getnumber(),cc.getmodel(),cc.getcategory()); fin.push_back(c); } this give me error when performing push_back. copy_if(all.begin(), all.end(),fin.begin(), [&](const car& cc) { if (cc.getmodel()==model) return cc; }); this go inside iterator library , give me errors along "conditional expression of type const car illegal" is there way make copies of elements need 1 vector , add them other inside loop this? i tried if(find_if(...) on same idea, lambda , trying create new car , add d vector ...

How can fix NameError: global name is not defined error in python? -

i wrote python code multiplying 2 matrices using threads.but gave error: raise self._value nameerror: global name 'a' not defined. i know it's because of defining global a,b matrices i'm new in python , don't know how fix it. how can fix problem? import numpy import random import numpy np random import randint import multiprocessing, numpy, ctypes def linemult(start): #global a, b, c, part n = len(a) in xrange(start, start+part): k in xrange(n): j in xrange(n): c[i][j] += a[i][k] * b[k][j] def creationthreads(a, b, threadnumber): n = len(a) pool = multiprocessing.pool(threadnumber) pool.map(linemult, range(0,n, part)) return c if __name__ == "__main__": import argparse, sys argparse import argumentparser temp=[] #initializing matrices------------------ size = int(raw_input('enter n: ')) print('initializing a...') = [] in range (...

c# - Wpf client and asp.net web app signalr Hub , save users logged in from wpf client in signalr server -

i creating signalr hub in asp.net web app. wpf application client signalr hub i have login facility in wpf application , want store users on hub created in asp.net , can send information specific user. want store 2 properties username , usertoken , list of these properties in hub , how can send properties information hub i tried using client.caller not getting value in connected or disconnected event on hub you can access user in hub methods: there user instance property. token, assume in request headers. can access in hub context.request.headers property. don't need store users send data them. somewhere (not in hub inheritor) have line this: private static readonly lazy<ihubcontext> _hubctx = new lazy<ihubcontext>(() => globalhost.connectionmanager.gethubcontext<myhub>()); protected virtual task sendreporttoall(report r) { return _hubctx.value.clients.all.eventtotriggeronclient(r); } protected virtual task sendreporttouser(report r...

java - Websphere JNDI lookup fails in a Quartz job -

do can me ejb initialization in quartz job i have quartz this: @disallowconcurrentexecution public class testjob implements job{ private testejbservicelocal testejbservice; private void initejb() { this.testejbservice = new jndiutil() .getbyjndiname("java:comp/env/ejb/testejbservice"); } @override public void execute(jobexecutioncontext arg0) throws jobexecutionexception { // stuff } } in web xml have: <ejb-local-ref> <description /> <ejb-ref-name>ejb/testejbservice</ejb-ref-name> <ejb-ref-type>session</ejb-ref-type> <local-home /> <local>com.ibm.blue.ejb.testejbservicelocal</local> <ejb-link>testejbservice</ejb-link> </ejb-local-ref> was liberty profile can not initialize ejb exception: 2015-06-04 16:18:00 error jndiutil:38 - jndiutil lookup error; javax.naming.namingexception: cwnen1000e: jndi operation on java:com...

Writing/Reading strings in binary file-C++ -

i searched similar post couldn't find me. i' m trying first write integer containing string length of string , write string in binary file. however when read data binary file read integers value=0 , strings contain junk. for example when type 'asdfgh' username , 'qwerty100' password 0,0 both string lengths , read junk file. this how write data file. std::fstream file; file.open("filename",std::ios::out | std::ios::binary | std::ios::trunc ); account x; x.createaccount(); int usernamelength= x.getusername().size()+1; //+1 null terminator int passwordlength=x.getpassword().size()+1; file.write(reinterpret_cast<const char *>(&usernamelength),sizeof(int)); file.write(x.getusername().c_str(),usernamelength); file.write(reinterpret_cast<const char *>(&passwordlength),sizeof(int)); file.write(x.getpassword().c_str(),passwordlength); file.close(); right below in same function read data file.open("filename",...

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

Creating plots from 2-D values generated in a for loop in Python -

Image
i'm creating trail of (x,y) co-ordinates generated in for-loop. plot pops , it's blank. can noob out? import random import math import matplotlib.pyplot pl x = 0 y = 0 dx = 0 dy = 0 v = 2 n=100 pl.figure() pl.hold(true) in range(1,n): dx = random.uniform(-2,2) x = x+dx y += ((v**2 - dx**2)**(0.5))*(random.randint(-1,1)) pl.plot(x,y) print(x,y) pl.show() you trying plot line each of random points: graph blank because each single point isn't connected other. try building list of points , plotting list line graph: xarr, yarr = [], [] in range(1,n): dx = random.uniform(-2,2) x = x+dx y += ((v**2 - dx**2)**(0.5))*(random.randint(-1,1)) xarr.append(x) yarr.append(y) pl.plot(xarr,yarr) pl.show()

javascript - How do I load my pdf file into my modal when the button is clicked? -

i have button that, when clicked, opens modal pdf content. have list of these. my problem when browser loads website loads pdf files. want specific pdf file load when press button opens 1 specific modal. <li> <div class="row"> <div class="col-md-2" style="border: 1px solid black; height:200px;"> <img src="images/immanuelkant.jpg" style="padding:5px;" height="198" width="150"> </div> <div class="col-md-8"> <div class="row"> <div class="col-md-6"> <h2>immanuel kant</h2> <h3>something</h3> <p> </p> <!-- modal --> <div style="display: block;" class="modal modal-wide fade in" id=...

progress bar - How do I resize ONLY the background on a Custom ProgressBar (Android)? -

i have custom style progressbars: <style name="mycustomprogressbar" parent="android:widget.progressbar.small"> <item name="android:background">@drawable/loader_background</item> <item name="android:indeterminatedrawable">@drawable/loader_indeterminate</item> </style> background image way bigger compared images of animation, however, when try code above image , background appear of same size, it's background tied 'indeterminatedrawable' image size. possible change background size independently? just fyi found workaround. use padding on progressbar, this: <style name="mycustomprogressbar" parent="android:widget.progressbar.large"> <item name="android:background">@drawable/loader_background</item> <item name="android:indeterminatedrawable">@drawable/anim_indeterminate</item> <item name="...

html - How to keep size of images same which have different proportions? -

Image
i have product page, 4 bootstrap columns. adding products through cms editor. below html structure of single product. now, images of products have different proportions. when added them, displayed different height , width. how keep them in same size, in different size of screen. <div class="row"> <div class="col-sm-3"> <p> <img src="powerabwheel.jpg" alt="powerabwheel.jpg" style="display:block; margin: auto;"> </p> <p style="text-align: center;"><strong>power ab wheel<br></strong> <strong>price:</strong> <a href="# style="font-size: 20px;">$37.95</a></p> </div> </div> here snapshot of page hopefully images of same proportion. limit images max-height , max-width ! .grid {display: block; overflow: hidden; margin: 0; padding: 0; list-st...

c# - Windows Phone 8.1 Media Element set position from totalmilliseconds -

i trying set position of media element pragmatically position setting 0:0:0 autoplay property disable when i media_final_outside.stop();//stoping earlier set source media_final_outside.autoplay = false; media_final_outside.setsource(streamdeacceleration_outside2, filedeacceleration_outside2.contenttype); media_final_outside.position = new timespan(0,0,0,0,((int)(math.ceiling(temp)))); neither media_final_outside.position = new timespan.frommilliseconds(temp); is setting position. if type media_final_outside.play(); still wont play if position on zero. how can set source of autoplay media using c# , play starting position other 0:0:0 i had solve same problem media element on windows 8.1 should work same way on phone. subscribe opened event , set position when fired.

DrawableLeft is getting overlapped with hint using with TextInputLayout android -

when try add drawable left of edittext textinputlayout edittext hint getting overlapped drawable. how avoid drawable overlapping. without using textinputlayout drawableleft working fine <android.support.design.widget.textinputlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/email" android:inputtype="textemailaddress" android:drawablelef="@drawable/email" /> </android.support.design.widget.textinputlayout> this bug in library in new release version-22.2.1 issue fixed.

tfs2013 - TFS: Code Review Metrics -

i want generate metrics measuring effectiveness of our code review process. some of metrics thinking 1. defect count - number of defects recorded per code review 2. percent of code reviewed 3. time in review i having trouble writing queries generate these metrics in tfs. can help?

mysql - Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) in Grails -

i try use mysql in cp1251_general_ci encoding(with russian characters support) in grails. when start application, while bootstrap.gsp executes, error: 2015-06-04 15:52:28,889 [localhost-startstop-1] error spi.sqlexceptionhelper - illegal mix of collations (cp1251_general_ci,implicit) , (latin1_swedish_ci,coercible) operation '=' in mysql deleted old database , created new required encoding, error still. can fix it? the fix depends on statement that's throwing error. basically, mysql complaining expressions on either side of = , characterset/collations aren't compatible. the error due mismatch in charactersets between 2 expressions being compared. i run error when run statement creates inline view (derived table), , derived table (as expected) created characterset of client connection, , in outer query equality comparison made column table has incompatible characterset, example: select l.latin1col latin1table l join (sele...

npm update<package> doesn't update the package -

i've run issue try update package on remote server, mongoose package. if run npm mongoose --version return version number of 1.3.10 . in package.json version specified ^2.7.4 . i've tried run npm update , not update package ^2.7.4 , version npm mongoose --version still returns 1.3.10 when uninstall package via npm uninstall mongoose return unbuild mongoose@2.9.10 , if run npm mongoose --version still output 1.3.10 . i've tried reinstalling specific version number npm install mongoose@2.7.4 npm mongoose --version still return 1.3.10 i've made sure mongoose package not global package, , i've tried rebuild entire node_modules folder uninstalling packages , running npm install , still version number of 1.3.10 . any idea be? the remote server running on ubuntu 14.04.2 lts (gnu/linux 3.16.0-38-generic x86_64) if helps. so npm --version command returns version number of npm . what want use npm list mongoose list version number of pac...