Posts

Showing posts from September, 2015

ios - How do I set Content-type using Bubblewrap HTTP? -

ios - How do I set Content-type using Bubblewrap HTTP? - i'm trying post request content-type: application/x-www-form-urlencoded. when view request charles (or fiddler) says application/json. http.post(url, { :headers => {"content-type" => "application/x-www-form-urlencoded"} }) |response| puts response puts response.body.to_str end bw::http.post("http://foo.bar.com/", {payload: data, headers: {"content-type": "application/x-www-form-urlencoded"} }) |response| ios ruby http-headers rubymotion

html - css, float alternative -

html - css, float alternative - in web app have toolbar, it's div: the div has 3 spans. contents of 3 spans filled later. and size of individual spans differ every time. <div> <span id="ab1" style="display: inline-block;"></span> <span id="ab2" style="display: inline-block;"></span> <span id="ab3" style="display: inline-block;"></span> </div> now, want, span "ab1" should placed on left, "ab2" , "ab3" on right side on div. is possibe without float right/left? use position:absolute , text-align:right css div{background:red; text-align:right; position:relative} #ab1{ position:absolute; left:0; background:yellow;} #ab2{background:yellow; } #ab3{background:yellow; } demo html css

c# - list property inside of a struct -

c# - list property inside of a struct - how write property list within of struct? my code: public struct config { list<int> ipaddress = new list<int>(); } if want create auto-property (which default null reference types , cannot initialized) can @scartag suggests. public struct config { // default null list<int> ipaddress {get; set;} } however, if you're trying what's in code , initialize actual reference, run issues because can't initialize fields in struct . can have defaults. create matters worse, can't override default constructor you. generally speaking, struct tends best small, preferably immutable types. there reason don't want utilize class this? now, if did want create struct "initialized" field, can fool lazy logic: public struct config { private list<int> _ipaddress; private bool _isassigned; public list<int> { { if ...

perl - How to pass environment variable to an AutoLoaded mod_perl handler, to be used at module load time? -

perl - How to pass environment variable to an AutoLoaded mod_perl handler, to be used at module load time? - i have http request handler mod_perl needs read environment variable, %env , @ module load time. environment variable passed apache config mod_perl using perlsetenv directive. this worked fine, until changed apache configuration autoload handler @ startup time, performance reasons. when module autoloaded this, the perlsetenv not take effect @ module load time, , variable need available %env @ request time within handler method. is there way go on using autoload, still set environment variable in apache config available in perl's %env @ module load time? minimal example: here's stripped downwards test-case illustrate problem. the apache config without autoload enabled: perlswitches -i/home/day/modperl <location /perl> sethandler modperl perlsetenv test_perlsetenv 'does work?' perlresponsehandler modperl::test allow ...

c# - Get angle of rotation after rotating a view -

c# - Get angle of rotation after rotating a view - let's rotate view using next method: cgaffinetransform t = cgaffinetransform.makeidentity(); t.rotate (angle); cgaffinetransform transforms = t; view.transform = transforms; how can current rotation angle of view without keeping track of set in angle variable when did cgaffinetransform? related view.transform.xx/view.transform.xy values? not sure these xx , xy , other similar members mean exactly, guess* won't able trace applied transformations using solely values (it tracing 1+2+3+4 knowing started off 1 , ended 10 - i think*). in case suggestion derive cgaffinetransform , store desired values, since it's construction cannot that, in sentiment best selection write wrapper class, so: class mytransform { //wrapped transform construction private cgaffinetransform transform; //stored info rotation public float rotation { get; p...

iphone - how to eliminate the blank frame while flipping over to the next view -

iphone - how to eliminate the blank frame while flipping over to the next view - i using this(afkpageflipper) to produce desired flipboard animation in application ,there 4 static html pages named 1.html,2..so on loadview - (void) loadview { [super loadview]; self.view.autoresizessubviews = yes; self.view.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; flipper = [[afkpageflipper alloc] initwithframe:self.view.bounds] ; flipper.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; nsurlrequest *urlreq=[nsurlrequest requestwithurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"1" oftype:@"html"]isdirectory:no]]; ; //[web loadrequest:urlreq]; nsurlrequest *urlreq1=[nsurlrequest requestwithurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] ...

matlab - Ghostscript postscript pswrite is encoding text -

matlab - Ghostscript postscript pswrite is encoding text - why ghostscript pswrite encoding text in output? consider next mwe: %!ps-adobe-3.0 %%title: mwe.ps %%pages: 001 %%boundingbox: 0 0 595 842 %%endcomments %%page: 1 1 %%pageboundingbox: 0 0 595 842 0 0 1 setrgbcolor 0 0 595 842 rectfill 1 0 0 setrgbcolor 247 371 100 100 rectfill /times-roman findfont 72 scalefont setfont newpath 247 300 moveto (chris) show showpage saving mwe file , viewing in gsview display bluish page reddish square , name underneath. run file through ghostscript 9.06 next command line: "c:\program files\gs\gs9.06\bin\gswin64c.exe" ^ -dsafer -dbatch -dnopause ^ -sdevice=pswrite -spapersize=a4 -r72 -soutputfile=mwe_gs.ps mwe.ps see ghostscript output below. can please explain happening here. whilst 2 rectfill commands still apparent, text (chris) has been encoded , no longer distinguishable. is there alternative postscript device retain text please? <snip> %%pa...

osx - Parse Issue: Expected Expression (Objective C) -

osx - Parse Issue: Expected Expression (Objective C) - for ever reason xcode has decided doesn't me... i'm getting error stated in title on line - (void)tableviewselectiondidchange:(nsnotification *)notification { nsinteger row = [_tableview selectedrow]; if (row == –1) //<---- line { return; } nsstring *selectedvoice = [_voices objectatindex:row]; [_speechsynth setvoice:selectedvoice]; nslog(@"new voice = %@", selectedvoice); } i believe has _tableview beingness befuddled because when attempted ide help me type (you know when guesses might finish word doing api lookup of available functions) doesn't show selectedrow possibility :( incase it's needed i've set .m , .h in pastebin save space on screens... fyi i'm next coca programming mac osx 4th edition chapter 6.10 in line if (row == –1) the minus-sign not real minus-sign, "en dash" (unicode u+2013). perhaps accidentally pre...

c# - Using Web API for a Windows Service to Receive Commands and Perform Tasks via Polling? -

c# - Using Web API for a Windows Service to Receive Commands and Perform Tasks via Polling? - i have project need create windows service that, when instructed via command, perform various tasks. server run on multiple servers , perform same kind of tasks when requested. for example, have web api service listens requests servers. the service running on server send query web api every 25 secs or , pass servername. web api logic servername , status updates various tasks... i.e., if status delete command 1, service delete folder containing log files... if status zip command 1, service zip folder containing log files , ftp them centralized location. this concept seems simple enough, , think need nudge tell me if sounds design. i'm thinking of using .net 4.5 windows service, can utilize httpclient object and, of course, .net 4.5 web api/mvc project. can please me started on basic web api woudld provide status updates windows services running , issue commands them... ...

c - Please Explain Comma Operator in this Program -

c - Please Explain Comma Operator in this Program - please explain me output of program: int main() { int a,b,c,d; a=10; b=20; c=a,b; d=(a,b); printf("\nc= %d",c); printf("\nd= %d",d); } the output getting is: c= 10 d= 20 my uncertainty "," operator here? compiled , ran programme using code blocks. the , operator evaluates series of expressions , returns value of last. c=a,b same (c=a),b . why c 10 c=(a,b) assign result of a,b , 20, c . as mike points out in comments, assignment ( = ) has higher precedence comma c comma

ios - Why set retain on @property for subviews? -

ios - Why set retain on @property for subviews? - fairly straightforward question in 2 parts. if view retains subviews, , create view hierarchy in interface builder views nested within others, why iboutlet property nested subviews need set retain? wouldn't assign acceptable parameter subview properties? i have uiview subclass adds few subviews upon initialization. capture references specific subviews, @property (nonatomic, assign) suffice need, correct? example, main uiview adds player score subview, later wants talk player score update it. reference needs assigned, view proper automatically retain uiview class, right? 1) doesn't need be. assign fine. made think have utilize retain ? 2) yes by way, using arc? if so, utilize weak instead of assign (please don't inquire why, explained in every corner of stack overflow , net in general). ios cocoa properties retain assign

mysql - Securepay payment received but Magento Order not created -

mysql - Securepay payment received but Magento Order not created - we have had issue securepay received payment client order not created in magento. order id skipped in magento when next order came through, cannot see in grid. can shed lite on over might have happened? you can see if order in sales_flat_order table. otherwise can enable error logging , php error happened after request payment gateway made or user didn't came response payment gateway. mysql magento

oracle - SQL Custom selection -

oracle - SQL Custom selection - i want write sql gives next result. possible? tried union works 1 record. col1 | col2 | col3 | col4 --------------------------- | 10 | | | 2 | val1 | val2 | 5 | val3 | val4 | 3 | val5 | val6 b | 11 | | | 3 | val7 | val8 | 5 | val9 | val10 | 3 | val0 | val12 here query : select a.val1, null val2, a.val3 table1 a.val1 = 'a' union select null val1, b.val2, b.val3 table2 b b.val1 = 'a' ; maybe create question more clear. imagine if run query: select a.val1, null val2, a.val3 table1 union select null val1, b.val2, b.val3 table2 b ; i want result set figure above. col1 | col2 | col3 | col4 --------------------------- | 10 | | | 2 | val1 | val2 | 5 | val3 | val4 | 3 | val5 | val6 b | 11 | | | 3 | val7 | val8 | 5 | val9 | val10 | 3 | val0 | val12 ...

php - What is the best way to sanitize user inputs? -

php - What is the best way to sanitize user inputs? - i need prevent xss attacks much possible , in centralized way don't have explicitly sanitize each input. my question improve sanitize inputs @ url/request processing level, encode/sanitize inputs before serving, or @ presentation level (output sanitization)? 1 improve , why? there 2 areas need aware: anywhere utilize input part of script in language, notably including sql. in particular case of sql, only recommended way of dealing things utilize of parameterized queries (which result in unescaped content beingness in database, strings: that's ideal). involving magic quoting of characters before substituting them straight sql string inferior (because it's easy wrong). can't done parameterized query service secured against sql-injection should never allow user specify. anywhere nowadays input output. source of input direct (including via cookie) or indirect (via database or file). in case, defa...

java - how to put a programmattic menu inside a menubar? -

java - how to put a programmattic menu inside a menubar? - i want create menu programmatically within menubar not working. this code doesn't work: class="lang-html prettyprint-override"> <p:menubar id="menubase"> <p:menu model="#{indicadormanager.indicadoresmenu}" /> <p:menuitem type="button" action="#{identity.logout}" value="logout" /> </p:menubar> this 1 does: class="lang-html prettyprint-override"> <p:menubar id="menubase" model="#{indicadormanager.indicadoresmenu}"> </p:menubar> but want button logout user, first example. can that? java jsf primefaces

replace - C# Word Document - How to clean formatting? -

replace - C# Word Document - How to clean formatting? - the dilemma rather simple. need create little app clear font background colors (leave table cell background colours unchanged), , remove text strikethrough in word document, , save document folder. otherwise document's formatting should remain untouched. below large-ish illustration scraped random examples available in google showing how apply specific kinds of formatting random strings found using find.execute(). have no clue however, on how described above. public static string searchdoc(string filenameref) { microsoft.office.interop.word._application word = new microsoft.office.interop.word.application(); ; microsoft.office.interop.word._document doc = new microsoft.office.interop.word.document(); object missing = system.type.missing; seek { system.io.fileinfo executablefileinfo = new system.io.fileinfo(system.reflection.assembly.gete...

typo3 - snowbabel extension tag displayed in frontend -

typo3 - snowbabel extension <br /> tag displayed in frontend - i've problem typo3 snowbabel extension. need insert line break in frontend. in manual, specified "if want have line break visible in front end end, you'll have insert html line break tag. i've added it. html br tag displayed in frontend.also line break not working. there configurations this? thanks, arun chandran this handy quick solution problem. can utilize <section> tags instead of " <br/> " tags. though purpose might different, still gives output. or just utilize <br></br> instead of </br> . works fine. typo3 typoscript

ruby on rails - Failing to bundle install tiny_tds on Mac OS X 10.8 with Homebrew FreeTds -

ruby on rails - Failing to bundle install tiny_tds on Mac OS X 10.8 with Homebrew FreeTds - my question surefire steps can take 100% working? need real instructions, not 1 liner answers or vague conceptual descriptions of process. let's bottom of this. appear there conflicts somewhere , i've had subpar assistance gem developer on github in relation experience ruby / rails / bundler / homebrew it's not fault :p need figure out how working asap here goes current state of problem. update: 2/25/2013 updated gcc / xcode version 4.6 (4h127) , downloaded latest version of xcode command-line tools , iconv_open() showing in extconf checker. i'm getting these errors: i believe issues tiny_tds , compatibility latest xcode paths. gem::installer::extensionbuilderror: error: failed build gem native extension. /system/library/frameworks/ruby.framework/versions/1.8/usr/bin/ruby extconf.rb checking iconv_open() in iconv.h... yes checking sybfron...

Setting Up Android Development Env requires a reinstall of Java on Mac, Why? -

Setting Up Android Development Env requires a reinstall of Java on Mac, Why? - i'm setting android development environment on macbook air running os x 10.8 mount lion. i have installed jdk mac downloading oracle website. run java -version shows java version "1.7.0_13" then downloaded adt bundle mac http://developer.android.com/sdk/index.html then ran eclipse , shows install dialog install java. says to open “eclipse,” need java se 6 runtime. install 1 now? why asking java, when installed java? and java included in path too. went wrong? jdk - java development kit jre - java runtime environment java se - java standard edition se defines set of capabilities , functionalities; there more complex editions (enterprise edition - ee) , simpler ones (mobile edition - me - mobile environments). the jdk includes compiler , other tools needed develop java applications; jre not. so, run java application else provides, need jre; develop java application...

ios6 - What is a common way to access a service that is running on an iPad from an iPhone without having internet access? -

ios6 - What is a common way to access a service that is running on an iPad from an iPhone without having internet access? - is there reference app, or best practices how set 1 ios device "server or backend service" cashier service , utilize other ios devices access service/server, iphone "electric order notebook"? i found out 3 options: - write own webserver runs on 1 device (ios devices web server) - utilize bonjour allows server-app provide services in network (https://developer.apple.com/library/mac/documentation/cocoa/conceptual/netservices/articles/about.html) - utilize gamekit allows utilize 'multiplayer' functionality non-game apps (https://developer.apple.com/library/mac/documentation/networkinginternet/conceptual/gamekit_guide/introduction/introduction.html#//apple_ref/doc/uid/tp40008304) ios6

Rails undefined method 'to_i' -

Rails undefined method 'to_i' - when user creates new worequest, want set worequest.statuscode_id first entry in statuscodes table. the next (from worequest.rb) working in rails 3.1 i've upgraded 3.2, it's not working. after_initialize :defaults def defaults self.statuscode_id ||= statuscode.first end i undefined method `to_i' #<statuscode:0x007fe934b67bd0> any thought why doesn't work now? know work? thanks! ruby-on-rails-3

python - TypeError: 'int' object does not support item assignment -

python - TypeError: 'int' object does not support item assignment - why error? a[k] = q % b typeerror: 'int' object not back upwards item assignment code: def algorithmone(n,b,a): assert(b > 1) q = n k = 0 while q != 0: a[k] = q % b q = q / b ++k homecoming k print (algorithmone(5,233,676)) print (algorithmone(11,233,676)) print (algorithmone(3,1001,94)) print (algorithmone(111,1201,121)) you're passing integer function a . seek assign as: a[k] = ... doesn't work since a scalar... it's same thing if had tried: 50[42] = 7 that statement doesn't create much sense , python yell @ same way (presumably). also, ++k isn't doing think -- it's parsed (+(+(k))) -- i.e. bytcode unary_positive twice. want k += 1 finally, careful statements like: q = q / b the parenthesis utilize print imply want utilize on python3.x @ point. but, x/y behaves di...

SQL CLR C# User Defined Function - Get house or flat number from address -

SQL CLR C# User Defined Function - Get house or flat number from address - i have next sql clr c# udf: using system; using system.data; using system.data.sqlclient; using system.data.sqltypes; using microsoft.sqlserver.server; using system.collections; using system.text; public partial class userdefinedfunctions { [microsoft.sqlserver.server.sqlfunction] public static sqlstring clrfn_getdigits(string theword) { if (theword == null) { theword = ""; } string newword = ""; char[] keeparray = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '\\', '/', '-', ' '}; foreach (char thischar in theword) { foreach (char keepchar in keeparray) { if (keepchar == thischar) { newword += thischar; } ...

livesearch - Jquery live search: fire with button? -

livesearch - Jquery live search: fire with button? - i found this fiddle functions how want on page, except need search occur when user clicks search button (which utilize help adding) or hits come in key - not while typing. here's code: //live search $('.filter-bar #search').search('.filter-results li', function(on) { on.all(function(results) { var size = results ? results.size() : 0 $('.filter-results-count').text(size + ' results'); }); on.reset(function() { $('.no-filter-results').hide(); $('.filter-results li').show(); }); on.empty(function() { $('.no-filter-results').show(); $('.filter-results li').hide(); }); on.results(function(results) { $('.no-filter-results').hide(); $('.filter-results li').hide(); results.show(); }); }); the next step making search not case sensitive , business relationship type-o's. (could utilize quick silver o...

javascript - js form update while typing -

javascript - js form update while typing - i can update form using js, when user hits come in after on html form or when onclick "submit" button, want update form while user typing something. i know can infinity loop yet not thought or can check after intervals cause unnecessary checking don't want. use keyup event handler input field contained within form. references: javascript, jquery [update] you missed round brackets @ function definition, check updated fiddle javascript html

ruby - Add method to base class in the context of module -

ruby - Add method to base class in the context of module - i want add together custom method string class in ruby. aware can done next code: class string def my_own_method # impelementation comes here end end if write code in file "string.rb" , somewhere else i.e. in irb, write require "string" works quite fine , have access custom method on string object. however, problem arises when want bundle custom code module this: module class string def my_own_method # implementation end end end then when include module (with no error), don't have access method on each string object unless instantiate straight string calling, say, s = a::string.new . in case have access custom method s variable not on string object. shall both bundle util classes , automatically add together methods base of operations classes? help appreciated. one alternative utilize :: ensure grabbing top-level string class: module cla...

Trying to understand C# and XML Spreadsheets in ASP.net -

Trying to understand C# and XML Spreadsheets in ASP.net - i'm building web application give users same info see on table on current page, in excel spreadsheet format. found previous code in project did same thing. small question first: know how column ss:width works? it's not exact match. column ss:autofitwidth="0" ss:width="114" returns column width of 21.00... where i'm having of problem is, of info passed spreadsheet has leading , tailing whitespace; have no thought how remove it. i've tried .trim() when create .tostring() query , i've been looking other methods, haven't seemed find it. next snippet of worksheet code: <worksheet ss:name="usermgmt1"> <table> @*name*@ <column ss:autofitwidth="0" ss:width="114" /> <row> <cell ss:styleid="s29"> <data ss:type=...

implementation - Does anyone actually know how the order of a set is decided in Python? -

implementation - Does anyone actually know how the order of a set is decided in Python? - this question has reply here: 'order' of unordered python sets 4 answers there seem consistency in calling set() on string seems resolve same (non-alabetical) order, , both class="lang-python prettyprint-override"> set([1,2,3]) & set([1,2,3,4]) and jumbled cousin class="lang-python prettyprint-override"> set([2,3,1]) & set([4,3,1,2]) will result in orderly-looking set([1,2,3]) . on other hand, bit more racy, such as class="lang-python prettyprint-override"> from random import randint set([randint(0,9) x in range(3)]) will give set([9, 6, 7]) ... ... going on here? you should consider sets unordered collections they stored in hash table. additionally, go on add together elements, hash shif...

open source - Getting C++ experience -

open source - Getting C++ experience - how suppose c++ experience? i've been reading thinking in c++ (almost of it) , of c++ programming language , experience in c++ can have mention in resume (i'm pupil in 1st year). i sorry if question has been asked mentioned open-source projects find them hard join. bunch of source code , no ideea start from... should first read more books on (i've found c++ recommended books topic on stackoverflow) ? , do after? what internships? your college education give wealth of knowledge , experience draw on won't give context of when , should apply knowledge. working on actual project accelerate learning great deal. some people have drive think potential project , set aside time work on regularly. sense coming project hard part. internship great way experience applying craft, come project , may net few bucks coffee fund! when comes learning basics, c++ books do. don't see lot of value in reading 10 varieties ...

android - The original file 'AndroidManifest.xml' has been deleted or is not accessible -

android - The original file 'AndroidManifest.xml' has been deleted or is not accessible - well. have imported project eclipse , whenever save xml file, popup comes up, "the original file '*.xml' has been deleted or not accessible." have cleaned , fixed project several times no use. anyone solved issue? try restarting eclipse. had same error message didn't special import project - i've restarted eclipse , it's working, now. android android-manifest

maven - Trouble producing cobertura coverage -

maven - Trouble producing cobertura coverage - my code contains tests , tests run fine upon mvn clean install i have included cobertura prlugin in order produce reports as <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>cobertura-maven-plugin</artifactid> <version>2.5.1</version> <configuration> <formats> <format>xml</format> <format>html</format> </formats> <check/> </configuration> <executions> <execution> <phase>clean</phase> <goals> <goal>cobertura</goal> </goals> </ex...

android - Eclipse, PyDev, and Kivy -

android - Eclipse, PyDev, and Kivy - i have installed eclipse, pydev, , kivy , setup first project main.py file using instructions found here: http://www.ocularsoftware.com/2012/11/how-to-use-pydev-to-develop-and-run-kivy-applications-on-windows/ but i'm stuck on how create hello world android app , install on android emulator. do need import part of android sdk? missing anything? don't know set in main.py except print("hello, world!") edit: ok figured out how run in test window, still can't run in android virtual device. here new code: from kivy.app import app kivy.uix.button import button class testapp(app): def build(self): homecoming button(text='hello world') if __name__ in ('__main__', '__android__'): testapp().run() thanks the tutorial linked not have android. the title is: how utilize pydev develop , run kivy applications (on windows) note (on windows) part. so don...

c - static keyword inside array [] brackets -

c - static keyword inside array [] brackets - this question has reply here: purpose of static keyword in array parameter of function 1 reply i came across new utilize of static keyword. static mean here? void fun(int some_array[static 7]); edit : can give illustration can useful? the standard says in 6.7.6.3: a declaration of parameter ‘‘array of type’’ shall adjusted ‘‘qualified pointer type’’, type qualifiers (if any) specified within [ , ] of array type derivation. if the keyword static appears within [ , ] of array type derivation, each phone call function, value of corresponding actual argument shall provide access first element of array @ to the lowest degree many elements specified size expression. it's feature introduced in c99. there have it: some_array must @ to the lowest degree 7 elements long. as say, the...

animation - ios - Expand table view cell like Twitter app -

animation - ios - Expand table view cell like Twitter app - i want have same behavior twitter app when selecting tweet : expanding row , adding supplementary content. so not basic row resize. think need 2 different custom cells, did : - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { if ([indexpath compare:self.selectedindexpath] != nsorderedsame) { firstcell *cell = [tableview dequeuereusablecellwithidentifier:@"firstcell"]; if (!cell) { cell = [[firstcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"firstcell"]; } cell.firstnamelabel.text = [[self.items objectatindex:indexpath.row] objectforkey:@"firstname"]; homecoming cell; } else { secondcell *cell = [tableview dequeuereusablecellwithidentifier:@"secondcell"]; if (!cell) { cell = [[secondcell alloc] initwithstyl...

java - Spring security redirect when maximum sessions for this principal exceeded -

java - Spring security redirect when maximum sessions for this principal exceeded - so user login -> closes browser -> opens browser 1 more time -> error appears: http status 401 - authentication failed: maximum sessions of 1 principal exceeded what need capture event session invalid, remove sessions user , redirect normal login page spring security config: <http auto-config="true" use-expressions="true"> <session-management session-fixation-protection="migratesession"> <concurrency-control max-sessions="1" error-if-maximum-exceeded="true"/> </session-management> <intercept-url pattern="/login" access="hasrole('role_anonymous')" requires-channel="any"/> <!--<custom-filter after="concurrent_session_filter" ref="sessionexpiration" /> -...

java - How to deal with returning an object and handling errors -

java - How to deal with returning an object and handling errors - thanks checking out question. have next code java deck. want step away arrays , toy code , seek using best practice , object oriented principles one, i'm aware can in much simpler, less re-usable, manner. the end goal create cardgame framework can utilize deal mundane parts of deck management while concentrating on implementation of different games. i'm having issue error handling. thought draw() code follows - 1) if there's card homecoming , move iterator along. eliminate need discard pile discards behind iterator .last() card beingness 1 drawn. 2) if there isn't card , "cards" empty run emptydeck() method. method implemented in subclasses. illustration in solitaire may want end game after running through deck x number of times may not want draw card more. 3) if deck isn't empty , have no more cards phone call endofdeck() method going subclassed. again, may want shuff...

c# - Faking a generic method FakeItEasy -

c# - Faking a generic method FakeItEasy - how go faking following: public interface iblah { func<t, bool> applyfilter<t>(func<t, bool> predicate) t:imessage; } what false homecoming it's argument without changes. however, verify false has been called once. utilize case given below: public class { public something(iblah blah) { _blah = blah; } public bool dosomething(somevalue m, func<somevalue, bool> predicate) { func<somevalue, bool> handler = _blah.applyfilter(predicate); homecoming handler(m); } } i.e. false needs deed pass through need able verify it's been used. what's best way go this? [please don't worry contrived example...there's lot of things going on under covers, i've simplified downwards illustration above.] would solve issue? pass through predicate , verify applyfilter called once [fact] public void testfeature() { ...

jquery - Offset this scroll-to-element function -

jquery - Offset this scroll-to-element function - is there way can offset scroll-to function stops 80px above element it's scrolling to? i have fixed header, 80px in height, , when scroll element header obscures of content. function filterpath(string) { homecoming string .replace(/^\//,'') .replace(/(index|default).[a-za-z]{3,4}$/,'') .replace(/\/$/,''); } var locationpath = filterpath(location.pathname); var scrollelem = scrollableelement('html', 'body'); $('a[href*=#]').each(function() { var thispath = filterpath(this.pathname) || locationpath; if ( locationpath == thispath && (location.hostname == this.hostname || !this.hostname) && this.hash.replace(/#/,'') ) { var $target = $(this.hash), target = this.hash; if (target) { var targetoffset = $target.offset().top; $(this).click(function(event) { ...

sql server - The schema update is terminating because data loss might occur -

sql server - The schema update is terminating because data loss might occur - i maintain bumping error caused error have made while building application in lightswitch . associated relationships. ususally moving along , done number of things before publish app , see error. time hard calulate did wrong. there way trace error see need alter in tables? net sqlclient info provider: msg 50000, level 16, state 127, line 6 rows detected. schema update terminating because info loss might occur. thank you. this error occurs when alter you've made entity's property (in table designer) cause entity's table in published database dropped & recreated, , table has info in it. way sql server works, it's not under lightswitch's control. however, lightswitch errs on side of caution, & doesn't permit operation might cause potential loss of data. the types of things might trigger are: renaming property changing required not requir...

scala - Why use Collection.empty[T] instead of new Collection[T]() -

scala - Why use Collection.empty[T] instead of new Collection[T]() - i wondering if there reason utilize collection.empty[t] instead of new collection[t]() (or inverse) ? or personal preference ? thanks. calling new collection[t]() create new instance every time. on other hand, collection.empty[t] homecoming same singleton object , defined somewhere as object empty extends collection[nothing] ... which much faster. edit: possible immutable collections, mutable collections have homecoming new instance every time empty called. scala

each - Why is this JQuery popup reappearing? -

each - Why is this JQuery popup reappearing? - i have jquery popup function shows text when users click link. click "close" close pop-up. pretty straight forward. the problem pop-up reappears after closed. here's problem bit: javacript $.fn.mypopup = function(popuptext) { var popuphtml = '<div class="messagepop pop">' + popuptext + '<p align="right"><a class="close" href="#">close</a></div>'; this.each(function() { $(this).click(function(){ $(this).addclass("selected").parent().append(popuphtml); $(".pop").slidefadetoggle() }); homecoming false; }); $(".close").on('click', function() { alert('in close function - slidefadetoggle on: ' + popuptext); $(".pop").slidefadetoggle(); alert('just did slidefadetoggle, removeclas...

PHP foreach loops -

PHP foreach loops - this making me insane. i've validated input/outputs, , i'm still getting unexpected behavior. should 2, it's doing numa numa. missing? input: data array ( [0] => array ( [lineid] => 1 [quantity] => 2 [costperitem] => 16.585 [itemid] => 1 ) ) code: printr( $data, 'data' ); foreach( $data $i => $value ){ foreach( $value $key => $a ){ echo 'key: '.$key.' - a: '.$a.'<br />'; ( $key == 'quantity' ) ? $dataquantity[$i] = $a : $dataquantity[$i] = 'numanuma'; } } printr( $dataquantity, 'data quantity' ); output: key: lineid - a: 1 key: quantity - a: 2 key: costperitem - a: 16.585 key: itemid - a: 1 info quantity array ( [0] => numanuma ) there couple of things wrong this. first, you're setting value $dataquantity[$i] in sub-loop $i increm...

jquery - How to return result from function that has an $.ajax call -

jquery - How to return result from function that has an $.ajax call - i'll right off bat this question seems address same situation, life of me i'm not seeing solution/answer there. perhaps needs "spell out" more me! i have next function: function checkifurlexists(checkurl) { var exists = ''; $.ajax({ type: 'post', url: '../scripts/branchadmin.php', data: {checkurl: checkurl}, cache: false, success: function(response) { console.log('response: ' + response); if (response === 'true') { exists = 'true'; } else if (response === 'false') { exists = 'false'; } }, error: function(response) { // homecoming false , display error(s) server exists = 'false'; } }); console.log('exists: ' + exists); // displa...

css - How to position divs next to each other and under each other? -

css - How to position divs next to each other and under each other? - this stupid question , it's easy solve, having problem doing so. question is, how position 2 lastly sections (shown in picture) below first ones? http://imageshack.us/photo/my-images/829/63128947.jpg/ this code: #main_div{ display: -webkit-box; -webkit-box-orient: horizontal; border: 1px solid black; max-width: 1000px; } #main_section{ width: 600px; height: 450px; border: 1px solid black; padding: 5px; margin: 10px; } #sub_section1{ width: 100px; height: 200px; border: 1px solid black; padding: 5px; margin: 10px; -webkit-box-flex: 1; } #sub_section2{ width: 100px; height: 200px; border: 1px solid black; padding: 5px; margin: 10px; -webkit-box-flex: 1; } #sub_section3{ width: 100px; height: 200px; border: 1px solid black; padding: 5px; margin: 10px; -webkit-box-flex: 1; } #sub_section4{ width: 100px; height: 200px; border: 1px solid black; padding: 5px; margin: 10px; -webkit-box-flex: 1; } ...

Android Converting to bitmap crash -

Android Converting to bitmap crash - ok supposed create android application reason, cannot convert image bitmap image. it's .png image , when seek convert in code, application crashes, no errorcode or nothing. ive tried fixing ton of times, i'm not in programming , need help, won't work. protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == foto_nemen && resultcode == result_ok) { final file file = temp; seek { string urienzo = "file:///sdcard/dcim/2013-01-30_13-27-28.png"; uri uri = uri.parse(urienzo); bitmap foto = mediastore.images.media.getbitmap(this.getcontentresolver(), uri); if (foto == null) { toast.maketext(this, uri.fromfile(file).tostring(), toast.length_short).show(); ...

jquery - How to bind .hover() to dynamically created "li" elemtent? -

jquery - How to bind .hover() to dynamically created "li" elemtent? - this question has reply here: jquery .on function future elements, .live deprecated [duplicate] 2 answers all solutions able find suggests utilize .live() method. of today deprecated. .hover() works on "li" elements not created dynamically. 1 time append new "li" .hover() not triggered @ all. anybody has figured 1 out? the "hover" event has been deprecated delegated event handling such .on() per .on() jquery doc pages. instead, need utilize .on() delegated event handling mouseenter , mouseleave , event handler each. for example: $(document).on("mouseenter", "li", function() { // hover starts code here }); $(document).on("mouseleave", "li", function() { // hover ends code here }); in r...

c# - Filter Entity Framework enumerable on Distinct property -

c# - Filter Entity Framework enumerable on Distinct property - the next statement not returning distinct values, whole list: public observablecollection<masterpartslist> parentassemblybom { { var enumerable = this._parentassemblybom .where(parent => parent.isassy == true).distinct(); homecoming new observablecollection<masterpartslist>(enumerable) ; } truly, should able tell object unique because this._parentassemblybom.partnumber distinct property. how work in logic yield right results? thanks in advance! try grouping identifier (in case part number) , select first of group: var enumerable = this._parentassemblybom .where(parent => parent.isassy == true) .groupby(x => x.partnumber) .select(x => x.firstordefault()); c# wpf entity-framework fil...

How to lock trackpad in blackberry using jquery? -

How to lock trackpad in blackberry using jquery? - is there way block users utilize trackpad in blackberry locking trackpad time ?? i need using jquery... i have implied plugin jqueryblockui using jquery jus displays loading message never blocks user actions "trackpad".. try jqueryblockui plugin blockint mousemove event.. or plugin locks ui user.. user can jus scroll using trackpad click events blocked..! jquery jquery-plugins blackberry ide

silverlight 5.0 - Databinding validation does not catch exceptions -

silverlight 5.0 - Databinding validation does not catch exceptions - i bound textbox object in memory throws exception when wrong value entered. if textbox has validatesonexception set true , mode=twoway, if exception should occur should intercepted binding, it's not. the textbox looks like: <textbox name="txtage" text="{binding age, mode=twoway, validatesonexceptions=true}" /> i created object in memory , set layoutroot grid's datacontext created object in usercontrol's constructor. student std = new student(); layoutroot.datacontext = std; the bound object type is: public class pupil { private string _name; public string name { { homecoming _name; } set { _name = value; } } private int _age; public int age { { homecoming _age; } set { if (value > 100 || value < 0) { throw new exception("please come in age be...

google apps script - Emailing data from a spreadsheet at a specific time of day -

google apps script - Emailing data from a spreadsheet at a specific time of day - i finish novice google scripts, , need find way have info collected in google spreadsheet emailed gmail account. i have google form set records client service statistics throughout day. responses collected spreadsheet. spreadsheet cleared everyday prepare next day's responses. need find way have of collected responses emailed in study @ end of each day. from searches have done far, believe getrange , getvalues needed, don't know how craft code retrieve of info on sheet. spreadsheet has 4 set columns, number of rows generated depends on number of statistics collected each day. figured out getlastrow can address issue, how utilize getrange , getvalues? i tried writing basic script create work, email value in a1 cell. need of data. used time trigger command when runs. doing wrong? function emailstats() { var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.getact...

android - Add delete function in my project -

android - Add delete function in my project - i utilize code contextual menu , create simple commands. how integrate real commands in this? i want create real function. @override public void oncreatecontextmenu(contextmenu menu, view v,contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); menu.setheadertitle("optiuni"); menu.add(0, v.getid(), 0, "copiaza"); menu.add(0, v.getid(), 0, "sterge"); } @override public boolean oncontextitemselected(menuitem item) { if(item.gettitle()=="copiaza"){copyfunction(item.getitemid());} else if(item.gettitle()=="sterge"){deletefunction(item.getitemid());} else {return false;} homecoming true; } public void deletefunction(int id){ toast.maketext(this, "sters", toast.length_short).show(); } public void copyfunc...

javascript - Highlighting text in a new window -

javascript - Highlighting text in a new window - i trying create recipe page user can click recipe ingredient (e.g. olive oil, broccoli, etc.) , redirected list of ingredients ingredient clicked highlighted in yellow. i know how highlight text specific link: css: .highlight {background-color:yellow;} javascript: function highlighttext(id) { var textobject = document.getelementbyid(id); textobject.classname = "highlight"; } html: <h1 id="ingredient">olive oil</h1> <a href="javascript:highlighttext('ingredient')">olive oil</a> what create link "olive oil" page, way using id attribute: <a href="http://www.mypage.com/recipe-list.html#ingredient"> olive oil </a> i appreciate , help. first post, please excuse me asking such simple question. use target selector :target{ background-color:yellow; } an article selector javascript html c...