Monday, 15 March 2010

statistics - R-sq values, linear regression of several trends within one dataset -



statistics - R-sq values, linear regression of several trends within one dataset -

i running sticky spot trying solve variance accounted trend several times within single info set.....

my info structured this

x <- read.table(text = " sta year value 1968 457 1970 565 1972 489 1974 500 1976 700 1978 650 1980 659 b 1968 457 b 1970 565 b 1972 350 b 1974 544 b 1976 678 b 1978 650 b 1980 690 c 1968 457 c 1970 565 c 1972 500 c 1974 600 c 1976 678 c 1978 670 c 1980 750 " , header = t)

and trying homecoming this

sta r-sq n1 b n2 c n3

where n# corresponding r-squared value of locations info in original set....

i have tried

fit <- lm(value ~ year + sta, info = x)

to give model of yearly trend of value each individual station on years info available value, within master info set....

any help appreciated.... stumped on 1 , know familiarity r problem.

to r-squared value ~ year each grouping of sta, can take previous answer, modify , plug-in values:

# assuming x info frame (make sure don't have hmisc loaded, interfere) models_x <- dlply(x, "sta", function(df) summary(lm(value ~ year, info = df))) # extract r.squared values rsqds <- ldply(1:length(models_x), function(x) models_x[[x]]$r.squared) # give names rows , col rownames(rsqds) <- unique(x$sta) colnames(rsqds) <- "rsq" # have rsqds rsq 0.6286064 b 0.5450413 c 0.8806604

edit: next mnel's suggestion here more efficient ways r-squared values nice table (no need add together row , col names):

# starting models_x above rsqds <- data.frame(rsq =sapply(models_x, '[[', 'r.squared')) # starting original info in x, great: rsqds <- ddply(x, "sta", summarize, rsq = summary(lm(value ~ year))$r.squared) sta rsq 1 0.6286064 2 b 0.5450413 3 c 0.8806604

r statistics linear-regression

visual studio 2010 - What Are the Correct Web.Config Settings for the VS2010 F# Compiler? -



visual studio 2010 - What Are the Correct Web.Config Settings for the VS2010 F# Compiler? -

i've got aspx page this:

<%@ page language="f#" %> <!doctype html> <html> <head> <title></title> </head> <body> <%-- seek output "this test" 10 times --%> <% = 1 10 %> <p>this test</p> </body> </html>

and web.config looks this:

<?xml version="1.0"?> <configuration> <system.codedom> <compilers> <compiler language="f#;f#;fs;fsharp" extension=".fs" warninglevel="4" type="microsoft.fsharp.compiler.codedom.fsharpaspnetcodeprovider, fsharp.compiler.codedom, version=2.0.0.0, culture=neutral, publickeytoken=a19089b1c74d0809"> <provideroption name="compilerversion" value="v4.0" /> <provideroption name="warnaserror" value="false" /> </compiler> </compilers> </system.codedom> <system.web> <compilation debug="true" targetframework="4.0" /> </system.web> </configuration>

when run vs2010 webapp, error this: "the codedom provider type "microsoft.fsharp.compiler.codedom.fsharpaspnetcodeprovider, fsharp.compiler.codedom, version=2.0.0.0, culture=neutral, publickeytoken=a19089b1c74d0809" not located."

i've tried settings mentioned manojlds here, don't seem working me either. think because re-create of vs2010 pro has newer version of f# compiler, don't know how tell sure.

can help me understand right version settings should utilize in vs2010 web.config "compiler" , "provideroption" elements?

i have not tried this, configuration file looks right me - can check eversion of fsharp.compiler.codedom assembly installed in gac (by looking @ c:\windows\assembly)?

however, @ moment, not recommend using f# writing of aspx part of web page. works, won't smooth experience when mixing c# aspx or using razor templating engine (for asp.net mvc).

i think best way create server-side asp.net web applications in f# utilize f# code behind (in traditional webforms) or model , controller parts (in mvc). there number of templates , tutorials describe how this:

tutorial: creating web project in f# using online template and templates asp.net mvc 4 , older asp.net mvc 3 you might want check out web stacks page on fsharp.org

visual-studio-2010 f#

html - Show / Hide background image of div on hover -



html - Show / Hide background image of div on hover -

i'm trying figure out if @ possible show , hide background image on div hover state. here's code: html

<div class="thumb"> <div class="text"> header<br> sub-header<br><br> date </div> </div> <div class="thumb"> <div class="text"> header<br> sub-header<br><br> date </div> </div> <div class="thumb"> <div class="text"> header<br> sub-header<br><br> date </div> </div>

css

.thumb { width: 400px; height: 250px; background-color: silver; font-weight: bold; background: url("http://www.imageurlhere.com") no-repeat 50% 50%; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .text { padding: 15px; }

so want alternate between background image , background color, when hover on div background image show, , on mouseout background image hidden , revert background colour (silver). found do-able via pseudo classes cms site images changed on fly, hence they'll have inserted via html:

style="background-image: url('insert url here')"

is @ possible hide , show background-image?

are against using javascript (or jquery)?

if not, have solution using .hover() function in jquery. said didn't want add together new classes new images. i'm proposing store urls in .thumb elements.

html:

<div class="thumb" data-hoverimage="http://placekitten.com/250/400"> <div class="text">header <br>sub-header <br> <br>date</div> </div> <div class="thumb" data-hoverimage="http://placekitten.com/250/300"> <div class="text">header <br>sub-header <br> <br>date</div> </div> <div class="thumb" data-hoverimage="http://placekitten.com/400/250"> <div class="text">header <br>sub-header <br> <br>date</div> </div>

i stored each thumbnail's url in data-hoverimage attribute (it can whatever want).

then, using jquery, can utilize hover function. first function when cursor over, sec when cursor out.

$(".thumb").hover(function(){ var imgurl = $(this).data("hoverimage"); $(this).css("background-image", "url(" + imgurl + ")") }, function(){ $(this).css("background-image", ""); });

i have working model here: http://jsfiddle.net/auurq/

html css hover

visual studio 2010 - How to fix profiling error "Couldn't add counter: cta_launched_vsm0" -



visual studio 2010 - How to fix profiling error "Couldn't add counter: cta_launched_vsm0" -

when effort run kernel profiling, series of couldn't add together counter: cta_launched_vsm0 errors. think might due profiler targeting fermi card, while there's kepler card in machine. i'm using code generation compute_30,sm_30. how can prepare error?

environment:

windows 7 64-bit visual studio 2010 cuda 4.2 + cuda 5.0 (5.0 installed on top of 4.2) occurs projects created cuda 5.0 wizard , 5.0 sdk samples. occurs projects created 4.2 wizard. both debug , release builds. gpus: single gtx660. (gtx570 installed before no longer installed). analysis activity: profile cuda application. experiments run: all. other settings on defaults. nsight 2.2, bundled cuda 5.

errors:

nsight: profiling kernel kernel nsight: achieved occupancy experiment ( 1/13):. nsight: achieved flops experiment ( 2/13):. nsight: instruction statistics experiment ( 3/13):couldn't add together counter: cta_launched_vsm0 (not supported device) nsight: issue efficiency experiment ( 4/13):couldn't add together counter: cta_launched_vsm0 (not supported device) nsight: branch experiment ( 5/13):.. nsight: memory global experiment ( 6/13):couldn't add together counter: cta_launched_vsm0 (not supported device) nsight: memory local experiment ( 7/13):couldn't add together counter: cta_launched_vsm0 (not supported device) nsight: memory atomics experiment ( 8/13):couldn't add together counter: cta_launched_vsm0 (not supported device) nsight: memory shared experiment ( 9/13):couldn't add together counter: cta_launched_vsm0 (not supported device) nsight: memory texture experiment (10/13):couldn't add together counter: tex0_cache_sector_misses_gpc0_tpc0 (not supported device) nsight: memory caches experiment (11/13):..couldn't add together counter: l2_slice0_read_sectors_l1_fb0 nsight: memory framebuffer experiment (12/13):couldn't add together counter: l2_slice0_read_sysmem_sectors_fb0 (not supported device) nsight: launch info experiment (13/13):. nsight: experiments complete, total replays needed: 7

nsight visual studio edition 2.2 shipped before gtx 660 (gk106) released market. nsight 2.2 has been refreshed multiple times , works drivers compatible gtx 660. however, pm programming library not updated 2.2.

nsight visual studio 3.0 rc1 available download here supports gtx 660 , tesla k20.

visual-studio-2010 cuda profiling

Finding the length of an array in C -



Finding the length of an array in C -

i'm trying find length of array of "header" structures defined (a header holds few informational int members, if relevant here). effort passing fl, pointer start of array, , idx, index value indicates proper fl_tails pointer is stationed @ end of array (in other/repetitive words, 'fl_tails[idx]` pointer end):

int arr_size(header* fl, int idx){ int cnt = 1; /* passed guaranteed have @ to the lowest degree 1 */ while(fl != fl_tails[idx]){ fl++; cnt++; } }

i thought advance fl pointer , generate count until end reached, goes infinite loop. i'm wondering if caused in function or elsewhere need find. when printed addresses of origin , end unsigned ints, seemed innocuous enough---things 16777216 , 16777344, respectively. maybe wrong understanding of header construction , size/effect on steps?

you want compare addresses, so:

while(fl != &fl_tails[idx]) ^

c arrays pointers

naudio - how to play more than one wav file in c#.net -



naudio - how to play more than one wav file in c#.net -

i need play more 1 wav file simultaneously (at same time). must have alternative volume command , stop, pause, , play.

i using naudio dll this. works fine times application goes crash.

this code:

_wavout = new waveout(); _wavreader = new wavefilereader(soundfilepath); _wavreader = (wavefilereader)waveformatconversionstream.createpcmstream( _wavreader); _wavout.init(_wavreader); _wavout.play();

this stack trace get:

at naudio.wave.waveoutbuffer.writetowaveout() @ naudio.wave.waveoutbuffer.ondone() @ naudio.wave.waveout.callback(intptr, wavemessage, intptr, naudio.wave.waveheader, intptr)

if you're using soundplayer, impossible.

c# naudio

php - How to properly count a query in pdo -



php - How to properly count a query in pdo -

i trying dynamically load more posts scheme

this code...

$stmt = " select * `acmposting` (`sender`='$thisid' , `posttype`='a') or (`recip`='$thisid' , `sender`='$userid' , `posttype`='a') or (`sender` in ($friendsarray) , `recip`='$thisid' , `posttype`='a') order `timesent` desc limit $startlimit,10"; if($stmtcount = $conn->query($stmt)){ if($stmtcount->fetchcolumn() > 0){ $result = acmposts($conn, $site, $userid, $stmt); $jsonarray['a'] = $result; $jsonarray['b'] = 'go'; }else{ $jsonarray['a'] = '<div class="thisoutput" style="padding:12px;">there no more posts</div>'; $jsonarray['b'] = 'stop'; } }

everything works fine until gets lastly set of posts aka if limit 100,10 there 105 posts in phone call won't phone call fetchcolumn().

i hope question makes sense. in advance help can give.

edit

how can determine when have reached limit , deed accordingly

your description not precise maybe looking for:

http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows

php pdo