Posts

Showing posts from July, 2012

angularjs - Empty an array before push -

i took project using angularjs. there filtering system. actually, click on category add category list. industries got category shown. note click on selected category remove category. i click replace filtering category each click not add category. how should modify code: $scope.changercategorie = function(category , name ){ if( jquery.inarray(category, $scope.selected ) !== -1) { angular.foreach($scope.selected , function(obj,index){ if( category == obj ){ $scope.selected.splice(index,1); $scope.selected_name.splice(index,1); } }); }else{ $scope.selected.push(category); $scope.selected_name.push(name); } $scope.selected_filter = $scope.selected.join(', '); } i tried doesn't work $scope.changercategorie = function(category , name ){ $scope.selected = 0; $scope.selected_name = 0; $scope.selected = category; $scope.selected_name =

jsf - Is it possible to stop perfoming validation after one of validators threw an exception -

i have jsf-page: <h:inputtext> <f:validator binding="{validator}" /> </h:inputtext /> <!-- other inputs validators --> is possible skip validation phase after 1 of validators failed , render response validation message?

math - Probability of getting specific sum after rolling n dice. Ruby -

what best solution finding probability of rolling sum n dice? i'm solving finding mean. standard deviation. z_score numbers below x z_score numbers above x converting both probabilities subtracting 1 other this i've done far. # sides - number of sides on 1 die def get_mean(sides) (1..sides).inject(:+) / sides.to_f end def get_variance(sides) mean_of_squares = ((1..sides).inject {|sum, side| sum + side ** 2}) / sides.to_f square_mean = get_mean(sides) ** 2 mean_of_squares - square_mean end def get_sigma(variance) variance ** 0.5 end # x - number of points in question def get_z_score(x, mean, sigma) (x - mean) / sigma.to_f end # converts z_score probability def z_to_probability(z) return 0 if z < -6.5 return 1 if z > 6.5 fact_k = 1 sum = 0 term = 1 k = 0 loop_stop = math.exp(-23) while term.abs > loop_stop term = 0.3989422804 * ((-1)**k) * (z**k) / (2*k+1) / (2**k) * (z**(k+1)) / fact_k sum += term k += 1

How to test the APNS p12 certificate environments ruby? -

i'm developing service sending push notifications, can't tell if uploaded apns certificate p12 sandbox or production. test in order avoid human error when uploading certificate. the common name of issued certificate tells if it's sandbox or production. example production: apple production ios push services: your.app.identifier my ruby skills bit rusty should it: require 'openssl' raw_cert = openssl::pkcs12.new(file.read(path_to_your_cert), your_pwd) # if want read .p12 cert cert = openssl::x509::certificate.new(raw_cert) cert.subject.start_with?("apple production ios") see here: http://ruby-doc.org/stdlib-2.0.0/libdoc/openssl/rdoc/openssl/x509/certificate.html

sql server - Security to run stored procedure with CTE -

i have stored procedure mystoredprocedure uses cte , returns it. create procedure mystoredprocedure mytemptable(foo) ( select bar mytable ) select foo mytemptable i have fixed requirement security. there fixed user myuser can give role myrole , , have granted myrole execute permissions mystoredprocedure . but error: create table permission denied in database 'mydatabase'. questions: am correct assume because cte creates table? how give myrole little access possible create cte, not alter everything? note: it has been impossible me search answer feel free edit or post correct words people search gets more help. i don't know if useful answer, had overlooked a select * mytable2 i had no idea potentially generate create since mytable2 exist

ruby - Stripe Connect in Rails -

trying necessary information after stripe user connects application, started out , have far, putting data in specific variables so: provider = request.env["omniauth.auth"].provider, uid = request.env["omniauth.auth"].uid, access_code = request.env["omniauth.auth"].credentials.token, publishable_key = request.env["omniauth.auth"].info.stripe_publishable_key when "skip form" redirected session#index , error undefined method provider nil:nilclass here routes: rails.application.routes.draw root 'login#index' 'login/log_in' => 'login#log_in' post 'login/log_in' => 'login#log_in' 'login/logout' 'sessions/index' '/auth/stripe_connect/callback', to: 'sessions#index' end

sql - Access UNION and JOIN query -

situation: access database i'm working on separates parts left , right parts. same part can used on both sides. trying create query count total number of individual parts needed per week. question: how create query allows union multiple fields , join shown below? table 1: part # |left part | left part qty | right part | right part quantity 1 xyz 5 lmn 7 2 abc 8 xyz 4 table 2: part # | needed 1 10 2 25 query: part | quantity xyz 150 (5 * 10) + (4 * 25) abc 200 (8 * 25) lmn 70 (7 * 10) you have problem in ms access, because cannot put union / union all subquery. if have table of parts (which should have), can use left join , think following want: select p.partname, sum(nz(t1l.leftpartqty * t2.needed) + nz(t1r.rightpartqty * t2.needed)) ((part p inner join table2 t2 on p.part# - t2.part# ) left join table1 t1l on t1l.left

java - Println error using enumate paramer and import error -

i have enumeration class this: public enum elementi { idrogeno("h", 1, 1.008), elio("he", 2, 4.003), // ... altri elementi litio("li", 3, 6.491); private int numeroatomico; private double massaatomica; private string simbolo; public int getnumeroatomico() { return numeroatomico; } public string getsimbolo() { return simbolo; } private elementi(string simbolo, int numeroatomico, double massaatomica){ this.simbolo = simbolo; this.numeroatomico = numeroatomico; this.massaatomica = massaatomica; } } in file have main program this: import java.util.elementi; public class main{ public static void main (string[] args){ (elementi e: elementi.values()) system.out.println("%s\t|\t%d|\t%s\n", e.getsimbolo(),e.getnumeroatomico(), e); } } if compile

c# - Explicitly declare the column name for a navigation property -

i'm trying use entity framework 6.1.3 oracle 12c database server. have been warned. i'm not yet ready tell customer it's impossible. have put number of hacks in place. need one. generated column names can longer 30 characters oracle still unable handle those. thought use columnattribute properties it's ignored navigation properties. here's sample code: public class component { public int componentid { get; set; } [column("parentif")] public virtual interface parentinterface { get; set; } } public class interface { public int interfaceid { get; set; } } the generated name "parentinterface_interfaceid". want change shorter "parentif". above code not work, still uses longer name. some code i've found elsewhere uses this: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { // fix reference column names support oracle's 30 characters restriction. // entity framework ignores co

regex - How to extract value between two strings with regexp_replace in Oracle? -

i want replace value found within regexp_replace in oracle. used regex101.com tool debug regular expression, , it's highlights result well, if put expression select, nothing... it's not replacing string want. so, question is, why pattern wrong in oracle pl/sql? select regexp_replace('some xml datas', '/(?<=</first_tag>)(.*)(?=</last_tag>)/s', '<replace_tag xsi:nil="1"/>') dual as can see search between 2 closing tags. sample xml: <?xml version='1.0' encoding='utf-8'?> <last_tag xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="urn:bla-bla-bla"> <default_language>en</default_language> <debug>0</debug> <debug_level>medium</debug_level> <debug_file>bla-bla.log</debug_file> <first_tag> <logical_printer> <id>printer1</id> <physical_printer>dummy_printer</physical_pri

go - Get given timezone timestamp -

i playing around timezone , noticed wierd. i in bst timezone hour ahead of gmt. := time.now() location, _ := time.loadlocation("atlantic/cape_verde") timeatzone := now.in(location) fmt.println(timeatzone) timestamp = timeatzone.unix() fmt.println(timestamp) fmt.println(now.add(-time.hour).utc().unix()) fmt.println(now.utc().unix()) you notice timestamp of bst current timezone. how timestamp of gmt??? http://play.golang.org/p/oq0irya0h7 unix time absolute. there no "bst unix time." there no "atlantic/cape_verde" unix time." there unix time. number of seconds since specific moment ( 00:00:00 coordinated universal time (utc), thursday, 1 january 1970, not counting leap seconds ). time zones related representation of time, not time itself. same moment me, wherever in world (leaving einstein aside moment). happen call moment different things. setting location on *time

android - How to compile my app with support library v7? -

i developing app min sdk 10. want add suppor library app , use provide actionbar app. how can support library app in eclipse. first download android support library sdk manager. click on import/existing code in workspace select location of support library "sdk\extras\android\support\v7". , press ok. right click on project properties , go android tab , click on add , select file , click ok.

Defining a new monad in haskell raises no instance for Applicative -

i trying define new monad , getting strange error newmonad.hs newtype wrapped = wrap {unwrap :: a} instance monad wrapped (>>=) (wrap x) f = f x return x = wrap x main = putstrln "yay" $ ghc --version glorious glasgow haskell compilation system, version 7.10.1 $ ghc newmonad.hs [1 of 1] compiling main ( newmonad.hs, newmonad.o ) newmonad.hs:2:10: no instance (applicative wrapped) arising superclasses of instance declaration in instance declaration ‘monad wrapped’ why need define instance of applicative ? this applicative monad proposal (amp). whenever declare monad , have declare applicative (and therefore functor ). mathematically speaking, every monad is applicative functor, makes sense. you can following remove error: instance functor wrap fmap f (wrap x) = wrap (f x) instance applicative wrap pure = wrap wrap f <*> wrap x = wrap (f x) https://wiki.haskell.org/functor-applicative-mon

android - Expanding a ViewGroup's surface to include text shadows -

in android project, using framelayout contain textview . textview has large shadow on (to provide glow). however, android detecting textview 's bounding rect of contained text, without shadow, , result compositor gets confused when objects animate around it. as workaround tried forcing textview have own hardware surface (with setlayertype ), closely cropped text , doesn't account shadow, shadow gets cut off. i have tried adding padding framelayout , doesn't expand surface - moves textview down , right padding amount. if set background color on framelayout , surface expand cover entire size, unfortunately background visible, if set 0x01000000 . if there way force contain entire background if background color 0, suitable solution. what easiest way expand hardware surface include text glow, ideally without affecting position of text itself? the trick canvas believe every pixel has been touched, without having paint. drawing colordrawable not work, be

javascript - Connect to Prosody XMPP server using Strophe js (CONNFAIL) -

i have prosody server setup @ example.com. can connect bosh service using pidgin url http://example.com:5280/http-bind , on broswer same url replies : it works! point bosh client url connect prosody. for more information see prosody: setting bosh. now trying using following command new strophe.connection("http://example:5280/http-bind/").connect("admin@example.com", "123456", callback); where callback fuction(status) use log connection. status @ callback first strophe.connecting , strophe.connfail . i have enabled debug log level on prosody , /var/log/prosody/prosody.debug doesn't add new entries (it works fine on pidgin). also, have fixed proxy adding following lines on apache2 virtualhost <location /http-bind> order allow,deny allow </location> rewriteengine on rewriterule ^/http-bind$ http://example.com:5280/http-bind [p,l] i note on pidgin had enable plain-text authentication in order make w

regex - Replacing digits immediately after a saved pattern -

searched pattern looks text9 i search (text)9 i want replace \15 text5 instead it's giving me text . any other character works except digits. as turns out, pcre-style back-references not work. so, have use \015 replace text captured first capturing group ( \01 ) , 5 . since there cannot more 99 capturing groups, , both digits after \ treated back-reference group number, \01 interpreted reference first group, , rest literal digits.

c# - Amazon Elastic Transcoder Http Request Error -

i need use amazon elastic transcoder mvc project. wanted use via http request described documentation. while creating header of request need create authorization parameter described think did. response returns error; the request signature calculated not match signature provided. check aws secret access key , signing method. consult service documentation details. host parameter of request = elastictranscoder.us-east-1.amazonaws.com:443 url post = https://elastictranscoder.us-east-1.amazonaws.com:443/2012-09-25/jobs authorization parameter = aws4-hmac-sha256 credential=accesskey/formatteddate/us-east-1/elastictranscoder/aws4_request,signedheaders=host;x-amz-date;x-amz-target,signature=xxxxx anyone have idea of reason error? i have updated awssdk nuget mvc project , there api elastic transcoder; here simple way do: var response = etsclient.createjob(new createjobrequest() { pipelineid = "pipelineid", //pipeline.id,

c++ - Select three choices (multiple choices) in C -

hi working on calculator , have choices on solve. first, asked how many given have. code, made 3 given. default, input 3. next, have list of 11 given in order solve equations. user chose 3 numbers 1-11... have started case using number 1,3,9 , 1,3,10, , 1,3,11. problem when choose 1,3,10 randomly, example change order in input in choice,choice2,choice 3 choosing 3,10,1 instead of 1,3,10... so let's choose 1,3,10 inputted in order... 10,3,1.. still must go action implement. i used following line if statement... if(choice==1,3,10 && choice2==1,3,10 &7 choice3==1,3,10) execute action... and if( (choice== 1 || 3 || 10) && (choice2== 1 || 3 || 10) && (choice3== 1 || 3 || 10)) execute action... i've tried above won't execute statements below it... execute 1 above... #include<stdio.h> #include<conio.h> #include<math.h> #define pi 3.14159265 int main(){ double length, angle, radius, tangent, chord, midordinate, externa

jquery - Time To Percent Using PHP -

this may sound dumb question, how can convert time between 2 dates percent? i using jquery plugin: http://tinacious.github.io/goalprogress/ the script on page calculates percent is: $('#timergoal').goalprogress({ goalamount: 100, currentamount: 40, textbefore: '', textafter: '% completed.' }); where says goalamount: i'd remain @ 100 , says currentamount: 40, i'd somehow find difference in percentage between 2 days, know i'd have set start date, current date, , end date find percentage. i'm part of code have be: $startdate = '01/01/2015 12:00:00'; $currentdate = date('d/m/y h:i:s'); $enddate = '02/15/2015 12:00:00'; finding difference in 2 dates easy, it's third date thing cannot grasp, make percentage. any ideas? i thinking along lines of: [taken from: how find difference in days between 2 dates ]

jquery - Text overflows on a div -

i have div right when text overflows, makes scroll. questions are, there way make scroll bars hidden until text overflows? , there way make overflows , down, , not left , right? div { width: 100px; height: 100px; overflow: scroll; } <div>hellohellohellohellohellohellohellohellohellohellohellohellohello</div> yes! use overflow: auto; , word-break: break-all; . div { ... overflow-y: auto; overflow-x: hidden; word-break: break-all; } working fiddle: http://jsfiddle.net/631msl3l/2/ note: word-break not supported opera.

pointers - What does => (equals greater than) mean in Fortran? -

i'm looking through old fortran 90 code , have come across => symbol: var => item it looks it's being used sort of assignment. searching google "arrow symbol fortran" or "equals greater symbol fortran" gives me no related material. => appears in 6 contexts syntactic element in modern fortran, most, not all, related pointers: pointer assignment ; pointer initialization ; procedure (pointer) declaration ; type-bound procedure declaration ; association ; renaming . there close connection between of these. loosely, in many => can viewed providing alternative temporary or permanent means of referencing entity. in none, however, => acting operator. 1 pointer assignment pointer assignment 1 of traditional appearances of => , appearing in fortran 90. used associate pointer target, , explained in another answer . use association renaming renaming of entities use associated involves element => , other appeara

git ignore line endings -

i know similar questions have been asked, still can't working. my project shared among people using different operating systems, , i'm on osx. also, not uses git yet , end having commit changes of others. sometimes, out of git says there pending changes. looking @ files identical: @@ -1,6 +1,6 @@ -<deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" -> - <deployment.parts> - </deployment.parts> -</deployment> +<deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" +> + <deployment.parts> + </deployment.parts> +</deployment> i suspect line ending issue. [edit] 1 external diff tool says: "status: 1 difference line endings differ - left: windows (crlf), right: unix (lf)" following of online tips,

python - Parsing an expression containing N using SymPy -

i parsing expression using sympy , getting following trace: >>> parse_expr("3n", transformations=transformations)` typeerror: unsupported operand type(s) *: 'integer' , 'function' from gather, happens because n seen function parser , not other string. code works fine few other symbols tested. can explain briefly why happening? there list of keywords or characters cannot parsed using parse_expr ? quoting docs ( pitfalls , gotchas ): lastly, recommended not use i, e, s, n, c, o, or q variable or symbol names, used ... numeric evaluation (n() equivalent evalf() )... or better yet, use lowercase letters symbol names. python not prevent overriding default sympy names or functions, careful.

c++ - How do header files like OpenGL.h work -

i understand header files processed prior compilation of remainder of source file in included make process of developing code easier. know allow working declarations. however, don't see functions in use in header file opengl.h in tutorials have been researching. opengl.h obscure me #define extern. don't know happening. instance #define cgl_version_1_0 1 #define cgl_version_1_1 1 #define cgl_version_1_2 1 #define cgl_version_1_3 1 extern cglerror cglqueryrendererinfo(gluint display_mask, cglrendererinfoobj *rend, glint *nrend); extern cglerror cgldestroyrendererinfo(cglrendererinfoobj rend); extern cglerror cgldescriberenderer(cglrendererinfoobj rend, glint rend_num, cglrendererproperty prop, glint *value); i have no idea happening here, , have come across other c++ includes share similar obscurity. write library of own , feel popper header files outlined in manner. to me seems happening keywords or variables being made, or functions don't have code block. h

r - Bounds of all intervals where a series crosses a fixed level -

i have many 2 columns matrices, one: x<-structure(c(-3.09, -3.028, -2.965, -2.903, -2.841, -2.778, -2.716, -2.653, -2.591, -2.528, -2.466, -2.404, -2.341, -2.279, -2.216, -2.154, -2.091, -2.029, -1.967, -1.904, -1.842, -1.779, -1.717, -1.654, -1.592, -1.53, -1.467, -1.405, -1.342, -1.28, -1.217, -1.155, -1.093, -1.03, -0.968, -0.905, -0.843, -0.78, -0.718, -0.656, -0.593, -0.531, -0.468, -0.406, -0.343, -0.281, -0.219, -0.156, -0.094, -0.031, 0.031, 0.094, 0.156, 0.219, 0.281, 0.343, 0.406, 0.468, 0.531, 0.593, 0.656, 0.718, 0.78, 0.843, 0.905, 0.968, 1.03, 1.093, 1.155, 1.217, 1.28, 1.342, 1.405, 1.467, 1.53, 1.592, 1.654, 1.717, 1.779, 1.842, 1.904, 1.967, 2.029, 2.091, 2.154, 2.216, 2.279, 2.341, 2.404, 2.466, 2.528, 2.591, 2.653, 2.716, 2.778, 2.841, 2.903, 2.965, 3.028, 3.09, 10.188, 10.195, 10.202, 10.209, 10.216, 10.224, 10.233, 10.241, 10.25, 10.26, 10.27, 10.281, 10.293, 10.305, 10.318, 10.332, 10.346, 10.362, 10.378, 10.396, 10.415, 10.435, 10.456, 10.4

javascript - Grunt file not doing a proper build -

Image
so started project using yeoman 'yo angular'. since, have added additional file structure (i.e. broke views , scripts folders based on project area), added additional packages use in project, etc.... running 'grunt serve' , loads , works great locally should. prior hadn't done grunt went default provided build yo angular. hadn't modified yet. when time port server , going run 'grunt' need deploy, having issues. here gruntfile.js: // generated on 2015-04-02 using generator-angular 0.11.1 'use strict'; // # globbing // performance reasons we're matching 1 level down: // 'test/spec/{,*/}*.js' // use if want recursively match subfolders: // 'test/spec/**/*.js' module.exports = function (grunt) { // load grunt tasks automatically require('load-grunt-tasks')(grunt); // time how long tasks take. can when optimizing build times require('time-grunt')(grunt); // configurable paths application var

Neo4j Cypher : No of Relations for Each Node -

what cypher find no of edges/relationships of each user/node ? want return count each user. the fastest way , uses node.getdegree internally. you can separate rel-pattern direction , relationship-type. match (n:user) return n, size((n)--()) degree

visual c++ - How to wrap class that passes unmanaged class in constructor? -

i trying understand c++/cli can create wrapper classes c++ code. problem have class stores pointer parent object of class, therefore need pass class. below example, full class has more functions , stores data. class { private: a* parent; public: a(a* parent) { parent = parent; } ~a() { delete parent; } a* getparent() { return parent; } } my current idea have non-public constructor can construct managed class unmanaged 1 without being accessible outside class. public ref class manageda { a* unmanaged; manageda(a* unmanaged) { this->unmanaged = unmanaged; } public: manageda(manageda^ parent) { unmanaged = new a(parent->unmanaged); } ~manageda() { delete unmanaged; unmanaged = null; } manageda^ getparent() { return gcnew manageda(unmanaged->getparent()); } } while works functions inside class, still have is

Upgrading Authorize.net to Akamai -

authorize.net upgrading access internet connections serve our data centers. instead of allowing direct connections, internet traffic routed through akamai, third-party cloud network service routes , delivers internet traffic. the new akamai transaction urls available are: https://api2.authorize.net/xml/v1/request.api https://api2.authorize.net/soap/v1/service.asmx https://secure2.authorize.net/gateway/transact.dll how go upgrading current system use these? require_once 'anet_php_sdk/authorizenet.php'; define("authorizenet_api_login_id", $authlogin); define("authorizenet_transaction_key", $authkey); //set true test account, set false real account define("authorizenet_sandbox", false); $sale = new authorizenetaim; $sale->amount = $rate; $sale->card_num = $ccnumber; $sale->exp_date = $ccexpire; $sale->card_code = $cccvv; $response = $sale->authorizeonly()

mysql - Selecting child records from same table -

Image
i have "company" table, has relation table "companycategorylink", has relation the "category". have query can select companies based on company id. have field in category table identifies parent category, can have nested categories. had make change design though, can "merge" categories. can mark category "merged" setting flag in parent category. multiple categories show one. thing is, have select companies linked merged categories linked parent category, , @ same time have still work none merged categories. shouldn't break non merged categories. have no idea how go doing this. i'm required post code snippet of have, here is: select company.name companyname, company.description, company.logo, company.companyid, company.telephone, company.fax, company.address, company.city, category.name, category.categoryid company join categorycompanylink on categorycompanylink.companyid = company.companyid join category on categorycompany

cuda - cublasDtrsm after LU with pivoting -

i stuck @ small problem. i've got solve linear system a * x = b . the matrix a gets decomposed lu-factorization ( lapack ). result factorized matrix , pivotarray. after want solve 2 linear systems: u * x = y , l * y = b on gpu *cublasdtrsm* . because of row interchanges dgetrf in lapack have pass pivot array cublas . *cublasdtrsm* -function don't offers this. without pivot array wrong results. i searched disabling pivoting in lapack , regarding stability it's not possible. there hint how solve linear equation system lu-factorization? if wanted use particular approach (cublas trsm after lapack getrf), believe should able use cublas trsm l,u output of lapack rearranging b vector (or matrix) match rearrangement order lapack performed during pivoting. believe order given in formula ipiv in lapack documentation : ipiv ipiv integer array, dimension (min(m,n)) pivot indices; 1 <= <= min(m,n), row of matrix int

FileNet - Reporting total number of user logged in to Filenet during a given period of time -

we need report total number of users have logged filenet environment during every quarter. there way it? i have seen environment custom logon event created. whenever user logs on event raised , custom entry may go staging db reports can generated. how achieve this? i'm not sure i'm right this, don't think there way audit logon events, @ least there nothing in p8 kc. , because of way ce works, jaas context built against server, calls authenticated , authorized, there isn't logon phase. however, i'm sure of, is doable on application side because there, there logon action initiated user. how user connect platform? using content navigator, workplace xt, custom application developed or java api, or maybe of them? please provide more context. for instance, if using content navigator, simple plugin listening login event , logging event trick.

c - One digit after the decimal point in input -

this question has answer here: rounding number 2 decimal places in c 15 answers how can take floating point number 1 digit after decimal point (0.1) using scanf in c language ? example user may type 3.25405... in variable 3.2 saved . how can ? different rounding floating point number . read using fgets() , post-process buffer. @devsolar char buf[100]; if (fgets(buf, sizeof buf, stdin) == null) handle_eof(); char *p = strchr(buf,'.'); if (p && isdigit(p[1])) p[2] = 0; char *endptr; double y = strtod(buf, &endptr); ... even better alert user of ignored additional input. if (p && isdigit(p[1])) { if (p[2] && p[2] != '\n') puts("extra input ignored."); p[2] = 0; } char *endptr; double y = strtod(buf, &endptr);

meteor - Blaze only client-side with routing -

did here tried using blaze stand-alone framework? i love simplicity of blaze. use client-side , there guide there no example routing. is there guide or question it? or know if can achieve simple yes/no answer great. thanks.

Using Clojure's filter to find entry with minimum value -

i developed function using clojure returns row minimum value determined. here function that: (#(reduce (fn [r1 r2] (let [v1 (read-string (apply str (clojure.string/split (get r1 %2) (re-pattern " ")))) v2 (read-string (apply str (clojure.string/split (get r2 %2) (re-pattern " "))))] (if (< v1 v2) r1 r2))) %1) [[1 "2007 05 18"] [2 "2004 06 15"] [3 "2004 06 10"]] 1) returns: [3 "2004 06 10"] question want implement above function predicate filter function return same result above function. please how do this? thanks given reasonable assumption have dates, , want row lower date. this approach using sort-by . (sort-by (fn [[idx date]] (let [[_ y m d] (re-find #"\d{4} \d{2} \d{2}" date)] y)) [[1 "2007 05 18"] [2 "2004 06 15"] [3 "2004 06 10"]]) or can parse input stri

ruby on rails - Query nested model with multiple plucks -

i wondering if following possible: have model nested associative models. want able render json: on current_user.reports.minned , have eager_load plucked values each model. how can accomplish this? here use 2 models example. in reality, solution needs work n+1 nested models. does not work: class report has_many :templates def minned self.pluck(:id, :title) self.templates = templates.minned end end class template belongs_to :report def minned self.pluck(:id, :name, :sections, :columns) end end .... # reports.minned.limit(limit).offset(offset) # should return like: [{ 'id': 0, 'title': 'rep', 'templates': [{ 'id': 0, 'name': 'temp' 'sections': [], 'columns': [] }] }, { 'id': 1, 'title': 'rep 1', 'templates': [{ 'id': 0, 'name': 'temp', 'sections': [], 'columns'

restrict perl to do memory allocation from a fixed range of memory -

i have c program perl running thread. restrict perl interpreter use memory chunk pre-allocated (about 2gb). wonder if it's possible , how it. thanks. i'm reasonably there no way in normal perl binary, perl's memory allocation code nicely packaged in malloc.c file in source code. file has lots of comments on how perl's memory allocation works under hood. it's shouldn't hard create locally modified perl want, think.

css - Font not being recognized in web app -

i have created website based on grails web framework uses groovy. reason i'm not able fonts load properly. i'm using: font-family: "avenir next ultra light","avenir next"; on mac, font loads using safari , chrome not on firefox. on other systems i've noticed font doesn't load @ all. i understand it's paid font not sure font incorporated site properly. any advice appreciated! store font file somewhere on server. @font-face { font-family: name; src: url('/filepath/filename.ttf'); } p { font-family: name; } browser support: http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp edit: and, alex k. said, make sure have license if it's commercial font.