Posts

Showing posts from March, 2012

How do I find the creation date of a document in MarkLogic? -

how find creation date of document in marklogic? i hoping find xdmp:document-creation-date(). thanks. marklogic maintain last-modified timestamp if enable in database options (i think it's enabled default), creation date need track on own. common pattern store value in attribute or in document property when document inserted.

javascript - How to animate a line in canvas -

i trying animate line using canvas. want use timelinelite handle animation. how this? know in timelinelite, timelines this: var timeline = new timelinelite(); timeline.to(target, duration, vars, position); the points exist in json file, , file correctly being brought in ajax. want line start @ points x1 & y1, keep x2, same value, , animate y2 position. want grow x1-y1 x2-y2. js function animatelines(name, stroke, width, x1, y1, x2, y2){ ctx.beginpath(); ctx.moveto(x1, y1); ctx.linewidth = width; ctx.strokestyle = stroke; ctx.stroke; console.log(x2); } for(var = 0; < animated_lines.length; i++){ animatelines(animated_lines[i].name, animated_lines[i].stroke, animated_lines[i].width, animated_lines[i].x1, animated_lines[i].y1, animated_lines[i].x2, animated_lines[i].y2); } json "animated_lines": [ { "name": "test", "stroke": "red", "width": 3, ...

c - I am able to count down to zero but i also want to be able to enter a negative number and have it count up to zero -

i trying write program allows user input number between negative 5 , positive 5 have number selected count zero. #include <stdio.h> #include <unistd.h> int main() { int start; //asking user input 1-5 { printf("need number start countdown (1 - 5): "); //receiving user input scanf("%d",&start); } //while number less number 6 while(!(start<6)); //begin countdown { printf("%d\n",start); start--; } while(start>0); //displaying number 0 when done printf("0\n"); return(0); } this should on codereview site, start have problem in initial input loop while(!(start<6)); will allow user enter value -1,234,567, needs be while(start < -5 || start > 5); that said, in simplest form need if statement if (start > 0) { // code count down } else if (start < 0) { // code count } else { print("all done"); //...

Java Beginner - Cannot find symbol- variable -

not sure whats causing error here, when enter value in string name upon creation of item. any appreciated, cause im pretty stuck @ moment public class item { double itemcode; string itemname; double itemprice; public item(){ } public item(double code, string name, double price){ itemcode = code; itemname = name; itemprice = price; } public string getcode(){ return string.valueof(itemcode); } public void setcode(double itemcode){ this.itemcode = itemcode; } public string getfirstname(){ return itemname; } public void setfirstname(string itemname){ this.itemname = itemname; } public string getprice(){ return string.valueof(itemprice); } public void setprice(double itemprice){ this.itemprice = itemprice; } public string tostring(){ return (string.valueof(itemcode) + ": " + itemnam...

C++ native use of Twitter REST API using HTTP Request -

i've been trying access twitter api in order search tweet particular hashtag. since twitter api 1.1 authentication needed so. application written in c++ , not use additionnal lib curl. here's code i've been using : std::string request="get /1.1/search/tweets.json?q=%23helloworld http/1.1\r\n" "x-hostcommonname: api.twitter.com\r\n" "authorization: oauth " "oauth_consumer_key=\"xxxxxxxxxxxx\", oauth_signature_method=\"hmac-sha1\", oauth_timestamp=\""+imtime.str()+"\", oauth_nonce=\""+imtime.str()+"\", oauth_version=\"1.0\", oauth_token=\"xxxxxxxxxxxxxxxx\", oauth_signature=\"xxxxxxxxxx\"\r\n" "host: api.twitter.com\r\n" "x-target-uri: https://api.twitter.com\r\n" "connection: close\r\n\r\n"; socket sock=socket(af_inet,sock_stream,0); if (sock==invalid_socket) {return 0; //error} sockaddr_in sin; struct in_addr a...

vba - Can I close an ActiveX combobox placed on an Excel worksheet? -

i can open combobox using object.dropdown isn't true/false scenario. i'm using force combobox display list remains on screen when switching worksheets unless manually closed or item selected. thoughts? thanks. best come select default value when sheet deactivate event triggered. default value not valid in application , tests before running report shouldn't cause me issues.

mysql - Creat individual .php?id= links for each of the products in products.php file -

on products page, there several different product grids(created bootstrap) in which, of products displayed. trying create detailed pages each of products page has. products.php: <?php session_start(); include('inc/config.php'); ?> <html> <body> content <div class="row"> <?php $query=mysql_query("select*from cars"); while($data=mysql_fetch_assoc($query)){ ?> <div class="col-md-4"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="text-center"> <?php echo "<h2>".$data['make']." ".$data['model']." </h2>"; ?></h4> </div> ...

javascript - Why can't I download zip-file in my php model if acces it from ajax script. Works fine from php link -

i have links number of images (my object contains links). want download these images in zip file. started code works well. download link in view (to controller) <a href="<?php echo url . 'album/downloadimage/' ?>" id="disablebutton" class="download-button"><span class="glyphicon glyphicon-download" aria-hidden="true"></span></span>download photos</a> my controller public function downloadimage() { $this->model->downloadimage(); } and model. model automatically start downloading zip file containing images public function downloadimage() { $imagenumber = 1; $zipname = 'name-'.date("y-m-d").'.zip'; # create new zip opbject $zip = new ziparchive(); # create temp file & open $tmp_file = tempnam('.',''); $zip->open($tmp_file, ziparchive::create); # loop through each file foreach($this->imageurl $file){...

Google Places Autocomplete plugin isnt working in Firefox android -

we using google's places-autocomplete plugin on our website. of late have received several complaints our website visitors plugin isn't working in android version of firefox. works fine in desktop version of firefox however. the problem can observed going places-autocomplete example here trying enter zip code in "enter location" search input you observe following 2 issues - google auto-complete should show suggestions start typing zip code. doesn't until 1 types space or , after 5 digit zip code. when suggestions show (after typing space or , ), can't choose first suggestion. tap on it, cursor moves search input. can choose second or third suggestion correctly. problem #2 extremely annoying , frustrating user. we've had received several complaints this. i have confirmed on firefox version 36.0.2 on samsung s4 running android 4.4.2. how can resolved? a work around second issue give first autocomplete suggestion top mar...

sorting - Printing a dictionary in python with n elements per line -

given .txt 200,000 lines of single words, need count how many times each letter appears first letter of word. have dictionary keys 'a' - 'z', counts assigned each of values. need print them out in form a:10,978 b:7,890 c:12,201 d:9,562 e:6,008 f:7,095 g:5,660 (...) the dictionary prints this [('a', 10898), ('b', 9950), ('c', 17045), ('d', 10675), ('e', 7421), ('f', 7138), ('g', 5998), ('h', 6619), ('i', 7128), ('j', 1505), ('k'... how remove brackets & parentheses , print 5 counts per line? also, after sorted dictionary keys, started printing key, value instead of key:value def main(): file_name = open('dictionary.txt', 'r').readlines() alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'h', 'i', 'j', 'k', 'l', 'm', 'n', ...

c# - WCF Client Extensibility: IParemeterInspector.AfterCall and exception handling -

for wcf client, i'd able pre , post work every operation of given endpoint. the pre work make use of operation name , input arguments . the post work make use of (again) operation name , original input arguments outputs / return value or exception occurred. given this, iparameterinspector (with beforecall , aftercall ) gives me almost need. problem that in case of exception, aftercall not called (see here ). to problem, can add iclientmessageinspector since afterreceivereply called in face of exception. gives me ability to determine if exception (fault) occurred or not. do post work in face of exception question: is there way iclientmessageinspector.afterreceivereply (or create equivalent) exception represents thrown callers. , if so, there way mark exception handled such callers not exception? or, there other extensibility mechanism or other approach should using meet goals? if understand correctly want mute exceptions...

javascript - How to select all *renderable* text elements in browser -

how can select visible renderable html text nodes in browser document? in other words, how can list of dom nodes can traverse via scripting in order obtain text visible user in browser, in document order? i rely on browser tell me nodes constitute visible renderable text. i'm not sure start. help? this tricky, here's i've come with: function traverse(o) { var = []; [].foreach.call(o.childnodes, function(val) { if(val.nodetype===3) { if(val.nodevalue.trim()>'') a.push(val); } else { var style= getcomputedstyle(val); if(val.tagname!=='noscript' && style.getpropertyvalue('display')!=='none' && style.getpropertyvalue('visibility')!=='hidden' && style.getpropertyvalue('opacity')!=='0' && style.getpropertyvalue('color')!==style.getpropertyvalue('background-color') ) { ...

c# - CACHE, What is the best way for caching timeline events? -

the question simple, have timeline of events or posts, facebook wall. i'm wondering best way manage caching here? things take in account: the collection of events custom each user, depending of friends, , friends visibility, wich makes database query bit heavy. also collection of events has pagination. user must see new events, not showing cached items, remove magic time line. what should best invalidation time? if 1 have tips or advices glad.

manifest - Java is not finding the class -

i have created manifest file: manifest-version: 1.0 main-class: dicomvalidate.menu class-path: lib/log4j-1.2.16.jar lib/sl4j-api-1.6.4jar lib/sl4j-log4j12-1.6.4.jar lib/dcm4che-audit-2.0.25.jar lib/dcm4che-core-2.0.25.jar lib/dcm4che-image-2.0.25.jar lib/dcm4che-imageio-2.0.25.jar lib/dcm4che-iod-2.0.25.jar lib/dcm4che-net-2.0.2h.jar when attempt run file in windows command prompt in directory: c:\temp\workspace\dicomvalidate>java -jar dicomvalidate.jar , error: view dicom tags enter dicom file path name: c:/ryan.dcm enter tag list: c:/testing.txt exception in thread "main" java.lang.noclassdeffounderror: org/dcm4che2/io/dicominputstream @ dicomvalidator.viewdicomtags.readdicomobject(viewdicomtags.java:40) @ dicomvalidator.menu.showmenu(menu.java:46) @ dicomvalidator.menu.main(menu.java:14) caused by: java.lang.classnotfoundexception: org.dcm4che2.io.dicominputstream @ java.net.urlclassloader$1.run(urlclassload...

c# - using a converter while reading xaml from string using XamlReader.Parse() -

i trying load xaml using xamlreader.parse() , code: <helpers:filterdatagrid xmlns:helpers="clr-namespace:urm.helpers;assembly=urm" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:grid="clr-namespace:microsoft.windows.controls;assembly=wpftoolkit" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:convert="clr-namespace:urm.converters;assembly=urm" itemssource ="{binding pendingcontracts}" autogeneratecolumns="false" margin="20,0,10,0" height ="auto" width ="auto"> <helpers:filterdatagrid.resources> <convert:dateconverter x:key="dateconverter"/> </helpers:filterdatagrid.resources> <helpers:filterdatagrid.columns> <grid:datagridtextcolumn header="contract id" binding="{binding contractid}" /> <gri...

salesforce - Amount change on Opportunity Apex Trigger [Resolved] -

trigger change quantity in negative number opportunitylineitems final opportunity amount in negative number if record type of opportunity 'revenue risk' trigger risk_negativequantity on opportunitylineitem (before insert) { if(trigger.isinsert) { set<id> oppid = new set<id>(); (opportunitylineitem oli : trigger.new) { oppid.add(oli.opportunityid); } id revenuerisk= schema.sobjecttype.opportunity.getrecordtypeinfosbyname().get('revenue risk').getrecordtypeid(); list<opportunity> opplist = [select id, recordtype.name,recordtypeid opportunity id in : oppid ]; (opportunitylineitem oli : trigger.new) { (opportunity opp: opplist) { if (oli.opportunityid == opp.id) { if(opp.recordtype.name == 'revenue risk') { if(oli.quantity > 0) { ...

java - ObjectAnimator vs TranslateAnimation -

i simple project try show/hide layout on top of linearlayout translateanimation. there flicker because when call onanimationend(), animation wasn't finished 0.1sec. example: @override public void onanimationend(animation animation) { retractablelayout.setvisibility(view.gone); } when search on stackoverflow, found there's way it. objectanimator. after using it, animation fine without view.gone what difference between translateanimation , objectanimator? 1 of them deprecated , same thing or there's time when 1 or other better. here's github repo 2 versions ( https://github.com/charlesvigneault/aaa_test1 ) thanks the difference if use translateanimation, view animating not leave original position on screen, makes moving. view doesnt change coordinates. check video view animations : https://www.youtube.com/watch?v=_uwxqfbf86u if use objectanimator view changes actual position. translateanima...

continuous integration - Xcode Bots do not update git submodules to specified commit -

my xcode bot using outdated version of repo's submodules. it builds old submodule code despite submodule being updated new version in commit history of parent app. parent repo uses submodule v1.0. parent repo updates submodule v2.0 , commits subproject commit github. the "on commit" xcode bot run new commit automatically. parent app uploaded testflight. testflight build contains correct v2.0 submodule commit (the last commit parent repo). however testflight build contains outdated submodule v1.0 code. i thought going crazy when bugs reproducible on testflight build despite being "fixed" in submodule , local builds. it turns out xcode bots not pull specified submodule commit. a simpler solution problem doesn't require server having credecentials git remotes - add pre-integration script bot: #!/bin/sh # enumerates each submodule check out desired commit. # needed because xcode bots reason prefers check out # branch head, may resul...

sql - Select all values from first table and ONLY first value from second table -

Image
i want select values users , min of dateused in code table. how can that? i've tried this: select u.firstname, u.lastname, u.fbid, q.dateused, u.codesleft users u inner join code q on u.id = q.userid but it's selecting values code , users tables. p.s. adding distinct has no effect adding distinct has no effect as rule of thumb, distinct helps single-column select s. multiple columns need go "big guns" - group by clause. in order work need make sure each item select either group by column, or has suitable aggregation function: select u.firstname, u.lastname, u.fbid, min(q.dateused) dateused, u.codesleft users u inner join code q on u.id = q.userid group u.firstname, u.lastname, u.fbid, u.codesleft

user interface - Google apps script UI services to HTML services -

Image
i try convert simple google apps script code below html services code. code below written deprecated google apps script ui services! can me html services example code in usecase? // script deprecated ui-services // how create app html-services?!!!? //this script runs in google website. //it has 1 textobject , 1 button. //when button pressed value entered stored in spreadsheet sskey = 'sheetkey....'; function doget(){ var app = uiapp.createapplication().settitle('myapp'); //create panels en grid var mainpanel = app.createverticalpanel(); var vpanel1 = app.createverticalpanel().setid('vpanel2'); var grid = app.creategrid(4, 2).setid('mygrid'); //vpanel1 widgets var namelabel = app.createlabel('name'); var nametextbox = app.createtextbox().setwidth('400px').setname('name').setid('name'); var submitbutton = app.createbutton('verstuur').setid('submitbutton'); grid.setwidget(0...

java - JUnit: test builder with private field -

i'm beginner , have problem junit test in constructor of class. the class want test called intsortedarray , follows: public class intsortedarray { private int[] elements; private int size; public intsortedarray() { this.elements = new int[16]; this.size = 0; } public intsortedarray(int initialcapacity) throws illegalargumentexception { if(initialcapacity < 0) { throw new illegalargumentexception("error - can't create array of negative length."); } else { elements = new int[initialcapacity]; size = 0; } } public intsortedarray(int[] a) { elements = new int[a.length + 16]; for(int = 0; < a.length; i++) elements[i] = a[i]; size = a.length; insertionsort(elements); } //other code... } with eclipse created class junit: public class intsortedarrayunittest { private intsortedarray i...

linux - Grep for a special pattern -

i looking pattern 1 below- .mm1(moda.portb) .mab(blah.pc) i trying this- grep -ir ".(*.*)" . unfortunately, expression, lot of results like- .mm1(moda) .mab(blah) how change pattern can grep files in directory expression - .characters(characters.characters) help appreciated, ! i'm not on unix environment sorry not testing, seems me wanna escape periods: grep -ir "\.(*\.*)" .

python - Tkinter understanding after() -

first of all, take @ previous thread here: tkinter understanding mainloop after following advice there, in gui programming, infinite loops have avoided @ costs, in order keep widgets responsive user input. instead of using: while 1: ball.draw() root.update() time.sleep(0.01) i managed using self.canvas.after(1, self.draw) inside draw() function. so code looks this: # testing skills in game programming tkinter import * root = tk() root.title("python game testing") root.resizable(0, 0) root.wm_attributes("-topmost", 1) canvas = canvas(root, width=500, height=400, bd=0, highlightthickness=0) canvas.pack() root.update() class ball: def __init__(self, canvas, color): self.canvas = canvas self.id = canvas.create_oval(10, 10, 25, 25, fill=color) self.canvas.move(self.id, 245, 100) self.canvas_height = canvas.winfo_height() self.x = 0 self.y = -1 def draw(self): self.canvas.m...

php - Get the value of the changed select in table -

Image
i need values of selected select orderno of changed row the table looks if change order no 1002 sold $query = mysql_query("select * orders"); while($row = mysql_fetch_assoc($query)) { echo '<tr>'; echo '<td>'.$row['orderno'].'</td>'; echo '<td>'.$row['total'].'</td>'; echo '<td>'; if($row['status'] == "sold") { echo '<select name = "status[]">'; echo '<option value = "sold" selected>sold</option>'; echo '<option value = "cancelled">cancelled</option>'; echo '</select>'; } else { echo '<select name = "status[]">'; echo '<option value = "sold...

python - Overcoming dimension errors with matrix multiplication? -

i'd multiply 2 matrices (to clear want in linear algebra meaning of word, i.e., if want further clarification of mean see wikipedia article ) i've tried a * b (which got following matlab numpy guide @ scipy wiki ) when a had dimensions of (n-1)x(n-1) , b had dimensions of (n-1)x(n+1) gave out valueerror (where n=100 ): valueerror: operands not broadcast shapes (99,99) (99,101) i tried np.dot(a,b) in case unintentionally using array (ps. case, have few np.asarray commands vectors built , b from. how convert them matrices?) , not matrix , got same result. this code in full (granted , b replaced np.diag(xasub) , np.sin... , respectively , on d2tsub line) import numpy np import scipy.special sp n = 100 n = range(0,n+1) xmin = -10 xmax = 5 pi = np.pi x = np.cos(np.multiply(pi / float(n), n)) xa = np.asarray(x) xasub = xa[1:n] xc = (1+xa)*(xmax-xmin) / float(2) xcsub = xc[1:n] na = np.asarray(n) nd = np.transpose(na) t = np.cos(np.outer(np.arccos(xa),nd)) tsu...

angularjs - angular access ng-repeat array from child directive -

i had idea angular directive i'm not sure if it's possible. i have delete , item ng-repeat array, de facto solution have function on scope: $scope.remove = function(item) { var index = $scope.items.indexof(item); $scope.items.splice(index, 1); } i'm writing boiler plate code every ng-repeat , nice able instead: <li ng-repeat="item in items"> <button ng-click-remove="item"></button> </li> basically i'm thinking directive wrap ng-click, start thinking, possible access items array directive without knowing name or using $parent? the way create service handling deletion/creation of said task, , use wrapper in controller. mean, way suggesting, still need write same code, in directive. also, yes possible access directive, can pass in controller it. function dir() { return { controller: 'ctrl ctrl', link: function(scope, elem, attrs, ctrl){ console.log(ctrl.items); ...

rust - How to take ownership of T from Arc<Mutex<T>>? -

i want return value function protected mutex , cannot understand how properly. code not work: use std::sync::{arc, mutex}; fn func() -> result<(), string> { let result_my = arc::new(mutex::new(ok(()))); let result_his = result_my.clone(); let t = std::thread::spawn(move || { let mut result = result_his.lock().unwrap(); *result = err("something failed".to_string()); }); t.join().expect("unable join thread"); let guard = result_my.lock().unwrap(); *guard } fn main() { println!("func() -> {:?}", func()); } playground the compiler complains: error[e0507]: cannot move out of borrowed content --> src/main.rs:16:5 | 16 | *guard | ^^^^^^ cannot move out of borrowed content in rust 1.15, can use arc::try_unwrap , mutex::into_inner : use std::sync::{arc, mutex}; fn func() -> result<(), string> { let result_my = arc::new(mutex::new(ok(()))); l...

javascript - getting error module "react" not found -

i'm attempting set flux react environment, watched tutorial here: https://egghead.io/lessons/react-development-environment-setup , have copied , pasted exact code works in tutorial vid ( available below video ) every time run following error: error: module "react" not found "/flux/src/js/fake_179946b1.js" @ notfound (/flux/node_modules/gulp-browserify/node_modules/browserify/index.js:803:15) @ /flux/node_modules/gulp-browserify/node_modules/browserify/index.js:754:23 @ /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/browser-resolve/index.js:185:24 @ /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:44:14 @ process (/flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:113:43) @ /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:122:21 @ load (/flux/node_modules/gulp-browserify/node_modules/browserify/node_modul...

javascript - Compare element values and assign attribute to larger -

'ive been banging head trying figure out best way go this... i have html: <div id="aa1">23</div> <div id="a2">14</div> <div id="b1">67</div> <div id="bb2">21</div> what attempting compare value of these elements in pairs. easiest solution be: var a1 = parsefloat($("#aa1").text()).tofixed(2); var a2 = parsefloat($("#a2").text()).tofixed(2); var b1 = parsefloat($("#b1").text()).tofixed(2); var b2 = parsefloat($("#bb2").text()).tofixed(2); if (a1 > a2){ $('#aa1').css('color','#fff'); }else{ $('#a2').css('color','#fff'); } if (b1 > b2){ $('#b1').css('color','#fff'); }else{ $('#bb2').css('color','#fff'); } assuming div ids not same length, contain numbers, , there multiple pairs, although pairing same (always a1/a2, b1/b2, etc)...

jquery - ajax call in each loop functions as not expected -

i have function output array named displaycomments(comments) . within function, make ajax call retrieve replies associated comments . when ajax run retrieve replies , after array returned web api controller, code jumps out of ajax , go last line of each loop , $('#div_listofcomments').append(replies); . goes first line of loop, var cid = comment.commentid; , continue next comment item. then, ajax call happens second comment , , behaves same way. never visits success status of ajax call until each loop completed comments . then, moves success section , runs code once each reply item display them on form. however, need attach replies under each comment, in other words, need append replies $('#div_listofcomments') after comment appended. however, code illustrated below not function in expected way. appends comments. appends replies. can see wrong code below ? function loadcommentsforpost(postid) { jquery.support.cors = true; $.ajax({...

javascript - Getting access to users mic via chrome background extention or background app -

i trying have app pick key words "okay chrome" it's not picking sort of audio. i'm not new javascript, new making chrome apps/extensions. there sort of way, might have missed, allows developers mic input unpackaged app/extent ion, if so, how? presently, have annyang library running background script , background scripts have following function openbrowser(){ chrome.windows.create({ url: chrome.extension.geturl('main.html'), type: 'panel' }); }; if (annyang) { var commands = { 'ok chrome': openbrowser }; annyang.addcommands(commands); annyang.start(); annyang.debug(); } this hasn't been implemented yet (at least in normal chrome), supposed work chrome.audio api. you'd declare following permissions: "permissions": [ "audio", ... ], and you'd access methods outlined here: https://developer.chrome.com/apps/audio as of works 1 dev channel chrome.

windows - Auto refresh logstash agent when input file changes -

i have logstash setup such takes input text file x. used manually copy newer results text file , logstash auto update results. now piping results text file y x using windows power shell get-content y -wait | out-file x -encoding utf8 the input file gets appended latest results, logstash not update results in it's database. how can auto update work again?

file - encfs does not mount folder -

i have installed encfs encrypt directory , files , worked when installed encfs , configured it. created 2 folders, 1 /xdm/game , second /private , encfs works have copy files /private folder , sync files' encrypted version /xdm/game . when restart pc have remount /private folder using following command - encfs ~/xdm/game ~/private but returns me error - encfs ~/xdm/game* ~/private encfs password: fuse: mountpoint not empty fuse: if sure safe, use 'nonempty' mount option fuse failed. common problems: - fuse kernel module not installed (modprobe fuse) - invalid options -- see usage message help me error please. thank in advance!!! short answer 'in order mount directory need remove file /private folder , try mounting again encfs `~/xdm/game ~/private`' and long answer, after configured encfs once restart computer, can see folder /private empty , show files have mount folder if copy file in /private folder , try mount give error. first...

java - Parse website content after log in Jsoup -

i have been looking @ solutions posted on stack-overflow parsing web content after log in jsoup, there wasn't solution problem, or not able implement it. can please give me clear understandings on how to: login 1 page user details, submit button doesnt have name, has id parse data of second page requires login access.

ios - how to keep app running in background only if the location manager is runnig -

i'm using location background mode, makes app runs forever. wanna when location manager active (user pressed start saving location) , app enter ground mode app must stay running (achieved). but, if user didn't pressed button start saving location or pressed button "stop saving locations" app can killed or suspended when in background. app running on background if has no work do. , drains battery.

regex - Regular expression pattern to match string without any 2 consecutive repeated characters -

i can write regular expression match string contains 2 consecutive repeated characters: /(\w)\1/ how do complement of that? want match strings don't have 2 consecutive repeated characters. i've tried variations of following without success: /(\w)[^\1]/ ;doesn't work hoped /(?!(\w)\1)/ ;looks ahead, portion of string match /(\w)(?!\1)/ ;again, portion of string match i don't want language/platform specific way take negation of regular expression. want straightforward way this. the below regex match strings don't have repeated characters. ^(?!.*(\w)\1).* (?!.*(\w)\1) negative lookahead asserts string going matched won't contain repeated characters. .*(\w)\1 match string has repeated characters @ middle or @ start or @ end. ^(?!.*(\w)\1) matches starting boundaries except 1 has repeated characters. , following .* matches characters exists on particular line. note this matches empty strings also. if don't want match empty lines chang...

php - Json decode store in single var -

hie all, have $id="1,2,3,";//like this wanted pass within function like.. <input type="submit" onclick="<?php echo 'edit($id)';?>"> i have $id in json_encoded format. want decode it. , store each in single var. foreach() { // single var store each decoded .. } in file1 save id in hidden field, <form method="get" action="file2.php"> <input type="hidden" name="ids" value="<?php echo $id;?>"> <input type="submit"> </form> in file2 this, $id = $_get['ids']; $id_arr = explode(',',$id); // gives array

rest - Spring security filter blocking restful api calls -

i have web application using spring 4. i'm using spring security here. in mean time need open restful api no security. issue till security filter enabled rest rest post calls 405 method not allowed response(still works). in mean time server log says .11:27:13.058 [http-bio-8080-exec-5] warn o.s.web.servlet.pagenotfound - request method 'post' not supported when comment security filter web.xml post works fine. tried adding following line security xml didn't help. <intercept-url pattern="/rest**" access="permitall" /> my web.xml , security filter , end when commented post start working. <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>counter web application</display-name...

python script to extract phrases from an XML file -

i trying parse xml file contains these tags. <?xml version="4.0" encoding="utf-8"?> <phrases> <phrase title="bacd_dd" version_id="10" version_string="lphaf"><![cdata[bacd dsfbsd dfsd]]></phrase> <phrase title="bcvd_ff" version_id="10" version_string="lphaf"><![cdata[ans fkdfjid dfdf]]></phrase> <phrase title="bdsd_fffd" version_id="17" version_string="lphaf 7"><![cdata[jdhfd dsfodf wernksdlg ffguywer <br> dsf sddsfdsfdsf ksdfj fdsf]]></phrase> </phrases> now want tag values. how can parse whole xml file ? try xml.etree import xml.etree.elementtree et root = et.fromstring("""<?xml version="1.0" encoding="utf-8"?> <phrases> <phrase title="bacd_dd" version_id="1010010" version_string="1.1.0 alpha"...

php - Switching external functions with form buttons and if statements -

i've been searching answer day. i've got 3 functions have forms in them. i'm trying call forms index page using form. what's happening can call functions , have them display when click appropriate button when try submit forms in functions index page function forms disappear , nothing gets posted. i'm not sure if i'm trying possible thought i'd ask. index.php if (isset($_post['posts'])) { posts(); } if (isset($_post['styles'])) { styles(); } if (isset($_post['templates'])) { templates(); } echo php_eol."\t\t".'<span class="switch">'.php_eol; echo "\t\t\t".'<form class="mode" method="post" action="'.htmlentities($_server['php_self']).'">'.php_eol; echo "\t\t\t\t".'<button class="edit" name="posts" type="submit" value="posts">posts</button>'...

json - Understanding pointer casting on struct type in C -

i'm trying understanding pointer casting in case. # https://github.com/udp/json-parser/blob/master/json.c#l408 #define json_char char typedef struct _json_object_entry { json_char * name; unsigned int name_length; struct _json_value * value; } json_object_entry; typedef struct _json_value { struct { unsigned int length; json_object_entry * values; #if defined(__cplusplus) && __cplusplus >= 201103l decltype(values) begin () const { return values; } decltype(values) end () const { return values + length; } #endif } object; } (*(json_char **) &top->u.object.values) += string_length + 1; due see top->u.object.values has address of first element of values ( type : json_object_entry ), , address of values, casting char, .. , here i'm lost. don't understand purpose of this. // notes : 2 pass parser wonders this. thanks author here (guilty charged...) in first pass, v...

python - how to go about first board game program… start with text based, or learn GUI? -

i've been learning python recently. it's relative joy use, i've decided start that. i've done coding in college. though decade ago, still have knowledge of functions, flow control, scope, oop, etc. (in languages such perl, java, c, , c++) such that should give me jump start, though i'll have bunch of stuff when hurdles present themselves. thinking implementing board game without ai (with solitaire mode, or played exclusively way). would "waste of time" speak if first program text based? advantage here can down coding right away. worth going through experience? otoh, i'll want learn guis @ point, makes more appealing , more true real deal. it not waste of time @ all. in fact, of code can same both gui-based , text-based game. write game logic separately code presents game , handles user input. way, when finish text-based game, visual display thing need write finish gui-based version. what doing here avoiding coupling between game logic...

java - Document path is not valid error in android emulator -

im creating android application.in have download , view pdf files.and when run app in emulator, if select download idle , if select view gets redirected adobe reader displays "document path not valid".what missing? screen8.java package com.example.library; import java.io.file; import java.io.ioexception; import android.app.activity; import android.content.activitynotfoundexception; import android.content.intent; import android.net.uri; import android.os.asynctask; import android.os.bundle; import android.os.environment; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.toast; public class screen8 extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_screen8); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds ite...