« first day (3 days earlier)      last day (4016 days later) » 

12:14 AM
0
Q: My login with AJAX and PHP

hlapointeIn your opinion, do I need to do all these validations. I thought to do well and stay safe but I seriously raises the question if it isn't slower. jQuery code $(document).ready(function () { // jQuery validate plugin $('#login > form').validate({ rules: { ...

0
Q: How to better structure my Javascript code?

cuserjuicerThe way I currently write my Javascript code is the following: $(document).ready(function(){ // store vars $var1 = $('.element1'); $var2 = $('.element2'); function doThis(){ } function doThat(){ } function doSomethingElse(){ } doThis(); doThat();...

 
 
3 hours later…
2:47 AM
0
Q: I need someone to check this out to improve it

Saeb MsarwaTakes a name, 2 images and a birthday for an artist, uploads images and insert info into MySQL, I seem to be missing something and I'm looking to see if i'm following best practice. <?php require_once '../config.php'; require 'includes/functions.php'; ?> <!DOCTYPE html> <html lang="en"> <head>

 
 
4 hours later…
6:39 AM
0
Q: Optimise this mysql query

AnonymousThis query is serving me a home page for users where a user can see all posts by him/her and his/her friends. This is an excellent query without any errors but i only wish to make it shorter if possible! select U.fname,U.lname,P.postid,P.status, P.date,U.usernick,P.visible from posts as P natura...

 
 
2 hours later…
8:23 AM
Quite a nice way to review new questions.
 
9:12 AM
1
Q: Applying DocumentListener on multiple JTextField

Maroun MarounSay I have 5 JTextField: jTextField1, jTextField2... Now I want them to behave the same on DocumentListener, so I decided to make only one DocumentListener and set it to the 5 components. Meanwhile I'm doing this: jTextField1.getDocument().putProperty("owner", jTextField1); jTextField2.getDoc...

 
 
4 hours later…
1:05 PM
0
Q: Refactor code for API wrapper

Shulhi SapliI am looking for ways to improve my API wrapper for Pocket. So far, my code is quite compact and nice (I think), but I feel like there must be a better way to do this. This is the part where I think a lot of code redundancy due to different parameters that need to be serialized to Json and later...

 
 
2 hours later…
2:59 PM
1
Q: Javascript modules loading with eval()

David FariñaRecently i asked to use eval() for a module function. Now i ended up doing a very weird function which does what i want. I like the idea i made it but im not so sure if this is state of the art, or more, good to build an application on. index.html: <script src="module.js"></script> <script> r...

 
3:38 PM
1
Q: I made a PHP contact form that goes to multiple addresses based on drop down selection, how do I determine if my code is safe?

KateI followed a tutorial to create a PHP contact form that sends to multiple emails depending on drop down field selection. I have included the PHP below. Is it protected from spam/other dangers? Or is it basically wide open for bots and the like to gain access? I'm a beginner to PHP, and don't real...

 
4:17 PM
0
Q: Is this an acceptable method name?

MaximusGetCollectionWhereKeyStartsWith(string key) The intent of the method is to retrieve a sub-collecteion from a name value collection where the key starts with the passes key argument.

0
Q: ASP.Net caching helper

Steve BI'm willing to simplify the use of the ASP.Net cache. I wrote this helper class : public static class CacheHelper { public static T GetCached<T>(string key, Func<T> initializer, DateTime absoluteExpiration) { return GetCached(key, initializer, Cache.NoSlidingExpiration, absoluteE...

0
Q: TicTacToe in Java

LewisI created this game in Java: import java.util.Scanner; public class TicTacToe { public static Scanner input = new Scanner(System.in); public static String getName(int noPlayer) { System.out.print("Enter name of Player " + noPlayer + ": "); return input.next(); } p...

 
4:57 PM
0
Q: HashSet add and search functions

Moldovan RazvanThis is my first time implementing a hash set and I need your help. I know I didn't implemenet the operator= and the copy constructor(that's because I don't know how to), and the remove function. I only have the add function and the search function and I wanted to see if they work. This is what I...

 
 
2 hours later…
6:51 PM
0
Q: Overriding __setattr__ at runtime

A. RodasI am trying to override the __setattr__ method of a Python class, since I want to call another function each time a object instance changes its value. However, I don't want this behaviour in the __init__ method, because during this initialization I set some fields which are going to be used later...

0
Q: CodeReview:Miller Rabin Primality Test algorithm implementation in C and python gives different output for the same input

SaurabhI have written 2 code one in C and other in python implementing Miller Rabin Primality Test which are essentially the same(according to me and I may be wrong). But they give different output when I run it on the same input. The code finds the largest prime less than the input. C Code test case 1 ...

 
 
3 hours later…
9:28 PM
0
Q: My take at OOP module/prototyping JavaScript

ViktorThe last month I've been reading up on how to take my JavaScript code to the next level. I am a Java programmer at heart, so it feels nice when everything is encapsulated in classes/objects, and these are ready to be instantiated or inhertid or whatever. I wrote a simple test project with the pu...

0
Q: Please tell me if it is a good controller or not. Would really appreciate

user2136883<?php session_start(); include_once("model/Model.php"); class Controller { public $model; public function __construct() { $this->model = new Model(); } public function invoke() { if (isset($_GET['page']) && $_GET['page'] == "registration") {...

 
 
1 hour later…
10:44 PM
0
Q: Project Euler 407: Is there any more optimal way to solve this idempotent equation (modulo n ring)?

Ilia SucholutskyThis is one of the problems on Project Euler: If we calculate a^2 mod 6 for 0 <= a <= 5 we get: 0, 1, 4, 3, 4, 1. The largest value of "a" such that a^2 mod 6 = a is 4. Let's call M(n) the largest value of a < n such that a^2 mod n = a. So M(6) = 4. Find M(n) for 1 <=n <=10^7. ...

 

« first day (3 days earlier)      last day (4016 days later) »