Posts

Showing posts from September, 2011

intellij idea - Keyboard shortcut to completely hide Java-doc comments so they take no lines in the code anymore -

Image
i know shortcuts: ctrl + shift + + ctrl + shift + - which expand , minimize java-doc comments respectively. way of line collapsing keeps line of space: how collapse no lines of code occupied comments anymore? how see java-doc comments above takes 1 line of code. i try work distraction free , want show actual code. here official page of intellij code folding shortcuts summarised (android studio fork of intellij have same shortcuts). can't find shortcut looking here. select part want hide , press ctrl + alt + t . choose either //<editor-fold desc="description"> // part hide //</editor-fold> or //region description // part hide //endregion change description won't distract you, example _ . after collapsing block see _ .

is database locking enabled by default in rails? -

some frameworks opinionated when comes database locking. example, grails orm (gorm) documents state following: by default gorm classes configured optimistic locking source : https://grails.github.io/grails-doc/latest/guide/gorm.html#locking i've read through material online rails , understanding rails not provide locking default. what rails default approach locking? note : not question approach best, question confirm rails's approach locking. by default, i'm pretty sure database locking turned off in rails. if want use locking, have @ ruby on rails docs: http://api.rubyonrails.org/classes/activerecord/locking/pessimistic.html

java - Is there a concrete implementation of OCRProcessor in openimaj -

i trying text extraction using openimaj , using liusamarabandutextextractorbasic text extractor subclass. class needs ocrprocessor implementation actual ocr. following javadoc public void setocrprocessor(ocrprocessor<t> ocr) for text regions extracted associated textual representations of text regions, ocr processor must used. use function choose ocr processor used extract read text regions. i did not find implementation in openimaj library (which strange if ask me). is there ocrprocessor implementaion can use? no, there seems no implementation. wrote java wrapper around tesseract-ocr (platform dependent) ocr.

Issue with scope of variables in C, why a function prints what it's supposed to print -

what going on in program here? why myfunction print 3 x? int myfunction(int); void main(void) /* local variables: x, result in main */ { int result, x = 2; result = myfunction(x); printf("%i", result); /* prints "3" */ printf("%i", x); /* prints "2" */ } int myfunction (int x) { x = x + 1; printf("%i\n", x); /* prints "3" */ return x; } that's because parameter local variable in function. when function called, there space allocated on stack parameter, , value variable x copied parameter. in function parameter x local varible, separate variable x in calling code. when x increased in function, happens local copy. when function ends, parameter goes away when stack frame function removed stack.

android - Can I use the same frame layout (as container) to display DrawerLayout and RecyclerView? -

i have navigation drawer using recyclerview layout. in same time, main page use recyclerview layout too. how manage optimally? this activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <!--toolbar--> <include android:id="@+id/toolbar_actionbar" layout="@layout/toolbar_default" android:layout_width="match_parent" android:layout_height="wrap_content" /> <!-- recyclerview commonly used attributes --> <android.support.v7.widget.recyclerview android:id="@+id/my_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" /> <imageview android:id="@+id/imageview1"

ios - Overlapping table view scrolls tableView behind it -

Image
basically have compound view in storyboard: a uiview inputs. let's call view1 container view displays tableview controller ( view2 ) works fine. i have small issue when displayed tableview uiview overlaps bottom view2 own results. cells stays within bound of view1 can interacted , selected. part of tableview (autocomplete results) overlaps view2 (and looks on top) scrolls view2 .. i tried referencing view1 , setting view1.layer.zposition higher value. wouldn't help.. any suggestions? if requires modifying code swift syntax preferred on obj-c your problem comes fact tableview autocomplete results added view1. , receive touches sent it. if select clipsubviews on view1 you'll see autocomplete results tableview cut bounds of view1 1. try add autocomplete results tableview self.view(main view of view controller). way above both view1 , view2 , receive touches come on tableview

PHP mySQL Query ignores decimal values -

i'm using ajax pull stocks database based on values contained on input. 1 of these values average returns, contains decimal value. i have 2 variables, $min_returns , $max_returns hold values such 4 , 6.6 respectively (normally hold ajax return). php code: select avgreturns stocks avgreturns >= '$min_returns' , avgreturns <= '$max_returns' in database , values 0.3 4.6, etc.. the problem getting decimals may not there. example, 1.3 valued 13, wouldn't included in example above. integers, 5, read , included above. i new php , mysql together. there doing wrong in database, need set columns correct setting? know called in query returned string, there isn't way convert within query, there? would avoid rounding values in database if @ possible. single quotes denote string literals, you're forcing database compare values lexicographically. in order interpret them numerically, drop quotes: select avgreturns stocks avg

python - What is causing my game to have really low fps -

ok finished simple game made in python , pygame , on laptop im getting 9 fps. must code. new game programming. think way animate sprites thats causing fps drop. if guys take @ sorce code great. sorry bad programming http://www.mediafire.com/download/7f4q55gk4a853o7/life+of+bob.zip i took @ code , found solution in changing line 392 inside __init__ method of map object from self.currentmap = pygame.image.load(os.path.join("assets", "maps", "spawn.png")) to self.currentmap = pygame.image.load(os.path.join("assets", "maps", "spawn.png")).convert() if have images don't need alpha channel should call convert on them. at beginning had framerate of 18 fps it's desired 60 fps. the key tool find bottleneck python module cprofile . next time should learn before posting wall of 500 lines of code . also consider changing loading of image files initialization of objects list. loading images character

vb.net - Covert Doc to XML -

i have make simple program convert doc file xml file using vb.net. dim app word.application = new word.application dim doc word.document = app.documents.open(txtfilename.text) dim writer new xmltextwriter("product.xml", system.text.encoding.utf8) writer.writestartdocument(true) writer.writestartelement("judgement") writer.formatting = formatting.indented each paragraph word.paragraph in doc.paragraphs paragraph.next() writer.writestartelement("p") if (paragraph.range.font.bold) writer.writestartelement("b") writer.writestring(paragraph.range.text.trim) writer.writestring(paragraph.range.text) writer.writeendelement() else writer.writestring(paragraph.range.text) end if writer.writeendelement() next writer.writeendelement() writer.writeenddocument() writer.close() app.quit() the result this. problem bold tag not @ bold font, put @ end of sentences. <?xml version=&quo

How to navigate in JSF? How to make URL reflect current page (and not previous one) -

i learning jsf , rather amazed , puzzled when realized whenever use <h:form> , standard behavior of jsf show me url of previous page in browser, opposed url of current page. i understand has way jsf posts form same page , renders whatever page controller gives browser doesn't know page location has changed. it seems jsf has been around long enough there must clean, solid way deal this. if so, mind sharing? i have found various workarounds, sadly nothing seems real solid solution. simply accept url misleading. append "?faces-redirect=true" return value of every bean's action , figure out how replace @requestscoped else (flash scopes, cdi conversation, @sessionscoped, ...). accept have 2 http round trips every user action. use method (e.g. 3rd party library or custom code) hide page name in url, using same generic url every page. if "?faces-redirect=true" gets, there way configure entire application treat requests way?

python - error with sklearn CalibratedClassifierCV and SVM -

i want use sklearn's calibratedclassifiercv in conjuction sklearn's svc make predictions multiclass (9 classes) prediction problem. when run it, following error. same code run no problem different model (i.e randomforestcalssifier). kf = stratifiedshufflesplit(y, n_iter=1, test_size=0.2) clf = svm.svc(c=1,probability=true) sig_clf = calibratedclassifiercv(clf, method="isotonic", cv=kf) sig_clf.fit(x, y) traceback (most recent call last): file "<stdin>", line 1, in <module> file "/home/g/anaconda/lib/python2.7/site-packages/sklearn/calibration.py", line 166, in fit calibrated_classifier.fit(x[test], y[test]) file "/home/g/anaconda/lib/python2.7/site-packages/sklearn/calibration.py", line 309, in fit calibrator.fit(this_df, y[:, k], sample_weight) indexerror: index 9 out of bounds axis 1 size 9 this problem of svc using one-vs-one strategy, , therefore decision function having shape (n_s

jsf - Primefaces Outputpanel deffered=true -

<h:form id="linkpanel"> <p:commandlink id="testpanle" value="test" update="contentoutputpanelid"/> </h:form> ... <h:form id="rerenderform"> <p:outputpanel id="contentoutputpanelid" deferred="true" style="padding:5px;"> <ui:include src="/pages/test.xhtml"/> </p:outputpanel> <h:form> when press press commandlink button update , contentoutputpanelid , include test.xhtml. doubt without deferred="true" not include page when press refresh page works fine.otherwise givent defferred="true" works fine. you're justified in suspicion: ui:include taghandler , while p:outputpanel uicomponent . taghandler evaluated , resolved @ view-build time , when component tree of view being setup (basically, deciding what's going be in page). component, on other hand, evaluated @ view-render , has markup interpretation wha

ios - I programmatically created rectangles, and added buttons on storyboard and the buttons are getting covered by the rectangles. How do I fix that? -

i programmatically created rectangles, , added buttons on storyboard , buttons getting covered rectangles. how fix that? import uikit class interestviewcontroller: uiviewcontroller { var squareview: uiview! var gravity: uigravitybehavior! var animator: uidynamicanimator! var collision: uicollisionbehavior! override func viewdidload() { super.viewdidload() squareview = uiview(frame: cgrectmake(100, 100, 100, 100)) view.addsubview(squareview) } as @matt mentioned subviews , views ordered in window. have different way want : you can insert rectangle @ given index if know : self.view.insertsubview(squareview atindex:index) if have reference uibutton can either : self.view.insertsubview(square, belowsubview:button) or after adding squareview using : self.view.addsubview(squareview) call following : self.view.sendsubviewtoback(squareview) all methods referenced in uiview class reference

Elasticsearch "pattern_replace", replacing whitespaces while analyzing -

basically want remove whitespaces , tokenize whole string single token. (i use ngram on top of later on.) this index settings: "settings": { "index": { "analysis": { "filter": { "whitespace_remove": { "type": "pattern_replace", "pattern": " ", "replacement": "" } }, "analyzer": { "meliuz_analyzer": { "filter": [ "lowercase", "whitespace_remove" ], "type": "custom", "tokenizer": "standard" } } } } instead of "pattern": " " , tried "pattern": "\\u0020" , \\s , too. but when analyze text "beleza na web", still creates 3 separate tokens: "beleza", "na" , "web", instead of 1 single &

angularjs - How do I pass the variable in a function into my controller? -

i'm trying pass videourl variable in showresponse function controller. i've been trying figure out solution without success. can guide me in right direction? var myapp = angular.module('myapp', []); myapp.controller('mainctrl', ['$scope', function($scope){ $scope.videourl = videourl; }]) // helper function display javascript value on html page. function showresponse(response) { var videourl = []; (prop in response.items) { videourl[prop] = "https://www.youtube.com/embed/" + response.items[prop].snippet.resourceid.videoid; } } // called automatically when javascript client library loaded. function onclientload() { gapi.client.load('youtube', 'v3', onyoutubeapiload); } // called automatically when youtube api interface loaded function onyoutubeapiload() { gapi.client.setapikey('#######'); search(); } function search() { // use javascript client library create search.l

javascript - Dynamic form field using HTML, and Bootstrap -

i trying create dynamic form field using code site http://bootsnipp.com/snippets/featured/dynamic-form-fields-add-amp-remove-bs3 here piece of code after modify it <div class="control-group" id="fields"> <div class="controls"> <form role="form" autocomplete="off"> <div class="entry input-group col-xs-3"> <input class="form-control" name="fields[]" type="text" placeholder="type something" /> <span class="input-group-btn"> <button class="btn btn-success btn-add" type="button"> <span class="glyphicon glyphicon-plus"></span> </button> </span> </div> <!--submit button--> <div class="form-group"> <

javascript - Dynamic Angular.js menu -

i trying build dynamic menu using anuglar.js , bootstrap. menu needs have dropdown ability. i've gotten basic menu down i'm trying add dropdown link , can't options generate correctly. i have variable menu items so: var nav = [ { display: 'home', link: '#/', drop: false, }, { display: 'categories', link: '#/', drop: true, sub: [ { display: 'sub 1', link: '#/' }, { display: 'sub 2', link: '#/' }, { display: 'sub 3', link: '#/' } ] } ]; i want dropdown menu generate of sub items when drop true , regular menu item when false . this html far: <ul class="nav navbar-nav"> <li class="dropdown" ng-repeat=&

javascript - Use .map to turn quantity into percentages -

i'd use javascript's lodash turn object of arrays percentages. here object: gender = { female: [14, 33, 28, 49], male: [33, 50, 42, 61] } i above object genderpercent = { female: [0.2978, 0.3975, ..., ...], male: [0.7021, 0.6024, ..., ...] } here tried: _.map(gender, function (val, index, list) { gender["male"][gender["male"].length-1] / gender["male"][gender["male"].length-1] + gender["female"][gender["female"].length-1]) }); but doesn't seem work. any suggestions? :) (note: need solution scale time because gender array(s) continue grow each month.) you can use loop if male , female lengths same: var gender = { female: [14, 33, 28, 49], male: [33, 50, 42, 61] } var m = gender.male; var f = gender.female; var genderp = {female:[], male:[]}; (var = 0; < gender.female.length; i++) { var t = m[i] + f[i]; genderp.male.push(m[i]/t); genderp.femal

windows - Boot2Docker on Windows8 won't start due to "not finding ip for eth1" -

when try start freshly installed boot2docker 1.5 (got aware of 1.6-bug) on windows8 there's message, "no ip found eth1". tried re-install virtualbox, still same message. even if empty hostonly-card of mac matches message loading boot2docker - without or reinstalling problem persists. the problem previous usecase had virtualbox installed before. config-data isn't deleted during uninstall. suppose old xml-config containing networking-details re-imposed on each new install-process. after deleting being in folders containing "virtualbox" got re-installed , configured anew , boot2docker worked breeze.

javascript - jQuery to display alert box when selecting radio button not working -

Image
i have spent lot of time in following piece of jquery code supposed display alert box whenever radio button selected; however, can't pinpoint why function not executing @ all. i have made jsfiddle here: https://jsfiddle.net/lcjgd/192/ here got far: $(document).ready(function(){ $('input[name="years"]').change(function() { if($('#years_3_years').is(':checked')) { alert("36 months"); } else if ($('#years_4_years').is(':checked')){ alert("48 months"); } else if ($('#years_5_years').is(':checked')){ alert("60 months"); } }; ); } ); <form id="plangen" action="/calculate" accept-charset="utf-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="jkgfl38i+e1kc/jjfw1tikdj

python - How do I install unicodecsv 0.12.0 on a mac -

the following commands not working: sudo pip install unicodecsv i get raise distributionnotfound(req) # xxx put more info here pkg_resources.distributionnotfound: pip==1.4.1 with sudo apt-get install python-pip i get sudo: apt-get: command not found i downloaded package here . how install download? install specific pip version required package: sudo easy-install pip==1.4.1 and repeat pip install command: sudo pip install unicodecsv

xcode6 - How to run UIAutomation on simulator using Xcode bots -

i using xcode 6.3.1 , os x server 4 have template ui automation , test success failure logged in bot. is possible? the right answer no, there no way results instruments after ui automation runs , display results unit tests bot results. but... if want hack stuff make work using info given here , parsing results , modifying xcode nodejs server displays data display ui automation results. opinion: i second option not worth time , effort , better use framework kif runs ui tests unit tests can results in xcode bot.

How does xcode project for a command line tool designate which swift file is the entry point? -

i've apparently done wrong xcode (v6.3.1) project using swift. when attempt build, startup statements in main.swift flagged compiler error: "statements not allowed @ top level". project contains multiple targets, each building multiple swift files. command-line app target failing build way. is there setting somewhere in project file designates swift file main entry point, , allows top-level statements?

java - Android appCompat issue with samsung and wiko -

Image
currently have little problem application, works fine on devices on samsung , wiko error : java.lang.noclassdeffounderror: android.support.v7.internal.view.menu.menubuilder i saw answers on internet said add line below in proguard file, in case doesn't work -keep class !android.support.v7.internal.view.menu.**, ** { *; } my app compound of 2 modules(so have 2 proguard file), 1module main app , other library here gradle file thr app module: apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.refresh.quickeer" minsdkversion 16 targetsdkversion 22 versioncode 1 versionname "1.0" multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } debug { minifyenabled fals

c++ - Boost.serialization unregistered class exception with serialized class defined in a runtime-linked shared library -

i trying create modular game system, , user - defined classes able serialized. to this, placing classes derrived polymorphic base class. running troubles while trying implement serialization on class. keep getting unregistered class exception (a runtime error). here minimal test case: environment: windows 8.1 msvc++ 12 (visual studio 2013) parent_class.h -- defines parent_class class polymorphic #pragma once #include <boost/serialization/access.hpp> #include <boost/serialization/nvp.hpp> #include <boost/serialization/export.hpp> class parent_class { protected: friend boost::serialization::access; template <typename archive> void serialize(archive& ar, const unsigned int version) { ar & boost_serialization_nvp(x) & boost_serialization_nvp(y); } float x; float y; public: explicit parent_class(float x, float y) : x(x), y(y) {} // virtual deconstructor make polymorphic virtual ~parent_c

ruby on rails - Compare associations on different ActiveRecords without fetching from the DB -

i able compare associated records on activerecords, without fetching database. following comparison, hits db when make comparison employee1 = employee.find_by(name: 'alice') debug employee load (92.0ms) select "employees".* "employees" "employees"."name" = 'alice' limit 1 employee2 = employee.find_by(name: 'bob') debug employee load (92.0ms) select "employees".* "employees" "employees"."name" = 'bob' limit 1 employee1.manager == employee2.manager debug employee load (697.9ms) select "employees".* "employees" "employees"."id" = $1 order "employees"."id" asc limit 1 [["id", 53]] debug employee load (504.1ms) select "employees".* "employees" "employees"."id" = $1 order "employees"."id" asc limit 1 [["id", 53]]

r - Access object by address / pointer -

can access data.table object created in current r session memory address or pointer? library(data.table) dt <- data.table(a = 1:10, b = letters[1:10]) address(dt) # [1] "0x6bf9b90" attr(dt,".internal.selfref",true) # <pointer: 0x2655cc8> this of silly way of doing (as compared how can cast pointers in e.g. c++), do: # recursively iterate on environments find.by.address = function(addr, env = .globalenv) { idx = which(sapply(ls(env), function(x) address(get(x, env = env))) == addr) if (length(idx) != 0) return (get(ls(env)[idx], env = env)) # didn't find it, let's iterate on other environments idx = which(sapply(ls(env), function(x) is.environment(get(x, env = env)))) (i in idx) { res = find.by.address(addr, get(ls(env)[i], env = env)) if (res != "couldn't find it") return (res) } return ("couldn't find it") } dt = data.table(a = 1) e = new.env() e$dt = data.table(b = 2) e$f =

c++ - Kinect depth Segmentation frame rate -

i new kinect project , implementing depth threshold when distance greater 400mm for (uint y = 0; y < pimg->rows; ++y) { // row pointers mats const ushort* pdepthrow = depth->ptr<ushort>(y); (uint x = 0; x < pimg->cols; ++x) { ushort raw_depth = pdepthrow[x]; short realdepth = nuidepthpixeltodepth(raw_depth); // if depth value valid, convert , copy if (raw_depth != 65535) { if(realdepth >400 ) //greater 400mm { pimg->at<vec4b>(y,x)[0] = 255; pimg->at<vec4b>(y,x)[1] = 255; pimg->at<vec4b>(y,x)[2] = 255; pimg->at<vec4b>(y,x)[3] = 255; } else { pimg->at<vec4b>(y,x)[0] = 0; pimg->at<vec4b>(y,x)[1] = 0; pimg->at<vec4b>(y,x)[2] = 0; pimg->at<vec4b>(y,x)

javascript - jQuery click not fired -

i have simple html file little bit of jquery in click event not triggered here: i not getting error , neither console.log statement expect print when click event triggered. did miss out on something? <!doctype html> <html> <head> <title>my webpage</title> <link rel="stylesheet" type="text/css" href="day.css"/> <link rel="stylesheet" type="text/css" href="night.css"/> </head> <body> <h1> website </h1> <button>day</button> <button>night</button> <script src="jquery.js"/> <script> (function(){ console.log('inside func'); $('button').click(function() { console.log('button clicked'); }); })(); </script> </body> </html>

mysql - need help on this php code line 17 -

this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers have tried on line 17 please need write (pdo) code because signup input not going database warning: mysql_num_rows(): supplied argument not valid mysql result resource in c:\wamp\www\my php\work\register.php on line 17 //please need code make right have tried know <?php include "scripts/connection.php"; //error_reporting(0); $email = $_post['email']; $username = $_post['username']; $password = md5($_post['password']. "al552kao09"); $confpassword = md5($_post['confpassword']. "al552kao09"); echo"text"; if (isset($email, $username, $password, $confpassword)){ if (strstr($email, "@")){

How can I add a label to f.select on rails -

i've been trying add label following code <%= f.select :platform, idea::platform_picking%> but keeps ignoring it,so researched why happen , turns out it's because f.select isn't simple_form method, there way can add label it? use label forms: <%= f.label :platform%> check docs

algorithm - Restore the original order based on many incomplete ordered sets -

let's original data 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 it got corrupted , have few incomplete sets order valid not elements present. 1, 4, 6, 7, 8, 11, 12 1, 2, 4, 5, 6, 9, 10, 12 2, 4, 7, 9, 10, 11 4, 7, 9, 12 etc. i have list of original elements without order. i need restore original data possible. have no guarantee have enough information restore everything. need make sense of have , figure out parts reliable. there may complications (but i'd solve problem without them first): order of incomplete sets valid may have few mistakes here , there, it's written humans. i may have additional information every pair of elements in incomplete sets like " there nothing between 5 , 6 ", " there else between 7 , 12 i'm not sure how many , exactly ", " there may or may not between 3 , 4 ", " there 1 unknown item between 7 , 9 " i'd incorporate information algorithm restore more data. my best ide

Add UUID Primary Key in Rails and MySQL -

i have table without id. know it's wrong design, want add primary key id table. here's script: def add_column :players, :id, :primary_key, first: true change_table :players |t| t.change :id, :uuid end end def down remove_column :players, :id end the thing script generate integer value uuid column. how add primary key uuid table? edit: it's in production. i can add id column , filled integer, not uuid expected. in database environment, table column id primary key unique identifier of each row of table . it's integer value autoincrement (but not necessary) , 32bit or 64bit integer used. there no 2 rows in table same id. in rails, uuid global unique identifier. can used identify user, session, anything. , id categories same. it's created random generator, reduce chance of having same uuid 2 different creations it's 128bit value. there ways use uuid primary key, it's bad design idea since database engine has lookup rows bas

node.js - How to count a group by query in NodeJS Sequelize -

in rails can perform simple orm query number of likes model has: @records = model .select( 'model.*' ) .select( 'count(likes.*) likes_count' ) .joins( 'left join likes on model.id = likes.model_id' ) .group( 'model.id' ) this generates query: select models.*, count(likes.*) likes_count "models" join likes on models.id = likes.model_id group models.id in node sequelize, attempt @ doing similar fails: return model.findall({ group: [ '"model".id' ], attributes: ['id', [sequelize.fn('count', sequelize.col('"likes".id')), 'likes_count']], include: [{ attributes: [], model: }], }); this generates query: select model.id, count(likes.id) likes_count, likes.id likes.id # bad! models model left outer join likes likes on model.id = likes.model_id group model.id; which generates error: column "

javascript - How to know if an element is rendered? -

my element has transition: transform .5s then has separate class: transform: translatex(-100%) so achieve initially, element positioned towards left. at window onload, when element rendered, remove transform class, , browser animate element correct position. but happens when page becomes visible/rendered, element @ correct position. , there no animation. i tried settimeout(function() {}, 0); doesn't work. if settimeout 1 second, works, sometime rendering takes long, , have settimeout 2 seconds. renders fast, , 2 seconds long time wait. so overall, feel not reliable or correct way of doing this. how can achieve want, correct way? edit: sorry guys, after trying put demo, realized wasn't removing class @ window onload. because element , javascript , css loaded ajax. can happen before window onload or after window onload. anyway, question is, if window takes long time load? possible element rendered before window finishes loading? or browsers render when enti

java - Gradle not running tests -

for reason gradle not running tests. when execute gradle cleantest test -i get: skipping task ':compilejava' up-to-date (took 0.262 secs). :compilejava up-to-date :compilejava (thread[main,5,main]) completed. took 0.266 secs. :processresources (thread[main,5,main]) started. :processresources skipping task ':processresources' has no source files. :processresources up-to-date :processresources (thread[main,5,main]) completed. took 0.001 secs. :classes (thread[main,5,main]) started. :classes skipping task ':classes' has no actions. :classes up-to-date :classes (thread[main,5,main]) completed. took 0.0 secs. :compiletestjava (thread[main,5,main]) started. :compiletestjava skipping task ':compiletestjava' has no source files. :compiletestjava up-to-date :compiletestjava (thread[main,5,main]) completed. took 0.001 secs. :processtestresources (thread[main,5,main]) started. :processtestresources skipping task ':processtestresources' up-to-date (to

bufferedimage - Combining PNG Images Java -

i trying loop through file of png images , stitch them form 1 image. have gotten work without using loop , combining 2 images file. assuming looping isn't working. images located in file called "images". appreciate input! file file = new file("images"); file [] morefile = file.listfiles(); string [] images = new string [morefile.length]; for(int =0; <images.length; i++) {images[i] = morefile[i].getname(); } int x = 0; int y = 0; bufferedimage result = new bufferedimage( controller.getsize().width*2, controller.getsize().height, //work these out bufferedimage.type_int_rgb); graphics g = result.getgraphics(); for(string image : images){ system.out.println(image); file path = new file("images"); try{imageio.read(new file(path, image)); system.out.println("it goes here"); bufferedimage bi = new bufferedimage((2*5

javascript - Using flexslider to create a responsive, full width, fixed-height, carousel image-slider -

i'm trying create full width, fixed-height, carousel image-slider home page of website i'm working on. that is, images scaled fixed-height (matching carousel height (the width doesn't matter)) scales responsively page does. however, want slider of lighter weight/ greater simplicity. here code far: (here head) <head> <!-- flex slider api js --> <link rel="stylesheet" href="flexslider.css" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="jquery.flexslider.js"></script> <script type="text/javascript" charset="utf-8"> $(window).load(function() { $('.flexslider').flexslider({ animation: "slide", animationloop: false, itemwidth: 360, itemmargin: 5, minitems: 2, maxi

overflow - Css element Max-Size -

what major differences in using these css rules div{width:100px; overflow:hidden;} and div{max-width:100px; overflow:hidden!important;} is there going cross-compatibility issues. max-width great stating "don't go bigger this, it's ok if it's smaller" . this might great if doing speech bubble dynamic in size (depending on content) , wanted div surrounding speech bubble vary. width on other hand says "the must 100px" , means if content within div smaller, surrounding div still 100px. example: http://cdn.gottabemobile.com/wp-content/uploads/2013/10/photo1.png

javascript - HTML5 getImageData without canvas -

this question has answer here: javascript: getting imagedata without canvas 2 answers is there way use getimagedata of image without canvas? wanting pixel color @ mouse position of image. no, can't. but getting imagedata can done in-memory canvas, that's fast , easy : var canvas = document.createelement('canvas'); var context = canvas.getcontext('2d'); var img = document.getelementbyid('someimageid'); context.drawimage(img, 0, 0 ); var thedata = context.getimagedata(0, 0, img.width, img.height); you may keep thedata variable don't have build @ each click. note won't work if image comes domain (and won't work if open html file using file:// instead of http:// ).

javascript - Traditional JSONP: Uncaught SyntaxError: Unexpected token : -

i have code: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <title>test</title> <script type="text/javascript" src="http://www.roblox.com/games/getgameinstancesjson?placeid=1818&startindex=0&jsonp=processresults"></script> <script> function parseresults(results) { alert('success'); } </script> </head> <body> </body> </html> when run this, comes error: uncaught syntaxerror: unexpected token : i've looked up, solutions jquery. i'm not using jquery; i'm using "tranditional" jsonp. how fix issue? thank in advance. try open http://www.roblox.com/games/getgameinstancesjson?placeid=1818&startindex=0&jsonp=processresults link in browser. can see returns json , not jsonp . for work result

c# - Error with WebHeaderCollection class when trying to add the header "User-Agent" -

good morning, need help. i have error webheadercollection class when trying add header "user-agent"   jumping me error in visual studio follows: "this header must modified right property my code follows , fault on third line. private static readonly webheadercollection headers = new webheadercollection() { {"user-agent", "custom-user-agent"}, // <<=== error?? {"cookie", "mycookie"}, {"application", "netconnect"} }; private static void start(int nrequests) { webrequest.defaultwebproxy = null; (var = 0; < nrequests; ++i) { sendrequest(); } } private static bool sendrequest() { var request = httpwebrequest.create("url"); request.headers = headers; using (var response = (httpwebresponse)request.getresponse()) { //returns boolean indicating success return response.statuscode == httpstatuscode.ok;

c++ - while(getline(myReadFile, temp, ':')) executing one iteration too many causing out of bounds on vector -

i have question on std::readline(istream, string, delimiter). trying read in file , store data in struct , add map. have gotten work. while loop iterates 1 loop many causing vector have no data stored in causes assertion failure out of bounds. i have read every stack overflow question on readline , none seem give me idea why behavior occurs. perhaps here can enlighten me. if (myreadfile.is_open()) { while(getline(myreadfile, temp, ':')){//loops through , splits line 1 delimiter @ time stringvector.push_back(temp);//add vector iteminfo tempitem = iteminfo(stringvector[1], stod(stringvector[2]), stod(stringvector[3]));//create struct catalog.insert(pair<string,iteminfo>(stringvector[0], tempitem));//add map stringvector.clear(); } } myreadfile.close(); thanks help the present code should break @ first iteration. assuming strart empty vection, read first line of file in tmp , fine. push_back tmp vector, sti

Best practice to share code across web application and mobile application with cordova -

i develop web application browser , mobile application cordova. want maintain 1 code base , have cordova references code web application. right have code web application in 1 folder , cordova project in folder. cordova can use of code web application, need add code mobile specific behaviors not applicable desktop browser. in case, don't want add code web application. so i'm seeking practice of sharing code among web application , mobile application (there's 1 problem that's not solved. cordova hardcode www , source web application in location). , i'm new cordova. i'm not better serve html, js, css files in mobile application. should pack of them app or load ones on demand when app running. be aware if serving code remote server, connection server may go down @ time, such nature of mobile devices. if happens, may prevent navigation through application , cause user interface issues. but if want serve cordova specific sections actual web applicat

ActionScript 3 sort an array with numbers and letters not working as expected -

i'm trying sort users cards in card game, example user's aces stand close each other. i'm using this: p1cards array elements "c8", "d9", "h1", letters stand card symbol (club, diamond, hearts) , number card value (1 ace, 2 2, , on) p1cards.sort(sortorder); function sortorder(a,b) { var = parseint(a.substr(1)); var bn = parseint(b.substr(1)); if (an > bn) { return 1; } else { return -1; } } the problem sorted card 8d, 8c switching places 8c, 8d, kind of randomly, when draw new card. any apreciated. see in picture below: http://i.stack.imgur.com/2ticj.jpg you don't define in sort when values same, depending item gets slotted in a , b (which have no control over) determine order. tell sort function when items same: function sortorder(a,b) { var = parseint(a.substr(1)); var bn = parseint(b.substr(1));

javascript - How to print out all the values inside object? -

i'm using function write values inside object. <script type="text/javascript"> function print_r(theobj){ if(theobj.constructor == array || theobj.constructor == object){ document.write("<ul>") for(var p in theobj){ if(theobj[p].constructor == array || theobj[p].constructor == object){ document.write("<li>["+p+"] => "+typeof(theobj)+"</li>"); document.write("<ul>"); document.alert(p.typeof(theobj)); print_r(theobj[p]); document.write("</ul>") } else { document.write("<li>["+p+"] => "+theobj[p]+"</li>"); //alert(p+" "+theobj[p]); } } document.write("</ul>") } } </script>

Dynamic xpath in Selenium -

how write xpath expression these kind of ids identifier contains numbers (ex: 11784) change every build. id='tab-11784-customer' id='tab-11784-tracker' question; why have use xpath in scenario? based on fact searching id, css makes more sense [id^=tab-][id$=-customer] if must use xpath then; //*[starts-with(@id, 'tab-') , contains(@id, 'customer')]

ios - UISegmentedControl tintColor -

i'm having problems getting uisegmentedcontrol show desired tint color. // appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // need red tint color in other views of app [[uiview appearance] settintcolor:[uicolor redcolor]]; return yes; } // viewcontroller - (void)viewdidload { [super viewdidload]; nsarray *items = @[@"item 1", @"item 2"]; uisegmentedcontrol *control = [[uisegmentedcontrol alloc] initwithitems:items]; // have control have green tint color control.tintcolor = [uicolor greencolor]; [self.view addsubview:control]; } how make uisegmentedcontrol use green tint color? try ? for (uiview *subview in mysegmentedcontrol.subviews) { [subview settintcolor: [uicolor greencolor]]; } but appears known issue in ios 7, don't know if has been fixed in ios 8. "you cannot customize segmented control’s style on ios 7. segme

Customer ArrayList Class amending Specific Element in Java -

how change specific variable @ specific point in custom arraylist? have created arraylist class , need adjust variable within list, cannot seem figure how achieve it. have searched answer nothing seems specific problem. the code super class is: public class parcel extends jpanel { protected int idnum; protected double charge; protected char zone; protected imageicon i; protected static arraylist<parcel> parcellist; protected static parcellist newparcel = new parcellist(); public parcel(int id, char z) { this.idnum = id; this.zone = z; } and code list is... public class parcellist extends parcel { parcellist() { parcellist = new arraylist<parcel>(); } public void addbox(int id, char z, int w, int l, int h) { parcellist.add(new box(id,z,w,l,h)); } what looking change imageicon example, change imageicon of 5th element in list of list contains many different instances of box differing images. , removing element. is p

linux - System time and file system time are not the same -

i met strange problem on 1 cluster 10 nodes. on node, file operation makes access/modification/change time of file in future 1min52s after current system time obtained date . makes make command cannot work correctly. following command tested: touch x , echo 123456 > x , using utimes(x,null) , utime(x,null) c program. of them can reproduce problem. is there anyway solve problem? thanks. the usual way address synchronize clocks on of machines common time reference using ntp (usually reliable time server). the ntp faq , howto place start. for linux servers, installing ntp package takes halfway. may need customize configuration file (usually /etc/ntp.conf ), enable service ntpd (the ntp daemon).

saving and then opening interactive 3d matplotlib figures -

i generating 3d interactive matplotlib figures.i save them , open them , still have interactive capability. 1.how can this? right when save them interactive features lost. 2.is there workaround? example save in '.fig' format python , open in matlab? or use python matlab connector?

html - How to Find all occurrences of a Substring in C -

i trying write parsing program in c take segments of text html document. this, need find every instance of substring "name": in document; however, c function strstr finds first instance of substring. cannot find function finds beyond first instance, , have considered deleting each substring after find strstr return next one. cannot either of these approaches work. by way, know while loop limits 6 iterations, testing see if function work in first place. while(entry_count < 6) { printf("test"); if((ptr = strstr(buffer, "\"name\":")) != null) { ptr += 8; int = 0; while(*ptr != '\"') { company_name[i] = *ptr; ptr++; i++; } company_name[i] = '\n'; int j; for(j = 0; company_name[j] != '\n'; j++) printf("%c", company_name[j]); printf("\n"); strt

matlab - How to check if a string is in and cellarray? -

i have cellarray list of strings: my_cell_array = {'stringa', 'stringb', 'stringc'} is there efficient one-liner check if literal string included in cellarray? something python: if 'stringc' in my_cell_array just found answer myself: ismember('stringc', my_cell_array)

stored procedures - Many to many relationship in SQL server - To add reference in foreign table when insertion does not happen in base table -

i have 2 tables user , item . user table have user details , item table have unique entries of item. now creating many many relationship there separate table called list references primary keys of both table foreign key. each user pass csv string contain items wants. these items added item table , id along user id placed in list table. the tables created this.... create table dbo.item ( item_id int identity(1,1) not null, item_name varchar(30) not null, primary key (item_id) ); create table dbo.list ( item_id int not null, users_id varchar(11) not null, ); the stored procedure looks this... alter procedure [dbo].[entry] @user_id varchar(11) @items varchar(max)=null begin insert dbo.item output inserted.item_id @outputtbl(item_id) select item_name [dbo].[split] ( @items, ',') -- call split function insert dbo.list select item_id, @user_id @outputtbl end go now when there duplicate of item name, want skip

python - Import csv as List of List of Integers -

i have following csv file 12,29,63,44 54,43,65,34 i'm trying import list of list such each index integer. here's have far. import csv filename = 'file.csv' open(filename, 'ru') p: #reads csv list of lists my_list = list(list(rec) rec in csv.reader(p, delimiter=',')) print my_list >>> [['12','29','63','44'],['54','43','65','34']] as can see produces list of list of strings, not integers. how import csv file list of list of integers? this >>> [[12,29,63,44],[54,43,65,34]] map int: my_list = [list(map(int,rec)) rec in csv.reader(p, delimiter=',')] [[12, 29, 63, 44], [54, 43, 65, 34]] which equivalent to: my_list = [[int(x) x in rec] rec in csv.reader(p, delimiter=',')]

jquery - jqplot animate pie chart and donut chart -

can tell me if animate , animate replot options in jqplot work pie chart , donut renderer? doesn't compatible option rendered can't find specific documentation. what need, ideally, pie chart animate on replot new data. if animate options not working, done loading in new data sequentially, rather @ once, in similar way thread: jqplot auto refresh chart dynamic ajax data problem have example adds existing data, rather replacing , wasn't able work. this got using example: var storeddata = [3, 7]; var plot1; rendergraph(); $('.change1').click( function(){ doupdate(); }); $('.change2').click( function(){ doupdate2(); }); function rendergraph() { if (plot1) { plot1.destroy(); } var plot1 = $.jqplot('chart1', [storeddata], {seriesdefaults: { renderer:$.jqplot.donutrenderer, rendereroptions:{ slicemargin: 3, startangle: -90, showdatalabels: true, datalabels: 'value' } } }); } var newdata = [9, 1, 4, 6, 8, 2, 5]; f