Posts

Showing posts from March, 2013

r - Caret Error Using Train: "Something is wrong; all the RMSE metric values are missing" -

i'm trying train neural network model using caret package in r , encountered error message regarding missing rmse metric values. has come across error before? below sample of code , error message received: install.packages("caret") library(caret) ctrl <- traincontrol(method = "timeslice", initialwindow = 8000, horizon = 2000, fixedwindow = true) install.packages("nnet") library(nnet) system.time({lmfiltered4 <- train(fgddatatavg2trainxd, fgddatatavg2trainy, method = "avnnet", size = 10, decay = 0.1, trcontrol = ctrl, preproc = c("center", "scale"), linout = true, trace = false, maxnwts = 10 * (ncol(fgddatatavg2trainxd) +1) + 10 + 1, maxit = 500)}) wrong; rmse metric values missing: rmse

aem - How to create a directory on the basis of path in cq5? -

i have string path of page example /content/xperia/public/events/eventeditor . gererating xml of page , saving dam, want save in similar tree structure under /content . i tried following code string page = "/content/xperia/public/events/eventeditor"; page = page.replace("/content", "/content/dam"); if (adminsession.nodeexists(page+ "/"+ "jcr:content")) { node node = adminsession.getnode(page+ "/"+ "jcr:content"); node.setproperty("jcr:data", sb.tostring()); } else { node feednode = jcrutil.createpath(page,"nt:file", adminsession); node datanode = jcrutil.createpath(feednode.getpath() + "/"+ "jcr:content", "nt:resource", adminsession); datanode.setproperty("jcr:data",sb.tostring()); } but gives following error no matching child node definition found { http://www.jcp.org/jcr/1.0 }content

rally - Query to create burndown from parent and children -

this question related question of mine: query retrieve defects parent , children have inherited code displays burndown of project. have took project , split 2 projects, there parent project , 2 children. code (below) fails create burndown, assume because cannot find stories/tasks on top-level project, , (i assume) not looking @ children project. please note - solution in link refer did not work me here (removed children: null , replaced _projecthierarchy: context.getproject().objectid,) anyway - here's code: storeconfig: { find: { _typehierarchy: "hierarchicalrequirement"}, fetch: ["taskestimatetotal", "taskremainingtotal", "iteration"], hydrate: ["taskestimatetotal", "taskremainingtotal", "iteration"], sort: { _validfrom: 1 }, filters: [{ property: "iteration", value: iterationrecord.get("objectid")

java - IBM WebSphere Application/Portal Servers, TAI and HttpSession and Cookies -

i have ibm 6.1 , portal 6.1. have tai works when user login/logout in/out portal. want work httpsession in tai. shortly task next: when user logging in want save parameter in memory , key want use id of httpsession (or else?). for example, while user logging id of httpsession "foo" . than, user logged in , working in portal, , press logout button, portal logged out user using internal mechanize , tai catch request , have http session id "bar" . so, changed http session. means can not user http session save parameter, because recreates logging out. have save parameter while user logging in, , use while logging out. also can't use cookies reasons. idea how can save id based on httpsession? or have know who(portal uid of user) pressed logout button in tai. helps me resolve problem. update #1. also, reason was(?) delete custom cookie. add custom cookie in tai , deleting it, can not find own cookie. idea , why? there http server beyond , client, checked

c# - Appropriate way to replace a string? -

my input abc@xyz.com i want replace xyz.com mnop.com so final result abc@mnop.com the present way var input = "abc@xyz.com"; var output = input.split('@')[0] + "@mnop.com"; what appropriate way?any regular expression? replace function sample (with correct exception handle) /// <summary> /// replace email domain /// </summary> /// <param name="email"> email </param> /// <param name="newdomain"> new domain </param> /// <returns></returns> private string replacemaildomain(string email, string newdomain) { if (email == null) throw new argumentnullexception("email"); int pos = email.indexof('@'); if (pos < 0) { throw new argumentexception("invalid email", "email"); } else { return email.substring(0, pos + 1) + newdomain; } } usage: string email = replacemaildomain("abc@xyz.

Node.js execute Javascript file -

this newbie question , i'm sure solution easy don't it. i downloaded node.js , put command-tool file , npm in project file. i created file called example.js contains console.log("hello world"); now open node file , type in node example.js and shows me unexpected identifier. thanks in advance. edit: node -v shows node not defined ?? .. i'm confused. edit2: mac ios edit3: installed , path usr/local/bin allowed move file? edit4: node -v works now. opened through cmd tool edit5: okay works.. thought have work node cmd tool. quick help! open terminal go folder have example.js (use cd -command) type in terminal node example.js , press enter you should not run node before typing node example.js

javascript - Why 2 different Module can access each other when added as depend to third module? -

i having 3 modules in angularjs app, e.g. main , home , product . main module having home , product module dependencies ( ng.module('main', ['home', 'product']) ) while home , product modules not having dependencies( ng.module('product', []) ng.module('phome', []) ), still product module can access home module service? why??? below sample code of application, having same scenario , same issue. , jsfiddle link . <!doctype html> <html ng-app="main"> <body ng-controller="maincontroller maincontroller"> {{maincontroller.name}} <script type="application/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> <script> (function (ng) { var homemodule = ng.module('home', []); homemodule.service("homeservice", [function () { var homeservice = this; homeservice.getname = function

certificate - Getting error while using CryptAcquireCertificatePrivateKey API to extract private key from PFX file -

we developing vc++ application using crypto apis windows 7 os. using cryptacquirecertificateprivatekey api extract private key pfx file . on executind api, getting below error: 0x8009200b(private key error) pfx file used api has multi layer certificate(root , intermediate). when use such pfx file, error comes. , if use pfx having single layer certificate time works. so please suggest reason failing. note: pfx file provided third party vendor(like symantec). thanks in advance.

php - Mod rewrite, for category and it's pages, conficts -

this question exact duplicate of: url rewriting 2 parameters using .htaccess , apache) 1 answer i have category.php , has ?slug='something' , looks after did code in .htaccess : www.example.com/category/football . , works well, need implement page numbering link this: www.example.com/category/football/page/2 . did code in .htaccess , not work. i wrote code in category.php indicate stuff: echo "$_get['slug']" if(isset($_get['page'])) echo $_get['page'] when go www.example.com/category/football it's ok, " fudbal " message echo $_get['slug'] but when go www.example.com/category/football/page/2 it's not ok, " fudbal/page/2 " (i supose echoes it's slug) echo $_get['slug'] , $_get['page'] not give anything. here .htaccess : options -indexes rewriteengine

javascript - How to put out-of-scope element into the scope using jQuery? -

i'm designing touch scrollable simple menu below: +-------+ | | | | | ^ | | # | % | @ | & | +-------+ i did using simple css . i'm able active menu item in dynamic webpage, can highlight them accordingly. if visitor in % page, can highlight particular menu, if in & page, can highlight too. problem is, on newly rendered page, menu refreshes , & become out-of-scope again. highlighted, user unable see that without touching , scrolling menu. +-------+ | | | | | | ^ | # | % | @ | & | +-------+ is there way can let menu remember it's position can refresh remembering current position? edit what want let menu remember position while being in newly rendered page: +-------+ | | | | | ^ | # | % | @ | & | +-------+

json - Swift: Filter a POST http request answer -

on swift, querying server http post request, with: let myurl = nsurl(string: "http://****.*****.***.***/****.php"); let request = nsmutableurlrequest(url:myurl!); request.httpmethod = "post" let session = nsurlsession.sharedsession() var getdefaults = nsuserdefaults.standarduserdefaults(); var password = getdefaults.valueforkey("password") as! string; var id = getdefaults.valueforkey("login") as! string; var err: nserror? let poststring = "method=tasks.gettasksbyfolder" + "&identifiant=" + id + "&password=" + password + "&data={\"folder\":\"" + folder + "\"}" // filter = {"folder":"inbox"} request.httpbody = poststring.datausingencoding(nsutf8stringencoding); let task = nsurlsession.sharedsession().datataskwithrequest(request){ data,response,error in if error != nil{ println("error=\(error)") return

sorting - Sort the file in unix using first six characters of a line -

i want sort file using first 6 characters of line. should ignore default sort order after sixth character. have tried using below command, system takes default sort order after sixth character. sort -k 1,6 filename.txt input file : "filename.txt" 09289720150531n201505220820d20150514 09289720150531n201505220820a20150516 08806020150531n201505290810d20150526 08806020150531n201505290810a20150528 output should be: 08806020150531n201505290810d20150526 08806020150531n201505290810a20150528 09289720150531n201505220820d20150514 09289720150531n201505220820a20150516 but command output is: 08806020150531n201505290810a20150528 08806020150531n201505290810d20150526 09289720150531n201505220820a20150516 09289720150531n201505220820d20150514 the option shown uses field position. if change -k1.1,1.6 use character position in first field. extended posix feature, provided on platforms. however, in example there 2 distinct values in character positions 1-6: 088060

javascript - How use Mithril's m.request to load data from a server? -

i want store blocks of json file array. here current code, in controller (ctrl) : var ctrl = this; var id = (location.href).replace(/.*\//g, ''); //use m.route() ? ctrl.list = []; m.request({method: "get", url: "/data/"+id}).then(function(blocks){ blocks.map(function(block) { ctrl.list.push(block); }); }); console.log(ctrl.list); //result : empty array. why ? m.request asynchronous operation: needs make request server, wait server answer, load contents, , give response — why implements then : give callback can things data when arrives. but console.log happening after make request: response isn't ready yet. depends upon server data needs invoked inside then callback function.

localization - How in iOS to localize text of the month in UIDatePicker, and if it is possible at all? -

i make search , see uidatepicker working localization of device. i have app has internal lozalization. need change month's text dependantly of internal localization. read appears not possible - have make own custom picker. is there way achieve without custom dat picker? use locale property of uidatepicker. can't see signs property deprecated. this code localize picker japanese. [datepicker setlocale: [nslocale localewithlocaleidentifier:@"ja"]]; replace "ja" language code need.

asp.net mvc - How to retrieve uploaded file in mvc 4 -

this controller code uploading file , storing title in database , actual file stored in documents/file folder now. facing problem in retrieving uploaded file since have stored title in database. how retrieve file ? [acceptverbs(httpverbs.post)] public actionresult uploadfile(string title) { _db.uploads.add(new upload() { title = title }); _db.savechanges(); int id = (from in _db.uploads select a.upload_id).max(); if(id>0) { if(request.files["file"].contentlength>0) { string extension = system.io.path.getextension(request.files["file"].filename); string path1 = string.format("{0}/{1}{2}", server.mappath("~/documents/files"), id, extension); if (system.io.file.exists(path1)) system.io.file.delete(path1); request.files["file"].saveas(path1); } vi

php - bcadd has different point precision -

on windows box when run $sr = "0"; $spr = "149"; $sr = bcadd($sr, $spr); echo "$sr"; it outputs 149.0000000000 but when upload same code linux host, output 149 . why? probably "scale" different on 2 environments. try set scale bcscale function before doing operations, example: bcscale(3); $sr = "0"; $spr = "149"; $sr = bcadd($sr, $spr); echo "$sr"; or use third parameter in bcadd set scale: $sr = "0"; $spr = "149"; $sr = bcadd($sr, $spr, 3); echo "$sr";

c# - How can I marshal a Delphi short string using p/invoke? -

i have problem variable type dll importing in c#. written in object oriented pascal , says developed delphi development tool. on manual of library says shortstring packed array of bytes. first byte length , following exaclty 255 bytes string data need. so after importing dll in c# wrote: [return: marshalas(unmanagedtype.lparray)] then called function dll: public static extern byte[] xxxx(); but getting following error: cannot marshal 'return value': invalid managed/unmanaged type combination on other hand tried following: [return: marshalas(unmanagedtype.safearray)] this time error: safearray of rank 18727 has been passed method expecting array of rank 1 can please tell me doing wrong, , firstly correct shortstring compiled library? regards i think cleanest way marshal delphi short string wrap in struct. [structlayout(layoutkind.sequential)] public struct delphishortstring { private byte length; [marshalas(unmanagedtype

html - jquery image click event for specific images -

i have images dynamically added page, , on page have jquery function shows when image clicked. works fine, have static images on page don't want clickable function. this jquery runs whenever image selected. can't use the id element of images because different time. $().ready(function () { $('img').click(function () { //do } } how can make images want run function when clicked? try this: add class images want clickable. example: <img class="clickableimage"> $(document).ready(function () { $('.clickableimage').click(function () { //this work images having class ="clickableimage" //do } }

function - javascript -why variable statement is executed? -

i in beginning of learning javascript , trying understand of it's logic. read variable box ,a way of storing , keeping track of information in program. so why code been executed? var person = prompt("please enter name"); if variable box suppose contain prompt function.then how , why function invoked ,shouldnt call function invoke it? like person(); and if function assigned variable self-invoked-like this?? var person = myfunc() { /*--code here--*/ }; because aren't passing prompt function, you're calling prompt function , storing result . another example: function add(a, b) { return + b; } var fiveplusthree = add(5, 3); // fiveplusthree === 8 var addfunction = add; //addfunction === add, passed function itself. var oneplusone = addfunction(1,1); // oneplusone === 2 you can pass function expressions variables, example person that. however, result of calling function has kept elsewhere var promptperson = function() { r

java - Monitor the health of weblogic server through script -

when start weblogic server, there various logs printed. structure of logging on weblogic can found on here . i'm writing script test, whether weblogic server started successfully. need filter <error> log messages, however, 1 condition, that, following them java exception. so, particularly failure of java bean (through thrown exceptions) criteria failure of server. i want ignore other sorts of <error> logs. there tool can in this? update: example of normal <error> , these types of errors should ignored: <may 29, 2015 5:02:44 pm ist> <notice> <stdout> <bea-000000> <|e |17:02:44 |2 |vgorade01 |correlationid=vgorade01_2_1432899124676 |'hotdirectory': /hot not exist: disabling service.> <may 29, 2015 5:02:44 pm ist> <error> <apm> <bea-000000> <|e |17:02:44 |2 |vgorade01 |correlationid=vgorade01_2_1432899124676 |'colddirectory': /cold not exist: disabling service.> &l

php - How to set value on page load using javascript? -

i have set dynamically text value when page load. code is.. $(document).ready(function() { //function call setname(); }); function setname() { document.getelementbyid('loginname').value = localstorage.getitem("username"); } <span class="text-muted text-xs block" id="loginname"></span> i value local session why not set on loginname field? don't know why, please me. span elements not have value property - need set innertext : function setname() { document.getelementbyid('loginname').innertext = localstorage.getitem("username"); } alternatively, can use jquery exclusively: $(function() { $('#loginname').text(localstorage.getitem('username')); });

how many records can be deleted using a single transaction in mysql innodb -

i wanted delete old records 10 related tables every 6 months using primary keys , foreignkeys. planning in single transaction block, because in case of failure have rollback changes. queries somethign this delete parent_table parent_id in (1, 2, 3,etc); delete child_table1 parent_id in (1, 2, 3,etc); the records delete around 1million. safe delete these in single transaction? how performanace? edit to more clear on question. detail execution plan i first retreiving primary keys of records parent table has deleted , store temporary table start transaciton delete child_one parent_id in (select * temp_id_table); delete child_two parent_id in (select * temp_id_table); delete parent_table parent_id in (select * temp_id_table); commit; rollback on failure. given can have around million records delete these tables, safe put inside single transaction block? you can succeed. not wise. random (eg, network glitch) come along cause huge transaction abort. might bloc

How to read a tab delimited file in R when data row contains an extra separator at end of line? -

i'm trying read file has annoying problem. header has 5 columns data has 6 due tab character @ end of line data rows. confused r , put item code row name , data not shifted 1 position. > items <- read.csv("http://download.bls.gov/pub/time.series/cu/cu.item", sep = "\t") > items[1,] item_code item_name display_level selectable sort_sequence aa0 items - old base 0 true 2 na > row.names(items[1,]) [1] "aa0" any idea how fix this? if specify row.names = null, read in item code "row.names" column still shifted. > items <- read.csv("http://download.bls.gov/pub/time.series/cu/cu.item", sep = "\t", row.names = null) > items[1,] row.names item_code item_name display_level selectable sort_sequence 1 aa0 items - old base 0 true 2 na as mentioned in comment, can try read in file withou

javascript - Select sibling before an element in Jquery? -

the dom looks this: <body> <div>a</div> <div>b</div> <div>c</div> <div id="selected">d</div> <div>e</div> <div>f</div> <div>g</div> </body> now can select <div id="selected">d</div> using $("div#selected") , how can select element before it, <div>c</div> . does have ideas this? simplest way using prev() $("div#selected").prev(); according docs, prev() will get preceding sibling...

ms access - Create query in QueryEditor with VBA function call for specifying the WHERE IN clause -

i have written couple of vba functions in end return collection of integers: public function validids() collection now want run create query in queryeditor following condition: where tableid in validids() . not work since access reason not find function long returns collection. therefore wrote wrapper around it, joins collection: public function joincollectionforin(coll collection) string now third function calls validids() , passes result joincollectionforin , returns result. lets call getidcollectionasstring() . as result can change query where tableid in (getidcollectionasstring()) . note added parenthesis since in needs them in case, can not @ end , beginning of string returned getid... . running query results in data type mismatch in criteria expression. i guess results fact return string, therefore access automatically wraps string in ' sql , in -clause no longer works because check if number in collection of 1 string. therefore question is: i

image processing - Is SIFT invariant to color distribution,skewness and shearness? -

i wanted know whether sift invariant color distribution,skewness , shearness.i wanted match feature vectors of 2 images , detect whether similiar or not. "basic" sift done in grayscale, , not, affine-invariant (beyond scale, rotation , translation invariance). asift affine invariant invariant skew , shear.

android - Sending file to ftp server? -

i coding send file on ftp server, giving error. private void connecttoftpaddress() { pd = progressdialog.show(upload_download.this, "", "connecting...", true, false); new thread(new runnable() { public void run() { boolean status = false; status = ftpclient.ftpconnect("xxx.xxx.xxx.x","xxxxxx","xxxxxx", xx); if (status == true) { log.d(tag, "connection success"); f1.wait_wind("connection success", getapplicationcontext()); handler.sendemptymessage(0); } else { log.d(tag, "connection failed"); handler.sendemptymessage(-1); } } }).start(); }

php - Clean url for static and dynamic pages -

i have website mixture of static pages without variables (ex: about.php) , dynamic pages (ex: searchresults.php?a=1&b=2) right .htaccess allows static pages show, not dynamic ones. i've tried make dynamic pages work, however, breaks clean urls static pages. rewriteengine on directoryindex index.php index.html rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l] rewriterule ^([^\.]+)$ $1.html [nc,l] i final result this: http://example.com/about.php -> http://example.com/about and http://example.com/searchresults.php?a=1&b=2 -> http://example.com/searchresults/1/2 is i'm looking possible? yes, it's possible. firstly, you'll need change rule strip extension. currently, have 2 rules match (meaning second never trigger), , second rule doesn't have condition. secondly, search rule need specified explicitly. your .htaccess file should this: rewriteengine on # rewrite search page rewriterule ^searchre

excel - How will I open xlsx File in C#.NET? -

i want open xlsx file in c#.net, shows error . but if file xls extension can open when file format xlsx shows error. my code oxl.workbooks.open(path, 0, false, 5, "", "", false, //microsoft.office.interop.excel.xlplatform.xlwindows, "\t", false, false, 0, true, 1, 0) the exception is: excel cannot open file 'new microsoft excel worksheet.xlsx' because file format or file extension not valid. verify file has not been corrupted , file extension matches format of file. workbooks.open fail if have version of excel in machine can't read xlsx files (eg excel 2003). if don't need office interop (so if need read , write files , not use excel functionalities) should take @ office open xml sdk (v2.5 .net 4.5 , v2.0 .net 3.5) @ the official download site . you're able open excel file this: spreadsheetdocument exceldocument = spreadsheetdocument.open(filename, false); and perform read , wri

org mode - emacs orgmode table use the equal sign without starting a formula -

i'm typing table org mode, equal sign(=) if first character in cell , want start formula. how display symbol without being formula, of way use formulas display it. errors when use single quotes, , see unicode decimal value when using double quotes. have tried following ='=+' ="=+" they give #error [61, 43] use escaped entity, \equal{} , should display wish. see variable org-entities others can use.

jsp - Domain host and localhost -

i doing web-application project using jsp/servlets . works fine in localhost . now had given access domain host upload project through filezilla . jsp pages displayed source code instead of interface of project in browser. i never used domain host before. need can run project in domain host works in localhost?

javascript - Can Bluebird Promise work with redis in node.js? -

here's original code fetch user php session stored in redis: var session_obj; var key = socket.request.headers.cookie.session session.get('phpredis_session:'+key,function(err,data){ if( err ) { return console.error(err); } if ( !data === false) { session_obj = phpunserialize.unserializesession(data); } /* ... other functions ... */ }) i rewrite code promise, can't data returned: promise.resolve(session.get('phpredis_session:'+key)).then(function(data){ return data; }).then(function(session){ console.log(session); // returns true, not session data session_obj = phpunserialize.unserializesession(session); }).catch(function(err){ console.log(err); }) the session returned boolean true instead of session data. original redis get function has 2 arguments. assumed promise returned first argument err in original. tried promise.resolve(session.get('phpredis_sessio

c# - How to convert base64 string to image binary file and save onto server -

this question has answer here: c# base64 string jpeg image 4 answers as example have converted canvas element re-sized image , posted hidden input field that's encoded data:image/jpeg;base64,/9j/4aaqskzjrgabaqaaaqabaad... this value posted same page need convert string image , save onto server. code behind file (upload.aspx) protected void btnupload_click(object sender, eventargs e) { httppostedfile fileposted = request.files["newinput"]; string base64string = fileposted.tostring(); // convert base64 string byte[] byte[] imagebytes = convert.frombase64string(base64string); memorystream ms = new memorystream(imagebytes, 0, imagebytes.length); // convert byte[] image ms.write(imagebytes, 0, imagebytes.length); system.drawing.image image = system.drawing.i

javascript - Placing a circle so that it does not collide with any other circles -

given canvas bunch of circles radius, 50, how place circle radius 10 in random location not collide or overlap existing circles? i know can place circle , check if there collisions , retry, need place lot of circles , stuck. wondering if there better ways solves this. the solution going use create image same size , render every circle onto image new radius equals existing circles radius plus 1 want to place. every pixel free of circle possible location , can pick locations.

how to click an anchor tag from javascript or jquery -

this sample code, trying click javascript not responding.. while load page should go next.php without click anchor tag. pls me, how this? <!doctype html> <html> <head> <title></title> <script src="jquery-2.0.3.js"></script> <script type="text/javascript"> alert("hai"); $(document).ready(function() { $('#about').click(); }); </script> </head> <body> <div> <a href="next.php" id="about">click here</a> </div> </body> </html> use $('selector')[0] , $('selector') returns jquery object, $('selector').click() fire click handler, while $('selector')[0].click() fire actual click. $(document).ready(function () { $('#about')[0].click(); //$('#

android - Trouble returning a subclass of fragment as a fragment -

i have class named singlefragmentactivity want class workoutactivity extend. when override abstract method createfragment code in method, error, , when run code, --- error:(12, 8) error: workoutactivity not abstract , not override abstract method createfragment() in singlefragmentactivity error:(16, 24) error: createfragment() in workoutactivity cannot override createfragment() in singlefragmentactivity return type android.app.fragment not compatible android.support.v4.app.fragment error:(15, 5) error: method not override or implement method supertype error:(20, 43) error: incompatible types: workoutfragment cannot converted fragment i believe code correct, extend class , override method in same way in several other places in app. here code involved functions. public class workoutfragment extends fragment { public static final string extra_alreadycreated_id = "alreadycreated"; private exadapter adapter; private listview listview; p

objective c - Determine when iPhone is on its back -

is there anyway determine when iphone on back? this on surface or user holding in hands , shifts phone laying flat in mid-air. i know iphone has gyro , accelerometer not sure how can used find out. have @ uideviceorientation : typedef ns_enum(nsinteger, uideviceorientation) { uideviceorientationunknown, uideviceorientationportrait, // device oriented vertically, home button on bottom uideviceorientationportraitupsidedown, // device oriented vertically, home button on top uideviceorientationlandscapeleft, // device oriented horizontally, home button on right uideviceorientationlandscaperight, // device oriented horizontally, home button on left uideviceorientationfaceup, // device oriented flat, face uideviceorientationfacedown // device oriented flat, face down };

codeigniter - Placing image in e-mail header -

how can put images header before hello ? can please me? this view: <body> <p>hello, <?php echo $first_name; ?> <?php echo $last_name; ?></p> <p>please click link below reset password within 24 hours :</p> <p> <a href="<?php echo base_url(); ?>recover/response/<?php echo $secret; ?>/">click here reset password</a> </p> <p> regards,<br> customer service. </p> </body> try this $to = '';//assign mail $subject = 'email subject'; $message = '<html><body>'; $message .= '<img src="http://example.com/123.png" alt="your image" />';//image $message .= '<p>hello, <?php echo $first_name; ?> <?php echo $last_name; ?></p>'; $message .= '<p>please click link below reset password within 24 hours :</p>'; $message .= '<p><a href="

unable to remote/ssh into my virtualbox guest linux OS -

i stuck , can't figure out why i'm unable remote guest vm. i'm trying do: my worklaptop running virtual box: (host-windows, guest-fedora 12) when @ home (personal network) - fireup laptop, virtualbox:guest-fedora 12 ssh guest-fedora 12 personal mac osx machine my vb settings guest: adapter1 - nat - allow all, cable connected adapter2 - host-only adapter - allow all, cable connected open-ssh client on fedora installed can ssh other servers. goal work macosx personal machine , ssh guest-fedora 12 vb. i unable so. when used "terminal" macosx, i'll operation timed out message. did install openssh server on fedora? i'm not sure default: # yum install openssh-server and make sure service started? systemctl start sshd also, nat networking not want. see here: http://catlingmindswipe.blogspot.com/2012/06/how-to-virtualbox-networking-part-two.html . creates ip address visible host. virtualbox has bridged mode give looks box on l

python - How to apply multiple formats to one column with XlsxWriter -

in below code apply number formatting each of columns in excel sheet. however, can't seem figure out apply multiple formattings specific column, either centering or numbering end being on written. possible apply 2 types of formatting 1 column? def to_excel(video_report): # create pandas excel writer using xlsxwriter engine. writer = pd.excelwriter('pandas_simple.xlsx', engine='xlsxwriter') # convert dataframe xlsxwriter excel object. video_report.to_excel(writer, sheet_name='sheet1', na_rep="-") # xlsxwriter objects dataframe writer object. workbook = writer.book worksheet = writer.sheets['sheet1'] # add cell formats. integer = workbook.add_format({'num_format': '0'}) decimal = workbook.add_format({'num_format': '0.00'}) percentage = workbook.add_format({'num_format': '0.0%'}) center = workbook.add_format({'align': 'cente

sql server - SQL Geography Latitude/Longitude distance calc -

i have trouble using geography calculate distance in miles using format of table. latitude , longitude of both locations side side: id | a_latitude | a_longitude | b_latitude | b_longitude i'm trying point of a , along point of b , , return distance between a , b in miles. i've tried few things, including similar to: declare @orig geography declare @end geography select @orig = geography::point(a_latitude, a_longitude, 4326) ,@end = geography::point(b_latitude, b_longitude, 4326) table1 select round(@end.stdistance(@orig)/1609.344,2) miles ,@end.stdistance(@orig) meters ,table1.* table1; where i'm getting repeating value miles , meters across rows. please suggest how should structuring query i'm looking for? edit: sql surfer! with x (select geography::point(a_latitude, a_longitude, 4326) ,geography::point(b_latitude, b_longitude, 4326) b ,id table1) select round(x.b.stdistance(x.a)/1609.344,2) miles ,x.b.stdistance(x.a) mete

javascript - How can I access a variable-referenced array element in Meteor spacebars? -

in spacebars template, have javascript array x , index i , eg. template.test.helpers({ 'foo': function() { return { x: ['aa','bb','cc'], i: 1 } } }); i can access fixed elements of x in template {{ x.[1] }} : {{template name="test"}} {{#with foo}} {{x.[1]}} {{/with}} {{/template}} but {{ x.[i] }} doesn't work. how can access x[i] ? thanks! one solution define custom helper: template.test.helpers({ 'getelement': function(a, i) { return a[i]; } }); and in template, use: {{ getelement x }}

Is there an OCaml equivalent of the [<RequireQualifiedAccess>] attribute for DUs in F#? -

in f# programs prefer use [<requirequalifiedaccess>] type mytype = | firstoption of string | secondoption of int so in code uses mytype forced write mytype.firstoption instead of firstoption . there way force in ocaml? you can similar effect defining type in module. $ ocaml ocaml version 4.02.1 # module mytype = struct type t = firstoption of string | secondoption of int end ;; module mytype : sig type t = firstoption of string | secondoption of int end # mytype.firstoption "abc";; - : mytype.t = mytype.firstoption "abc" # firstoption "abc";; error: unbound constructor firstoption # if way, name of type (as can see) mytype.t.

import - Unsure how to resolve this Bottle error (Python) -

here imports: from bottle import request, route, run, template, static_file, redirect urllib2 import urlopen, urlerror, request pymongo import mongoclient config.development import config import json and here offending line (and line think may causing issue): game_id = request.forms.get('game_id') request = request(config['singlegame_url'].replace('$gameid', game_id)) the error i'm getting is: unboundlocalerror("local variable 'request' referenced before assignment",) traceback (most recent call last): file "/usr/local/lib/python2.7/site-packages/bottle.py", line 862, in _handle return route.call(**args) file "/usr/local/lib/python2.7/site-packages/bottle.py", line 1732, in wrapper rv = callback(*a, **ka) file "app.py", line 23, in add game_id = request.forms.get('game_id') unboundlocalerror: local variable 'request' referenced before assignment my first though

php - How to force SSL on a specific file example.org/index.html? -

i have php based website....i trying use ssl...the ssl working fine in site, problem not redirect https....it show http , try edit in .htaccess file, not working.... site open format example.org/ index.html /index.html i trying use this, not working rewritecond %{https} off rewriterule ^ https://%{http_host}%{request_uri} [ne,l,r=301] .htaccess code: rewriteengine on rewritebase / #authuserfile /home/products/html/path/.htpasswd #authgroupfile /dev/null #authname "private area" #authtype basic #<limit post> #require valid-user #</limit> <filesmatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> fileetag none <ifmodule mod_headers.c> header unset etag header set cache-control "max-age=31536000, public" </ifmodule> </filesmatch> options -indexes rewritecond %{request_filename} !-f rewriterule ^(.+).html$ $1/?%{query_string} -------urls--------- rewriterule ^index/$ path/index.

javascript - jQuery does not get correctly values of all checked checkbox -

i have list of checkboxes checked follow: <input type="checkbox" name="capacity" value="16" checked> 16 <br> <input type="checkbox" name="capacity" value="32" checked> 32 <br> <input type="checkbox" name="capacity" value="64" checked> 64 <br> <input type="checkbox" name="capacity" value="128" checked> 128 <br> each time checkbox checked or unchecked, want update capacity list again, therefore, use (with little bit of repeating code): $('input[name="capacity"]').change(function() { var capacity = $('input[name="capacity"]:checked').map(function() { return this.value; }).get(); console.log(capacity); }) however, capacity still contains value of last unchecked checkbox. when unchecked 128 -> capacity = ["16","32","64","1

Rails can't start when serve_static_assets disabled in production -

the site works fine until add config.serve_static_assets = false in production.rb. this: demosite.com(master)$ rails_env=production rails s warning: use strings figaro configuration. false converted "false". => booting puma => rails 4.1.4 application starting in production on http://0.0.0.0:3000 => run `rails server -h` more startup options => notice: server listening on interfaces (0.0.0.0). consider using 127.0.0.1 (--binding option) => ctrl-c shutdown server exiting /users/user1/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:125:in `assert_index': no such middleware insert before: actiondispatch::static (runtimeerror) /users/user1/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:88:in `insert' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/configuration.rb:68:in `block in merge_into' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties

scala - Using Squeryl inside a OSGi container -

has gotten squeryl work inside osgi environment, on karaf 3.03. so far have gotten individual dependencies load, scala libraries, squeryl , jdbc driver.the installed bundles this: 51 | resolved | 80 | 0.3.0.snapshot | ac.za.cput.pe.model 52 | active | 80 | 2.11.6.v20150224-172222-092690e7bf | scala standard library 53 | active | 80 | 0 | wrap_mvn_org.squeryl_squeryl_2.10_0.9.5-6 54 | active | 80 | 2.10.0.v20121205-112020-vfinal-18481cef9b | scala standard library 55 | active | 80 | 0 | wrap_mvn_cglib_cglib-nodep_2.2 56 | active | 80 | 0 | wrap_mvn_org.scala-lang_scalap_2.10.0 57 | active | 80 | 2.10.0.v20121205-112020-vfinal-18481cef9b | scala compiler 58 | active | 80 |

ios - CAShapeLayer strokeColor from image pattern UIColor to CGColor upside down -

i'm using cabasicanimation draw uibezierpaths have in array using cashapelayer cashapelayer *shapelayer = [cashapelayer layer]; shapelayer.path = [path cgpath]; shapelayer.strokecolor = path.color.cgcolor; my path.color uicolor image pattern. when converted cgcolor image pattern upside down. know because ios , core graphics use different starting points drawing. i have tried shapelayer.transform = catransform3dmakerotation(m_pi, 0.0, 0.0, 1.0); and shapelayer.geometryflipped = yes; but none of them worked. how flip strokecolor image pattern 180 degree match origin uicolor ? as have correctly suspected, coordinate system differs. in case, origin @ bottom left @ (0, 0) . so compensate either flip image using image editor or in code so: uiimage *flippedpatternimage = [uiimage imagewithcgimage:patternimage.cgimage scale:1.0f orientation:uiimageorientationleftmirrored]; uicolor *colorwithimagepattern = [uicolor colorwithpatternimage:flippedpa

ios - Tableview scroll too slow loading images -

my issue in app load images in table view. when scroll through table view slow , stops scrolling sometimes. looked online , saw using dispatch help. tried code below , app crashes saying nil. code: dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_high, 0)) { let parseimage: pffile = objectsong.valueforkey("picture") pffile var pic: uiimage = uiimage(data: parseimage.getdata())! dispatch_async(dispatch_get_main_queue()) { cell.imageview.image = pic <-- crash happens here } } } previous code used load table view cells: let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) tableviewcell let objectsong: pfobject = object pfobject cell.songimage.image = uiimage(data: parseimage.getdata()) that approach cannot work. remember how tableview reus

metaprogramming - Implement ifLet function in R -

here code: setgeneric("iflet", function(sym, x, body1, body2, ...) { standardgeneric("iflet") }) setmethod("iflet", signature(sym = "name", x = "any", body1 = "any", body2 = "any"), function(sym, x, body1, body2 = {}) { e = new.env() sym_str = deparse(substitute(sym)) iflet(sym_str, x, body1, body2) }) setmethod("iflet", signature(sym = "name", x = "any", body1 = "any", body2 = "any"), function(sym, x, body1, body2 = {}) { stopifnot(length(sym) == 1) e = new.env() assign(sym, x, envir = e) if(e[[sym]]) { eval(substitute(body1), e) } else { eval(substitute(body2), e) } }) iflet("..temp..", true, {print(paste("true.", as.characte

java - Play Framework @routes.Assets.at Compilation Error -

i'm using play 2.4.0 , i've been trying follow tutorial main page: https://playframework.com/ play 2.3 , after solving couple of issues regarding changes in ebean orm version 2.3 2.4, i'm stuck following error: compilation error value @ not member of controllers.reverseassets my index.scala.html : @(message: string) @main("welcome play") { <script type='text/javascript' src="@routes.assets.at("javascripts/index.js")"></script> <form action="@routes.application.addperson()" method="post"> <input type="text" name="name" /> <button>add person</button> </form> <ul id="persons"> </ul> } and routes file: # routes # file defines application routes (higher priority routes first) # ~~~~ # home page / controllers.application.index() post /person

android - Google API client bug, sending locations -

i want create send every few seconds message gcm. after time want remove locationupdates again. sending data intentservice of gcm use pendingintent. every time , happens lot error : caused by: java.lang.illegalstateexception: googleapiclient not connected yet. @ com.google.android.gms.common.internal.n.a(unknown source) @ com.google.android.gms.common.api.b.b(unknown source) @ com.google.android.gms.internal.lt.removelocationupdates(unknown source) @ com.example.task_1.location.locationupdate.stoplocationupdates(locationupdate.java:83) @ com.example.task_1.location.locationupdate.onstartcommand(locationupdate.java:52) @ android.app.activitythread.handleserviceargs(activitythread.java:2704)             at android.app.activitythread.access$1900(activitythread.java:141)             at android.app.activitythread$h.handlemessage(activitythread.java:1353)             at android.os.handler.dispatchmessage(handler.