• 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

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.

Just an FYI, in your original post asking for help, you put 12gb daily usage:
In addition, the site sees approximately 12 GB of bandwidth usage per day.

In regards to the advice qqwref gave you, make sure you don't deny all access to the crawlers, you still want your site indexed by Google :)

You can fix hotlinking issues by setting up some rules in a .htaccess file.

Since your webhost said (in a nutshell) that you have too many requests at a given time, sounds like their web server config might need to be optimized (such as cutting down the keepalive settings on requests).

Ultimately though, I think you could clearly benefit from setting yourself up with a CDN. You have the CDN host all your static content (images, videos, etc) and then people request the html page, not the html page + however many images you have on it (since the request for each image then gets pawned off to the CDN). I realize you have your videos on youtube now, but that was just an example. Another benefit to using a CDN is that the users will see a decrease in loading times. So think about this: The page where you have 57 OLL images, that's 58 requests at minimum (one for the html page, one for each image). You can cut that to 1 request (just the page) because the images then get pulled from the CDN.

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.

MIPiCubed: Also make sure that you start the timer on keyUp event (such as spacebar being let go instead of pressed) and stop the timer on keyDown event (spacebar being pressed).
 
Last edited by a moderator:
Just an FYI, in your original post asking for help, you put 12gb daily usage:


In regards to the advice qqwref gave you, make sure you don't deny all access to the crawlers, you still want your site indexed by Google :)

You can fix hotlinking issues by setting up some rules in a .htaccess file.

Since your webhost said (in a nutshell) that you have too many requests at a given time, sounds like their web server config might need to be optimized (such as cutting down the keepalive settings on requests).

Ultimately though, I think you could clearly benefit from setting yourself up with a CDN. You have the CDN host all your static content (images, videos, etc) and then people request the html page, not the html page + however many images you have on it (since the request for each image then gets pawned off to the CDN). I realize you have your videos on youtube now, but that was just an example. Another benefit to using a CDN is that the users will see a decrease in loading times. So think about this: The page where you have 57 OLL images, that's 58 requests at minimum (one for the html page, one for each image). You can cut that to 1 request (just the page) because the images then get pulled from the CDN.

Whoops! I meant 12GB per month! :) Big typo.

What exactly is a CDN? Is it just some other site that I store these files and I just change the image URL to the location on at the CDN? Do you have any to recommend?
 
Running a jar in cmd, have this;

Code:
@echo off
java -jar filename.jar

Trying to automatically execute keystrokes after this segment (inside the batch), but having trouble because it's still running the jar. Any ideas?
 
Running a jar in cmd, have this;

Code:
@echo off
java -jar filename.jar

Trying to automatically execute keystrokes after this segment (inside the batch), but having trouble because it's still running the jar. Any ideas?

Is it that you need to wait for the .jar to finish before sending the keystrokes, or do you need the keystrokes to send while the .jar is running?

If you just need to delay the keystrokes, ping localhost long enough for the file to finish:

Code:
ping 127.0.0.7 -n 5

Just replace the "5" with the number of requests... experiment to see how many you need.
 
Is it that you need to wait for the .jar to finish before sending the keystrokes, or do you need the keystrokes to send while the .jar is running?

If you just need to delay the keystrokes, ping localhost long enough for the file to finish:

Code:
ping 127.0.0.7 -n 5

Just replace the "5" with the number of requests... experiment to see how many you need.

The problem is that I'm needing to send the keystrokes while the jar is running. It actually won't terminate unless I enter specific keystrokes. Like I could manually type what I need out everytime I run this batch, but that would be quite annoying and tedious.
 
Last edited:
The problem is that I'm needing to send the keystrokes while the jar is running. It actually won't terminate unless I enter specific keystrokes. Like I could manually type what I need out everytime I run this batch, but that would be quite annoying and tedious.

Is the .jar your own creation? You aren't going to have any luck using a batch file to input keystrokes into the file. If you are able to edit the .jar code, you could set it up to allow a switch dictating what keystrokes to input. I'm not sure what you are trying to do, but at this point it starts to be more trouble than it is worth. It may be time to explore something a little more elaborate than .bat.
 
=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:A 5,1),LARGE(A1:A5,2),LARGE(A1:A5,3)}),STDEV({LARGE( A1:A5,2),LARGE(A1:A5,3),LARGE(A1:A5,4)})),2)))

How can you modify this to look through a string of data -- say 100 solves entered into a spreadsheet in the same row -- to identify your best Ao5?
 
Another question:

Python (Bear with me, I'm still trying to wrap my head around variable vs. name and list vs. array)

Code:
list1 = ['a', 'b', 'c']
list2 = ['1', '2', '3']
list3 = ['cheese', 'beer', 'cheetah']

list_chosen = random.randint(1,3)
item_chosen = random.randint(0,2)
item = list{list_chosen}[item_chosen]

I hope this sort of makes sense... its hard to tell since I don't really know what I'm doing at this point. This is also just a learning exercise, so it isn't really meant to do anything yet. What is contained in the curly braces {} is what I am trying to figure out, they are just there to highlight my problem. My real question is, how do I use one name as part of a reference to another name?
 
I don't know whether such variable interpolation is possible in Python, but I'd find it rather ugly. That example with 15 variables in the wikipedia article makes me want to throw stuff at the author, not just because it's bad but also because he smugly writes "done smartly", "variables are appropriately used" and "the best way".

Better use a two-dimensional list, so you have one variable holding a list of lists.
 
Last edited:
Don't do Java. Do Python.

I disagree. Java gives you a solid footing to move on to things like Objective C or C++, and allows you to do application development that works on any plant form. Python may be easier to learn initially, but Java gives you a far better knowledge of working with static variables and formatting for the other languages mentioned.

Once you have a solid handle on Java, learning something like c++ is nearly the same except for some small details.
 
Last edited:
Java gives you a solid footing to move on to things like Objective C or C++

And Python doesn't?
Also, I'm not sure that's desirable.

and allows you to do application development that works on any plant form.

And Python doesn't?
Also, "plant form"? :D

Python may be easier to learn initially

It's not about easier initial learning, it's that Python is sooooo much nicer. I've been using both Java and Python (and some other languages) for years and consider myself a good coder and I absolutely despise Java and love Python now.

Out of curiosity: How much experience do you have with Java and how much with Python?

Java gives you a far better knowledge of working with static variables and formatting for the other languages mentioned.

Do you really mean static variables, not static typing?
If you mean static typing... that's a major reason I despise Java.
What do you mean with formatting?

Once you have a solid handle on Java, learning something like c++ is nearly the same except for some small details.

Yeah it's probably easier to go from one sucky language to another (note: I don't despise C++ and occasionally use it when I need something very fast). But I disagree anyway. The *syntax* is more similar between those languages, but coding is not about syntax. Concepts are more important, and Java drags you down with annoying formalities and restrictions and just makes everything a hassle, obstructing the actual coding. And it's missing essential nice things (last I checked). I believe Python makes you a better coder.
 
Last edited:
And Python doesn't?
Also, I'm not sure that's desirable.



And Python doesn't?
Also, "plant form"? :D



It's not about easier initial learning, it's that Python is sooooo much nicer. I've been using both Java and Python (and some other languages) for years and consider myself a good coder and I absolutely despise Java and love Python now.

Out of curiosity: How much experience do you have with Java and how much with Python?



Do you really mean static variables, not static typing?
If you mean static typing... that's a major reason I despise Java.
What do you mean with formatting?



Yeah it's probably easier to go from one sucky language to another (note: I don't despise C++ and occasionally use it when I need something fast). But I disagree anyway. The *syntax* is more similar between those languages, but coding is not about syntax. Concepts are more important, and Java drags you down with annoying details and just makes everything a hassle. I believe Python makes you a better coder.

1. It's definitely true. Python formatting is unlike any other language. This is advantageous for learning purposes, but makes transitioning to other languages (C, Java, etc) more difficult. In an ideal world we just learn all of them, but that isn't always possible.

2. I clearly meant plant form :P
In all seriousness, Java is found everywhere. Literally. It's the main language for android development and is simply incredibly versatile.
Python is definitely versatile, but Java wins by a mile here. It's so common that just about any OS will run the Java virtual machine, and the vast majority already have it installed. With Python, you have to run your code in a compiler in order for the OS to understand it.

3. I agree on this, Python is much nicer looking code. That being said, Java isn't really bad Imo. I wouldn't consider myself really good at either of them, but I definitely understand the differences of each. I'd say I know enough about both to be dangerous.

4. Static typing :P 'twas quite tired when writing this. While Dynamic typing is easier to pick up and may be more convenient at first, in my experience it's much easier to find your errors with static. I really should have said syntax, but once again I was half dead while typing this. Essentially, like I said, lots of languages are similar to Java with key differences. An experienced Java programmer could in theory pick up the new language much faster.

5. It's not because they both suck. If Java were a bad language I doubt it would be the most widely used. And yes, syntax definitely matters. If you don't understand the syntax you can't write the code in the first place. Annoying details in Java are made easy with a good IDE like eclipse, or if you're just learning, bluej.

What about Python makes you a better coder? In my opinion, some of those annoying things aren't so bad once you're used to them.


I found this post interesting, let me know what you think of it.
http://javarevisited.blogspot.com/2013/04/10-reasons-to-learn-java-programming.html?m=1
 
Last edited:
I am going to start learning how to code. I have chose to begin with Java. Any advice?(Stuff you wish you knew when you started etc)

I would recommend C because it is like C++ and C++ is kinda like Java. In this way you can learn 3 languages without it being too hard. C helps to develop logic. I know you won't believe me but I have used HTML,CSS,C,C++,Python,Ruby,Javascript and I am currently revising on C
 
Last edited:
I really never should get into stuff like this, but ok, one more round.

1. It's definitely true. Python formatting is unlike any other language. This is advantageous for learning purposes, but makes transitioning to other languages (C, Java, etc) more difficult. In an ideal world we just learn all of them, but that isn't always possible.

It's like you *should* be formatting in any other language *anyway*. Encourages good style and makes it easier to read other people's code. It's not just advantageous for learning, it's advantageous, period. And again, that's a syntax issue. Do you think adding curly braces or being sloppy or inconsistent is hard to learn or important? Again, actual coding concepts are more important.

2. I clearly meant plant form :P
In all seriousness, Java is found everywhere. Literally. It's the main language for android development and is simply incredibly versatile.
Python is definitely versatile, but Java wins by a mile here. It's so common that just about any OS will run the Java virtual machine, and the vast majority already have it installed.

Same with Python.

With Python, you have to run your code in a compiler in order for the OS to understand it.

This alone makes me doubt you actually ever tried Python. Python can be interpreted, compiled to bytecode for a virtual machine (like Java), compiled to other langues (including Java!), or compiled for the OS. But a beginner typically starts with interpretation, hence my doubt that you actually ever tried it, or else you'd know.

3. I agree on this, Python is much nicer looking code. That being said, Java isn't really bad Imo.

Depends on what you do. For me, Java goes from "acceptable" to "makes me want to scream".

I'd say I know enough about both to be dangerous.

"dangerous"? Rule of thumb: wannabe-speak won't make me take you *more* seriously.

4. [...] in my experience it's much easier to find your errors with static.

Not my experience, but ok.

An experienced Java programmer could in theory pick up the new language much faster.

I disagree.

5. [...] If Java were a bad language I doubt it would be the most widely used.

Eat ****, millions of flies can't be wrong. Also, [citation needed].

And yes, syntax definitely matters. If you don't understand the syntax you can't write the code in the first place.

Yes, of course, and I didn't say you don't need to understand it. What I meant was that yes, Java and let's say C++ look similar, but learning a new syntax isn't hard or important. Learning concepts is harder and more important.

Annoying details in Java are made easy with a good IDE like eclipse, or if you're just learning, bluej.

Not sure what you mean with "made easy", but doesn't sound like they're hidden from my screen so they don't annoy the hell out of me. Haven't tried bluej and haven't used eclipse much/lately, though, so I don't know.

What about Python makes you a better coder?

Python lets you write elegant code. Plus elegance inspires elegance (I think/hope). And it's not just the syntax but the way it lets you do things. A major factor is that lists/sets/dictionaries/tuples are really basic data types in Python *and* that Python lets you work with them very naturally. A while back I wrote something in Java with nested data structures and it was utterly painful and ugly. I then did it in Python and it was beautiful. That day I started hating Java.

There's much more beauty than that list/etc handling, though. I have since learned much more Python and it still occasionally surprised me with more elegance that I didn't know and then think "Of course! That is so much better (than what I learned from other languages)! It's how it *should* be!".


Decent 10 reasons, too bad they apply to Python as well, if not better. So it's very surprising that he doesn't even mention Python.

Well, he does mention it here:
http://javarevisited.blogspot.de/20...hich-programming-laungage-to-learn-first.html
But I again get the feeling that he doesn't really know Python, partly because he's endorsing that awful moronic infographic that literally made me scream out loud in a mix of agony, disgust and disbelief.
 
Last edited:
Back
Top