Posts

Showing posts from April, 2011

java - How to detect mouse over on drawn image with awt.Graphics.drawImage() when transformed -

Image
in java swing panel draw image arbitrary transfomation e.g.: public void paintcomponent(graphics g){ affinetransform transform = affinetransform.gettranslateinstance(x, y); affinetransform rotateinstance affinetransform.getrotateinstance(rotx, roty); transform.concatenate(rotateinstance); g.settransform(transform); g.drawimage(image, 0, 0 , null); } what best way detect mouse on over such image? even better: best way detect mouse on over non-transparent pixels? construct shape encloses image, , use affinetransform method createtransformedshape() rotate shape along image. shape method contains() allow position testing in component relative coordinates. complete examples seen here , here . 2 approaches inverse coordinate transformation cited here .

python - migrate error with Django 1.7 while adding new model -

i created new model names join 3 fields, email, timestamp , updated timestamp. but, databse sync started giving me error add default values create table. added random values , has started giving me totally random errors beyond understanding. please here. here's model: class join(models.model): email = models.emailfield(default="default@default.com") timestamp = models.datetimefield(auto_now_add=true, auto_now=false, default = "") updated = models.datetimefield(auto_now_add=false, auto_now=true) def __unicode__(self): return self.email and here's error: (learn_django) c:\users\ajhavery\desktop\learn_django\source>python manage.py ma kemigrations migrations 'joins': 0004_auto_20150320_2358.py: - alter field timestamp on join - alter field updated on join (learn_django) c:\users\ajhavery\desktop\learn_django\source>python manage.py mi grate operations perform: apply migrations: admin, contenttypes,...

ant Ivy behind corporate proxy -

i trying run ant script behind corporate proxy , can't seam work : have followed presume closest have : http://www.midvision.com/community/code-blog-for-developers/bid/275503/allow-access-from-ivy-to-the-internet-through-a-corporate-firewall-that-requires-authentication and still your proxy requires authentication message. have specia characters inside password , escaped them url encodings. i new ivy , trying build apache nutch . y idea problem? using latest ant , ivy versions (1.9.4 , 2.4.0). i choose use nexus or artifactory. yes, getting through firewall not purpose, protects repository going down , stopping development. use nexus , getting through firewall snap.

android - Overlay button prevents dialogs from appearing, using TYPE_SYSTEM_ALERT -

i adding notification icon overlaid in corner of activities when there important things user needs know. have working, except prevents spinners, dialogs, , edittext working. spinners appear work, except can't see them, if touch it, touch again, option gets selected, spinner dialog doesn't appear. base activity other activities extend: public abstract class loggedinactivity extends gaugesactivity { private static final string tag = "loggedinactivity"; private windowmanager wm; private boolean overlaycreated = false; private linearlayout moverlay; private imageview moverlayimageview; @override protected void onresume(){ super.onresume(); wm = (windowmanager) getsystemservice(window_service); sharedpreferences prefs = getsharedpreferences(prefs_name, mode_private); string duplicatetruckguid = prefs.getstring("duplicatetruckguid", ""); if (! duplicatetruckguid.isemp...

java - Spring Session, Websocket, REST Token Security -

we have spring application contains rest api , websocket broker endpoints realtime updates on database changes. we've migrated spring session project embedded redis server authenticates basic auth , session id can used on subsequent requests x-auth-token header. the issue we're having secure websocket. on angular, have wrapper directive around stomp.js / sockjs libraries can't seem figure out how set x-auth-token header on websocket upgrade requests. are doing wrong? recommended way approach kind of security scheme? stack: tomcat 7.0.57 spring security 4.0.0.rc2 spring session 1.0.0.release spring mvc 4.1.4 angularjs 1.2.28 looks js websocket api doesn't allow setting http headers on initial handshake , upgrade request. the proper scheme send authentication token on connect frame , handle accordingly on server side. we've migrated browser cookie sessions until can find suitable implementation on server side.

arduino java serial communication not working -

i'm trying communicate arduino java using eclipse. using tutorial arduino -> java problem message "could not find com port" , dont know how fix this. think has me not chosing right port in code. sceenshot here can see message eclipse , arduino using com 3 , serial communication working. i might have wrong java code supposed string "hello world" , display in console right ? thanks in advance help. maybe arduino not connected on com3 port. should know port pc assign arduino connection. you can discover using ardulink console: www.ardulink.org

how can I use PhantomJS with a different version of GhostDriver? -

i struggling phantomjs/ghostdriver issue in ci builds. ( geb/selenium tests hang loading new page ) unfortunately there no phantomjs 2.0 binary linux yet, , have not been able build source. in meantime, there way can run latest ghostdriver within older version of phantomjs?

c++ - Adding a non-button hyperlink to MFC application -

Image
i trying add hyperlink direct user of application website. see mfc has built in "mfc link control". in dialog-editor. hyperlinks work correctly. when debug program, links instead turn buttons. is there way add non-button hyperlinks? thanks. cbutton natural base class of cmfclinkctrl . if misses key properies, cmfclinkctrl revert cbutton . bet on url. try this: cmfclinkctrl m_btnlink; // <-- associate control! ... bool ctestdlg::oninitdialog() { ... m_btnlink.seturl(_t("http://www.example.com")); m_btnlink.settooltip(_t("link site")); m_btnlink.sizetocontent(); ... }

python - Do you know how to install the IFC importer for Blender on Mac OS X? -

Image
i not able import .ifc files in blender. when try import .ifc file, blender goes unresponsive. i using mac os x ver 10.10.2 . python ver python 2.7.6 . blender ver blender 2.73a i see http://ifcopenshell.org/ifcblender.html shows message under os x: "users advised use 32bit blender , ifcopenshell on osx if possible" i have installed ifcblender blender 2.73 32bit osx variety of errors including incorrect architecture error. i have gone http://ifcopenshell.org/ifcblender.html , selected ifcblender blender 2.73 64bit os x . i attempted use importer import files via install blender add-on clicking on file > user preferences > add-ons > install file . select files, import-export: ifcblender not show under import/exports check off. then copied downloaded io_import_scene_ifc path /applications/blender.app/contents/resources/2.73/scripts/addons via cp -r io_import_scene_ifc /applications/blender.app/contents/resources/2.73/scripts/addons in termi...

machine learning - feature extraction for adding new dimensions -

is there algorithms in scope of feature extraction adding new dimensions ? general question , there not particular technical situation me, indeed need general answer , maybe introduce known algorithms in feature extraction used adding new feature based on existing ones . thanks in advance .

ggplot2 - R ggplot box plot -

i trying plot boxplot on following df using command: p <- ggplot(rt_vs_distance, aes(as.factor(distance)), latency) p + geom_boxplot() however, getting error message: error in sort.list(y) : 'x' must atomic 'sort.list' have called 'sort' on list? it seems distance cannot coerced factor. this str of df: > str(rt_vs_distance) 'data.frame': 3364 obs. of 4 variables: $ :list of 3364 ..$ : chr "morning" ..$ : chr "system" ..$ : chr "friend" ..$ : chr "peace" ..$ : chr "pain" ..$ : chr "ave" ..$ : chr "soldiers" ..$ : chr "assault" ..$ : chr "wives" ..$ : chr "hours" ..$ : chr "memories" ..$ : chr "obsession" ..$ : chr "chests" ..$ : chr "friend" ..$ : chr "blue" ..$ : chr "ass" ..$ : chr "chests" ..$ : chr "thing" .....

maven - Exclude package / directory from SonarQube's 'Package Tangle Index' analisys -

we run sonarqube analisys on our code , we're having bad time 3rd party package , "package tangle index" analisys. reasons can't fix issues , can't exclude folder being processed because harsh; have rules want run there. so... there way exclude package / directory being analyzed on specific package tangle index rule ? we've tried squid:cyclebetweenpackages on rule exclusions didn't seem work. alerts not generated index still there going strong. thanks! package tangle index not rule, metric, not delete it. the metrics calculated because used activate or not rules. in sonarqube 4.5.1 (version use), delete package of analysis. however, excluded, ie no other metric calculated it: settings > exclusions> files.

python - TypeError: 'psycopg2._psycopg.Binary' object does not support indexing -

i need help, i'm trying insert files (.txt) postgres using psycopg2 python, sends error , don't understand... error: typeerror: 'psycopg2._psycopg.binary' object not support indexing i have: archivo=open("coordenada.out",'rb').read() cur.execute("insert fhi(coordenadas) values(%s)",(psycopg2.binary(archivo))) you missing comma: (psycopg2.binary(archivo),) it expects iterable. comma make tuple. otherwise try iterate on binary

r - Combining shape and color legends into one (ggplot) -

Image
i'm trying combine shape , color legends 1 graph looks cleaner. example, bg data (mg/dl) filled red, cgm retropective value sensor 1 (mg/dl) filled withorange, etc.. tried working scale_color_manual , scale_shape_manual can't seem combine them. here code: #load libabries needed create graphs library(ggplot2) library(dplyr) library(scales) library(gridextra) library(grid) #create dataset subject data1<-subset(carb_data,subject.id.. == 1) carb1<-subset(data1,visit == 1) #makes sure "amount" stored number , "time" stored date carb1$amount = as.numeric(as.character(carb1$amount)) carb1$time = as.posixct(carb1$start, format = "%h:%m", tz = "gmt") q <- ggplot(data=carb1, aes(x=time, y=amount, group=type, color= type, shape=type, label=amount)) + geom_point(data=carb1[carb1$type=="bg data (mg/dl)", ], size=2, colour="red") + geom_point(data=carb1[carb1$type == "cgm retropective value senso...

java - search sub words in word from array of words? -

i have been working on assignment in have read words file , find longest word , check how many sub words contains in longest word? should work words in file. i tried using java code wrote works small amount of data in file task process huge amount of data. example: file words: "call","me","later","hey","how","callmelater","now","iam","busy","noway","nowiambusy" o/p: callmelater : subwords->call,me,later in i'm reading file words storing in linked list , finding longest word & removing list checking how many sub-words extracted word contains. main class assignment: import java.util.scanner; public class assignment { public static void main (string[] args){ long start = system.currenttimemillis();; assignment = new assignment(); a.throwinstructions(); scanner userinput = new scanner(system.in); string filename = userinput.nextli...

html - Bootstrap 3.0 Height 100% not working -

i've set need 100% to 100% height sidebar still refuses got bottom of page when using bootstrap 3.0. i've used -9999px trick knocks out dropdown have in navigation above can't use fix. what i've tried instead is: <div class="row-fluid fill"> <nav class="col-lg-2 fill"> <a class="btn btn-link" href="#"><span class="glyphicon glyphicon-piggy-bank navicon" aria-hidden="true"></span> animal care</a><br /> <a class="btn btn-link" href="#"><span class="glyphicon glyphicon-user navicon" aria-hidden="true"></span> customers</a><br /> <a class="btn btn-link" href="#"><span class="glyphicon glyphicon-gift navicon" aria-hidden="true"></span> donations</a><br /> <a class="btn btn-link" href=...

php - hasMany returns null -

i'm on laravel 4.2, trying objects associative relation yet reason getting null . models: class keg extends eloquent { protected $fillable = ['beer_distribution_id', 'status', 'keg_size']; public function beer_distribution() { return $this->belongsto('beerdistribution'); } } class beerdistribution extends eloquent { protected $fillable = ['beer_id', 'distributor_id']; public function kegs() { return $this->hasmany('keg'); } } my query: $distirbution = keg::find($tap->keg_id)->beer_distribution this query returns null: know keg object found , know object has beer_distribution_id. i tried specifying foreign key in model so: class keg extends eloquent { protected $fillable = ['beer_distribution_id', 'st...

ios - How Do I PERMANENTLY HIDE/REMOVE the navigation bar in my first View Controller? -

hey guys i'm having dilemma regarding nav bar in 1st view controller scene. hid with: self.navigationcontroller?.navigationbarhidden = true under viewdidload not knowing temporary fix. every time button pushed in second view controller scene return home controller scene, nav bar pops again! help! try viewwillappear, called every time view appear. function using, viewdidload, can run more once, runs once per application session.

teradata - SQL - A table with two same column names -

i have table user_id , entitlement entitlement can full game or demo, given user_id have 2 rows if user played both full game , demo. i did join table 2 columns gives me info on whether or not user has played full game has played demo. first column gives me ids of players has played full game, while second column repeat id if player has played demo, or null if he/she hasn't. select * ( (select e.user_id table1 e entitlement = 'fullgame') fg left join (select e.user_id table1 e entitlement = 'demo') demo on fg.user_id = demo.user_id ) my problem when i'm trying join table tables other information (age, country), teradata sql assistant gives me error saying there 2 columns of same name, i.e. user_id how can write query distinguish between 2 columns. have somehow rename 1 of columns first? you can use alias so: select * ( (select e.user_id userid1 table1 e entitlement = 'fullgame') fg left join (...

c# - Roslyn Code Issues And Fixes For Visual Studio 2012? -

i have experimented roslyn code issues (and blogged them), have lost touch progress being made on them. the last checked, code issues used visual studio 2013. still case, or there way make work visual studio 2012? no, there hasn't been updates visual studio 2012 in on 2 years , don't believe microsoft distributes september 2012 ctp anymore. even support visual studio 2013 not enough production. there have been no more official releases of roslyn visual studio 2013 since april of last year. on old codeplex page following quote confirms this: (note: vs 2013 preview quite out of date, , no longer updated)

animation - Flash rotation not consistent across frames -

i noticed seems flaw in flash professional rotation tweens. movie clip rotation tween not rotate consistently frame frame. when rotation slow, seems rotate noticably every 4th or 5th frame, , either not @ or minutely on next 3 or 4 frames. not noticeable unless rotating slowly. 1 might think not worth worrying about, becomes problem when trying subtle animation effects, such cartoon character's slight head movement - looks jittery. i made flash movie demonstrate problem - here . can done mitigate this? it rather complicates things, if use object's transformation matrix rotate instead, animation smoother. can guess there sort of optimisation regular animation gets bypassed when you're doing manually. private var box:sprite = new sprite(); private var boxangle:number = 0; // in radians private var boxposition:point = new point(); private var boxmatrix:matrix = new matrix(); private function updatebox():void { boxmatrix.identity(); boxmatrix.rotate(b...

javascript - tumblr - How can I make a div appear based on the height of a certain post's caption? -

i editing theme on tumblr , trying use jquery make div appears if height of text post or post's caption on 250px. pretty simple , seems working, seems take in first post , sets div visible other entries too. know how can adjust code each post goes through code instead of being set first post only? note: #entry id that's being used styling posts. .caption caption's class , .b div want shown if caption on height. $(document).ready(function(){ if ($("#entry .caption").height()>250) { $("#entry .b").show(); } }); please let me know if can help. thanks! try change if ($("#entry .caption").height()>250) to: if ($("#entry .caption").height()>=250) so match 250px of height , above. and each element matches: $(document).ready(function(){ $('.entry .caption').each(function(i, ui){ if ($(this).height()>=250) { $(this).parents('.entry').find('...

sonarqube - Nginx proxy to application on localhost -

i have nginx webserver set on port 80. (sonarqube) app runs on port 9000. when request http://www.example.com/sonar/ wish redirected sonar, added nginx config: location /sonar/ { proxy_pass http://127.0.0.1:9000/; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_read_timeout 1800; proxy_connect_timeout 1800; auth_basic "restricted"; auth_basic_user_file /etc/nginx/.htpasswd; } however, when go http://www.example.com/sonar/ , every link on page goes http://www.example.com/ instead of http://www.example.com/sonar/ . stylesheets, css scripts , links broken. how can fix this? tried rewrite , can't seem working.... the problem in proxy_pass line. in case, should be: proxy_pass http://127.0.0.1:9000; but not: proxy_pass http://127.0.0.1:9000/; in proxy_pass directive, if specify uri / in case, matche...

ant - Build errors on github's cyberduck -

trying build cyberduck https://github.com/greenqloud/cyberduck source errors azure , rococoa missing dependencies: how should proceed successful build? compile: [javac] /users/myuser/xcode/cyberduck/build.xml:131: warning: 'includeantruntime' not set, defaulting build.sysclasspath=last; set false repeatable builds [javac] compiling 605 source files /users/myuser/xcode/cyberduck/build/classes [javac] /users/myuser/xcode/cyberduck/source/ch/cyberduck/core/abstractcollectionlistener.java [...] [javac] /users/myuser/xcode/cyberduck/source/ch/cyberduck/core/aquaticprime/receipt.java:35: warning: [deprecation] pkcs7signeddata in org.bouncycastle.jce has been deprecated [javac] import org.bouncycastle.jce.pkcs7signeddata; [javac] ^ [javac] /users/myuser/xcode/cyberduck/source/ch/cyberduck/core/azure/azuresession.java:33: error: package org.soyatec.windows.azure.authenticate not exist [javac] import org.soyatec.win...

r - Finding Frequency of each letter in a data frame -

i have data frame looks following: col1 col2 col3 b c d e b i need find total number of occurrences of letters a,b,c,d , e. i have used lapply along table function in following manner: z =apply(t[,1:3],2,table) it gives list of frequency of each letter in each column. going wrong? table(as.matrix(dat)) or rstudent suggested: table(unlist(dat)) data dat<- read.table(text="col1;col2;col3 a;b;a c;a;d e;a;b ", header=true, sep=";")

amazon web services - AWS Ruby-sdk: How can I create a IAM user with auto generated password -

i using aws ruby-sdk create iam user specifying username. password should auto-generated. couldn't find related in api docs ( http://docs.aws.amazon.com/sdkforruby/api/index.html ) iam not have auto-generate password feature in api. web console providing functionality on behalf of users. create password user using aws sdk ruby, can following: require 'aws-sdk' iam = aws::iam::resource.new user = iam.create_user(user_name: 'name') user.create_login_profile(password: 'randompassword', password_reset_required: false) you can of course use method prefer randomize password. simple mechanism use securerandom ruby's standard library: # creates random password of 10 hex characters (length 2x given n) require 'securerandom' password = securerandom.hex(5) #=> "764d9308a3"

css - clip-path on YouTube iframe -

i trying make polygon clip-path work on youtube iframe. works on chrome , safari before video played (but not after), , not @ on firefox. have no idea why happening , have not found examples of clip-path working on youtube iframe. <iframe width="320" height="256" src="https://www.youtube.com/embed/zkesoubvqds" style=" -webkit-clip-path: polygon(0 25%, 100% 16%, 100% 89%, 0 64%); clip-path: polygon(0 25%, 100% 16%, 100% 89%, 0 64%);`" frameborder="0"></iframe> jsfiddle

makefile - Configure generates additional directories on x86_64 with clang -

i'm trying build libjit source on mac os x yosemite (using clang) following commands: ./auto_gen.sh ./configure --prefix=/path/to/my/own/directory make make install after found linker reported library-not-found error clang test.c -o test -ljit command. checked directory library installed, , noticed installed /usr/local/lib/x86_64/libjit* instead of /usr/local/lib/libjit* , leaded linking error. i built library on archlinux box , fine. comparing 2 makefiles generated on different oses, saw libdir variables differed. i googled , went pages talking multiarch on debian, i'm not sure if problem has mechanism. so how can change installation directory /usr/local/lib other libraries? or, if right way, how can make linker work correctly? after spending time on configure script, found piece of code: 448 if test x$gcc = xyes ; 449 multi_os_directory=`$cc -print-multi-os-directory` 450 case $multi_os_directory in 451 .) ;; # avoid trailing /. 452 ...

r - Add XY points conditionally to raster map generated by levelplot -

Image
i have tricky ifelse task here. below code showing data 2 periods( future , current ). data has mean, 5th , 95th confidence bounds alongside xy cordinates. want compare mean, 5th , 95th confidence bounds (ci) 2 dfs ( future , current ). conditions: 1) if cis future not overlap of current , cis of futrue above current, then pch=2 . 2) if cis future not overlap of current , cis of futrue below current, then pch=3 . 3) if cis of future overlap of current, pch=4 library(raster) library(rastervis) s <- stack(replicate(2, raster(matrix(runif(100), 3)))) current <- data.frame(coordinates(samplerandom(s, 3, sp=true)), c5th=c(17.643981,16.83572,9.979904), cmean=c(26.66364,19.74286,15.10000),c95th=c(35.68329,22.64999,20.22010)) future <- data.frame(coordinates(samplerandom(s, 3, sp=true)), c5th=c(17.643981,16.83572,9.979904)*2, cmean=c(26.66364,19.74286,1...

binding - In C++, we can't declare a reference without initialization. Why? -

in c++, can't declare reference without initialization. actual reason this.although aware uses of references in operator overloading , other concepts. c++ references (in ordinary c++ meaning of word) can't reassigned. if reference isn't initialized can't made refer anything. , language not support null-references, hence, uninitialized reference, if such permitted, in error.

asp.net - CSS for width of asp:ListView -

i've read listview can't take css adjust width, in itemtemplate, can't it. i'm trying put 3 listview controls side side. each control has image , text right. think windows explore file list, single column name. the text in each listview less 32 characters, there should plenty of room, each listview takes more 50% of screen no matter i've tried. css not strong suit. current css wrong .lv_table{ width:500px; border: 1px solid #ccc; } .lv_tr { width: 100px; } .list_view { border-style: solid; border-width: 2px; border-color: #000000; } .list_image { float: left; display: inline-block; } .list_item_large { font-size: 1.6em; color: #000000; padding: 8px 0px 0px 0px; margin: 0px auto; display: inline-block; text-align:left; min-height: 32px; } listview controls <table class="lv_table"> <tr class="lv_tr"><td class="...