Posts

Showing posts from January, 2010

.htaccess - htaccess redirect from wrong URL (Laravel) -

i using laravel unfortunately google picking urls wrong. example, page such as: www.domain.co.uk/article/hello-world has been indexed in google www.domain.co.uk/public/index.php/article/hello-world . when visit site, urls seem correct , www.domain.co.uk/article/hello-world url shows page expected, guess google bots using .htaccess , viewing long url instead (i had put public folder comes laravel in public_html) the .htaccess in public_html has: rewriteengine on options +followsymlinks options -indexes rewritecond %{request_filename} !-f rewriterule (.*) /public/$1 [l] and there additional .htaccess in public_html/public folder: options -multiviews rewriteengine on rewritecond %{request_filename} !-f rewriterule ^ index.php [l] does know of solutions issue? i have tried rewrite rules redirect url when public/index.php url having 0 luck. tips appreciated. if forced host include files in document root, surely need 1 .htaccess file in root itself? mo...

Android strings xml file formatting -

hy! working on android app , want format text textview shows text on contact on website, dont know how format in strings.xml file. have tried basic html formatting putting <br> tag new row , <a> tag email adresses , web site, nothing change. how format ? can large strings saved strings.xml ? http://visitsplit.com/#pages?page=409 you can use \n new lines. further, can use html.fromhtml create spanned have basic formatting - bold, italic, links, etc. you need override movement method make links operational: textview.setmovementmethod(linkmovementmethod.getinstance()); textview.setlinksclickable(true);

sql - Extract XML using PLSQL based upon child element value -

i have following xml document stored in clob variable within plsql procedure: <soap:envelope> <soap:body> <ns2:getallissuehistoriesresponse> <return> <eventdate>2013-08-02t11:45:58.013+02:00</eventdate> <eventtext>test</eventtext> <issueeventtype> <id>10</id> <value>replied</value> </issueeventtype> </return> <return>...</return> <return>...</return> </ns2:getallissuehistoriesresponse> </soap:body> </soap:envelope> i trying extract return nodes have , issueeventtype value of 10. i have used following code in attempt achieve p_xml_content clob containing xml: l_xml_parser := '<?xml version="1.0" encoding="utf-8"?><results>'; l_xml_parser := l_xml_parser ||(xmltype(p_xml_content).extract('//return/issueeventtype/[id=10]...

multithreading - Using semaphore , Sync two threads Patient and Assistant -

i asked question in interview prestigious group in company(i cannot tell name) stack question while, generated possible solutions them want make sure solution correct, please comment or fix solution or guide me solution or show if solution has deadlock, starvation etc..., this problem: patients go bio lab work. lab contains nummachines. in lab there supervisor assign 1 machine each patient if there available machines. after patient finishes work, releases machine , waits until 2 patients done. when group has 3 patients formed leave. use semaphores , operations on semaphores, synchronize 2 types of threads: patient , supervisor binary semaphore mutex=1 counting semaphore machine =5 , done =0 patient: p(machine); v(done); p(mutex); waitingpatient++; if(waitingpatient==groupsize){ for(int i=0’i<groupsize;i++){ v(waiting); } waitingpatient=0; p(waiting); v(mutex); } else{ p(waiting); v(mutex); } assistant: while(true){ p(done); v(m...

javascript - echo user agent Casperjs -

so i've set new user agent using: casper.useragent('mozilla/5.0 (macintosh; intel mac os x 10_6_8) applewebkit/537.36(khtml, gecko) chrome/28.0.1500.95 safari/537.36'); but obtain newly modified user agent testing purposes, how 1 print out user agent has been modified using casper.js ? you try: casper.on('remote.message', function(msg) { this.echo(msg); }); casper.evaluate(function() { console.log(window.navigator.useragent); });

php - UrlEncoding giving different results -

javscript function: var s="ì"; var e=encodeuricomponent(s); document.write(e); exspected result: %c3%ac result : %c3%ac php function: $s = "ì"; echo $e = urlencode($s); exspected result: %c3%ac result : %ec what doing wrong? your php file encoded in single-byte encoding, iso-8859-1. when type in non-ascii character, use encoding's representation of character. expecting utf-8 (multi-byte) result. to result, encode php file utf-8 file. usually, ide have option this; in "save as..." dialog. alternatively, if can't or don't want change file's encoding, can do echo $e = urlencode(utf8_encode($s));

ios - Stop activityIndicator in Embedded TableView Cell Upon Return From Detail ViewController -

i have viewcontroller has container view. in container view have tableview contains static cells. each cell has disclosure indicator. created in ib. parent viewcontroller embedded in navigationcontroller. each cell pushes new view controller loads mapview. each map parses , loads .kml file. .kml files huge , take minute (or more) load. i placed activityindicator in accessory view of each cell using following code: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; uiactivityindicatorview *activityview = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; [activityview startanimating]; [cell setaccessoryview:activityview]; [self.tableview deselectrowatindexpath:[self.tableview indexpathforselectedrow] animated:yes];} this appears work expected. after viewing map touch "back" button provided navigation...

java - Jersey and AOP without Spring -

i using grizzly jersey 2.1. add aspect logging purpose (before , after each method execution). possibile without using spring or google-guice? thanks you can achieve similar using monitoring features offered jersey (particularly via event listeners ). need create , register instance of applicationeventlistener , requesteventlistener listening resource_method_start , resource_method_finished events. @provider public class myapplicationeventlistener implements applicationeventlistener { @override public void onevent(applicationevent event) { // noop. } @override public requesteventlistener onrequest(requestevent requestevent) { return new requesteventlistener() { @override public void onevent(final requestevent event) { switch (event.gettype()) { case resource_method_start: logmethod(event.geturiinfo(), true); break; ...

Does apportable support for sqllite at all? -

i tried "apportable build" on project makes reference sqllite. linking error. should do? here's error log packaging assets/exchangeothergamebtn_d.png packaging assets/exchangeothergameview.xib packaging assets/exchmenu.png /android/bacc/userinfo.m:33: error: undefined reference 'sqlite3_prepare_v2' /android/bacc/userinfo.m:34: error: undefined reference 'sqlite3_bind_int' /android/bacc/userinfo.m:35: error: undefined reference 'sqlite3_bind_int' /android/bacc/userinfo.m:36: error: undefined reference 'sqlite3_bind_int' /android/bacc/userinfo.m:37: error: undefined reference 'sqlite3_bind_int' /android/bacc/userinfo.m:48: error: undefined reference 'sqlite3_step' /android/bacc/userinfo.m:49: error: undefined reference 'sqlite3_finalize' /android/bacc/userinfo.m:58: error: undefined reference 'sqlite3_prepare_v2' /android/bacc/userinfo.m:59: error: undefined reference 'sqlite3_step' /android/...

amazon ec2 - Mongodb EC2 EBS Backups -

i have confusion on need here. new mongo. have set small mongo server on amazon ec2, ebs volumes, 1 data, 1 logs. need backup. it's okay take db down in middle of night, @ least currently. using boto library, ebs snapshots , python backup, built simple script following: sudo service mongodb stop run backup of data run backup of logs sudo service mongodb start the script ran through , restarted, noted in aws console snapshots still being created, through boto has come back, mongo has restarted. not ideal. i checked mongo docs, , found explanation on backups: http://docs.mongodb.org/ecosystem/tutorial/backup-and-restore-mongodb-on-amazon-ec2/#ec2-backup-database-files this info, bit unclear. if using journaling, are, says: if dbpath mapped single ebs volume proceed backup database files. we have single volume data. so, i'm assuming means bypass steps on flushing , locking. @ end of backup database files , discusses removing locks. so, i'm bit confused. r...

oracle - DBMS_Scheduler get/put file alternative -

i have side project i'm working on requires me copy on .csv file remote ftp , save locally. figured use dbms_scheduler.get_file not have permission. when asked manager, said wont able privileges , should other ways. after researching couple of days keep coming dbms_scheduler , out of luck or searching skills terrible. thanks i'm not you'd want use dbms_scheduler this; understand documentation (never used myself) ftp site have open all; there parameter destination_permissions , it's "reserved future use" , i.e. there's no way of specifying permissions @ moment. if i'm right agree manager, though not same reasons (it seems you'll never permission use dbms_scheduler hope incorrect). there other methods of doing this: utl_tcp ; method of interacting on tcp/ip protocol. oracle base has article , includes ftp package based on utl_tcp , instructions how use it. requires use of utl_file package, can write os files. utl_http ;...

php - Isolating the value of an array variable in a string -

let's have line in php file: $config['fw_ls'] = 'some value'; i want values between quotes. tried combinations like: preg_match('/\$config\[\'fw_ls\'\] = \'([^\'])*\';/',$sdata,$ak); var_dump($ak); sadly can't seem value between quotes, in above example returns character 't'. don't understand i'm doing wrong. i'd expect regex search starting quote , until finds quote. doesn't seem quite right. any appreciated. try this: $text = "\$config['fw_ls'] = 'some value';"; preg_match("#\\\$config\['fw_ls'\]\s*=\s*'([^']+)';#", $text, $match); print_r($match); array ( [0] => $config['fw_ls'] = 'some value'; [1] => value )

asp.net mvc - How to return View from action when the request is always asynchronous -

i have action following definition in mvc: public actionresult create(club club) { if (modelstate.isvalid) { club clubfound = db.clubs.firstordefault(x => x.clubname == club.clubname); if (clubfound != null) { viewbag.countryid = new selectlist(db.countries.orderby(x => x.countryname), "countryid", "countryname"); modelstate.addmodelerror("", "the club exists in database."); return view(); } else { db.clubs.add(club); db.savechanges(); string message = mvchtmlstring.create(@"club added db successfully. <a href=""/"">go home page.</a>").tostring(); //tempdata["successmessage"] = "club added."; return json(message, jsonrequestbehavior.allowget); ...

python - using requests to check dead URLs -

i using requests library check number of urls. aim see if still alive or not. code simple import requests def checkurlalive(url): r = requests.head(url,timeout=10) if r.ok: return true else: return false however, not work following url: http://ieeexplore.ieee.org/ielx5/6294/4804034/04804053.pdftp=&arnumber=4804053&isnumber=4804034 this url works on computer shows pdf file, however, method above gives me requests.exceptions.timeout error. on other hand, following url: http://www.wartsila.com/ss/satellite?blobcol=urldata&blobheader=jpg&blobkey=id&blobtable=mungoblobs&blobwhere=1278606917069&ssbinary=trueaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa should not valid url method above gives me positive result. how be?

android - I can't get eclipse to upload the most recent apk file to the emulator -

so app decided test out use of accelerometer. decided run file on actual device. connected device, installed of drivers , ran app , fine. when disconnected device, made changes, saved, , tried run app changes on emulator not change @ all. no matter changed in code, file remain same 1 tested. i've tried rebooting adb connection nothing works. no matter file being run on emulator not updated. thoughts? it error in 1 of xml files others have said. used have problems time, long there no errors should fine. if have checked, , still can't can projects -> clean or restart eclipse. if still doesn't work if delete r.java , clean should rebuild itself.

uisplitviewcontroller - iOS switch rootViewController not working -

i have login view checks see if there default settings, syncs data. if there no default settings, view waits user login. if there settings , data syncs correctly, should switch split view. the code works if user enters login information. syncs data, switches view. if user logged in, hits function , doesnt switch view. here code being called both paths: -(void)redirect{ nslog(@"redirect@"); uisplitviewcontroller *split = [self.storyboard instantiateviewcontrollerwithidentifier:@"orders_split"]; [self.view.window setrootviewcontroller:split]; } "redirect@" shows in log on initial load if user has logged in once. have confirmed there no sync errors, hits function not perform switch. i moving standard view nav controller splitview, cannot use manual segue trigger. try use app delegate: uisplitviewcontroller *split = [self.storyboard instantiateviewcontrollerwithidentifier:@"orders_split"]; myappdelegate *appdelega...

javascript - fraction slider not working -

i've downloaded fraction slider @jacksbox , have gone through documentation countless times , cannot figure out why slider won't show effects it's supposed to. site i'm working on: http://pacificdesignacademy.com/new/2 , example of slider supposed do: http://jacksbox.de/stuff/jquery-fractionslider/ . here path js: ../new/2/fractionslider/jquery.fractionslider.js and here path css ../new/2/fractionslider/fractionslider.css all of images stacking on top of 1 regardless of me defining overflow:hidden on containing element. not sure else here, appreciated. i'm supposed launch site september 1st... eep! thanks! a simple check in browser's console showed have syntax error on line 594 of page. have closing parenthesis instead of opening brace. update after fixed that, you're getting error : uncaught referenceerror: jquery not defined i suggest move code , place after you've included both jquery , slider plugin, page should thi...

css - Responsive Design Issue At the 320px and 480px Viewport Sizes -

i having difficult time figuring out why div being pushed down , out of div. if go following link http://www.chrismazzochi.com/index.php?subject=6 this page contains contact form, , if scale down 480px landscape or 320px portrait size viewport dimension, or view site on iphone, see there bit of gap between label , input. if use firebug able see label , input in question .styled_label , .styled_input respectively. first have used negative top margins align inputs because being pushed down , out of .form_fields container. don't want this. , can't these input fields budge on left. can help? i'd appreciate it. thanks, chris i think you. change mazzo_style.css in line number 1005. change margin-right:1%; margin-right:21.9592%

c# - DropDownList with anchor tag elements -

i new .net programming , perhaps trying relatively simple couldn't find useful example until now. i want generate anchor elements dropdownlist. have following code in asp.net: <asp:dropdownlist id="dropdownlist1" runat="server" autopostback="true"> </asp:dropdownlist> in code behind(c#), want interrogate database (the result returns url, description , title) , fill in dropdownlist following: <a href="url">title description</a> i add db results dropdownlist this: while (reader){ list.add("<a href='" + url + "'> " + title +" "+ description+"</a>"); } this.dropdownlist1.datasource = list; this.dropdownlist1.databind(); but showing whole line dropdownlist: "<a href='" + url + "'> " + title +" "+ description+"</a>" ,where url, title , description interpreted, , anchor tag appea...

html - wget --page-requisites locally? -

i have local html file referencing image , style data in various places in local file system. i’d list of referenced files; or alternatively command copy html files , referenced files clear location (with or without changing links in html file), can make self-contained zip file of html page. it seems wget provides support downloading html file including prerequisites (images, styles) using --page-requisites flag. unfortunately not support file:// url. what options here? why not setting local apache server , serve off localhost? you can use easyphp, mamp or other set local apache server.

c++ - Fast pseudorandom number generator for cryptography in C -

i using following code generate sequence of pseudo-random numbers used cryptographic purposes, read somewhere may not secure. can give me c implementation of better generator -- main goal method fast. instance, did research , came across blum blum shub method, totally kill performance doing pow(n) calculations. ps. , please don't quote wikipedia articles w/o c/c++ code. i'm looking c or c++ code sample of i'm showing below. #define rol(v, shift) ((((v) >> ((sizeof(v) * 8) - (shift))) | ((v) << (shift)))) ulonglong uipsn = doseed(); //64-bit unsigned integer for(int = 0; < sizeofarray; i++) { uipsn = uipsn * 214013l + 2531011l; uipsn = rol(uipsn, 16); //apply 'uipsn' } isaac ( http://www.burtleburtle.net/bob/rand/isaacafa.html ) 1 of fastest cryptographically secure prngs (code @ site). approach use block cipher in counter mode. twofish, reasonably fast , freely available, effective. if don't need lot of numbers...

javascript - Google Analytics: Using chrome's console to track an event? -

will work if use chrome console to _gaq.push(['_trackevent'... will work though ga script has been loaded? yes. the google analytics script replaces _gaq array own object; new push() function sends requests immediately. this allows use same _gaq.push() calls both before , after async script loads.

php - Cannot retrieve value of extra query per record? -

im working on table data users picked database. the problem im not being able put 2 statements on while condition because im getting data different tables , rows. @code <?php $con = mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("database_name") or die(mysql_error()); $result = mysql_query("select * users"); $space_used = mysql_query("select sum(filesize) file file.userid=users.id , file.statusid=1"); $total_files = mysql_query("select count(id) file file.userid=users.id , file.statusid=1"); echo "<table class='table table-striped table-hover table-bordered' id='sample_editable_1'> <tr> <th>username</th> <th>type</th> <th>email</th> <th>last login</th> <th>last ip</th> <th>space_used</th> <...

Scala Def Macros - How do I get the parameterized type member of a symbol? -

i'm trying parameterized type of member on symbol in macro context. have symbol available (can't use weaktypeof[list[blah]]) because iterating on bunch of classes. val mewantarg = classsymbol.member("paramlist": termname).typesignature returns... => list[iwantthis] how iwantthis type object??? i've tried: mewantarg.typesymbol.astype.typeparams //returns list(type a) i've tried extraction: typeref(_,_,args) = mewantarg //returns () keep in mind, using 2.10.2 macro plugin. i guessing => iwantthis paramlist not val arity-0 method without parentheses: def paramlist: list[iwantthis] = ??? if so, member method type, , have return type of method before extracting arguments it: val mewantarg = classsymbol.member("paramlist": termname).asmethod.returntype val typeref(_,_,args) = mewantarg

css - How to write cssSelector to Find Save Button -

please me write css selector identify save button. webelement save_btn = driver.findelement(by.cssselector("")); <div id="button-1050" class="x-btn actionbutton x-box-item x-toolbar-item x-btn-default-toolbar-small x-noicon x-btn-noicon x-btn-default-toolbar-small-noicon" style="border-width: 1px; left: 293px; top: 5px; margin: 0px;"> <em id="button-1050-btnwrap"> <button id="button-1050-btnel" autocomplete="off" role="button" hidefocus="true" type="button" style="height: 16px;" class="x-btn-center"> <span id="button-1050-btninnerel" class="x-btn-inner" style="">save</span> <span id="button-1050-btniconel" class="x-btn-icon "></span> my official answer is: save_btn = driver.findelement(by.xpathselector("//*[text()[contains(.,'save')]]")); ...

javascript - Improving security with JS -

i’m trying little ideas, , i’ve hit snag. at moment, when user logs in, password stored in variable handled later. 1 has hold of password go developer tools or console or whatever , add statement alert(pass.value); . i know unrealistic been bugging me. there way of detecting alert statement , scrambling password somehow? regex or string replace? thanks! if want have secure system, don't store password on client side. there absolutely nothing can in javascript prevent accessing password if stored in javascript variable. all of authentication should handled on server side. if storing passwords somewhere, not store them in plain text, , not use home-brew encryption method. cryptology full of minefields , it's easy wrong, , recommend using thought-out system bcrypt .

javascript - Show div if radio value selected -

i show div if radio value selected hide again if different value selected <input type="radio" name="timespan" id="timespan" value="ongoing" checked>on-going <input type="radio" name="timespan" id="timespan" value="history">historical <script type="text/javascript"> $(document).ready(function() { $('.end_date').css('display','none'); $('#timespan').click(function () { var selected = $(this).find(':checked').val(); if(selected == 'history') { $('.end_date').css('display','block'); } else { $('.end_date').css('display','none'); } }); }); </script> if history selected want elements class end_date show, otherwis...

Can Google Cloud Endpoints Be Hit Using Task Queues? -

i have app engine task queue tries call cloud endpoint, when see task queue fire off gets 404. verified endpoint configured post: @apimethod(name = "sendemail", path = "sendemail", httpmethod = httpmethod.post) and queueing this: taskoptions loptions = taskoptions.builder.withurl("/_ah/api/email/v1/sendemail"); i can hit endpoint using endpoint explorer, missing? thanks! it's defaulting method try adding method post or making endspoints method get. withurl("....").method(method.post)

php - Random Cannot send session cache limiter - headers already sent -

in server logs see there error php warning: session_start() [function.session-start]: cannot send session cache limiter - headers sent (output started @ /public_html/templates/meta.php:294) in /public_html/include/query.php on line 7 seems obvious got output started sooner...but errors gets generated , can't reproduce maybe because `session_start()' inside of if statement. this beginning of query.php <?php // including here can check user logged in or not on each , everypage if(!isset($_session)) { //to make session work across multiple domains. session_set_cookie_params(0, '/', '.mydomain.com'); session_start(); } everywhere query.php gets included before meta.php meta.php html , js few php blocks , line 294 in middle of js function. but intrigues me error request not involve these 2 files @ all. for example from access log 66.249.72.33 - - [19/aug/2013:22:44:30 +0100] "get /robots.txt http...

Build new joomla Component in Legacy or Native classes? -

i starting develop first joomla 3 component. should choose legacy or native classes , why? support in future? joomla core components use legacy classes. gonna removed in future? thanks! if starting joomla! development right now, opinion start using legacy classes. knowledge, legacy support in next major release (3.5) in current sts releases (3.1, 3.2). what going happen in future rather thing discussed, software evolving, joomla. you should learn using legacy classes because: you find of documentation / books / support them core components build using them (and understanding how core components work, key success in developing extensions). native classes: are rather poorly documented not many examples (for example joomla installer using them) not many use them, getting support might rather difficult it have @ them 1 have more experience joomla, can understand benefits they don't have powerful jmodel legacy classes have, building crud functionalit...

jquery - In rails, is there any gem works like the auto complete function in twitter? -

when press @ key in text field, there list of available option nearby cursor, similar in twitter or stackoverflow. i've installed auto_complete plugin jquery ui, i'm not sure whether it's available in case. the jquery autocomplete should work fine. need give list autocomplete from, or can set query database on ajax larger lists. see bit of walkthrough here: how set-up jquery-ui autocomplete in rails more info on autocomplete gem here: https://github.com/crowdint/rails3-jquery-autocomplete , example app here: https://github.com/crowdint/rails3-jquery-autocomplete-app

function - Why isn't this onclick JavaScript call working? -

html <div id="test"></div> <input type="button" value="go" onclick="test()" /> javascript function test() { alert("test!"); } fiddle http://jsfiddle.net/mvbrs/11/ please @ one, jsfiddle code frames separation: inline event handler not working in jsfiddle of course, if running same code embedded on plain html works normally, having alerted popup appearing. <!doctype html> <html> <head> <script> function test() { alert("test!"); } </script> </head> <body> <div id="test"></div> <input type="button" value="go" onclick="test()" /> </body> </html>

debugging - Any way to turn on/off a println in java (verbose mode) -

is there way in java can make println appear when requested, not default? similar using "-v" in many programs give verbose mode, information on happening. for example let's have if statement in loop, , simple println tells me whether if statement evaluates true each iteration of loop. there other way toggle on/off it's visibility other commenting out when don't need , uncomment when do? saving it, recompiling it, etc. it make lot easier see going on in program, when want info. said, looking way implement "verbose" mode shows print statements, without having comment/uncomment save, recompile, etc. java have this? your best choice use appropriate logger of kind ( log4j example). if that's not possible, can "consume" stdout , stderr using like... printstream nullprintstream = new printstream(new outputstream() { @override public void write(int b) throws ioexception { } }); system.seterr(nullprintstream); syste...

javascript - Why does this CSS style interfere with HTML5 drag and drop? (position: absolute; left: -10000px) -

dojo dijit buttons hide "real" button offscreen using css: .dijitoffscreen { position: absolute !important; left: -10000px !important; top: -10000px !important; } why cause html5 drag , drop not function correctly in chrome , firefox? what alternative methods hide input element , maintain same dojo dijit button behavior? (adding display:none offscreen input element seems work, functionally alter behavior of input , widget?) original question: sometimes default 'ghost' html5 drag image smaller in size or not rendered @ all. varies browser , there seems interaction dojo dijits involved. after adding dijit button draggable dijit contentpane, causes drag icon tiny in firefox , not rendered @ in chrome? simple jsfiddle repro : var cp1 = new contentpane({ style: "width: 400px; height: 124px; background:red", content: "cp1: 'ghost 'drag icon tiny or not visible :(<br />", }); // make draggab...

google app engine - GAE can't access bootstrap folder -

this question has answer here: yaml configuration add 1 more script file google app engine 1 answer i'm noob missing rudimentary. taking advice of senthil kumaran here , added bootstrap folder app.yaml, still can't reference resources. app.yaml looks like: application: generacy version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /static static_dir: static - url: /.* script: blog.app - url: /bootstrap static_dir: bootstrap libraries: - name: jinja2 version: latest - name: pil version: "1.1.7" and i'm referring bootstrap js using @ bottom: <script src="bootstrap/assets/js/jquery.js"></script> <script src="bootstrap/dist/js/bootstrap.min.js"></script> <script src="bootstrap/assests/js/holder.js"></script> but doesn't work. howev...

mysql - Update table values from another table using joins? -

i trying update collection of computer hostnames match changed room numbers. hostnames in database formatted fl-itf2106a 2106 being old room number. have list in table has old , new room numbers on same row. have been trying strip non-numerics out of string hostname , join updates table unsuccessfully. update computers c inner join updates u on u.old = ( select numericonly(c.hostname) hostname "%fc%" ) set c.hostname = concat('classf', u.new); numericonly user function removes characters numerics string. i trying set hostname column equal classf + new room number. i'd take chances like update computers c inner join updates u on u.old = numericonly(c.hostname) set c.hostname = concat('classf', u.new) c.hostname "%fc%";

php - Html/Js live update page -

i programming website church hockey league, , trying make page live updates. trying setinterval() signal php update time.txt live page can draw time from. update.html has time on it, page sends time php doc function writes time time.txt, live.html gets time every 5 secs setinterval() . in 5 secs live.html keeps own time, needs check every 5 pauses or time changes. the problem this: server cant handle updating time.txt every 2.5 seconds need simpler method doesn't require me update time.txt every 2.5, live.html still can time, pauses, , time changes. any please. here update.html $('#play').click(function(){ if(pause == true){ $('#play').attr('src',"mup/pause.jpg"); $.get("mup/postt.php", {text: "11"}); pause = false; } else { $('#play').attr('src',"mup/play.jpg"); $.get("mup/postt.php", {text: "09"}); pause = true; ...

python - Pass tuple as input argument for scipy.optimize.curve_fit -

i have following code: import numpy np scipy.optimize import curve_fit def func(x, p): return p[0] + p[1] + x popt, pcov = curve_fit(func, np.arange(10), np.arange(10), p0=(0, 0)) it raise typeerror: func() takes 2 arguments (3 given) . well, sounds fair - curve_fit unpact (0, 0) 2 scalar inputs. tried this: popt, pcov = curve_fit(func, np.arange(10), np.arange(10), p0=((0, 0),)) again, said: valueerror: object deep desired array if left default (not specifying p0): popt, pcov = curve_fit(func, np.arange(10), np.arange(10)) it raise indexerror: invalid index scalar variable. obviously, gave function scalar p. i can make def func(x, p1, p2): return p1 + p2 + x working, more complicated situations code going verbose , messy. i'd love if there's cleaner solution problem. thanks! not sure if cleaner, @ least easier add more parameters fitting function. maybe 1 make better solution out of this. import numpy np scipy.optimize import curve_fit ...

Writing an If condition within a Loop in SPSS -

i want have if condition within loop. long id < 10, check if modc_initial equal modc, if true set d = 12 this code tried bit not working, can please help. loop if (id lt 10) if(modc_initial eq modc)) compute d = 12. end loop. execute. you can either use 1 line conditional of form if (condition) d = 12. or multiple line do if . below provide example of do if adapted syntax. data list free / id modc modc_initial. begin data 1 3 3 2 3 5 12 1 1 end data. loop if (id lt 10). if (modc_initial eq modc). compute d = 12. end if. end loop if (d = 12). execute. note had period missing in original syntax on initial loop . added end loop condition, otherwise code written go until maximum set number of loops per system.

Hibernate HQL IN clause only match first item of list -

the problem : in clause of hql query matches first item of comma separated list! the hql query : from news 93 in (pictureids) news entity : public class news { string id; string pictureids; // comma separated list of pictureids } note: if change hql query , hardcode pictureids result correct! how can change query resolve problem? try this: from news pictureids '%,93,%' commas added start , end.

Understanding For Loops -

i'm trying out loop. added if statement stop loop once reaches 30. have seen i <= 10 run 11 times, since loop still run when reaches 10. why code below run 11 times (first print line) if there if statement sets i 0 when reaches 10? shouldn't print 10 asterisks instead of 11 - since never reaches 11th loop? also, second if sets i 10, should let loop run 1 more time, through first if , , set i 0? int j = 0; (int = 0; <= 10; i++) { console.write("*"); if (i == 10) { j++; console.writeline(""); = 0; } if (j == 30) { = 10; } } on first loop, line has 11 stars, because i iterates 0 through 10, total of 11 iterations. whenever i becomes value 10, j incremented, newline printed, , i becomes 0 . however, when i set 0 within loop, loop makes i iterate 1 10, total of 10 iterations. this because i incremented before next iteration starts. a for loop structu...

php - Remove Content-Type header in apache -

how remove header content-type in apache ? the following code not work header_remove('content-type'); try this. header("content-type: none"); i don't know why, it's worked me. i cannot find reference mentioned this. it's removed content-type header me. it' may apache's bug or php's bug. try , use careful.

java - quartz compatibility with jdk version 1.4 -

did know maximum version of quartz can use when use jdk 1.4? i try search everywhere could't find it. in this other question : server 1: quartz 1.x running in jdk 1.4 code server 2: quartz 2.x running in jdk 1.6 code but try use quartz <groupid>org.quartz-scheduler</groupid> <artifactid>quartz</artifactid> <version>1.8.6</version> and know org.quartz.impl.stdschedulerfactory have wrong version 49.0, should 48.0 use in jdk 1.4. the version support jdk 1.4 quartz 1.5.2, can it's jar here . , dependency maven repository : <dependency> <groupid>quartz</groupid> <artifactid>quartz</artifactid> <version>1.5.2</version> </dependency> then use (surround try catch): scheduler s = sf.getscheduler(); s.start(); jobdetail jd = new jobdetail("myjobq", "job_group", updaterjob.class); crontrigger ct = new crontrigger("mytrigger",...

javascript - Call function in nodejs from angular application -

i'm having angular app(angular-seed app) should call function in nodejs(web-server.js). function in nodejs calls batch file. the op didn't mention express i'll provide alternative server side (node.js part) without using additional frameworks (which require installing via npm). solution uses node core: web-server.js: 'use strict'; var http = require('http') var spawn = require('child_process').spawn var url = require('url') function onrequest(request, response) { console.log('received request') var path = url.parse(request.url).pathname console.log('requested path: ' + path) if (path === '/performbatch') { // call existing function here or start batch file this: response.statuscode = 200 response.write('starting batch file...\n') spawn('whatever.bat') response.write('batch file started.') } else { response.statuscode = 400 response.write(...

pca - Extract Identifier from Principal Component Analysis with Missing Data in R -

i conducting principal component analysis in r on vectors missing data. want extract score principal component , match values observations not missing in original frame can't figure out how extract , match on right identifiers. example: x1 <- c(1,2,3,na, 5,6,7) x2 <- c(7,na,6,na, 4,3,2) frame <- cbind(x1,x2) pca_ob<- princomp(~frame) pca_ob$score[,1] this produces following output: 1 3 5 6 7 4.273146 2.104705 -0.715732 -2.125950 -3.536168 i bind pca_ob$score[,1] original frame based on identifiers , fill rest in nas such produces following matrix: x1 x2 x3 1 1 7 4.273146 2 2 na na 3 3 6 2.104705 4 na na na 5 5 4 -0.715732 6 6 3 -2.125950 7 7 2 -3.536168 this takes output of first set of scores , matches them frame nas filling spots there isn't pca score , matching on variables there scores.any thoughts? thanks. this feels bit of hack. there may better solution ou...

How to know if vim call from Git, in vimrc -

.gitconfig [core] editor = /usr/bin/vim .vimrc autocmd vimenter * nerdtree ./ i don't want call in git commit. i want this if !gitcommit autocmd vimenter * nerdtree ./ endif this snippet should put in right direction: augroup isnotgitcommit autocmd! autocmd vimenter * nerdtree ./ augroup end autocmd bufread commit_editmsg autocmd! isnotgitcommit the notgitcommit group contains generic autocmd works "regular" file. the other autocmd triggered when edit commit message, before vimenter event, , removes notgitcommit group.

jquery - Why is on blur and focus not working on appended input textfield? -

ers. can explain me why blur , focus events aren't working on appended input textfields? as can see in jsfiddle . input fields created in html seem listen blur , focus event. when append input textfield using append button, input textfields don't listen blur/focus events. html <input class="input" value="value 1"> <input class="input" value="value 2"> <div id="appendinput">append input textfield</div> <div id="inputcontainer"></div> jquery var counter = 0; $("#appendinput").click(function () { $('<input class="input" value="value 3" type="text" id="input' + (counter) + '"/>').appendto('#inputcontainer'); counter++; }); $('.input').on('focus', function () { thisvalue = $(this).val(); $(this).attr("value", ""); }); $('.input').on(...

php - Change Variable Value in While Looping -

i want know how modify variable value each time while looping. please guide me doing wrong in below coding. $amount = 500; while ($amount > 0) { $a = $amount - 50; echo $a . "<br>"; } i receiving this: 450 450 450 450 450 450 450 450 450 but want that: 450 400 350 300 250 200 150 100 50 you not changing the amount in loop, hence getting result 450 form statement: $a = $amount - 50; which evaluates time $a = 500 - 50 = 450 change code this: $amount = 500; while ($amount > 0) { $a = $amount - 50; echo $a . "<br>"; $amount = $amount - 50; }

php - Uploading a Stream of files using move_uploaded_files -

i have been trying upload stream of files using following code, <form enctype="multipart/form-data" action="carousel_update.php?id=<?php echo $id;?>" method="post"> for($j = 1 ; $j <= $n ; $j++) { echo "<option value='$j'>$j</option>"; } echo "</td></tr> <tr><td>title:</td><td><input type=\"text\" name=\"title[$i]\"></td></tr> <tr><td>image: </td><td><input type=\"file\" name=\"picture$i\"></td></tr> <tr><td>description:</td><td><textarea name=\"description[$i]\"></textarea></td></tr> <tr><td>link text: </td><td><input type=\"text\" name=\"link_text[$i]\"></td></tr> <tr><td>link url: </td><td...

symfony - Does not insert as a new record instead replaces a previous record -

i have tried insert new record in database table instead keeps replacing record in table. (currently have single record in table). ideas why? here's query: public function setexperimentdata($name, $type, $description) { $updatequery = $this->repository->createquerybuilder('ud') ->update() ->set('ud.name', $this->em->createquerybuilder()->expr()->literal($name)) ->set('ud.type', $this->em->createquerybuilder()->expr()->literal($type)) ->set('ud.description', $this->em->createquerybuilder()->expr()->literal($description)) ->getquery(); $updatequery->execute(); } yes have tried following (experiments() entity): $experiment = new experiments(); $experiment->setname($experimentname); $experiment->setdescription($experimentdescription); $experiment->setprimaryinvestigator($primaryin...

PHP PDO Cant Bind Params in Class -

this question has answer here: can php pdo statements accept table or column name parameter? 6 answers php pdo - bind table name? [duplicate] 2 answers i cant code bind params mysql query, doing wrong here? error fatal error: uncaught exception 'pdoexception' message 'sqlstate[hy093]: invalid parameter number: number of bound variables not match number of tokens' in /users/warren/sites/frame work/modules/user login/classes/db.php:34 stack trace: #0 /users/warren/sites/frame work/modules/user login/classes/db.php(34): pdostatement->execute() #1 /users/warren/sites/frame work/modules/user login/classes/db.php(48): dbconnect->get_contents() #2 {main} thrown in /users/warren/sites/frame work/modules/user login/classes/db.php on line 34 code <?ph...

javascript - Scrolling to a particular position in Safari on iPhone -

is possible modify below code scrolls particular position in safari , not bottom now. javascript:scroll(0,document.getelementsbytagname(%20′body’)%5b0%5d.scrollheight); i'm okay if can suggest different code same. thanks in advance! you can scroll position on page using scrollto(h,v) //h = horizontal, v=vertical window.scrollto(0,500); http://jsfiddle.net/vlmb9/ edit: spaced on iphone portion. have use settimeout: settimeout(function () { window.scrollto(0, 500); }, 1000);

android - Id of edittext in searchable app -

i want implement search view in app when user clicked on search button on device search data. dont know how can set id default search edittext , how can id of that.i know id of edittext findviewbyid dont know id of edittext add edittext in xml file want appeare , set visibility "gone" , set , id it. ex: <edittext android:id="@+id/myid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" /> when want appear (when press search button guess) set visibility visible. ex: edittext..setvisibility(view.visible); now edittext visible , user can add input. input gettext().tostring() , when want gone set visibility gone.

php - How big can CMS database be? -

planing build simple cms (with php) own educational needs , ran problem design have never encountered in book or tutorial. if wanted let used mess around colors example. how do that? idea had make database such options , echo them site normal css. thet mean load db every single time visits webasite. seems me overload website. again, have never encountered such problem. or there way of doing more easily? thanks every answer! edit: create system enables user change css via cms. example background color, drop-down menu colors, text sizes, fonts , lot of other stuff handeled css. simple customization. asking 2 questions. how? system should use? no book/tutorial read never covered editing css files using php have no idea how that. or maybe there better ways of doing it? i had idea how store customisable data. in database wanted know how big can , whether problem when posibly tens or maybe houndreds of variables loading site. edit2: , btw never worked wordpress or other ...