Posts

Showing posts from August, 2015

jquery - Convert Magento Dropdown to Buttons or list -

is there possibility convert classic dropdown product configurable view list of buttons inline jquery, javascript or css3 ? this example of website: http://demo.extensionsmall.com/color-swatch-examples/configurable-product-with-popup-boxes.html i appreciate if can examples. regardless, doing through extension proper way of modifying this. here link github of extension similar. not sure compatibility 1.8 work reference. https://github.com/dbashyal/magento-configurable-products-radio-select

jquery - Selecting elements to hide if either first or last in an array -

i'm using slider looping turned off issue running display of navigational arrows first , last slides. having troubling finding way communicate left arrow should hidden on first slide , right arrow last slide. can target specific slides myswiper.getfirstslide() / myswiper.getlastslide() hide display of respective arrows? or set length of array , designate each arrow hide either if first or last in list? i'm not sure if these correct approaches. open suggestions. http://codepen.io/newbcake/pen/sibxi try this, $('.arrow-left').hide() var myswiper = new swiper('.swiper-container',{ loop:false, onslidechangeend: function () { $('.arrow-left').show() $('.arrow-right').show() if(myswiper.activeindex==0){ $('.arrow-left').hide() } if(myswiper.activeindex==myswiper.slides.length-1){ $('.arrow-right').hide() } } }) $('.arrow-left').on('...

javascript - ExpressJS - Regex for matching a path doesn't work -

i have simple regex should match words made of letters (0-5) doesn't seems working. how should regex , used in expressjs? url trying validate may something.com/abcd var express = require("express"), app = express(); app.get("/:id(^[a-z]{0,5}$)", function(req, res) { res.send("the right path!"); }); app.listen(8000); to set url accepts / followed 5 ascii characters, this: var express = require("express"), app = express(); app.get("/[a-z]{0,5}$", function(req, res){ res.send("right path!"); }); app.listen(8000); result: get http://localhost:8000/ right path! http://localhost:8000/abcde right path! http://localhost:8000/abcdef cannot /abcdef note: express case insensitive routing default. change it, put @ top of script: app.set('case sensitive routing', true); now, [a-z] match lower case characters: get /abc not get /abc

Matrix: limiting translate and scale in android -

i drawing image in android using canvas. i'm using surfaceview's ontouch method let user scale , move image. i can limit scaling have problem limiting translate. can limit translate if scale of matrix in original form, if scale changed i'm having problem limiting translation.

Create PHP session variable inside Kinetic.js/Javascript -

i trying create php session variable inside of kinetic.js/javascript. stage.on('mousedown', function(evt) { var shape = evt.targetnode; if (shape) { if (shape.getfill() == 'green') { //$_session['room_name'] = shape.getattr('key'); window.location.href = 'create.php'; } } }); when shape clicked, want session variable store 'key' attribute, string, go 'create.php'. how can this? edit: cerbrus, tried suggestion: stage.on('mousedown', function(evt) { var shape = evt.targetnode; if (shape) { if (shape.getfill() == 'green') { var img = new image(); img.src = "script.php?roomname=" + encodeuricomponent('hello'); window.location.href = 'create.php'; } } }); the user sent 'create.php', when tried print in 'create.php': <?php echo $_get['roomname']; ?> nothing echoed ...

Fusion Tables URL is too long -

i have chart in fusion tables , want embed html page. link fusion tables generated long , caused 414 error: https://www.google.com/fusiontables/embedviz?containerid=googft-gviz-canvas&q=select+col0%2c+col2+from+1byyqosoa5ydbaiktz4fa_0p_irtl8ejkrs3ppzg+order+by+col0+asc&viz=gviz&t=area&rmax=250&uiversion=2&gco_forceiframe=true&gco_haslabelscolumn=true&gco_vaxes=%5b%7b%22title%22%3a%22difficulty%22%2c+%22minvalue%22%3anull%2c+%22maxvalue%22%3anull%2c+%22useformatfromdata%22%3atrue%2c+%22viewwindow%22%3a%7b%22max%22%3anull%2c+%22min%22%3anull%7d%2c+%22logscale%22%3afalse%2c+%22titletextstyle%22%3a%7b%22color%22%3a%22%23222%22%2c+%22fontsize%22%3a%2213%22%2c+%22italic%22%3afalse%2c+%22bold%22%3atrue%7d%2c+%22textstyle%22%3a%7b%22color%22%3a%22%23222%22%2c+%22fontsize%22%3a12%2c+%22bold%22%3afalse%2c+%22italic%22%3afalse%7d%2c+%22gridlines%22%3a%7b%22count%22%3a%227%22%2c+%22color%22%3a%22%23cccccc%22%7d%2c+%22minorgridlines%22%3a%7b%22count%22%3a%22...

gridview - Bootstrap 3 grid, set 1 column size for all displays -

in bootstrap v3, column sizes declared different screen sizes.. <div class='container'> <div class='row'> <div class='col-md-6 col-lg-6 col-sm-6'> i find myself needing 1 size display types.. , thought like <div class='col-6'> where no matter display size user on, keep width of column 6/12 of grid system.. doesn't seem work. missing? the correct answer sizes <div class='col-sm-6'> . suggested other answers, apply larger it. there fourth size, though, xs , using <div class='col-xs-6'> apply every possible size.

javascript - Dynamically getting a checked input's value and send with AJAX -

Image
i'll start of telling i'm using bootstrap 3 , button system radio buttons: so whichever of these buttons clicked, other button unclicked. i'm struggling getting value of button checked , send through ajax call php script. problem pure jquery/javascript though, i've been trying alert() correct value, can't there. so problem occurs follow (demo try): i click 1 button i alert value i wrong result each time. when click 130 110 , continue 160 , 130 , on. i'm 1 step back. in real world project, need take value , send ajax call can determine based on number in php script. way tried create js object like: var selected_thumbwidth = { width: 110 }; and change value this: $('.thumb-sizes .btn').click(function() { selected_thumbwidth.thumbwidth = $('.thumb-sizes .active').children().val(); }); then alert ing outside click callback gives me results described above. why selecting .active class? well, whenever button cli...

reporting services - How to put a label under each column in a SSRS chart -

Image
i have made chart in ssrs cannot figure out way x-axis show number under each column(month). does 1 have advice? thanks ah got it, needed set interval in chart-axis 1

javascript - How to stream a canvas element in WebRtc? -

i searching webrtc , found great project on github: https://github.com/mexx91/basicvideortc the communication between 2 cameras works great using node.js. it's possible before stream getusermedia modify in canvas element , stream object? thanks it seems not possible in cross-browser compatible fashion. but may in future, can take glimpse @ htmlcanvaselement.capturestream interface implemented recent firefox browsers, see https://developer.mozilla.org/en-us/docs/web/api/htmlcanvaselement/capturestream . it allows capture content of canvas stream can send wia webrtc peer then.

mongodb - Unknown provider error when injecting factory -

i using yeoman angular full stack generator. trying out todo items tutorial mongodb. worked fine i.e. able read db using $http.get. decided go further , create factory can perform curd. after creating factory tried inject getting error follows: error: [$injector:unpr] unknown provider: facttodoprovider <- facttodo http://errors.angularjs.org/1.2.6/$injector/unpr?p0=facttodoprovider%20%3c-nanacttodo @ http://localhost:9000/bower_components/angular/angular.js:78:12 @ http://localhost:9000/bower_components/angular/angular.js:3538:19 @ object.getservice [as get] (http://localhost:9000/bower_components/angular/angular.js:3665:39) @ http://localhost:9000/bower_components/angular/angular.js:3543:45 @ getservice (http://localhost:9000/bower_components/angular/angular.js:3665:39) @ invoke (http://localhost:9000/bower_components/angular/angular.js:3687:13) @ object.instantiate (http://localhost:9000/bower_components/angular/angular.js:3708:23) @ http://localhost:9000/bower_components...

database - Query for most favorited in each category -

i have table of creations . each belongs category (with categoryid ). have field called statfavorites . i want return flat list of single creation favorites each category in list. the way can think of doing groupedmapreduce . there way? var categories; // objects id r.table('creations') .filter(function(creation) { return categories.filter(function(category) { return category.id == creation.categoryid }).length > 0 }) .groupedmapreduce(function(row) { return row("categoryid") } , function(row) { return row } , function(best, creation) { return r.branch(creation("statfavorites").gt(best("statfavorites")), creation, best }) two things happening above: first, i'm filtering creations match categories care (equivalent of in query in mongo. how in rethink?) second, i'm getting favorited of each one. is there better way of doing this? may ok pre-calculate things when i'm writing data. you c...

jquery how to set jquery DOM name -

i studying jquery , customize it. when check stackoverflow.com source code view source code in browser. found : stackexchange.ready(function () { stackexchange.using("postvalidation", function () { stackexchange.postvalidation.initonblurandsubmit($('#post-form'), 2, 'answer'); }); how write stackexchange.ready , function stackexchange.question.init, stackexchange.realtime.subscribetoquestion etc pls me something - var yourcustomname = $(document); go ahead - yourcustomname.ready(function () { stackoverflow has custom ready method - stackexchange.ready=function(d){stackexchange.initialized.done(d)};

emacs - Clojure: are there docs for java functions e.g. Math/exp? -

i expect (doc math/exp) give me doesn't. sure it's not clojure function, still there should way reach documentation. closest thing can (javadoc math) . prefer actual doc page string: static double exp(double a) returns euler's number e raised power of double value. upd: signature reflection here's how can signature: (.tostring (first (filter #(= (.getname %) "exp") (.getmethods math)))) i'm hoping similar way doc. upd: no doc reflection according question how read javadoc comments reflection? , it's not possible doc reflection. wonder if it's possible re-use of eclipse code give access docs. simply start typing method name intend use: (java.lang.math/exp) and cursor on "exp" , press m-. see cider docs more related hotkeys https://cider.readthedocs.io/en/latest/interactive_programming/ if install "company-mode", searching class intend use gets easier via autocomplete.

php - How to manage Drupal custom modules? -

imagine scenario: use custom drupal module in drupal-7 website , in drupal-7 website b , make changes custom module in website a. if want these updates in drupal website b, you'll have to: push changes remote server (at moment use git repo keep track of our custom drupal modules) pull changes in website b (and other websites use custom module) is there way don't have keep track of websites custom module installed? in other words: possible notice in website b there new version of custom module, if default contrib drupal module? the closest you'll without writing custom feature server module this module allows share features , custom modules on own website. lets create projects , releases, , produces update xml feed compatible update module in core. in way it's highly simplified version of project module. there's release drupal 6, can use version provide feeds d7 modules too.

Phantom.js .NET authentication -

what common problems when trying authenticate phantom.js against asp.net site? here specific issue; able navigate asp.net site , fill in login form appropriately, verify rendering simple test.png file. point works expected. once submit form (either form.submit() or element.click(); ), page reloads not redirected authenticated side of site. it's same page if authentication failed. difference, though, new rendered page has password removed password field. i know credentials correct, can log in browser. i using following test script received post , made minor changes. can please me or point me in right direction? var page = require('webpage').create(), testindex = 0, loadinprogress = false; page.onconsolemessage = function(msg) { console.log(msg); }; page.onloadstarted = function() { loadinprogress = true; console.log("load started"); }; page.onloadfinished = function() { loadinprogress = false; console.log("load finished...

c++ - Problems with execvp -

i'm trying create simple shell. here's i've done far: #include <iostream> #include <sys/wait.h> #include <unistd.h> #include <string> #include <vector> #include <sstream> void execute(std::vector<char *> instructions) { auto pid = fork(); int status; if (pid < 0) { std::cout << "fork error occured!" << std::endl; exit(1); } else if (pid == 0) { if(execvp(instructions[0], instructions.data()) < 0) { std::cout << "command not found" << std::endl; exit(1); } } else { while (wait(&status) != pid); } } std::vector<char *> splitter(std::string input) { std::istringstream iss(input); std::vector<std::string> tokens{std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>{}}; std::vector<char *> instructions(tokens.size());...

image processing - Strange result of making one picture from to on PHP -

in project, need merge 2 pictures. the first (img.png): img http://uoops.ru/1/img.png and (for example) second (photo.png): img http://uoops.ru/1/photo.png this php code: $photoimage = imagecreatefrompng("img.png"); imagealphablending($photoimage, true); $logoimage = imagecreatefrompng("photo.png"); $logow = imagesx($logoimage); $logoh = imagesy($logoimage); imagecopy($photoimage, $logoimage, 1, 1, 0, 0, $logow, $logoh); imagepng($photoimage, "mrkr.png", 0); as result want have this: http://uoops.ru/1/result.png but have this: http://uoops.ru/1/mrkr.png how can fix this? $photoimage = imagecreatefrompng("img.png"); $w = imagesx($photoimage); $h = imagesy($photoimage); $out = imagecreatetruecolor($w, $h); imagealphablending($out, true); imagefill($out, 0, 0, imagecolorallocatealpha($out, 0, 0, 0, 127)); imagesavealpha($out, true); imagecopy($out, $photoimage, 0, 0, 0, 0, $w, $h); $logoimage = imagecreatefrom...

android - Play store reports "Your device isn't compatible with this version" but it installs via adb just fine on Nexus7 -

i have app released private google play beta. can install exact same apk nexus 7 fine adb pm install but through google play store marked exact same nexus7 as your device isn't compatible version. this same apk. can't figure out how information on why play store thinks it's not compatible. my manifest looks this: <uses-sdk android:minsdkversion="10" /> <uses-permission android:name="android.permission.internet"></uses-permission> <uses-permission android:name="android.permission.camera"></uses-permission> <uses-permission android:name="android.permission.record_audio"></uses-permission> <uses-permission android:name="android.permission.read_phone_state"></uses-permission> <uses-permission android:name="android.permission.wake_lock"></uses-permission> <uses-permission android:name="android.permission.modify_audio_settin...

Highcharts Stacklabel Style backgroundColor -

how can change background color of stacklabel. didn't find example this. i tried ... dont worked. yaxis: { title: {text:'%'}, stacklabels: { style: { backgroundcolor: 'rgba(252, 255, 197, 0.7)', color: 'black', borderwidth: 1 }, any ideas? you need enable usehtml . stacklabels: { style: { backgroundcolor: 'rgba(252, 255, 197, 0.7)', color: 'black', borderwidth: 1 }, enabled: true, usehtml: true }

python - Apply formula to specific numpy array values -

i have 2 dimensional array in numpy , need apply mathematical formula values of array match criteria. can made using loop , if conditions think using numpy where() method works faster. my code far doesn't work cond2 = np.where((spn >= -alpha) & (spn <= 0)) spn[cond2] = -1*math.cos((spn[cond2]*math.pi)/(2*alpha)) the values in orginal array need replaced corresponding value after applying formula. any ideas of how make work? i'm working big arrays need , efficient way of doing it. thanks try this: cond2 = (spn >= -alpha) & (spn <= 0) spn[cond2] = -np.cos(spn[cond2]*np.pi/(2*alpha))

ruby on rails - Geocoder Gem not working in Production Environment -

so using geocoder pull in latitude , longitude coordinates based on address provided user when submitting form. doing can plot markers using google maps api. works in development - 0 issues. when push production however, latitude , longitude not generated geocoder. have checked production logs , there 0 errors. checked make sure gem not installed development , have restarted unicorn , nginx on production machine. ideas going on? here model code model preforming task in -- class order < activerecord::base attr_accessible :city, :customer_email, :customer_id, :delivery_date, :delivery_time, :street, :zipcode, :coupon, :total, :name, :items_with_day, :user_id, :shopping_cart_id, :extras, :latitude, :longitude, :location_name, :phone, :suite, :state belongs_to :user validates :name, :presence => true validates :street, :presence => true validates :city, :presence => true validates :zipcode, :presence => true def address [street, city, sta...

android - "The specified child already has a parent" How can I remove view from AlertDialog -

i inflating linearlayout alertdialog. works fine if dismis , launch again gives me following error java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. in contructor: infowindow = (linearlayout) ((activity) context).getlayoutinflater().inflate(r.layout.map_info_content, null); later: protected boolean ontap(int index) { builder dialog = new alertdialog.builder(context); dialog.setview(infowindow); dialog.show(); return true; } i have tried keep dialog in memory , setting it's view null didn't fix problem you cannot re-use inflated views in android once you've added them parent viewgroup . @ side, you're trying reuse inflated view in dialog. solve problem, inflate view in alertdialog class itself. i'd recommend create separate class it. here's how oncreatedialog method like: public dialog oncreatedialog(bundle savedinstance){ /...

google app engine - Advice needed for Concurrent read and write scenario in GAE Python NDB -

i developing ticket booking website using gae python. website lists available vehicles on selected date , allows customer book it. when customer selects vehicle , proceeds booking, want temporarily block vehicle day nobody else books using our website. temporary block should revoked automatically in next 2 minutes if customer fails make payment correctly. planning have model below: class availability(ndb.model): vehicle = ndb.stringproperty() date = ndb.datetimeproperty() status = ndb.stringproperty() #"available" or "booked" temporary_blocking_time = ndb.datetimeproperty() i update "temporary_blocking_time" variable selected vehicle , date. when other customer searches vehicle on same date, "temporary_blocking_time" vehicle checked , if less 2 minutes old, vehicle not listed customer book. t0 < t1 < t2 < t3 problem logic: when customer "x" wants proceed book given vehicle, read "temporary...

c# - Accessing Link Button Text Present in Grid view column -

i have telerik gridview contains several columns of few columns link-buttons. want access text of link button upon clicking on in code behind. want access particular column text clicked in code behind. code follows <telerik:gridtemplatecolumn datafield="employeehrid" filtercontrolalttext="filter employeehrid column" headertext="employee hr id" sortexpression="employeehrid" uniquename="employeehrid"> <itemtemplate> <asp:linkbutton id="lbemphrid" runat="server" emphrid='<%#eval("employeehrid") %>' cssclass="emphridcss"> <%#eval("employeehrid")%> </asp:linkbutton> </itemtemplate> </telerik:gridtemplatecolumn> please me this haven't used telerikgrid basic step have find control in rowcommand event or si...

canopy - Returning value to pane from macro in ipython -

i new python.. trying create macro. when selected word , press f3 filedialog come , ill select folder,ill occurance of word in files in tat folder displayed in pane. problem couldn't return value macro editor pane. currently using code code_task = get_active_task() python_pane = code_task.python_pane python_pane.execute_command(u'print "searchstring"\n') (consider searchstring contains data) when try execute telling tat undefined variable searchstring. me how send data macro editor pane.

javascript - Highstock chart not rendering data completely on first load -

Image
i struggling weird problem highstock chart. if have large number of datapoints , multiple graphs on same page 1 of graph shown partial data on load. the datapoints not more 18000 (half hourly data). and after user clicks on zoom button or clicks on 'inspect element' in chrome graph shown should be. i tried searching on stackoverflow couldn't find reason behaviour. any help/pointer appreciated. (i'm using asp.net mvc , data called json returned web api, not relevant wanted add these if useful) thankx, siddhant ah!! issue fixes self when use latest highstock.js library. using 1.3.6 , latest 1 1.3.9

c# - How can i change the color of two lines in mouse down event? -

i have code: private void scrolllabel1_mousedown(object sender, mouseeventargs e) { (int = 0; < scrolllabel._lines.length; i++) { } } _lines type of string[] _lines format this: first index 0 contain text: "hello" index 1 contain line of date , time: fri, 31 jan 2014 18:31:12 +0200 then index 2 empty line space: "" then index 3 again text: "hi" index 4 again date , time: fri, 31 jan 2014 18:31:30 +0200 and os on there 151 lines. what want when click(down) on line part of 2 lines text + date , time color both lines. for example clicked on line in index 0 anywhere on line color index 0 , index 1 if clicked on line in index 2 empty nothing. if click on line in index 3 or 4 color lines 3 , 4. if clicked on line 3 or 4 color both lines 3 , 4. if clicked on line example 123 or 124 color both 123 , 124. how can ? scrolllabel usercontrol type label dragged form1 designer. , dose...

sql - Mysql sort by date but ignore year -

i have table has mysql date field type. i searching entries , need sort entries soonest first within next 30 days. but, of entries have years on them have expired recurring data. for date find i'm using dayofyear works great. question is: can sort following least number of days until event, first? select b.name, ue.event_title, ue.event_date brains b join user_events ue on b.user_id=ue.user_id b.user_id=63 , mod(dayofyear(ue.event_date) - dayofyear(curdate()) + 365, 365) <= 30 order event_date desc order event_date desc goes wrong because of year figured out: answer select b.name, ue.event_title, ue.event_date, (dayofyear(ue.event_date) - dayofyear(curdate())) days brains b join user_events ue on b.user_id=ue.user_id b.user_id=63 , mod(dayofyear(ue.event_date) - dayofyear(curdate()) + 365, 365) <= 30 order days asc

How Does the Single Store Xpages work? -

i have number of xpages design elements use in many different databases. if read wiki correctly single store or nothing situation. want create unique design in database use set of reusable xpages element single store location. wiki says: apart "dummy or blank xpage same name of default xpage" in each instance application, matter if 'instance' contains xpage design elements? no. if scxd set on application xpages design elements ignored on database , application uses design elements on scxd database. if case have create databases 75% of code reusable have repeat (and maintain it) in dozens of separate databases. pity! xpages , related elements (custom controls, ssjs libraries, java code) can inherited specific template other design elements. so, setup database called, perhaps, "core components" (.ntf or .nsf) template name of "corecomponents" . on individual elements in target db set inheritance "corecomponents" template....

javascript - How do i Make a load more button -

i wake to create button.. everytime user click on load more buttom want keep number ++ on , on.. far gotten ten dont know how make load more without stopping everytime user click on button heres code have far <!doctype html> <html> <body> <p>click button loop through block of code 5 times.</p> <button onclick="myfunction()">load more</button> <p id="demo"></p> <script> function myfunction() { var y=""; (var i=0;i<10;i++) { y=y + "the number " + + "<br>"; } document.getelementbyid("demo").innerhtml=y; } var x=""; (var i=0;i<5;i++) { x=x + "the number " + + "<br>"; } document.getelementbyid("demo").inn...

Create SEO permalinks using PHP without .htaccess -

currently, page urls this: http://ourdomain.com/articles/?permalink=blah-blah-blah i want convert these to: http://ourdomain.com/articles/blah-blah-blah how can accomplish using php not .htaccess? how can accomplish using php not .htaccess.. you can't. need tell web server how deal urls don't physically exist. in apache, done in central configuration or in .htaccess file. if server happens have acceppathinfo on , can try having urls like http://ourdomain.com/index.php/articles/blah-blah-blah which redirect index.php , have articles/blah-blah-blah in $_server["path_info"] variable. method known "poor man's url rewriting" because can't rid of index.php part in url. if mentioned setting turned on (i think default), may able without using .htaccess file.

image segmentation - How to convert raw file to analyze format? -

i'm in trouble raw data. i've raw file(100m) metadata. tools i'm going use segmentation supports analyze format think have convert it. there way can realize it? i've been googling time of information found convert analze format raw file.the resource find might useful analyzedirect. if know format of raw file use hex editor view it, maybe excel convert numbers, or use program python or visual studios create program convert it. though better give proper name , file extensions of file wish convert , same resulting file can use. name of program(s) trying use may answer too.

mysql - Select on aggregate result -

i have query count table adds column result. need alter original select results based on being told unknown column. e.g. following query count table within main query, , result named shares, need filter main query result set based on whether column greater 0 error unknown column shares select b.name, event_title, ue.event_vis, event_date, (select count(*) list_shares user_id = 63 , event_id=ue.user_event_id) shares, (dayofyear(ue.event_date) - dayofyear(curdate())) days brains b join user_events ue on b.user_id=ue.user_id b.user_id=63 , ((ue.event_vis='public') or (shares>0)) , mod(dayofyear(ue.event_date) - dayofyear(curdate()) + 365, 365) <= 30 order days asc is there way this? i suggest using derived table deliver aggregate value , join "phyiscal" table. example: select b.name, ue.event_title, ue.event_vis, ue.event_date, tmp.shares, (dayofyear(ue.event_date) - dayofyear(curdate())) da...

image processing - Recognition and counting of books from side using OpenCV -

Image
just wish receive ideas on can solve problem. for clearer picture, here examples of of image looking at: i have tried looking thresholding it, otsu, blobbing it, etc. however, still unable segment out books , count them properly. hardcover easy of course, cover separates books, when comes softcover, have not been able count number of books. does have suggestions on can do? appreciated. thanks. i ran sobel edge detector , used hough transform detect lines on last image , seemed working okay me. can link edges on output of sobel edge detector , count number of horizontal lines. or, can same on output of lines detected using hough. you can further narrow down area of interest converting image binary image. outputs of of these operators can seen in following figure ( couldn't upload image had host here) http://www.pictureshoster.com/files/v34h8hvvv1no4x13ng6c.jpg refer http://www.mathworks.com/help/images/analyzing-images.html#f11-12512 more useful examples ...

javascript - How do I check if a property exists in an object/dictionary? -

i'm iterating on array of words , trying stuff them in object literal can assign value of how many times words occur each word in literal/dictionary. problem need check make sure word hasn't been added literal. tried using in check if property exists in literal it's throwing error: cannot use 'in' operator search 'we' in undefined here's problematic function: i commented line that's causing problem function wordcountdict(filename) { wordcount = {}; inputfile = fs.readfile( root + filename, 'utf8', function( error, data ) { if(error) { console.log('error: ', error) return false; } var words = data.split(" "); (i in words) { if(words[i] in wordcount) { // problem occurs wordcount[words[i]]++; } else { wordcount[words[i]] = 1; } console.log(words[i]); } }); } i'm coming python , best/eas...

ios - iOS7 style mapview callout segue in the callout (calloutAccessoryControlTapped, UIButtonTypeDetailDisclosure) -

Image
i have mapview on ipad annotations , callouts, each callout has rightcalloutaccessoryview detail disclosure button. see stock maps app performs segue callout details within callout's object. first performs transition of view right left push segue, resizes callout frame based on detail's content. how should configure segue in storyboard performed within original callout , not replace entire screen? push segue or popover? if it's popover, how should configure anchor , passthrough? - (void)mapview:(mkmapview *)mapview annotationview:(mkannotationview *)view calloutaccessorycontroltapped:(uicontrol *)control { [self performseguewithidentifier:@"contactdetail" sender:self]; }

c# - Reading QR Code in an image with zxing -

Image
i'm using c# library reading of qrcodes. lot of samples i've found based off old version of zxing rgbluminancesource constructor still takes in bitmap. in latest version rgbluminancesource takes byte[]. i've tried convert bitmap byte[], decode result null. here's code used conversion: private byte[] getrgbvalues(bitmap bmp) { // lock bitmap's bits. system.drawing.rectangle rect = new system.drawing.rectangle(0, 0, bmp.width, bmp.height); system.drawing.imaging.bitmapdata bmpdata = bmp.lockbits(rect, system.drawing.imaging.imagelockmode.readonly, bmp.pixelformat); // address of first line. intptr ptr = bmpdata.scan0; // declare array hold bytes of bitmap. int bytes = bmpdata.stride * bmp.height; byte[] rgbvalues = new byte[bytes]; // copy rgb values array. system.runtime.interopservices.marshal.copy(ptr, rgbvalues, 0, bytes); bmp.unlockbits(bmpdata); return rgbvalues; } and decode: bitmap bitmap = bitmap.fromfile(@"c:\...

c++ - How to set orthographic near/far clipping planes to display all vertices -

i rendering scenes using glm::ortho projection. want rendering include every vertex draw without adding unnecessary depth (i.e. minimal depth buffer resolution impact). i've seen this post similar question on perspective projections, looking both near , far clipping plane values in orthographic projection. i can calculate z values of each vertex using viewmatrix transform vertices screen coordinates. in pseudo code: float near; float far; (each glm::vec4 vertex) { glm::vec4 trans = viewmatrix * vertex; // invert z-buffer trans.z = -trans.z; if (trans.z < near) near = trans.z; if (trans.z > far) far = trans.z; } this way, near , far represent z-values of nearest , farthest vertices in screen coordinates, respectively. but when use these values znear , zfar in glm::ortho matrix, of rendering still clipped. missing?

cocoa - How to configure content for NSPopUpButton -

i have nspopupbutton configured bindings , coredata. working perfectly, add item implements action "edit list", like item 1 item 2 item 3 item 4 ------ edit list.. is possible bindings? i think answer no, @ least not completely. thought provide content button programatically , maintain bindings selected value , came with - (void)updatesectorpopupitems { nsfetchrequest *request = [[nsfetchrequest alloc] initwithentityname:@"sector"]; nssortdescriptor *sortposition = [[nssortdescriptor alloc] initwithkey:@"position" ascending:yes]; [request setsortdescriptors:@[sortposition]]; nserror *anyerror = nil; nsarray *fetchobjects = [_gdcmanagedobjectcontext executefetchrequest:request error:&anyerror]; if (fetchobjects == nil) { dlog(@"error:%@", [anyerror localizeddescription]); } nsmutablearray *sectornames = [nsmutablearray...

javascript - Testing angularjs directive (template not updated in tests after changing an isolated scope var) -

i'm creating angularjs component (will) provides checkbox list directive filtering, sorting, toggling options, scrolling, etc... once finished. should people deal long checkbox lists. i'm trying test order label or id feature template not reflect model changes after $digest or $apply call. tried solve no way. here directive definition: angular.module('angularjssmartcheckboxapp') .directive('smartcheckbox', [function () { return { templateurl: 'views/smartcheckbox.html', restrict: 'e', replace: true, scope: {model: '='}, controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) { // todo }] }; }]); usage: <smart-checkbox model="smartlist" /> where smartlist is: $scope.smartlist = [ {id: '001', label: 'first item'}, {id: '002', label: 'second item'}, {id: 'z0...

sql server 2008 - Changing a SQL statement when columns have been extracted to a different table -

we have database keeps track of client issues. have been tasked adding site tab, , part of this, extracted address information dbo.client table, , created new dbo.address table. i new sql, have managed muddle way through modifying stored procedures. however, have 1 method creates dynamic sql statement, , since tries access address information dbo.client table rather new dbo.address table, , not work. one possible iteration of statement below: select iclientid, (select top 1 isstype.cistypdesc issue inner join status on issue.istatusid = status.istatusid left outer join priorty on issue.ipriortyid = priorty.ipriortyid left outer join isstype on issue.iisstypeid = isstype.iisstypeid issue.iclientid = client.iclientid , issue.istatusid <> 2 order status.nrank desc, priorty.nrank desc, isstype.nrank desc) cistypdesc, (select top 1 status.cstatdesc issue inner join...

php - REST htaccess redirect -

i'm developing php script uses rest api. request client goes http://.../api/cart i have directory api/cart/ , script index.php in it. when client tries request http://.../api/cart server redirects http://.../api/cart/ (which right, way) returns 300 response. need him receive "200 ok" what should do? maybe write specific .htaccess? this mod_negotiation thing, depends on other kind of stuff have in directories. here, mod_negotiation sees couple of things /api/cart request can map to, , lets user-agent know. try messing multiviews and/or mod_dir (to prevent redirect). maybe in /api/ directory: options -multiviews directoryslash off rewriteengine on rewritecond %{request_filename} -d rewriterule ^(.*[^/])$ /api/$1/ [l]

excel - Calling a sub from another using date variables in ACCESS vba -

i trying invoke sub sub in access , keep getting "compiler error byref argument mismatch. understand says variable passing not match 1 specified in called sub. here code. have variables firstdayofstartmonth , firstdayofendmonth defined dates , passing them second proc deletecurrentdata(startdate date, enddate date). any appreciated. sub loaddatafromexcel() dim monthname1, monthname2 string dim startmonth, endmonth, curmonth integer dim thismonday, rptstartdate, rptenddate, firstdayofstartmonth, firstdayofendmonth date thismonday = date - weekday(date, vbmonday) + 1 rptstartdate = thismonday - 14 rptenddate = thismonday - 10 firstdayofstartmonth = dateserial(year(rptstartdate), month(rptstartdate), 1) firstdayofendmonth = dateserial(year(rptenddate), month(rptenddate), 1) call deletecurrentdata(firstdayofstartmonth, firstdayofendmonth) end sub private sub deletecurrentdata(startdate date, enddate date) i have variables firstdayofstartmonth , fi...

objective c - How to use protocols with categories for NSMutableArray -

i don't think i've found example quite own on site though i'm sure pops time, , finished chapter on subject in my book . i'm not looking complicated, want add functionality nsmutablearray objects of type because don't want subclass nsmutablearray because seems difficult, may change mind that. i want category offers nsmutablearray s conform ndvector protocol ability things calculate norm, rotate axis, etc. i've tried couple things, , i'm thinking should this: make protocol: @protocol ndvector <nsmutablearray> , declare methods there create category @interface nsmutablearray (ndvector) that... declares methods? implement methods in category's implementation @implementation nsmutablearray (ndvector) and finally, somehow instantiate nsmutablearray<ndvector> (i'm coming java), object nsmutablearray<ndvector> vec = [[nsmutablearray alloc] init] how should doing this? please don't send link, provide explanatio...

vb.net - Cannot access class in ASP.NET -

i have created aspx web application, have compiled , works fine when running through visual studio on local pc. however, on server error message * compiler error message: bc30451: 'epodb' not declared. may inaccessible due protection level. * epodb name of class have contains several methods. not using "code-behind" file, separate file epodb.vb. when publish website creating 60 kb dll in bin folder. have checked webconfig , set allow assemblies. here code: (aspx page) <% @ import namespace="epoapprover" if not action = "x" decrypted = epodb.aes_decrypt(rawstring) %> the first time hits method aes_decrypt, told epodb not declared. here epodb.vb public class epodb public shared function aes_decrypt(byval input string) string 'decryption method return decrypted end function end class this epodb.vb separate file. have few classes , compiles 60kb epoapprover.dll , yet don't seem a...

jQuery Hide part of a string based on text -

if have html like: <div class="text">good stuff hide me</div> <div class="text">great stuff hide me</div> <div class="text">best stuff hide me</div> and want hide "hide me" in every instance of div.text you're left with good stuff great stuff best stuff how jquery? this $("div:contains('hide me')").hide(); hides entire string. how can isolate text want hide? if want remove text, use: $('div.text').text(function (i, t) { return t.replace(' hide me', ''); }) jsfiddle example to hide it, use: $('div.text').html(function (i, t) { return t.replace('hide me', '<span class="hidden">hide me</span>'); }) with css .hidden { display:none; } jsfiddle example

Using Nested IF ELSE statements in sql -

when 1 of following conditions met, want code go next execution step: first name, last name , dob : 3 not blank id , dob not blank ssn , dob not blank id , group number not blank below code have. when run providing first name, last name , dob (condition 1 satisfied), still fails saying condition 4 not met. can tell me doing wrong? if ( ( @firstname null or len(ltrim(@firstname)) = 0 ) , ( @lastname null or len(ltrim(@lastname)) = 0 ) , ( @dob null ) ) begin insert @validationerror (errormessage) values ( 'first name, last name , date of birth must specified.' ) end else begin if ( @dob null , @id null ) begin insert @validationerror (errormessage) values ( 'date of birth , id must specified.' ) end else begin if ( @dob null , @ssn...