Posts

Showing posts from March, 2015

sending array from javascript through url in php page but -

rooms array window.location = "booking_status.php?array="+ json.stringify(rooms); sending javascript php page on php page url show full array value store in array in page address bar url that http://localhost/zalawadi/booking_status.php?array=[ {%22id%22:10,%22rate%22:100} ] i want prevent data show in url %22id%22:10,%22rate%22:100 i decoding on php page other way send array data javascript php page you can use hidden form , post method. use $_post instead of $_get. <form action="script.php" onsubmit="this.firstchild.value=json.stringify(value);"> <input type="hidden" value="" /> <a href="javascript:this.form.submit();">link text</a> </form>

image - workaround for missing pm3d corners2color feature in gnuplot -

Image
as written in manual of gnuplot @ page 136 , because pm3d algorithm not extend colored surface outside range of input data points, 'c' coloring options result in pixels along 2 edges of grid not contributing color of quadrangle. example, applying pm3d algorithm 4x4 grid of data points in script demo/pm3d.dem (please have look) produces (4-1)x(4-1)=9 colored rectangles. so if plot 4x4 pixel sized image, can't in way without missing 4th column , row. (i not modify file.) there efficent workaround problem? to plot 4x4 image shows color rectangles specified in data file, splot ... pm3d not suited. 1 can use image plotting style. pm3d mode must used e.g when grid points not equidistant, or 3d representation. taking following file data.dat 1 6 8 3 2 5 4 4 9 1 1 2 5 4 3 8 a more or less minimal script be set autoscale fix set xtics 1 out set ytics 1 out plot 'data.dat' matrix image t '' the result set terminal pngcairo

php - Login and fetch a protected page with cURL -

i got login part of script working second part not work. <?php // curl login $login = "http://****/admin/index.php?route=common/login"; $credentials = "username=admin&password=****"; $cookie = "cookie.txt"; $ch = curl_init(); curl_setopt ($ch, curlopt_url, $login); curl_setopt ($ch, curlopt_post, 1); curl_setopt ($ch, curlopt_postfields, $credentials); curl_setopt ($ch, curlopt_cookiejar, $cookie); curl_setopt ($ch, curlopt_returntransfer, 1); $exec = curl_exec ($ch); // logged in, fetch post data $url = $_post['order']; $return = $_post['return']; // request protected invoice page curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_verbose, 0); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt ($ch, curlopt_useragent, "mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.8.1.6) gecko/20070725 firefox/2.0.0.6"); curl_setopt($ch, curlopt_url, $url); $response = curl_exec($ch); curl_close

php - Handling login failure in a Symfony application -

i working on app using fosuserbundle , maintains local database of users. use case follows: user tries login , upon login credentials authenticated in case of success user proceeds navigate site in case of failure above: the credentials authenticated against single sign on service , if credentials correct, user created locally, logged in, , proceeds navigate site. in case single sign on unsuccessful, user shown default incorrect password screen my question in symfony add logic? this have tried far: i have tried @ overrriding loginaction on further research read may not work dislays login form. i looked @ following stackoverflow question: overriding authentication failure handler - symfony2 also read in symfony docs: http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html i not clear whether should use approach in 2 or 3 in use case. tips or code samples highly appreciated. i ended using hybrid approach of 2 & 3 solve

Save state radio button javascript-html -

i´m trying program save state of radio button , check it. code don´t know it`s wrong. me please <script> function savestate(){ var ans1 = document.getelementbyid('grupo1'); if (ans1.value == 1) { ans1.setattribute("checked","checked"); ans1.checked = true; } </script> <input type="radio" name="group" id="grupo1" value="1"> 1 <input type="radio" name="group" id="grupo2" value="0"> 2 <input type="submit" onclick="savestate()" value="update"> try this: <script> function savestate(){ var ans1 = document.queryselector('input[name="group"]:checked').value; if (ans1.value == 1){ ans1.setattribute("checked","checked"); ans1.checked = true; } } </script>

css - Can I use font-awesome without downloading? -

for simple html pages want use fontaweseome without downloading @ all. i thinking have css point /fontface this: (i.e.: directly github url) @font-face { font-family: 'fontawesome'; src: url('http://fortawesome.github.io/font-awesome/assets/font-awesome/font/fontawesome-webfont.eot?v=3.2.1'); src: url('http://fortawesome.github.io/font-awesome/assets/font-awesome/font/fontawesome-webfont.eot?#iefix&v=3.2.1') format('embedded-opentype'), url('http://fortawesome.github.io/font-awesome/assets/font-awesome/font/fontawesome-webfont.woff?v=3.2.1') format('woff'), url('http://fortawesome.github.io/font-awesome/assets/font-awesome/font/fontawesome-webfont.ttf?v=3.2.1') format('truetype'), url('http://fortawesome.github.io/font-awesome/assets/font-awesome/font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg'); font-weight: normal; font-style: normal; } which did ... not see

java - How to disable a button in openbravo? -

i want disable "complete" button wich appears when creating new requisition procurement management module in openbravo. custom button placed on right side of toolbar. you can hide complete button setting displayed field no in application dictionary || windows,tabs , fields || requisition. since " complete " button in openbravo core , need save changes under custom template. ad_field.displayed document action

android - Java Does InputSream.read(byte[] b, int offset, int length) wait for the full amount of bytes specified -

if do, instream.read(buffer, 0, 65); java wait 65 bytes or wait amount of time fill buffer how many ever can. inputstream.read(byte[] b, int off, int len) read bytes given byte[] , len , , return number of bytes read or -1 if end of stream encountered. must attempt read @ least 1 byte (blocking unless does) unless end of stream encountered, 0 given argument len parameter, or exception thrown. whether or not call blocks until len bytes read implementation detail, in particular default implementation provided in java.io.inputstream block until len bytes read, end of stream encountered, or exception thrown, implementations can eagerly return available bytes (as long there least 1 byte read) , still satisfy method's contract. to summarize, should check return value see how many bytes read off stream.

java - Runtime.exec can't work on JDK 7u25 -

after update java latest version 7u25, runtime.getruntime().exec can't work anymore. //jhghai_w.filepath = "c:\\aucs\\data\\tmp.txt"; br = new bufferedreader(new inputstreamreader(runtime.getruntime() .exec("cmd.exe /c \"c:\\program files\\juman\\juman.exe \" -e < "+jhghai_w.filepath) .getinputstream())); i read reference:jdk 7u25: solutions issues caused changes runtime.exec https://blogs.oracle.com/thejavatutorials/entry/changes_to_runtime_exec_problems and tried modifications below: br = new bufferedreader(new inputstreamreader(runtime.getruntime() .exec("cmd.exe /c \"c:\\program files\\juman\\juman.exe -e < \""+jhghai_w.filepath) .getinputstream())); and this: br = new bufferedreader(new inputstreamreader(runtime.getruntime() .exec(new string[] {"cmd","/c" "c:\\program files\\juman\\

javascript - traverse element inside the div -

html: <div style="width: 260px;margin:25px 0 0 30px"> <input type="checkbox" name="send_email" class="delete_followup" />send email alerts <input type="checkbox" value="delete" type="checkbox" />send sms alerts <button type="submit" name="delete" value="{{follower.id}}" class="delete_follower">delete</button> </div> js: $(".delete_followup").click(function(){ var $this = $(this); $(this).find(".delete_follower").show(); }); i want show hidden button on clicking delete_followup class.i tried above jquery not working. or try .nextall : $(this).nextall(".delete_follower").show(); working here: http://jsfiddle.net/tw5xk/

ios - Thread 1 : SIGABRT error in simple storyboard app -

i have made extremely simple app using storyboards (for first time). the app's table view controller embedded in navigation controller , segues out view controller displays image. when click on row, gives me thread 1 sigabrt error. here's log : 2013-09-03 22:37:16.669 footballplayers[7226:c07] * terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[uitableviewcontroller loadview] loaded "pcv-xw-t12-view-xx8-ac-4ru" nib didn't uitableview.' * first throw call stack: (0x1c94012 0x10d1e7e 0x1c93deb 0x245357 0xf6ff8 0xf7232 0xf74da 0x10e8e5 0x10e9cb 0x10ec76 0x10ed71 0x10f89b 0x10fe93 0xc4823f7 0x10fa88 0x46be63 0x45db99 0x45dc14 0xc5249 0xc54ed 0xacf5b3 0x1c53376 0x1c52e06 0x1c3aa82 0x1c39f44 0x1c39e1b 0x1bee7e3 0x1bee668 0x15ffc 0x226d 0x2195 0x1) libc++abi.dylib: terminate called throwing exception here's implementation of tableviewcontroller #import "playerstableviewcontroller.h" @interfac

c++ - Can I use a single address space for the GPU, CPU and FPGA look like to CUDA UVA? -

Image
if i'm developing cuda, have opportunity use uva (unified virtual addressing) - single address space cpu-ram , gpu-ram of gpu. not possible, , appeared in version cuda 4.0. understand - provided nvidia cuda driver. http://docs.nvidia.com/cuda/gpudirect-rdma/index.html#basics-of-uva-cuda-memory-management but if want use gpu , fpga on single computer connected pci-express 2.0 16x , them use single address space. there such possibility in fpga similar nvidia uva, need use fpga "uva", , nor interfere fpga "uva" vs cuda uva? how this? http://research.microsoft.com/pubs/172730/20120625%20ucaa2012_bittner_ruf_final.pdf you've found gpudirect rdma documentation seems answer question. rdma gpudirect feature introduced in kepler-class gpus , cuda 5.0 enables direct path communication between gpu , peer device using standard features of pci express. with this, host can initiate data movement between gpu , peer device. uva means each device

jQuery Timepicker "Now" button not accessing current time -

this question deals third-party plugin, there may enough crossover stock jquery ui datepicker might able out. 1) set maxdate of 0 or new date() set in datetimepicker options $('.foo').datetimepicker({maxdate:0}) 2) press "now" button !3) button not set time current time, time when page loaded example: http://jsfiddle.net/rf3gk/ how can work around this? there fix can do, either in external file or in addon itself? i think mean calling setdate , or similar in plugin, see jquery datepicker set selected date, on fly .

javascript - Any idea how to make this script touch-friendly? -

a bit background info: simple game http://deslimmespeeltuin.nl/speeltuin.htm going part of educational project children. based on marco kuiper's nice polaroid viewer ( http://demo.marcofolio.net/polaroid_photo_viewer ). original script bit old , had update jquery libraries references work on latest ie, example. however, doesn't work on touch devices (android / ios), real pity. although looks right, cannot drag shapes. i'm not programmer. marco himself help, busy. have clue? advice great. if add html file should work: <script> function touchhandler(event) { var touch = event.changedtouches[0]; var simulatedevent = document.createevent("mouseevent"); simulatedevent.initmouseevent({ touchstart: "mousedown", touchmove: "mousemove", touchend: "mouseup" }[event.type], true, true, window, 1, touch.screenx, touch.screeny, touch.clientx, touch.clienty, false,

Android ActionBar in older versions -

i want make android application include action bar , app working on versions 2.2 latest of understand have make application android platform 2.1 (level 7) platform 2.3.4 (level 10) , use support library v7 or make platform 3.0 (level 11) , go on right? want make application available 2.2 4.3 same features , design platform use (2.2 or 4.3) , 1 include support library , values of (minsdkversion = 8), maxsdkversion = 18) , targetsdkversion = 18). when application don't run @ , make error i'm confused... couldn't find full example of this. note: don't want work actionbarsherlock library , got error when try extract zip file downloaded actionbarsherlock.com actionbarsherlock great library, new project i'd start actionbarcompat android support library. http://developer.android.com/tools/support-library/setup.html you need add android-support-v4 , android-support-v7 add action bar support on android.

Splitting XML file with XSLT based on nodes -

i'm starting learn more using xslt parse xml - after researching other solutions, i"m still unable correctly write stylesheet break large xml file smaller xml files based on nodes. i've got large xml file has 1500 or abstracts. structure of file looks like: <rows> <row> <id>p-1-28-08</id> <absno>4286</absno> <title>..article title...</title> <topic>..article topics..</topic> <authors>..article authors..</authors> <abstract>..article abstract..</abstract> <keywords>..article keywords..</keywords> </row> <row> <id>p-1-28-09</id> <absno>4461</absno> <title>..article title...</title> <topic>..article topics..</topic> <authors>..article authors..</authors> <abstract>..article abstract..</abstract> <keywords>..article ke

c# - Adding MinGW compiled DLL to Visual Studio fails -

i have written library in c want able used in c#, c++, , python (other languages nice, not necessary now). library developed in linux , have been able compile on windows via mingw. problem having when trying add .dll reference in visual studio 2010 solution. error is: a reference 'c:\path\to\libmylibrary.dll' not added. please make sure file accessible, , valid assembly or com component. i have spent time trying see if compiling dll incorrectly, don't see glaring out @ me. references i've used this , this , , this . if more information needed can provide compilable example source code. there 2 ways add "dll" c# project. if dll clr assembly, meaning managed code adheres clr, can add "reference". if dll not clr assembly, can load code manually using p/invoke structure. there's lot of online documentation on p/invoke. messy, works. need declare each dll entry function using [dllimport] attribute, , load dll manually. sea

javascript - jQuery - tell when page has been scrolled to, and is viewing, a specific DIV -

this question has answer here: check if element visible after scrolling 37 answers i'm building one-page website, each different "page" different div. each div placed below 1 another, 1 div viewable @ time. want able tell when user scrolls to, , viewing, 1 of divs, , based on div id alter css of correpsonding link in navigation. guidance appreciated. thanks! check out plugin - described http://imakewebthings.com/jquery-waypoints/

Get current time in BORLAND c -

i saw somewhere took computer's current in whole int,and started calculating hours minutes seconds,and don't remember function used time int, maybe inportb or mk_fp or else,and don't remember if in dos.h .can me,i tried find quite time. in standard c, can current time calling time function: time_t = time(null); which requires #include <time.h> the null argument admittedly odd; it's there historical reasons. time_t numeric type capable of representing times. way implementation-specific, it's typically integer representing number of seconds since january 1, 1970. i'm not borland uses same representation; consult system's documentation time function. <time.h> provides various functions convert between time_t values , struct tm (a "broken-down" time), generate human-readable strings times, , forth. there may other way current time, specific borland and/or ms-dos. unless need better 1-second resolution, o

colorbar - matplotlib standard colormap usage -

Image
i'm using matplotlib 1.3.0 , have following: import matplotlib.pyplot plt cmap = plt.cm.jet plt.contourf([[.12, .2], [.8, 2]], levels=[0, .1, .3, .5, 1, 3], cmap=cmap, vmin=0, vmax=3) plt.colorbar() which produces: the bit don't understand did of other colors go? understand, specifying vmin=0 , vmax=3 color bar should use full range of cmap in image: which produced without giving vmin , vmax , levels arguments. so... missing here? edit 1 in response tom10 & tcaswell. have expected say, but... unfortunately it's not. take @ this: plt.contourf([[.12, .2], [.8, 3.2]], levels=[0, .1, .3, .5, 1, 3], cmap=cmap, vmin=0, vmax=3) plt.colorbar() with: maybe clarify bit: have data , important features of around 0.1, there around 3 let's say. give levels=[0, 0.005, 0.075, 0.1, 0.125, 0.15, 0.2, 1, 2.5, 2.75, 3, 3.25] , vmin=0, vmax=3.25 . expect see full range of colors, instead of important data-points 0.005 0.125 end in blue region (by using s

angularjs - Vertical navbar using Bootstrap and angular -

folks, i trying implement vertical navbar in page. page rendered angular. somehow not able working. not sure missing here. clicking on different tabs not display respective pages. any clues can provide appreciated. here plnkr have created troubleshooting: http://plnkr.co/edit/dzfv8vmwcjk8cywgy5mm you need dynamically set classes of elements under nav-tabs , tab-content . easiest way accomplish use ng-class attribute calls function in controller return appropriate class each tab. set active tab, use ng-click on nav-tabs . here working version in plunker: http://plnkr.co/edit/ubbq7v8mdyqllbhdwegy

Blackberry webworks SDK for OS 7 and earlier -

i want develope phonegap app bb os7 , earlier need webworks sdk. blackberry website has bb 10. webworks bb10 support other versions ? if not older versions ? here page, can download webworks sdk blackberry os (rim os): http://developer.blackberry.com/bbos/html5/download/

ggplot2 - Forcing a 1e3 instead of 1000 format in ggplot R -

i'm having trouble y formatting ranges. when use scale_y_log10() in plot, decides having scale 0.1, 10, 1000 way it. need display 1e-1, 1e1, 1e3 . math_format page not helpful without format need know. anything can answer will. you can use breaks , labels parameters of scale_y_log10 in library(ggplot2) ggplot(data=subset(movies, votes > 1000)) + aes(x = rating, y = votes / 10000) + scale_y_log10(breaks = c(0.1, 1, 10), labels = expression(10^-1, 10^0, 10^1)) + geom_point() this might not elegant solution, works if have limited number of plots.

jsf - <p:watermark> appears unparsed in generated HTML source -

i'm using jsf 2.0. i've been trying render placeholder input text, , i'm trying primefaces' watermark. here's jsf code <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core" xmlns:p="http://primefaces.org/ui"> .... .... <h:form> <table> <thead> <tr> <th> <h:outputtext value="header"/> </th> </tr> </thead> <tbody> <tr> <td> <h:inputtext id="first" value="#{bean.firstvalue}"/> <p:watermark for="first" value="fill me"/>

python - Why does assigning to self not work, and how to work around the issue? -

i have class (list of dict s) , want sort itself: class table(list): … def sort (self, in_col_name): self = table(sorted(self, key=lambda x: x[in_col_name])) but doesn't work @ all. why? how avoid it? except sorting externally, like: new_table = table(sorted(old_table, key=lambda x: x['col_name']) isn't possible manipulate object itself? it's more meaningful have: class table(list): pass than: class table(object): l = [] … def sort (self, in_col_name): self.l = sorted(self.l, key=lambda x: x[in_col_name]) which, think, works. , in general, isn't there any way in python object able change (not instance variable)? you can't re-assign self within method , expect change external references object. self argument passed function. it's name points instance method called on. "assigning self " equivalent to: def fn(a): = 2 = 1 fn(a) # still equal 1 assigning self changes self name points (fro

javascript - AngularJS ng-repeat with custom element inside a table is rendering strangely -

i'm trying re-use portion of html view in multiple places. portion want re-use table cells in html table. problem custom directive inside ng-repeat doing funny things. have reproduced problem on jsfiddle . there 2 html tables in jsfiddle. first ng-repeat table cells written in view , second table cells coming directive, my-element. chrome dev tools report rendered html looks this. note custom element appears once , outside table. rendered html <div ng-controller="myctrl" class="ng-scope"> table1 <table class="table table-hover"> <tbody><!-- ngrepeat: p in people --> <tr ng-repeat="p in people" class="ng-scope"> <td class="ng-binding">name: mike</td> <td class="ng-binding">age: 20</td> </tr> <tr ng-repeat="p in people" class="ng-scope">

html - CSS: Right align a vertically rotated text -

i can't seem align vertically rotated div way right side of page: http://jsfiddle.net/f23w2/2/ html: <div class="vertical">vertical text</div> css: .vertical { position: relative; background-color: #dddddd; padding: 10px; border-radius: 5px 5px 0 0; float: right; -moz-transform: rotate(270deg); /* ff3.5+ */ -o-transform: rotate(270deg); /* opera 10.5 */ -webkit-transform: rotate(-90deg); /* saf3.1+, chrome */ } there unwanted margin created between right page border , div. top part of rotated div gets cropped. although can use negative margins work around, wondering if cleaner solution exists. change origin of rotation transform via transform-origin: 100% 100%; new fiddle

vb.net - How to properly close form1 after showing form2 -

i have script editor i'm using code through object model of software company uses. has login form make sure able access system , main form pull script object , edit using scintillanet. the issue having when pass object main form , leave login form open runs smoothly want close login form after main form open. when stops after opening main form. here sample of code. can see have commented out line me.close() seems issue. ' close form, show main form , pass m3 object dim f formmain = new formmain ' pass m3 object next form f.m3system = m3system f.show() 'me.close() any awesome!!! this built-in feature vb.net. use project + properties, application tab. change shutdown mode setting "when last form closes".

regex - Why is my regexp matching multiple times? -

i have following line want capture several strings via regular expression: l = '15 1180 62444 e0e0 049c f3ec 104'; i augmenting following regexp operate on line: d = regexpi(l, '([0-9a-f]+)\s?', 'tokens'); when executing line, length(d) == 7 . shouldn't regexp match first occurrence, i.e., length(d) == 1 , d{1} == '15' ? for it's worth, used same regexp in perl , found matches first instance of pattern (which expected): my $l = ... #defined above $l =~ m/([0-9a-f]+)\s?/i; if (! defined($2)){ # $2, $3, ..., $n defined n matches print "didn't match twice!\n"; # prints when execute script } as stated using regexpi ... start = regexpi(str,expr) returns row vector, start, containing indices of substrings in str match regular expression string, expr, regardless of case. when either str or expr cell array of strings, regexpi returns m-by-n cell array of

python - How to use Any with Flask-Enterprise -

i can't find examples or documentation using flask-enterprise when creating soap service. mentioned briefly in soap models section of documentation but, unlike other types described in section, there no code block showing usage. maybe going down rabbit hole trying use flask-enterprise since, if go home page, says have been bought out , no longer license software 3rd party developers. try flask-spyne extension, it's bsd licensed.

html - css: table scrollable both horizontally and vertically with fixed header -

how can implement table both horizontally , vertically scrollable fixed header using css? i found scrolling div outer div , implemented using javascript/jquery. way implement using css? the updated code: #div-table-content { width: 100%; overflow-x: auto; } table { font-size: 12px; white-space:nowrap; overflow-x: scroll; } tbody { height: 400px; overflow-y: auto; width: 100%; display: block; } thead tr { display: block; width: 100%; } for start divide <table> semantically headers inside <thead> , content inside <tbody> . then, vertical scrolling, give fixed height <tbody> , set overflow-y: auto , display: block . for horizontal scrolling, belive have wrap entire table container (lets <div> , give fixed width , overflow-x: auto . jsfiddle demo

c# - How Does .Net Allow Nullables To Be Set To Null -

the nullable<t> type defined struct . in .net, can't assign null struct because structs value types cannot represented null (with exception of nullable<t> ). int = null; // won't compile - know int? = null; // compile, , i'm glad does, , should compile, why? how did nullable<t> become exception rule "you can't assign null value type?" decompiled code nullable<t> offers no insights of how happens. how did nullable<t> become exception rule "you can't assign null value type?" by changing language, basically. null literal went being "a null reference" "the null value of relevant type". at execution time, "the null value" nullable value type value hasvalue property returns false . this: int? x = null; is equivalent to: int? x = new int?(); it's worth separating framework parts of nullable<t> language , clr aspects. in fact, clr doesn&#

javascript - Using the PUT method with Express.js -

i'm trying implement update functionality express.js app, , i'd use put request send new data, keep getting errors using put. i've read, it's matter of using app.put, isn't working. i've got following in routes file: send = function(req, res) { req.send(res.locals.content); }; app.put('/api/:company', function(res,req) { res.send('this update'); }, send); when use postman make put request, "cannot put /api/petshop" error. don't understand why can't put, or what's going wrong. you may lacking actual update function. have put path returning result client missing part when tell database update data. if you're using mongodb , express, write like: app.put('/api/:company', function (req, res) { var company = req.company; company = _.extend(company, req.body); company.save(function(err) { if (err) { return res.send('/company', { errors: err

css - Testing for collapsed float -

how test collapsed float, container element not expand take in floating elements, e.g. div collapse after float css . a collapsed float can fixed adding css overflow:auto property container. however, if overflow declaration accidently deleted in later edit, web page (or many pages if container used on many pages) can become unreadable. given collapsed float not css error , not change text on page, how write rspec test detects if such collapsed has occured? if have items floated within element, you'll need clear float @ end. .clearfloat { clear:both; } here's fiddle shows i'm talking about: http://jsfiddle.net/fishgraphics/gmr9m/

Replacement pattern for an anonymous class in Dart -

i'm trying build base class table< t > uses list tablecolumns< t > display table in dart. in java done anonymous class pattern leaf class simple following: class parttable extends table< part > { // column 1: part number addcolumn( new tablecolumn<part>("part number") { string get(part part) { part.getnumber().tostring() } void set(part part, string number) { part.setnumber(number); } }); // column 2: part description addcolumn( new tablecolumn<part>("part description") { string get(part part) { part.getdescription().tostring() } void set(part part, string desc) { part.setdescription(desc); } }); } can suggest dart design pattern nicely substitute java anonymous class pattern above? basic idea anonymous tablecolumn class abstract methods (e.g. , set) overridden by anonymous class in table constructor provide view specific overrides working part's attributes. table

iphone - iOS Tapku library calendar is black on some devices (TKCalendarMonthTableViewController) -

Image
i'm using tapku library show calendar of events, it's showing correctly on device (iphone 5 ios 6.1.3), on other devices or simulator, calendar black (check screenshots) the calendar object of tkcalendarmonthtableviewcontroller any idea why it's not showing correctly everywhere? thanks i found it, tapkulibrary.bundle file missing in xcode project, added , works fine.

php - Page Not Found in title of WordPress page on template_redirect using include() -

i've added custom rewrite rule wordpress site so: add_rewrite_rule( 'register/bronze', 'index.php?action=register&type=2', 'top' ); then within template_redirect action, check against action querystring variable , load include so: $action = get_query_var( 'action' ); if( $action == "register" ) { include( bg_file_path . '/templates/register-brand.php' ); exit; } this works fine , custom template displayed, however, page title appears "page not found | site name". is there way can set page title custom template? i'm trying avoid setting these pages wordpress page since they're fundamental running of site, don't want 1 of admins change page settings or delete page entirely. any appreciated. wordpress overwriting title because still throwing 404 (you can verify using firebug). wordpress typically throw 404s when including files in template redirect. you need reset header

java - No display - ListView using SimpleAdapter -

i'm trying display list of wifi ap's in range i.e. including same ssid's these not shown in default wifi settings. this first attempt @ android sdk , i've gotten far: package com.iiitd.wifistats; import android.app.activity; import android.content.context; import android.net.wifi.scanresult; import android.net.wifi.wifimanager; import android.os.bundle; import android.view.menu; import android.view.view; import android.widget.button; import android.widget.listview; import android.widget.simpleadapter; import android.widget.toast; import java.util.arraylist; import java.util.hashmap; import java.util.list; import java.util.map; public class wifistats extends activity implements view.onclicklistener { wifimanager wifi; list<scanresult> scanresults; arraylist<map<string, integer>> list; simpleadapter adapter; listview listview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(sa

sublimetext2 - SublimeText 2: What does the number on the left side mean in command palette? -

Image
when search file name- on left gives numbers ranging 0-999. these numbers represent? seems search ranking i'm not sure. they measure of likelihood result match search query. algorithm happens under hood on predictive or autocomplete searches (like google's or mac's spotlight search) st2 team decided neat show numeric result. it takes few items consideration. each 1 of these criteria adds more value result: of matching characters how file has been used proximity top folder whether letters in sequence or dispersed through filename whether filename starts matched letters, or matched letters somewhere in between. in example below, can see values go "index.html" gradually becomes more accurate. expected, buried files, or files used less lower value.

c# - MVC WebMail Helper - Is It Possible to Send An Email With Attachments Without Saving Them First? -

is possible? i'm using mvc webmail helper send email form user can add attachment using file input webmail.send( to: email.to, cc: email.cc, bcc: email.bcc, replyto: email.replyto, subject: email.subject, body: email.messagebody, filestoattach: email.attachments, isbodyhtml: email.isbodyhtml ); i filenotfound exception save attachment first, send email, go , delete it, wondering if there way avoid having that. remember in webforms possible using fileupload control , system.net.mail's attachments system. suggestions? thanks! the source system.web.helpers.webmail.cs http://aspnetwebstack.codeplex.com/sourcecontrol/latest#src/system.web.helpers/webmail.cs it looks helper method supports file paths. you'll have use mailmessage , smtpclient directly if want able send attachments file in memory. message.attachments.add(new attachment(postedfile.stre

char - Formatting a C Program -

so have program takes file , reads in character character , prints character , hexadecimal equivalent. ` #include <stdio.h> #include <stdlib.h> int main(){ file *labfile; char buf; labfile = fopen("lab1.dat", "r"); if (labfile == null) perror("error opening file\n"); while( (buf = fgetc(labfile) ) != eof){ if(("%x", buf)< 16){ printf("%c 0%x\n", buf, buf); } else printf("%c %x\n", buf, buf); } fclose(labfile); return 0; } ` program works way need except 1 thing. need program output hex number on top character directly underneath number , process needs continue horizontally. any appreciated! you should output characters hex first, , save each read in character has been printed until run out of columns on screen. can move next line, , print out characters saved underneath hex output. you can simplify logic format hex output single

How can I parse the expiration date from a Windows Azure SAS key as a client? -

i'm trying check on expiration date of sas key on client side can request new sas key once expires. i'm using microsoft.windowsazure.storage namespace (which version 2.0 of azure storage library). there built in method or have parse manually? i don't believe there's specific in storage client library. should able parse querystring on uri , @ utc date in signedexpiry . can parse querystring httputility.parsequerystring() . here 2 caveats think about: this check won't entirely accurate, since there clock-drift between machine's clock , storage service's clock. if server uses shared access policy (which allows programmatic modification/revocation of access), there's no guarantee signedexpiry part of querystring. more on shared access policies here .

How can i remove /index in URL in routing in cakePHP? -

i want remove /index in url. i have tried following in routes.php file : router::connect('/home/:index', array('controller' => 'homes')); and : router::connect('/home/', array('controller' => 'homes','action'=>'index')); try router::connect('/home', array('controller' => 'homes','action'=>'index'));

Clearing a Password text box in ASP.NET -

i have 2 boxes 1 username [text] , 1 password [password]. i'm using code in codebehind: protected void button2_click1(object sender, eventargs e) { textbox1.text = ""; textbox2.text = ""; } [asp.net/html] <asp:textbox id="textbox2" runat="server" height="24px" style="text-align: center" width="209px" textmode="password"></asp:textbox> the first text box clears second doesn't. there special way in asp.net? hi don't know happend in html wrote this: <asp:textbox id="textbox1" runat="server" ></asp:textbox> <asp:textbox id="textbox2" runat="server" height="24px" style="text-align: center" width="209px" textmode="password"></asp:textbox> <asp:button id="button1" runat="server" text="button" oncli

python - Error: bad runtime process port [''] on App Engine -

i'm developing site gae , webapp2. while running development server, following error out of nowhere, no stack trace: http_runtime.py:404] bad runtime process port [''] sometimes happens when change part of database schema (it's still in development) , problem fixed if restart server , clear datastore. happens seemingly no reason. the solution restart server, feel weird not knowing why i'm getting error. happens when server has been long? there can prevent it? happen in production? want know before start thinking deploying. for reference error coming line of code: https://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/devappserver2/http_runtime.py it in start() function maybe causing dev_app_server restart , trying reuse port not available anymore? can try enable debugging devappserver , see if can reproduce , paste in context? dev_appserver.py --dev_appserver_log_level=debug sets log output debug level

Sorting and Organization of letter frequency - python -

i'm trying find way count number of occurrences of letters in text file display them in greatest lowest depending upon there frequency. have far, please on brain block. def me(): info= input("what file select?") filehandle= open(info,"r") data=filehandle.read() case = data.upper() s=('abcdefghijklmnopqrstuvwxyz') in range(26): print(s[i],case.count(s[i])) me() this collections.counter , most_common() method for: import collections import string def me(): info = input("what file select? ") filehandle = open(info, "r") data = filehandle.read().upper() char_counter = collections.counter(data) char, count in char_counter.most_common(): if char in string.ascii_uppercase: print(char, count) me() a counter dictionary counts number of occurrences of different items (in case, characters). char_counter.most_common() gives pairs of characters , co

rest - Why does my code in android annotations fail without anything in the logs -

i'm new android annotations maybe i'm missing i'm trying copy rest client seen https://github.com/excilys/androidannotations/wiki/rest%20api here where have interceptor defined follows @ebean(scope = scope.singleton) public class restinterceptor implements clienthttprequestinterceptor{ final string tag = "rest"; @bean authstore authstore; @override public clienthttpresponse intercept(httprequest request, byte[] data, clienthttprequestexecution execution) throws ioexception{ //need set api key here nothing happens code quits // log.d("rest",authstore.getsessionkey()); httpheaders headers = request.getheaders(); headers.set("api_key",authstore.getapikey()); clienthttpresponse resp = execution.execute(request, data); httpstatus code = resp.getstatuscode(); log.d(tag,resp.getbody().tostring()); if(code.value() == 200){ log.d(tag,"success code 200"); }

Directly calling delegate's method in objective-c -

i created protocol requires class client implement method. in client class need perform same actions defined in method not when delegate calls it. don't think idea copy-paste code, don't know either if it's practice call method directly within client class. thinking maybe delegate methods should called delegate. should create third method it's called inside delegate method , when need it? or, can call delegate method directly? use blocks instead of delegates solve problem. blocks same work delegates, it's far cleaner, requires less plumbing work (think instance variables/properties gotta shuttle between classes , delegates.. in blocks, info encapsulated within block), , consistent direction ios/objective-c community moving in (you'll find lot of high profile libraries evolving substitute delegation , other stuff blocks). if you're not familiar blocks or find it's quirky syntax annoying, here user friendly guide. also here nice answ

java - Eclipse IDE Sidebar (navigation) missing -

Image
i'm trying use eclipse computer science class, except bar on left missing. know fix? do mean package explorer ? can toggle here

Jquery button click event handler for displaying hidden HTML element in Rails -

i using jquery display hidden '' element (hidden using css ---> display:none) when button clicked user in table. using rails, ruby, jquery , html. code view: <h2>files</h2> <table class="table"> <tr> <th>filename</th> <th>description</th> <th>download link</th> </tr> <% @files.each |file| %> <% filename = file.split('/').last %> <% object = @bucket.objects[file] %> <tr> <td><%= filename %></td> <td> <div class="file_description"><%= object.metadata['description']%> <button id ="file3" type="button" class= "btn btn-default edit_description" onclick="window(this)">edit</button> </div> <div id = file2 class="file_descripti

java - How to build native library for Hadoop 2 -

i've setup cluster running hadoop 2.1 beta on 64 bit linux. however, each time run hadoop command tools, warning message pops out: warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable then found out lacking native library the 64 bit linux. official hadoop 2.1 tarball provides native library 32 bit linux in /lib/native folder. and read official document hadoop native library, guide says: once installed prerequisite packages use standard hadoop build.xml file , pass along compile.native flag (set true) build native hadoop library: $ant -dcompile.native=true <target> i search hadoop folder, there no file named build.xml . haven't enough knowledge of java programming , hadoop, want know how can compile native library 64 bit linux system? thanks. the build system has changed maven. can find instructions building here: https://svn.apache.org/repos/asf/hadoop/common/trunk/building.txt spec

mysql - How can I update the value of one field to the most often used value of another field? -

i have table similar following: id     payee     category 001  costco      grocery 002  see's        candy 003  costco      repair 005  costco      grocery 006  costco 007  costco 008  see's using mysql without aid of programming language, there query (nested or not) set category of 3 new rows used category payees? for example, 1 of costco records (id 003) has repair category, whereas other 2 costco rows (id 001 , id 005) have grocery category. desired result new costco rows (id 006 , id 007) set grocery since that's used category payee. sure.. change 'your_table' name of table update your_table left join (select payee, category (select payee, category your_table category != '' , category not null group payee, category order count(*) desc) tbl2 group payee ) tbl2 using (payee) set your_table.category = tbl2.category; this change costco categorized repair 'g

alarm - Is there any way, given user permission, for an android app to start on its own at a scheduled time in the future? -

as title suggests, there way have android application schedule start on own @ time in future. example, possible within android api developer write application might initiate @ 7am if scheduled user? you can use alarm manager. this class provides access system alarm services. these allow schedule application run @ point in future. http://developer.android.com/reference/android/app/alarmmanager.html

javascript - if/ else statement not working? -

i'm new coding, , cant figure out doing wrong. every time try write if/ else, works point statement is, , wont work. this wrote: alert("welcome chloe's quiz show!") var name = prompt("contestant, name?") var = prompt("is first time playing? type 'yes' or 'no'.") if (help === yes){ alert("the game easy! have type letter corresponds correct answer. press 'ok'.") confirm("lets started!") } else{ confirm("lets started then!") } change line: if (help === yes) to this: if (help == "yes") since yes not variable.

c# - Force Binding isn't what I want -

my oneway binding isn't working i'm expecting. when click button add new "person" doesn't add newly entered person listview until shut down , restart application (so value gets added db not ui) what doing incorrectly? have inotifypropertychanged, have observablecollection... missing? i have model: public class person : inotifypropertychanged { public event propertychangedeventhandler propertychanged; private string _personname; private string _personemail; private string _personphone; private datetime _persondob; [primarykey, autoincrement] public int personid { get; set; } [maxlength(25)] public string personname { { return _personname; } set { _personname = value; onpropertychanged("personname"); } } [maxlength(50)] public string personemail {

android - Unity3d BootCamp Tutorial UnityScript Array Order Anomaly in ImageEffectsOrder.js -

i new unity , grabbed bootcamp project , ran within unity 4.1.5f1 windows build without modification i tried build android , had bunch of errors (mostly variables not being declared) but have 1 remaining don't understand... in following code in file imageeffectsorder.js javascript references order method of array sorted[] sorted[i].order the compiler errors 'order' not member of object. so i'm little confused why windows build supports member not android. makes me wonder other surprises await when converting platform platform. but can point me workaround order member? , i'm not quite clear on returning...it seems variable i should give order. the order seems intrinsic code, never set value, 'order' it? can't seem find docs on ' member ' of array class. here code: var sorted : array = new array(); var : int = 0; (var fx : posteffectsbase in getcomponents(posteffectsbase)) { if(fx && fx.enabled) {