Posts

Showing posts from May, 2012

c++ - Visual C++6 looking for text file in the "solution" directory rather than output directory -

Image
i have vc++6 project , have following code snippet: string s; int i=0, indx; ifstream myreadfile; myreadfile.open("chanmap.txt"); for reason, when run program, looking text file in "solution"/root/dsw directory rather output directory (i.e. debug folder) legacy project, i'm sure settings mangled here , there. ide old me , foreign. appreciated. for both debug , release projects, specify same path in project settings debugging -> working directory : other this, ensure run program windows explorer (or command propmpt same path). may need create shortcut, you'd specify directory . since on windows, can use setcurrentdirectory within program.

android - Error when connecting kSoap to Spyne The attribute '{http://schemas.xmlsoap.org/soap/encoding/}root' is not allowed -

i have soap server written in python using spyne. have created soap client in python using suds. works perfect. here code server class personnel(servicebase): @rpc(_returns=string) def personnel(self): """docstrings service methods appear documentation in wsdl. <b>what fun!</b> @param name name hello @param times number of times hello @return completed array """ employees_list = employees() employees_list.populate_from_db("elleo", "odoo", "0801", "127.0.0.1") tststring = "dirk" return tststring application = application([personnel], 'elleo.personnel', in_protocol=soap11(validator='lxml'), out_protocol=soap11()) wsgi_application = wsgiapplication(application) when connect android program using ksoap, error. here code: string soap_action = "http://192.168.1.100:8000/personne...

bamboo - NPM Install to wrong directory -

trying use npm install during bamboo build , getting odd results. using $ npm install is resulting in odd results if let build run command. if log build machine , run command manually results expected. the odd results: in node_modules , see package folders; however, of folders empty. ones not empty ones explicitly define dependencies in package.json. to further confuse things. when things work out, node_modules folder has 18k files 62mb. when doesn't work right, has 40k files 112mb. looking @ individual folders node_modules event more confusing. just sampling of package folders comparing bad install. install bad install package size / # files size / # files jspm 1.5mb / 945 26mb / 8,924 gulp-jspm-build 883kb / 450 23.5mb / 10,589 eslint 1.4mb / 292 6.6mb / 3,200 the last confusing part: doesn't happen 100% of time, times does. i realize ...

math - Draw diagonals of an n-gon, effectively -

so got problem while practicing python, guess applies languages. draw diagonals in regular n-gon , fine, managed that. but, there criteria aswell, same line isn't drawn more once. way interpret turtle (i use turtle graphics btw) cannot travel between same 2 corners twice, , not lift pen. have been trying find solution while can't seem figure out , have started wonder if possible. do on here know if possible n-gons? , if is, give me hint? here 2 regular n-gons don't know is. (i sure hell didn't) nonagon octagon /q edit thanks john kahn able solvable part, pointed out can done on regular n-gons of uneven degree. here code solution. think? def nhorning(r, n, ): if n % 2 == 0: print("it can't done") return none angl = (2 * pi) / n # angle calculating coordinates of n-gon = {} # contains destinations each corners diagonals cord = {} # contains coordinates of each corner x in range(n): cord[x] ...

CSS selectors on custom navigation -

the context: working on project requires coding custom tumblr theme using html, css, , jquery. website i'm building out features "newsfeed" of auto-generated content pulled in , auto-posted tumblr iftt sequences have monitoring rss , social feeds. backend program automatically tags posts source type, have set redirect pages in theme's navigation navigate content tagged each source type. want set css selectors style hover , active navigation links, , have followed lvha rule , tried specifying class , id, can't work. want hover , active navigation categories set bold, instead of italic (link , visited setting). the ask: taking peek @ my code a.nav1 links, how can set css :active , css:hover text-decoration: bold? thanks much!! pointers appreciated. hannah my current code is: a.nav1:link { color: black; margin: auto; width: 130%; margin-bottom: 0px; padding-bottom: 0px; fon...

linux - Using doxygen with qtcreator -

i want use doxygen qt creator on linux box mageia 3, , found qtcreator plugin purpose ( here ). unfortunately qt creator version 2.4 (i use 2.7). there plugin 2.7 or possible use doxygen without plugin in qtcreator? mean doxygen tags autocompletion , like... regarding plugin found: wiki , binaries not on par source code compatible qtc 2.7 if compile source. guess want binary if didn't find out yourself. qtcreator can generate doxygen blocks if manually start write block (activate in completion settings of text editor inside qtcreator settings). interaction doxygen binaries not integrated. regards.

c++ - Accessing null-termination character in std::string (string subscript out of range) -

consider following simple text example: #include <stdio.h> #include <string> int main() { std::string x("ugabuga"); int i=0; while (x[i]) { ++i; } printf("%d\n",i); //should print 7 return 0; } i expect program iterate on characters of string, reach null-terminating character breaking loop , reach program end correctly. however, when tried compiling in debug mode under visual studio 2010 reaching exception "string subscript out of range". when compiling in release mode program passes, bigger project depending on behaviour crashes - perhaps because of issue. however, when checked specification of std::string::operator[] @ www.cplusplus.com , end-character string handled explicitly: if pos equal string length, function returns reference null character ('\0'). i ask here: is interpretation of specification of std::string correct? or missing something? if problem lies on vs side of imp...

How to create a Hashtable in javascript from a JSON by setting a value as the key? -

i apologize if vague, want search each json object unique value , spit out value. have been told idea create hash table issue, not know how go this. example: { "form_key" : "basicpatientname", "data" : "miranda jones", "cid" : 2, "pid" : 1, "no" : "0" } i want search basicpatientname , able pull miranda jones , or search basicpatientgender , pull 1. used library called defiantjs lets me loop through json , lets me asking, have been told there many iterations involved if want 1000+ times in same program. you use this: data = [{ "form_key" : "basicpatientname", "data" : "miranda jones", "cid" : 2, "pid" : 1, "no" : "0" }, { "form_key" : "basicpatientgender", "data" : "1", "cid" : 4, "p...

javascript - jQuery if GET form conditional -

this question has answer here: how value parameters? 43 answers i have following code: $( 'body' ).replacewith( '<iframe src="http://google.com" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>' ); it replaces whole content of page iframe. above code vary iframe source if form sent specific value. for example if: <input name="any_other_value" value="any_value" type="radio"> is selected, jquery code posted above shows different iframe. do think can achieved jquery? this code looks see whether radio button checked. if so, src of iframe adjusted. var desiredsrc = 'http://google.com' if...

logging - Programmatically add new Appender in log4j2 -

i have log4j2.xml defines base appenders project needs, in cases need add new appenders during runtime log4j states should possible ( https://logging.apache.org/log4j/2.0/manual/architecture.html under section appender addloggerappender method should: "...the appender attached , loggers notified update loggerconfig references."). however, not seem work (or i'm missing step). i'm running log4j2 version 2.6 , log4j2.xml defines root-logger of level debug , have 3 appenders (one stdout, 1 stderr , rollingfile). without trying change logging configuration works should. here code i've tried adding appenders: public static void addfileappender(string logpath, string name, level level){ loggercontext ctx = (loggercontext) logmanager.getcontext(true); configuration config = ctx.getconfiguration(); layout<?> layout = patternlayout.createlayout( patternlayout.simple_conversion_pattern, null, config, ...

javascript - merge array on keys -

sorry if duplicate, can't find suitable answer. have 2 arrays: array1 = { '0': 'f1', '1': 'f2'}; array2 = { '0': 's1', '1': 's2'}; how combine (merge) these 2 arrays this: array3 = [['f1', 's1'], ['f2', 's2']]; thanks! if inputs arrays var = ['f1', 'f2']; var b = ['s1', 's2']; the transformation looking zip var zip = (xs,ys)=> xs.reduce((zs,x,i)=> zs.concat([[x, ys[i]]]), []); zip(a,b); //=> [['f1', 's1'], ['f2', 's2']] this assumes both inputs same length. if inputs objects numerical keys var = {'0': 'f1', '1': 'f2'}; var b = {'0': 's1', '1': 's2'}; var zipobj = (xs,ys)=> object.keys(xs).reduce((zs,xk)=> zs.concat([[xs[xk], ys[xk]]]), []); zipobj(a,b); //=> [['f1', 's1'], [...

How to set cookies in phantomjs using selenium with python? -

Image
it raise error message said "can set cookies current domain",but did put old cookies in.sometime add 'correct' domain,it raise error message "unable set cookie". , tested in firefox,firefox cant work. from selenium import webdriver driver = webdriver.phantomjs(executable_path=phantompath) driver.get('http://stackoverflow.com/') driver.get_screenshot_as_file('1.png') cookies = driver.get_cookies() driver.delete_all_cookies() driver.get_cookies() cookie in cookies: driver.add_cookie(cookie) the phantomjs driver doesn't support keys cookie dictionary. 1 way overcome issue select keys: from selenium import webdriver driver = webdriver.phantomjs() driver.get('http://stackoverflow.com/') cookies = driver.get_cookies() driver.delete_all_cookies() cookie in cookies : driver.add_cookie({k: cookie[k] k in ('name', 'value', 'domain', 'path', 'expiry')})

windows - Why does console output keep self-referencing batch script from exiting cleanly? -

i writing self-referencing windows 10 (home ed.) batch script locate string in large number of log files, create results file and, when finished, open log file in notepad++. process takes few minutes hence self-referencing part allows me return control original command window until log file opened (and takes focus). however, when second command window, started "start" command , "/b" switch, includes @ least 1 "echo" command won't exit cleanly , requires me press enter key exit "nested" command window. i've distilled code down 9 lines can see mean. see in action, save following "test.bat" , run command prompt: @echo off if "%1" equ "" call :noargs & goto :done echo there @ least 1 argument. :done exit /b :noargs echo there no arguments. start "" /b cmd /c test.bat arg1 goto :eof it print "there no arguments." below prompt followed "there @ least 1 argument." @ prom...

routes - CodeIgniter3 HMVC Routing with .htaccess not working -

i new ci3 , got frustated spending more 1 week in making codeigniter3 hmvc wiredesignz routing working .htaccess , still not working properly. because there multiple sources can cause error, write link of github repository https://github.com/ibudisteanu/php-tests the behavior super easy: can access following address no errors http://localhost/ http://localhost/index.php/login http://localhost/index.php/awesome i returns following links in routing: http://localhost/login http://localhost/awesome the error not found requested url /login not found on server. this did htaccess file , working fine in test server options +followsymlinks -indexes rewriteengine on # notice: if 404 play combinations of following commented out lines #allowoverride #rewritebase /wherever/ci/is # rewritebase / # restrict site 1 domain # important use 1 of these options below! # option 1: rewrite "www.domain.com -> domain.com" uncomment following lines. #rewr...

ruby - Understanding negative look aheads in regular expressions -

i want match urls not contain string 'localhost' using ruby regex based on answers , comments here , put 2 solutions, both of seem work: solution a: (?!.*localhost)^.*$ example: http://rubular.com/r/tqtbwacl3g solution b: ^((?!localhost).)*$ example: http://rubular.com/r/2kknqzumwf the problem don't understand they're doing. example, according docs, ^ can used in various ways: [^abc] single character except: a, b, or c ^ start of line but don't how it's being applied here. can breakdown these expressions me, , how differ 1 another? in both of cases, ^ start of line (since it's not used inside character class). since both ^ , lookahead zero-width assertions, can switch them around in first case - think makes bit easier explain: ^(?!.*localhost).*$ the ^ anchors expression beginning of string. lookahead starts position , tries find localhost anywhere string (the "anywhere" taken care of .* in f...

php - Inserting multiple rows into database -

i have <?php include 'stats.php'; ?> on every page on site. in stats.php file there sql insert query inserts data table in database. for reason when visiting 1 page inserts 4 rows database - there 1 sql command. why doing this... below code on stats.php file <?php $activity_history_sql= "insert user_activity_history (user_seq, user, timestamp, ip_address, user_request_uri, user_script_filename, user_script_uri, user_script_url, user_script_name, user_php_self) values ('".$_session["domain.co.uk"]["sequence"]."', '".$_session["domain.co.uk"]["forename"].' '.$_session["domain.co.uk"]["surname"]."', '".date("y-m-d h:i:s")."', '".$_server["remote_addr"]."', '".$_server["request_uri"]."...

javascript - Logging requests and responses in express middleware -

i'm trying implement logger in express application. need able log requests , response (status code , body) sent each request. started writing middleware looks this: function (req, res, next) { ... res.on('finish', function () { logger.debug('for request', req); logger.debug('response sent'); }); ... } i need access data passed res object method used send response. example, if in 1 controller had: res.json({ foo: 'bar' }) i need way { foo: 'bar' } object, maybe: function (req, res, next) { ... res.on('finish', function () { logger.debug('for request', req); var data = res.data; // or res.body, or whatever logger.debug('response: ' + res.statuscode, data); }); ... } is there property or method in express res object use that? or, there better strategy logging requests , responses them? you need event listener triggered when res...

ios - Is there a way to know whether locationManager is active or stopped? -

in app, developing corelocation functionality module , need know whether startupdatinglocation or stopupdatinglocation have been called. know use boolean variable, wonder if there more 'globally' useful. there no api check "running" status cllocationmanager. wrap cllocationmanager in class (or subclass it) , have "running" state on custom class. something perhaps: swift: class mylocationmanager: cllocationmanager { var running: bool override init() { running = false super.init() } override func startupdatinglocation() { super.startupdatinglocation() running = true } override func stopupdatinglocation() { super.stopupdatinglocation() running = false } } objc: @interface mylocationmanager : cllocationmanager @property (nonatomic, assign) bool running; @end @implementation mylocationmanager - (void) startupdatinglocation { [super startupdatinglocation];...

Can't connect to SQL Server with my vb.net program -

Image
i'm trying test sql server (i've never used before), , annoying error: i've traveled multiple websites, multiple questions, , not solution. user 'mrdan' windows admin... can't understand why can't connect. dim con new mysqlconnection("server=********;database=pruebamultiple;user id=mrdan;password=*****;") am missing something? or using bad connection string? first, connections sql server made using sqlconnection , not mysqlconnection . mysql , sql server different database systems. second, explicit credentials work sql accounts. you're trying log in windows user, , should therefore use integrated security=sspi in connection string (and omit user name , password). sum up: dim con new sqlconnection("server=********;database=pruebamultiple;integrated security=sspi")

Passing Data from PHP to Python -

i trying decide on best way send data across php script python script. please keep reading have looked @ existing posts on subject. doing following suggested 1 of posts have read: example .php $var1 = 2; $tmp = exec(/var/www example.py $var1); echo "$tmp"; example.py import sys print sys.argv[1] this seems working ok. although in stages. php script sending on reasonable amount of data generated html form wondered if efficient way of sending it. the php, html , python scripts running on raspberry pi connected via wired lan laptop. ultimately going have use tcp/ip read various commands desktop sending them out via tcp/ip (i can't change this) wondered whether better initialize sockets , use method send data php script python. i quite new range of languages looking advice can investigate further. have looked @ various other posts none seem match trying do. you use queuing service gearman , client in php , worker in python or vice versa. someone ha...

c# - VSIX IClassifier assigning multiple ClassificationTypes -

using standard template managed make custom highlighter turns occurrences of string "archive?????key" (where ???? collection of characters allowed in variable names) pink. "archive" , "key" portions become pink , "????" portion become maroon. far understand vsix highlighters (and don't) means defining 2 classificationformatdefinition s, every time try break project. my getclassificationspans method (which significant deviation standard template) looks like: public ilist<classificationspan> getclassificationspans(snapshotspan span) { list<classificationspan> spans = new list<classificationspan>(); string text = span.gettext(); int idx0 = 0; int idx1; while (true) { idx0 = text.indexof(keyprefix, idx0); if (idx0 < 0) break; idx1 = text.indexof(keysuffix, idx0 + 6); if (idx1 < 0) break; // todo: make sure prefix , suffix part of same object identifier. string na...

connect google bigquery from onprem using python -

we have our application hosted on google cloud , logs being uploaded google bigquery datasets. we want fetch monitoring data on-prem server using python program , create dashboard using data points. how can connect google bigquery on prem , how fetch data using python. thanks, adi this documented on bigquery page, python examples provided.

java - When trying to register a Swing button with an event handler why do I get an error? -

i trying create simple java swing application allow me convert kilometers miles. when registering button event handler error. error lies within textfield identifier. there red squiggly line highlighted underneath , not know why error. here code. appreciated. import javax.swing.*; import java.awt.event.*; public class graphics { public static void main(string[] args) { // create window jframe window = new jframe(); window.settitle("distance converter"); window.setsize(550, 450); window.setdefaultcloseoperation(jframe.exit_on_close); window.setvisible(true); // create panel jpanel panel = new jpanel(); // create components jlabel message = new jlabel("enter distance in kilometers"); jtextfield textfield = new jtextfield(10); jbutton button = new jbutton("calculate"); // add components panel panel.add(message); panel.add(textfield); panel.add(button); // add panel w...

html - Force browser cache clearance across all browsers -

i have following code on (all html webpages) : <meta http-equiv="cache-control" content="max-age=0" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="expires" content="tue, 01 jan 1980 1:00:00 gmt" /> <meta http-equiv="pragma" content="no-cache" /> however, not clearing caches , code updates not showing up. there way accomplish cache refresh? it better use standard http headers control caching server side, rather using http-equiv meta tags in html. allows controlling proxy caching , other intermediaries, making lot more effective. meta tags don't if have external css , js files. these still cached, may explain why isn't working correctly you. have append randomly generated query string resource paths browser appears loading brand new resource every time. ...

html - jQuery parent div sort -

i have simple html data: <div class="divtable svc-adv" id="info"> <div class="divtablebody adv-body"> <div class="divtablerow adv-row"> <div class="divtablecell adv-cell snmhdr">title</div> <div class="divtablecell adv-cell stitlehdr">service name</div> <div class="divtablecell adv-cell snhdr">service number</div> </div> </div> </div> <div class="divtable svc-adv servicealert"> <div class="divtablebody adv-body"> <div class="divtablerow adv-row"> <div class="divtablecell adv-cell advtitle">was</div> <div class="divtablecell adv-cell advsnm">abc</div> <div class="divtablecell adv-cell advsnum">123</div> </div>...

jquery - Send JSON data to a WebMethod -

i'm trying post data vb.net webmethod via ajax. json.stringify(myrows) contains: { "myrows":[ { "uniqueid":"188", "description":"hello", "clientid":"321", "secretkey":"dftete", "active":"checked", "delete":"delete icon" }, { "uniqueid":"191", "description":"sfsss", "clientid":"fsdfs", "secretkey":"cvvcvb", "active":"unchecked", "delete":"delete icon" }, { "uniqueid":"201", "description":"i test singh", "clientid":"23424242", "secretkey":";kfddgdfl;ghf", "active...

php - paypal website form return parameters with link and auto return -

i choose "on" auto return selling tools: https://www.paypal.com/webapps/customerprofile/ but auto return not working! why? and form: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="business" value="example@mail.com"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="item_name" value="<?php echo $name; ?>"> <input type="hidden" name="item_number" value="<?php echo $id; ?>"> <input type="hidden" name="amount" value="0.01"> <input type="hidden" name="quantity" value="1"> <input type="hidden" name="return" value="http://example.com/done.php...

Thymeleaf exception resolving template for REST Endpoint using Spring Data Rest + Spring Security -

i have setup rest endpoint s without issue creating new endpoint in spring application , have introduced spring security . first custom endpoint in application security . rest endpoint - requestmapping @requestmapping(value = "setuserpassword", method = requestmethod.post) public void setuserpassword(@requestbody string jsonobject) throws exception { system.out.println("in endpoint"); } i can send http post endpoint , have output print exception. can assume has adding spring security have not had issues in other spring data rest project not have spring security . question what missing when configuring new rest endpoints when spring security enabled? securityconfiguration @configuration @enablewebsecurity @enableglobalmethodsecurity(prepostenabled = true) public class securityconfiguration extends websecurityconfigureradapter { @autowired private springdatajpauserdetailsservice userdetailsservice; @override protect...

c# - Is it possible to get a list of all links with a class on a webpage? -

Image
there lot of links on webpage. the ones want make list of (there exactly 22) have same class "name notranslate": is possible list of links class? or @ least after "href" this program written in c#. i tried loop web.document.getelementbyid (web name of webbrowser control) did nothing. you can use htmlagilitypack var web = new htmlagilitypack.htmlweb(); var doc = web.load(url); var list = doc.documentnode.selectnodes("//a[@class='name notranslate']") .select(a => a.attributes["href"].value) .tolist();

ibm mobilefirst - WL 6.0. How to generate apk or ipa pointing to the right server without the worklightServerRootURL -

i have read posts: ibm worklight 6.0 - worklightserverhost attribute , app-builder ant task ibm worklight - how connect worklight server located in machine in same network? ibm worklight 6.0 - application-descriptor.xml and think i'm missing because them stop generation of wlapp other servers. after generating , installing wlapp needed generate , apk/ipa or "run as" on environment execute application. the problem i'm having deployed application in device points development server , not other server have used generating .wlapp files (run -> build remote server...). i have tried deploying application property "publicworklighhostname" changed in worklight.properites has no effect. how deploy application device pointing desired server? thank you. run >> build , deploy / build specific environment, points local development server build remote server, points server of choosing if perform build , deploy after build remote...

php - How to find Total of sum of rows in mysql? -

Image
i trying rows table. job properly. problem comes when put each row values percentage , tried sum percentage. example, using following query output rows: select sum( mark_score ) / sum( full_mark ) *50 score nuexam regd = '22' group subject with above query got following output: i want sum total of score . far output. appreciated. welcome php solution. simply running nested query should work: select sum(s) score (select sum( mark_score ) / sum( full_mark ) *50 s nuexam regd = '22' group subject) table

Executing script on receipt of new email in outlook -

i need create sort of trigger in outlook python script executed new emails received in inbox. did refer link: how trigger macro run after new mail received in outlook? , have written following script: private withevents items outlook.items private sub application_startup() dim olapp outlook.application dim objns outlook.namespace set olapp = outlook.application set objns = olapp.getnamespace("mapi") default local inbox set items = objns.getdefaultfolder(olfolderinbox).items end sub private sub test_macro(byval item object) on error goto errorhandler dim msg outlook.mailitem if typename(item) = "mailitem" set msg = item ret_val = shell("python <path-of-python-script>") debug.print "value: ", ret_val if ret_val <> 0 msgbox "couldn't run python script", vbokonly end if end if programexit: exit sub errorhandler: msgbox err.number & " - " & err.description resume programexit e...

python - Searching for a unique word in a string -

i write program can perform multiple task on gedcom file (file hold information family tree). i face 1 problem though; there lines this: 0 @f8@ fam 1 famc @f5@ 1 fams @f5@ now want extract code starts @ , ends @. i used: if 'fam' in line: var = line[1:6] ... but when run program outputs lines famc , fams these words have fam inside them. how can extract lines matching fam only? thank you. you can using regular expression (word boundaries), , re.search() : lines = [ "0 @f8@ fam", "1 famc @f5@", "1 fams @f5@" ] line in lines: if re.search(r'\bfam\b', line): var = line print var a "word boundary" ( \b ) marks start or end of word. we can use re.search() extract family code @ same time: for line in lines: search = re.search(r'@([a-z0-9]+)@\s*\bfam\b', line) if search: code = search.group(1) print code

python 2.7 - How to mix queue-based and feed-based input in TensorFlow -

i've migrated fully_connected style model reads inputs queue generated tfrecords file. has proven more efficient, still pass parameters interactively placeholder/feed_dict. is there way use same computation graph (say have model class builds graph in init method) both feed_dict , full_connected functionality? can placeholder receive values dequeue? you feed output of dequeue operation. tensorflow not dequeue item, use value provided. example: q = tf.fifoqueue(capacity=10, dtypes=[tf.float32], shapes=[()]) v = tf.placeholder(tf.float32) enqueue = q.enqueue([v]) dequeue = q.dequeue() output = dequeue + 10.0 tf.session() sess: sess.run(enqueue, feed_dict={v: 1.0}) sess.run(enqueue, feed_dict={v: 2.0}) sess.run(enqueue, feed_dict={v: 3.0}) print(sess.run(output)) # 11.0 print(sess.run(output, feed_dict={dequeue: 5.0})) # 15.0 print(sess.run(output)) # 12.0 print(sess.run(output)) # 13.0

redirect - How to get the current parent directory in .htaccess? -

how current parent directory in htaccess? i'm working on redirecting page when error 404 found... here code... errordocument 404 /sitewylog/www/404-redirect.php but when directory changes like, /sitewylog/www/404-redirect.php turns /some-new-name/www/404-redirect.php because pulled copy different folder name (eg. using rapidsvn).. produces error says, 404.html not found.. because 404-redirect.php contains code... <?php include_once '../config.php'; header('location: /'.root.'/www/404.html'); exit; ?>

html - PHP DOMDocument - ignore unexpected closing tags -

i'm kind of hacking wordpress theme footer, , found little problem. what doing taking footer of parent theme, capturing output, , using domdocument modify element. here code: <?php // apologize in advance messy code.... /** * javascript-like html dom element * * class extends php's domelement allow * users , set innerhtml property of lalalalala.... * * @author keyvan minoukadeh - http://www.keyvan.net - keyvan@keyvan.net * @see http://fivefilters.org (the project written for) */ // blahblahblah ob_start(); require get_theme_root() . '/responsive/footer.php'; $output = ob_get_clean(); libxml_use_internal_errors(true); $dom = new domdocument(); $dom->registernodeclass('domelement', 'jslikehtmlelement'); $dom->loadhtml($output); $finder = new domxpath($dom); $classname="powered"; $nodes = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' $classname ')]"); $elem = $no...

python - Django: using more than one database with inspectdb? -

my settings file's database section looks this: databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': 'c:/users/desktop/test.db' }, 'blah':{ 'engine': 'django.db.backends.sqlite3', 'name': 'c:/users/desktop/test2.db' } } when run command python manage.py inspectdb > models.py , model generated default database, not second one. how both models generated? from documentation : --database database specifies database introspect. defaults default . so can inspect second database with: python manage.py inspectdb --database 'blah' you cannot inspect both @ same time.

css - Can I set the width and height of an entire browser window in the code of the same html file? -

i set size (width , height) of entire html window page without javascript/css call in page. properties in same html file control size of browser.. below did control size of browser window, didn't work... help! <!doctype html> <html> <head> <link type="text/css" /> <style type="text/css"> html {height: 500px; width:500px; margin:0; padding:0; } body {height: 500px; width:500px; margin:0; overflow: hidden; padding:0; } .container {height: 500px; width:500px; margin:0; overflow: hidden; padding:0;} </style> </head> <body> <div class="container">this it.</div> </body> </html>

swing - Problems with loops in GUI (java) -

i'm pretty new java, , started writing dumb little program gui test. it's supposed have 12 buttons, set them white, continuously make 3 random buttons black, set buttons white again, wait 1 second , repeat. problem is, can't seem make repeat. every time try put while or loop around section of code makes random buttons black, won't run. doesn't give errors, , process run, no window appears. code class (minus import statements): public class testingness extends jframe { jbutton one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve; jpanel panel; testingness(string title) { super(title); this.init(); this.setsize(800, 800); this.setlocationrelativeto(null); this.setvisible(true); } void init() { panel = new jpanel(); panel.setlayout(new gridlayout(3, 4)); 1 = new jbutton(); one.setbackground(color.white); 2 = new jbutton(); two.setbackground(color.white); 3 = new jbutton(); three....

objective c - Audio player works in simulator but not on iOS device -

i have following code initializing: nsstring *path = [nsstring stringwithformat:@"%@/test.mp3", [[nsbundle mainbundle] resourcepath]]; nsurl *soundurl = [nsurl fileurlwithpath:path]; _audioplayer = [[avaudioplayer alloc] initwithcontentsofurl:soundurl error:nil]; then button starts player [_audioplayer play]; so works fine when on simulator doesn't work on device. the proper way path of file in app bundle this: nsstring *path = [[nsbundle mainbundle] pathforresource:@"test" oftype:@"mp3"]; but if want nsurl , use following directly: nsurl *soundurl = [[nsbundle mainbundle] urlforresource:@"test" withextension:@"mp3"]; also, simulator isn't case sensitive real device is. make sure file named test.mp3 , not test.mp3 . update name in code match actual filename. use debugger make sure soundurl isn't nil . if not audio player still doesn't work, use error parameter see why: nserror *error =...

java - How do I add a .jar file to Rhino's classpath? -

i scripting java via rhino, , use jcodec library. put jcodec-0.1.9.jar file in same directory, , added via -cp on command-line. command invoke rhino looks like: java -cp "rhino-1.7.7.1.jar;jcodec-0.1.9.jar;." org.mozilla.javascript.tools.shell.main -opt 9 js/main.js %* however, library doesn't load @ all, since of classes remain undefined. example, running: print(java.lang.class.forname('org.jcodec.api.awt.sequenceencoder')) throws classnotfoundexception , while doesn't say, 'javax.swing.jframe' . i feel i'm not including correctly, everywhere i've looked, seems way. have suggestions? try following make sure current directory in classpaht: java -cp ".\rhino-1.7.7.1.jar;.\jcodec-0.1.9.jar;." org.mozilla.javascript.tools.shell note: if you're on unix change .\ ./ , ; : updated: the class trying reference not have 'awt' in it. should be: org.jcodec.api.sequenceencoder