Posts

Showing posts from March, 2012

c# - Return json without binding it to object using web client -

i want return jsonresult in c# online api service (itunes). wanting go out data in json format , return exact data in same json format can play in javascript. here have: public jsonresult index() { using (var client = new webclient()) { var json = client.downloadstring("https://itunes.apple.com/lookup?id=909253"); return json; } } i noticing can't return json because string. don't want bind model!!! want return json object how got it. change method signature return string instead of jsonresult object… public string index() { using (var client = new webclient()) { return client.downloadstring("https://itunes.apple.com/lookup?id=909253"); } }

python - Error while calculating math.sqrt -

this question has answer here: list of lists changes reflected across sublists unexpectedly 13 answers i faced strange error, , wasted 2 hours on it, couldn't come explanation import math ipd={1:[2,3],2:[1],3:[1],4:[5,6,7],5:[4,6],6:[4,5],7:[4]} gkeys = [k k in ipd.iterkeys()] key_map = {} x in range(len(gkeys)): key_map[x] = gkeys[x] val = len(gkeys) #adj matrix... w = [[0.0]*val]*val print w in range(len(gkeys)): j in range(len(gkeys)): #if , j has edge... if key_map[j] in ipd[key_map[i]]: deg1 = len(ipd[key_map[j]]) deg2 = len(ipd[key_map[i]]) v = 1.0/math.sqrt(deg1*deg2) w[i][j] = v print i,j,deg1,deg2,w[i][j], w[j][i] here whole problem for i=3 , j=5 first w[i][j] 0.4248.. i=5, , j

recursion - Is this a bug? (recursive constructors in Java) -

i've been playing recursive constructors in java. following class accepted compiler 2 examples of recursive constructors in java. crashes stackoverflowerror @ runtime using java 1.7.0_25 , eclipse juno (version: juno service release 2 build id: 20130225-0426). class mylist<x> { public x hd; public mylist<x> tl; public mylist(){ this.hd = null; this.tl = new mylist<x>(); } } the error message makes sense, i'm wondering if compiler should catch it. counterexample might list of integers constructor takes int argument , sets this.tl null if argument less zero. seems reasonable allow in same way recursive methods allowed, on other hand think constructors ought terminate. should constructor allowed call itself? so i'm asking higher authority before submitting java bug report. edit: i'm advocating simple check, prohibiting constructor calling or whatever java developers did address https://bugs.openjdk.java.net/br

php - How to process bulk actions out of WP_List_Table class in Wordpress -

i'm extending wp_list_table in wordpress in plugin. i'm using example here: http://wordpress.org/plugins/custom-list-table-example/ base i'm doing. now, in example documentation says can process bulk actions wherever want, haven't found example shows how that. specifically want process them in admin_action{$action} hook, , redirect table page. is smart thing do? important, how can it? can provide example? bulk action can implemented overwriting method get_bulk_actions() , returning associated array: function get_bulk_actions() { $actions = array( 'delete' => 'delete' ); return $actions; } you can find full details step step guide here edited to process bulk action, yes can use admin_action{$action} hook. if using simple action name(like edit, delete) thing need make sure is, put request verification code determine if request or not. way prevent interference name action prefixed plugin name (my_aswam_plugin_edi

jquery - Scroll Background Relative to Page -

this first time on stack overflow, apologize if question bit verbose. have bit of quandary: i want create parallax-scrolling effect background image (the height of larger of window) scrolls in direct relationship progress on page. for example, when you've scrolled 25% of way down page, background image should have scrolled 25%. , when you've scrolled bottom of page (100%), background image should have scrolled bottom (100%). with parallax effect, background image still scroll, wouldn't tile or need stretched. however, current code (show below), background does scroll @ slower rate content on page; reaches bottom of background , starts tiling. i feel i'm missing mathematically. ideas? here's jquery i'm using: note: background image has height of 1200px $(window).scroll(function() { var x = $(this).scrolltop(); /* scroll position */ var y = $('html').height(); /* height of page */ var z = x / y; /* progress of current positi

ios - How to add a < Back button to a navigation bar? -

i have simple app push views navigation. however, on 1 of screens push tab controller 2 tabs. when navigation goes away when reach tab controller screen. on navigation of tab screens know how < back button. basically, want know how manually create < back button on top left try this: uibarbuttonitem *backbarbutton = [[uibarbuttonitem alloc] initwithimage:[uiimage imagenamed:@"icon_back.png"] style:uibarbuttonitemstyleplain target:self action:@selector(goback:)]; self.navigationitem.leftbarbuttonitem = backbarbutton; then write goback method: - (void)goback:(id)sender { [self.navigationcontroller popviewcontrolleranimated:yes]; } note: there other initializer uibarbuttonitem. choose 1 need. hope helps.. :)

java - Eclipse: Getting error when adding external class / jar files to build path: "XYZ Cannot be resolved to a type" -

Image
i working java , eclipse, both bit out of comfort zone (yup , assignment...). i have 2 class files need use in project. far have tried: attempt #1 i tried adding external class folder : in project folder have added classes\legacy folder. in properties > java build path > libraries clicked on add external class folder in window opened selected classes folder created in step 1. in code have added import legacy.*; result: can use classes in class files getting following errors: (seems occur when classes attempting use 1 another) the project not built since build path incomplete. cannot find class file ishkesher. fix build path try building project the type ishkesher cannot resolved. indirectly referenced required .class files note: tried class folder - same results. attempt #2 someone suggested using jar files should easier, gave try: created jar file containing class files: jar cvf classes.jar contactslist.class ishkesher.c

extjs - Connect two models by ID -

i asked extjs question few days ago, , side note asked how connect 2 models. main answer got answered, still couldn't figure out other problem, opening new question it. it might silly problem again, here is: i json server, looks this: { "success": true, "result": { "publishers": [ { "id": "009999", "type": "abc", "isreceipient": false, "description": "xyz" }, { "id": 45, "type": "abc", "isreceipient": true, "description": "xyz" }, { "id": 45, "type": "abc", "isreceipient": false, "description": "" } ], "notes": [ { "publisherid": &quo

interface - Wrap fortran program for use in R -

i working r, need lot of number crunching, want in fortran. relatively new r , newbie fortran... have working r program, optimize. created fortran program solving system of ode's, keep in subroutine. additionally use module called aux.f90 store parameters , function creates signal fed equations. works intended , data saved in .txt file. what create r front-end tosses fortran program parameters, such length of simulation or number of steps used in solution. fortran heavy lifting, saves results in file , can use r visualize data file. see fortran code below: ! auxiliary module contains parameters module aux implicit none integer,parameter :: n = 2**8 ! number of steps real(kind=4) :: jout = 0.5 ! normal metabolism real(kind=4) :: alp = 4.0 ! factor growth real(kind=4) :: bet = 1.0 ! benefit value real(kind=4) :: etay = 0.1 ! cost value y real(kind=4) :: etaz = 0.10 ! cost value z real(kind=4) :: h = 3.0 ! hill

ios7 - Dot vs arrow notation in Objective-C for non structs -

i've seen examples of arrow notation used structs. in 1 tutorial, saw syntax in view controller implementation file: self->webview.cangoback) backbutton.enabled = yes; i have no idea why did not use dot notation. no explanation given. tried in simple project has button , text field. below put in button press method: //header file @property (strong, nonatomic) iboutlet uitextfield *myinputfield; //implementation file self.myinputfield.text = @"another test"; //self->_myinputfield.text = @"text field test"; either line of code works without issue. why use 1 of above lines on other? also, notice arrow notation produces _myinputfield.text . significance of underscore? in objective-c, objects c structs. if you're new language, knowledge in more trouble help. helps explain you're seeing. an objective-c property helpful construct creates ivar in object (a new field in class's struct) defaults property name prefixed undersco

Sqoop Import Create File Name with Date -

i working on sqoop script want create target directory current date. have options in sqoop --target-dir /dir1/$date. if so, exact syntax? you can't directly add $date sqoop can use shell script , pass parameters in shell script e.g. # -----------myscript.sh------------------ date=`date` echo sqoop import --connect jdbc:db2://localhost:<port_number>/<db> --table table_name --username user -password pass -m 1 --target-dir /user/$date #------------end script---------------------- now add permission script file chmod 777 myscript.sh run script file ./myscript.sh

asp.net - Unable to call server side function using jquery -

i have following code in jquery $('#btnsubmit').click(function () { $.ajax({ type: "post", url: "appointment.aspx/saveappointment", data: "{firstname:'" + firstname + "'}", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { alert(1); // interesting here. } }); }); i calling function in vb.net <webmethod()> _ public shared function saveappointment(byval firstname string) boolean dim checkval = globalclass.firstname try catch ex exception throw ex end try return true end function end class it seems work without parameters. there no call if parameters provided. referred seem work calling asp.net server side method via jquery th

iphone - OpenSSL RAND_byte issue with iOS Simulator -

Image
i have downloaded latest source openssl page (released on april 7th, 2014), , created libcrypto.a library using tutorial have followed steps in run ./build-openssl.sh script file generate libcrypto.a file environments (armv7s, armv7, i386) on mac os x having version 10.9.2 . i able encrypt / decrypt date using evp_aes_256_cbc encryption code gets failed when try rand_byte. code gets crashed on rand_byte call. below codes, trying rand_byte seeds: // code 1 unsigned char seed[32]; rand_bytes(seed, 32); // code 2 int count = 24; unsigned char *buffer = (unsigned char *)calloc(count, sizeof(unsigned char)); rand_bytes(buffer, count); // code 3 int count = 24; unsigned char *buffer = (unsigned char *)malloc(sizeof(int)*count); rand_bytes(buffer, count); // code 4 int count = 24; unsigned char *buffer = openssl_malloc(count); rand_bytes(buffer, count); when run above code on ios 6.0/6.1 simulator, gets crashed on rand_byte call , “_interposition_vtable_unimpleme

inner join - Mysql query where not exists -

i have 3 different tables - subscribers, unsubscribers, mass subscribers. i'd print out each email mass subscribers table. email can printed if doesn't exist in both subscribers , unsubscribers tables. i know how arrays, want plain mysql query. what mysql query be? thanks! you can subquery (this slow! please read below line): select email subscribers email not in(select email unsubscribers) however, bad performance. suggest change way have database, 1 table subscribers , , add column active (tinyint). when unsubscribes, set value 1 0. after can stay in 1 table: select email subscribers active=1 this faster because of reasons: no subquery the bad, because going select heap of data, , compare strings selecting on integer in fast (especially when index it) apart fact faster, better database structure. dont want 2 tables doing same, emailadresses. create duplicate data , chance misalignments

iOS Translate text given from API -

currently building weather iphone app. so, problem: using api wich gives response in english. want translate response german. somehow possible? have translated time , weekdays this: - (id)init { if (self = [super init]) { _hourlyformatter = [[nsdateformatter alloc] init]; _hourlyformatter.dateformat = @"h a"; _hourlyformatter.locale=[[nslocale alloc] initwithlocaleidentifier:@"de_de"] ; _dailyformatter = [[nsdateformatter alloc] init]; _dailyformatter.dateformat = @"eeee"; _dailyformatter.locale=[[nslocale alloc] initwithlocaleidentifier:@"de_de"] ; } return self; } ah , interface code based no interface files if needed (wich don't think never know, hu? :) ) so in case want translate condition. example clear or rain. could maybe hall me that? api using openweathermap.org one. if want app translate text automatically, system doesn't have support that, there apis can use that: language trans

Android: find the id of the inflated buttons -

i have inflated buttons using following codes, , swap location of 2 buttons selected using simple translateanimation . codes: (int k = 1; k <= quotient; k++) { linearlayout.layoutparams params3 = new linearlayout.layoutparams(button_width,row_height); params3.setmargins(button_margin, button_margin, button_margin, button_margin); btn_right = new button(this); btn_right.setid(idd); final int id_ = btn_right.getid(); btn_right.settext(""+question[idd]); frame_row.addview(btn_right, params3); btn_right.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { btn_right = ((button) findviewbyid(id_)); x1 = getrelativeleft(btn_right); y1 = getrelativetop(btn_right); int b = integer.parseint(""+btn_right.gettext().tostring()); sel

javascript - Downloading remote file using nodejs -

here problem... have node server multiple node terminals(raspberry pi) connect to. these node terminals run series of jobs , of them generate files. files not saved in terminal in mysql blob. these terminals managed through interface in server (a crm webpage). manage them using socket.io , there redis available. through socket.io can tell terminal file want, problem i'm facing getting file requesting browser client. can identify browser via socket id not sure how going serve file. or suggestion great. note: im not using js or nodejs frameworks.

ios - How to fill a UIBezierPath with a gradient? -

Image
i've drawn graph using uibezierpath. can fill area under graph solid color want fill area under graph gradient rather solid color. i'm not sure how make gradient apply graph , not whole view, i've read few questions not found applicable. this main graph drawing code: // draw graph uibezierpath *bargraph = [uibezierpath bezierpath]; bargraph.linewidth = 1.0f; [bluecolor setstroke]; tcdatapoint *datapoint = self.testdata[0]; cgfloat x = [self converttimetoxpoint:datapoint.time]; cgfloat y = [self convertdatatoypoint:datapoint.datausage]; cgpoint plotpoint = cgpointmake(x,y); [bargraph movetopoint:plotpoint]; (int ii = 1; ii < [self.testdata count]; ++ii) { datapoint = self.testdata[ii]; x = [self converttimetoxpoint:datapoint.time]; y = [self convertdatatoypoint:datapoint.datausage]; plotpoint = cgpointmake(x, y); [bargraph addlinetopoint:plotpoint]; } [bargraph stroke]; i've been attempting fill graph experimenting code following, hones

javascript - JQuery selector with both a selector and not-selector -

i have following jquery function: $('article.node--article p, .video-title').highlightwordandscroll({ words : search_word, tag : '<span class="found_keyword">', closingtag : '</span>', }, scrollto); which wraps class found_keyword around search_word . nothing more. between <p> tags <img> tags. , because found_keyword class wrapped around image name, image isn't rendered anymore. <p class="rtecenter"> <img alt="" src="/sites/default/files/userfiles/logo_&lt;span class=" found_keyword"="">foto.jpg" style="height:87px; width:332px"&gt; </p> and so, image-rendering broken. there way exclude image tag in jquery selector? edit link. i've tried following code, no luck there... $('article.node--article p, .video-title').children().not("img").highlightwordandscroll({ words

math - d3.js how to calculate new endpoints for each line with a distance of X from node center -

i have force directed graph , i'd adjust endpoints of lines 30px node center. believe need modify tick function calculate new coordinates x1,y1 , x2,y2 haven't touched geometry in long time , can't seem figure out right equation accomplish this. any or guidance appreciated. update... so managed using following (thanks friend). slight caveat, has bug line vertical. if has more efficient way i'd love help. function distance(x1,y1,x2,y2) { y = y2 - y1; x = x2 - x1; return math.sqrt(x*x + y*y); } function calc_slope(d) { x1 = d.source.x; y1 = d.source.y; x2 = d.target.x; y2 = d.target.y; return (y2-y1)/parsefloat(x2-x1); } function calc_constant(slope, x, y) { return (y - (slope * x)); } function calc_y(slope, constant, x){ return (slope * x) + constant; } function adjusted_source_x(d, adjustment_size) { x1 = d.source.x; y1 = d.source.y; x2 = d.

mysql - Subquery vs join -

select id posts subject_id = 1 or subject_id in ( select related_subject_id relatedsubjects parent_subject_id = 1); trying select posts current subject sub-subjects stored in lookup table. above query works, wondering how accomplish same thing join select distinct id posts p left join relatedsubjects r on p.subject_id = r.related_subject_id , r.parent_subject_id = 1 p.subject_id = 1 or r.related_subject_id not null

ios - Passing data from login controller to frontviewcontroller of SWRevealViewController -

Image
i'm sorry english. my question how pass data login viewcontroller frontviewcontroller of swrevealviewcontroller library. let me explain situation. my app has login view. if login informations ok can enter inside app menu managed swrevealviewcontroller. this storyboard: to "remember" user logged-in want pass id loginview (in storyboard called "view controller") "homeappviewcontroller". in viewcontroller prepareforsegue method wrote code: -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender{ if ([[segue identifier] isequaltostring:@"entrataapp"]) { swrevealviewcontroller *destination = [segue destinationviewcontroller]; uinavigationcontroller *navviewcontroller = (uinavigationcontroller *) [destination frontviewcontroller]; homeappviewcontroller *destviewcontroller = (homeappviewcontroller* )[navviewcontroller topviewcontroller]; destviewcontroller.testopassato = risposta; } } and in homea

javascript - Count number of rows inside a div element -

Image
as shown in image below, have several div inside div (outer div). need count number of rows outer div have. in example row count 5. note:the inner div floated left , content created dynamically. does has ideas? perhaps along lines of: demo fiddle var minleft = null, rows = 0; $('div div').each(function () { var left = $(this).offset().left; if (left <= minleft || minleft==null) { rows++; minleft=left; } }); console.log(rows);

google app engine - Separate datastore data from debug and live versions of app -

what best approach separate data debug version , live one? the question , answers here describe how separate code logic: https://stackoverflow.com/a/8550105/129202 still datastore data shared between versions. i imagine of these: some nice setting in dashboard automatically separate data between versions, ignorant of each other. no changes needed in code, unless expect versions share data :-p get version number in code , use "physically" organize data, ie putting data in subfolders/subkeys per version... i'm not experienced datastore yet , don't know if have significant impact on performance. you can't seperate data based on versions. you use name space, wouldn't i use different instance , copy production data instance, run testing there, complete confidence working separate data set. some of projects, data specific companies/users , set test companies , test users, approach dependent on types of updates, , how segmented data is.

clojure - let forms : How to access destructured symbols in a macro? -

i'm trying write macro expands let form destructuring. problem have list of symbols defined in let form, including obtained destruturing. use case i'm trying factor out kind of behavior, validation example : (let [a (foo bar) {x :x, y :y, {u :u, v: v :as nested-map} :nested} some-map] (and x y nested-map u v ; testing truthiness (valid-a? a) (valid-x? x) (valid-y? y) (valid-nested? nested-map) (valid-u-and-v? u v) )) proposed solution it nice achieve through sort of and-let macro call this: (and-let [a (foo bar) {x :x, y :y, {u :u, v: v :as nested-map} :nested} some-map] (valid-a? a) (valid-x? x) (valid-nested? nested-map) (valid-u-and-v? u v)) what i'm missing but i'm missing way of accessing list of symbols bound in let form. if had list-bound-symbols function, : (defmacro and-let "expands , close previouly

php - Display current post on single template -

i have plugin automatically expires posts , changes it's post status "archive" on date. we have archive section houses these posts. still want display data post gives page not found. can alter query display post on single template? i've tried following pulls in archive posts rather page you're on. <?php $my_query = new wp_query('post_status=archive'); ?> <div> <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?> <ul> <li> <?php the_title(); ?> </li> </ul> <?php endwhile; else: ?> <div> <ul> <li><?php _e('no upcoming posts'); ?></li> </ul> </div> <?php endif; ?> </div> post status allows users set workflow status post in wordpress. there 8 default st

r - Subset rows which have a column inside numeral interval -

i subset lines have "chr" column 1 29, in "cnv1" dataframe. i tried it: cnvk <- cnv1[cnv1$chr==1:29,] but not lines have 1,2,3...29. cheers! try cnvk <- cnv1[cnv1$chr %in% 1:29,] or cnvk <- cnv1[cnv1$chr>=1 & cnv1$chr<=29,] (the latter might quicker if you're checking against large range of values)

angularjs - Implementing keyboard shortcuts in Angular apps -

i using directive implement keyboard shortcuts in angular app. directive called "keycapture". included in body tag of index page. <body ng-controller="mainctrl" key-capture> this directive uses mix of $broadcast , other methods things done. angular.module('plunker').directive('keycapture',['$state','$rootscope',function($state, $rootscope){ var shortcutkeys = []; return { link: function(scope,element,attrs,controller){ element.on('keydown',function(e){ shortcutkeys.push(e.keycode); if (shortcutkeys.length === 2){ var key2 = shortcutkeys.pop(); var key1 = shortcutkeys.pop(); /*press g , 1 - navigate different state*/ if (key1 === 71 && key2 == 49) { $state.transitionto('option1'); } /*press g , 2 - navigate different state*/ if (key1 === 71 && key2 == 50) {

Is there an equivalent of Androids ShowcaseView for iOS? -

there project android on github: https://github.com/amlcurran/showcaseview according readme: the showcaseview library designed highlight , showcase specific parts of apps user distinctive , attractive overlay. library great pointing out points of interest users, gestures, or obscure useful items. i know if functionally equivalent 1 exists ios. useful give users quick tour of app. typically app intros handled few swipe screens. think uber , duolingo. google , stackoverflow searching returns nothing meaningful. if had time i'd work on side project. edit: i've ended using github.com/ifttt/razzledazzle works both swift , objective-c. you can try https://github.com/rahuliyer95/ishowcase similar implementation of showcaseview android on ios.

actionscript 3 - Away3D click listener doesn't work with all the cube, only its center -

i trying add click listener cube in away3d. works... partially. seems click works center of cube's face. have no idea why because should taking bounding box (which, of course, cube). if click somewhere "near" edge of cube, nothing happens. the code rather simple: cube = new mesh(new cubegeometry(400, 400, 400, 1, 1, 1, false)); cube.mouseenabled = true; cube.addeventlistener(mouseevent3d.click, cubeclickhandler); var t:trident = new trident(); cube.addchild(t); scene.addchild(cube); ... private function cubeclickhandler(event:mouseevent3d):void { navigatetourl(new urlrequest("http://www.google.com")); } any idea doing wrong , how resolve it? lot! example here here suggestions: have tried rotate camera? have tried without trident?(it have big bb , occlude) have tried other picking method? cube.pickingcollider = pickingcollidertype.as3_best_hit it's possible framerate in example (1fps) interfere, try set @ least @ 10fps

soap - wso2 ESB request is truncated -

i'm using fresh installation of wso2 esb 4.8.1 stanalone default configuration. when send soap request backend (perl service soap lite), body of post request truncated according tcpdump: soapaction: "" content-type: text/xml content-length: 511 host: 192.168.11.234:8181 connection: keep-alive user-agent: synapse-pt-httpcomponents-nio <?xml version="1.0" encoding="utf-8"?><soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="htt p://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <soap:body> <deleteaccountforhost xmlns="abcdehostingphysicalhostmanagercpanelservice"> <host xsi:type="xsd:string">zs000.abcde.net</host> <user xsi:type="xsd:string">tstauto</user> </deleteacc

C++ : Is it bad practice to use a static container in a class to contain pointers to all its objects for ease of access? -

i know if it's bad practice have static container in class store pointers class' objects can accessed base classes of program. game , saw on sdltutorials dot com, , find useful. allow me have neat structure game , don't see downside doing this, know have careful "global" access , maybe there's negative effect i'm not seeing right now. here context/example. game has base class basic methods such loop(), render(), playaudio(), cleanmemory(). idea have individual objects have same methods being executed inside base method. example in pseudocode: game::render() { (iterate enemies in static container) { current_enemy::render(); } } to sure, static member inside class this: static std::vector<enemy*> enemylist; so way, when game executing base render() method, example, can iterate enemies in enemies' class static container , execute individual render() methods, same environment objects, player, etc. i make sure i'm awa

php - Email Verification/Validation - Error -

i think post may appear "off" topic others. it'll great thank if me out this. i found email verification code on web. somehow, find confusing @ first when began understand , put on code. there's error , don't know how. problems: the email verification code. proper syntax/use of code. code: <?php if(isset($_post['submit'])) { $a = $_post['username']; $b = $_post['password']; $c = $_post['firstname']; $d = $_post['lastname']; $e = $_post['month']; $f = $_post['day']; $g = $_post['year']; $h = $_post['contact']; $i = $_post['email']; $j = $_post['confirm']; $code = md5(uniqid(rand())); include("dbconnect.php"); $query = "select * `users`.`info` `username`='".$a."' , `email_address`='".$i."'"; $queryquery=$con->query($query);

io - Can't read the files from a folder in series in java -

i trying read files folder java, found snippet , used it. file folder = new file("z.."); file[] listoffiles = folder.listfiles(); (int = 0; < listoffiles.length; i++) { file file = listoffiles[i]; if (file.isfile() && file.getname().endswith(".txt")) { string content = fileutils.readfiletostring(file); } this works fine except doesn't retrieve files in order. have files numbered file 0,file 1, file2.....file10 , how retrieves file 0 file 1 file 10 , file 2, should retrieve in proper series. should using else? i'm new this. there great example of using custom comparator sort array of files here: best way list files in java, sorted date last modified you have modify return of comparator along lines of return f1.getname().compareto(f2.getname()); and should you're looking for. if files numbered may want compare file names integers: return integer.valueof(f1.getname()).compareto(integer.va

Showing three different edge images in single figure for comparison (No Subplot) -

hello friends, have applied canny edge detection 3 different images , got 3 images of edges of circles of 3 different sizes. want show these 3 edges of circles of different radius in same figure different colors compare them. how can done? have tried use imfused command did not desired result. please me here quick solution might not best method: % edge detection = imread('circuit.tif'); bw1 = edge(i,'canny'); bw2 = edge(i,'sobel'); % black result image (it else) imrgb = repmat(zeros(size(bw1)), [1 1 3]); % color matrices, red , green rm = repmat(cat(3,1,0,0),size(bw1,1),size(bw1,2)); gm = repmat(cat(3,0,1,0),size(bw1,1),size(bw1,2)); % logical matrices same dimension result image lm1 = repmat(bw1,[1 1 3]); lm2 = repmat(bw2,[1 1 3]); % overwrite pixel positions color matrices according logical matrices % logical matrices derived edge detected ones imrgb(lm1) = rm(lm1); imrgb(lm2) = gm(lm2); imshow(imrgb)

ember.js - Why am I getting an error after successful deleteRecord in Ember -

i error after calling deleterecord , save on entity. i'm using ds.restadapter , delete works in backend console throwing error error: no model found 'id' @ new error (native) @ error.ember.error (http://localhost:3000/assets/ember.js?body=1:913:19) @ ember.object.extend.modelfor (http://localhost:3000/assets/ember-data.js?body=1:9808:33) @ jsonserializer.extend.extractsingle (http://localhost:3000/assets/ember-data.js?body=1:3021:28) @ superwrapper [as extractsingle] (http://localhost:3000/assets/ember.js?body=1:1295:16) @ ember.object.extend.extractsave (http://localhost:3000/assets/ember-data.js?body=1:2511:21) @ ember.object.extend.extractdeleterecord (http://localhost:3000/assets/ember-data.js?body=1:2468:21) @ ember.object.extend.extract (http://localhost:3000/assets/ember-data.js?body=1:2368:37) @ http://localhost:3000/assets/ember-data.js?body=1:10436:32 @ invokecallback (http://localhost:3000/assets/ember.js?body=1:10016:19) ember.js?body=1:3524 uncaught err

jquery - How to add text-align buttons to toolbar in TinyMCE 4.x? -

this link: http://www.tinymce.com/wiki.php/tinymce3x:%22for_dummies%22 shows under headline "custom advanced tinymce wysiwyg editor" in second window behind "theme_advanced_buttons" names of buttons can add toolbar. it's bit different in version 4.x works following way: $('#my_textarea').tinymce({ plugins: 'link,code,preview,autolink', height: 350, width: 750, toolbar: "undo redo | styleselect | bold italic | justifyleft justifycenter justifyright | bullist numlist | link image | preview code" }); except justifyleft justifycenter justifyright buttons works perfect. how find out right button names these buttons? found answer here: http://www.tinymce.com/tryit/full.php "alignleft aligncenter alignright alignjustify" works

sql - TempVar use in query -

Image
so client has 4 queries need updated every time process run. i setting macro ask user input on variable called 'filedate'. here's how looks: settempvar name = filedate expression = inputbox("enter filedate (yyyymmdd):") now works fine ( can tell ) then wanted use messagebox display value of tempvar, since it's in same macro, didn't see problem this. messagebox message = "you entered:" & [tempvars]![filedate] & "." beep = yes type = informative title = input i've tried several variations of syntax no progress... issues i can't messagebox show value set variable, displays message - know proper syntax messagebox? once figure out, i'd enter input box once, , insert variable each query requires update. currently i'm accepting user input every query: update test_pcp_changes set test_pcp_changes.datercvd = [enter filedate (yyyymmdd): ] (((test_pcp_changes.datercvd) nu

html - CSS: counter property renders empty -

i'm trying create printing page has attachments running numbering (for example: page 3 of 5). far have succesfully created page header repeating on attachment pages, , has correct page numbering, on first page. on second attachment page total number rendered empty. i'm trying not use javascript achieve this. to reproduce issue, copy following code html file open in firefox , go print preview , move second or third page, notice total page number empty. there no need support other browsers firefox. any welcome! :) <!doctype html> <html> <head> </head> <body> <style> body{ counter-reset: joku, attachment; } table { page-break-inside: auto; page-break-after: always; } tr { page-break-inside:avoid; page-break-after:auto; } table td { border-bottom:1px sodiv.attachment-page-breakd gray; } th { font-family:arial; color:black; background-color:div.attachment-page-breakghtgrey; } thead { display:t