Posts

Showing posts from March, 2012

Struts2 -- NullPointerException from radio button -

i have following form in struts2 jsp contains radio buttons. there 2 other forms on page work correctly, 1 doesn't. have determined value selected somehow not being passed, , that reason i'm getting nullpointerexception, can't figure out why it's happening. can me? here jsp form. <s:form action="processpoll3"> <table> <tr> <td><b><i>poll #3</i></b></td> <td>how many kids have?</td> <td><s:radio name="poll3" list="#{'1':'0.', '2':'1.', '3':'2.', '4':'3.', '5':'more 3.'}" /> <s:submit value="vote poll #3" align="left" /></td> ...

javascript - tty.js does not work -

i installed tty.js: $ npm install -g tty.js start it: $ tty.js when call http://example.com:8080/ can't open terminal , http://example.com:8080/socket.io/socket.io.js returns http error 404. i tried node 0.6.19. i posted in github maybe stackoverflow can :) you should not using "example.com", external domain, own machine. try replacing localhost, or 127.0.0.1, so: http://localhost:8080

jquery - Load certain pages in a modal box on page load -

i have built simple modal using jquery takes url , loads using ajax method , inserts response html div display on screen in design of modal box. simple stuff! however these pages actual urls e.g. domain.com/posts/add , can accessed directly via browser , not clicking link within app. prefer displayed in modal @ times if user types url address bar. make if request not ajax redirect them homepage or show 404 prevent happening. i prefer load these pages in modal should user access them directly via http in same way chrome store e.g. https://chrome.google.com/webstore/detail/pjkljhegncpnkpknbcohdijeoejaedia how though? without having messy javascript? ideas or suggestions appreciated. please note should work proper app in allows user use , forth buttons , modal should appear , disappear as modal code use... it simple , example of how looks (note mine more robust this, code purely example of simplicity) $('.ajax-link').click(function(e){ e.preventdefault; $.ajax({...

iOS push notifications nightmares, Provisions app IDs and certificates -

hey apple developers, i'm pulling hair out trying figure out how ios provisioning profiles, certificates , app ids work push notifications. thought close getting work, maybe not. when run app , attempt register push notifications, error in console: 2012-06-26 17:52:29.380 grouped[1732:707] badgenumber: 0 2012-06-26 17:52:30.089 grouped[1732:707] [info] device ready 2012-06-26 17:52:32.654 grouped[1732:707] jslog: registering apns via app delegate 2012-06-26 17:52:32.655 grouped[1732:707] register success callback set 2012-06-26 17:52:32.661 grouped[1732:707] didfailtoregisterforremotenotificationswitherror:error domain=nscocoaerrordomain code=3000 "no valid 'aps-environment' entitlement string found application" userinfo=0x18a0c0 {nslocalizeddescription=no valid 'aps-environment' entitlement string found application} i've done several hours of research , can't figure out i'm doing wrong. i've created new provisioning prof...

c# - DirectX not showing up in references -

i installed directx sdk when try add reference it, isnt showing in list. so, need know either how dx references added list or dll need browse for. i'm trying microsoft.directx.audiovideoplayback for now, anyways, i've downloaded directx9 managed code still exists , fixed problem. considered using sharpdx had 0 documentation.

linux - search.h-No such file or directory while porting libtiff on Android-tiff 4.0.1 -

i trying port libtiff on android. source version using tiff 4.0.1. building source inside u1 android os. getting below error when run mmm external/tiff 4.0.1/ in file included external/tiff-4.0.1/libtiff/tiffiop.h:33, external/tiff-4.0.1/libtiff/tif_dirread.c:42: external/tiff-4.0.1/libtiff/tif_config.h:93:1: warning: "have_malloc_h" redefined in file included <command-line>:0: ./system/core/include/arch/linux-arm/androidconfig.h:221:1: warning: location of previous definition in file included external/tiff-4.0.1/libtiff/tif_dirread.c:42: external/tiff-4.0.1/libtiff/tiffiop.h:54:21: error: search.h: no such file or directory i tries searching lot on internet not issue. can 1 provide me approx idea wrong or package missing. i resolved issue finally. hope doing work in future. need remove lines libtiff/tiffiop.h header file being referenced.that worked me.

r - Delete "" from csv values and change column names when writing to a CSV -

i'm trying create csv files out of r table. cant understand why values checked "" when use write.csv() function. data looks this: sample sample_name sample_group pool_id sample_plate nortum sentrix_id sentrix_position hybnr 1 00_11242 00_24200n2 mutyh gs0005703-opa gs0010004-dna n 1280307 r007_c005 1 2 00_11242 00_24200n2 mutyh gs0005704-opa gs0010004-dna n 1280307 r007_c011 1 3 00_11242 00_24200n2 mutyh gs0005702-opa gs0010004-dna n 1416198 r007_c011 2 4 00_11242 00_24200n2 mutyh gs0005701-opa gs0010004-dna n 1416198 r007_c005 2 5 00_7 00_7t mutyh gs0005701-opa gs0010004-dna t 1416198 r006_c005 2 6 00_7 00_7t mutyh gs0005702-opa gs0010004-dna t 1416198 r006_c011 2 7 00_7 00_7t mutyh gs0005704-opa gs0010004-dna t 1280307 r006_c011 1 8 00_7 00_7t mutyh gs0005703-opa gs0010004-dna t 12...

security - Symfony2: Unrecognized options "method_access_control" under "jms_security_extra" error -

so i'm trying configure security access of methods here, through jmssecurityextrabundle. followed instructions here : jmssecuritybundle doc . i ended having in config.yml file: jms_security_extra: secure_controllers: true secure_all_services: false method_access_control: 'mybundle:.*:postentitydelete': 'hasrole("role_super_admin")' now i'm getting error: invalidconfigurationexception: unrecognized options "method_access_control" under "jms_security_extra" how can have gone wrong on little? where's catch , how solve problem? thanks in advance! edit: deps : [jmssecurityextrabundle] git=https://github.com/schmittjoh/jmssecurityextrabundle.git target=/bundles/jms/securityextrabundle [metadata] git=https://github.com/schmittjoh/metadata.git version=1.1.0 ; <- make sure 1.1, not 1.0 [jmsaopbundle] git=https://github.com/schmittjoh/jmsaopbundle.git target=/bundles/...

c# - Databindings.Add really slow -

i asked question yesterday , reference: keeping track of 40+ control values i binding bunch of controls property class; however, slows down gui portion of application. example, following code: numericupdownphysicalais.databindings.add("value", configurationvalues, "physicalais"); numericupdowninternalais.databindings.add("value", configurationvalues, "interalais"); numericupdownphysicalaos.databindings.add("value", configurationvalues, "physicalaos"); numericupdowninternalaos.databindings.add("value", configurationvalues, "internalaos"); numericupdownsetpoints.databindings.add("value", configurationvalues, "setpoints"); numericupdownindexregisters.databindings.add("value", configurationvalues, "indexregisters"); numericupdownnetworkid.databindings.add("value", configurationvalues, "networki...

asp.net mvc - Custom Regular Expression Validation in MVC3 -

i on way implement custom regular expression validator 1 of mvc3 project. i have been able perform validation correctly using custom atrribute. the view model property decorated below custom attribute [regularexpressionif("dependantproperty","targetvalue","pattern","errormessage")] but requirement , need match property1 values regular expressions based on property2 value. ex. property 2 dropdown , has values 1,2,3 . if user selects 1, regular expresion pattern {regx1}, 2 {regx2} that. i tried modify attribute passing variables contain these values. on build .net insists should "constant" passed. able hard code value in attribute, in no way can pass parameter below [regularexpressionif("dependantproperty","targetvalue",patterndictionary,"errormessage")] if me out in great.. you'll need use reflection value of property @ runtime. protected override validationresult isvalid( ...

java - "Found 1 deadlock" but trace shows that not locked by any thread -

the jvm tells me deadlock has occurred: found 1 java-level deadlock: ============================= "tp-processor107": waiting ownable synchronizer 0x00002aaaf58e70f0, (a java.util.concurrent.locks.reentrantreadwritelock$nonfairsync), held "indextrackerthread3" "indextrackerthread3": waiting ownable synchronizer 0x00002aaaf4394580, (a java.util.concurrent.locks.reentrantreadwritelock$nonfairsync), held "tp-processor16" "tp-processor16": waiting ownable synchronizer 0x00002aaaf58e70f0, (a java.util.concurrent.locks.reentrantreadwritelock$nonfairsync), held "indextrackerthread3" we can see indextrackerthread3 waiting resource held tp-processor16 , , vice-versa. indeed deadlock. we can see indextrackerthread3 waiting 0x00002aaaf4394580 : "indextrackerthread3": - parking wait <0x00002aaaf4394580> my question: in the threads dump , why there no line - locked <0x00002aaaf4394580...

java - System.err.println() doesn't print in red -

system.err.println() in eclipse doesn't print in red. i checked preferences > run/debug > console and "standard error text color" red and "show when program writes standard error" checked. any idea why shouldn't eclipse print in red? from can see seems bug has been fixed in tomcat 7 , onwards. i'm not sure if causing it, might be: redirection of system.out , system.err in org.apache.catalina.startup.catalina.start() prevents other application (for instance ide) redirecting system.out , system.err. redirects them same output (the standard system output stream) preventing differentiation of 2 streams.

local php.ini sessions.save_path issue - sessions not recognised -

i have client running user management script. host provider had blocked allow_url_fopen using suphp created local copy of php.ini allow_url_fopen set "on". the problem can no longer login using script - says 'success logging in' - logs right out (because sessions either not getting created or in wrong place - excuse lack server knowledge). here settings in local php.ini upload_tmp_dir = "/home/aspac124/public_html/tmp" register_globals = on memory_limit = 256m session.save_path = "/home/aspac124/public_html/tmp" safe_mode = off upload_max_filesize = 32m allow_url_fopen = on zend_extension = "/usr/local/ioncube/ioncube_loader_lin_5.3.so" i'm not sure why hosting provider turned register_globals on client. correct place session.save_path? i've checked , folder exists , set 777 make sure no happiness. another client using same system had similar issue , told me changed tmp/ folder home directory , fine. i've tried...

WCF certificates and non .net clients -

i developing wcf service. use wshttpbinding , customusernamevalidator access through username , password. i've faced problem use username/password need sort of secure channel means should generate 2 certificates - 1 service , 1 client. question - possible client not needed certificate , if yes - how that? , how customize security of wcf service non-.net clients? there no need have 2 certificates when using wshttpbinding binding type. need set 1 certificate on server using transportwithmessagecredential used point point channel communication user credentials encrypted , stored in message. on following link can find complete sample related wshttpbinding username authentication: http://msdn.microsoft.com/en-us/library/ff648840.aspx .

image - drag and drop different buttons into a view (Android)? -

need drop different buttons view in creating clip art palette. added image want background of button. tried out code , works well, problem drops same image every button click. code layout = (framelayout) findviewbyid(r.id.linearlayout01); // layout.setontouchlistener(this); btn = (button) findviewbyid(r.id.btn); btn.setdrawingcacheenabled(true); btn.setontouchlistener(this); btn2 = (button) findviewbyid(r.id.btn2); btn2.setdrawingcacheenabled(true); btn2.setontouchlistener(this); btn3 = (button) findviewbyid(r.id.btn3); btn3.setdrawingcacheenabled(true); btn3.setontouchlistener(this); btn4 = (button) findviewbyid(r.id.btn4); btn4.setdrawingcacheenabled(true); btn4.setontouchlistener(this); params = new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content); } @override public boolean ontouch(view view, motionevent me) { if (me.getaction() == motionevent.action_down) { ...

regex - Java Pattern.quote -

i pretty new patterns , great. i building webcrawler, looks specific pattern in path. right using pattern.quote produce literal string. let's pattern.quote produces \q/test/live/167909\e in after second slash (thus live) same. because test , 167909 random created pattern \q/*/live/*\e , can't use create new pattern. any welcome. the expression ".*/live/.*" matches paths pattern describe. can create pattern that. alternatively, peter said, ask path.contains("/live/");

casting - Objective Cconvert id(type) to NSNumber:Error -

i want convert id* nsnumber * trying unsigned int shortvalue = [(nsnumber *)idobject unsignedshortvalue]; but aint compiling cast of indirect pointer objective-c pointer 'nsnumber *' disallowed arc any ideas how it. id* object argument method ,second argument type information of id* object inside method performing type specific methods on 1 above id semi-primitive type, declared in objc.h as typedef struct objc_object { class isa; } *id; when create id objects, don't use "*", pointers objects, don't this: id *someobject; the correct syntax this: id someobject; hope helps! --------edit------ tried out code used: unsigned int shortvalue = [(nsnumber *)idobject unsignedshortvalue]; and compiled fine. think error how create idobject . ---------edit--------- here's apple doc on id : http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/chapters/ocobjectsclasses.html , here's 2...

python - How to plot data from multiple two column text files with legends in Matplotlib? -

how open multiple text files different directories , plot them on single graph legends? this relatively simple if use pylab (included matplotlib) instead of matplotlib directly. start off list of filenames , legend names, [ ('name of file 1', 'label 1'), ('name of file 2', 'label 2'), ...]. can use following: import pylab datalist = [ ( pylab.loadtxt(filename), label ) filename, label in list_of_files ] data, label in datalist: pylab.plot( data[:,0], data[:,1], label=label ) pylab.legend() pylab.title("title of plot") pylab.xlabel("x axis label") pylab.ylabel("y axis label") you might want add fmt='o' plot command, in order change line points. default, matplotlib pylab plots onto same figure without clearing it, can run plot command multiple times.

php - Relating my normalized tables together -

i have range of tables have normalized user profile section. tables follows; users --> userprofilesettings --> userpersonalinfo --> usercontactinfo --> useraddresses --> userbusinessinfo --> userbusinesstags --> userbusinesslogo the users table contains username , password, profile settings containing information whether account active/inactive , date became member. way have in head - user can have 1 entry in each table - , must have entry in each table (apart userbusinesslogo) in order member, table allow multiple rows indentifed user userbusiness tags. what best way achieve this, 1 many relationships allow multiple rows of same user? have been searching around similar kind of setup cannot seem find examples. you have over-normalized schema. in general, if have strict one-to-one relationship between tables, should consider merging them single table. if user can have 1 set of personal info, 1 set of contact info, 1 address, , 1 set of business ...

java - Creating a dynamic (growing/shrinking) thread pool -

i need implement thread pool in java (java.util.concurrent) number of threads @ minimum value when idle, grows upper bound (but never further) when jobs submitted faster finish executing, , shrinks lower bound when jobs done , no more jobs submitted. how implement that? imagine common usage scenario, apparently java.util.concurrent.executors factory methods can create fixed-size pools , pools grow unboundedly when many jobs submitted. threadpoolexecutor class provides corepoolsize , maximumpoolsize parameters, documentation seems imply way ever have more corepoolsize threads @ same time use bounded job queue, in case, if you've reached maximumpoolsize threads, you'll job rejections have deal yourself? came this: //pool creation executorservice pool = new threadpoolexecutor(minsize, maxsize, 500, timeunit.milliseconds, new arrayblockingqueue<runnable>(minsize)); ... //submitting jobs (runnable job : ...) { while (true) { try { poo...

objective c - iOS Core Plot - Detect swipe gesture on the graph -

i'm using core plot display scatter plot graph, , i'd use swipe gesture switch between graph , uitableview of data graph made of. uiswipegesturerecognizer working fine on table view, swipe events not triggered on graph. graph uiview class set cptgraphhostingview, , code follows : uiswipegesturerecognizer *swiperight = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(swipehistorydata:)]; [swiperight setdirection:uiswipegesturerecognizerdirectionright]; [graphhostingview addgesturerecognizer:swiperight]; [tablelistview addgesturerecognizer:swiperight]; my guess cptgraphhostingview 'eating' swipes in way not detected recognizer. can comment or put me on right road? sorry figured out - adding same gesture recognizer both graph view , table view. forget doesn't work - because added table view after graph view, table view receives events. need use 2 gesture recognizers (unless can tell me different).

How to save a byte type char array data to a file in c++? -

i have char type array[100] 100 bytes stored in it. want write char type byte array file. how this? i not writing .txt file other format. thank you. no need complicated. use old fwrite directly: file* file = fopen( "myfile.bin", "wb" ); fwrite( array, 1, 100, file );

What is the difference between the generic signifier ' and the symbol ^ In F# method signatures -

i understand tick signify generic parameter, in: seq.append : seq<'t> -> seq<'t> -> seq<'t> but caret signify, in: seq.average : seq<^t> -> ^t the detailed signature is: seq.average : seq<^t> -> ^t (requires ^t static member (+) , ^t static member dividebyint , ^t static member zero) unlike seq.append , seq.average needs more constraints on type of elements. particularly: _ dividebyint (s1 + s2 + ... + sn) n n <> 0 seq.average {s1; s2;...; sn} = / \_ ^t.zero n = 0 as can see, both (+) , dividebyint , zero required in order seq.average<^t> makes sense. useful information generics found here msdn .

jsf - f:convertNumber doesn't throw conversion error on trailing alphabetic characters in decimal -

i using <f:convertnumber> tag convert decimal input. <f:convertnumber minfractiondigits="2" /> but it's accepting trailing alphabatic characters. example, if input 12345.1234aaa converts 12345.123 . throw conversion error on instead of trimming alphabetic characters. how can achieve this? this standard behavior of java.text.numberformat used <f:convertnumber> : trims entries after first not-allowed character (e.g. letters or decimal separators others ones defined in input locale). conversion fails if offending character @ beginning. i don't behaviour because user may not notice mis-typed value got trimmed, resulting in unintended , (even worse) unnoticed auto-correction wrong value. interestingly enough, specific number converters behave differently. using <f:converter converterid="javax.faces.double" /> not automatically handle non-numerical input, fails conversion instead. however, tag not possess additiona...

java - Action Listeners -

how use action listeners attached buttons. , how make work separate class file? edit: have: import java.awt.*; import java.awt.event.*; public class gui { static boolean playerturn = true; public static void main(string[] args) { frame frame1 =new frame("ticktactoe - fred"); frame1.setlayout(null); frame1.setbounds(250,150,500,500); frame1.setvisible(true); frame1.addwindowlistener(new windowadapter(){ public void windowclosing(windowevent e){ system.exit(0); } }); final button button11 = new button(""); button11.addactionlistener(null); final button button12 = new button(""); button11.addactionlistener(null); final button button13 = new button(""); button11.addactionlistener(null); final button button21 = new button(""); button11.addactionlistener(null); final button button22 = new button(""); button11.addactionli...

simulation - R: strange result using sample function in apply -

i running simulation takes sample of values in matrix starts 1 column. put them through selection criteria , each row in matrix randomly selects value output , saves random selection. reason when apply sample() matrix on rows have real number , na, returns number not available sampled. may doing wrong sample() function, don't understand unknown value coming from. example code: theta <- c(30, 84, 159, 32, 60, 97) omega <- 0.01 k <- 1 xn <- matrix(c(30, 84, 159, 32, 60, 97), ncol=1) dup <- xn * 2 set.seed(1) z <- matrix(rbinom(n=rep(1,length(dup)),size = as.vector(dup),prob = 0.5),nrow = nrow(dup)) z1 <- dup - z xn <- cbind(z, z1) # put both in matrix w <- exp( -(1/2)*( ( ( xn - theta ) / theta ) ^2 / omega ) ) set.seed(1) z <- matrix(rbinom(nrow(w) * ncol(w), 1, w), nrow=nrow(w), ncol=ncol(w) ) xn <- ifelse ( z == 0, 0, xn ) xn [,1] [,2] [1,] 32 0 [2,] 78 0 [3,] 144 0 [4,] 0 30...

c# - Counter--; Help me understand -

application, have textblock , 2 buttons, text displayed textblock clicking on button (the text of q.txt read line line, on hundred lines): public class qwork { public static int counter = 0; public static string getq() { var qfile = new list<string>(); string pathfile = "q.txt"; uri uri = new uri(pathfile, urikind.relative); streamresourceinfo sri = application.getresourcestream(uri); using (streamreader sr = new streamreader(sri.stream)) { string line = ""; while (line != null) { line = sr.readline(); if (line != null) qfile.add(line); // add list } return qfile[counter]; } } } buttons event handler: private void rightbutton_click(object sender, routedeventargs e)//next text { qtextblock.text = qwork.getq(); qwork.counter++; } private ...

android - Make my view able to accept child views in xml -

Image
i have write own view bar, extends linearlayout . bar has 2 places add buttons or other view. add items bar using code, like: bar.additemtoleft(view); or bar.additemtoright(view); i make bar able accept childs view in xml linearlayout . for example: <com.my.ui.bar android:id="@+id/bar" android:layout_width="fill_parent" android:layout_height="wrap_content"> <com.my.ui.barleft android:layout_width="wrap_content" android:layout_height="wrap_content"> <view/> <view/> <view/> </com.my.ui.barleft> <com.my.ui.barright android:layout_width="wrap_content" android:layout_height="wrap_content"> <view/> <view/> <view/> </com.my.ui.barleft> </com.my.ui.bar> is possiable do? ps: you bar left , ri...

sql server - Unable to display classic asp page on local machine on iis7 -

i new classic asp deployment. have deployed classic asp project on local machine on iis7 of windows7. when browse website iis displays home page when click on search button on page should redirect search.asp page not displayed , no errors shown. shows the website cannot display page . sqlserver version: 2008 my connection string: mm_mtyadi_string.open "provider=sqloledb;data source=.\sqlexpress;initial catalog=mydb;integrated security=true;" my html code : <a href="html/search.asp"><img src="images/search.gif" width=351 height=51 border="0"> any suggestions? if using iis7 classic asp has own error reporting settings. in iis manager have double click asp properties page pop up. expand: debugging properties: set send errors browser : true that give detailed classic asp errors can understand code breaking.

PHP mySQL fetch data if no match in second table -

the following code supposed return results either match parameter in table or don't match id @ all. this attempt , don't understand why not work. returns many times number of results. select * table2, table1 table1.id = table2.name , table1.value = 1 or table1.id != table2.name how can fixed looks need parenthesis from table2, table1 (table1.id = table2.name , table1.value = 1) or table1.id != table2.name table2, table1 table1.id = table2.name , (table1.value = 1 or table1.id != table2.name)

Get last parameter of url in php -

possible duplicate: extracting last segment on uri i want last parameter of url eg. http://www.youtube.com/embed/adu0qnq4eds i have full url above , want last parameter php adu0qnq4eds please help something this? echo end(explode("/", $url)); this throw error if strict error reporting enabled. avoid this, split them this: $parts = explode("/", $url); echo end($parts);

c# - Is there a way to run a list of different action methods on an object in Nunit using TestCase? -

say have following: [test] // parameterize parameters in call , call public void test() { var res1 = _sut.method1(1); var res2 = _sut.method2("test"); var res3 = _sit.method3(3); assert.that(res1, is.null); assert.that(res2, is.null); assert.that(res3, is.null); } i'd parameterize tests using testcase/testcasesource attribute including call itself. due repetitive nature of tests, each method needs called different parameters, need able tag different call each of different parameters. possible in nunit? if so, how go it? using testcasesource , should able loop on array of values , invoke desired methods, example this: [testfixture] public class testclass { private sut _sut; public testclass() { _sut = new sut(...); } private ienumerable<object> testcases { { var values = new object[,] { { 1, "test", 3 }, { 2, "hello", 0 }, ... }; (var = 0; ...

function - In C++, how can I test for one of several flags combined with "|" in one argument? -

i have next code: int main() { ownselect(23, fd_read | fd_write); // <---- several arguments 1 return 0; } int ownselect(socket s, long lnetworkevents) { // how can check fd_read has been passed? if(lnetworkevents == fd_read) { // never here } return 0; } how can check fd_read has been passed no matter if fd has been passed fd_read. thanks! seems you're missing out on bit of basic bit manipulation here. you're or'ing fd_read , fd_write (| = bitwise or), thereby setting bits indicated both values, parameter. check if fd_read passed, need , lnetworkevents fd_read , check if result equals fd_read, so: if (fd_read == (lnetworkevents & fd_read)) { ... } this of course assuming fd_read , fd_write values meant used way (i.e. typically don't have overlapping bits). edit: fixed, wabepper absolutely right :) oops!

Reading file formatted with C in C# -

i have binary file, written in c, contains long stream of numbers. first contains subsequently 4 times int (so first 16 bytes 4 ints) , contains doubles (i assume every 8 bytes new double). there no spaces @ point or else. need read data c# far tried didn't work, suggestions? using (binaryreader br = new binaryreader(file.open("file", filemode.open))) { int = br.readint32(); int b = br.readint32(); int c = br.readint32(); int d = br.readint32(); double e = br.readdouble(); double f = br.readdouble(); ... }

html - PHP include without output? -

alright, heres thing. have (paid for) shopping cart, in process of jazzing jquery , css , whatever else make , work nicer is. anyway. in order use database , functions etc, need include file @ beginning of webpage. have put in a <div style="display:none;"> but of course output still written browser. not alot, prefere have no div , no output, still want perform it's calculations. 5000 line php file , complicated go through , edit out bits dont want. is there clever way, can include file specify if want written page when including it? i knows it's bit of bodge, hope i've explained myself, if can please let me know. thanks. you can use output buffering catch output variable instead of sending browser: ob_start(); require(...); $data = ob_get_clean(); note use of require instead of include . because think script should crash when hitting include error, not continue if nothing wrong.

.htaccess - Grabbing Querystrings while using ModRewrite with PHP -

i'm using url rewriting through .htaccess on site. submit through paypal's expresspay , following returned: http://mydomian.com/cart/success?token=ec-123456789&payerid=123456789 the /cart , /success great, there easy way grab "token" "payerid" variables? here's .htaccess i'm working with: rewriterule ^([^/\.]+)/?$ index.php?load=$1 rewriterule ^([^/\.]+)/([^/\.]+)/?$ index.php?load=$1&query=$2 rewriterule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?load=$1&query=$2&query2=$3 [l] add [qsa] each of rules, , change third rule have these flags: [l,qsa] . make query string paypal appended , you'll able access them index.php.

Unrecoverable block scoping error, array of C++ functors -

i'm trying create array of functors @ compile time, so: (complete file): #include <functional> using namespace std; function< float( float televation, float pazimuth )> colorfunctions[] = { []( float televation, float pazimuth ) -> float { return 2.0f ; }, } ; int main() { } that works fine. try create local inside functor block, this: function< float( float televation, float pazimuth )> colorfunctions[] = { []( float televation, float pazimuth ) -> float { float v = 2.0f ; return v ; }, } ; you error 1 error c1506: unrecoverable block scoping error how can declare locals inside these blocks? doesn't seem work. i can reproduce on msvc 2010, sp1. vs10 known problems lambdas , scoping. i've tried around lot found nothing beautiful. ugly, ugly workaround have initialization overhead else work intended: #include <functional> #include <boost/assign/list_of.hpp> #include <vector> using ...

sql - PHP Form must be submitted twice to update checkbox -

i'm still relatively new php. i'm trying build privacy settings page members opt out of automatic emails triggered events (i.e. private message notification). want checkbox set automatically based on database setting. of now, form update database correctly, checkbox status not show correct setting unless submit button pressed twice, or page reloaded. setting '0' unchecked, '1' checked. i'd love use ajax or jquery handle this, don't know @ all. privacysettings.php <?php $id = ""; $pm_mail_able = ""; $pm_email = ""; if (isset($_get['id'])) { $id = preg_replace('#[^0-9]#i', '', $_get['id']); // filter numbers } else if (isset($_session['idx'])) { $id = $logoptions_id; } else { header("location: index.php"); exit(); } //query checkbox status $sql = mysql_query("select * members id='$id'"); while($row = mysql_fetc...

javascript - How to insert interactive map? -

i trying use googlemap in website : function insertmap() { var map; var op = { zoom: 10, center: new google.maps.latlng(-34.397, 150.644), maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid('id'), op); } i calling function on button click event. problem insert static map ( single image ) instead of interactive map. tried isstaticmap : false not working , when did shows nothing neither static nor interactive. me out ! there implementation using jquery might you. source code , demo included! http://www.position-absolute.com/articles/create-an-interactive-google-map-widget-with-a-list-filter-and-a-map-helper-class/

facebook - How to insert fb like into fancybox? -

is there way insert facebook pop image of fancybox? fancybox ajax call. can use html5 buttons just trigger parse function when load complete. try simple code below after fancybox load , can run: $("#foo").fancybox({ 'oncomplete':function() { fb.xfbml.parse(); } }); http://developers.facebook.com/docs/reference/plugins/like/

User authentication in django with custom user model and table -

i'm new django , wanted ask regarding user authentication , logging in. read documentation , unable find proper answer/direction regarding trying accomplish. basically, have integrate legacy system, cannot use default auth_user tables or that. have model defined in app written below: class user(models.model): class meta: db_table = 'user' def __unicode__(self): return self.first_name + ' ' + self.last_name first_name = models.charfield(max_length=64) last_name = models.charfield(max_length=64) email = models.charfield(max_length=64) password = models.charfield(max_length=32) active = models.charfield(max_length=1) last_modified = models.datetimefield("last modified") timestamp = models.datetimefield("timestamp") my question is, how can make use of above model (or changes should making it) work authentication app? right have following backend authentication per docs: class customauth(modelbac...

jasper reports - Setting bold with text field and parameter with string "&" scratch pdf -

im trying set bold in part of text field concats parameter (nocurso) when parameter comes character "&" scratch pdf print. this prints style tag bold besides put in bold text. , works when parameter not come "&" see below text field "eu, "+$p{noaluno}.touppercase()+", portador(a) da cédula de identidade número "+$p{nurg}+", declaro, sob penas da lei, que entregarei todos os documentos necessários para efetivação da matrícula no curso "+$p{nocurso}.touppercase()+". " what going on? you can use apache commons library method escape special characters in parameter: org.apache.commons.lang.stringescapeutils.escapehtml($p{nocurso}).touppercase() more on issue can found in jasperforge ireport forums . the apache commons lang api can found here . in particular, need download commons-lang library here .

c# - PayPal SOAP API - Express Checkout - Error 10002 -

i'm trying connect website paypal sandbox in order use express checkout feature. i've used link reference keep getting 10002 error "security header not valid". documentation has invalid credentials problem if made request manually through soapui returns "sucess", if use curl command works expected. scenario: asp.net page 2 web references 1 https://www.sandbox.paypal.com/wsdl/paypalsvc.wsdl , https://www.paypalobjects.com/wsdl/paypalsvc.wsdl , given credentials username, password , signature can see in following code snippet: using cloudshop.com.paypal.sandbox.www; namespace cloudshop { public static paypalapiaasoapbinding buildpaypalwebservice() { useridpasswordtype credentials = new useridpasswordtype() { username = cloudshopconf.paypalapiusername, password = cloudshopconf.paypalapipassword, signature = cloudshopconf.paypalapisignature }; paypalapiaasoapbindin...

javascript - IIS custom header to show request time -

is possible have iis (7.5) attach custom response header showing request time (in milliseconds preferably) background, im trying find way of collecting absolute load time of page, absolute start finish, seems good/simple way of doing opposed other solutions require "startup" time load js etc etc before can start keeping track doesnt give genuine representation

oracle10g - ALTER TABLE <table> REBUILD error -

Image
when execute sql command: alter table <table> rebuild; i have error: i use: oracle database 10g enterprise edition release 10.2.0.1.0 - 64bi pl/sql release 10.2.0.1.0 - production thx

xml - Data types in xslt -

i developing json parser xml using xslt transformer, thatis output type text. not provide output data types. example, input xml has data string or int or date, , xslt not realize kind , parse them same. query whether there way import xsd file (has data types) within xslt, xsd can check type of data , transform finar accordingly. from thank much! there's fair amount can schema-aware xslt 2.0 transformation, i'm not sure understand requirement sufficiently facilities relevant. you converting json xml, output text. have thought transformation text in, xml out. you "however not provide output data types". there's missing subject sentence. expect data type knowledge come from? parsing specific json input structure known stylesheet, or parsing arbitrary json? and i've no idea "finar" is, or fits in!

java - Netbeans Startup option 'sun.java2d.opengl=true' not recognised -

i'm trying tweak performance of netbeans on rather old pc using. i've followed of suggestions here 1 regarding sun.java2d.opengl=true fails, giving unknown option -dsun.java2d.opengl=true i'm using linux wattos distro version 5, java 1.7 , netbeans 7.1.2. has option become obsolete above page seems refer java 5? are there additional steps need enable netbeans use opengl? ** additional info ** i realised should have used option -j-dsun.java2d.opengl=true although crash when try starting netbeans now. i've submitted crash report i'll wait , see happens , post result here. check with java -version what version of java you're using. extension supported in sun jvm, , quite few distros come openjdk default.

How to get the httppost filename on the php server -

i used fileentity httppost post file php apache server,but not want change name of file. how can name of file server using php? have file: $filename='test.zip';//自定义的名字 file_get_contents('php://input'); file_put_contents($filename,$data); html (test.html): <!-- make sure have enctype , name on file input --> <form method="post" action="test.php" enctype="multipart/form-data"> <input type="file" name="test" /> <button>submit</button> </form> php (test.php): // since we've set our file input name 'test' , // we've posted form-data, can use $_files print_r( $_files['test'] ); just use $_files . array ( [name] => test.jpg [type] => image/jpeg [tmp_name] => /tmp/pasd41l3fmfr [error] => 0 [size] => 15476 )

css3 - Mobile Webkit reflow issue -

i've been experiencing issue in mobile versions of webkit (specifically webkit 534.46 on ios 5.1.1 mobile safari, , chrome ios) doesn't happen on desktop browser i've seen. (i.e. demos below should viewed on mobile version of webkit.) here live example of issue. core of css extremely straight forward. positions alphabet index along left of page: #index { left:0; margin:0; padding:0; position:fixed; top:0; width:3em; } the issue happens when element fixed position on top of body. able interacted until scroll changes , stops accepting input. if (manually) jiggle scroll 1 pixel becomes active again. example kept simple possible , not use javascript. after hammering on it, i've discovered appears element thinks scrolled has been visually fixed. in other words, if click on 'a' try click on 'a' again, second click in further down list. seemed css reflow issue me. know mobile webkit attempts reduce number of reflows. here live example of workar...

c# - UDP Tracker not responding -

alright, i'm trying connect udp trackers using c#, never response. don't errors. here's code. namespace udptester { class mainclass { public static bool messagereceived = false; public static random random = new random(); public static void log(string format, params object[] args) { console.writeline (format,args); } public static void main (string[] args) { log ("creating packet..."); byte[] packet; using(var stream = new memorystream()) { var bc = new miscutil.conversion.bigendianbitconverter(); using(var br = new miscutil.io.endianbinarywriter(bc,stream)) { log ("magic num: {0}",(int64)0x41727101980); br.write (0x41727101980); br.write((int32)0); br.write ((int32)random.next()); ...

java - Serialize a DOM document in UTF-8 -

i have been trying rid of com.sun.org.apache.xml.internal packages in code replacing them stable alternatives. this 1 method i've replaced... import com.sun.org.apache.xml.internal.serialize.lineseparator; import com.sun.org.apache.xml.internal.serialize.outputformat; import com.sun.org.apache.xml.internal.serialize.xmlserializer; ... ... /** * @param source * @param target * @throws ioexception */ protected static void serialize( document source, writer target ) throws ioexception { outputformat outputformat = new outputformat( (document) source ); outputformat.setlineseparator( lineseparator.windows ); // format.setindenting(true); outputformat.setlinewidth( 0 ); outputformat.setpreservespace( true ); xmlserializer serializer = new xmlserializer( target, outputformat ); serializer.asdomserializer(); serializer.serialize( source ); } // end serialize this alternative f...

javascript - How to scroll within an overflow hidden div to a certain currently invisible element? -

i have list of elements within overflow hidden div. not elements visible. now, if element gets activated, should become visible within div. how scroll active element using jquery? it's merely convenience last element has active class. toggled dynamically. var scrolltoel = $("div.element.active"); console.log(zoomtoel); #main, #sidebar { height: 200px; } #wrapper { width: 190px; float: left; background: grey; overflow: auto; overflow-x: hidden; } #sidebar div.element { height: 150px; width: 150px; background-color: green; margin-bottom: 10px; } #sidebar div.element.active { background-color: red; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="main"> <div id="wrapper" class="sidebar"> <div id="sidebar"> <div class="element" data-slide...

android - Handler meaning -

i think handlers in android tools different objects in thread , move thread example ui thread in android. true? sorry knowledge :) thanks! from documentation , a handler allows send , process message , runnable objects associated thread's messagequeue. each handler instance associated single thread , thread's message queue. when create new handler, bound thread / message queue of thread creating -- point on, deliver messages , runnables message queue , execute them come out of message queue.

javascript - jQuery Mobile - why bind defaults to mobileinit? -

i'm using jquery mobile , want turn of ajax handling because funky stuff page. started with <script src="jquery..."></script> <script src="jquerymobile..."></script> other stuff... own code: <script src="config.js"></script> other javascript files... my idea define global stuff libraries @ top, , specifics @ bottom rendered later , "overwrite" global properties. example, own css override jquery's css, , config file do: $.mobile.ajaxenabled = false; which disabled ajax handling. however, http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html says overwrite defaults in config file before jquery mobile src 'd, funky notation: (from page) <script src="jquery.js"></script> <script src="custom-scripting.js"></script> <script src="jquery-mobile.js"></script> //custom-scripting.js $(document).bind("mobileinit...

java - Making copied images all rotate independently -

i think issue has deep vs. shallow cloning, have not worked before, , cannot seem understand reading articles(you can tell i'm not professional programmer). small game making , when shoot bullet, rotate as velocity vector traveling in. works fine, , bullets rotate, rotate together, , not independently. i'm unsure how can each have own rotation. if can point me in right direction, i'd appreciate it. source: https://github.com/vynlar/point-and-click-shooter thanks, vynlar since using resource manager, transforms performed on image remain update cycle. have transform, draw, draw next item, update cycle. rotating 1 image under one

ios - ZoomingPDFViewer example error -

i'm trying develop app can show pdf file. try complete zoomingpdfviewer http://developer.apple.com/library/ios/#samplecode/zoomingpdfviewer/introduction/intro.html#//apple_ref/doc/uid/dts40010281-intro-dontlinkelementid_2 code in apple library. when mix code code function doesn't work. , if make same code (don't mixed) app throw error: * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uiview setpdfpage:]: unrecognized selector sent instance 0x6a833f0' i'm in sdk 5.0 requirements says should compile in sdk 5.1 sample runs perfect, problem in project don't know error. i'll appreciate if can me strange error. check class setting in storyboard. view controller -> custom class: zoomingpdfviewerviewcontroller , scroll view -> custom class: pdfscrollview the second setting cause of error.

ruby on rails - Jquery Lightbox Like Facebook and Google + Photo Viewer -

i have no found solutions yet i have rails 3 website has image gallery. each image has comments i want load image, , comments fancybox or lightbox , display comments facebook, , google + what best way achieve this. i have played little lightboxme , came simple example on how make it. notice have implement styling , flow changing 1 image another. http://jsfiddle.net/ekuhh/1/

java - Navigator Add options of jqgrid using struts2-jquery tag? -

i using jqgrid (struts2-jquery tag).what default parameters navigator add options in sjg:grid tags some options found were navigatoraddoptions="{height:250,width:500,reloadaftersubmit:true,aftersubmit:servererrorcheck,addcaption:'add holiday',beforesubmit:valsetup,beforesubmitform:callme,closeafteradd:true}" what other options in navigator add ??? i think jquery grid wiki helpful.

java ee - Spring security domain ACL integration with EJB3 -

i building application has services (ejb3 stateless session beans & hibernate4) layer & client web layer (spring mvc) residing on different physical servers. client service layer services.all data access done @ service layer . spring security used authentication @ web application layer. 1) there way share logged in user details service layer ejb application? 2) best option authorize data acces? there way integrate spring security domain object security acl's ejb3? appreciate time & answers ..

php - Display a css class based on a given db record -

i'm using yii i'm trying understand logic implement this, if not yii proficient use help. we have event types names may containing special characters like: "amça" "Áli Çulo" etc... i cannot simple grab names , call statically model on view display those, because invalid css class. the model: /** * @desc event type name normalized. * @param int $id * @return object */ public function geteventtypename($id) { return normalizer_normalize(self::model()->findbypk($id)->name); } the view: <p class="event-resume-<?= function_exists('normalizer_normalize') ? eventtype::geteventtypename($data->event->type) : '';?>"></p> i've tried user normalizer_normalize but, doesn't work "Áli Çulo" due space between words. the logic issue: we can create method says: if id 1 return constant string named "nameoftype1" if id 2 return constant string named "...

c - Default case in a switch condition -

i have code: #include<stdio.h> int main() { int a=10; switch(a) { case '1': printf("one\n"); break; case '2': printf("two\n"); break; defalut: printf("none\n"); } return 0; } the program doesn't print anything, not none . figured out default had typo defalut ! want know why syntax error not detected compiler. defalut label in program can jump goto . having editor highlights keywords have made error easier spot. i should note program may have logic errors. character '1' not same 1 , , same '2' , 2 .

php - Parsing SOAP response -

calling web service controller: $client = new \soapclient("http://.../webservice/name_of_page.asmx?wsdl"); $result = $client->estadohabitacionesfechas(); i this: <xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="newdataset"> <xs:element name="newdataset" msdata:isdataset="true" msdata:maindatatable="tablaestadohabitacion" msdata:usecurrentlocale="true"> <xs:complextype> <xs:choice minoccurs="0" maxoccurs="unbounded"> <xs:element name="tablaestadohabitacion"> <xs:complextype><xs:sequence> <xs:element name="idhabitacion" type="xs:int" minoccurs="0"/> <xs:element name="fechaentrada" type="...