Posts

Showing posts from February, 2015

c# - Multithreading doesn't refresh the form -

i'm having problem multithreading, working forms. problem is: have form , 1 more class. i'm having problem refresh form screen. form screen has 5 checkboxes checked or not according 5 properties on sample class. public boolean ip1 { get; set; } public boolean ip2 { get; set; } public boolean ip3 { get; set; } public boolean ip4 { get; set; } public boolean ip5 { get; set; } the main form class has function private void test() called when form loading: new thread(test).start(); the private void test() function 1 call sample.getcon() inside sample class , function getcon() calls more 5 threads makes pings in differently ip's , set properties of ip1, ip2, ip3... form class inside function private void test() refresh form with: this.begininvoke((action)(() => checkbox1.checked = sample.ip1; checkbox1.checked = sample.ip2; checkbox1.checked = sample.ip3; checkbox1.checked = sam...

exception handling - What is the correct way to configure custom mapper for WebApplicationException? -

i've created class implements implements exceptionmapper<webapplicationexception> , registered environment.addprovider(new webapplicationexceptionmapper()); . custom mapper works exceptions extended webapplicationexception . example doesn't work conflictexception , doesn't work custom exceptions following constructor: public conflictexception(uri location, object entity) { super(response.status(response.status.conflict).location(location).entity(entity).build()); } it work if i'll remove super(response.status.... . strange , can't explain this. i'm not sure jersey or dropwizard behaviour. what correct way configure mapper webapplicationexception , subclasses? can explain problems have? may little late, found work. for dropwizard 0.8 , above in yaml configuration server: registerdefaultexceptionmappers: false this disable dws default exception mapper, add own exception mappers // register custom exceptionmapper...

php - http request loop not sending -

why not send http request? i'm trying add friends person logged in mysql table. when use url manually in browser http://www.ratemyplays.com/api/post_friends.php?name=%@&id=%@&userid=%@ it add values %@, not when run objective-c code. doing wrong http request loop? for (nsdictionary<fbgraphuser>* friend in friends) { nsstring *strurl = [nsstring stringwithformat:@"http://www.ratemyplays.com/api/post_friends.php?name=%@&id=%@&userid=%@",friend.name, friend.id, currentid]; // execute php code nsdata *dataurl = [nsdata datawithcontentsofurl:[nsurl urlwithstring:strurl]]; // receive returend value nsstring *strresult = [[nsstring alloc] initwithdata:dataurl encoding:nsutf8stringencoding]; nslog(@"%@", strresult); } i think need more clear trying accomplish here.. url nslog prints out looks fine.. mean adding %@? did in creating again , again -one- string of url , didn't it... ...

forms - Codeigniter ignore empty array items on update database record -

hey guys i've been working on few days can't seem work :( here situation. i have "edit profile" page. on page can, name implies, edit profile information. for example here i'm trying do. database record: ||-------||----------||-----------|| || name || surname || email || ||-------||----------||-----------|| || amy || nuts || an@no.com || ||-------||----------||-----------|| i have form gives user ability enter own data , change of fields. the form fields have names corrospond database fields. <input name="name" ...... <input name="surname" ...... <input name="email" ..... this logical , easy. the problem have when submit form. build website html5 , use placeholders form fields. because looks nice imo , can experiment it. when want update surname, other fields stay empty. codeigniter default returns "false" in case of empty post item. maybe can see problem. when send post data ...

Suppose you have no static keyword in Java -

suppose have no static keyword in java still want same functionality. how go it? you create data structure maps class instances values associated class instead of particular instance of class, other people saying, hypothetical of value.

go - How to print JSON on golang template? -

i need object in client side, converted json using json.marshal , printed template. object getting printed escaped json string. i'm expecting var arr=["o1","o2"] var arr="[\"o1\",\"o2\"]" i know can json.parse in client side, way? here how i'm printing in template: {{ marshal .arr }} here marshal function: "marshal": func(v interface {}) string { a, _ := json.marshal(v) return string(a) }, in js context normal strings gets escaped. should have converted template.js type before printing. ref: http://golang.org/pkg/html/template/#js this new marshal function: "marshal": func(v interface {}) template.js { a, _ := json.marshal(v) return template.js(a) },

java - Scala parse a JSON into a Map alternatives -

i'm looking alternatives scala json.parsefull(jsonstring). i'm using scala json convert jsonstring map[string,any] takes long convert map, , build java object it. jsonstring long json response. do know fastest ways convert jsonstring map[string, any] can patternmatching after that? here goes code json.parsefull(): override def parse(in: string): responseobject = { val json: option[any] = json.parsefull(in) json match { case some(value) => val map: map[string, any] = value.asinstanceof[map[string, any]] //json root val data: map[string, any] = map.get("data").get.asinstanceof[map[string, any]] //populate psmsearchresponse val response: responseobject = new responseobject //mapping base properties response.sethash(data.get("hash").get.asinstanceof[string]) //call "transformtopsmitem" function map each searchitem val items: list[responseobjectitem] = data.get("items").get.asinstanceof[l...

tcp - What are fine-grained and coarse-grained timeout -

what definitions of fine-grained , coarse-grained timeout? i googled them, properties lectures , academic papers. still don't know mean. tcp uses estimate of round trip time (rtt) guess when packet has received other end. if timer exceeds, packet assumed lost , retransmitted. in tcp reno rtt computed using coarse-grained timer. means that, say, every 500ms checked whether sent packet received or not. if is, rtt time of timer, if not timer checks again in 500ms. of ourse, 500ms arbitrary value how works. tcp vegas, example, uses fine-grained timer, using system's time @ point of sending , point of receiving segment compute rtt. see rfc 2988 details.

r - Producing multiple qplots with data.table -

i'd produce 1 scatter plot per group data.table , return function. i can produce different charts using plot (below) assume isn't data.table issue: dt = data.table(a = c(1,2,3,4), b = c(1,1,2,2), c = c(4,5,6,7)) result = dt[, list(plot = list(plot(a, c))), = b] however if try same qplot (in order plots can return), appear end 2 copies of second chart. dt = data.table(a = c(1,2,3,4), b = c(1,1,2,2), c = c(4,5,6,7)) result = dt[, list(plot = list(qplot(a, c))), = b] result[1,][["plot"]] result[2,][["plot"]] apologies if i'm missing obvious / doing stupid. i'm not 100% sure what's going on, here workaround: result = dt[, list(plot = list(qplot(data=.sd, a, c))), = b] it seems data.table reserves environment execute evaluations in in way, , qplot stores reference environment. since don't specify data argument, qplot in environment data, keeps getting changed each by value data.table , after data.table operation, ...

javascript - Jquery add div to page ontop of everything else with draggable -

i have application attempting extend functionality of it. case html in example must added javascript. requirement when page loaded div added page , become draggable. happens since div added prepend takes space , there 'grey' space when div dragged around. $('.body').prepend('<div style="height:40px; width 40px; z-index:9; position:relative;" id="draggable" class="ui-widget-content"><p>test</p></div>'); $(function() { $( "#draggable" ).draggable(); }); i guess , need position absolute position:absolute;

c# - Why SQL Server CE does not recognize DB when my app is deployed -

i struggling how make app work when deployed - keeps saying file invalid no matter do: have is: data source="\mydb.sdf" the db should in directory executable located. you need use absolute path access file. var pathtoexe = system.reflection.assembly.getexecutingassembly().location; var path = path.getdirectoryname(pathtoexe); var pathtodb = path.combine(path, "mydb.sdf"); pathtodb should absolute path database object, assuming in directory of executing assembly.

Eclipse Groovy change Color of Comments? -

Image
how can change color of comments groovy files in eclipse? the option not available in preference/editor settings. edit: use eclipse kepler 4.3.1 change color in java syntax coloring option in window > preferences > java > editor > syntax coloring > comments, change groovy's too. worked fine on eclipse juno.

css - Why do the elements on my page move slightly when I hover over the images? -

here link: http://www.levomedia.com/commercial%20%20%20baker%20wilkins%20&%20smith.htm if closely @ main box 8 images inside, if hover on 1 , wait, can see elements move , images , elements seem try , adjust new position. when take off hover, move previous position. it must because of conflicting css properties think, i've tried lots of different things , can't seem identify source of problem. the problem persists on following page also. on page, scrolling seems slower usual; think it's because images readjusting slow browser down. link: http://www.levomedia.com/projects.htm many thanks. that due transition! can see transitions added website. when hover on images, transitions takes action , elements' position changed in while (the 1 second time have provided). please try altering value!

dynamic tabs that worked in Bootstrap 2 don't work in Bootstrap 3 -

i've used following in bootstrap 2.1 when try use in bootstrap 3, dynamic content isn't loaded. can suggest fix? thanks <script type="text/javascript"> $(function() { $("#maintabs").tab(); $("#maintabs").bind("show", function(e) { var contentid = $(e.target).attr("data-target"); var contenturl = $(e.target).attr("href"); if (typeof(contenturl) != 'undefined') $(contentid).load(contenturl, function(){ $("#maintabs").tab(); }); else $(contentid).tab('show'); }); $('#maintabs a:first').tab("show"); }); </script> and <ul id="maintabs" class="nav nav-tabs"> <li><a data-target="#tab1" data-toggle="tab" href="a">tab 1</a></li> <li><a data-target="#tab2" dat...

cmd - taskkill window with space and quotation on its name? -

how kill cmd window space , quotation on name? want kill window name is: remote /c comuptername "session1" taskkill /f /fi "windowtiltle eq remote /c comuptername "session1"" doesn't work, don't find window thanks solved, juste add double quotation: taskkill /f /fi "windowtiltle eq remote /c comuptername ""session1"""

objective c - Zebra IMZ 320 printing image takes too long (iOS) -

i using zebra imz 320 print pdf document ios (receipt actually) , works. takes 50 seconds print 23 kb pdf document. i thinking maybe if send in hexadecimal format printer understand, printing time decrease can't find how send in byte format. tried zpl codes understanding converting image .grf format , send printer using utilities images dynamic. can please me ? here code send print images : cgdataproviderref dataprovider = cgdataprovidercreatewithcfdata((cfdataref)pdfdata); cgpdfdocumentref document = cgpdfdocumentcreatewithprovider(dataprovider); size_t npages = cgpdfdocumentgetnumberofpages(document); size_t pagenum; (pagenum = 1; pagenum <= npages; pagenum++) { uiimage* image = nil; cgpdfpageref page = cgpdfdocumentgetpage(document, pagenum); cgrect rect = cgpdfpagegetboxrect(page, kcgpdfartbox); uigraphicsbeginimagecontextwithoptions(rect.size, yes, 2.6); cgcontextref context = uigraphicsgetcurrentcontext(...

html - Use sprite image for list -

i struggling bit here: http://jsfiddle.net/spadez/jbue6/27/ i trying have vertical list each list item has it's own icon, loaded in single sprite. seem have got of way image displayed in background. how crop sprite image show correctly, , how offset them show different images? html <ul> <li class="navimg" id="user"><a href="url">user</a></li> <li class="navimg" id="vacancy"><a href="url">vacancies</a></li> <li class="navimg" id="company"><a href="url">company</a></li> </ul> css .navimg { background:url('http://www.otlayi.com/web_images/content/free-doc-type-sprite-icons.jpg'); } #user { left:30px } #vacancies { left:60px } #company { left:90px } any appreciated. take @ this. http://jsfiddle.net/itsakt/v6ewj/1/ html <ul> <li> <i class=...

c - Why do two calculations give different answers? -

#include<stdio.h> #define pi1 3.141 const float pi = 3.141; int main() { printf("%f %f",4*10*pi, 4*10*pi1); } output (on machine) 125.639999 125.640000 pi1 preprocessor symbol , replaced textually double. pi float constant initialized double, , lose precision bits (see ieee754 specs). for more details, pi float in fact stored 0x40490625 3.1410000324249267578125. pi1 stored 0x400920c49ba5e354, 3.1410000000000000142108547152

c - data strucure of addition of two elements -

i have problem in c, want achieve kind of thing using code written below. input , output should this: input freq output freq 1 0,1,4,2,5,3 add 2 first (0+1) 0,1,4,2,5,3,1 2 4,2,5,3,1 add min , last (2+1) 0,1,4,2,5,3,1,3 3 4,5,3,3 add min , last (3+3) 0,1,4,2,5,3,1,3,6 4 4,5,6 **here add(4+5)**(minimum two)0,1,4,2,5,3,1,3,6,9 5 9,6 minimum 2 0,1,4,2,5,3,1,3,6,9,15 6 15 but condition there must no swaping of elements , no sorting , **but can deal index of element comparison , once if found correct element @ index add them , put @ last of array. i trying basic idea working correctly first if condition write in other 2 if conditions want know.please me there . suppose data[i].freq={0,1,2,3,4,5} , data[i].next points next element in example above in first step 0 points 1 , 1 points element obtained these two(so 1 points 1 @ alst , 1 @ last index poi...

php - Jquery Table and text with accented characters issue -

i created table dynamically jquery variables (in java array json_encoded php array). after this, variables perfect accented characters. far good. put them in table results bad. here's code : <script> (var j = 0; j < 13; j++) { // labels if (j==0) { var tab_b = tab_b + "<tr><th>" + label_array2[j] + "</th><th>" + label_array2[j+1] + "</th><th>" + label_array2[j+2] + "</th></tr>"; } // inputs if ((j>0) && (j<13)) { var tab_b = tab_b + "<tr><td><input type='text' name='" + input_array2[(j*3)] + "' maxlength='33' size='33' value='" + label_array2[(j*3)] + "'/></td><td><input type='text' name='" + input_array2[(j*3)+1] + "' maxlength=...

Is there a benefit to defining variables together with a comma vs separately in JavaScript? -

reading crockfords the elements of javascript style notice prefers defining variables this: var first='foo', second='bar', third='...'; what, if benefit method provide on this: var first='foo'; var second='bar'; var third='...'; obviously latter requires more typing aside aesthetics i'm wondering if there performance benefit gained defining former style. aside of aesthetics, , download footprint, reason var statement subject hoisting . means regardless of variable placed within function, moved top of scope in defined. e.g: var outside_scope = "outside scope"; function f1() { alert(outside_scope) ; var outside_scope = "inside scope"; } f1(); gets interpreted into: var outside_scope = "outside scope"; function f1() { var outside_scope; // undefined alert(outside_scope) ; outside_scope = "inside scope"; } f1(); because of that, , function-scope j...

iTunes Connect and iOS: Changing AppStore search name but not App name -

Image
is there way change appstore search name of app not app.ipa name? in other words, have app in appstore looks "myappname: subtitle" on iphone "myappname". the reason doing that, providing subtitle, want allow users find "myappname" typing keywords included in "subtitle". edit: in other words, itunes connect appname have same appname of xcode app bundle? the name in itunesconnect can different .ipa file name. similar trick own app, , works fine.

PhoneGap JQuery Mobile Application - Overflow Issue -

i developing phonegap application using jquery mobile. i have header & footer navbar's. , in content section have html: <div data-role="content" class="maincontent" style="overflow:hidden; padding-top: 0px;"> <ul data-divider-theme="b" data-role="listview" data-inset="true" class="mainmenu"> </ul> </div> the list dynamically created , works fine. in cases overflow:hidden doesn't appear working , header / footer start moving along contents of main body , become invisible. anyone has idea please? adding data-tap-toggle="false" has worked me. @nijilnair style needed remove space on top.

Calculate the performance of a multicore architecture? -

cal multicore architecture 10 computing cores: 2 processor cores , 8 coprocessors. each processor core can deliver 2.0 gflops, while each coprocessor can deliver 1.0 gflops. computing cores can perform calculation simultaneously. instruction can execute in either processor or coprocessor cores unless there explicit restrictions. if 70% of dynamic instructions in application parallelizable, maximum average performance (flops) can in optimal situation? please note remaining 30% instructions can executed after execution of parallel 70% over. consider application dynamic instructions can partitioned 6 groups (a, b, c, d, e, f) following dependency. example, --> c implies instructions in need completed before starting execution of instructions in c. each of first 4 groups (a, b, c , d) contains 20% of dynamic instructions whereas each of remaining 2 groups (e , f) contains 10% of dynamic instructions. instructions in each group must executed sequentially on same processor or copr...

django - Dokku install libmemcached -

i trying deploy django application dokku. my requirements.txt contains django-pylibmc requires pre-installed libmemcached . when push repo fails message: remote: in file included _pylibmcmodule.c:34:0: remote: remote: _pylibmcmodule.h:42:36: fatal error: libmemcached/memcached.h: no such file or directory remote: remote: compilation terminated. remote: remote: error: command 'gcc' failed exit status 1 remote: i thought solve using memcached plugin understand creates separate container memcached installed. so question is: need make pip installation work? can somehow include apt-get install libmemcached step in dokku push? found solution here . seems case heroku. answer states, problem heroku(dokku) python buildpacks requires explicit pylibmc specification in requirements.txt .

java - Builder Pattern: Why do we need .build()? -

when researching builder pattern, standard pattern like: new sandwichbuilder().salami().pastrami().cat().build(); where .salami(), .pastrami(), , .cat() return sandwichbuilders , , .build() returns sandwich . is considered bad style to, instead, use following convention? new sandwich().salami().pastrami().cat(); where .salami(), .pastrami(), , .cat() return sandwich directly, foregoing seemingly unnecessary complication? one of greatest advantages of builder pattern built object can immutable . second example either impossible, assuming salami() , pastrami() , etc. act standard setters, or inefficient if each returned new instance. jb nizet points guava's splitter , example of latter case. point, guava developers must have felt "foregoing seemingly unnecessary complication" enough reason tolerate few copies during creation of customized splitter s.

Why is the file I uploaded locked by ColdFusion 10? -

i'm trying delete file if not spreadsheet, keep getting following error when uploaded testfile.text: coldfusion not delete file d:\coldfusion10\cfusion\runtime\work\catalina\localhost\tmp\testfile.text i verified not permission issue, because if go , execute code try delete file again, work. <cffile action="upload" destination="#dest#" filefield="xlsfile" result="upload" nameconflict="makeunique"> <cfif upload.filewassaved> <cfset thefile = dest & upload.serverfile> <cfif isspreadsheetfile(thefile)> <cfspreadsheet action="read" src="#thefile#" query="data" headerrow="1"> <cfset showform = false> <cfelse> <cfscript> thisfile = thefile; fileread = createobject("java", "java.io.fileinputstream"); thisthread = createobject("java...

Ubuntu execute result from find command -

im bit rusty in linux , i'm starting again after 10 years. im using packer+vagrant+virtualbox provisioning , have run problem. find . -name "someexecutable" | execute/run file found i need pipe result (always 1 file) , execute it. how that? kind regards instead of using pipe may want command substitution described here: http://tldp.org/ldp/bash-beginners-guide/html/sect_03_04.html#sect_03_04_04 example: `find /bin -name "date"` this finds executable script "date" , executes immediately.

python - order of parameter for stat functions -

i have following code estimate parameters of gamma distribution, generate reall data estimated parameters , kstest: alhpa, beta, loc=gamma.fit(my_data) real_data=gamma.pdf(my_data, alpha,loc,beta) stat, pval = kstest (my_data, 'gamma',(alpha,loc)) i not sure order of parameters in fir, pdf , kstest. there references right order of parameters each function? thanks, amir according scipy documentation gamma , kstest , order of arguments are: gamma.fit(data, a, loc=0, scale=1) gamma.pdf(x, a, loc=0, scale=1) kstest(rvs, cdf, args=(), n=20, alternative='two-sided', mode='approx') you can find more detailed information parameters , usage examples in documentation linked above.

Bootstrap 2 or Bootstrap 3 how to collapse open accordion -

i building own accordion markup using bootstrap collapse does know how close open accordion when click on other? i tried //bs2 $('#top1_accordion').on('show','.collapse', function() { $('#top1_accordion').find('.collapse.in').collapse('hide'); }); //bs3 $('#top1_accordion').on('show.bs.collapse','.collapse', function() { $('#top1_accordion').find('.collapse.in').collapse('hide'); }); bootstrap 3 works on first click http://jsfiddle.net/4wsfk/1/ i got working on bootstrap 2 http://jsfiddle.net/mtkp7/26/ any appreciated! i believe fiddle should work. removed class 'collapse' find statement. i'm not sure of differences in 3.0, must've changed markup slightly. $('#top1_accordion').find('in').collapse('hide'); http://jsfiddle.net/9jzde/1/

ruby - What does *args mean? -

this question has answer here: what (unary) * operator in ruby code? 3 answers what args mean, , different between , argv if there difference? def puts_two(*args) arg1, arg2 = args puts "arg1: #{arg1}, arg2: #{arg2}" end argv special variable in ruby. contains arguments passed script on command line. example, if write following code in file called test.rb: argv.each |a| puts end and call this c:\> ruby test.rb 1 2 will display one 2 in code posted, *args indicates method accepts variable number of arguments in array called args . have been called want (following ruby naming rules, of course). so in case, args totally unrelated argv .

objective c - How to conditionally fire segue based on block-based network operation in iOS? -

i have block-based network function want allow segue commence when successful. attempt @ authentication: [user signupinbackgroundwithblock:^(bool succeeded, nserror *error) { nslog(@"in process"); if (!error) { nslog(@"succcess"); }else{ nslog(@"failure"); } }]; how can commence segue conditionally statement in viewcontroller? [self performseguewithidentifier@"yoursegueidentifierthatyousetinstoryboard"]; should trick if understand question correctly. edit 1: to fire code on main thread, wrap code that: dispatch_async(dispatch_get_main_queue(), ^{ [self performseguewithidentifier@"yoursegueidentifierthatyousetinstoryboard"]; });

python - Pylab animation multiple figures -

i want update multiple figures using pylab animation. initialize new figure each channel display , set interactive mode off using: pyplot.ion() pyplot.show() in class containing figure there's ring buffer , method update data: def append_data(self, data): update buffers data ... ... self.lineb.set_data(self.tbuf, self.bbuf) self.ax1.set_xlim( [min(self.tbuf), max(self.tbuf)] ) self.ax1.set_ylim( [min(self.bbuf), max(self.bbuf)] ) ... ... self.fig.show() pyplot.draw() the problem: more 1 figure, last 1 updates correctly. other ones not refresh. know data correctly added each figure's buffer, problem not there. i found solution following this article . i initialized figure name: fig = pyplot.figure(name) and changed lines: self.fig.show() pyplot.draw() to: pyplot.figure(name) pyplot.draw() apparently works, not sure why.

Select all by type: Geometry. Equivalent Python script? -

i trying find right code make maya select geometry objects in scene. tried echo command while doing operation , this: selectallgeometry; select -r `listtransforms -geometry`; (edit > select type > geometry) could translate python? what you're seeing procedure selectallgeometry , , contents: select -r `listtransforms -geometry`; that command several parts. part in backquotes: listtransforms -geometry is mel procedure. run command help listtransforms see path .mel file. reading that, command actually listrelatives("-p", "-path", eval("ls", $flags)); the output of argument to: select -r the_list_of_geometry_transforms so check out maya's mel , python command reference select , listrelatives , , ls , research how 1 command translates other: select listrelatives ls combining together, equivalent mel being called is: select -r `listrelatives("-p", "-path", eval("ls", $fla...

python - Disable, hide or remove close "X" button in Tkinter -

i want show gui client, don't want give possibility client close window through [x] button. how disable, hide or remove close [x] button of tkinter window? i found following answers: python tkinter “x” button control removing minimize/maximize buttons in tkinter however, these posts not answering question. want disable, hide or remove [x] button. when use protocol : def __init__(self): frame.__init__(self, bg = "black") self.protocol('wm_delete_window', self.dosomething) self.pack(expand = 1, fill = both) def dosomething(self): if showinfo.askokcancel("quit?", "are sure want quit?"): self.quit() i receive following error: self.protocol('wm_delete_window', self.dosomething) attributeerror: 'gui' object has no attribute 'protocol' the problem calling protocol method it's method on root window gui object not root window. code work if call protocol m...

How select a file from one branch when resolving conflict during git rebase? -

given git repo 2 branches master , feature . when rebasing feature branch on top of master using rebase master lets file a.txt contains conflict needs resolved before rebase can continue. i know can resolve conflict in 3 steps: open a.txt in editor manually resolve conflict call git add a.txt tell git have manually resolved conflict call git rebase --continue move rebase forward is there way avoid step 1 telling git want version of file master branch or want version of file feature branch without having steps 1 , 2 above. yes. in fact, there's more 1 way it. the rebase , merge (and cherry-pick, matter) commands take same strategy , -x flags pass underlying git merge machinery. recursive strategy, -xours , -xtheirs choose 1 or other "sides" of files in case of file modified in both branches being merged. or—this quite different—in cases when merge stops conflict , can use git checkout --ours or --theirs flags, pick version 1 side ...

php - Convert image to string without saving image -

i know there quite lots question on stack overflow don't think question same. i want convert image resource string without having save image disk. is there function that, im not aware of , did not got able find in pass hour of searching google.com you can use of image* functions output image stream , use output buffering capture it: ob_start(); // example jpeg imagejpeg($resource); $image_string = ob_get_contents(); ob_end_clean();

kendo ui - How to increase vertical offset of tooltip position? -

i'm using kendo tooltips on graphic (within anchor link) 24px tall. accordingly, when tooltip shows (default position of bottom), covers bottom third of graphic , bottom third of graphic can't clicked. i can following: .k-tooltip { margin-top: 8px; } but problem if tooltip on graphic @ bottom of page, position "top" instead of "bottom" it'll covering 1/2 graphic instead of third because it's still being pushed down 8px. what i'd if position bottom, margin-top 8px, if position top, the margin-bottom 8px. thanks can provide! billy mccafferty would 1 you? http://dojo.telerik.com/amoze/5 var tooltip = $("#demo").kendotooltip({ filter: "a", show: function (e) { var position = e.sender.options.position; if (position == "bottom") { e.sender.popup.element.css("margin-top", "10px"); } else if(position == "top") { e.sender.popu...

eclipse - Groovy Grails Tools Suit (GGTS) Maven plugin -

what fastest way install maven integration plugin in ggts 3.4.0? i see plugin not installed default in ggts 3.4.0. when search marketplace "m2e" whole lot of different plugins, of not apply, e.g. "maven integration juno". go help->install new software. press "add" button , paste " http://download.eclipse.org/technology/m2e/releases " "location" field. install plugin.

How do I create a dark Google Maps image for Google Glass? -

i need create dark/inverted map image use on google glass, since standard google static maps image bright when displayed on screen. how can customize map theme on glass? the google static maps api provides number of customization options change colors of map features. here's example of activity loads dark/inverted static map image , displays in full-screen imageview on glass. the description of query parameters used construct url can found in documentation google maps static maps api . public class staticmapactivity extends activity { private static final string tag = staticmapactivity.class.getsimplename(); private static final string static_map_url_template = "https://maps.googleapis.com/maps/api/staticmap" + "?center=%.5f,%.5f" + "&zoom=%d" + "&sensor=true" + "&size=640x360" + "&scale=1" + ...

jquery - Prepend/Append an Image only in active class by Click Function -

i know don't meet often..but i'll try describe it. i have list of links. have script makes link has been clicked active adding class it. every time link clicked, have different active link. problem every time happens, want image prepend active link. manage add image unfortunately script add image every time clicked on link , not active link. want image prepend active class link. my script is: $(function(){ var sidebar = $('#sidebar'); sidebar.delegate('a.inactive','click',function(){ sidebar.find('.active').toggleclass('active inactive'); $(this).toggleclass('active inactive'); $(this).prepend('<img class="gallery-selected-bg" src="http://www.saugeentimes.com/496%20liz/girls%20soccer%20aug%204,%202010/soccer-ball-small.jpg">'); }); }); sorry if did not describe well, can see code please... if tell simpler want 1 ball active link may changes click....

asp.net - Concurrent page processing/serving -

i've created web application has sub builds contacts list. sub fetches phone numbers , email address contacts db based on ids provided user. @ it's fastest, application process 4 ids per second. 200-300 ids @ given time, completion time long. time not problem, it's end user status updates. i've created crude web service reads "currentrecordnumber" stored in session variable app loops through ids. intend use javascript call webmethod app periodically update status. my problem when debugging, webmethod call complete successfully, not until app finished processing. this seems simple problem. must not using right terms because results seem overly complicated. i'm new asynchronous features of asp.net please forgive. have, however, written winforms incorporate multiple threads have basic understanding of threading. this due way asp.net treats session. haven't said whether using webforms or mvc, mvc has quick workaround this. firs...

How to convert Python HTTP Post to Coldfusion HTTP Post with Authentication -

how convert python http post cf http post basic authentication? there seems issue cf http post authentication. can't connect other side. what missing in cf code? from - python: import datetime import requests auth = ('huant','vk2014') url = 'https://www.mytestdomain.com' inquiry_xml = "<inquiry> <header> <source>vk</source> </header> <data> <request_date>2014-02-25t18:48:24</request_date> <name>huan</name> <total_guests>4</total_guests> <check_in>2014-02-25</check_in> <check_out>2014-03-25</check_out> <comment><![cdata[hi u please confirm there availability , location wise close sydney city centre have 2 young children. forward hearing you. thanks,john]]></comment> <property_id>201027</property_id> <email>myemail@test.com</email> <phone_number>07747484202</phone_number> <newsletter_opt_in...

java - The two Strings don't update, keep returning "?" -

this class file of whole project. i've checked everyother class , found culprit. it's supposed take in city , state parsed in class(so you're left city=dallas , state=tx example) when parameter passed through, don't update private string state , private string city. i keep getting ?,? output tostring method public class address { private string city; private string state; public address() { city="?"; state="?"; } public string getcity() { return city; } public string getstate() { return state; } public void setstate(string s) { //system.out.println(s); state=s; //system.out.println(state); } public void setcity(string c) { city=c; } public string tostring() { string citystate=city+","+state; return citystate; } } tester class import java.io.*; import java.util.*; public class assignment4 { public static void m...

sql - List of table names ordered by their foreign key dependency in MySQL -

given mysql database, how obtain list of table names ordered foreign key dependency can delete each table? understand foreign key's stored in key_column_usage table i'm not sure if there utility method obtain table names in correct order. prefer 100% sql solution. if foreign keys follow naming convention (as should :), simple like select table_name, group_concat(distinct constraint_name order constraint_name) fk_list information_schema.key_column_usage constraint_name rlike 'fk' group table_name order fk_list, table_name; or, if foreign keys don't follow naming convention, then select table_name, group_concat(distinct constraint_name order constraint_name) fk_list information_schema.key_column_usage referenced_table_name not null group table_name order fk_list, table_name;

sql - TSQL: how to delete last record from query result if record is NULL -

background: using stored procedure below retrieve hourly time series data. select * ( select cast(localdatetime smalldatetime) [datetime], datavalue, variableid datavalues siteid = 2 , variableid in(1,3,30) ) tabledate pivot (sum(datavalue) variableid in ([1],[3],[30])) pivottable order [datetime] usually data written database @ top of hour, , stored procedure executed @ 5 minutes past hour retrieve existing values. the problem data retrieval on top of hour fails 1 of many sites , no new data written datavalues table site. however, recent hour still present in datavalues table because other sites wrote values it. results in query result has record recent hour fields null . code handles query results can deal hourly data null whatever reason except in cases last record null fields. question: there simple way remove last record of query result (once pivoted per procedure above) if fields of record null ? you can usin...

C++ Help (ISO C++ forbids comparison between pointer and integer.) -

i'm trying make simple program stacks seem getting error when try run it. error says "iso c++ forbids comparison between pointer , integer.". appreciated. my code: #include <iostream> #include <string> using namespace std; const int maxstack = 5; struct stacktype{ string name[maxstack]; int top; }; void createstack(stacktype &stack); void destroystack(stacktype &stack); bool fullstack(stacktype stack); void push(stacktype &stack, string &newelement); bool emptystack(stacktype stack); void pop(stacktype &stack, string &poppedelement); int main(){ stacktype stack; string newelement, poppedelement; char quest; createstack(stack); cout<<"do want enter data? (y/n)"; cin>>quest; while((quest == "y" || quest == "y") && !(fullstack(stack))){ //i error on line cout<<"please enter name"; cin>>newelement; ...

ruby on rails - FontAwsome font awesome not working in internet explorer 8/9/10 amazon s3 -

it seems fontawesome not working on amazon s3. i'm getting below error internet explorer @font-face failed cross-origin request. resource access restricted. i have cors configured below: <?xml version="1.0" encoding="utf-8"?> <corsconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <corsrule> <allowedorigin>*</allowedorigin> <allowedmethod>get</allowedmethod> <maxageseconds>3000</maxageseconds> <allowedheader>content-*</allowedheader> <allowedheader>host</allowedheader> </corsrule> </corsconfiguration> this seems working firefox (it had same error on before cors config) still not on ie. i thought caching issue done 2 days ago. is there other config need fix error , display icons on ie aswell? have tried setting allowedorigin http://*.yourdomain.com ? oh, , didn't using clou...

AngularJS + ASP.NET MVC - Can you use both under "/"? -

i want serve angularjs spa "/" , reason have disabled default route , using // action not 'fire' due angular's routing... routes.maproute( name: "test", url: "test", defaults: new { controller = "home", action = "test" }, namespaces: new[] { "my.webapp.controllers" } ); // index view has no layout , contains angular spa routes.maproute( name: "angularjs-spa", url: "{*catchall}", defaults: new { controller = "home", action = "index" }, namespaces: new[] { "my.webapp.controllers" } ); i using following angular app config block .config(['$routeprovider', '$httpprovider', '$locationprovider', function ($routeprovider, $httpprovider, $locationprovider) { $routeprovider.otherwise({ redirectto: '/404' }); $httpprovider.defaults.h...

ios - Category on UIImage to return a blank UIImage? -

how create uiimage context can return it? want have transparent pixels. have different method adds smaller uiimages larger one, need blank slate begin with. + (uiimage *)blankuiimageofsize:(cgsize)size { uigraphicsbeginimagecontextwithoptions(size, no, 1); ...? } the following should work: + (uiimage *)blankuiimageofsize:(cgsize)size { uigraphicsbeginimagecontextwithoptions(size, no, 1); cgcontextref ctx = uigraphicsgetcurrentcontext(); cgcontextclearrect(ctx, cgrectmake(0, 0, area.width, area.height)); uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return newimage; }

google chrome - How to make a .crx file installer? -

i have made many crx files google chrome, , wondering if there way download crx file website , have automatically installed (like chrome webstore)? there's special api google install applications , extensions inline website. however, still hosted in chrome web store. advantage user doesn't have leave website. called chrome.webstore api . nice read api itself: https://developer.chrome.com/extensions/webstore.html more inline installation : https://developers.google.com/chrome/web-store/docs/inline_installation .

php - facebook share button showing wrong picture -

{ "id": "242856279230384", "url": "http://plankingaround.com/?id=585", "type": "book", "title": "planking around photos", "image": [ { "url": "http://plankingaround.com/pics/585.jpg", "width": 400, "height": 526 } ], "site_name": "planking around photos", "admins": [ { "id": "1253531138", "name": "chuck bridges" } ], "updated_time": "2014-02-01t01:18:35+0000", "created_time": "2014-01-27t03:57:50+0000", "is_scraped": true } this facebook graph api saying "provided og:image not big enough. please use image that's @ least 200x200 px. image ' http://plankingaround.com/pics/defaultimage.jpg ' used instead." why happening? it's possible error received old l...

cocoapods - Cocoa pods setup taking forever -

trying set pod, seems taking forever. steps $ sudo gem install cocoapods 1 gem installed $ pod setup /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: insecure world writable dir /usr/local in path, mode 040777 setting cocoapods master repo ... is there problem access repository ? saw there current problem broken specs repo ( http://blog.cocoapods.org/repairing-our-broken-specs-repository/ ), should not affect new installs , i.e. pod setup right ? if want speed can following: $ sudo gem install cocoapods --no-document -v it skips out on documentation, , installs verbosely can see happening.

python - Django decorator to redirect based on user-type -

currently in django app, have 2 kind of users, usertypea , usertypeb. at point, redirect both of types /usercheck/ has function check type of user, , redirect them accordingly. working out pretty well. however, curiosity, if write decorator put ? one place can think of settings.py decorator output different login_redirect_url based on user type. it learning. current implementation working out pretty far. thanks lot. settings.py meant global static configuration data, not try dynamically changing settings. there many other places in django login url can set explicitly. i'm not entirely clear on want do, sounds user_passes_test decorator you're after. the docs : limiting access logged-in users pass test: simple way run test on request.user in view directly.... shortcut, can use convenient user_passes_test decorator.

c# - ASP.NET Web Application Deployment Methods Best Practice -

got quick question deployment methods, i use programming site in visual studios using c# asp.net , saving , building it, copying on entire contents of folder visual studio project coordinating iis folder hosting site each time make change site , need update it, there has got better more efficient way deploy web site or application visual studios update site. does have advice on deployment techniques or builtin tools in visual studios has deployment of programmed site. advice helpful. you can in publish feature of visual studio. work if it's small site , working on it. if things bigger , more complex, may want else cruisecontrol .

Spring web flow end state, want to go and edit a previous error? -

we have web flow, , @ end can tell there error processing transaction. want add functionality end of flow, natural end-state, lets user click edit button go to, say, step 2 of flow re-enter details. can done? way see make current-end state regular view-state transition state 2 on click of button, end-state makes lot of sense since want clear details of transaction. can me line thinking here? adding decision state before end state work ok. test can made see if transaction went ok, , depending on either go end state or previous view: <decision-state id="checkiftransactionok"> <if test="service.istransactionfailed()" then="previousviewstate" else="endstate" /> </decision-state>

hadoop - Azkaban - HIve Job Failed -

i trying run hive job in azkaban i able upload hive job hive job not getting executed properly. error [hive-demo] [azkaban] failed build job executor job hive-demojob type 'hive' unrecognized. not construct job[{hive.query.01: drop table words;, hive.query.03: describe words;, hive.query.02: create table words (freq int, word string) row format delimited fields terminated ' ' stored textfile;, working.dir: /home/hduser/technology/azkaban/azkaban-executor/executions/44, azk.hive.action: execute.query, azkaban.job.attempt: 0, type: hive, hive.query.05: select * words limit 10;, hive.query.04: load data local inpath "res/input" table words;, user.to.proxy: azkaban, hive.query.06: select freq, count(1) f2 words group freq sort f2 desc limit 10;, parent = {azkaban.flow.flowid: hive-demo, azkaban.flow.execid: 44, azkaban.flow.start.timezone: america/los_angeles, azkaban.flow.start.hour: 22, azkaban.flow.start.second: 17, azkaban.flow.start.year: 2...

python - Best way to automatically decode bytes -

currently using following (works in both py2 , 3) if isinstance(string, bytes): string = string.decode('utf-8') however, there better way both python 2 , 3 compatible. seems missed obvious. in python 2 simple str(string) edit: context : making library/util class accepts redis client object. object has option automatically decode responses (default off), or return plain bytes. given response object, can either bytes or str depending on how object configured the best way avoid problem in first place. use "unicode sandwich" technique - convert data strings after read it, , convert bytes when need serialize it. if this, shouldn't end object might strings or might bytes, shouldn't ever need detect whether has been decoded yet or not. if really can't reason (if third-party code hand either based on conditions don't control), next easiest thing use library six , makes easier write code works in both python 2 , python 3. among ot...