Posts

Showing posts from September, 2013

ios - UIButton squeezed when project is run -

Image
i created uibutton in interface builder, setting size 81x31 , using image of same size. however, in simulator comes out looking squeezed. know doing wrong? also, realize not lot of information not sure relevant. please let me know if there's else should post.

plugins - Gradle: illegal repetition error -

just started use artifactory manage libraries use..therefore had have artifactory plugin. used screencast tutorial @ http://www.jfrog.com/confluence/display/rtf/gradle+artifactory+plugin , added buildscript follows download plugin.. buildscript { repositories { maven { url 'http://localhost:8081/artifactory/plugins-release' credentials { username = "${artifactory_user}" password = "${artifactory_password}" } } } dependencies { classpath ( group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.1.0' ) } } then in gradle.properties file in gradleuserhomedir, have following, password encrypted artifactory. artifactory_user=admin artifactory_password={desede}ifw8dygu849gr8enzumolj/l8cwy6fqfrzghhtyj9l0= artifactory_contexturl=http://localhost:8081/artifactory then ran g

android - Link to app in Google play -

i have prepared lite version of app. take user paid version in google play if user clicks on "buy option". please point me process/steps achieve this. just use intent , start activity in this example.

security - Strange git branch showing up in all my repos -

i noticed git repo create or clone has —quiet branch in it, cannot check out or , don't know comes from, ideas? i regularly use github, source tree (mac version), git command line, any suggestions appreciated, edit2: noted @dcoder first character not regular hyphen or minus sign, makes more suspicious, edit: if git branch get: * ali master —quiet if git checkout -quit or git checkout "-quit" or git checkout \-quit or git checkout -- --quit or anyother variant come mind get: error: pathspec '-quiet' did not match file(s) known git. i looked ~/.gitconfig file , did not find related this, found culprit, should have guessed it, few days back, copied , pasted config script webpage fish config file, , happens in addition ' , " replaced similar looking characters - replaced had missed it, thanks @dcoder did grep on , found in fish config file, case closed,

How to monitor Seed method in an Azure Deployment? -

i have seed method - time around - quite bit of work. takes 10 minutes locally , has been running in azure (website) 20 minutes. the feedback have 1) monitoring azure database changes reflect successful seed - difficult addorupdate, , 2) fact package manager console still says "running seed method". is there other way more insight stage / method / etc seed method on, while it's running part of migration? if application running on windows azure websites, can instrument seed , migration methods calls system.diagnostics.trace , can stream log command line: azure site log tail mysite for details on procedure refer streaming diagnostics trace logging azure command line (plus glimpse!) , how debug application in windows azure web sites . you can view log stream in visual studio. described in announcing release of windows azure sdk 2.0 .net , can done in server explorer, connecting web site , selecting view streaming logs in output window command.

sql - How to join multiple tables in Oracle -

i keep getting follow error "column ambiguously defined" input below. using oracle sql developer. i in school , 1 of assignments. being said, unexperienced , need "child-like" explanation. assignment states, "create view list movies available renting. view should include title, category description (not category_code), company, director, actor, store, copy, type." think might joining many tables?!? or, obviously, not doing correctly. assistance tremendously appreciated. create view availablemovies select m.title, mcat.description, comp.company_name, d.director_name, act.actor_name, mrs.store_name, mrl.available_for_rent, mrl.type_distributed companies comp join directors d on comp.company_id = d.company_id join movie_directors mdir on d.director_id = mdir.director_id join actor_in_movies aim on mdir.movie_id = aim.movie_id join actors act on aim.actor_id = act.actor_id join actor_in_movies aim on act.actor_id = aim.actor_id join order_items o

git - GitLab remote repository with a non standard port -

i have following error: ssh: connect host git.limeworks.eu port 22: connection refused fatal: not read remote repository. please make sure have correct access rights , repository exists. now, configuration have in local .ssh/config file is: host limeworks user git port 6565 hostname git.limeworks.eu; and in remote gitlab.yml: gitlab: ## web server settings host: git.limeworks.eu port: 6565 also, here's nginx setup (/sites-enabled/gitlab): server { listen 80; # e.g., listen 192.168.1.1:80; in cases *:80 idea server_name git.limeworks.eu; # e.g., server_name source.example.com; ... i have restarted gitlab , nginx services after each modification, yet nothing works! edit: worth noting here snippets sshd_config of remote server port 9595 allowusers rrw git ok , found fix: in gitlab.yml ... under advanced setting there's option change default ssh port # if use non-standard ssh port need specify ssh_po

python - Google App Engine datastore POST not working -

i'm having problem getting simple form post using datastore. i'm trying store rss feeds, starting name (sourcename) , link (sourcelink). form loads , can enter text in both fields, when hit submit, 404 error. i'm sticking pretty close guestbook tutorial i'm bit flummoxed. here's form code: import cgi import urllib #from google.appengine.api import users google.appengine.ext import ndb import webapp2 main_page_footer_template = """\ <form action="/newurl%s" enctype="multipart/form-data" method="post"> <div><textarea name="sourcename" rows="1" cols="60"></textarea></div> <div><textarea name="sourcelink" rows="1" cols="60"></textarea></div> <div><input type="submit" value="submit"></div> </form> <hr> </body> </html> ""&

java.lang.NullPointerException with JMenu and JMenuBar -

i have jmenubar has 1 menu , 3 jradiobuttonmenuitems : jmenubar menubar; jmenu menu = new jmenu("menu"); jradiobuttonmenuitem rbmenuitem; i declare it: menu = new jmenu("a menu"); buttongroup group = new buttongroup(); rbmenuitem = new jradiobuttonmenuitem("a radio button menu item"); rbmenuitem.setselected(true); group.add(rbmenuitem); menu.add(rbmenuitem); menubar.add(menu); and set menu bar: this.setjmenubar(menubar); i run file , gives me: exception in thread "main" java.lang.nullpointerexception @ geometry.tools.main.rectangleframe.<init>(rectangleframe.java:47) @ geometry.tools.main.rectangleframe.main(rectangleframe.java:95) java result: 1 line 47 is: menubar.add(menu); and line 95 is: rectangleframe thr = new rectangleframe(); in the: public static void main(string[] args){ rectangleframe thr = new rectangleframe(); } i don't understand why. haven't specified value null

Convert wrong Android timestamp on Php date() function -

i getting timestamp (1370956788472) of android message : cursor.getstring(cursor.getcolumnindex("date")) and trying convert android timestamp using php date() function , getting wrong date , time echo date('y-m-d h:i:s','1370956788472'); output : 1997-04-28 09:50:48 but display correct date , time if remove last 3 character timestamp (removed 472 1370956788472) : echo date('y-m-d h:i:s','1370956788'); output: 2013-06-11 13:19:48 what wrong here , should can divide android timestamp 1000 this time format 1370956788472 (the longer) in milliseconds. the shorter 1 1370956788 in seconds, can type time $time = time() in php. so divide 1000.

asp.net - Sending a message with C# works locally but silently fails live -

hi, using following code send booking form working locally when put live fails , not sure why: protected void page_load(object sender, eventargs e) { } protected void sendmail() { var sdate = startdate.text; var edate = enddate.text; // gmail address send mail var fromaddress = "xxx@googlemail.com"; // address email sending var toaddress = "silverhillcattery@hotmail.co.uk"; //password of gmail address const string frompassword = "xxx"; // passing values , make email formate display string subject = yoursubject.text.tostring(); string body = "from: " + yourname.text + "\n"; body += "email: " + youremail.text + "\n"; body += "contact number: " + txtcontactnumber.text + "\n"; body += "subject: " + yoursubject.text + "\n"; body += "question: \n" + comments.text + "\n"; body += "pet

Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for -

i trying simple zookeeper example leader election, , error , server doesn't start up. code: public leaderelection() throws ioexception, interruptedexception, keeperexception { setzk(new zookeeper("localhost", timeout, this)); /* call gives problem */ stat s = getzk().exists(master, this); if (s == null) { getzk().create(master, "this node used election.".getbytes(), zoodefs.ids.open_acl_unsafe, createmode.persistent); } //wait till syncconnected signal received in process method. latch.await(); setnodepath(getzk().create(master + node, null /*no data yet*/, zoodefs.ids.open_acl_unsafe, createmode.ephemeral_sequential)); } at exists() call error: exception in thread "main" org.apache.zookeeper.keeperexception$connectionlossexception: keepererrorcode = connectionloss please let me know missing. using version 3.4.5 of zk, , time out of 15k.

sorting - Javascript sort method -

i working bit of code on website , trying order results member id (i've left comments in code below is) doesnt seem sort order of results though guess must doing wrong. know issue is, , perhaps how limit amount of results shown 10 please? var httprequestobject = $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "/wcf/search.svc/testsearch", datatype: "json", success: function (response) { if (response != null && response.d != null) { var data = response.d; if (data.serviceoperationoutcome == 10) { var profilelist = data.memberlist; if (profilelist != null && profilelist.length > 0) { (var = 0; < profilelist.length; i++) { var profile = profilelist[i]; // sort var var memberid = (profile.memberid); if (profile != null) { var

browser - IIS 8 - Access to the Path … is Denied -

i'm using iis 8 web deployment in network.when i'm opening in browser showing access denied , had checked security setting.how solve problem. open iis manager , check basic settings of web app. there test settings option perform checks , allow identify issues. number of issues. more likely, iis user not have permission access files of web application.

multithreading - Implementing multiple queue and single thread in Java -

using java need implement following architecture: there multiple queues jobs continuously coming in queues. there single thread picking jobs queues following scheduling algorithm. should able write own scheduling algorithm. can please tell me java api use implement this? have used threadpoolexecutor, implement single job queue , thread pool containing multiple threads. in advance! use multiple concurrent queues , 1 semaphore. in producers, push objects , signal semaphore. in 1 consumer, wait on 'common' semaphore , poll queues according scheduling algorithm - 1 of them must have object on it.

css viewport width: device-width doesn't work for some Android app's inner browser (say micro message) -

i set @-ms-viewport { width: device-width; initial-scale: 1; } @-o-viewport { width: device-width; initial-scale: 1; } @viewport { width: device-width; initial-scale: 1; } p { font-size:2em; font-weight:normal; white-space:normal; width:100%; color:#7b7b7b; } in css file, , sure loaded page displayed in android default browser, not in micro message inner browser. lines inside tag p not 100% width in preview display model. when double click screen zoom in, lines inside tag p 100% width. how make lines width auto adjust in preview display model in browser? thanks.

c# - .NET callback as function parameter? -

i'm working on project has api , 1 of function's signature follows: public system.threading.tasks.task<farmersmarket.service.results> zipsearchasync(string zip, string callback) { return base.channel.zipsearchasync(zip, callback); } the string callback parameter confusing me. .net delegate? same javascript callback? update: i'm working api: http://search.ams.usda.gov/farmersmarkets/v1/svcdesc.html . there's object called "marketserviceclient" , that's documentation. given api can consumed via ajax, imagine callback parameter server write jsonp results when serving jsonp.

performance - Algorithm for making two histograms proportional, minimizing units removed -

imagine have 2 histograms equal number of bins. n observations distributed among bins. each bin has between 0 , n observations. what algorithm appropriate determining minimum number of observations remove both histograms in order make them proportional? not need equal in absolute number, proportional each other. is, there must common factor bins in 1 histogram can multiplied in order make equal other histogram. for example, imagine following 2 histograms, item in each histogram refers number of observations in bin respective histogram. histogram 1: 4, 7, 4, 9 histogram 2: 2, 0, 2, 1 for these histograms, solution remove histogram 1 7 observations in bin 2 , 7 observations bin 4, such (histogram 1)*2 = histogram 2. but general algorithm used find subsets of 2 histograms maximized number of total observations between them while making them proportional? can drop observations both histograms or one. thanks! seems me problem equivalent (if consider each histogram

Long/Lat from KML Fusion Tables export - any way? -

is there way long/lat coordinates fusion tables kml export? this post it, process doesn't work anymore: http://mickschroeder.com/2011/03/fusion-tables-export/ if data coded lat/longs, you'll lat/longs out in export (in form of <coordinates> element. if data coded address (as suspect in case), there's no way coordinates directly in export. instead, kml file have <address> element. seems google address geocoding on fly, , isn't willing share you. google has geocoding api can use turn addresses coordinates under condition you'll displaying geocoded data on google map. here's simple example of using geocoding api in python: import urllib2, json # create request uri google geocoding api service_fmt = "https://maps.googleapis.com/maps/api/geocode/json?address={0}&sensor=false" request_addr = service_fmt.format(urllib2.quote("600 mountain ave, new providence, nj")) # make request , deserialize json response

Extjs Grid - Delete all record has a conditional -

i have grid , button delete in http://jsfiddle.net/9zb8r/ field fields: ['id', 'name', 'type'] . if type == delete delete it. init data like: var simpledata = []; var store = new ext.data.arraystore({ fields: ['id', 'name', 'type'], data: simpledata }); (i = 0; < 20; i++) { simpledata.push({id:''+i+'', name: 'name'+i, type: 'delete'}); } //this record not delete simpledata.push({id:'20', name: 'enable', type: 'enable'}); store.loaddata(simpledata); i have tbar below can't delete record have type == delete . how can fix that. thanks. tbar:[ { text:'delete type = delete', handler:function(){ store.each(function(item, idx) { if (item && item.get('type')=='delete') { store.removeat(

uml - Difference between a 'class diagram' and a 'design class diagram' -

i have assignment states following criteria: for view may use truncated version of design class diagram (dcd) including architecturally significant classes. for context, logical view of 4 + 1 architectural view. how design class diagram (dcd) differ regular class diagram? uml diagram without functions or variables included (i.e. names of classes , interactions each other)? most of time, people model code. that's good! in case, class diagram modeling used graphically represent structure of (object-oriented) classes: class, method, attribute, annotations stereotypes. imagine jpa, spring, whatever annotations in class diagram of jpa-j2ee based architecture... as it's said above, "design class diagram" should design domain model, architecture level. basic entities structural system rely on? no details programming language, no "dto", "dao" or technical stuff that. here's example use: online shopping cart domain model . contains

linux - zend : Fatal error: Class 'Application_Model_User' not found -

i trying connecting model class defined in /application/models named user.php. following how bootstrap looks like: class bootstrap extends zend_application_bootstrap_bootstrap{ protected function _initappautoload() { $autoloader = new zend_loader_autoloader_resource(array( 'namespace' => 'application', 'basepath' => application_path, 'resourcetypes' => array( 'model' => array( 'path' => 'models', 'namespace' => 'model', ) ) )); echo '<pre>'; var_dump($autoloader); return $autoloader; } } folli

ember.js - Image address in ember templates grunt build -

i used yeoman create web app in emberjs. works ok, after using grunt build command, if view built app in browser (from dist directory), can see images missing because src path wrong. grunt changing names of images in "image" folder, not updating paths in html. updates path in css files; images in .hbs template files still have old path (with old image name)... anyone know how fix this? finally got rid of this: all needed edit gruntfile.js in project's root; rev task 1 manage image renaming; this: rev: { dist: { files: { src: [ '<%= yeoman.dist %>/scripts/{,*/}*.js', '<%= yeoman.dist %>/styles/{,*/}*.css', '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}', '<%= yeoman.dist %>/styles/fonts/*' ] } } }, you have delete row tell him pro

javascript - Kendo UI DropDownList dataSource from external url not working (SOLVED) -

original code http://demos.kendoui.com/web/dropdownlist/template.html json file original, in different location. project: http://jsfiddle.net/rbogdanowicz/rrdq4/2/ what wrong? the difference in between responses, 1 wrappeped in callback keyword : callback([{"customerid":"alfki","contactname":"maria anders","companyname":"alfreds futterkiste"},{"customerid":"anatr","contactname":"ana trujillo","companyname":"ana trujillo emparedados y helados"}]); kendo 1 not. solution set jsonpcallback parametr (fiddle : http://jsfiddle.net/vojtiik/2jtst/ ): transport: { read: { datatype: "jsonp", jsonpcallback: "callback", url: "http://www1.com.br/customers", } }

Python code not working - confusion about if statement -

i'm writing simple code calculate how change due, print statements thrown in check values. cost = float(raw_input('how did meal cost? > ')) payment = float(raw_input('how did pay? > ')) change = (payment - cost) print change if change < 0: print 'you need pay $%.2f more!' % (-change) dollars, q, d, n, p = 0, 0, 0, 0, 0 change = float(change*100) print change if change> 100: dollars = int(change/100) change = change % 100 print change if change >= 25: q = int(change/25) change = change % 25 print change if change >= 10: d = int(change/10) change = change % 10 print change if change >= 5: n = int(change/5) change = change % 5 print change if change >= 1: p = int(change/1) else: print "why doesn't work?" print p print change print 'you %d dollars, %d quarters, %d dimes, %d nickels, , %d pennies!' % (dollars, q, d, n, p) this

How to make a python program one-time use? -

is there anyway construct python program such that, after using once, specific program no longer usable on any computer? if so, how? note i'll compiling program .exe, in case makes things easier. not really. can load script virtual machine, save state of machine, , reset virtual machine every time want run script. plus, executables generated py2exe, cx_freeze, pyinstaller, etc. easy disassemble original source code, wouldn't need go far virtual machine break restrictions. i make webapp , have users purchase access tokens. software runs entirely on server, have nothing disassemble. if don't care security, add key registry or make file in appdata checked before script run.

c# - Autofac and WebForms - passing non-constant parameters, resolved parameters? -

i'm getting started autofac , have following code: public class _default : system.web.ui.page, iuserinformationprovider { protected void page_load(object sender, system.eventargs e) { controllerfactory cf; using (scope == ((global_asax)this.context.applicationinstance).containerprovider.applicationcontainer.beginlifetimescope()) { cf = scope.resolve<icontrollerfactory>(); // <-- love pass "this" somewhere here, how??? } } } controllerfactory defined below , takes iuserinformationprovider interface. pass instance of webform parameter resolve icontrollerfactory. public class controllerfactory : icontrollerfactory { protected iuserinformationprovider _userinformation; public controllerfactory(iuserinformationprovider userinformation) { _userinformation = userinformation; } } looking through documentation, see there 3 parameter types (named, typed, resolved), first 2 take constant

CSRF token protection using cookie -

is practice save csrf token in cookie or better use hidden field in form? regenerate csrf token every user request captchas doing? thanks it best include in form. idea behind csrf token is not passed passively (e.g. if malicious user able trick browser accessing url nasty). cookies passed passively.

Django/MySQL error -

i have error , i'm not sure how fix it. looked previous questions , of them because mysql-python not installed. however, have installed traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/home/bradford/development/django/django_1.5.1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line utility.execute() file "/home/bradford/development/django/django_1.5.1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/home/bradford/development/django/django_1.5.1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command klass = load_command_class(app_name, subcommand) file "/home/bradford/development/django/django_1.5.1/local/lib/python2.7/site

wpf - Button content not updated with PropertyChanged Notifications -

what trying is, when user click on button, content should change according coding. here code. have tried both, code behind way , xaml way of binding. not working. <button x:name="header" content="{binding listheader}" click="headerclick"/> private string listheader; public string listheader { { return listheader; } set { listheader = value; if (propertychanged != null) { propertychanged(this, new propertychangedeventargs("listheader")); } } } public calendar() { this.selecteddate = datetime.now; this.listheader = selecteddate.tostring("mmmm"); } private void headerclick(object sender, routedeventargs e) { switch (stateoflist) { case statesoflist.listofdates: { this.listheader = selecteddate.year.tostring(); this.stateoflist = statesoflist.listofmonths; }

tabs - GWT - ScrollPanel in TabLayoutPanel not working properly if not selected -

i have ui setup have tablayoutpanel , each tab corresponding panel, wrapped inside scrollpanel . chat program, users able post messages appear in panels; means messages can appear in tabs aren't focused. now wanted (simplified here) have scrollpanel scroll bottom whenever message arrives, keep newest message in view. works fine in selected tab, there's problem in tabs aren't. basically, when amount of messages in tab gets enough scrollbar needed, doesn't seem register until tab selected. can call getverticalscrollposition() , return 0, though know there's way more there fit; , if switch tab, scrollbar resting @ top. if @ point switch away again, work point, problem when goes not showing scrollbar showing it, doesn't seem register until tab selected. does have suggestion getting around behavior? i've tried setting scrollbars display, didn't @ all. not 100% sure guess problem display:none of hidden tab might reason why getverticalscro

protocol buffers - Is there one-byte type in protobuf? -

i can't find if there possible have char / byte type in proto. i can see various types here: https://developers.google.com/protocol-buffers/docs/proto https://developers.google.com/protocol-buffers/docs/encoding but can't find byte type , int16 types there. no, there no fixed 1-byte type. fixed length has 4 , 8 byte variants only. other numeric values encoded "varint"s, variable length depending on magnitude (and sign, "zigzag" comes play there). can store bytes value 0-127 in 1 byte, , 128-255 in 2 bytes. 16-bit values take between 1 , 3 bytes depending on magnitude (and sign /zigzag etc). for multiples, there "bytes" 8-bit version, , "packed" rest; avoids cost of field-header per value.

php - How to remove "label" decorators in Zend? -

how remove " label " decorators in zend each multiple radio form element? disableloaddefaultdecorators & setseparator doesn't remove it.. $form = new zend_form(); $form->addelement('radio', 'radio', array( 'ignore' => true, 'label' => 'add new material' )); $element = $form->getelement('radio'); $element->removedecorator('label');

java - How to set value on select change of drop down in JSP -

this code index.jsp. want when select option in drop-down menu, value should printed out , value should set. example, if select "grapes" should print grapes , set value grapes. have tried many things have been unable so. <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <form method="post" action="index.jsp" name="productform"> <select name="colour" onchange="document.productform.submit();"> <option value="dropdown">pls select 1 <option value="apple">apple <option value="oragne">orange <option value="grapes">grapes </select> <input type="hidden" name="dropdown" id="dropdown"> <input type="submi

PHP Jquery JSON catching -

here's php responding jquery calls. <?php if ( isset( $_post['icnumber']) && $_post['icnumber'] != '' ) { $custic = $_post['icnumber']; $response = array(); $response['status'] = 'false'; $sql ="select * ctrl_cust cust_ic='$custic'"; $raw = mysql_query($sql,$link) or die('query 1 '.mysql_error()); if ( $data = mysql_fetch_assoc( $raw ) ) { $response['status'] = 'true'; $response['custid'] = $data['cust_id']; $response['custname'] = $data['cust_name']; } header("content-type: application/json", true); echo json_encode($response); } ?> and here's jquery $(function() { $('#icnumber-form').submit(function() { var icno = $('#icnumber').val(); $.ajax({ type : 'post', url : 'php/create

linq - Unit test setup never invoked -

i'm trying write unit test test method takes in data groups , runs method. reason setup never invoked. i've debugged , i've checked types passed in , out , data , same after grouping. ideas why wouldn't work? this in test: myarray[] grouped = myarray .selectmany(x => x.accountvalues) .groupby(x => x.timestamp) .select(g2 => new accountvalue { amount = g2.sum(x => x.amount), timestamp = g2.key }) .toarray(); helper .setup(s => s.compute(grouped, grouped.count()) .returns(somevalue); var result = _engine.get(accountnumbers, startdate, enddate, code); helper.verify(v => v.compute(grouped, grouped.count()), times.exactly(1)); the actual method i'm testing follows: public decimal? get(long[] accountnumbers, datetime startdate,

R: Factorize one variable in data frame -

i have r data frame variables stored numeric categorical. how convert 1 specific column's data type of existing data frame numeric factor? you can use: dat$col <- as.factor(dat$col) where dat name of data frame , col name of column.

calculate Euclidean distance of two image in hsv color space in matlab -

i use code below calculate euclidean distance 2 rgb images: im1 = imread(filename1); im1 = rgb2gray(im1); hn1 = imhist(im1)./numel(im1); im2 = imread(filename2); im2 = rgb2gray(im2); hn2 = imhist(im2)./numel(im2); f = norm(hn1-hn2); and gives me correct answer want use code 2 images in hsv color mode wont work on it cause of above code in 2d space while hsv 1d there specific code calculating euclidean distance of 2 image in hsv color space? images format jpeg you need create histogram each channel seperatetly function hst = im2hsvhist( img ) % % computes 3 channels histogram in hsv color space % n = 256; % number of bins per hist (per channel) hsvimg = rgb2hsv( img ); hst = zeros(n,3); ci = 1:3 hst(:,ci) = imhist( hsvimg(:,:,ci ) , n ); end hst = hst(:) ./ n; % 3*n vector, normalize n , not 3n using function can compute image image distance in hsv space im1 = imread(filename1); hst1 = im2hsvhist(im1); im2 = imread(filename2); hst2 = im2hsvdist(im2); f

jboss7.x - Exception in JBoss AS 7.2 CLI API when terminating connection -

we upgraded jboss 7.1.3-final 7.2.0-final. since upgraded 1 of our applications, uses java cli public api, throws nullpointerexceptions every time connection terminated through cli api. the following our code set , close connection jboss cli: private commandcontext ctx; private modelcontrollerclient client; public jbossclitool() { try { ctx = commandcontextfactory.getinstance().newcommandcontext(); } catch(cliinitializationexception e) { throw new illegalstateexception("failed initialize cli context", e); } } public void establishconnection() { try { ctx.connectcontroller("localhost", 9999); client = ctx.getmodelcontrollerclient(); } catch (commandlineexception e) { log.debug(e.tostring()); } } public void terminateconnection() { try { if (!ctx.isterminated()){ ctx.terminatesession(); } } catch (exception e) { log.debug(e.tostring()); } } whe

Maven Could not resolve dependencies -

now, have project runs fine on windows computer. after copied linux computer, when compiling reports following error: failed execute goal on project alert: not resolve dependencies project com.cloud.ras:alert. the pom com.external:commons-logging:jar:1.0.4.1 missing, no dependency information available pom com.external:freemarker:jar:2.3.4 missing, no dependency information available pom com.external:log4j:jar:1.2.14 missing, no dependency information available pom com.soa.lib:eboxservicecommon:jar:2.5.3 missing, no dependency information available but have copied these jars maven repository. , can give me help? you should not copy jars in first place. that's maven job resolve dependencies you. it helpful if explain reason why need use own groupid e.g. com.external in first place i.e. commons-logging apache use com.external groupid . if insist on wanting use own groupid , @ least download jar , install using maven. see here: http://maven.apache.org/guides

JavaScript: Unable to read all elements from innerHTML content -

i trying read elements in innerhtml of div, seems alternate elements being read. code block: <!doctype html> <html> <body> <script type="text/javascript"> var tdiv=document.createelement("div"); tdiv.innerhtml="<span>a1</span><span>a2</span><span>a3</span><span>a4</span><span>a5</span>"; var cn=tdiv.getelementsbytagname("*"); var len=cn.length; console.log("length: "+len); console.log("tdiv len: "+tdiv.getelementsbytagname("*").length); for(var i=0;i<len;i++){ if(cn[i]){ console.log(i+": "+cn[i].nodename+": "+cn[i].tagname); document.body.appendchild(cn[i]); } } </script> </body> </html> output: a1a3a5 note: a2 , a4 missing. have tried using both childnodes , getele

ios - when trigger gesture cancel state? -

the apple doc says a recognizer continuous gesture can transition changed canceled (uigesturerecognizerstatecancelled) if decides gesture no longer fits expected pattern. i want know when recognizer cancel state.for example, there's rotate gesture in view, if left 1 finger, gesture still in changed state, why not in cancel state? cancel reserved instance system cancels gesture (for example, uialertview shown while gesture active, or user double taps home button show used apps list).

JSF action not called OR selectbox value is null -

i have strange jsf problem here... don´t know why, ever try do, have 1 out of 2 problems. either action method inside popuppanel not (means never) called or called, value selectbox (always) null. can´t figure out, problem is, seems me, it´s xhtml property problem. already tried put popuppanel outside h:form (helped me @ other locations...), tried put outside , put form popup. beyond trying change attachment parent/form , changed execute of commandbutton inside popup form/form-id/popuppanel-id , guess there more things did... nothing helped. bean session scoped , using richface 4.0 final if matter @ all. what ever, xhtml looks this: <rich:popuppanel header="#{label['edit.title']} #{mandateaction.ccservice.mandatelist[mandateaction.currentindex].id}" id="addexternalsystem" onmaskclick="#{rich:component('addexternalsystem')}.hide()" domelementattachment="form" autosized="true" layout="block&qu

iphone - Mobilesubstrate: Create a tweak to hook into another tweak or dylib -

is possible create tweak hook existing tweak? not possible. .xm files cannot dumped using class-dump. hook other frameworks or other source files used tweak, dumping them. tweak hooked identifier should used load it.

How to maintain the aspect ratio when using GPUImage? -

i found instagram has camera window 300*300? square, im trying use gpuimage make same camera size.so wrote this: primaryview = [gpuimageview alloc] initwithframe: cgrectmake(0,0,300,300)];//define square view //define still camera stillcamera = [[gpuimagestillcamera alloc] initwithsessionpreset:avcapturesessionpreset640x480 cameraposition:avcapturedevicepositionfront]; //make portrait stillcamera.outputimageorientation = uiinterfaceorientationportrait; //define filter filter = [[gpuimagefilter alloc] init]; //force output 300*300 [filter forceprocessingatsize:((gpuimageview*)self.primaryview).sizeinpixels]; //set things [stillcamera addtarget: filter]; [filter addtarget: primaryview]; [stillcamera startcameracapture]; now square view..but view looks flat, distortion, think might wrong aspect ratio.then set fill mode of primary view this: [primaryview setfillmode:kgpuimagefillmodepreserveaspectratioandfill];

php - How to get refering URL when redirected from some page to another page -

i redirecting several pages dev.php using php header <?php header(location: dev.php); ?> i want know have been redirected here. i have tried <?php print "you entered using link on ".$_server["http_referer"]; ?> but dosent work $_server["http_referer"]; works if access dev.php using <a href="dev.php">go developer page</a> so how can referring url? try below. <?php header(location: dev.php?referrer=$_server[php_self]); ?> or header('referer: '.$_server['php_self']); header(location: dev.php); if above methods don't work, have go sessions.

javascript - How to use userscripts in a site?(How does Greasemonkey work) -

userscripts used add-ons greasemonkey. how can utilize these scripts in site? for example, found script eliminate ads in videos, , want put script in site, people in site wont't see ads i've tried save , put in <script> in head, went wrong. ( typeerror: document.body null ) i tried put before </body> , no error reported time, still doesn't work. and i'm wondering how greasemonkey works? insert scripts in webpage? how load scripts pages? greasemonkey , userscripts.org meant provide kind of lightweight extensions for browser , not webpages. i.e. install them user inside browser . some of trivial scripts might incorporated webpages, in general, greasemonkey has "superpowers" things ordinary javascript can't due security constraints. instance, issuing (and reading response of) cross-domain xmlhttprequest , interactions between frames different origin etc. normally greasemonkey scripts executed when domcontentloaded fire

asp.net mvc - How to get the selected values from MVC CheckBoxFor jquery? -

i working on mvc app , right stuck on following problem: have checkboxes generated 1 of models, don't know how value(either name of id) of selected ones in javascript. ideas ? here's code: @if (model.controls.any()) { (int x = 0; x < model.controls.count(); x++) { <div aria-autocomplete="inline"> @html.checkboxfor(p => p.controls[x].isselected, new { @class = "ccb" }) @html.label(model.controls[x].name) @html.hiddenfor(p => p.controls[x].id) </div> } } working : $(document).ready(function () { $('.ccb').change(function (event) { var matches = []; $(".ccb:checked").each(function () { matches.push(this.value); }); alert(matches); }); }); try: $(document).ready(function () { $('.ccb').change(function (event) { if ($(this).is(&#

Merge several reports / have several report chapters -

how can merge or concatenate several jrxml jasperreports 1 report unit, without using java code ? i can upload jrxml files , generate report units rest api / webservice only . or there other solution element layout? --header-- * group of countries england australia croatia * pie chart countries --footer-- --new page-- --header-- * group of else 1 else 2 .... * chart of else --footer-- i think of having array variable iterate on <group> element , print sub report each element. like: <variable name="chapters" class="java.util.list" resettype="none" resetgroup="chaptergroup" incrementtype="group" incrementgroup="browsergroup"> <variableexpression> <![cdata[java.util.arrays.aslist("browser", "country")]]> </variableexpression> <initialvalueexpression> <![cdata[new java.util.arraylist()]]>

c# - Getting a false value of integer from view in razor -

i have error in asp.net mvc application. have view : @if (model == null || model[1] == null || model[1].count == 0) { <label>pas de demande</label> } else{ int = 1; string s = ""; <form action="\travail\validation_reservation" method="post"> @foreach( planning.models.affectation v in model[1]){ if (v.periode == 1) { s = "matinale"; } else { s = " après midi"; } int = v.id_affectation; <div><h5 style="color:blue">@i / demande de reservation de vehicule @veh.matricule : le @v.date_affectation , la periode @s</h5> <input type="hidden" name="id" value="@a" /> <input type="submit" name="btn" value="valider" /> <input type="submit" name="btn" value="refuser" /></div> <br /> i++; } &l

http - Why does evhttp_request_get_connection() always return NULL? -

in following example program: #include <event2/event.h> #include <event2/http.h> #include <assert.h> void response_cb(struct evhttp_request* req, void *arg) { assert(evhttp_request_get_response_code(req)<400);/* passes */ assert(evhttp_request_get_connection(req));/* fails ??? */ } int main(int argc, char **argv) { struct event_base* ev_base; struct evhttp_connection *http_conn; struct evhttp_request *req; ev_base = event_base_new(); http_conn = evhttp_connection_base_new(ev_base, null, "google.com", 80); req = evhttp_request_new(response_cb, null); evhttp_make_request(http_conn, req, evhttp_req_get, "/"); event_base_dispatch(ev_base); return -1; } in response_cb first assert passes, expected, seconds fails i.e. evhttp_request_get_connection(req) returns null. why that? the documentation evhttp_request_get_connection claims: returns connection object associated request or null. b

ruby - Convert integer to base 26, using a to z as digits -

i need implement decimal chars converter. have 26 chars available, it's converting integer base 26 system , then, changing each number it's alphabet counterpart. i don't want use characters 0-9 in final result string . can use to_s() method , how goes: 82.to_s(26) #=> "34" / gives me "de" 120.to_s(26) #=> "4g" / should give me "aep", it's not ruby to_s() method returns value in format not helpful. number 82 converted fine, conversion of 120 returns value have no idea how handle. could explain how can make 120 convertion (as example) return aep equivalent? in other words, how convert decimal base 26 without using numbers in output? ruby's fixnum#to_s( base ) , string#to_i( base ) representing numbers in different bases. cannot use arbitrary characters them though, designed compatible conventions hex , base64 amongst other things. if not converting different base, encoding decimal digits letters

c# - Implicit operator for int? -

i've learned use implicit operators classes. now want this: public static implicit operator string(int val) { return "the value is: " + val.tostring(); // nonsense example } however wrong. compiler says: user-defined conversion must convert or enclosing type how can workaround this? my goal able run code this: int x = 50; textbox1.text = x; // without using .tostring() or casting you can't add operator outside of class of either parameter or return type of operator. in other words: can't add operator converts between 2 types both don't control. the compiler error explicit this: user-defined conversion must convert or enclosing type so, trying achieve here not possible. best option extension method on int performs conversion , returns string .

winforms - Bind list to gridview C# -

i'm trying bind list gridview . situation this: take data .txt file, later put inside first list list<mycolumns> . have data in list (with 3 separated columns) created. taking data 1 of columns called system_description . show data in gridview , thing length of each row. how should fix it? here code. private void button7_click(object sender, eventargs e) { list<mycolumns> list = new list<mycolumns>(); openfiledialog openfile1 = new openfiledialog(); openfile1.multiselect = true; if (openfile1.showdialog() != dialogresult.cancel) { foreach (string filename in openfile1.filenames) { using (streamreader sr = new streamreader(filename)) { string line; while ((line = sr.readline()) != null) { string[] _columns = line.split(",".tochararray()); myc