@SimonAndréForsberg I know enough to get me laughed at. so be prepared. it was nothing special, and I think I might have made up some syntax too while I was at it
Task
Create a matrix of checkboxes. The user must be able to select only 1 checkbox in a row or unselect all of them.
Solution
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<script type="text/javascript">
function switch_che...
So i made following and have few questions:
Do i have some (big) mistakes in this approach? (bad practices, 'this code is trash'...)
1.1 If i do can you suggest what to fix.
Are appended element created in good way?
Code in success function seems to be a little long, anyway to refactoring?
I w...
$user_search = esc_attr($_POST['city']);
global $wpdb;
global $user_search;
$address_table = $wpdb->prefix . "address_table";
$query = $wpdb->get_col('SELECT city FROM ' . $address_table . 'WHERE city = ' . $user_search );
print_r($query);
I have this code set up to pul...
(hey, I believe I'm the first on CR to get the Ghost of Winterbash past ... and, since I have not got Chuck Yaeger yet (and don't know how), then I figure you guys can wonder about my pretty mask.
Considering code sample below, which approach of service method design would you prefer and why? The one used in SaveOrder1 or the one in SaveOrder2 method?
UPDATE: To be clear, I'm not talking about web service here, but application-type-agnostic service class from my business logic layer. I ma...
Even flagged comments would show up in the history. Anyway, I do wish it was flagged for migration instead of just having it closed. I can't quite tell if it was "moved" so SO.
Okay. Also, @retailcoder, this didn't quite help move things along:
Well this is a fairly good answer, all answers here are trying to tell you there's more to solve than just what you think is your problem. Take it or leave it, but stop bitching at everyone that's trying to help you. Again, this question is hardly a good fit for this site, so be happy+thankful to be answered. — retailcoderyesterday
Actually, I'll just delete them and clean up everything else. I'll keep it open as well since, after an edit, it can work as a proper best-practice question.
And no need to worry too much, @retailcoder. It happens (if you recall, I sort of did the same thing with that invalidating-answer user). It's good that you calmed down in the next comment, though.
@retailcoder Don't worry, it happens to all of us. I almost lost it to that one guy that answered my question and then downvoted the other great answers he "borrowed" some ideas from.
Yeah, I try to be as much as possible. But some users just come here with the wrong expectations, and don't even bother reading through the help/on-topic page...
You earned 'Florence Nightingale' on Code Review! :)
I have some questions to ask how to organize python project better.
Where to put your unit tests scripts?
Where to put your init script ?
How to show your module version ?
Here is my project structure (I built it by the module https://pypi.python.org/pypi/modern-package-template)
.
├── HACKI...
True. Even then, it could be hard to interpret it. That's also why the established users should help uphold the rules, thereby limiting moderator intervention. We need that if we're going to graduate.
@syb0rg yeah, oddly the day I hit the vote cap 3 of my [down]votes got lost through deletion I guess, so my vote count said 37. It's the only explanation I can come up with for not yet having the vote-cap hat.
I have some questions to ask on how to better organize a Python project:
Where to put your unit tests scripts?
Where to put your init script?
How to show your module version?
Here is my project structure (I built it by this module):
.
├── HACKING.txt
├── MANIFEST.in
├── NEWS.txt
├── README.r...
This is my first real program in python (and my first real program) and I would like to have input by some more advanced programmers on the code, on the writing style and on the amount of comments (is it clear enough?).
new_name(scheme) does seems a bit bloated to me, but I can't figure out how ...
I just got this hat without much activity on SO. Judging form Gilles' idea, I checked my meta activity and found that someone just upvoted one of my comments, and now I have:
So this hat is like the meta equivalent of Peanut Gallery. Given the unicorn look of the hat, and most of the people I ...
Lack of voting has already been identified as an issue that prevents the site from graduating. I'm shamelessly stealing this post from Meta Biblical Hermeneutics, hoping it will inspire all of us to be a bit more active with our votes. Enjoy! And vote!
I cannot state this strongly enough. Voti...
Me, too. I'm still not sure if it has helped any, though. But, judging on the votes given to many of you, things seem to be improving. Plus, svick is only a few upvotes away from 10K.
But yes, I can see how it has improved recently. Many of you have recently started posting a lot of answers, and they've already received a lot of votes. You all are above 2K, too. That's a great start. It took me a while to get that far, but that's just from my skills.
I think in the past couple months, we have redefined CR's voting scheme, and how hard it is to earn rep here. Let's just keep this direction and we're headed the right way.
Yet, I still have a feeling the "this site may not be a good fit for the Q&A format" thing that determines graduation may hit us. Well, it wasn't told to us specifically, but it still worries me.
On SO you have to answer fast, or you're out of luck. You need to play the numbers games..... get in fast, answer a lot of questions, and get 5-up 2-down if you're lucky.
Beta Q&A site for feedback on projects you're working on, by sharing your code with fellow programmers and getting extensive feedback/review of best practices, design pattern usage, application UI, security, etc.
If you answer more than 10 minutes after an SO question is asked, you will only score the up-vote of the asker, and, if you're lucky, an accept. Once the question has more than 1 answer on SO, no-one else looks at the answers to upvote them.
The only thing I can think of is changing the size of the terminal window.
To do this: right-click on the status bar > Properties > Layout > Window Size > increase width.
This may not be what you want, but it may help a bit. Of course, this is also limited by the size of your monitor.
True. I think we're different from SO in terms of "culture." We don't like shotgunning answers, but they do. They don't like slowly working on an answer, but we do.
^^ Ahem. You skipped the part about weeks later you make a puny edit, brings your post back up onto the front page, and you are getting drive-by-upvotes
Build the code, copy to the server stop the three processes, replace the jars, start the servers, record the logs...... That's all I have to do, but I have not managed that step once the first-time in the past couple of hours.
@Jamal it just hit me - your profile is showing 16 hats, but 2 of them weren't earned on CR, so the CR.WB2013 Leaderboard is showing 14 hats for you, which means I can stop waiting for the cache to update and be assured to sleep as #2 with 16 hats :)
I have about 15 queries I am using to get some year end numbers for a report.
I am trying to figure out if I can combine them all.
I have a query that gives me a total of all paid invoices:
$sql = "SELECT SUM( total ) AS total
FROM `tblinvoices`
WHERE `datepaid`
BETWEEN '$start...
This week's weekend challenge #3 seemed like a great opportunity to learn Ruby! Unfortunately, my workload and looming vacation did not cooperate. :( The puzzle will make forced moves automatically, but I was hoping to implement rules such as Naked Pairs before resorting to brute force.
But ther...
I've inherited a class in a project which is purposed to execute a function that exists in POST data from a specified class. I've tried to clean this up as much as possible as well as secure it against SQL injection but I'm wondering if I could have done a better job or written this better. Any a...
I wrote these classes and I would like to know if this is a correct way. I created a new Project with Blank activity and "Scrollable Tabs + Swipe" as Navigation type.
My main activity:
public class MyMainActvity extends FragmentActivity {
private static String url = "http://www.myurl.it";
sta...
I have a team that works on multiple technologies. I want to know how can I automate the process of code review for .Net, .Net MVC, Python, PHP, Drupal and HTML5/CSS with JavaScript.
I have read about and have used some tools like StyleCop/FxCop for .Net and PHP Code Sniffer and likes for PHP an...
Greetings from Austria!
I want to make a simple Universal-File-Duplicator. (Example: make 125 duplicates of one file)
my problems:
I tested the program with .XPS files and it worked BUT it corrupted the file. The XPS-Viewer couldn't read it anymore!
When I duplicate a simple .TXT file it is a...
The task is fairly simple. I want to create a collection of intervals and implement an Add method which would insert new intervals to the collection and merge overlapping ones. I would also like this method to somehow tell me which parts of the added interval were not in the collection before add...
I'm building an API wrapper for a bookkeeping SOAP API.
I have some questions regarding bast practice for structure of the wrapper and for error handling.
For now i've structured it like this:
EconClient.php
class EconClient {
public function __construct()
{
$wsdlUrl = 'htt...
Some time ago I created a markdown parser in clojure and I would like to get some feedback, since I'm a clojure noob in the first place (is the code understandable?/is it idiomatic?/can some things be improved?).
So I'm looking for feedback on best practices and design pattern usage (performanc...
What should the code do: Process client HTML requests, querry database and return the answer in XML.Working with a high load.
I need to know how can it be optimized.
Is something terribly wrong with this code?
In data: Html-session, mac-address (in form of GET argument).
Out data: Xml (session_...
@syb0rg As @Jamal didn't answer your question exactly (as far as I can tell), seems like I have to. We avoid pasting in the code for the user since code on CR is CC-wiki. We technically don't have the licensing right to take their code, where-ever it is posted, and put it here. I believe there's a CR meta-question about this somewhere.
help!
so I've bought a wordpress theme from someone and the creater is not willing to help in fixing his coding!
im trying to get my website to show the stats of the minecraft server for me.
the code for the server.class.php is as follows;
<?php
/**
*
* @Třída serveru
*/
class Server...
I'm assuming this code hasn't been reviewed yet because it's... beautiful - and I'm still searching for a better word. I mean, wow that's clever, I want that!!
The only thing I can see here, is in the View method:
protected override ViewResult View(string viewName, string masterName, object mo...
you might want to write it like this
$total_query_raw = "SELECT SUM( total ) AS total
FROM `tblinvoices`
WHERE `datepaid`
BETWEEN '$start_date 00:00:00' AND '$end_date 23:59:59'";
$total_query = mysqli_query($link...
Do you guys have any hints of how we can improve our code ?
Heres a link to the source code :
https://github.com/z3poxx/XNA_Projekt_v2/tree/master/WindowsSpel/XNA_ProjektArbete
Its a space shoot em up developed using xna 4.0 framework.
I have a method which returns Array. Array can contain values or can be empty. Here is the code:
function getCustomerIds() {
//this declaration is at the top to inform about returning value of the method; I don't declare variables at the top
var customerIds = [];
var linkedContact = ...
This is my first real program in python (and my first real program) and I would like to have input by some more advanced programmers on the code, on the writing style and on the amount of comments (is it clear enough?).
new_name(scheme) does seems a bit bloated to me, but I can't figure out how ...
I'm creating an open source stack exchange clone and the following is my schema. What should I add indexes on for it to be optimal?
Note: Rails auto adds an id column so the schema below doesn't list that explicitly for each table.
create_table "comments", force: true do |t|
t.integer "p...
I read this post on codeforces(essentially we heap sort 10 000 000 values). I am really surprised why does ruby perform that badly for this task. I will copy paste the code that Mike Mirzayanov used for the ruby version of the task but you can also find it where he posted it:
N = 10000000.freeze...
Put yourself in the reviewers' shoes, would you spend 3-4 hours (or more!) to review an entire project just to get a couple upvotes and maybe a green tick? Break it down in multiple, digestible posts and I'm sure you'll get it reviewed - we love reviewing code, and you're at the best possible place to get your code reviewed. You can post a bunch of related classes and post a question with a title like "Pursuing the player, could this AI code get any cleaner?" - for example. — retailcoder4 mins ago
Hi! Code that compiles isn't necessarily working code: your question seems to be asking for assistance in finding a resolution to known issues, which is outside the scope of this site. — retailcoder1 min ago
Let's go though a few things here...
you do not have any primary keys on your database. Primary keys are part of the database's referential integrity, and ensure that you and your programs do the 'right thing'. Additionally, primary keys are implemented as an index, so they will ensure that pri...
@rolfl Technically the question wasn't broken, just aimed at rails developers. I also had no idea that "rails auto adds the primary keys on each table". But once we know that, your answer isn't providing much anymore.
@SimonAndréForsberg - you may be right ..... but, something in me hates deleting things... and now the question is actually good so it was worth something.
Do you guys have any hints of how we can improve our code ?
Heres a link to the source code :
https://github.com/z3poxx/XNA_Projekt_v2/tree/master/WindowsSpel/XNA_ProjektArbete
Its a space shoot em up developed using xna 4.0 framework.
First things is first.
When you create a database, you only do it once, or you script it out and execute in the SQL database itself. I wouldn't use ruby to create the SQL for you. it seems illogical to me that you would create the tables on the database in a language other than SQL.
That bein...
@rolfl how did you get ghost of winterbash past? I participated last year
We've grown considerably as a network since the days of the original trilogy, when the prospect of growing into a network of over 100 thriving Q&A sites was a distant glimmer in a cloudy night sky. Today, Stack Overflow continues to graciously host discussions about the entire network on its extr...
@rolfl so should I have your back on that answer to the Ruby SQL? or should I send you down the river?
we need to get @ruds in here talking, says he is a software engineer from google! that is almost as cool as @rolfl cakes working on.... (dang it I forgot it's name)... oh yeah Watson
Unless necessary you should consider making your Interval immutable by making the sets private. It's easier to deal with such "value containers" if they're immutable (see Point, DateTime, etc.).
Also at the moment you can break your collection by doing the following (also it's non obvious what h...
@retailcoder Yeah I noticed that a couple of days ago. It's about time I guess
@Malachi Yeah I don't like PHP and JavaScript much... I more prefer the good old compiler having it's say first. That reduces the number of bugs quite a lot.
@SimonAndréForsberg well it doesn't help that browsers interpret things differently from one browser to the next. PHP is better because it is run at the server level and not the client level, but it's just weird letting you create variables on the fly like that. (kind of Dangerous)
I read this post on codeforces(essentially we heap sort 10 000 000 values). I am really surprised why does ruby perform that badly for this task. I will copy paste the code that Mike Mirzayanov used for the ruby version of the task but you can also find it where he posted it:
N = 10000000.freeze...
one thing that you can do to shorten up this code is instead of this:
var linkedContact = getLinkedContacts(this);
if (linkedContact === null) {
return [];
}
var linkedResource = getLinkedResources(linkedContact);
if (linkedResource === null) {
return [];
...
int convChoice = 0;
int compChoice;
int compWin = 0, playerWin = 0, tie = 0, rounds = 0;
String loop = "yes";
Scanner scan = new Scanner (System.in);
System.out.println ("Hello, let's play a game of Rock, Paper, Scissors!");
while (loop.equals("yes"))
{
compChoice= genera...
@Malachi It's something mostly used in functional, statically typed languages, and is a refinement of the null pointer concept. We have a collection type called "Option" or "Maybe" that contains either zero or one element. This is equivalent to null or a non-null pointer.
A number of questions have come up recently where the code is not the asker's own code, prompting a 'close' response. It would be convenient if there was an 'off-topic' close option that included:
off-topic because the code you want reviewed is not your code. See the help (item 2) for on-topi...
@rolfl how about a feature request for an actual button (floating toolbar?) that shows up when you type a comment on a question, with a button that inserts auto-text that links to help center?
I guess the off-topic reason would be much less effort ..
The best is when you're at the user's desk and use a walkie-talkie to inform the help desk "Code-18, under control" ..and the user has no clue, thinks it's a help desk code (which it kinda is)
Walkie-talkie .... huh.... when I did help desk it was at university, we had eisa cards, token ring, and coax.... those were the days. People I studied with later when on to help invent things like 'cell phones'.
I made a simple Universal-File-Duplicator (Example: make 125 duplicates of one file).
Very useful if you want to fill a whole USB flash drive or an old harddisk with an important file (Example: Bitcoin wallet.dat or privatekey) and you don't want to hit Ctrl+V all the time...
Suggestions? Improv...
@retailcoder The only cool thing I did on helpdesk was to create a user account for some poor guy called 'Hugh Jorgan' ..... that had me laughing for weeks...
@Donald.McLean - I guess you still work in the fields where communication bandwidth is so restricted that the coding/decoding schemes are tightly conctrolled..... Nowdays the bandwidth is typically high enough that gzipping your data may slow down your transmission
still no votes? only my vote on the question even. I guess it has only been posted 2 hours ago, but still this is JavaScript we are talking about here.
I have a method which returns Array. Array can contain values or can be empty. Here is the code:
function getCustomerIds() {
//this declaration is at the top to inform about returning value of the method; I don't declare variables at the top
var customerIds = [];
var linkedContact = ...
I have asked this question first on Stack Overflow but then someone said it's off-topic and I should ask it on Code Review. Now on Code Review the question seems is again off-topic. Where should I ask it after all?
you don't even use linkedContact in that function, I assume that the getLinkedResource needs a linked contact, if that is the case then you really only need to check for the linked Resource, maybe something like this
var linkedResource = getLinkedResources(getLinkedContacts(this));
and then ...