Posts

Showing posts from February, 2010

copy - Copying files in php -

i know copy() function not allow directories listed first, there way bypass this? attempting copy file 1 directory different directory, need able state file should copied , to. here code have: if ($_files["pdffile"]["type"] == "application/pdf") { if (file_exists("../pdf_new/".$rowapp['filename'])) { copy("../pdf_new/".$rowapp['filename'], "../pdf_new/backup/".$rowapp['filename']); } move_uploaded_file($_files["pdffile"]["tmp_name"], "../pdf_new/".$rowapp['filename']); } i tried replacing "../pdf_new" variable , adding "/" between variable , .$rowapp['filename'], still did not work. thoughts?

if statement - Adding string to variable powershell -

i trying create powershell script append character variable if variable not null. instance user fills out form, or spreadsheet cell in case , has data want append | variable when call variable in script display | contents of variable. have , not seem working. if ([string]::isnullorempty($field6)) {$field6 = $field6} else {$field6 = "| $field6" } } echo $field6 this should suffice: if ($field6 -ne $null) { $field6 = "| $field6" }

html - Struts2 Textarea Resize -

basically i'm trying 'hide' resize handle on struts2 textarea. attempt @ had , unexpected result. code told overflow in x & y direction scrollbar told resize 'none' i expected resize handle disappear did overflow wrapping down next line instead of scrolling. <s:textarea name="newsstring" cols="65" rows="17" style="overflow: scroll; resize: none;"></s:textarea> so how should go hiding resize handle , still having scroll? if @ possible. in struts2 tags, class , style attributes named cssclass , cssstyle . this work: <s:textarea name="newsstring" cols="65" rows="17" cssstyle="overflow: scroll; resize: none;" /> the fact wasn't getting compilation errors due inexistent attribute, because <s:textarea> tag (like <s:file> tag , maybe others), has dynamic attributes allowed: true ( as specified in official d...

java - Apache POI org.apache.poi.ss.formula.FormulaParseException -

i'm using apache poi , i'm facing issue when evaluating formula cell. this code: xssfcell cellvalue = sheet.getrow(6).getcell(2); if (cellvalue.getcelltype() == cellvalue.cell_type_formula) { evaluator.evaluateformulacell(cellvalue); } the formula: =c6/num_input , num_input = f36 the issue: org.apache.poi.ss.formula.formulaparseexception: cell reference expected after sheet name @ index 18. first, leave poi , check in excel if formula working fine. there no problem @ poi end. wrote sample code , it's working fine. xssfworkbook workbook = new xssfworkbook(); xssfsheet sheet = workbook.createsheet(); xssfformulaevaluator evaluator = new xssfformulaevaluator(workbook); xssfcell cellvalue = sheet.createrow(0).createcell(0); sheet.getrow(0).createcell(1).setcellvalue(2); sheet.getrow(0).createcell(2).setcellvalue(5); cellvalue.setcellformula("b1+c1"); if (cellvalue.getcelltype...

linux - How can I efficiently handle the result set of mysql from a bash script? -

i excited see how easy write bash script interact mysql . trying this: #!/bin/bash res=`mysql -u $user -p$pass students <<eof | tail -n +2 select name table age = 20 limit 1; eof` d in $res; echo result : $d done if result "john smith" get: result: john result: smith how can around issue space? seems treats 2 values while single column. one way ask adding before loop: ifs=$'\n' this change default bash internal field separator (ifs), default works spaces, tabs , new lines. my example work new lines, you're looking for.

javascript - Print PDF in IE using window.print -

i have pdf document i'm opening in new window using javascript , attempting print using window.print(). following code works in chrome, not ie. ideas? var pdfwindow = window.open('/mypdf.pdf', '_blank'); pdfwindow.print(); that not work. if ask me, best way of implementing pdf in browser following. create php file this: i'm calling first php file "firstfile.php" <?php header('content-type: application/pdf'); $file='yourpdffile.pdf'; @readfile($file); ?> then create php file , use iframe desired pdf file. sample code below <iframe src="http://localhost/domainfolder/firstfile.php>" height="400px" width="750px"> </iframe> hope helps

c# - Preventing SQL injection on insert -

i looking tips prevent sql injection. told on forum code not safe , looking nice enough me fix that. i have webform , on submit goes aspx.cs page , inserts data ms sql database. protected void submit_click(object sender, eventargs e) { string fullstarttime = starttimehourlist.selectedvalue + ":" + starttimeminutelist.selectedvalue + " " + starttimeamlist.selectedvalue; string fullendtime = endtimehourlist.selectedvalue + ":" + endtimeminutelist.selectedvalue + " " + endtimeamlist.selectedvalue; oledbconnection conn; oledbcommand cmd; conn = new system.data.oledb.oledbconnection(""); cmd = new system.data.oledb.oledbcommand(); conn.open(); cmd.connection = conn; var sql = string.format(@"insert formtable1 (nonprofit, contact, phone, email, event, startdate, enddate, starttime, endtime, place, comments, submitdate) values ...

How do I Load AGRC ArcGIS REST tile service in Openlayers? -

how load service http://mapserv.utah.gov/arcgis/rest/services/basemaps/lite/mapserver in openlayers? projection 26912 (utm zone 12). here 1 of variations tried (without success): var map = new openlayers.map({ div : "rcp1_map", projection: new openlayers.projection("epsg:26912") }); var agrclite = new openlayers.layer.xyz( "agrc lite", "http://mapserv.utah.gov/arcgis/rest/services/basemaps/lite/mapserver/tile/${z}/${y}/${x}"); map.addlayer(agrclite); using xyz method works in case: var esriworld = new openlayers.layer.xyz( "esri", "http://server.arcgisonline.com/arcgis/rest/services/world_topo_map/mapserver/tile/${z}/${y}/${x}", {sphericalmercator: true} ); but can't work agrc service. any appreciated! have @ resource : openlayer / blog sathyaprasad using openlayers.layer.arcgis93rest class must trick cache services not available in wished projection.

asp.net - Visual Studio 2010 displays IIS 7 page on debug instead of my project -

this first asp.net project bit of rookie when comes lot of configuring of iis/visual studio bear me... i using visual studio 2010 running on windows server 2008 sr2. did updates on server , project no longer loads when attempt debug. when try debug default "welcome" page iis 7 loads instead of project. set use development server debug, not iis don't understand why iis page. before updates debugger pulling page without issues. any ideas? in advance! it looks iis bound port number visual studio development web server using previously. can change port number in properties of web site project.

javascript - Asynchronous (setTimeout) lambda doesn't use correct inputs -

this question has answer here: javascript closure inside loops – simple practical example 31 answers javascript settimeout, loops , closure 1 answer i got below code within callback of xmlhttprequest callback function: // more code before ... // schedule ui update var totsteps = 6; for(var = 0; < listchangeel.length; ++i) { // callback pulse function var curpulse = function cell_pulse(elname, curcnt) { console.log("accessing element: " + elname); var curel = document.getelementbyid(elname); console.log("element: " + elname + " = " + curel); var curcolor = rgb2html(255, 255*(curcnt/totsteps), 255*(curcnt/totsteps)); if(curcnt < totsteps) { // recursion here! settimeout( function(){ cell_pulse(elname, cur...

jquery - Sticky header with transition animation -

$(function () { $('#nav').data('size', 'big'); }); $(window).scroll(function () { if ($(document).scrolltop() > 0) { if ($('#nav').data('size') == 'big') { $('#nav').data('size', 'small'); $('#nav').stop().addclass('nav-min'); } } else { if ($('#nav').data('size') == 'small') { $('#nav').data('size', 'big'); $('#nav').stop().removeclass('nav-min'); } } }); .. works perfectly, menu jumps normal min, possible somehow animate transition looks smooth? thanks to animate and change classes... $('#nav').stop().animate({...}, 999, function() { $('#nav').addclass('nav-min'); }):

jquery - Clear select2 without triggering change event -

i have select2 input i'm using , on 'change' i'm grabbing values , performing action. i'm trying clear select2 without triggering change event. possible? to clear select2 i'm using following code: $docinput.select2('data', null); this clears input desired, triggers change event runs through other code. there must way silence trigger. ideas? i believe need is: $docinput.select2('data', null, false);

android - What is the best way to handle a large list data set with orientation changing? -

i have large data set base adapter in twitter-like app, consists of custom models (with nested references) quite large in themselves. the issue i'm having is, when re-creating activity on orientation change, list quite slow populate (i'm passing data set through onsaveinstancestate ) i've looked changing way serialise models (currently using kryo has sped saving disk aspect), caching disk , reloading in oncreate , using setretaininstance(true) in list fragment, i've tried handling configuration changes in parent activity. although latter quickest, it's last option want take there's lot of downsides handling orientation , mean having re-write chunks of code. my question is, best practice of handing adapter repopulating on orientation? i can foresee oom errors when serialising list pass through onsaveinstancestate edit: possible duplicate best way persist data between orientation changes in android one of options avoid recreating activity...

uart - Using ElectricImp server.show() and Arduino -

i'm following sparkfun tutorial connecting arduino electric imp . have 1 arduino , imp, i'm trying whatever type in arduino serial monitor display in imp node using server.show() . i've modified 1 of functions in sparkfun code this: function polluart() { imp.wakeup(0.00001, polluart.bindenv(this)); // schedule next poll in 10us local byte = hardware.uart57.read(); // read uart buffer // return -1 if there no data read. while (byte != -1) // otherwise, keep reading until there no data read. { // server.log(format("%c", byte)); // send character out server log. optional, great debugging // impeeoutput.set(byte); // send valid character out impee's outputport server.show(byte) byte = hardware.uart57.read(); // read uart buffer again (not sure if it's valid character yet) toggletxled(); // toggle tx led } } server.show(byte) displaying seemingly random numbers. have idea of why...

html - Error: Insufficient Scope Permissions -

i developing web application post stocktwits wall. getting error: insufficient scope permissions. can tell me error is? my code is: <form name="chart" method="post" action="https://api.stocktwits.com/api/2/messages/create.json?access_token=657c40d5a04615c973d474745f8f1311960dcc6d"> <a id="post">message posting</a> <input type="submit" value="post" /> </form> i suggest reading more on http://stocktwits.com/developers/docs/api http://stocktwits.com/developers/docs/authentication#scopes . the message self evident - not have enough permission api call.

jquery - getJSON call succeeds but still throws 500 error -

i have getjson() call accesses view returns data. call works , data retrieved despite still getting 500 error. failed load resource: server responded status of 500 (internal server error) multivaluedictkeyerror @ /album_ajax/ "key u'reid' not found in <querydict: {}>" request method: request url: http://127.0.0.1:8000/album_ajax/ django version: 1.4.3 python executable: /usr/bin/python python version: 2.7.1 python path: ['/users/santi/programming/feastfm', '/library/python/2.7/site-packages/pip-1.2.1-py2.7.egg', '/library/python/2.7/site-packages/south-0.7.6-py2.7.egg', '/system/library/frameworks/python.framework/versions/2.7/lib/python27.zip', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-darwin', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-mac', '/system/li...

ember.js - How to check if route is in transition -

is there way check if route in transition? need add loading state view while model being fetched. i've found several different answers none seem work. wondering if there's canonical/idiomatic approach this. give in gist , have usefull information how create global loading, or 1 route

What is a proper way to add listeners to new elements after using AJAX to get the html content? (jQuery, Javascript) -

i making can loads new setting pages via ajax, not sure what's efficient way bind listeners elements new content page? here's thought. can make function compares file path, , each condition, apply correct listeners new elements based on page ajax loaded. feel makes function big if have large amount of pages. thanks! two ways: 1) bind on non-dynamic parent container using .on() $('.some-parent-class').on('click', '.element', function() { // stuff! }); 2) bind new elements after ajax call completed $.ajax(url, { // ajax options }).done( function(data) { var newel = $('<div class="element"></div>'); // setup newel data here... newel.on('click', function() { // stuff }); newel.appendto($('.some-parent-class')); }); the former results in quicker ajax response times, may slow click responsiveness down.

Using intern in java Strings -

i trying understand java's string class having hard time understanding situation described below. consider following example snippet: string x = new string("hey"); string y = "hey"; if use bool = y == x.intern(); variable bool equal true . my question is: when make declaration this: string b = "h"; string = b.intern + "ey"; boolean x = == "hey"; x 's value false when make a = (b + "ey").intern(); x 's value true . why won't x = true in second example? because declarations in first example not alike? if yes differences? with first example: string y = "hey"; java automatically interns string literals such ( jls section 3.10.5 ): moreover, string literal refers same instance of class string. because string literals - or, more generally, strings values of constant expressions (§15.28) - "interned" share unique instances, using method string.inte...

asp.net - Can HttpClient share same the HttpContext.Current.Session.SessionID as its host? -

there times when want make calls httpclient within asp.net web site internal resources ( asp.net webforms , mvc running together). the first hurdle forms auth cookie, think solved, second problem though when call mvc controller, system.web.httpcontext.current.session.sessionid different when initiated call. sessionid being used key cache items, items come null in controller. so question boils down this, did implement cookie swapping correctly , can httpclient inherit session it's host if has one? try { // boostrap properties tab preloading data uri baseaddress = new uri(request.url.getleftpart(uripartial.authority)); cookiecontainer cookiecontainer = new cookiecontainer(); string resource = string.format("/contact/propertybootstrapper/{0}", request.params["contactguid"]); httpcookie appcookie = request.cookies[formsauthentication.formscookiename]; using (httpclienthandler handler = new httpclienthandler { cookiecon...

image - SWT Button setImage(null) -

Image
i want button not resize when setting image null. button wrapped in custom colorselector jface . see here . i've made own custom color selector, can set null image button. e.g. background color null here: my solutions: set griddata swt.fill internally. set widthhint or minimumwidth . draw gradient rectangle on 'default image', set image button. (remember, cocoa buttons have gradient, solution if presenting button nothing's there) don't these. seem hardcore workarounds. instead of setting null-image, may try set transparent image.

linux - Reserving system memory using kernel boot parameters -

i playing of linux boot params. trying create hole in system memory using memmap option. have 6gb system , e820 map shows: 0x100000-0xcf49d000 usable memory. decided create hole 128mb 1g , mark reserved , allow system use memory 1g-2g. in boot options configured follows: memmap=890m$128m memmap=1g@1g . however, once system boots modified memory map quite different expect. 0000000000100000 - 0000000037a00000 (usable) 0000000040000000 - 0000000080000000 (usable) what must doing wrong? i know, kernel needs low memory , cant make whole 1m 1g. why thought of giving 128mb initial boot sequence. thanks

regex - Mocha Supertest json response body pattern matching issue -

Image
when make api call want inspect returned json results. can see body , static data being checked properly, wherever use regular expression things broken. here example of test: describe('get user', function() { it('should return 204 expected json', function(done) { oauth.passwordtoken({ 'username': config.username, 'password': config.password, 'client_id': config.client_id, 'client_secret': config.client_secret, 'grant_type': 'password' }, function(body) { request(config.api_endpoint) .get('/users/me') .set('authorization', 'bearer ' + body.access_token) .expect(200) .expect({ "id": /\d{10}/, "email": "qa_test+apitest@example.com", "registered": /./, "first_name": "", "last_name": ...

java - Is it a good approach to override methods in a class which you don't want to test? -

suppose class has 3 methods: public void parent() throws exception {} public string child_1(string arg_1) throws ioexception {} public boolean child_2(string arg_1, string arg_2) throws sqlexception {} parent() calls child_1() , child_2() , like: public void parent() throws exception { // complicated stuff child_1("str1"); // more stuff child_2("str1", "str2"); // more stuff } now, if have tested child_1() , child_2() , want test parent(), ok override child_1() , child_2() , test parent()? this: myclass myclass = new myclass() { @override public string child_1(string arg_1) throws ioexception { return "expected_string_to continue_execution"; } @override public boolean child_2(string arg_1, string arg_2) throws sqlexception { return true; // return expected boolean result continueexecution; } }; myclass.parent(); by doing this, can test parent() , since child_1...

mysql - Following cfquery result is driving me crazy -

i'm running following query many hours, made sorts of changes wondering why detail query not returning results. have similar queries me other connections well( firstconn, secondconn, fourthconn) running absolutely fine , displaying desired range of dates in output. figure out reason? <cfquery datasource = "xx.xx.x.xx" name="master"> select str_to_date(date_format(timedetail,'%m-%d-%y'),'%m-%d-%y') thirdconn,count(timedetail) thirdoccurances ,events mydatabase events = "third" group thirdconn; </cfquery> dump third master <cfdump var = "#master#"> <cfquery dbtype="query" name="detail"> select * master thirdconn >= <cfqueryparam value="#form.startdate#" cfsqltype="cf_sql_date"> , thirdconn < <cfqueryparam value="#form.enddate#" cfsqltype="cf_sql_date">; </cfquery> dump third detail <cfdu...

php - multiple countdown with mysql -

i have serious problem , can't resolve. need put multiple countdown work in code, 1 countdown works fine. can't understand why others datetime can't read. i'm using database datetime. here code: $stmt4 = $mybd->prepare($query3); $stmt4->bind_param("s",$cat); $stmt4->execute(); $stmt4->bind_result($idvoucher,$titulo,$descricao, $precooriginal, $desconto,$data, $nome, $nomeimagem); while($stmt4->fetch()){ if($cat == $nome){ if($idvoucher != $idvoucher2){ echo "<input id='data2' type='hidden' value='$data' />"; and using script countdown: $(function(){ var data = $('#data').val(); var date_split = data.split(" "); var date = date_split[0]; date = date.split("-"); var time = date_split[1]; time = time.split(":"); var data1 = $('#data2').val(); var date_split1 = ...

ios - Xcode: Changing my UIBarButton item title if pressed? -

i trying set uibarbutton items title dependant on whether buttons been clicked or not, think close not sure why isn't working. using storyboard , barbuttons name/method "share1" , have is connected on storyboard, , heres code far: in .h: - (ibaction)share1:(id)sender; and in .m: #import "viewcontroller2.h" @interface viewcontroller2 () @property (assign, nonatomic) bool sharepressed; @end @implementation viewcontroller2 - (ibaction)share1:(id)sender { //i trying open menu in shouldn't affect button. if (self.sidemenu.isopen) { self.sharepressed = yes; [self.sidemenu close]; } else { [self.sidemenu open]; } self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"share" style:uibarbuttonitemstylebordered target:self action:@selector(share1:)]; } - (void)viewdidload { [super viewdidload]; if (_sharepressed) { self.navigationcontroller.n...

SQLITE update, limit, case -

Image
i want implement parking lot application there garage 5 or more parking lots when driver parks car next free slot in garage should assigned him. so have table garage 5 or more slots have problem when update update garage set free = 0, set car = 1 (car_id) free slots update how can limit update first free row? can me thanks in advance (false) have garage table levels , slots in each level when park car want update free slots you'll need specify record(s) want update, or database update all of them. if you're looking update 1 record specifically, might want reference primary key where clause. if haven't assigned primary key table, you use sqlite's rowid column. this: select rowid garage free = 1; then, supposing identify spot 5 free car 42: update garage set free = 0, car = 42 rowid = 5; if prefer, can combine 2 steps single query: update garage set free=0, car=42 rowid in (select rowid garage free=1 limit 1)...

api - Use CryptProtectData & CryptUnprotectData in Delphi -

i want use cryptunprotectdata & cryptprotectdata in crypt32.dll . my code : unit unit1; interface uses winapi.windows, winapi.messages, system.sysutils, system.variants, system.classes, vcl.graphics, vcl.controls, vcl.forms, vcl.dialogs, vcl.stdctrls; type tform1 = class(tform) btn1: tbutton; btn2: tbutton; edt1: tedit; procedure btn1click(sender: tobject); procedure btn2click(sender: tobject); private { private declarations } public { public declarations } end; var form1: tform1; const cryptprotect_local_machine = 4 ; type tlargebytearray = array [0..pred(maxint)] of byte; plargebytearray = ^tlargebytearray; _cryptoapi_blob = packed record cbdata: dword; pbdata: pbyte; end; tcryptoapiblob = _cryptoapi_blob; pcrypyoapiblob = ^tcryptoapiblob; crypt_integer_blob = _cryptoapi_blob; pcrypt_integer_blob = ^crypt_integer_blob; crypt_uint_blob = _cryptoapi_blob; pcrypt_uint_blob = ^crypt_int...

mysql - UPDATE Same Row After UPDATE in Trigger -

i want epc column earnings / clicks . using after update trigger accomplish this. if add 100 clicks table, want epc update automatically. i trying this: create trigger `records_integrity` after update on `records` each row set new.epc=ifnull(earnings/clicks,0); and getting error: mysql said: #1362 - updating of new row not allowed in after trigger i tried using old got error. before if added 100 clicks use previous # clicks trigger (right?) what should accomplish this? edit - example of query run on this: update records set clicks=clicks+100 //epc should update automatically you can't update rows in table in after update trigger. perhaps want this: create trigger `records_integrity` before update on `records` each row set new.epc=ifnull(new.earnings/new.clicks, 0); edit: inside trigger, have have access old , new . old old values in record , new new values. in before trigger, new values written table, can modify them. in after tr...

asp.net mvc - AngularJS routing failure -

please can tell me why views not being inserted ng-view placeholder? i'm using standard visual studio mvc project template homecontroller , .cshtml files in /views/home i'm browsing http://localhost:12345/home/example04#/view1 i see example04 header not contents of _view01.cshtml here rendered html: <!doctype html> <html ng-app="movieapp"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>example04</title> <link href="/content/site.css" rel="stylesheet"/> <script src="/scripts/modernizr-2.5.3.js"></script> </head> <body> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script> <h2>example04</h2> <div> <div ng-view=""></div> </div> <script> va...

html - div background smaller than its content with css (without specifying the width in % or px) -

this have: <div style="width: 100%; background: red; text-align: center"> <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/plain-m%26ms-pile.jpg/280px-plain-m%26ms-pile.jpg" height="170" width="170" style="border-radius:700px; border: 10px solid white;"> </div> though want: http://i.stack.imgur.com/fstkg.png i've tried borders, inset shadow, , many other options in css none of them seems work purpose :( there way make div's background smaller contents without having specify height? adding div it; <div style="width: 100%; text-align: center"> <div style="width:100%;height:100px;position:absolute;left:0;top:45px;background:red;z-index:-1;"></div> <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/plain-m%26ms-pile.jpg/280px-plain-m%26ms-pile.jpg" height="170" width="170" style=...

entity framework - EF6 Beta1 - db.Database.CreateIfNotExists(); doesn't create the database anymore after enabling the migration -

db.database.createifnotexists(); doesn't create database anymore , return true after enabling migration. don't see mentioned in release node well. bug? note both automaticmigrationsenabled = true or false not working after "enable-migrations" in nuget console. public void testmethod1() { //using (var db = new hive.models.hivedbcontext()) { using (var db = new testdbcontext()) { var returnvalue = db.database.createifnotexists(); console.writeline(returnvalue); } } public class testdbcontext : dbcontext { } internal sealed class configuration : dbmigrationsconfiguration<unittestproject1.testdbcontext> { public configuration() { automaticmigrationsenabled = true; } protected override void seed(unittestproject1.testdbcontext context) { // method called after migrating latest version. // can use dbset<t>.addorupdate() helper extension method ...

javascript - Street View panorama is grey? -

i have built page displays different views of location e.g. roadmap, satellite , streetview. when try display streetview panorama not working. have separate div each map view. here example of code , html using streetview. var panoramaoptions = { position: new google.maps.latlng(-41.34473283543335, 174.7694693629674), pov: { heading: 34, pitch: 10 }, visible:true }; var panorama = new google.maps.streetviewpanorama(document.getelementbyid('street_view'),panoramaoptions); panorama.setvisible(true); <div class='map-big' id='street_view' style='overflow:hidden;'></div> how can display streetview properly? best guess: ran similar issue streetview when tried toggling between standard map view , street view. did 2 things fix issue: 1. when switched street view, re-ran setposition on streetview. ran: g_map.getstreetview().setposition(g_...

How to run my php file from mac terminal -

sorry if novice question - novice - but, have no clue how run php file terminal. i type in mac terminal this: php test.php (where test.php file i'm trying run) then, this: not open input file: test.php i think i'm having problem because didn't change directory (not sure how either). in order change directory, must type cd , file path name if find file in finder, , hold file, , drag mac terminal window, place entire path file....so type cd, drag file path do not forget remove file name on end of path and take directory of file.. after that, type php test.php , , should work hope helps!

PHP and FPDF - sprintf not working with data in certain combinations -

i'm having problem following code. want use content (taken community builder fields) print labels envelopes. the first line of label contain subscriber's title, first name , surname, , works fine. pdf required info. the second line things start go pear-shaped. try include $faculty in line 2 instead of empty string i've got there in code below, pdf produced downloads 0 bytes , acrobat says it's not supported file type. weird thing can print $faculty onto label if don't include first line. the code i'm working printed same data csv. need go pdf instead. anyone know why happening , can point me in right direction? there's commas , stuff in many of fields i'm using wouldn't make difference it? cheers! note clarity: code works. doesn't work when replace $linetwo assignment below '$linetwo = sprintf("%s",$faculty);'. or '$linetwo = "$faculty");". foreach($activesubscribers $subscriber) { $title =...

javascript - Pushing changes to deployed Meteor.js app -

after deploying meteor.js app own server, best practice continue pushing code changes live app if want develop off server? do upload newly edited file server via ftp , page auto-reloads? doing meteor bundle app.tgz , uploading server untarring package seems slow , inefficient me. basically have uploads file, untar it, restarts node process. as restarts clients refresh pages. if find inefficient , slow use script such https://github.com/netmute/meteor.sh you edit parameters in match server.

perl - How to use FastCGI to send an image -

i'm using apache mod_fcgid , fastcgi under apache. i'm trying write perl fcgi send images client browser. googled sending image file in perl fastcgi script, found nothing. for example, if client requests <http://mydomain.com/perl-cgi/123.jpg> , perl-cgi request , respond resized 123.jpg (this image located on apache server), how send image? found samples on internet sends plain text/html, didn't find out how send images. thanks in advance! rather copying files filesystem echo'ing them apache, why not use https://tn123.org/mod_xsendfile/ . response includes standard headers , special x-sendfile header. server module reads file filesystem , returns client.

syntax - How to check YML grammar is correct (gitlab.yml) -

Image
gitlab server can't start . reason because gitlab.yml configuration file not correct. what tool use check yml grammar correct? i have tried notepad++ , sublimetext, show small sign in different places: notepad doesn't indent 1 line. sublimetext can indents , spaces problem in gitlab config parser? what use, , works editor, comparison between: gitlab.yml gitlab.yml.example i developed little bash diff script differences in keys (not values, since supposed put own values there) ## ldap setting ldap: (<--- key) enabled: true ^^^ ^^^ key value i a: cd gitlab/config check_all_diff . that way, if there change in term of keys, key order, new keys or deleted keys, can spot when upgrade gitlab. to summarize, need copy in directory part of $path : check_all_diff check_diff (called check_all_diff ) don't forget to: chmod 755 check_all_diff check_diff don't introduce improper eol (end of line)...

scala - How can I match case with shapeless variable? -

how can match case shapeless variable ? let's have variable of following type shapeless.::[string,shapeless.::[string,shapeless.hnil]] currently have this authheaders.hrequire(shape_value => { val (client_id, client_secret) = value.tupled isauthorized(client_id, client_secret) } ) can somehow unwind string :: string :: hnil string pair don't have in separate statement ? there method unapply in object shapeless.:: : def unapply[h, t <: hlist](x: h :: t): option[(h, t)] so match on hlist this: scala> val ::(a, ::(b, hnil)) = "1" :: "x" :: hnil a: string = 1 b: string = x or alternative syntax unapply method tuple2 result: a :: b instead of ::(a, b) : scala> val :: b :: hnil = "1" :: "x" :: hnil a: string = 1 b: string = x scala> "1" :: "x" :: hnil match { | case :: b :: hnil => s"$a :: $b :: hnil" | } res0: string = 1 :: x :: hnil ...

html - Div disappearing behind footer -

my problem trying make little image gallery option scroll. if set size height of gallery, incredibly awkward on bigger monitors bunch of space below it. i think bigger issue i've made lot of adjustments whole website make sure footer works, , don't how it's implemented, though @ stage don't see way. guess want gallery working, though if has suggestions making footers work in future sites, i'd love suggestions. all right, here's html: <body> <div id="container"> <div id="content_wrapper"> <div id="header"> </div> <div id="content"> <div id="gallery"> </div> </div> </div> </div> <div id="footer_wrapper"> <div id="footer"> </div> </div> </body> and here's relevant css: html, body { height: 100%; } img { padding: 0; margin: 0; } #conten...

file - negative return value in Open system call; C -

i have created file in /proc named "test" (it created in kernel). file exists. when want open in user level returns negative. int fd; if((fd=open("/proc/test","o_rdonly"))<0){ perror("open"); } the error see open: file exists . have seen this question not case. you need parentheses in there (now fixed in question), , second argument open() not string: #include <fcntl.h> int fd; if ((fd = open("/proc/test", o_rdonly)) < 0) perror("open"); i'm not convinced idea create file of sort in /proc file system. in fact, i'm bit surprised allowed to. if learning program root , hope have backups.

javascript - Saving nested json object path to a variable via recursion -

is there way save "path" of json object variable? is, if have this: var obj = {"mattress": { "productdelivered": "arranged retailer", "productage": { "year": "0", "month": "6" } } }; how can loop through , save each key node name variable? eg. (i need in format): mattress[productdelivered], mattress[productage][year], mattress[productage][month] i have got partly there in fiddle http://jsfiddle.net/4cewf/ can see in log, year , month don't separated append array well. know because of looping have going on i'm stuck on how progress data format require. flow have set in fiddle emulating need. is there way haven't considered this? try var obj = { "mattress": { "productdelivere...

Python MySQLdb- using multiple database tables in query -

i writing script in python , using mysqldb package. con1 = mdb.connect('127.0.0.1', 'root', '', 'teacher') con2 = mdb.connect('127.0.0.1', 'root', '', 'student', true) i can execute query using single cursor in python. want write query use tables both database @ once. how can that? was looking answer same question. found connecting without specifying database allow query multiple tables: db = _mysql.connect('localhost', 'user', 'password') then can query different tables different databases: select table1.field1, table2.field2 database1.table1 inner join database2.table2 on database2.table2.join_field = database1.field1.join_field and boom goes dynamite

search - Twitter API 1.1 Illegal string offset 'statuses' -

im running twitter api v1.1. $tweets= $connection->get("https://api.twitter.com/1.1/search/tweets.json?q=".$searchstring."&result_type=mixed&rpp=100&count=".$notweets); $twitter=json_encode($tweets); ($i = 0; $i < sizeof($twitter["statuses"]); $i++) { echo $twitter["statuses"][$i]; } warning: illegal string offset 'statuses' why wrong offset? https://dev.twitter.com/docs/api/1.1/get/search/tweets $tweets= $connection->get("https://api.twitter.com/1.1/search/tweets.json?q=".$searchstring."&result_type=mixed&rpp=100&count=".$notweets); $twitter=json_encode($tweets); foreach($tweets->statuses $tweet){ echo $tweet; }

cloud - why Hbase with Hadoop map reduce performance is slow? -

i have configured hadoop1.0.3 on 3 machines distributed mode.on first machine below jobs running: 1) 4316 secondarynamenode 4006 namenode 4159 datanode 4619 tasktracker 4425 jobtracker 2) 2794 tasktracker 2672 datanode 3) 3338 datanode 3447 tasktracker now when run simple map reduce job on it,it takes longer time execute map reducejob.so installed hbase layer on hadoop.now have below processes hbase on 3 clusters. 1) 5115 hquorumpeer 5198 hmaster 5408 hregionserver 2) 3719 hregionserver 3617 hquorumpeer 3) 2937 hquorumpeer 2719 hregionserver when run map-reduce job on hbase 1,00,000 data taking 1 minute , same 1,00,00,000 data.now want result in milliseconds. steps should take improvement? i newbie please me out or suggest layering on hbase or hadoop can result in milliseconds. i summarizing below records: hbase(main):007:0> describe 'weblog' description enabled...

Strange bug in widget in Android 2.3.3 -

i trying write home screen widget. on widget there few textviews 2 imagebuttons . 1 refreshing , second opening settings window. the problem is working on android 4.2.2 , not working on android 2.3.3. everything looks fine. when buttons pressed don't work. interesting thing is happening on first instance of widget. when second added works ok. this small part of code, used make update , @ point not working in android 2.3.3: @override public void onupdate(context context, appwidgetmanager appwidgetmanager, int[] appwidgetids) { log.i(tag, "onupdate"); // widgets ids componentname thiswidget = new componentname(context, dataappwidgetprovider.class); int[] allwidgetids = appwidgetmanager.getappwidgetids(thiswidget); log.d(tag, "widgets id: " + allwidgetids.length); (int widgetid : allwidgetids) { log.d(tag, "widget: " + widgetid); ...

uri - why sometime i get the cursor null or count equal to zero -

my apliction works fine ,it updates spinner sometime when start activity cursor becomes null , spinner list blank ,why?.it seems cursor null or count zero. though works fine of time there no chance of cursor being null or emplty. very strange behavior public class mainactivity extends activity { string[] data = { mediastore.video.media.data }; arraylist<string> path; spinner path_spinner; protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.mainactivity); path= new arraylist<string>(); path_spinner = (spinner) findviewbyid(r.id.folder_spinner); cursor cursor = managedquery(mediastore.images.media.external_content_uri,data, null, null, null); if(cursor != null && cursor.getcount() > 0) { cursor.movetofirst(); { path.add(cursor.getstring(cursor.getcolumnindexorthrow(mediastore.images.media...

jquery - find previous div with class name rather than using parent().parent()....parent() -

<div class="a"> <span class = "s"> <button> <button> <div class="b"> <p> <textarea> <div> <button class="click"> </div> </div> </div> on button click of class "click" . need find in div class a. what tried $('.click').parent().parent().parent().find('span') -- working i looking similar alternative in easiest way $('.click').closest('div').find('.a') -- not working $('.click').closest('div').prev('.a') -- not working what correct approach when traversing inside multiple , find class name * note : sample html find correct approach in jquery , not find syntax error in html thanks closest('.a') should it. finds first element in element's ancestry (starting element , going parent, etc.) matching selector.

Verify address book contacts iOS from PHP server -

i need check of addressbook users using ios app (using emails). this, send contacts list php server , check emails, registered. then, return array of users , show them in ios tableview. problem when have 100-200 contacts, retrieval lightening fast, when have 1000-1500 contacts takes @ least 3-4 minutes. how can improve it? php code: $handle = fopen('php://input','r'); $jsoninput = fgets($handle); // decoding json array $array = json_decode($jsoninput,true); if (empty($array)) { echo '<h1>array empty!!!<h1>'; return; } require('dbconnection.php'); $dbconnection = new dbconnection; $link = $dbconnection->connecttodatabase(); if ($link) { $dbconnection->selectdatabase(); foreach($array $subarray) { foreach($subarray['email'] $email) { $query="select email,picture user email='$email'...

Yodlee exception - cipher is bad -

when using yodlee api we're getting internal exception: coreexceptionfaultmessage::com.yodlee.core.internalcoreexception: cipher bad: no such key: ... in keyring: itemsummary|...ciphertext: ... | memid=... | container type: credits |itemid=... while invoking yodlee dataservice how can fix this? problem on our end or @ yodlee's end? david, apologies delay in responding. have resolved issue, please confirm same. -vijay david, this vijay yodlee , manage support our yodlee interactive customers. have identified root cause issue (cipher bad) , working on fixing it, hear shortly on this. -vijay

html - CSS: changing the color of a bullet in a list? -

i have problem changing color of bullet in list. so have list inside <nav> tag in html file: <nav id="top-menu"> <ul> <li> <a href="">home</a> </li> <li><span> <a href="">products</a> </span></li> <li> <a href="">statistics</a> </li> <li> <a href="">countries</a> </li> <li> <a href="">settings</a> </li> <li> <a href="">contacts</a> </li> </ul> </nav> so can see <nav> tag has id="top-menu" . , 1 more thing: <li><span> <a href="">products</a> </span></li> here can see put <span> tag inside bullet. here css file: nav#top-menu { width: 100%; height: 33px; background-color: #696969; ...