Posts

Showing posts from March, 2010

OTRS Email attachments not visible -

i've got otrs server running, functional. problem ticket attachments can viewed in web interface, , not in emails. have open ticket in browser first, before can view attached images , on. in web interface, displays fine. does have /opt/otrs/bin/otrs.articlestorageswitch.pl fs db? or there else i'm missing? thanks in advance, ben there sysconfig function this ticket -> frontend::agent::ticket::articleattachmentmodule there should 2 modules. in the framework -> core::web::attachmentdownloadtype you can select module use. this default set attachment, when set inline doesn't download attachment shows them inline.

Javascript / jQuery page change event on mobile browsers -

i designing mobile website keeping in mind leading browsers - safari, chrome, dolphin, opera. i want show "loading" element , when page navigates / changes / new page requested . i cannot use click event on anchor tags there many ones present preventdefault(); . i tried following: $(window).on('beforeunload', function() { ... }); but not work in dolphin or opera . can suggest cross-browser solution ? -- edit : realize wasn't clear in asking question, apologies. created fiddle here- http://jsfiddle.net/hiteshpachpor/7dada/5/ based on response. example makes use of event bubbling. now here's problem facing. showing loader ( $('.jacket').show(); ) each time page changes / navigates. don't want show if link clicked; want other operations on page instead. now, adding $('.jacket').hide(); line in such actions totally suffice not ideal scaling reasons. this why evaluating 'beforeunload' method, no luck there not

javascript - Uncaught ReferenceError: QRCode is not defined -

i tried implement qrcode in html-template: <div id="qrcode"> <script type="text/javascript"> new qrcode(document.getelementbyid('qrcode'), 'http://jindo.dev.naver.com/collie'); </script> </div> in qrcode.min.js have this: var qrcode = new qrcode(document.getelementbyid("qrcode"), { text: "http://jindo.dev.naver.com/collie", width: 128, height: 128, colordark : "#000000", colorlight : "#ffffff", correctlevel : qrcode.correctlevel.h }); but still error , qrcode don't show off.. here path: <script "type=text/javascript" src="qrcode.min.js"></script> solved i solved issue. the problem integrated : var qrcode = new qrcode(document.getelementbyid("qrcode"), { text: "http://jindo.dev.naver.com/collie", width: 128, height: 128, colordark : "#000000", colorlight : "#ff

c# - "/" character has been replaced with the string "%2F" in error page -

i have error page in web config i.e; <customerrors mode="off" defaultredirect="/contents/error.aspx"> </customerrors> whenever error happens re-direct error.aspx;but in error aspx if click button try redirect %2fcontents%2ferror.aspx. can me resolve.

c# - How do you pass object data into textboxes in a second form to edit? -

i relatively new c# , use getting on hurdle. have windows form along classes create call objects values entered user , add them list. take existing call , display values in different text boxes in seperate form opened when click button. have 'findcall' method finds desired call in list 'callername' , 'phonenumber' values. if call found display edit form. works fine , form opens, know code find call functioning properly. cannot wrap head around how can display values of call object in text boxes on edit form. appreciated. thanks a simple way create property on second form. allow set values on form before displaying , new values afterwards. on edit form have like... string somevalue { { return somevaluefield.text; } set { somevaluefield.text = value; } } ...where somevaluefield textbox on edit form. then in calling form can access textbox via property... var editform = new editform(); editform.somevalue = "..."; editf

c# - here my code if to navigate the files and copy if exist the files -

i'm having error please me. the error: 1 expected catch or finally the code: class program { static void main() { string sourcedir = @"c:\source";//folder directory path// try { var txtfiles = directory.enumeratefiles(sourcedir, "*.*", searchoption.alldirectories).where(s => s.endswith(".jpg") || s.endswith(".bmp") || s.endswith(".png") || s.endswith(".gif") || s.endswith("jpeg"));//identify extension name// foreach (string currentfile in txtfiles) { string filename = currentfile.substring(sourcedir.length + 1); directory.getfiles(currentfile, path.getextension(filename)); directory.getfiles(currentfile, path.getfilename(filename)); directory.getfiles(currentfile, path.getfilenamewithoutextension(filename));

Grand Total in Summary Band using Delphi Report Builder -

i have 2 variables in detail tab using delphi report builder , running totals correct. getting data 2 sets of client data sets within delphi code. now need grand total of total comes variables in details band calculate in summary band. how go doing this? declare global variable , set that? , if yes how use global variable 2 different totals? in advance. (i assume mean digital metaphor's report builder - not sure if that's bundled delphi or not...) to create grand totals: just create summary band in designer: report->summary , , put 2 dbcalc components in there. assign data fields fields want summarize grand totals. works because dbcalc component context aware - knows sort of band lives in: if it's in group footer, aggregates group, if it's in report summary section, aggregates whole report. important: consider if need summarize subtotals, or directly aggregate data in report. depending on data types , how handle rounding, truncating, etc,

javascript - Html style hidden for tables, td-s doesn't work well, just for div-s -

i hide , unhide part of html file. code use: function changevisible(colorclass, mode){ var items = document.getelementsbyclassname(colorclass); for(var i=0; < items.length; i++) { if(mode == "0") { items[i].setattribute("style",""); items[i].style.visibility = 'hidden'; } else if(mode == "1") { items[i].setattribute("style",""); items[i].style.visibility = 'visible'; <!--items[i].style.display = 'none';--> } } } the part select hideable parts: function geturlparameters(variable, element){ var query = window.location.search.substring(1); var vars = query.split("&"); (va

grails - How do I get the controller and action from which a button was clicked? -

i working on project in there "add person" button appears on multiple pages redirects controller/view lets user fill out required fields , add new person database. however, stumped on how make redirect view called once new person has been added. if possible, retain user input existed on calling view when add person button clicked. here code adds person. i need @ end of code. redirect(controller: 'callingcontroller', action: 'callingaction') any help? you need form <g:form url="[resource:person, action:'addperson']" method="get" > <label for="personname"> <span class="required-indicator">*</span> </label> <g:field name="personname" value="" required=""/> <!-- put here fields details above--> <fieldset class="buttons"> <g:actionsubmit class="save" action="addperson" value

c# - Exception while setting DataContext -

i have created custom usercontrol exposes dependencyproperties headertitle , headertitleforeground public partial class pageheadercontrol : usercontrol { public string headertitle { { return (string)getvalue(headertitleproperty); } set { setvalue(headertitleproperty, value); } } public static readonly dependencyproperty headertitleproperty = dependencyproperty.register("headertitle", typeof(string), typeof(pageheadercontrol), new propertymetadata("")); public string headertitleforeground { { return (string)getvalue(headertitleforegroundproperty); } set { setvalue(headertitleforegroundproperty, value); } } public static readonly dependencyproperty headertitleforegroundproperty = dependencyproperty.register("headertitleforeground", typeof(string), typeof(pageheadercontrol), new propertymetadata("")); public pageheadercontrol() { initializecomponent();

python - How do I append tuples together? -

i'm trying put multiple tuples not know how. know how create tuple, i'm not quite sure how put them together. want keep on appending (not appending because don't want list). i'm pulling string out of each line , putting of tuples x = (132, 534, 4) y = (345, 531, 1) z = (212, 421, 5) what want returned (132, 534, 4), (345, 531, 1), (212, 421, 5) the tuple in example can created this: >>> # following line equivalent to: new_tuple = (x, y, z) >>> new_tuple = x, y, z >>> new_tuple ((132, 534, 4), (345, 531, 1), (212, 421, 5)) >>> however, because tuples immutable (cannot changed after creation) sequences, need create new 1 each time want "append" it: >>> new_tuple = x, y, z >>> new_tuple ((132, 534, 4), (345, 531, 1), (212, 421, 5)) >>> w = 1, 2, 3 # tuple needs go inside new_tuple >>> new_tuple = x, y, z, w # so, have rebuild new_tuple include >>> new_

php - Uncaught SyntaxError Unexpected Number JSON.parse -

trying json data through ajax request, error : uncaught syntaxerror unexpected number here js code : var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>'; $.ajax({ url: ajaxurl, type: 'post', datatype: 'json', data: { action : 'getpills' }, success: function(data){ product = json.parse(data); console.log(product); }, error: function(jqxhr, textstatus, errorthrown) { console.log(textstatus, errorthrown); } }); here php code : add_action('wp_ajax_getpills', 'getpills'); add_action('wp_ajax_nopriv_getpills', 'getpills'); function getpills(){ $data = array( "test" => 'test' ); error_log(json_encode($data), 0); echo json_encode($data); } called error_log see json data trying receive: {"test":"test&quo

php - Image upload/receive API -

i'd offer simple api on website allows people upload images (and receive url access it). but have several questions: would better if user have send image in binary code or better if user have send in idk ascii or so? conventional way? (i'm asking because can imagine languages have functions read files textfiles.) where store images on server , how? can put them in mysql database , perform well? or should put them in 1 folder? how should user able specify file type? in header or in body? how receive , data save file? i found code somewhere else: <?php /* put data comes in on stdin stream */ $putdata = fopen("php://input", "r"); /* open file writing */ $fp = fopen("myputfile.ext", "w"); /* read data 1 kb @ time , write file */ while ($data = fread($putdata, 1024)) fwrite($fp, $data); /* close streams */ fclose($fp); fclose($putdata); ?> does work binary files images? idea "read data 1 kb @ time&

javascript - Bgcolor not working in while loop -

although know bgcolor not best thing use change web page's color dynamically, css route not appear allow numbers bgcolor (unless mistaken). code follows: <!doctype html> <html> <head> <title>title</title> <script> while(1===1){ confirm("you click this";) document.write("<h1>hello</h1>"); document.bgcolor = bgcolor; } </script> </head> <body></body> </html> i know code in infinite loop. can try document.body.style.background instead of document.bgcolor? also, have ask, why need infinite loop there?

php - Is there an alternative for file_get_contents? -

i tried getting 1 character file comments.txt i want random lines 1 one .. file_get_contents disabled urlencode $f_contents = file_get_contents("comments.txt"); $line = $f_contents[array_rand($f_contents)]; $messages = $line; $messages = urlencode($messages); you can simplify .. <?php $arr = file('comments.txt',file_ignore_new_lines); shuffle($arr); foreach($arr $v) { echo $v."<br>"; } the above code prints random lines text file 1 one.

r - Using dplyr to make sample from data frame -

i have large data frame (150.000.000 rows) format this: df = data.frame(pnr = rep(500+2*(1:15),each=3), x = runif(3*15)) pnr person id , x data. sample 10% of persons. there fast way in dplyr? the following solution, slow because of merge-statement prns = as.data.frame(unique(df$prn)) names(prns)[1] = "prn" prns$s = rbinom(nrow(prns),1,0.1) df = merge(df,prns) df2 = df[df$s==1,] i suggest "data.table" package on "dplyr" this. here's example big-ish sample data (not smaller own 15 million rows). i'll show right , wrong ways things :-) here's sample data. library(data.table) library(dplyr) library(microbenchmark) set.seed(1) mydf <- dt <- data.frame(person = sample(10000, 1e7, true), value = runif(1e7)) we'll create "data.table" , set key "person". creating "data.table" takes no significant time, setting key can. system.time(setdt(dt)) # user system ela

parsing - Java SimpleDateFormat parse Timezone like America/Los_Angeles -

i want parse following string in java , convert date: dtstart;tzid=america/los_angeles:20140423t120000 i tried this: simpledateformat sdf = new simpledateformat("'dtstart;tzid='z':'yyyymmdd't'hhmmss"); date start = sdf.parse("dtstart;tzid=america/los_angeles:20140423t120000"); and this: simpledateformat sdf = new simpledateformat("'dtstart;tzid='z':'yyyymmdd't'hhmmss"); date start = sdf.parse("dtstart;tzid=america/los_angeles:20140423t120000"); but still doesn't work. think problem in america/los_angeles. can me please? thank you try 1 using timezone . note: have split date string before doing operation. simpledateformat sdf = new simpledateformat("yyyymmdd't'hhmmss"); timezone tz = timezone.gettimezone("america/los_angeles"); sdf.settimezone(tz); date start = sdf.parse("20140423t120000"); in simpledatefor

wix - How can I use bind.FileVersion when harvesting using Heat? -

i've used... <?define productversion="!(bind.fileversion.mylibrary.dll)" ?> ... define version variable use in installers. first time i'm using heat.exe harvest files/folders need in installer (which includes mylibrary.dll) file called source.wxs. if try build installer following error: unresolved bind-time variable !(bind.fileversion.mylibrary.dll) it's product.wxs file productversion declared can't see source.wxs file has details of mylibrary.dll, know isn't true since if set productversion="1.0.0.0" installer builds , files installed correctly. how can bind.fileversion 'see' mylibrary.dll? edit i can work if use non-human friendly file id source.wxs (see below), best solution? <?define productversion="!(bind.fileversion.fil023e197261ed7268770dde64994c4a55)" ?> you can edit output generated heat using xsl. way can transform id fil023e197261ed7268770dde64994c4a55 more readable ca

java - Maven Test Scope -

if have 1 project of mine myproject1 has following depenedencies: <!-- logging --> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.6</version> </dependency> <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-core</artifactid> <version>1.1.1</version> <scope>test</scope> </dependency> <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-classic</artifactid> <version>1.1.1</version> <scope>test</scope> </dependency> and include myproject1 in myproject2 so: <dependency> <groupid>com.mydomain</groupid> <artifactid

vba - logical error/for loop not functioning within conditional statement -

Image
edit i realize code run every time button either checked or un-checked. need way may array values equal values column f when box first checked, , stay put, then, if box unchecked, need array values first instance of code being run printed (now empty) column f. possible? perhaps sort of global array variable? i have bit of vba code wrote, myself, of , lot of research. code attached check box button in excel sheet. when excel check-box button checked, 3 columns deleted. when button un-checked, columns put back. 2 of columns simple columns contain functions. these , g. have 2 for loops in code print these functions , set numberformat of columns general run automatically. these both work great. the problem is, need save values in column f array before column deleted. if check box unselected (after being selected once- can't undo something has never been done @ least once) want print values array1 (the variable names work in progress) column f. that part isn't worki

cocoa - core data object insert in loop causes problems with NSNumber* property on object novel in inner-loop -

i have loop has degrading performance proceeds (the first loop might 3 seconds, last might 400 on 500 iterations). i've narrowed down 1 line of code . . . attaching unique nsnumber value core data object. catalog size typically 20k-150k. here excerpt runs in outer loop. outer loop gets slower , slower each time due 1 line of code: for(int = 0 ; < 500 ; i++){ nsstring *key = @"somerandomstring" ; nsnumber* sampleidnumber = [nsnumber numberwithint:13] ; (it = catalog.begin(); != catalog.end(); it++) { // it->second->id changes each time in inner-loop nsnumber* tagnumber = [nsnumber numberwithint:it->second->id]; datummo *newdatummo = [nsentitydescription insertnewobjectforentityforname:@"datum" inmanagedobjectcontext:moc]; // **tagnumber changes each inner loop** // **each time outer loop calculated gets slower** // **this not happen if tagnumber constant** newdatummo.tagid = tagnumber ; newdatum

javascript - Google Maps for AngularJS does not work with any Angular directives related to "HIDE" and "SHOW" -

Image
the angularjs google maps library not work once ng-hide or ng-show used, once 1 of 2 display functions called, happens map: this can fixed when resize browser window, there hack that'll similar window resizing fix graphical issue javascript? without hack angularjs google maps library defeats purpose of single page applications. in stackoverflow issue this, solution add ng-cloak directive map tag: <map ng-cloak zoom="10" style="visibility:hidden; z-index:1000; width:900px; height:300px; display:inline-block;" width="1600" height="1600"/> but i've tried , absolutely nothing. maybe $rootscope.map.width = z; ??? how replicate window resizing fix instantly using javascript? or guess better question how can library work despite fact it's broken. this angular library not work unless issue patched , temporary hack used in place counter graphical bug. try using data-ng-if instead of ng-hide or ng-show.

android - Google Tag Manager hits not visible in Google Analytics -

i'm implementing google analytics v4 in android app through gtm. container , code configured according instructions found here https://developers.google.com/tag-manager/android/v4/ . i'm getting logs indicate events being matched rule , fired, don't data in google analytics. logs this: 04-23 22:01:35.966 v/googletagmanager(22149): puthit called 04-23 22:01:35.966 v/googletagmanager(22149): sending hit store path: https: params: ul=en-gb, ev=value, el=label, t=event, cd=mainactivity, .... 04-23 22:01:36.026 v/googletagmanager(22149): puthit called please give advice... can give 1 example of log looks /googletagmanager(22149): sending hit store path: https: params: ul=en-gb, ev=value, el=label, t=event, cd=mainactivity, ? the hits may appear in reports after delay. can make sure realtime reports not show activity?

python - User interface optimization when using pack -

Image
i have code, creates ui this. i want page up/down buttons next page 1 label couldn't managed that. way know pack side option , not working well. second thing is, scrollbar should in listbox. know, need create canvas frame in it. embed both listbox , scrollbar them couldn't either. this code. class interface(tk.frame): def __init__(self,den): self.pa_nu = 0 ##page number. both used in labeling , result slicing self.lbl1 = tk.label(den, text="keyword") self.lbl2 = tk.label(den, text="page %d" %(self.pa_nu+1)) self.ent1 = tk.entry(den, takefocus=true) self.btn1 = tk.button(den, text="search", command=self.button1) self.btn2 = tk.button(den, text="page up", command=self.page_up) self.btn3 = tk.button(den, text="page down", command=self.page_down) scrollbar = tk.scrollbar(den) scrollbar.pack(side=right, fill=y) self.lst1 = tk.listbox(

c - libssh2: What to do with unsolicited data from the ssh server? -

i have program uses libssh2 administrate linux boxes. it's straightforward: connects linux boxes, downloads config file, keeps libssh2 connection open (and idle) if user presses buttons on gui can send appropriate shell commands linux boxes necessary. it uses non-blocking i/o (via libssh2_session_set_blocking(session, 0)) network i/o can handled single thread without session a's activity being held off session b blocking on read or write, etc. this works fine. because there strange problem occurs when program connected many (i.e. several dozen) boxes @ once. happens sessions connect usual, , config files downloaded successfully, , connections idle, expected. on few of sessions, few milliseconds after download completes (i.e. after i've libssh2_channel_read()'d config file bytes, , after libssh2_channel_close() has succeeded), additional bytes of data (usually 104 or 140) appear on session's tcp socket, ready read me , passed libssh2. at point have pro

vb.net - Adding Selected Item in a Listbox to a Label in Visual Basic -

in program i'm writing i'm stuck on 1 of last steps display employee's name , salary selected listbox in labels (one name , 1 salary), cannot figure out how this. employee's names , salaries read in file , placed in corresponding listboxes on 3 different forms (two list names, , 1 lists salaries). on last form, user supposed select name of 1 of employees , person's name supposed appear in 1 label (lblname) , salary supposed appear in label (lblsalary). names listed in selectable listbox, when click on 1 of them nothing happens. here code have far on main form: option strict on imports system.io public class main private sub open_click(sender object, e eventargs) handles open.click dim open new openfiledialog open.filter = "text files |*.txt|all files|*.*" open.initialdirectory = environment.getfolderpath(environment.specialfolder.desktopdirectory) if open.showdialog() = windows.forms.dialogresult.ok dim selectedfilename s

exclude specific fields in flask-admin's create/edit forms -

i have fields in models want exclude modelview . reference https://flask-admin.readthedocs.org/en/latest/api/mod_model/ , attempted exclude specific fields using form_exclude_columns , e.g. class userview(modelview): form_exclude_columns = ('created', 'modified') but doesn't seem work. how can exclude these 2 fields in create , edit modelview pages? the attribute should named form_excluded_columns . forgot 'd'. class userview(modelview): form_excluded_columns = ('created', 'modified')

Understanding parameters in Haskell -

i new haskell , trying call function got from: http://www.haskell.org/haskellwiki/functional_differentiation derive :: (fractional a) => -> (a -> a) -> (a -> a) derive h f x = (f (x+h) - f x) / h i having trouble understanding parameters of method , h f x correspond to. from understand: h fractional f function takes in fractional , returns fractional x ?? come from? however when type in ghci: prelude> let derive h f x = (f (x+h) - f x) / h prelude> :t derive derive :: fractional => -> (a -> a) -> -> prelude> i different type out of it. what going on? kind of currying? it indeed currying. (fractional a) => -> (a -> a) -> (a -> a) , fractional => -> (a -> a) -> -> a same type because -> right associative. take add x y = x + y . type int -> int -> int ~ int -> (int -> int) . add 5 function takes int , adds 5 it. the reason 1 might write first form may put emp

javascript - Calculate map polygon Width and Height -

let's have map: <map name="diffmap1" id="diffmap1" class="mymap"> <area shape="poly" coords="152,347,253,292,264,307,167,358" class="diff diff1"> <area shape="poly" coords="93,244,164,215,171,233,97,264" class="diff diff2"> </map> and jquery: $('.diff').click(function(e){ //code here }); how can calculate maximum height , width of each polygon? here html code: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <img src="planets.gif" width="145" height="126" alt="planets" usemap="#diffmap1"> <map name="diffmap1" id="diffmap1" class="mymap"> <area id="area1" shape="poly" coords="152,347,253,292,264,307,167,358" class="diff diff1"> <area id="are

GIT stashed date -

given following stash content: $ git stash list stash@{0}: on fixes: animations-fixes stash@{1}: wip on master: 62aecaa merge pull request #10 source/branch-name is there way have same list, including date on stash created? a stash entry regular git commit internally. can read date ("commit date" or "author date") know when created. as mentioned in manpage of git stash , can use formatting options git log when invoking git stash list . date, use git log 's option --format : git stash list --format="%gd: %ci - %gs" this produces output like: stash@{0}: 2014-04-23 11:36:39 +0500 - wip on master: d072412 stuff that format uses %ci , prints committer date in iso 8601 format. use %cr relative dates: stash@{0}: 8 minutes ago - wip on master: d072412 stuff see the manpage of git log (section "pretty formats") more formatting options.

WiX Burn failing to run on TeamCity build server -

i have installer uses burn, , have no problem building installer on (64-bit) dev machine. on our (64-bit) build server, error: [step 1/3] 2014-04-24 10:40:09,800 [2796] warn jetbrains.container.log4netdefaultloggerinitializer - unhandled exception in current domain: system.badimageformatexception: not load file or assembly 'file:///c:\program files (x86)\wix toolset v3.8\bin\heat.exe' or 1 of dependencies. attempt made load program incorrect format. from incorrect format warning clear have x86/x64 clash going on, where? projects in solution installer set cpu , build parameters in teamcity build x64. installer project set x86 , think problem. i've tried setting installer x64, errors one: this 64bitcomponent myapppool uses 32bitdirectory installlocation i think teamcity trying run x86 burn.exe x64 (since that's how i've configured build) hence problem, what's solution? need build x64, setting build x86 isn't option. since underlying mode

string - Python Text Based Map -

when comes graphics, programming skills have never been great resort using text in games or programs. wondering if knew how take different values list , print out in game map display grid of text sort of game 1980's: http://en.wikipedia.org/wiki/star_trek_(text_game) idea player can input 'left', 'right', 'up', , 'down' move symbol around. need redraw map after every action. wondering if knew way clear text in python shell or dos window (depending on preferred method of running programs) appear map isn't being redrawn on , on again. sorry lot ask. appreciate answer. use package curses 'direct' access text-screen. have absolute positioning, colors, scrolling , of cause clearing.

php - Problems with HHVM and shell_exec -

i error while using shell_exec() within php script executed hhvm: warning: unable execute '/usr/bin/svn update /daniele/myproject' in /daniele/myproject/controllers/evolution.php on line 122 the script returns warning if executed root privileges. know if there problem shell_exec() in hhvm? thanks! i have experienced similar issue times hhvm 2.2.0. wasn't able reproduce sudo su -s /bin/bash hhvm , gone after hhvm service restart, looks kind of leak. haven't noticed such errors (yet?) after migrating hhvm 3.1.0 few weeks ago.

java - Skipping validation phase but need to update model values -

This summary is not available. Please click here to view the post.

python - Fill memcached with compressed data, serve directly from nginx -

in python generate complex static pages. put them memcached next time they're requested, can served directly nginx (without hitting python @ all) this worked great until realized how inefficient store uncompressed html in nginx. tried manually gzip data before storing it, , nginx return directly (just setting content-encoding:gzip), although nginx's documentation suggests it's possible, haven't been able work. in test, had python fill cache data gzip in python via npe's answer @ how gzip compress string in python? . set memcached flag these 1. with no other changes, @ point, nginx serves raw data, gets displayed junk in browser. after that, changed nginx settings location, setting memcached_gzip_flag field 1 nginx know data gzipped, nginx still served raw data. i've experimented every combination of nginx's settings: gzip on , memcached_gzip_flag 1 in cases browser displays raw data (after first direct python hit); in cases firebug report

java - RESTful web service life cycle is *always* per request? -

in beginning java ee 7 antonio goncalves written: in section writing restful web services -> life cycle , callback : thus, life cycle of restful web service per request service not have worry concurrency , can use instance variables safely. yet couple lines later writes: remember restful web service can annotated @stateless or @singleton benefit services of session beans. so it? lifecycle per request or can session too? in addition that, if life cycle session, how handle @context annotation when injecting httpheaders attribute? headers vary during session, attribute updated after each request? according jax-rs specification, every implementation (like jersey) must support per-request behaviour: 3.1.1 lifecycle , environment by default new resource class instance created each request resource. first constructor (see section 3.1.2) called, requested dependencies injected (see section 3.2), appropriate method (see section 3.3) in

yaml - Using Similar "suites" in Test Kitchen for Code Reuse? -

how can re-use of attributes section, except maven suites: - name: dev attributes: 'ant': &ant 'version': '1.9.3' 'home': '/my/path/ant' 'maven': 'version': 3 'm2_home': '/my/path/maven' '3': 'version': '3.2.1' 'maven_rc': 'opts': '' for testing instance, inherit of above attributes, except maven , i'd override (different version): - name: testing attributes: <<: *ant # re-use ant it's same configuration 'maven': # different version testing 'version': 3 'm2_home': '/my/path/maven' '3': 'version': '3.0.5' 'maven_rc':

ruby on rails - How do I only display a specific layout for Controller X -

let's want display specific layout when i'm on home page. home page's controller , action home#index . how display different layout business#new ? there couple of options: option 1 - specific layout @ controller level just create layout file named business.html.erb in app/views/layouts , automatically picked rendering views of businesscontroller option 2 - custom layout name @ controller level create layout file named my_custom_name.html.erb in app/views/layouts , in controller specify as: class businesscontroller < applicationcontroller layout "my_custom_name" #... end my_custom_name layout used views corresponding businesscontroller . option 3 - layout particular action in controller create layout file named layout_name.html.erb in app/views/layouts , in controller specify as: class businesscontroller < applicationcontroller def new # ... render :layout => "layout_name" end end i

c# - How to implement an MVC Model that doesn't link directly to a database -

i trying implement view displays information database has been modified before displaying. example, trying add markup labor , hardware costs give final price. problem can't use foreach loop display in view because list , , having trouble declaring ienumerable because won't let me use add() function. here model, namespace myname.models{ using system; using system.collections.generic; public partial class pricing { public list<int> id { get; set; } public list<string> manufac { get; set; } public list<string> model { get; set; } public list<string> service { get; set; } public list<string> type { get; set; } public list<int> price { get; set; } } here index method in controller, private wtentities db = new wtentities(); // get: /jobinformation/ [authorize(roles = "employee")] public actionresult index() { pricing prices = new pricing(); prices.id = new list<

c++ - fatal error: Eigen/Dense: No such file or directory -

i have installed libeigen3-dev in order compile programs using eigen 3. when include file, such eigen/dense error when try run g++ : user@office-debian:~/documents/prog$ g++ src/main.cpp -mmd -std=c++11 in file included src/main.cpp:9:0: src/tdefs.h:16:23: fatal error: eigen/dense: no such file or directory compilation terminated. running following line works fine: g++ -i /usr/include/eigen3/ src/main.cpp -mmd -std=c++11 shouldn't include directory automatically found gcc because installed eigen package through aptitude? why boost , opengl found automatically when install libraries not eigen? (note eigen header-only library, shouldn't matter right?) running g++ src/main.cpp -mmd -std=c++11 --verbose produces following output: using built-in specs. collect_gcc=g++ collect_lto_wrapper=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper target: x86_64-linux-gnu configured with: ../src/configure -v --with-pkgversion='debian 4.7.2-5' --with-bugurl=file:///us

java - Cannot find symbol - method -

having hard time calling method in main. keeps saying cannot find symbol - method addsales(double) i doing project programming because learnt inheritance , has 3 super classes , 3 sub classes. having problem 1 sub , super class. named hourly , commission. commission extends hourly. feel have written method called addsales correctly when call in main says cannot find method. missing here? appreciated. commission class: public class commission extends hourly { private double totalsales, commission; public commission(string ename, string eaddress, string ephone, string socsecnumber, double rate, double commissionrate) { super(ename, eaddress, ephone, socsecnumber, rate); totalsales = 0.0; commission = commissionrate; } public double pay() { double payment = super.pay(); payment = (payment + (commission * totalsales)); return payment; } public string tostring() { string result = super.tostring(); result += "total sales: " + totalsales;

sql - Get top three records from duplicate records having unique identity -

i'm using sql server 2008 r2. have table in management studio work . want top 3 records each employee in table. table has primary key workid , foreign key employeeid . table sorted descending date. don’t need joins other tables. specific top 3 records current employeeid . here example query. select wtop.workid, wtop.employeeid work wtop wtop.employeeid in (select top 3 wsub.employeeid work wsub wsub.employeeid = wtop.employeeid order wsub.employeeid) how using row_number . something like ;with workvals ( select *, row_number() over(partition employeeid order [date] desc) rowid work ) select * workvals rowid <= 3

straight line detection in android -

Image
i have image like: and image: i have taken image of laser line. aim check if image contains straight line of laser.if image contains straight line give message "straight line found" else "straight line not found". want in android. input image sd card , output message. provided 1stimage should give message "straight line found" , 2nd image should give message "straight line not found" . tried cant reach goal: int iwidth2 = bmp.getwidth(); for(int i=0;i<bmp.getheight();i++) { int found=0; for(int j=0;j<bmp.getwidth();j++) { if(pixels[(i*iwidth2)+j]==color.red) { found++; } } if(((found*100)/bmp.getwidth())>80) { toast.maketext(getapplicationcontext(), " straight ", toast.length_short).s

html - Align div to a table column -

i've spent days trying find solution of problem. i align or specific column of table. for example my sample : <table border="1" > <tr> <td>1.1</td> <td>1.2</td> <td>1.3</td> </tr> <tr> <td>2.1</td> <td>2.2</td> <td>2.3</td> </tr> </table> <div>test</div> i align test below 2.2 cell. i'm using jquery. do have ideas ? you can try following fiddle $(document).ready(function(){ var position = $("#test").position(); $("div").css({ "left": position.left }); });

ios - UITextView custom UIDataDetectorTypes -

i have read lot of posts yet, didn't result. to, example, have uidetectortype hashtags in uitextview . isn't there way subclass accomplish this? seems odd of apple have these detector types , no customization(as have twitter-keyboard in sdk). is there approach laying buttons on text it's necessary? you can set tintcolor of uitextview. affects link color cursor line , selected text color.

Idea Intellij include non-menu actions by default -

Image
is there way ensure include non-menu actions checkbox in run actions window turned on default? i'm quite tired of having press Сtrl + shift + a twice run maven build (a non-menu action)! there not. best best record simple macro (edit > macros) , record ctrl + shift + a twice. give name , map different shortcut in settings > keymap if wanted move ctrl + shift + a mapping macro, in theory should record "action:findmacro" step followed alt + n select checkbox using n accelerator. bug surfaced when did that. when macro runs, "open tasks" dialog opens mapped alt + shift + n . appears when macro interpreter sees uppercase n, adds shift key playback. went in , manually edited 'n' 'n' , resolved issue. (i reported bug via idea-124492 ). after working through that, issue surfaced. alt + n sequence getting sent quickly. needed pause between ''open find action dialog''. since unaware of way add pause in rec