Posts

Showing posts from March, 2013

apache - how to config .htaccess to prevent www.parent.com/child access www.child.com -

i have unix shared hosting have: / .htaccess a.html .... child/ .htaccess b.html ...... the www.parent.com points / www.child.com points /child i have prevent access www.parent.com/child without stopping www.child.com working. result can redirect, 404 or access denied. .htaccess files based on html5boilerplate .htaccess file. i tried modified /.htaccess without success: attempt #1: <directory /child> order deny,allow deny </directory> --> child.com stopped working. attempt #2: rewritecond %{http_host} ^.*parent.com.*$ [nc] rewriterule ^.*/child.*$ / [nc] --> nothing happens. tried different regex combinations. attempt #3: <ifmodule mod_rewrite.c> rewritecond %{request_uri} ^.*child.*$ [nc] rewriterule ^ / [r=302.l] </ifmodule> --> nothing happens. known 1 brute force, after trying main less aggressive options. i known rewriteengine on, because works:

java - How is "this" used when it comes after a Class like this? -

i don't quite understand how keyword this being used in instance. private void checkforcomodification() { // i'm concerned first 1 if (cyclicarraylist.this.modcount != this.modcount) throw new concurrentmodificationexception(); } you need in inner classes. this points inner class instance itself. myouterclass.this points containing class instance. in case, necessary, because both classes have modcount property (and 1 outer class cyclicarraylist shadowed here).

ruby on rails - Routing Error in ROR -

i have 2 button in index page register login if clicked should redirect new.html.erb page, when clicked in register button found below error. please me resolve error. error: no route matches [post] "/posts/new" my code snippets given below. in posts/index.html.erb <h1>index page</h1> <h1>register here</h1> <hr /> <p> <%= button_to "register",posts_new_path%> </p> <p> <%= button_to "login" %> </p> in posts/new.html.erb <h1>register here</h1> in controller/posts_controller.rb class postscontroller < applicationcontroller def index end def new @user=user.new end end in config/routes.rb rails.application.routes.draw root "posts#index" "posts/new" => "posts#new" #resources:posts # priority based upon order of creation: first created -> highest priority. # see how routes lay out

objective c - update UITableView sectionHeaderHeight at time of UIButton click in iOS -

good day! default tableview sectionheaderheight 56. want update when sectionopened method gets called.this following code: - (void) sectionopened : (nsinteger) section { sectionheight = @"yes"; getsection = section; nslog(@"section clicked: %ld",(long)getsection); sectioninfo *array = [self.sectioninfoarray objectatindex:section]; array.open = yes; nsinteger count = [array.category.menulist count]; nsmutablearray *indexpathtoinsert = [[nsmutablearray alloc] init]; (nsinteger = 0; i<count;i++) { [indexpathtoinsert addobject:[nsindexpath indexpathforrow:i insection:section]]; } nsmutablearray *indexpathstodelete = [[nsmutablearray alloc] init]; nsinteger previousopenindex = self.opensectionindex; if (previousopenindex != nsnotfound) {

php - Extract URL from curl response -

i have following response php curl request: function ___qby1szi() { ymi = 5849562624174926"; kno = "http://download2.website.com/ce0zbkpbzmzg/2g7xednxqx4m11f/blabla.rar"; output = ""; for(i=0; i<ymi.length; i+=2){ output = output + string.fromcharcode( (128+ ( parseint("0x"+ymi.substr(i, 2)) - kno.charcodeat(0) )) % 128 ); } return output; } i want extract url response: http://download2.website.com/ce0zbkpbzmzg/2g7xednxqx4m11f/blabla.rar can tell me best way? have used preg_match seems slow. if preg_match() "slow", can imagine wrongly used it. try following pattern: /kno = "(.*)";/ matching group[1] contain url. example: $string = <<<eof function ___qby1szi() { ymi = 5849562624174926"; kno = "http://download2.website.com/ce0zbkpbzmzg/2g7xednxqx4m11f/blabla.rar"; output = ""; for(i=0; i<ymi.length; i+=2){ output = output + string.f

android - Can't show AlertDialog in DoInBackground -

i trying use alertdialog in android notify users runing in offline mode after checking internet connection. i have used following codes: protected void doinbackground(void... params) { if (this.isonline()) { new getjson().execute(); } else { alertdialog.builder builder1 = new alertdialog.builder(homefragment); builder1.setmessage("internet connection not available. viewing news in offline mode."); builder1.setcancelable(true); alertdialog alert1 = builder1.create(); alert1.show(); try { savefile = new saveintofile(filename); jsonstr = savefile.read(); // log.d(tag,"offline data reading file"); if (!jsonstr.equals(null)) new getdatas().execute(); else { } } catch (exception e) { e.printstacktrace(); } } return null; } but getting error on

ios - Adding rows dynamically in UITableView and setting scrollToRowAtIndexPath -

Image
dynamically adding rows on click of button @ index path n-3. in table view default there total 6 rows 4 contains textfields , other 2 contains button(add more , save). adding buttons @ location above last 2 rows. -(void)addmorebutton:(uibutton *)sender { rowcount=rowcount+1; int section = 0; long row = rowcount; nsindexpath* path = [nsindexpath indexpathforrow:row-3 insection:section]; [(uitableview *)[self.view viewwithtag:ktagtableview_detailsedit] beginupdates]; [(uitableview *)[self.view viewwithtag:ktagtableview_detailsedit] insertrowsatindexpaths:[nsarray arraywithobjects:path, nil] withrowanimation:uitableviewrowanimationleft]; [(uitableview *)[self.view viewwithtag:ktagtableview_detailsedit] endupdates]; nsindexpath* top = [nsindexpath indexpathforrow:rowcount-1 insection:0]; [(uitableview*)[self.view viewwithtag:ktagtableview_detailsedit] scrolltorowatindexpath:top atscrollposition:uitableviewscrollpositionbottom animated:yes]; } the problem arises when

javascript - how can i set starting position of a tabs in swipe Tabs for removing there scroll? -

Image
i make phonegap app using swipe tabs have 4 tabs , every tab have specific div getting dynamic data using ajax. tabs work fine. there have problem in scroll bar. suppose have in first tab page ajax call , data url. suppose 100 data url seeing last data use scroll page. problem here @ time swipe first tab second tab second tab use scroll of first tab page , show in last of page. don't know can explain add snapshot of problem. 1 please me. thanks. have no reputation post images add code swipe. my index.html <div class="tabs"> <a href="#" class="active">orders</a> <a href="#" >quotes</a> <a href="#">closing</a> <a href="#">encompass</a></div> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide slide-style"> <div class="content-slide

javascript - How to control checkbox value on client side with mvc -

i have problem. how control checkbox value on client side mvc, possible ? used checkbox's value getting bool variable. other guy changed different value example, original; <input data-val="true" data-val-required="required place" id="confirm" name="confirm" required="required" type="checkbox" value="true"> trytohack; <input data-val="differentvalue" data-val-required="required place" id="confirm" name="confirm" required="required" type="checkbox" value="differentvalue"> such when throw exception, how block state mvc ? you can jquery. value attribute shouldn't bool, can text. $('#confirm').val(); //returns value of checkbox $('#confirm').val("test"); //sets value "test" $('#confirm').is(':checked'); //returns if checkbox checked (true or false)

c++11 - Appropriate syntax for Initialising Python C-API container types (List Dict Tuple Set) in C++ -

i'm designing c++ python-wrapper. i have object class wrap generic pyobject*, , providing constructors , conversion operators can things like: // c++ type -> pyobject (of appropriate pyfoo_type) object i{42}; // create pyobject of type pylong_type object f{3.14}; // create pyobject of type pylong_type // pyfoo_type -> c++ type std::string s{f}; // convert pyobject pystring_type, convert std::string i'm looking @ how might initialise containers: pydict_type pylist_type pytuple_type pyset_type (i think that's everything?) it appears can break down 2 cases: pylist_type , pydict_type . because {pylist_type, pytuple_type, pyset_type} can initialise pylist_type , subsequently convert it. my question is: what c++ syntax should provide? seeing goal open-source project public consumption, need pay attention providing usable interface isn't going jar existing design patterns. everything follows below thought process, , own attempt answer question. sep

c++ - Returning reference to a function template -

i have template class called managed has static templated create() function. i'm trying write helper returns function when passed managed subclass type. typedef std::function<screenbase::ptr (windowbase&)> screenfactory; template<typename t> screenfactory screen_factory() { screenfactory ret = &t::create<windowbase&>; return ret; } because create takes template arguments, explicitly try reference instantiation takes windowbase&. far can see above code should work. however, when try call it, following error: error: expected '(' function-style cast or type construction screenfactory ret = &t::create<windowbase&>; ~~~~~~~~~~^ i'm not sure i'm doing wrong, pointers? you missing template keyword: template<typename t> screenfactory screen_factory() { screenfactory ret = &t::template create<windowbase&>; // ~~~

css - Is it possible to fill the remaining width? -

Image
i fill remaining width, example: the black rectangle container got relative width. the green rectangles display <div> or other element css in code block below. the red line shows end of right div of setup css below. can see don't want should fill remaining space. so how fill remaining space if content smaller container? .wrapper { display:block; text-align:center; } .container { display:inline-block; background-color:black; width:100%; max-width:600px; } .column { color:white; background-color:green; float:left; width:auto; display:inline-block; } <div class="wrapper"> <div class="container"> <div class="column"> short text </div> <div class="column"> <span>long text</span> </div> </div> </div> there large number of approaches, 1 float firsst

php - Drupal Panel - how to add node directly to Panel regions through drag and drop node -

using drupal 7. installed module panel , working fine. requirement - instead of adding node(node id) through "add content" option want add node through drag , drop. description - in page - nodes display @ left side , panel @ right side. if drag node(page or article) left side , drop region in panel should add node region(same line 'add content' working). i think file need change "sites\all\modules\panels\panels.module". please advice.

javascript - Angular JS not working on IE9 -

i trying migrate webpage angular js. simple spa. has basic components label, texboxes , dropdowns. can page working on chrome , firefox. looking page fails on ie9. in ie9 cant angular js working. asthe page loads following js errors: script5007: object expected angular.js, line 318 character 12 script438: object doesn't support property or method 'module' refernce-module.js, line 6 character 1 script5007: unable value of property 'controller': object null or undefined refernce-module-controller.js, line 6 character 1 i want mention havent used angular js in html except ng-app(in html tag) , ng-controller (in bodytag). following controller js code : referencedatamaintainenceapp.controller('referencedatamaintainencectrl', function ($scope) { $scope.lookup_codes = [ {'key':'fs_asset_class','value':'asset class - fs'}, {'key':'account_actc','value':'non asset cl

Open File in eclipse programatically -

i need open file in eclipse program example bash in linux or command prompt in windows. something eclipse.exe myfile.js which works, don't want start eclipse instance each file open file in current eclipse instance if 1 exists. is there chance of opening file in way? you can open file in eclipse command line check wiki page . eclipse open file feature

c - Insert a printf inside each function call with vim -

i debugging c code embedded systems ( backtrace no option) , have repetitive task consists in putting printf each function call find real caller of function in specific time of code execution. i using cscope tool along cctree vim plugin find callers , helpful if wrote vimrc configuration or if there magical vim plugin this. you can use cscope vim plugin cscope_maps . for more details on using cscope , vim refer cscope , vim

caching - How does client can understand that response from server cached by Akamai or not? -

i afraid akamai can cache cookie. want avoid it. is there way check it? can i open browser, browser console , detect it? p.s. have not direct access akamai configuration. there addon called "akamai content source" provided in akamai portal. "content source mozilla firefox , firebug extension gives overview of cache information in firebug's content source panel. both firefox , firebug required use add-on." tell if request served akamai or went origin response.

SQL Server: Proper way to order by name -

i have query containing lines following: select b.lastname + ', ' + b.firstname tm currently use order tm in order sort, seems work. however, in order right, can tell me correct way here order tm ? order tm, order b.tm, order b.lastname + ', ' + b.firstname or else? also, can tell me if need put tm in single quotes? it seems work without quotes want make sure right. order tm best way! order b.tm, no, tm not 1 of b's columns. order b.lastname + ', ' + b.firstname can done, first alternative easier. qutes required reserved words, , identifiers including strange characters (incl space).

javascript - Pop Up Window Not Display -

why below code not functioning registering on html source code? page.clientscript.registerstartupscript(page.gettype(), "pop", pops); below complete code. below intended display popup window. on other pages, pop window displaying using same line of code. i'm sure id of modal existing on html snippet public static void showmodaldialog(page page, string modalname = "mymodal", int modalwidth = 560) { string pops = string.empty; pops = "<script language='javascript'>" + "$('#" + modalname + "').modal('toggle').css({ 'width': '" + modalwidth + "px', 'margin-left': function () { return -($(this).width() / 2); } });" + "</script >"; page.clientscript.registerstartupscript(page.gettype(), "pop", pops); } try registe

c# - Insert custom data to JSON serialized from DataModel -

i have data model class i'm serializing json in order able post serialized json web service. data model this: using newtonsoft.json; namespace webcrawler.models { [jsonobject(memberserialization.optin)] public class linkdataviewmodel { [jsonproperty] public string title { get; set; } ..... [jsonproperty] public string customerid { get; set; } } } how should change data model class serialized json that: {"postpropertyrequest": {serializeddatamodel}} you can write custom json in way (make class derived jsonconverter , override 3 methods) using newtonsoft.json; namespace webcrawler.models { [jsonobject(memberserialization.optin)] public class linkdataviewmodel : jsonconverter { [jsonproperty] public string title { get; set; } ..... [jsonproperty] public string customerid { get; set; } public override object readjson(jsonreader reader, type

php - pgAdmin III can connect to Heroku Postgresql. PDO can't connect to same database. Why? -

i'm new here , apologize if i'm doing wrong post question. my question quite simple: machine can connect pgadmin iii remote postgresql (provide heroku). can read/write database without problems. unfortunately, from same machine , can't connect php page using pdo extension (it work perfectly). error give me is: sqlstate[08006] [7] fatal: no pg_hba.conf entry host "x.x.x.x", user "username", database "mydatabase", ssl off i should edit "pg_hba.conf" resolve, unfortunately can't edit on heroku (or maybe don't know how do). i don't understand why pgadmin iii can connect php page can't. thanks in advance. you ans in following ans think user have no entry in pg_hba.conf file , pgadmin iii , php users different check link

ssl - WSS/TLS websocket connection with Swift iOS -

solved (following answer) i using starscream library create safe websocket wss in test server have self-signed certificate , find impossible make connection. var socket = websocket(url: nsurl(scheme: "wss", host: "selfsignedserver.com", path: "/")!) log 2014-12-16 10:38:10.260 pruebasignin[2135:363455] cfnetwork sslhandshake failed (-9807) websocket disconnected: operation couldn’t completed. (osstatus error -9807.) and when try connect server certificate valid fails connect solved var socket = websocket(url: nsurl(scheme: "wss", host: "production.com", path: "/")!) log websocket disconnected: invalid http upgrade starscream supports flag can use self-signed certificates: https://github.com/daltoniam/starscream#self-signed-ssl-and-voip

node.js - Reset Password in nodejs -

i writing script in user can reset password. user email my example when user click on link. form open , user can enter new password. route code app.get('/resetpassword/:token', function (req, res, next) { var filelocation = path.resolve(__dirname + '/../public/resetpassword.html'); console.log(filelocation); res.sendfile(filelocation); }); app.post('/setnewpassword', function(req,res,next){ console.dir(req.body); }); and html there <form action="/setnewpassword" method="post"> <div> <label>password:</label> <input type="password" name="password" /> </div> <input type="submit" value="submit" /> </form> now problem not getting params under app.post('/setnewpassword' any idea? how params under setnewpassword. i want use

java - How to properly map a servlet -

i have mapped servlet this <?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>s1</servlet-name> <servlet-class>firstservlet</servlet-class> </servlet> <servlet> <servlet-name>s2</servlet-name> <servlet-class>secondservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>s1</servlet-name> <url-pattern>/servlet1/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>s2</servlet-name> <url-pattern>/servlet2/*</url-p

c++ - Replacing duplicates in a string -

i trying write code replace duplicates in string '*' . code have written is- #include<iostream> #include<math.h> #include<string> using namespace std; int main() { string ch; cin>>ch; for(int i=0;i<ch.length()&& (ch[i]!='*');i++) { for(int j=i+1;j<ch.length()&&ch[j]!='*';j++) { if(ch[i]==ch[j])ch[j]='*'; } } cout<<ch; } the above code gives unexpected results inputs. e.g. if input "adad" answer "ad*d", whereas output "adda", , "aadd" matches expected output. can tell me i'm doing wrong ? like piotr s. said in comments, need keep processing string, if current character * . here take, should work: #include<iostream> #include<math.h> #include<string> using namespace std; int main() { string ch; cin >> ch; for(int = 0; < ch.length(); ++i) { if(ch[i

javascript - I want to print parent url in my iframe. Is it possible? -

Image
i want print parent domain name in iframe. possible? share idea. in advance. :) parent page <html><head><title></title></head> <frameset border="0" rows="100%,*" cols="100%" frameborder="no"> <frame name="topframe" scrolling="yes" noresize src="http://test.com/test.php"> <frame name="bottomframe" scrolling="no" noresize></frameset> </html> iframe page (test.php) <body> <h1 align="center">parent domain name</h1> </body> you pass whatever value php page , output within frame view? <frame name="topframe" scrolling="yes" noresize src="http://test.com/test.php?domain=mydomain.com"> then in test.php <h1 align="center"><?php echo $_get['domain']; ?></h1> alternatively, you try using window.parent.document.loc

svg - d3.js graph has incorrect visualisation of path in firefox -

i'll try clear possibile (i'm not in english). have d3 static force graph , need cross browser. had big problem internet explorer, because doesn't support svg correctly. , solved drawing elliptic arc without markers suggested in topic. now have following problem: in every browser tested (chrome, ie, opera , safari far) graph shown correctly, in other words links length starts , stop in x,y coordinate of source , target node), while in firefox, using same data, every link go beyond node x,y coordinate. with chrome result with firefox result the code i'm using same both browser, if need can try make jsfiddle working.

javascript - Executing code before document.ready in requirejs -

i see require.js has support execute code when document.ready() fired. see: http://requirejs.org/docs/api.html#pageload i wondering there way 100% execute code before document.ready() invoked? example, code main.js executed before document.ready() event? thanks. there no pure requirejs solution request. in essence asking is: i'd a) load modules asynchronously b) want load them synchronously. requirement a entailed fact using requirejs. requirejs loader designed load amd modules. amd stands asynchronous module definition. if use requirejs, have okay fact operates asynchronously. cannot guarantee module load , execute before document ready. requirement 'b' entailed requirement code executes before document ready. cannot done otherwise forcing execution of modules synchronous. (i've given thought ways delay ready event don't see being possible. solutions jquery.holdready not really delaying event delaying handlers set using jquery.re

How to remove number in ng-grid header when using sortInfo in angularjs? -

Image
i beginner angularjs. have ng-grid default sorting 3 columns defined: sortinfo:{ fields: ['col1', 'col7', 'col6'], directions: ['desc', 'desc', 'asc'] }, but in result i'm getting small labels in grid header: how can rid of these number? i tried using custom template header , removing sortpriority part, didn't work. sortpriority @ or looking @ wrong place?

php - Unexpected results in eloquent query -

i running following query in laravel code, $organisations = organisation::with('projects', 'projects.clients') ->with('clients') ->get(); $organisations->load('users'); this loading in organisations table, , should in thoery load in related models expect object looks returned, organisation { projects { clients { } } users { } } basically organisation can have many projects, project can have 1 client, organisation can have many users , many clients. what wanting query client data returned each project not getting that, getting following object returned. [ { "id": "114", "name": "xxxxxxx", "slug": "xxxxxxx", "information": "", "type": "organisation", "notifications": "0",

javascript - Twitter Bootstrap tags input doesn't remove placeholder when onfocus -

i have been scratching head since yesterday on problem, cannot solve. new starter twitter bootstrap , going until yesterday. i using latest jquery v1.11.1 , twitter bootstrap v3.3.1. yesterday downloaded bootstrap tags input, here: http://timschlechter.github.io/bootstrap-tagsinput/examples/ the plugin works , have changed css styles match page layout problem having placeholder attribute not disappear when on focus. if type in tag , add comma value placeholder show until start typing , disappear again. i have tried using jquery onfocus function remove attribute when onfocus doesn't anything. want achieve when onfocus placeholder not show @ point not on blur. my input field demonstrated below: <input type="text" name="customer_tags" id="customer_tags" value="" placeholder="enter tags" data-role="tagsinput" required /> html5 placeholder attribute not disappear when focus in input tag... disappe

intellij idea - Spring Batch default beans not included -

i use annotation driven configuration, no xml hell, including spring batch application spring mvc rest based application. the spring-batch configuration file starts this: @configuration @enablebatchprocessing public class batchconfig { @autowired jobbuilderfactory jobbuilderfactory; @autowired stepbuilderfactory stepbuilderfactory; [...] intellij puts mark on beans, telling me not autowire no beans of 'jobbuilderfactory' / 'stepbuilderfactory' type found. afaik annotation @enablebatchprocessing should make beans available. the application compile, spring-batch seems included. in pom.xml added <dependency> <groupid>org.springframework.batch</groupid> <artifactid>spring-batch-core</artifactid> <version>3.0.2.release</version> </dependency> i can autowire other beans ( private environment environment ) in same file, autowiring works. steps need find solution? intellij issue compi

mysql - Calculate average using AVG function for multiple numbers -

i'm not sure used correct title, edit question if understand little bit more topic. now tried test mysql's avg() function , tried query: select avg(1,2,3) i expected give me 2 result. i've en error avg() intended receive column name single parameter. can not imagine need thing anywhere beyond artificial example believe understand sql language better if able execute such queries. avg() aggregation function, operates on single oolumn of values (or single expression evaluated each row). doesn't take multiple arguments. want: select (1 + 2 + 3) / 3 contrast with: select avg(t.n) (select 1 n union select 2 union select 3 ) t this summarizes 3 rows 1 row, calculating average.

android - UI not being properly updated on LG device (works on others!) -

i'm writing app i've been testing on nexus 5 android 5 , in emulator on different dpi , api levels. while ui magic missing on pre-l android, worked fine , know how work around these missing parts (e. g. implement touch feedback etc.) i've implemented recyclerview , cardview support library worked fine on device , emulators. there data being fetched web "list" being filled upon launch. now, i've tested app on lg g2 mini running android 4.4.2. ui not being updated. items added, have leave activity , come again before can see them. this sounds i've been missing runonuithread, didn't! furthermore, why working on stock android not on oems mod?

In Artifactory Pro, is there a URL for the latest snapshot version of an artifact on any release? -

i want out latest artifact repository, irrespective of version number on. e.g. if have 2 artifacts in repository so: 1.0-snapshot 1.1-snapshot i url allows me out 1.1-snapshot version. according documentation, ( http://www.jfrog.com/confluence/display/rtf/artifactory+rest+api#artifactoryrestapi-retrievelatestartifact ) possible release versions adding [release] url version number should be. i'm not sure how equivalently snapshots. (nb. maven supports feature through latest , release version indicators, using wget @ point) thanks. unfortunately, documentation states, "integration , release tokens cannot mixed together". feature request welcomed.

javascript - how to use uppercase method with do not allowed turkish character? -

i have following code: <input type="text" style="text-transform: uppercase" /> the string gets transformed uppercase, ü example, transform Ü . want ü transform u , e.g. gülay should become gulay . have idea how can this? if data comming database, suggest treat on server before send view. can use javascript if don't want happen on server. check out answer: remove accents/diacritics in string in javascript you use like: var finalstring = removediacritics(initialstring).touppercase();

How to print (hardcopy) with folds in Vim? -

i have simple todo list dates , tags : 141218 call school &phone @me 141219 buy groceries &buy @me 141220 have w order books &buy @w 141220 think vacation &vac @me 141221 have w try santa claus outfit &fam @w 141222 ask question s.o. &vim @me this list not long (i have longer files in mind), suppose want print it, , print, e.g., @w part ? first shall search : /&w then fold (vim wikia simple folding : tip 282) :set foldexpr=getline(v:lnum)!~@/ :nnoremap <f8> :set foldmethod=expr<cr><bar>zm i have : +—- 2 lines 141220 have w order books &buy @w +—- 1 line 141221 have w try santa claus outfit &fam @w +—- 1 line this works fine down hardcopy part : lines displayed… how should proceed print folded file ? unfortunately, :hardcopy doesn't consider current representation in window, prints physical contents (and has other limitations, ignoring concealment). use means of printing the :tohtml command

Will OCaml compiler deal with boolean operators to make recursion tail-recursive? -

let's have @ following function is_prime : let is_prime n = let rec div_check = * > n || (n mod <> 0 && div_check (i+1)) in n >= 2 && div_check 2 so if n mod <> 0 false , stop. but if n mod <> 0 true , recursively continue. my question if continues, has ocaml optimised compiler return div_check(i+1) directly, i.e., tail-recursive? or still hold true && part , wait div_check return? ps function taken http://www.cs.cornell.edu/courses/cs3110/2014sp/lectures/2/lec02.html the answer yes. i've simplified example, make compiler output more understandable: let rec is_prime n = let rec div_check = * > n || (i + < n && div_check (i+1)) in div_check n given input, compiler emit following assembly (i've added annotations): camlis_prime__div_check_1010: .l102: movq 16(%rbx), %rdi movq %rax, %rsi sarq $1, %rsi movq %rax, %rdx decq %rdx imu

php - How do I select emails from list to send -

i have user's role table called lookup_roles , contain user_id, email, , role fields. i need pull emails of rows have 's' (s stands test in system) in role field , put them $to else statement below emailed. if ($production == 'y' ) { $subject = "production subject"; $to = 'prodemail@email.com' . ', '; } else { $subject = "[test]"; $to = 'testemai1@email.com' . ', '; $to .= 'testemail2@email.com ' . ', '; i have feeling it's pretty simple. appreciate help. i'm still noob @ this. select email lookup_roles role 's' and walk through results , put them $to variable.

dataframe - Calculating correlation in data frame in R -

i have data frame d , has 3 columns, s , n , id , need calculate correlation between "s" , "n" based on "id". eg data frame: "s" "n" "id" 1.6 0.5 2 2.5 0.8 2 4.8 0.7 3 2.6 0.4 3 3.5 0.66 3 1.2 0.1 4 2.5 0.45 4 so, want calcualte correlation of 2's, 3's , 4's , return vector like: cor 0.18 0.45 0.65 my problem how choose these id's , calculate correlation , return in form of vector. thank you tab_split<-split(mydf,mydf$id) # list each element subset of data.frame same id unlist(lapply(tab_split,function(tab) cor(tab[,1],tab[,2]))) # vector of correlation coefficients with sample gave : mydf<-structure(list(s = c(1.6, 2.5, 4.8, 2.6, 3.5, 1.2, 2.5), n = c(0.5,0.8, 0.7, 0.4, 0.66, 0.1, 0.45), id = c(2l, 2l, 3l, 3l, 3l, 4l,4l)), .names = c("s", "n", "id")

javascript - View from multiple partials (loaded dynamically) in angular.js -

i create view consisting of multiple partials loaded dynamically depending on content type. new angular.js, , idea have in controller: $(elem).html(string_with_src); $compile(elem.contents())($scope); ...and works. thing wanted put source of partials in separate files , load them through jquery: $.get(source.html, function( data ) { elem.html( data ); $compile(elem.contents())($scope); }); but doesn't work. template not compiled angular.js. explain me why doesn't work or how better? don't use jquery this. angular provides directive load partials: ng-include : <div ng-include="'/path/to/partial.html'"></div> (notice double quotes "' when passing static string) you use dynamic path: $scope.pathtopartial = "/path/to/partial/" + partialname + ".html"; <div ng-include="pathtopartial"></div>