Search Results

Search found 4 results on 1 pages for 'plr'.

Page 1/1 | 1 

  • Loading, listing, and using R Modules and Functions in PL/R

    - by Dave Jarvis
    I am having difficulty with: Listing the R packages and functions available to PostgreSQL. Installing a package (such as Kendall) for use with PL/R Calling an R function within PostgreSQL Listing Available R Packages Q.1. How do you find out what R modules have been loaded? SELECT * FROM r_typenames(); That shows the types that are available, but what about checking if Kendall( X, Y ) is loaded? For example, the documentation shows: CREATE TABLE plr_modules ( modseq int4, modsrc text ); That seems to allow inserting records to dictate that Kendall is to be loaded, but the following code doesn't explain, syntactically, how to ensure that it gets loaded: INSERT INTO plr_modules VALUES (0, 'pg.test.module.load <-function(msg) {print(msg)}'); Q.2. What would the above line look like if you were trying to load Kendall? Q.3. Is it applicable? Installing R Packages Using the "synaptic" package manager the following packages have been installed: r-base r-base-core r-base-dev r-base-html r-base-latex r-cran-acepack r-cran-boot r-cran-car r-cran-chron r-cran-cluster r-cran-codetools r-cran-design r-cran-foreign r-cran-hmisc r-cran-kernsmooth r-cran-lattice r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-quadprog r-cran-robustbase r-cran-rpart r-cran-survival r-cran-vr r-recommended Q.4. How do I know if Kendall is in there? Q.5. If it isn't, how do I find out what package it is in? Q.6. If it isn't in a package suitable for installing with apt-get (aptitude, synaptic, dpkg, what have you), how do I go about installing it on Ubuntu? Q.7. Where are the installation steps documented? Calling R Functions I have the following code: EXECUTE 'SELECT ' 'regr_slope( amount, year_taken ),' 'regr_intercept( amount, year_taken ),' 'corr( amount, year_taken ),' 'sum( measurements ) AS total_measurements ' 'FROM temp_regression' INTO STRICT slope, intercept, correlation, total_measurements; This code calls the PostgreSQL function corr to calculate Pearson's correlation over the data. Ideally, I'd like to do the following (by switching corr for plr_kendall): EXECUTE 'SELECT ' 'regr_slope( amount, year_taken ),' 'regr_intercept( amount, year_taken ),' 'plr_kendall( amount, year_taken ),' 'sum( measurements ) AS total_measurements ' 'FROM temp_regression' INTO STRICT slope, intercept, correlation, total_measurements; Q.8. Do I have to write plr_kendall myself? Q.9. Where can I find a simple example that walks through: Loading an R module into PG. Writing a PG wrapper for the desired R function. Calling the PG wrapper from a SELECT. For example, would the last two steps look like: create or replace function plr_kendall( _float8, _float8 ) returns float as ' agg_kendall(arg1, arg2) ' language 'plr'; CREATE AGGREGATE agg_kendall ( sfunc = plr_array_accum, basetype = float8, -- ??? stype = _float8, -- ??? finalfunc = plr_kendall ); And then the SELECT as above? Thank you!

    Read the article

  • Why do these ipfw delayed pipes have no effect?

    - by troutwine
    I'm on OSX 10.7.5 and am attempting to add some latency to the connection to my personal domain with ipfw, using this article as a guide. Normal latency: > ping -c5 troutwine.us PING troutwine.us (198.101.227.131): 56 data bytes 64 bytes from 198.101.227.131: icmp_seq=0 ttl=56 time=92.714 ms 64 bytes from 198.101.227.131: icmp_seq=1 ttl=56 time=91.436 ms 64 bytes from 198.101.227.131: icmp_seq=2 ttl=56 time=91.218 ms 64 bytes from 198.101.227.131: icmp_seq=3 ttl=56 time=91.451 ms 64 bytes from 198.101.227.131: icmp_seq=4 ttl=56 time=91.243 ms --- troutwine.us ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 91.218/91.612/92.714/0.559 ms Enabling ipfw: > sudo sysctl -w net.inet.ip.fw.enable=0 net.inet.ip.fw.enable: 1 -> 0 > sudo sysctl -w net.inet.ip.fw.enable=1 net.inet.ip.fw.enable: 0 -> 1 The configuration of the pipe: > sudo ipfw add pipe 1 ip from any to 198.101.227.131 00200 pipe 1 ip from any to any dst-ip 198.101.227.131 > sudo ipfw add pipe 2 ip from 198.101.227.131 to any 00500 pipe 2 ip from 198.101.227.131 to any > sudo ipfw pipe 1 config delay 250ms bw 1Mbit/s plr 0.1 > sudo ipfw pipe 2 config delay 250ms bw 1Mbit/s plr 0.1 The pipes are in place and configured: > sudo ipfw -a list 00100 166 14178 fwd 127.0.0.1,20559 tcp from any to me dst-port 80 in 00200 0 0 pipe 1 ip from any to 198.101.227.131 00300 0 0 pipe 2 ip from 198.101.227.131 to any 65535 37452525 32060610029 allow ip from any to any > sudo ipfw pipe list 00001: 1.000 Mbit/s 250 ms 50 sl.plr 0.100000 0 queues (1 buckets) droptail mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000 00002: 1.000 Mbit/s 250 ms 50 sl.plr 0.100000 0 queues (1 buckets) droptail mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000 Yet, this has had no effect: > ping -c5 troutwine.us PING troutwine.us (198.101.227.131): 56 data bytes 64 bytes from 198.101.227.131: icmp_seq=0 ttl=56 time=100.920 ms 64 bytes from 198.101.227.131: icmp_seq=1 ttl=56 time=91.648 ms 64 bytes from 198.101.227.131: icmp_seq=2 ttl=56 time=91.777 ms 64 bytes from 198.101.227.131: icmp_seq=3 ttl=56 time=91.466 ms 64 bytes from 198.101.227.131: icmp_seq=4 ttl=56 time=93.209 ms --- troutwine.us ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 91.466/93.804/100.920/3.612 ms What gives? I understand that ipfw is depreciated, but the manpage does not mention it being disabled. Also, I am not using Network Link Controller as I want to affect a single host.

    Read the article

  • C# Working with Linq binding

    - by Isuru
    I have designed Types as follow: class Cricket { string type; Team tm; public Team Team { get { return tm; } set { tm = value; } } public string Type { get { return type; } set { type = value; } } } class Team { string country; Players plr; public Players Players { get {return plr; } set { plr = value; } } public string Country { get { return country; } set { country = value; } } } class Players { string name; DateTime dob; int run; public string Name { get { return name; } set { name = value; } } public DateTime DOB { get { return dob; } set { dob = value; } } public int Run { get { return run; } set { run = value; } } } I have to get the following using LINQ techniques. 1) Youngest all data of the youngest player among all teams 2) Oldest Player of each team 3) The highest run scorer will receive Gold Medal,rest of the players of all team will receive Silver medal. (Please look at the GetPlayer() i have declared var Medal=new String[] {"Gold","Silver"} to associate the Medal ) public void GetPlayer() { var TeamMatrix = new Cricket[] { new Cricket{ Type="Twenty20", Team=new Team{ Country="England", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1989"), Name="Russel", Run=45}}}, new Cricket{ Type="Twenty20", Team=new Team{ Country="England", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1991"), Name="Joel", Run=56}}}, new Cricket{ Type="Twenty20", Team=new Team{ Country="Australia", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1990"), Name="Clark", Run=145}}}, new Cricket{ Type="Twenty20", Team=new Team{ Country="Australia", Players=new Players{ DOB=Convert.ToDateTime("01/Jan/1971"), Name="Bevan", Run=156}}} }; var Medal = new string[] { "Gold", "Silver" }; var tm = (from mat in TeamMatrix select new { mat.Team.Players.DOB }).Max(); Console.WriteLine("Youngest Age={0}",tm); } When I declare var tm = (from mat in TeamMatrix select new { mat.Team.Players.DOB }).Max(); I receive error atleast one object must implement IComparable. What is the actual way to complete the above three tasks? ( Tasks 1 ,2 ,3 are explained above). Thanks to all.

    Read the article

  • My Optin form doesn't work in Internet Explorer, but works fine in Firefox.

    - by Allen
    I have the following code for my optin form: <script language="JavaScript"> function checkSub(){ if (document.signup.email.value.indexOf('@', 0) == -1) { alert("Please fill in your valid Email address.\nYour email should be in the following format: [email protected]"); document.signup.email.focus(); return false} else if (!document.signup.terms.checked) { alert("You must read and agree to the terms"); document.signup.terms.focus(); return false} else { switch(document.signup.extra1.value) { case "Platinum": answer = confirm("By clicking OK you confirm that you have\nalready entered the World Cup Giveaway\nas a Platinum upgrade contributor.\n\nIf you have not yet entered the giveaway\nclick Cancel.\n\nYou can enter using the link at the\nbottom of the page.\n\nIf you have already entered the giveaway\nusing a link other than my invitation link\nyou are not eligible for this offer."); if (!answer) { return false} break; case "Gold": answer = confirm("By clicking OK you confirm that you have\nalready entered the World Cup Giveaway\nas a Gold upgrade contributor.\n\nIf you have not yet entered the giveaway\nclick Cancel.\n\nYou can enter using the link at the\nbottom of the page. \n\nIf you have already entered the giveaway\nusing a link other than my invitation link\nyou are not eligible for this offer."); if (!answer) { return false} break; default: alert("You must sign up as a contributor to the \nWorld Cup Giveaway to take advantage of \nthis offer.\n\nPlease click the link at the bottom of this \npage or at the blog post mentioned below \nto sign up.\n\nIf you have already signed up using \nthis link, please select the upgrade level\nyou chose on signup or select \"Free\" if \nyou signed up as a free contributor.\n\nIf you have already entered the giveaway\nusing a link other than my invitation link\nyou are not eligible for this offer.\n\nNote: This page may not function properly\nif viewed in languages other than English."); return false} } } </script> <form action="http://ebizac.com/ar/optin.php" method="post" name="signup" onsubmit="return checkSub()"> <input type=hidden name="action" value="addlead"> <input type=hidden name="member" value="2315"> <input type=hidden name="auto" value="7584"> <input type=hidden name="thankyou" value="http://plr.forinternetnewbies.com/Offer1"> <input type=hidden name="resubsetting" value="Y"> <input type=hidden name="resubredirect" value=""> <input type=hidden name="invalid_redirect" value=""> <div style="padding:0 0 0 10px;"> <table border=0 cellspacing=0 cellpadding=2><tr><td class="label"><font size="2" face="arial, verdana">Name:</font></td><td><input type=text size=20 name="fname"></td></tr> <tr><td class="label" width="150"><font size="2" face="arial, verdana">Email address:</font></span></td><td><input type=text size=20 name="email"></td></tr> <tr><td class="label"><font size="2" face="arial, verdana">Upgrade Level:</font></td><td><select size=1 name="extra1"><option>Haven't Joined Yet</option><option>Platinum</option><option>Gold</option><option>Silver</option><option>Free</option></td></tr> <tr><td></td><td align=center><input type="checkbox" name="terms" value="agree">I agree to the terms as described on the <a href="http://short9.com/blog0522-sp" target="_blank">blog post</a> </td></tr> <tr><td></td><td align=center><input type="submit" value="Contribute Now"></td></tr></table></div></form> Everything does what I expect in Firefox, but in Internet Explorer the switch statement always goes to the default case. I tested with an extra alert(signup.extra1.value) in the default case and it shows an empty string. What could be the problem here?

    Read the article

1