Posts

Showing posts from April, 2010

objective c - NSString to NSData conversion to Hex Value -

this question has answer here: converting hex nsstring nsdata 4 answers i've been trying convert user defaults nsstring (tried nsdata also), hex value can use char array. problem every time convert nsstring or nsdata takes hex values , turns them ascii values, isn't want @ all. how tell literally take values there , keep them hex? i'm struggling find solution. inside .plist <key>shit</key> <string>5448495344414e475448494e474e45454453544f53544159484558</string> my code convert nsstring nsdata nsstring *defaults = [[nsuserdefaults standarduserdefaults] objectforkey:@"shit"]; nsdata *thedata = [defaults datausingencoding:nsutf8stringencoding]; nsuinteger datalength = [thedata length]; byte *bytedata = (byte*)malloc(datalength); memcpy(bytedata, [thedata bytes], len); nslog(@"this : %@",[n...

c++ - Unusual use of a Boolean expression -

this part of code base code: bool succ = true; //below place warning there succ &= draw( e0.x, e0.y, e0.z, (e0.x + dir.x), (e0.y + dir.y), (e0.z + dir.z)); //------ //------ bool draw( float x, float y, float z, float p, float q, float r) { bool ret; ret = fun(x,y,z,p,q,r); return ret; } warning : warning 514: unusual use of boolean expression info 1786: implicit conversion boolean (assignment) (int bool) i don't want increase line of code ,so doing logic in 1 line ...can me in resolving issue ... you have &= there, these basic types equivalent to bool succ = ...; succ = succ & draw(...); however bitwise & operator takes integer values, succ needs cast int in order compare using bitwise &. when use booleans should instead use bool succ = ...; succ = draw(...) && succ; (as pointed out have change order here since && 1 of few places c++ lazily evaluating) notice there no &&= operator. edit: ...

Open a Wordpress portfolio thumbnail as lightbox instead if linking to portfolio item page -

currently theme using links each portfolio thumbnail corresponding portfolio item page. link thumbnail larger image using lightbox. the current shortcode is: $output .= '<li>'; $output .= '<a href="'. get_permalink() .'">'; $output .= get_the_post_thumbnail( null, 'portfolio-item', array('class'=>'scale-with-grid' ) ); $output .= '<div>'; $output .= '<span class="ico"><i class="icon-search"></i></span>'; $output .= '<h6>'. the_title(false, false, false) .'</h6>'; $output .= '</div>'; $output .= '</a>'; $output .= '</li>'; you can use jquery colorbox plugin achieving functionality wa...

java - Apache Batik Transcode exception when "&" appears in some text -

i trying create png svg batik. in proof of concept worked smoothly. code receives , svg escaped, have unescape before transcoding. but when there tag "&" (ie "o&m") fails. error: java.io.ioexception: reference entity "m" must end ';' delimiter. any ideas? & beginning of character reference . has written &amp; in xml files.

Associative Arrays - Javascript -

i trying populate associative array, in dynamic way. have been reading lot of documents unable figure out right way. the outcome of code be op{ '0': value1, value2 '128': value3, value4, value 6 '630': value7 } this have written , not working var arr = []; for(var = 1; <=last ; i++){ var key = rec[i].op; var op = {}; op[key] = rec[i].description; arr.push(op); } the recent record overwriting previous record. i think want like: var op = {}; for(var = 0; < last ; i++) { var key = rec[i].op; if (op[key] == undefined) { op[key] = []; } op[key].push(rec[i].description); }

java - Should I write tests for class A if it's covered from class B -

i'd opinion testing methodology. lets assume have class , b. class b uses functionality of class a. b class tested , test coverage applied indirectly class a. should write full tests directly class a? or should test not tested class functionality? i asking because maybe in future there possibility b class removed or modified in way might not use same functionality class might leave methods untested. do? classes != units if practice tdd, understand behind. imo, should test b 's behavior without based on fact a tested. actually, there 3 cases: a , b belonging same layer: if a created through refactor cycle (extract class) of b (happens while practicing tdd), a should totally left untested! no need test @ all! indeed, structure of code (in case, separation of classes/srp) should independent of unit concept; b , a in case belonging same unit. if a existed before b , b should not based on fact, , b 's whole behavior should t...

javascript - bxSlider onSlideBefore - Doesn't work after first pass through -

i'm working on slideshow using bxslider , onslidebefore callback. while works on first iteration of slider, function fails on subsequent visits specific slide, or on second (and on) iteration through slides. here's code in question: $(document).ready(function(){ var slider = $('.slider').bxslider({ auto:true, mode: 'fade', pause:8000, captions:false, controls:true, onsliderload: function(){ var caption = $('#0 .caption').contents(); $(".imagecaption").html(caption); }, onslidebefore: function(){ var caption = '#'; caption += slider.getcurrentslide(); caption += ' .caption'; var cap = $(caption).contents(); $(".imagecaption").html(cap); }, }); }); example on jsfiddle essentially happening jquery pulling contents out of div , placing in div b. i want...

Windows Phone 7 - Keyboard showing up for now reason -

so have listbox template in bind observablecollection of objects called "totaldebits". i have 2 way delete items: one 1 through context menu by range through delete button , fetching checked objects. this works: private void delete_click(object sender, routedeventargs e) { deletedebit((directdebit)(((menuitem)sender).datacontext)); } private void deletedebit(directdebit ddb) { totaldebits.remove(ddb); } private void delete_click(object sender, eventargs e) { deletedebitlist(); } private void deletedebitlist() { try { foreach (var ddb in totaldebits.tolist()) if (ddb.ischecked) totaldebits.remove(ddb); } catch { } } in both case, items deleted, problem is, in second case, keyboard showing right after items deleted, absolutely no reason.. of course can hide right after focusing on list looks ugly , wish find way prevent issue happening. edit: you'll find hereunder xaml of page:...

jquery - design of json <-> server for large complex objects -

i have html/kendoui/jquery front end has several places user enters in large amounts of form data - think 50+ fields. have rest endpoints expecting json objects pseduocode: patient { firstname:"", lastname:"", birthdate:"", address: { street1: "" street2: "" city:"" state:"" zip:"" } user: { username: "", password:"", userrole: { id:"" description:"" } contacts { contact { id: "", type:"", number:"" } } } i can take java objects , return them way, struggling on how convert form values such complex json structure. kendoui doesn't appear support this, , many parameters don't want manually send them manually assemble them. how large datasets handled in json this? expectation send/receive complex json wrong? what relationships between address, u...

remove Category and archive from wordpress blog -

i have wordpress blog , in blog page says: archives category archive for: ‘blog’ at top inside div called inner <div id="feature"> <div class="top_shadow"></div> <div class="inner"><h1>archives</h1> <div id="introduce">category archive for: ‘blog’</div> </div> i rid of not see anywhere inside of settings. using theme striking if helps. adding display:none; on css may solve problem. want remove exactly? if superior has id or class, simple #whateveriscalled {display:none;} or .whateveriscalled {display: none;} post div want remove.

javascript - smooth scroll and accordion conflict bootstrap -

although has been asked few times haven't found fix problem. this code smooth scroll: $(function() { $('a[href*=#]:not([href=#]),a[href*=#]:not(a[data-toggle])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrolltop: target.offset().top }, 1000); return false; } } }); }); it's css-tricks code bit of editing. site: http://redrocketwebsitedesign.co.uk/test/my3dtwinalpha/about/#arrow6 so accordion still being selected scrolling, , it's not running accordion js. think there's problem javascript not selector code : a[href*=#]:not(a[data-toggle]) any appreciated :-] the page provided has mis...

javascript - jQuery script execution order in html injection -

consider following js code: var html = '<script>$("body").append("a");</script>' + '<script src="script.js"></script>' + '<script>$("body").append("c");</script>'; $("body").append(html); and assume script.js contains following: $("body").append("b"); it seems that, indeed, "a", "b" , "c" appended body ( in order ). and, obviously, "c" appended body after script.js has finished loading (so, example, if takes 5 seconds script.js finish loading "c" appended body after 5 seconds). my question following: can rely on behavior in jquery? deterministic or may encounter unpredictable situations? this useful in terms of dynamically loading scripts make use of .js files not loaded yet. can assume script.js contains function f(){} , third line have been <script>f()...

java - check if a string inserted by user input corresponds to a particular format -

i have method ask user input(a date) in specific format -- dd/mm/yyyy , managed partially limit user input way using code date.matches("[0-9]+[0-9]/[0-9]+[0-9]/[0-9]+[0-9]+[0-9]+[0-9]")); but still got problem on input because if user insert date 12121/12121212/12121 takes input , goes forward the input cicle determined portion of code using joptionpane string date = joptionpane.showinputdialog(frame,"inserisci la data di partenza separata da / (gg/mm/aaaa):"); if (date ==null) { return;} while (!date.matches("[0-9]+[0-9]/[0-9]+[0-9]/[0-9]+[0-9]+[0-9]+[0-9]")) { joptionpane.showmessagedialog(frame, "data inserita errata"); date = joptionpane.showinputdialog(frame,"inserisci la data di partenza separata da / (gg/mm/aaaa):"); } then split string using string[] parts = date.split("/"); int year = integer.parseint(parts[2]); int month = integer.parseint(parts[1]); in...

jquery - Set traditional property in AJAX shorthand methods -

is possible set tradition property ajax shorthand commands such $.post() & $.get() ? i know possible set following $.ajax({ url: url, type: "get", traditional: true, } }); however, shorthand version. the way seems be $.ajaxsetup({ traditional:true }); but applied (future) ajax queries. $.post or $.get "shorthand ajax functions", without "options" parameter.

Auto heighten divs in Foundation over using media queries? -

my questions common problem seem encounter brain never registers right answer reason, because i'm slow. the question have regarding navigation menu. when i'm @ full width in foundation use large-12 class , small-12 class smaller viewports, have nav div inside of parent div when small viewport navigation drops below height of parent div. i've set parent div min-height: 204px , max-height: auto assuming adjust in height wrapping child elements doesn't work. so best way ensure child divs grow in height due smaller viewports push parent div in height well? here html: <div> <div class="interior-header"> <div> <nav class="utility"> <ul> <li><a href="#" class="register">register</a></li> <li><a href="#" class="login">login</a></li> </ul> ...

sql server 2008 r2 - Multi-Column, Multi-Row PIVOT -

consider have table contains data in following form: foo_fk monthcode_fk activity_fk sumresultsx sumresultsy ----------------------------------------------------------- 1 201312 0 10 2 1 201312 1 5 1 1 201401 0 15 3 1 201401 1 7 2 2 201312 0 9 3 2 201312 1 1 2 2 201401 0 6 2 2 201401 1 17 4 for purposes, safe assume table aggregation have been created group by on foo_fk, monthcode_fk, activity_fk sum( resultsa ), sum( resultsb ) obtain data, making foo_fk, monthcode_fk, activity_fk unique per record. if reason found preferable pivot table in stored procedure ease amount of screwing around ssrs i'd have ( , undoubtedly later maintain ), wishing following format consumption via matrix tablix t...

Android ScrollView's scroll disable when set width & height programically -

i had following structure in android application linearlayout scrollview linearlayout -- elements --- then need set width & height of scrollview programically. wrote following code scrollview sv=(scrollview)activity.findviewbyid(r.id.menuscroll); linearlayout.layoutparams relp=new linearlayout.layoutparams(width/2,height-margin); relp.setmargins(width, 0, 0, 0); sv.setlayoutparams(relp); but when added setlayoutparams , scroll property. can't scrolling internal elements. idea ? new android. thanks i use relativelayout: private scrollview mscrollview; mscrollview = (scrollview) findviewbyid(r.id.scrollview); relativelayout.layoutparams layoutparams = (relativelayout.layoutparams) mscrollview.getlayoutparams(); layoutparams.leftmargin= width; layoutparams.setmargins(width, 0, 0, 0); mscrollview.setlayoutparams(layoutparams); this works me. think that's similar linearlayout.

javascript - jQuery popup resize on phone -

i have small problem popup image displaying on mobile browser. popup displayed on mouse click , resize function sets size according viewport size. this works fine , centred in viewport when opened, when tilt phone landscape call resize function doesn't seem work newly resized image off centre in viewport, repeated when phone returned portrait mode. have tested code on android chrome browser. the resize function have used follows: $(window).resize(function () { $(".dialogcontent").css({ position: 'absolute', left: ($(window).width() - $(".dialogcontent").outerwidth()) / 2, top: ($(window).height() - $(".dialogcontent").outerheight()) / 2 }); }); sorry posting answer still can't comment yet. based on have said little confused mouse click portion of code. surly resize function not being called when user clicks button first time. sure working way want @ all? to answer question limited amoun...

c# - What is the difference between a function and a helper in Razor? -

from tutorials i've read, functions contain c# code. case or can have razor syntax in functions? on other side, can have c# code in helpers? use functions processing , helpers display purposes. functions used defining c# code , , c# code, pertains page. location perform (preferably small) data operations, etc. granted should in controller or service layer , passed model. meanwhile helpers actual display. a way write html html without having use plain strings, tagbuilders or other messy c# tactics spit out html. yes "reusable" others have said. static c# method in page... (rhetorical) why not that? the point able create/edit html in more natural html environment. and yes can have c# code inside helpers using regular old @ razor syntax. again should limited display purposes convention. ie: looping through list create elements, etc.

ios - Cancel button not showing up in UINavigationController in modal for iPad -

i'm trying add cancel button modal in navigation bar ipad. i'm using following code: uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:abpersoncontroller]; navcontroller.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemcancel target:self action:@selector(dismissmodal)]; [self presentviewcontroller:navcontroller animated:yes completion:nil]; for reason though, cancel button not show up. using spark inspector, i'm seeing indicator cancel button supposed hidden, , when run in on ipad simulator, cannot see cancel button or indicator. i tried setting indicator's hidden property no nothing shows up. edit: way can work if add button in completion block: [self pre...

ios - UITableViewCell not animating content after reloadSections with animation -

i have uitableview 2 sections, first section have many controls , ok, on second section have lot of cells having contents of results. when call realodsections in table view, after make fetches, expect when cell's appearing plays animation on label. [self.tableview reloadsections:[nsindexset indexsetwithindex:1] withrowanimation:uitableviewrowanimationtop]; animating on: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { [...] if (indexpath.row==0) { [uiview animatewithduration:0.5 delay:1 options:uiviewanimationoptioncurveeaseinout animations:^{ cellbgview.layer.cornerradius = 5; cellbgview.frame = frame; // new frame } completion:nil]; } } return cell; } resulting: animation happens after 3 or 2 calls of method reloadsections

ruby on rails - Gitlab refuses to create remote repositories -

i have installed gitlab 6.5 using this guide . i have run sudo -u git -h bundle exec rake gitlab:check rails_env=production , green. the problem can't clone or push stuff server http. saw server not creating git repository in folder, wiki.git. i can push , pull wiki.git?

loops - Replace previous plot with each mouse click in matlab -

hi im trying have first part of program plot line origin length 10 in direction of mouse clicks in plot area. have this: [gx,gy,b] = ginput(1); theta = atand(gy/gx); theta = theta*(pi/180); polar(theta,8,'-k') within loop of while b~=3. ie trying whilst clicking left mouse button, want plot line in direction of click, , when right button pressed...move onto rest of program line staying in position of last left click made. also, when each left click made, previous line plotted should replaced new one. ie 1 line on screen @ time. thanks in advance help. the following script works me, if interpreted question correctly. figure r=10; % desired line length polar(0,r) % empty polar plot b=0; while b~=3 [gx,gy,b]=ginput(1); if b~=3 % not right mouse click theta=atan(gy/gx); if gx<0 theta=theta+pi; % needed, because atan(gy/gx) range -pi/2 pi/2 end polar([0 theta],[0 r],'-k') end end what does ...

clearcase - Maximum numbers of users in CLEARCASE_PRIMARY_GROUP? -

is there limit add users in clearcase_primary_group ? in unix/linux, can add 32. there limit on in windows clearcase? according ibm article : clearcase enforce limitation on number of clearcase groups user may belong to. the sunrpc protocol use can process maximum of 32 groups on windows , 16 groups on unix. means users in windows environment can have maximum of 32 groups can use clearcase , 16 groups in unix environment or windows , unix interop environment . by default, clearcase recognize first 32 groups of user's group list displayed output of creds utility on windows. total of 32 groups includes windows primary group or clearcase_primary_group variable , next 31 groups either creds output or clearcase_groups variable. the environment variables, clearcase_groups , clearcase_primary_group , can resolve or alleviate of issues may arise due limitation.

osgi - Blocked threads due to ServiceRegistry -

i have relatively high volume/requests system in using osgi. close 800m requests per day. we seeing issues threads getting blocked. every request comes in, forward event/data osgi bundle using registerservice pass payload/data osgi bundle listening service. like this: bundlecontext.registerservice(map.class.getname(), dataholdermap, null); where dataholdermap nothing regular java hashmap here threaddump using jstack: =========================================================================== "requestthread" prio=10 tid=0x00000000421ab800 nid=0x1042 runnable [0x00007fbdd3867000] java.lang.thread.state: runnable @ org.apache.felix.framework.serviceregistry.getservice(serviceregistry.java:295) - locked <0x0000000700e2c590> (a org.apache.felix.framework.serviceregistry) @ org.apache.felix.framework.felix.getservice(felix.java:3568) @ org.apache.felix.framework.bundlecontextimpl.getservice(bundlecontextimpl.java:468) ...

SQL Conditional Unique Constraint With Where Clause Within Same Table -

i have table want ensure combination of 5 columns remain unique within table. example: alter table [dbo].[mytable] add constraint [uq__mytable.mfg.model.class.depiction.iteration] unique nonclustered ( [manufacturerid] asc, [model] asc, [blockclassid] asc, [blockdepictionid] asc, [blockiterationid] asc )with (pad_index = off, statistics_norecompute = off, sort_in_tempdb = off, ignore_dup_key = off, online = off, allow_row_locks = on, allow_page_locks = on) on [primary] go i want exclude combinations sixth separate column has particular value. example, want enforce above constraint when column [flag] = 0 , exclude enforcement when column [flag] = 1 . as workaround, can proper ansi behavior in sql server 2008 , above creating unique, filtered index. create unique nonclustered index [ix__mytable.mfg.model.class.depiction.iteration] on [dbo].[mytable] ([manufac...

c# - Accurately Set the MySqlCommand Parameter Size -

how can accurately pass in proper data size following line: objcmd.parameters.add(_pns[i], _dts[i]).value = _pvs[i]; it passed array of parameternames, mysqldbtypes , however, able pass in data size well... according mysqldbtype passed in. i know text, varchar, etc... lengths vary, else? p.s. c# using latest version of mysql, , latest version of mysql .net connector here's have far, not seem accurate assume should be. objcmd.parameters.add(_pns[i], _dts[i], _estimatedsize(_pvs[i])).value = _pvs[i]; // method pretty dumb want fast. internal int _estimatedsize(object _val) { if (_val == null || _val == dbnull.value) return 4; // size of null if (_val byte[]) return (_val byte[]).length; if (_val string) return (_val string).length * 4; // account utf-8 if (_val decimal || _val float) return 64; if (_val bool) return 1; return 32; } create 2 array sqldtype , sqlsize sqldbtype[] sqldtype = new ...

templates - Alternative to Dynamic Includes In Jade -

what alternative solution trying use dynamic includes using express + jade? here i'm trying following setup: routes index.js widgets.js views widgets widget1.jade index.jade widget.jade app.js in app.js, specify following route: app.get('/widgets/:widget', widgets.widgets); in widgets route, widgets.js have: exports.widgets = function(req, res){res.render('widgets/' + req.params.widget);}; this gives me ability view widget on own browsing /widgets/widget1. works great. can include widget in view this include widgets/widget1 this works great too. however, want add widget2 , want show widget1 , show widget2 within page. had hoped pass variablewidgetname view , reference this: include widgets/#{variablewidgetname} this fails. when try access page, 500 error stating no such file or directory views\widgets#{variablewidgetname}.jade exists. cannot reference variables includes. what other options have. if limitation in jade, there di...

c++ - Cache header files for make/g++ -

i working on large c++ code base , want speed compilation times. 1 thing know of library includes on network drive slows down things lot. if can make or else automatically cache them, either in /tmp, or ramdisk, expect improve compile times me quite bit. there way that? of course can copy them manually , set sync job every developer have on every box ever compile looking automated solution. thanks! of course. there lots , lots of ways. can have make rule copies things have people run make copylocal or whatever. fast people have remember it, , if libraries change lot annoying. can make rule copies things put prerequisite other target it's done on every build, first. take longer: copy step plus using local copies take longer total time using remote copies? knows? you use tool ccache locally cache results of compilation, rather copying library headers. give lot more savings typical small incremental build , it's integrated build system, slow down "re...

sql server - SQL Multiple Rows to one CSV -

this question has answer here: concatenate many rows single text string? 38 answers i'm having issues converting concatenating multiple rows 1 row csv this have [project number] | [resources] 1 25254 , jim anderson 2 25254 , becky smith 3 32564 , amy dickerson 4 32564 , james walsh 5 25679 , jim anderson 6 25679 , james walsh this need [project number] | [resources] 1 25254 jim anderson, becky smith 2 32564 amy dickerson, james walsh 3 25679 jim anderson, james walsh this query i'm using select * from( select 'project number' = p.projectid , 'resources' = ', ' + pe.name projects p (nolock) left join persons pe (nolock) on p.pers...

javascript - Resizable div puts textbox on new line? -

i have code here allows resize div , textbox stays @ 100%. however textbox goes onto new line - how can keep label , textbox on same line? resizing div around label reduce textbox size? <div id='div1' style='display:table-cell;width:300px; border: 1px solid black; white-space:nowrap; padding-right: 50px;'> <div style="display:table-cell"><label>test&nbsp;</label> </div> <input type='text' style='width:100%;' id='inputbox'/> </div> $("div").resizable({ handles: "w, sw, ne, nw, se" }); working example here: http://jsfiddle.net/xpuuj/1/ thanks! here want http://jsfiddle.net/xdhhm/ your code had minor positioning problems , unwanted div. html: <div class="container"> <lable>text</lable> <input type="text" /> </div> css: .container { width:300px; border:#000 ...

openssl - Installation of a DER certificate in Chrome -

i'm having issues trying automatically install der certificate chrome. error reported error 502 (net::err_no_private_key_for_cert) . after doing research, openssl doesn't support der files private keys , chrome accepts der certificates. i'm thinking there may specific mime type needs returned possibly? the mime type being returned incorrect; needs returned application/x-x509-ca-cert .

maven - different log4j.xml when exporting jar from eclipse -

i have problem when export executable jar. i'm using maven , slf4j log4j my pom.xml <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.7.2</version> <scope>runtime</scope> </dependency> i added log4j.xml in /src/java/main (is same in generated target folder): <?xml version="1.0" encoding="utf-8" ?> <!doctype log4j:configuration system "log4j.dtd"> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> <appender name="file" class="org.apache.log4j.rollingfileappender"> <param name="file" value="/media/dlm/log/dlm.log" /> <param name="threshold" value="info" /> <param name="append" value="false" /> <param name="maxfilesize" value="10mb" /> ...

jquery - Taking Values of a Form and Using Them for Comparison in Javascript -

i'm attempting create html-based game. game supposed use or tag accept data user. i'd assign data entered variable in javascript comparison. comparison used alter page, bringing next part of game view. how assign value of input user types javascript variable comparison? i thought along lines of: function(){ document.getelementbyid("submit"); } would work situation, i'm not sure. the code have rather simple, can see here: fiddle i'm pretty new js/jquery, forgive me if question incredibly easy answer! there many ways this. it seems way going using button "read input now". in case, can add event handler button read in there. see following: <h3>you've entered dungeon. want continue or exit?</h3> <div id="actioninterface"> <input type="text" id="myinput" value="user"/> <button id="clickme">enter option</button> </div...

gis - Better hillshading for map plots in R -

Image
i'm working on improved hillshading topographical map plots. basic hillshade workflow documented in image() is: require(raster) alt = getdata('alt', country='che') slope = terrain(alt, opt='slope') aspect = terrain(alt, opt='aspect') hill = hillshade(slope, aspect, 40, 270) plot(hill, col=grey(0:100/100), legend=false, main='switzerland') plot(alt, col=rainbow(25, alpha=0.35), add=true) this image shows plot(hill..) before plot(alt..) applied: the method creates solid grey under-layer of hillshades on other data layers (e.g. elevation shading) plotted semi-transparently. problem approach (a) neutral colour flat terrain (rbg (202,202,202), '#cacaca') severely shades whole model, (b) prevents multiple shade layering, such used 'swiss hillshade' approach. i can imagine workaround converts rasters matrices , applies hillshading numerical multiplier brightness of other layers, doesn't seem elegant (although ...

Why does IOrganizationService.Update() return "The specified record type does not exist in Microsoft Dynamics CRM."? -

a call update record in early-bound custom entity, record retrieved, returns above message. code fragment follows (heavily instrumented i'll leave in i'm new crm code , might remove someting relevant) // retrieve , update contactfact record - string strcontactfactid = reader["contactfactid"] == dbnull.value ? string.empty : (string)reader["contactfactid"]; string strcontactid = reader["contactid"] == dbnull.value ? string.empty : (string)reader["contactid"]; whereami = "retrieved strcontactid = " + strcontactid; string straccountid = reader["accountid"] == dbnull.value ? string.empty : (string)reader["accountid"]; guid contactfactid; guid contactid; guid accountid; guid.tryparse(strcontactfactid, out contactfactid); whereami = "try generate contactid " + strcontactid; guid.tryparse(strcontactid, out contactid); whereami = "generated contactid = " + contactid.tostring(); guid.trypa...

html - Link PHP inside an echo tag -

i having problem code <?php echo '<div class="post_note2"> <b>'.$lang['renew_success'].'</b></div><br /><span class="orange"><b><a href="?view=main">home</a>|<a href="<?php echo $adurl; ?>">view ad</a></b></span>'; } }?> for reason when view ad link clicked doesn't build , still contains php code in link rather link actual ad page. issue echo in echo ? i'm sure isn't quite difficult solve have been trying far long on own , cant it. thanks, great. you had right in first part of string. can't have , echo statement inside of echo statement. use concatenation throughout string: <a href="' . $adurl . '"

http status code 403 - Google CardDAV API 403 Error -

i've been trying use google's carddav apis (and i've gotten caldav access working). unfortunately, keep getting 403 error when trying discover user's current-user-principal. fwiw, have gone google's developer console , set client information , seems work fine caldav access. here snippet of http traffic carddav: propfind https://www.googleapis.com:443/.well-known/carddav/ depth: 0 content-type: text/xml brief: t authorization: bearer ya29.1.aadtn_ud1cvkpiqpsyb4hzokvxt4l5kpfxu3gucmtfjmjj9t0pzzqx1i3xx748y <?xml version="1.0" encoding="utf-8"?> <x0:propfind xmlns:x0="dav:"> <x0:prop> <x0:current-user-principal /> <x0:principal-url /> <x0:resourcetype /> </x0:prop> </x0:propfind> vvvvvvvvvvvv http propfind status(403) forbidden <?xml version="1.0" encoding="utf-8"?> <errors xmlns="http://schemas.google.com/g/2005"> <erro...

lighttable - Simple clojure program doesn't work -

i trying follow example in clojure data analasys cookbook. using lighttable play program. first example shows how read in .csv data. i used lein new getting-data. added 2 dependencies project file (defproject getting-data "0.1.0-snapshot" :description "fixme: write description" :url "http://example.com/fixme" :license {:name "eclipse public license" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [ [org.clojure/clojure "1.5.1"] [incanter/incanter-core "1.4.1"] [incanter/incanter-io "1.4.1"] ] ) then in core.clj file below, using cmd-shift-enter in lighttable evaluate program, exceptions: (use 'incanter.core 'incanter.io) clojure.lang.compiler$compilerexception: java.lang.runtimeexception: unable resolve symbol: use in context, compiling:(/users/idf/documents/clojure/getting-da...

regex - Why do most languages implement wildcard regular expressions inefficiently? -

i given link following article regarding implementation of regular expressions in many modern languages. http://swtch.com/~rsc/regexp/regexp1.html tl;dnr: regular expressions such (a?)^na^n fixed $n$ take exponential time matched against, say, a^n because implemented via backtracking on string when matching ? section. implementing these nfa keeping state lists makes more efficient obvious reasons the details of how each language implements these isn't detailed (and article old), i'm curious: what, if any, drawbacks of using nfa opposed other implementation techniques. thing can come bells , whistles of libraries either a) building nfa features impractical or b) there conflicting performance issue between expression above , other, possibly more common, operation. while possible construct dfas handle these complex cases (the tcl re engine , written henry spencer, proof example; article linked indicated performance data) it's exceptionally hard. one ...

php - MySQL select where the MOST RECENT date is NOT between two dates -

i'm trying run query retrieve customers recent activity not between +/- 30 days. life of me can't figure out. here's have far: activity.date not between date_sub(curdate(), interval 30 day) , date_add(curdate(), interval 30 day' problem need make sure activity.created_on field recent. i'm not sure how go this. i'm joining customers table based on customer_id, if matters. thanks help i've similar table structure , works me: select c.id, c.first_name, c.last_name, max(a.activity_date) date activities join clients c on c.id = a.client_id a.activity_date not between date_sub(curdate(), interval 30 day) , date_add(curdate(), interval 30 day) group c.id order date desc, c.first_name, c,last_name

java - How to create a button in Libgdx? -

i want create button changes when user hovers it, or clicking it. created following variable button buttonplay = new button(); i don't know now, how load images? how write text button? how implement events / effects (hover, click)? it helpful if write example code button. a button actor in libgdx. render actor use stage contains actors of screen, renders them , updates them. assume want button text, should use class textbutton , add stage. textbutton takes string render , buttonstyle, in case textbuttonstyle, class contains information button (font, drawable render while not pressed, drawable render while pressed etc). public class buttonexample extends game{ stage stage; textbutton button; textbuttonstyle textbuttonstyle; bitmapfont font; skin skin; textureatlas buttonatlas; @override public void create() { stage = new stage(); gdx.input.setinputprocessor(stage); font = new bitmapfont(); ...

java - Why can't I implement a parametrized interface mutiple times with different parameters? -

this question has answer here: getting error generic interface: interface observer cannot implemented more once different arguments: 3 answers i'm developing system widgets listen changes in model. wanted notify widgets on interface parametrized notification's class. why doesn't java allow this: public class uiinventory extends widget implements observer<eventgetitem>, observer<eventloseitem>, observer<eventwield>, observer<eventunwield>, observer<eventputon>, observer<eventtakeoff> { the error message duplicate class: 'my.package.structure.observer', why appear in first place? the answer lies in java's type erasure . @ runtime, generic type information erased, , result in public class uiinventory extends widget implements observer, observer, observer, ...

django - Partial Load from Ember Model -

i have model such; logics.files = ds.model.extend({ field1: ds.attr('string'), field2: ds.attr('string'), date_changed: ds.attr('date'), status: ds.attr('number'), }); and when loaded django-rest fields have data coming server when loaded model date_changed , status being filled in. im not sure causing this? ember 'opinionated' framework , expects attribute names begin lowercase letter. should go flow , adopt lowercase convention.

java - Android App Stops and Crashes when using a long nested loop -

i trying make nested loop show me on screen combinations of letters , numbers, created nested loop make string of 15 characters put in string named "pass". "tr" activity made translate numbers resulted in letters or numbers (something ascii table), thought translate activity problem commented whole thing out leaving loops , app freeze. here code: private void nestedlooptest() { (int aa = a; aa < 35; aa++) { (int bb = b; bb < 35; bb++) { (int cc = c; cc < 35; cc++) { (int dd = d; dd < 35; dd++) { (int ee = e; ee < 35; ee++) { (int ff = f; ff < 35; ff++) { (int gg = g; gg < 35; gg++) { (int hh = h; hh < 35; hh++) { (int ii = i; ii < 35; ii++) { ...

Checking where the file is stored in android? -

i writing log data file in android. unable understand file stored on android device ( google nexsus 7 ). , how should contents of file ? following piece of code using write log data file. public file appendinglog(string logdata){ try { file logfile = new file(environment.getexternalstoragedirectory(), "yourlog.txt"); if (!logfile.exists()) { try { logfile.createnewfile(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } try { bufferedwriter buf = new bufferedwriter(new filewriter(logfile, true)); buf.append(logdata); buf.newline(); buf.close(); } catch (ioexception e) { e.printstacktrace(); } } catch (exception e) {...

php - Simple HTML DOM returning NULL -

i'm scraping data website using simple html dom parser ( http://simplehtmldom.sourceforge.net/ ) the html is: <tr class="productlisting-odd"> <td align="right" class="productlisting-data">&nbsp;0&nbsp;</td> <td class="productlisting-data">&nbsp;<a href="http://www.spellvault.net/p46563/liliana-of-the-veil/product_info.html" onmouseout="hd()" onmouseover="sd('images/101257121.jpg')">liliana of veil</a>&nbsp;<br> </td> <td align="center" class="productlisting-data">&nbsp;black&nbsp;</td> <td align="center" class="productlisting-data">&nbsp;mythic&nbsp;</td> <td align="center" class="productlisting-data">&nbsp;innistrad&nbsp;</td> <td align="right" class="productlisting-data...

javascript - How does one preserve scope with nested directives? -

my goal create flexible set of directives reusable , lightweight ui elements. each has isolated scope, , many of them transclude content. want each directive black box - user ideally wouldn't need know whether nests directive internally when writing content transcluded. according angular guide directives : the transclude option changes way scopes nested. makes contents of transcluded directive have whatever scope outside directive, rather whatever scope on inside. in doing so, gives contents access outside scope. i have found works described when using single directive. however, if there directive nested in 1 transcludes content, transcluded content resolved within scope of outer directive, rather scope on outside. problem, because prevents users knowing in scope transcluded content resolved! for example: ( fiddle ) .controller('main', function ($scope) { $scope.value = '"main"'; $scope.expected = $scope.value; }) .directive(...

javascript - DOJO: Overriding a method in Dijit widget -

i need pass arguments widget watch method can used in callback function current code: require(["dijit/form/numbertextbox"], function (numbertextbox) { var txt = new numbertextbox({}, "text10"); txt.watch("value", function (name, oldvalue, value) { }); }); desired code: require(["dijit/form/numbertextbox"], function (numbertextbox) { var txt = new numbertextbox({}, "text10"); txt.watch("value", function (name, oldvalue, value, panelid) { alert(panelid); },panelid); }); need induct panelid in watch function. have searched docs seems cannot pass arguments watch function. is there way override watch method , make accept arguments? you can wrap callback function in closure keeps local reference panelid variable. assumes panelid not meant change across invocations of watch function. require(["dijit/form/numbertextbox"], function (numbertextbox) { var txt = ...

c# - Is there any way I can call this getter and consistently get the expected result? -

i need use property getter 3rd-party api, , accessing getter sometimes hangs entire application, sometimes works (in dev/debugger). , if deploy production server, host application sometimes works expected, sometimes dies appcrash in kernel32. i couldn't understand how simple getter freeze or crash anything, though maybe property method in disguise, , used favorite decompiler find out. this scheme/pattern came across: internal myclass() : isomeinterface { locker = new object(); } public object locker { get; private set; } private someobject _myproperty; public someobject myproperty { { lock (locker) { if (_myproperty== null) myproperty = somecondition ? somemethod() : something.else; return _myproperty; } } private set { _myproperty = value; } } am correct believe whenever _myproperty null , getter calls setter , there's race condition bug here may causing ran...