• Welcome to SpeedSolving.com — the world’s largest puzzle community!

    You’re currently browsing as a guest, which means you have limited access to discussions, resources, member profiles, and community features.

    Join 50,000+ cubers and puzzle enthusiasts from around the world to ask questions, share solves, improve faster, and be part of the community.

    Registration is free, fast, and easy — create your account today.

    Already a member? Log in here to hide this message and start participating.

Coding/Scripting/Programming/Web Design Help Thread

Carson

Premium Member
Joined
Feb 1, 2008
Messages
1,285
Location
Somerset, Kentucky, United States
WCA
2008PENT01
The Gist of Things:
This thread is an effort to avoid the multitude of threads scattered throughout the forum related to coding, scripting, etc. This is not a "one answer" type thread, as it is likely that many questions posed will result in conversational type answers. Questions do not need to be related to cubing software/scripts or web sites.

I have personally asked many questions here-and-there about these issues, as I know many of you have as well. We are fortunate, as a community, to have many proficient programmers in our midst, many of whom are very helpful and wiling to assist those of us who are "less than proficient." Hopefully this thread will be able to put those questions and resources in the same place.
 
Help needed with finding SD in Excel

I wasn't sure where to search or who to ask, so here I'll ask.
Could someone help me write a formula (for Excel/Google Docs Spreadsheets) for finding the standard deviation of a set of five times, removing best and worst?
I've done it for mo3 just by tweaking the mo3 average formula, since that doesn't remove any best/worst result. However, the a5 system is a completely different monster.

Thanks for your time =D

~R

EDIT: Thanks for the move, didn't see this here =)
 
Last edited:
Avg5 can be calculated by =(SUM(A1:A5) - MAX(A1:A5) - MIN(A1:A5))/3 (not sure if that's the right syntax, but you get the idea)
You can do he same for standard deviation with the correct formula: Wikipedia - Standard Deviation

So instead of using standard functions, you just type the formula, excluding the MIN and MAX
Or you can write new functions using VBA :)
 
Avg5 can be calculated by =(SUM(A1:A5) - MAX(A1:A5) - MIN(A1:A5))/3 (not sure if that's the right syntax, but you get the idea)
You can do he same for standard deviation with the correct formula: Wikipedia - Standard Deviation

So instead of using standard functions, you just type the formula, excluding the MIN and MAX
Or you can write new functions using VBA :)

But how would one factor in DNFs and DNSes? That's where I'm kinda stuck.
From the results.xls file you can download from the WCA website, they have:
=IF(COUNTBLANK(C2:G2)>0,"",IF(COUNTIF(C2:G2,"DNF")+COUNTIF(C2:G2,"DNS")>1,"DNF",ROUND(IF(COUNTIF(C2:G2,"DNF")+COUNTIF(C2:G2,"DNS")>0,(SUM(C2:G2)-I2)/3,(SUM(C2:G2)-I2-J2)/3),2)))
And this works perfectly for what I'd like for average of 5 (which explains why it's used officially for results pages). The first half of the formula is just fine, but the true/false arguments for ROUND are what's screwing me up.
 
And this works perfectly for what I'd like for average of 5 (which explains why it's used officially for results pages). The first half of the formula is just fine, but the true/false arguments for ROUND are what's screwing me up.

Let's assume we have results with at most one DNF or DNS
The nice thing about SUM( ... ) is that it will only sum the ... elements that are numbers. (... are, in this case, either times or "DNF" or "DNS")
For the standard deviation, you will need to sum (... - avg5), which is a number if ... is a number. In the bad case, ... is DNF or DNS, so a string, which will result in an exception. Excel simply doesn't understand that you want to subtract a number from a string :)

What you will need to do in this case, is check every ... to not be DNF before you subtract the avg5.
The excel formula's are not really nice in a case like this, because they will become very long, but you could try :)

I was just having some trouble with DIV's and I was wondering if somebody could give me an example.

Not sure what your problem is, but here is an example that shows the difference between div and span.
span is an inline block-element, while div will just use the whole page-width by itself.

edit: If your just starting to learn HTML, which I assume since you want to learn about div's, here is a site where I learned everything from
 
Last edited by a moderator:
Let's assume we have results with at most one DNF or DNS
The nice thing about SUM( ... ) is that it will only sum the ... elements that are numbers. (... are, in this case, either times or "DNF" or "DNS")
For the standard deviation, you will need to sum (... - avg5), which is a number if ... is a number. In the bad case, ... is DNF or DNS, so a string, which will result in an exception. Excel simply doesn't understand that you want to subtract a number from a string :)

What you will need to do in this case, is check every ... to not be DNF before you subtract the avg5.
The excel formula's are not really nice in a case like this, because they will become very long, but you could try :)

There's a STDEV function, and I wanna use it, but the DNSes and DNFs are in the way. No need for formulating how to find SD manually lol. Would it be beneficial to sort the data in a separate sheet and locally import the sd of the middle three results?

EDIT: Never mind, got it working using the LARGE function.
=IF(COUNTBLANK(A1:A5)>0,"",IF(COUNTIF(A1:A5,"DNF")+COUNTIF(A1:A5,"DNS")>1,"DNF",ROUND(IF(COUNTIF(A1:A5,"DNF")+COUNTIF(A1:A5,"DNS")>0,STDEV({LARGE(A1:A5,1),LARGE(A1:A5,2),LARGE(A1:A5,3)}),STDEV({LARGE(A1:A5,2),LARGE(A1:A5,3),LARGE(A1:A5,4)})),2)))
Woot
 
Last edited:
Maybe somebody can offer some help or shed some light on this for me. I'm curious if there is any validity to what my web host is telling me or if they're just blowing smoke up my ass. I have been getting a "Service Unavailable" error quite frequently when cubewhiz.com is visited. I have unlimited bandwidth and the site sees approximately 1000 page hits per day (on the main page...I don't have data for other page views). In addition, the site sees approximately 12 GB of bandwidth usage per month. Here is the email I got today in an attempt to resolve this issue.

Bob -

This isn't about bandwidth at all. It's about the number of connections to your site at any given time. No site can have unlimited connections or it would have the ability to overrun the server and shut down other sites.

Each account has a limited number of connections per second. Isolating your site (which was done) helps protect you from other sites so that you are not sharing resources with other customers. If you have scripts that fail to close or if you are having many hits per second to your site that are maintaining a connection to the site indefinitely, then that can affect the performance.

You also share the resources between 2 websites. You are not limited in your bandwidth to the sites, but the sites do share the connections that are allowed. I have increased the connections as much as I can.

We usually encourage customers to make sure that scripting sessions close properly. In all reality - your site would probably run faster/more efficiently on our Linux cloud servers, but we don't offer unlimited bandwidth there. Those packages are newer and handle the connection requests better.

Your site is visited by many bots and spiders and those could be tripping you up.

Bandwidth is not the problem at all for your site - it is the sheer number of hits and connections to the site that you are getting. That is what is causing the errors that you see. Your site is out of resources as far as the amount of visitors it can accomodate per second.
Any advice would be appreciated.
 
Last edited:
Maybe the solution there would be to use a robots.txt to prevent bots and spiders from looking at everything? The wikipedia article (http://en.wikipedia.org/wiki/Robots.txt) provides some good info about how to use one of those. It's possible that with the sheer quantity of stuff hosted on your site the bots and spiders could be making a ton of requests and overwhelming the server.
 
Are you connecting to a database? If so, you may have the connections left open. You want to close connections and dispose of objects when you are done with them in any language.

You need to figure out where the error came from. Did browser generate that message when the server didn't respond or did the server decide to give up when the site didn't respond?

I'm a Microsoft developer so I can't be a huge help. I can tell you this, Service Unavailable on a Microsoft Server usually means there was a crash in the web site's code.It's low level so it implies the site couldn't even start up at all.
 
Bob, do you still have all of the image files and such from the "original" cubewhiz? I recall "back in the day" that those images appeared in various places. I'm not sure whether they were "borrowed" or if they were hotlinked. If the latter, that could perhaps be part of the issue.

To really be running into an issue with connections, you would have to have a crazy amount of hits. 12 gigs per month? That sounds like a lot for what you have on your site. There has to be something going on there.
 
I suppose it's possible sites are just linking to them rather than uploading them to their own spaces. If any sites are hotlinking, though, those sites are going to be pretty confusing. I renumbered all of my OLLs to match the Speedsolving Wiki and I've rotated a number of images to match the angle I use, so those sites will have OLL pages in which none of the algs match the case. LOL.

I think maybe the videos might be part of the problem. There are no visible links to them anymore, but they were taking up a ton of space (>1MB each) and there were a ton of them (57 OLL, fast and slow for each, 21 PLL, fast and slow for each, 40 COLL, fast and slow for each, plus tons of videos of me solving). I'm going to be using Youtube for videos from now on so when I re-do the vids, I'll just be embedding videos from Youtube.

It's funny--Youtube wasn't even around when I created Cubewhiz...I think it started out right around the same time so it really wasn't popular. Here is a funny email conversation from 2005.

I like to host my videos on my own webspace because it is easier to keep track of what I have uploaded and also I don't have to depend on any outside source. Plus, I have never heard of youtube.com. Are you personally in charge of youtube.com? I would not mind uploading videos onto youtube.com, but I would keep a copy on my own webpage. I see that a YouTube logo is placed on videos when they are viewed. Is this so that if somebody downloaded the video, they know it is from YouTube? I would not be comfortable with somebody else getting credit for my own videos.

~ Bob

----- Original Message -----
From: "Jawed Karim" <[email protected]>
Sent: Thursday, 10 November, 2005 11:33
Subject: videos

why dont you just use www.youtube.com to host your videos? we do it for free, and we allow people to discuss/share your videos.

Anyway, I removed all of the videos for now to see if bandwidth goes down. Most of them are out of date anyway.
 
Do you really have neither the access_log file nor some detailed analysis page? Those should tell you a lot, and every reasonable host will give you at least one of them.
 
Last edited:
Yesterday's bandwidth was about 150MB instead of the usual 400MB and the lowest bandwidth over the last 30 days by far. I think the videos were definitely the problem.
 
Hello everybody.

I was just having some trouble with DIV's and I was wondering if somebody could give me an example.

Thanks,
Eric

I find tutvid.com to be veeeery useful in web design. You usually don't actually need dreamweaver, though it does make doing things easier. As for your specific question, I believe [URL="http://tutvid.com/create-a-full-css-webpage-dreamweaver-tutorial/]THIS VIDEO[/URL] to be quite helpful.
 
I am trying to implement a simple cube timer in java. I found this code here, http://stackoverflow.com/questions/8255738/is-there-a-stopwatch-in-java which works well for timing the execution time of a block of code. How can I adjust this so that the timer starts when the spacebar is hit, and waits for the spacebar to be hit again? Thanks in advance for any help, I'm assuming lots of us know java.
 
I am trying to implement a simple cube timer in java. I found this code here, http://stackoverflow.com/questions/8255738/is-there-a-stopwatch-in-java which works well for timing the execution time of a block of code. How can I adjust this so that the timer starts when the spacebar is hit, and waits for the spacebar to be hit again? Thanks in advance for any help, I'm assuming lots of us know java.
You should use a variable to store the time when the spacebar is first hit (System.CurrentTimeMilliSeconds or something like that, can't remember), then when it's hit again, set another variable and compare it to the first one to get the time elapsed.
 
Back
Top