Posts

Showing posts from 2014

History.js vs. window.history for HTML5-only mode -

does history.js offer substantial advantages on html5's window.history nowadays? we're not interested in supporting/falling html4 hashbang urls. history.js doesn't support anchors in pushstate() , while window.history does. need feature if there no big reasons use history.js instead of native window.history in html5-only mode, we'd rather go latter. yes - on website say: provide cross-compatible experience html5 browsers (they implement html5 >history api little bit differently causing different behaviours , bugs - >history.js fixes ensuring experience expected / same / great throughout >the html5 browsers) those differences small, , googling wasn't enough find them - had in source code - seems main 1 fixing html5 functionality in safari. there 2 problems safari implementation - 1 history.back fails return hash state set location.hash susequently replaced history.replacestate. the second when busy safari fail apply state changes.

python - How to sort list within a list? -

this question has answer here: how sort list of lists specific index of inner list? 6 answers i want sort list based on first item such as: fruits = \ [['mango', 6, 5, 8.0], ['banana', 2.0, 5, 8.9, 7], ['pineapple', 4, 6.8, 9], ['apple', 3.9, 6, 7, 2]] to sorted out this: fruits = \ [['apple', 3.9, 6, 7, 2], ['banana', 2.0, 5, 8.9, 7], ['mango', 6, 5, 8.0], ['pineapple', 4, 6.8, 9]] i know have use sort() function don't know how use in right way produce outputs want. what problem exactly? sort() sorts first element. in [14]: fruits = [["mango", 6,5,8.0], ["banana", 2.0,5,8.9,7], ["pineapple", 4,6.8,9], ["apple", 3.9,6,7,2]] in [15]: fruits.sort() in [16]: fruits out[16]: [['apple', 3.9, 6, 7, 2],

sql - function that will only insert Monday-Friday? -

i've created function insert customer database, wondered if possible make except inserts on monday friday days @ how done in oracle sql? here code function running , works function create_customer( country in varchar2 ,first_name in varchar2 ,last_name in varchar2 ,birth_date in varchar2 ,customer_type in varchar2 ,address in varchar2 ) return varchar2 new_customer_id varchar2(8); begin select custid_seq.nextval new_customer_id dual; insert customer (customer_id, country, first_name, last_name, birth_date, customer_type, address) values (new_customer_id, country, first_name, last_name, birth_date, customer_type, address); total_customers := total_customers + 1; return (new_customer_id); end; anyone got idea how develop or if possible? thanks you want insert statement run on weekdays? if so, can check day of weeks using to_char(sysdate,'d') it returns numbers 1-7(sunday saturday). based on can decide whe

internet explorer - jQuery and JSON vs IE - SCRIPT5007: Unable to get value of the property -

i'm struggling script working. it's simple ajax call retrieve data php returns json code. function refreshwindows(){ if(ajaxpull && ajaxpull.readystate != 4){ ajaxpull.abort(); } ajaxpull = $.ajax({ type: 'post', url: $path, data: { ajax: true, mode: 'update', to: math.round(currentdate.gettime() / 1000), from: math.round(previousdate.gettime() / 1000) }, datatype: "json", success: function (data) { alert(data); //that's debug $replies = data.updates; $.each($replies ,function(group,value) { if (value!=''){ $("#group"+group+" .content").append(value); $("#group"+group+" .content").stop().animate({ scrolltop: $("#group"+group+" .content")[0].scrollheight }, 800); if (!$("#group"+group+" .window").is(':vi

unable to send email through PHP with POP3 -

i have completed writing php code in order send email pop3. every time being faced error [error] => connecting pop3 server raised php warning: [errno] => 2 [errstr] => fsockopen() [function.fsockopen]: unable connect pop3.yahoo.com:465 (a connection attempt failed ) smtp -> error: failed connect server: connection attempt failed because connected party did not respond after period of time, here code. <?php require_once('/class.phpmailer.php'); require_once('/class.pop3.php'); // required pop before smtp $pop = new pop3(); $pop->authorise('pop3.yahoo.com',465,10, 'arsalansherwani@yahoo.com', '******',1); $mail = new phpmailer(); $msg='name'; //$body = file_get_contents('contents.html'); //$body = eregi_replace("[\]",'',$body); $address='arsalanjawed619.com'; $mail->issmtp(); $mail->smtpdebug = 1; $mail->host = 'p

html - How to use srcset image attribute? -

just came know srcset attribute. trying run without success. expect see @ least 1 image loading in when run on google chrome iphone or ipad nothing displayed. <img srcset="img1.png 1x low-bandwidth, img2.png 2x high-bandwidth"> according w3c , srcset attribute still in draft status. means not yet recommended use because specification can still change , web browsers not expected implement already. by way, note low-bandwidth , high-bandwidth not part of current draft. because it's hard find objective definition of "low" , "high" bandwidth still reasonable in ten years.

sql - How to find the difference between 2 rows -

table1 id no name value 001 grid1 rajan 200 001 grid2 rajan 300 002 grid1 mahesh 100 002 grid2 mahesh 200 003 grid1 jayan 200 003 grid2 jayan 50 i want find difference (grid1 - grid2) each id expected output id name value 001 rajan -100 002 mahesh -100 003 jayan 150 how make query above condition need query help select id, name, sum(case when no = 'grid1' value else value*(-1) end) table1 group id, name see sql fiddle demo

mysql - Faster updates on database? -

we trying move our databases (mysql) amazon redshift (data warehouse), , facing problem while updating warehouse db. have enabled general logging on our db , replaying these queries general log on redshift. updates queries taking around 6-7 secs. looking way execute these updates @ faster speed? amazon redshift internally uses postgre db, , it'll great if has resolved problem redshift/postgre can suggest solution. although general approach make updates faster helpful. 1 solution have tried merging updates set of deletes , inserts. updates on single table transform single delete query combined clauses , single batch insert query. either provide alternative solution or comment on solution tried? redshift not intended used 'regular' database - data should inserted using copy command (or create table syntax) use selects. operations on single rows (like inserting or updating) not database optimised for. proposed workaround (using delete/insert) instead of updat

c - Why does incrementing a void pointer by 1 moves one byte ahead but it's 4 bytes for an integer pointer,8 for double? -

this question has answer here: pointer arithmetic void pointer in c 7 answers in following program,if add 1 void pointer, moves 1 byte ahead.but,quite expected, moves 4 , 8 bytes respectively int , double pointers.why void pointer move 1 byte,just character pointer would? #include<stdio.h> int main(void) { int num=3,*int_ptr=&num; double sum=3,*double_ptr=&sum; void *void_ptr1=&num,*void_ptr2=&sum; printf("%p,%p,%p,%p,%p,%p,%p,%p",void_ptr1,void_ptr1+1,\ void_ptr2,void_ptr2+1,int_ptr,int_ptr+1,double_ptr,double_ptr+1); } you can't pointer arithmetic on void pointer (because doesn't make sense). it's compiler has extension allows pointer arithmetic performed on void pointers, , it's implemented this. however, neither standard nor encouraged used.

c# - OrmLite pattern for static methods in business logic -

for web-based (asp.net) environment, best way design base service class using ormlite (for factory , connection), such business logic classes (derived base class) can support static methods database operations? sample business logic class: public class jobs : service { public static job get(int jobid) { return db.id<job>(jobid); } } i want reduce code repetition (for ormlite factory , connection handling) , support static methods. i'm not sure if making idbconnectionfactory , idbconnection objects static in base service class sufficient. i've looked @ similar question ( servicestack + ormlite + repository pattern ) addresses issue non-static methods.

sql - How to get data from three or more tables -

i need display distinct data between 3 tables. how requirement. firsttable: 9999999999 8888888888 7777777777 6666666666 5555555555 secondtable: 7777777777 9999999999 thirdtable: 8888888888 i want output in format. 6666666666 5555555555 use left join select t1."col" table1 t1 left join table2 t2 on t1."col" = t2."col" left join table3 t3 on t1."col" = t3."col" t2."col" null , t3."col" null output: | col | -------------- | 6666666666 | | 5555555555 | see sqlfiddle

How to use Saxon(XSLT 2.0 processor) in eclipse indigo with JAVA -

i have use xslt 2.0 processor string manipulation functions replace() . have added dependency saxon in pom file , ran "mvn install" command. doing "saxon-9.1.0.8.jar" added under "referenced libraries" folder. in code have used system.setproperty("javax.xml.transform.transformerfactory", "net.sf.saxon.transformerfactoryimpl"); when try call following line transformerfactory.newinstance("net.sf.saxon.transformerfactoryimpl", null); getting error saying javax.xml.transform.transformerfactoryconfigurationerror: provider net.sf.saxon.transformerfactoryimpl not found. if try call new net.sf.saxon.transformerfactoryimpl(); , error java.lang.noclassdeffounderror: net/sf/saxon/transformerfactoryimpl please let me know if missing in configuring saxon eclipse indigo. please make sure have included saxon jar in build path. in source code following lines should work: system.setproperty("javax.xml.transform.

mule - Message payload is of type: String -

i try test transforming data in flow example in page : " http://www.mulesoft.org/documentation/display/current/transforming+data+in+a+flow " but error on browsers : component caused exception is: defaultjavacomponent{hellowflow1.commponent.30555765}. message payload of type: string the exact message in console of mule studio : error 2013-05-01 12:39:19,067 [[configureendpoint].connector.http.mule.default.receiver.04] org.mule.exception.defaultmessagingexceptionstrategy: ******************************************************************************** message : failed find entry point component, following resolvers tried failed: [ callableentrypointresolver: object "nametransformer{this=4146a7, name='null', ignorebadinput=false, returnclass=simpledatatype{type=java.lang.object, mimetype='*/*'}, sourcetypes=[]}" not implement required interface "interface org.mule.api.lifecycle.callable" methodheaderpropertyentrypointresolver: requ

Bash - Return value from subscript to parent script -

i have 2 bash scripts. parent scripts calls subscript perform actions , return value. how can return value subscript parent script? adding return in subscript , catching value in parent did not work. i assuming these scripts running in 2 different processes, i.e. not "sourcing" 1 of them. it depends on want return. if wish return exit code between 0 , 255 then: # child (for example: 'child_script') exit 42 # parent child_script retn_code=$? if wish return text string, have through stdout (or file). there several ways of capturing that, simplest is: # child (for example: 'child_script') echo "some text value" # parent retn_value=$(child_script)

list - create a python dictionary based on another dictionary -

i have the following dict contains following data: response = {"status":"error","email":"email_invalid","name":"name_invalid"} i trying create new dict based on 'response' suposed following: {'api_error': {'list': [{'converted_value': 'no special characters allowed.', 'field': 'name', 'value': 'name_invalid'}, {'converted_value': 'invalid email', 'field': 'email', 'value': 'email_invalid'}], 'status': 'error'}, 'email': 'email_invalid', 'email_label': 'invalid email', 'name': 'name_invalid', 'name_label': 'no special characters allowed.', 'status': 'error'} so f

cakephp - How to avoid accessing one app controller from another app -

i have 2 cakephp directory in server in separate path . cakephp application 1 located in /var/www/html/app1/v11/. application can accessed via http://example.com . cakephp application 2 located in /var/www/html/ app2/ v12/app. application can accessed via sub.example.com/app2 . cakephp app 2 having controllers/models/views of cakephp app 1 excepted 2 new controllers. when accessing sub.example.com/app2/comps/list url , shows undefined error notice (8): undefined variable: res [app/controller/compscontroller.php, line 681] code context $stack = array() compscontroller::trending() - app/controller/compscontroller.php, line 681 reflectionmethod::invokeargs() - [internal], line ?? controller::invokeaction() - /var/www/html/app1/v11/lib/cake/controller /controller.php, line 488 dispatcher::_invoke() - /var/www/html/app1/v11/lib/cake/routing/dispatcher.php, line 103 dispatcher::dispatch() - /var/www/html/app1/v11/lib/cake/routing/dispatcher.php, line 85 [main] - a

Error creating glassfish as a service -

trying do: asadmin create-service and getting: error while trying install glassfish windows service. return value was: 8. stderr: stdout: wmi.wmiexception: unknownfailure @ wmi.wmiroot.basehanderl.checkerror(managementbaseobject result) @ wmi.wmiroot.classhandler.invoke(object proxy, methodinfo method, object[] ags) @ wmi.win32servicesproxy.create(string, string, string, servicetype, errorcontrol, startmode, boolean, string[]) @ winsw.wrapperservice.run(string[] args) @ winsw.wrapperservice.main(string[] arges command create-service failed trying create glassfish service start glassfish @ windows boot (with war file in auto-deploy folder start application asap.) do have more 1 domain in domain directory? if must specify name of domain noted in asadmin create-service documentation

java - String.split(".") is not splitting my long String -

i'm doing following: string test = "this a. example"; string[] test2 = test.split("."); the problem: test2 has no items. there many . in test string . any idea problem is? note public string[] split(string regex) takes regex . you need escape special char . . use string[] test2 = test.split("\\."); now you're telling java: " don't take . special char . , take regular char . ". note escaping regex done \ , in java, \ written \\ . as suggested in comments @oldcurmudgeon (+1), can use public static string quote(string s) " returns literal pattern string specified string ": string[] test2 = test.split(pattern.quote("."));

android - List of actions that uses WRITE_SECURE_SETTINGS -

i trying make toggle widget (like control one) i've seen many of things wanted needs write_secure_settings permission (like gps, airplane mode 4.2+...). so, there place can check actions needs permission? have tried looking @ official android docs on manifest permissions? https://developer.android.com/reference/android/manifest.permission.html (sent phone)

eclipse - creating dependencies with other existing projects -

this third various post same subject! actually, have 3 spring maven-based project: let's name them projecta, projectb , projectc. of them compose same , unique project named myproject. have no problem projecta coz compiles , built importing in eclipse, both other, have real problem:projectb can't built because first, depends on projecta, second gets jlibrtp , xuggler jar dependencies. in pom file, these dependences declared maven can't built it; error message these: missing artifact projecta:jar missing artifact xuggle-xuggler ... projectc depends on both , 1 file contained in 1 pom file.so same error messages there. spent long time trying resolve i'm out of skills now, me resolve problem. if think better explain more, i'll it, make me aware. thank you!

jquery - take several values from textboxes -

im using mvc 3.0 .net 4.0, razor , kendo ui framework. i have tree textboxes , need take values each 1 , passing mvc controller. i cannot receive values textboxes. ie: file.cshtml <input type="text" id="tb0" /> <input type="text" id="tb1" /> <input type="text" id="tb2" /> <button type="submit" id="btnsave">send</button> jsfile.js $('#btnsave').click(function (e) { e.preventdefault(); var variable1 = new array(); //i dont know how send values controller variable1[0] = $('#tb0').val(); variable1[1] = $('#tb1').val(); variable1[2] = $('#tb2').val(); var model = { representative1: variable1 } $.ajax({ url: rootfolder + 'controller1/method1', type: 'post', data: json.stringify(model), datatype: 'json', processdata: false, contenttype: 'applicatio

android - Set the Textview size respective to the device screen size -

this question has answer here: text size , different android screen sizes 6 answers i searching long not successful . have came across issue many times somehow managed giving fixed sizes . but there method , textview size increases depending on device screen size . as far , using below code , facing sort of issue . want set larger size textappearancelarge in below code . <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_conten

sitecore6 - How to abort saveui pipeline in Sitecore and then reset values? -

i trying implement saveui pipeline processor in sitecore 6. have created custom processor presents user popup message depending on fields may have changed on item , new data is. if made changes presented popup asking them if want continue. if answer no pipeline aborted. working. noticed when abort pipeline sitecore seems not save. of changes user made content item still there in ui. if navigate away item in sitecore, prompt if want save changes. there way can sitecore ui cancel of changes , revert of fields initial values? aborting pipeline because don't want save, want cancel save in ui too. know how this? sample code: public class customsaveprocessor { public void process(saveargs args) { sitecore.diagnostics.assert.argumentnotnull(args, "args"); if(args.items == null) { return; } if(args.ispostback) { if(args.parameters["runcontext"] == "firstquestion") { if((args.result == null) || (arg

varnish - Regex to match host request -

given vcl code in varnish 3.0.2: sub vcl_recv { if (req.http.host !~ "^(?i)(www|m|mobile)\.example\.com$" || req.http.host !~ "^(?i)example\.com$") { error 403 "forbidden"; } return(lookup); } can explain why i'm getting 403s on "www.example.com"? thanks i don't know varnish , syntax, interpret || logical or . www.example.com not match second alternative ==> true , enter if . probably wanted logical and ? if both not true, 403? so try: if (req.http.host !~ "^(?i)(www|m|mobile)\.example\.com$" && req.http.host !~ "^(?i)example\.com$") { error 403 "forbidden"; }

c# - Reading value removes characters in JSonNet -

i'm trying read date time string jvalue gets changed read.. { "updated": "2012-12-12t00:00:00z", } json["updated"].value<string>() = 12/12/2012 00:00:00 the above json string found when inspect json object. ideas why it's doing this? it's resolving datetime internally , doing datetime.tostring. try json["updated"].value<datetime>().tostring("your format")

java - solr.extraction.ExtractingRequestHandler ClassNotFoundException -

i working on internal project in company requires solr, not manage link tika. bought apache solr 4 cookbook yet couldn't figure out solution. i copied required jar files lib directory i added lib directory in solrconfig.xml when remove start="lazy" in requesthandler="update/extract" following error: org.apache.solr.common.solrexception: requesthandler init failure ... ... caused by: org.apache.solr.common.solrexception: requesthandler init failure ... ... caused by: org.apache.solr.common.solrexception: error loading class 'solr.extraction.extractingrequesthandler' ... ... caused by: java.lang.classnotfoundexception: solr.extraction.extractingrequesthandler make sure have apache-solr-cell jar , dependencies in extraction lib in solr library , being loaded solr when solr starts. <lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" /> <lib dir="../../contrib/extraction/lib" />

Cannot deserialize previously serialized XML with c# xmlserializer -

i have use externally given xml structure (huge). use xsd tool of visual studio generate classes should (de)serialized using xmlserializer. since switched vs2010 vs2012 (but still targeting .net 4.0), have problems deserializing xml. broke down following code: using system.io; using system.xml; using system.xml.serialization; using microsoft.visualstudio.testtools.unittesting; /// <remarks/> [system.codedom.compiler.generatedcodeattribute("xsd", "4.0.30319.1")] [system.serializableattribute] [system.diagnostics.debuggerstepthroughattribute] [system.componentmodel.designercategoryattribute("code")] [xmlrootattribute("decoderparameter", namespace = "", isnullable = false)] public class decoderparametertype { private string[] decoderupdatepointsfield; /// <remarks/> [xmlattributeattribute(datatype = "integer")] public string[] decoderupdatepoints { { return thi

c++ - Best practice for using the 'volatile' keyword in VS2012 -

since upgrading our development , build environments vs2008 vs2012, confused implications of using volatile keyword in our legacy codebase (it's quite extensive there copied pattern managing threads "old" days). microsoft has following remarks in vs2012 documentation: if familiar c# volatile keyword, or familiar behavior of volatile in earlier versions of visual c++, aware c++11 iso standard volatile keyword different , supported in visual studio when /volatile:iso compiler option specified. (for arm, it's specified default). volatile keyword in c++11 iso standard code used hardware access; not use inter-thread communication. inter-thread communication, use mechanisms such std::atomic<t> c++ standard template library. it goes on say: when /volatile:ms compiler option used—by default when architectures other arm targeted—the compiler generates code maintain ordering among references volatile objects in addition maintaining ordering refe

c# - get foreach sequence number on an array -

i have array s[],i'm setting with: string [] s; s = data.split(','); after can getting elements s foreach: foreach (string c in s) { list.items.add(c); } but want write seqeunce of c near c value i.e it'll show in list: 0 hello 1 world 2 earth i'm not using counter in foreach,is there way? you have use counter. can use 1 in foreach, or use for loop , use counter. edit: if start empty list could use list.items.count in loop print current count of items in list although really not way that. // ugly foreach (string c in s) { list.items.add(list.items.count + " " + c); }

Location of has_capability() method in Moodle -

i trying understand access control in moodle. want have @ definition of method has_capability() in project. has idea in file can find definition of method? as said, it's in file called accesslib.php under server -> moodle -> lib . adding little more info that, has_capability() 1 of important function of moodle , checks whether user has particular capability in given context. function has_capability($capability, context $context, $user = null, $doanything = true) more info on can found here .

android - StartActivity wont work from onclick event -

i'm trying log in facebook , pass user's info activity problem when run startactivity method intent onclick event gets freeze's , doesn't anything i created class implements serializable holds couple of strings then when user log in facebook create instance of class can pass on other activity heres code: session.openactivesession(me, true, new statuscallback() { @override public void call(session session, sessionstate state, exception exception) { if(session.isopened()) { request.executemerequestasync(session, new request.graphusercallback() { @override public void oncompleted(graphuser user, response response) { if(user!=null) { graphlocation location= user.getlocation();

php - Phpdocx word documents are corrupt when adding images -

i'm using phpdocx 2.5 convert html docx. i'm using embedhtml method 'downloadimages' parameter set true; when html doesn't contain images, document generated fine. when images added, resulting document seems corrupt. details of errors show standard "file corrupt , cannot opened" message. however, word displays "do want recover content" message if clicked, displays content (with images) fine. content seems rendered correctly there issue somewhere causes word see document corrupted. had problem or can give me ideas how solve this? thanks in advance.

submit - Multiple Form Actions to different pages / different target windows -

i have form on page needs have multiple form actions associated it. i'm using following script in conjunction following code achieve this: <script> function submitform(action) { document.getelementbyid('summary').action = action; document.getelementbyid('summary').submit(); } </script> <form action="go-gold.php" method="post" enctype="multipart/form-data"> <input type="image" id="arrow" name="go_back" onclick="submitform('go-gold.php')" value="go_back" src="images/arrow_back.png" class="submit_button" /><br> <input type="image" id="arrow" name="submit_form" onclick="submitform('registration.php')" value="submit_form" src="images/arrow.png" class="submit_button" /> </form> the first button needs "go

objective c - CouchDb views not updating -

okay i'm using couchdb v 1.2.0 scheme application objective-c. when run program i'm deleting old version of database , creating new 1 this: couchdb *couchdb = [[couchdb alloc]init]; //deleting old version of db if exists xcode demo [couchdb deletedb:@"timevault" oncomplete:^(nsstring *message) { nslog(@"%@", message); }]; //creating new db [couchdb createdb:@"timevault" oncomplete:^(nsstring *message) { nslog(@"%@", message); }]; //creating views students , courses nsstring *viewcourses = @"function (doc) { if (doc.type === \"course\") { emit(doc._id, doc); } }"; nsstring *viewstudents = @"function (doc) { if (doc.type === \"student\") { emit(doc._id, doc); } }"; nsdictionary *views = @{@"views": @{@"courses": @{@"map":vi

cygwin - How do I run an desktop executable file on Windows over SSH? -

here's situation: have machine - linux box, , machine b - windows box using cygwin , openssh. currently, can ssh between 2 machines, , run programs. there program need run on windows machine control desktop (some mouse clicks , such). i need able ssh windows machine linux machine (done already) , run program. when this, program hangs up. can see program in system processes on windows, doing nothing. when call program on cygwin on windows machine, runs flawlessly. my question: is there way run executable program on windows machine controls desktop environment - run remotely on ssh? ps: have tried on windows machine go services > cygwin sshd > log on > allow services interact desktop. however, when checked can't cygwin sshd service started.

ios - MKOverlayView and changing its alpha -

i have custom mkoverlay , mkoverlayview . when mkoverlayview created, can set alpha of view: -(void)drawmaprect:(mkmaprect)maprect zoomscale:(mkzoomscale)zoomscale incontext:(cgcontextref)context { datasetoverlay *datasetoverlay = (datasetoverlay *)self.overlay; uiimage *image = [uiimage imagewithdata:datasetoverlay.imagedata]; cgimageref imagereference = image.cgimage; mkmaprect themaprect = [self.overlay boundingmaprect]; cgrect therect = [self rectformaprect:themaprect]; cgcontextscalectm(context, 1.0, -1.0); cgcontexttranslatectm(context, 0.0, -therect.size.height); cgcontextsetalpha(context, 1); cgcontextdrawimage(context, therect, imagereference); } but want able change alpha of view after draw. how can that? i have not worked core graphics yet. -(void)drawmaprect:(mkmaprect)maprect zoomscale:(mkzoomscale)zoomscale incontext:(cgcontextref)context { dlog(@"fired"); datasetoverlay *datasetoverlay = (

xml - exclude match based on node list -

first question on here bear me... i'm confined xslt 1.0 via our cms :-/ trying create sitemap parsing xml xsl. but, need exclude several directories being displayed , don't want clutter syntax long piped| test statement.... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> **<!-- have tried param -->** <xsl:variable name="ppaths"> <n>/docs</n> <n>/files</n> </xsl:variable> <xsl:if test="not( starts-with(path, $ppaths) )"> <url> <loc>http://www.domain.com<xsl:value-of select="path"/></loc> <changefreq>monthly</changefreq> </url> </xsl:if> in code above, if there 1 'n' element excludes properly. however, adding 2nd 'n' stops working entirely. i&

asp.net mvc - MVC: Application has no errors but returns a blank page in IE -

sorry if not specific. not make more specific not understand issue i have mvc application ran well, , published it. after modifying it, when try run on local, following error in chrome: server error. webpage @ http://localhost:63178 unavailable. may overloaded or down maintainance. , ie returns blank page i tried return content("test") on index controller no avail. there no error in code, cannot run. other application projects work fine. i have tried putting break point in application_start break points never hit. other projects work fine, one. edit : here system.web section of web.config <system.web> <compilation debug="true" targetframework="4.5" /> <authentication mode="forms"> <forms loginurl="~/account/logon" timeout="2880" /> </authentication> <pages> <namespaces> <add namespace="system.web.helpers" /> <add namespace=

cakephp - Redirect without changing the url -

how can redirect without changing url? i use this: $this->redirect('/lojas/index'); or this: $this->redirect(array('controller' => 'servicos', 'action' => 'index')); but these 2 forms url changes. need continue same before redirect. anyone have idea how solve? i got retrieving session variable in file routes, , using variable "name" in url. app::uses('cakesession', 'model/datasource'); $sessao = cakesession::read('loja'); router::connect( "/".$sessao['storename'], array('controller' => 'lojas', 'action' => 'index'));

java - JAAS configuration from Tomcat to Glassfish -

i understood 3 jaas elements: jaas client login module jaas config file but confused where/how change tomcat context glassfish context. current tomcat context : <context path="/admin/sso" reloadable="true"> <realm classname="org.apache.catalina.realm.jaasrealm" appname="bytesloungelogin" userclassnames="test.jaas.userprincipal" roleclassnames="test.jaas.roleprincipal" /> </context> i found glassfish's jdbcrealm , ldaprealm classes there no jaasrealm class. the configuration of glassfish differing tomcat , not find jaasrealm class. link: http://glassfish.java.net/javaee5/security/faq.html#pluglogin : the glassfish authentication subsystem built upon realm , standard java jaas framework - can write own realm , jaas login module, , plug glassfish. in current implementation of glassfish, realm , jaas module needs derived com.sun.appserv.security.appservrealm , com.su

css3 - -moz-box-flex is not flexing? Works with (Chrome/Webkit) -

i have been looking past 8 hours or trying find possibly missed in html/css code, yet firefox not flex page content? works in chrome (i've been making sure each -webkit-box-flex there -moz-box-flex vice versa). there i'm missing? time , appreciated! * {margin: 0px; padding: 0px; } body {width: 100%; height: 1000px; display: -webkit-box; display: -moz-box; display: box; -webkit-box-pack: center; -moz-box-pack: center; box-pack: center; background-color: #696969; background-image: url(squairy_light.png); background-repeat: ; background-position:; } header, footer, article, nav, section, hgroup, aside {display: block; } #banner {display: block; margin-left: auto; margin-right: auto; padding: 30px 0px 0px 0px; } #fullpage_box {max-width: 1000px; display: -webkit-box; display: -moz-box; display: box; -webkit-box-orient: vertical; -moz-box-orient: vertical;

php - Strange foreach loop after modifying array -

as wrote code, php confused me little didn't expected result of following code: $data = array(array('test' => 'one'), array('test' => 'two')); foreach($data &$entry) { $entry['test'] .= '+'; } foreach($data $entry) { echo $entry['test']."\n"; } i think should output one+ two+ however result is: http://ideone.com/e5tcsi one+ one+ can explain me why? this expected behaviour, see https://bugs.php.net/bug.php?id=29992 . the reference maintained when using second foreach, when using second foreach value of $entry , points still $data[1] , overwritten first value. p.s. (thanks @billyonecan saying it): need unset($entry) first, reference destroyed.

Getting pointer to COM object in java -

i looking @ how pointer com object in java can pass pointer on native dll. at moment have been using jacob java com bridge, not notice how pointer actual com object pass native dll function call. i have used java native access (jna) rather jni calling dll functions , have noticed jna seems have stuff working com. have 2 related questions on jna com support: how com support of jna work, ready use in projects? there tutorial on using jna com support documentation com support limited , not sure how should using it. i guess there third question relating jna , com, allow me pointer com object , pass native dll c type function? guessing yes inheritence of objects com stuff work making standard native dll calls jna, want clarify that. finally, while have asked jna possible solution have found, open other possibilities, although prefer use jna calling native dll functions rather using jni.

delphi - Why does the compiler warn when overloading an abstract method introduced in the base class? -

i have code this: tbaseclass = class(tobject) protected procedure amethod(const s:string);virtual;abstract; end; tderivedclass = class(tbaseclass) protected procedure amethod(const s:string);overload;override; procedure amethod(const s:string;const x:integer);overload; end; compiler generates warning: [dcc warning].... w1010 method 'amethod' hides virtual method of base type 'tbaseclass' clicking on warning sends me 'amethod(const s:string;const x:integer);' since not marked override directive. however, method cannot marked override: no method signature exists in base class, , adding override directive method causes compiler error: [dcc error].... e2037 declaration of 'amethod' differs previous declaration. this obvious, since no method signature exists in tbaseclass. only 'amethod(const s:string)' exists in base class, , method marked 'override' - so nothing in base class being hidden @ all. why not err

Connect to a Cisco switch with SSH and Ruby -

Image
i'm trying connect cisco switch ssh , ruby. problem need enter empty 'login as' ask me user name , password. on putty this: here how have tried connect net::ssh. cisco = "host" #enter ip address here user = "operacao" #enter username here pass = "" #enter password here tn = net::ssh::telnet::new("host" => cisco, "timeout" => 60, "prompt" => /^\login as:/ ) tn.cmd("\n") { |c| print c } tn.cmd("\n#{user}") { |c| print c } tn.cmd(pass) { |c| print c } tn.print("echo oi") { |c| print c } tn.close is there way ruby? i find sample here hope gives direction. before run code certify run: gem install net-ssh #!/usr/bin/env ruby require 'net/ssh' host = '192.168.1.113' user = 'username' pass = 'password' net::ssh.start( host, user, :password => pass ) do|ssh| result = ssh.exec!('ls') put

jsp - Form inheritance in Spring MVC -

i facing situation in spring mvc application have form common pages. so, took form in separate jsp page , included page in other jsp pages. form simple: <form:form method="post" commandname="coachingdomain" action="searchform"> <form:input path="coachingname" placeholder="search coaching" /> <button type="submit" value="search">search</button> </form:form> now scene when run application, server not able find binding of coachingdomain in controller. make more clear, suppose form present in page a1 , included in page a2. in a2 controller, have bind coachingdomain given below: @requestmapping(method = requestmethod.get) public string showpage(modelmap modelmap, httpservletrequest request, httpservletresponse response) { modelmap.addattribute("coachingdomain", new coachingdomain()); return "welcome"; } but bind e

IOS: NSDateFormatter for region format Italy -

i have tested app regiorn format usa , date display correct. when region changed italy live contains null value. my starter string date is: - "may 2, 2013 6:46:33 pm" the result date correct is: - "02/05/2013 18:46:33" here code: nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; dateformatter setdateformat:@"mm dd, yyyy hh:mm:ss a"]; nsdate *datefromstring; datefromstring = [dateformatter datefromstring:datastr]; [dateformatter setdateformat:@"dd/mm/yyyy hh:mm:ss"]; dateformatter.locale = [[nslocale alloc] initwithlocaleidentifier:@"en_us_posix"]; nsstring *stringfromdate = [dateformatter stringfromdate:datefromstring]; if starter string may 2, 2013 6:46:33 pm have 2 issues: your format string mm dd, yyyy hh:mm:ss a not match string. needs mmmm dd, yyyy hh:mm:ss a . use of mm numeric months. use mmm abbreviated month names , use mmmm full month names. your date string has

api - JAX-RS hostname change possible? -

i'm developing rest web service using jax-rs. can change host name "local host 8080"? also, can use https? i want name represent api host twitter "" https://api.twitter.com " or possible? jax-rs uses subset of uri path matching requests (the part relative application context). changes domain , schema (http/https) should not make difference.

python - Numpy where function multiple conditions -

i have array of distances called dists. want select dists between 2 values. wrote following line of code that: dists[(np.where(dists >= r)) , (np.where(dists <= r + dr))] however selects condition (np.where(dists <= r + dr)) if commands sequentially using temporary variable works fine. why above code not work, , how work? cheers the best way in your particular case change 2 criteria 1 criterion: dists[abs(dists - r - dr/2.) <= dr/2.] it creates 1 boolean array, , in opinion easier read because says, is dist within dr or r ? (though i'd redefine r center of region of interest instead of beginning, r = r + dr/2. ) doesn't answer question. the answer question: don't need where if you're trying filter out elements of dists don't fit criteria: dists[(dists >= r) & (dists <= r+dr)] because & give elementwise and (the parentheses necessary). or, if want use where reason, can do: dists[(np.where

java - App Engine datastore to Android listview -

i have set basic entity class in app engine backend. `@entity` `public class club {` `@id` `private int id;` `private string clubname;` `public club() {` `}` `public int getid() {` `return id;` `}` `public void setid(int id){ this.id =id; }` `public string getclubname() { return clubname; }` `public void setclubname(string clubname) { this.clubname = clubname; } }` i have generated cloud endpoint class , generated cloud endpoint library. want able populate clubname datastore listview in android not sure how this. i'm trying follow https://developers.google.com/appengine/docs/java/endpoints/consume_android far unable understand do. i'm new , greatful if lead me in right direction please. you can use below steps achieve objective: 1, mentioned in google doc on consuming cloud endpoints in android, ready app adding required libraries , make api calls , on getting data backend, can store data sql database. can ste

php - Foreach loop; Undefined index: position. Syntax appears correct though -

i'm getting undefined index: position error using code below, yet not see errors in doing. looks example on php page ( http://php.net/manual/en/control-structures.foreach.php ) : $position_list = array( 1 => "chair", 2 => "saca", 5 => "school", 0 => "disabled", ); foreach ($position_list $priv_id=>$position) { $data['position'] .= '<option value="'.$position_list[$priv_id].'"'; //throws error here if ($position_list[$priv_id] == $privilege_id) { $data['position'] .= " selected=\"selected\""; } $data['position'] .= '>'.$position.'</option>'; //throws error here } i commented code errors thrown. edit: $data['position'] whole different thing, not suppose refer position used in foreach array. edit2: more code. here @ end of php file: $page->html .= file::text_replaceme