instruction
stringlengths
71
95.1k
I have implemented an STL-like graph class. Could someone review it and tell me things that I could add to it? File graph.hpp #include <vector> #include <list> using std::vector; using std::list; #ifndef GRAPH_IMPL #define GRAPH_IMPL namespace graph { struct node { int v,w; }; template<class T, bool dig...
I wrote a predicate used in a remove_if call that deletes shared_ptr's of type StemmedSentence from an vector of sentences. The predicate: class EraseSentenceIf { ArrayStemmedSnippet * m_ass; public: EraseSentenceIf(ArrayStemmedSnippet *ass) : m_ass(ass) { } bool operator()(const std::shared_ptr<...
If I have an array: var names = ['John', 'Jim', 'Joe']; and I want to create a new array from names which afterwards will look like: newNames = ['John John', 'Jim Jim', 'Joe Joe'] What I came up with is the following: var newNames = []; var arr = null; var loop = 0; $.each(names, function (i, item) { arr = []; l...
I have pieced together some code that works for my project. However, it is pretty long, but self-similar. I am a jQuery beginner and I tried to shorten the code by using variables, but it didn't work so far. I guess I should use some for()-statement. Could you help me to simplify this code? //apply the class "active" t...
I am trying to learn C and have written a very basic socket library. I would be interested in any general design and coding comments. Note that at this stage I am not bothered about implementing the most efficient networking model. I just want to get a simple synchronous model working then I can progress from there. ...
I wrote this recently for one of my projects. Are there any error you can spot or a feature which could be implemented without eating up resources or some optimisations? Also, this isn't meant for multi-cores. /******************************************************************************* * @file mutex.c * @date ...
I actually feel bad posting "yet another singleton"... I wrote the following one many years ago and had recently found another application for it. We had many threads, each running the same function that requires the use of a boost::asio::io_service instance. It was best that all threads shared the same io_service inst...
My inclination is to make these methods static: package net.bounceme.dur.usenet.driver; import java.util.List; import java.util.logging.Logger; import javax.mail.Folder; import javax.mail.Message; import javax.persistence.*; import net.bounceme.dur.usenet.model.Article; import net.bounceme.dur.usenet.model.Newsgroup; ...
As part of a question designed to help us understand the relationship between pointers and arrays in C, I've been asked to write an inner product function that doesn't use any array subscripting. Here's what I came up with, but it looks like the kind of complicated 'clever' coding that we've traditionally been told NOT...
I needed to find away to left shift a number on a platform with buggy << and >> bitwise operators. I came up with a rudimentary solution, but it looks ugly and inefficient. What's a better way to do this? float leftShift8(int value) { return value * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2; } float rightShift8(int value) { ...
The page is assigning $gid to the url paramater gid. It then reads an XML file that looks like this: <games> <game> <name>name 1</name> <appID>1234</appID> </game> <game> <name>name 2</name> <appID>5678</appID> </game> </games> The code I am using works correctly but takes a second to load because there ar...
I have the following code: from Bio import AlignIO import itertools out=open("test.csv","a") align = AlignIO.read("HPV16_CG.aln.fas", "fasta") n=0 def SNP(line): result=[] result.append(str(n+1)) result.append(line[0]) result.append(align[y].id.rsplit("|")[3]) result.append(x) return result ...
I have a hard time adapting to jQuery and chaining. I think it's really neat at times, but how do I know when to use it and when to indent? I may suffer from some kind of OCD-ish behaviour, and this is not your concern, but I would like your input on what needs refactoring in this ol' bit of code: $(function() { $(...
I've done some programming in the past, but I'm new to MIPS, which I'm trying to learn on my own. This program lists the first five perfect numbers. It uses the Lucas-Lehmer and Miller-Rabin primality tests. Any suggestions on how I could improve will be most appreciated. .data # marks the...
In python2.7: 2 for loops are always a little inefficient, especially in python. Is there a better way to write the following filter function? It tags a line from a log file, if it is useful. Otherwise the line will be ignored. Because there are different possible interesting lines, it tries different compiled regexes ...
When you click on a span it enters the value into the input. That works fine, but as you can see the JS code is very big and there must be a better way to do this, but like I said I'm still learning. Maybe someone can give me a pointer in the right direction. I suppose I have to use a variable somewhere but can't reall...
I've setup up a nice, little parent class that I can extend easily to do Http request to servers offering some sort of data with JSON/XML/whatever output. You can see the init() function that is defined in the child class. The request URl builder is defined in the parent class, as the callback is. The desired result is...
This downloads content from YouTube either as whole playlists or single videos. I find it very useful but would like to know if it's something close to a program that others could maintain. I also wanted to show it off a bit and get some feedback as I've been learning on my own from the net and would be helpful to know...
I'm new to bash scripting and need some help improving a script I made for working with reverse-engineering Android applications. I wrote comments in the script itself to explain what I want to do. Some of the code/functions are missing/broken, but I hope that you can help me out with it. #!/bin/bash # Goal: Have a wo...
I have written this sample code to fetch a web page in C++ using libcurl. Please review it. #include <iostream> #include <iostream> #include <string> #include <exception> extern "C" { #include <curl/curl.h> #include <stdlib.h> } //Exception class for curl exception class CurlException : std::exception { public: C...
I wrote a failback for the fairly new CSS calc() rule. It works fine but I want to use it in a production environment and would appreciate feedback. Please recommend anything regarding weird/wrong code, possible optimizations, or a way to reduce code size. // CSS calc() replacement function calcfailback(){ var d = ...
I have written a small Windows application that draws India's flag in the window. I am very new to using Visual C++ and I want to understand if my code can be improved further. #include "afxwin.h" #include <math.h> class CMyApp : public CWinApp { public: virtual BOOL InitInstance (); }; class CMainWindow : publi...
I'm one of those coder/designers that has been at it since day one, but is still getting the hang of several important coding nuances (e.g. OOP for PHP, and concepts such as this). In this case, I'm migrating my toolkit from MySQL to PDO. I had considered MySQLi, but a critical mass of stackoverflow leans towards PDO, ...
Project Euler #11 asks to find the largest product of four numbers of a grid, where the four numbers occur consecutive to each other vertically, horizontally, or diagonally. Here is my solution in Python. In addition to the usual code review, I have 2 extra questions (actually confessions of my laziness): Would it be...
As a beginner, I wrote the following python script that solves warrant 1 of this document - pp 436-438. My solution, although works, seems to me as poorly designed and highly unmaintanable. I was thinking of putting talbe 4C-1 condition A/B as numpy arrays and use mapping to interpolate. I would also like to get rid of...
I'm working on a simple time sheet webapp. I have created the following query (simplified - I actually have several mapped columns of a similar type to project_id) to generate test data: INSERT INTO `entries` (`entry_id`, `user_id`, `project_id`, `date`, `comment`, `hours`) VALUES ( null, 0, (SELECT `project_id` FR...
I wrote a script to remove .vb code files when there are corresponding .cs files in a certain directory structure. But I felt like there were some extra statements that I had to put in there that didn't feel natural. Is there a better way to do this check and then action? Specifically, having to do the foreach at the...
Anyone can play Google Hurdles today. Here is my score: 1.1 second. Is there are way of improving this score and running faster than a second? http://www.google.com/doodles/hurdles-2012 import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; public class RunOlim { private volatile static...
I am writing a lightweight JSON API, and I come from a PHP background, so I have some questions/reviews about async node.js code. This is my code so far: main.js var http = require('http'); var api = require('./api.js'); api.addRoute({ 'method': 'POST', 'url': '/users', 'input': { 'fullName': { ...
I have a shell script to mount different remote systems. While it does work, the area I struggle with (not being a programmer) is the logic of the script: it feels quite stilted and there seems to be some unnecessary duplication. I would appreciate any comments as to how I could improve it - both in terms of the logic,...
This is really not a question. I was looking up this solution but couldn't find it anywhere. Thought of posting it here so it may save someone's time. Here was my issue: I had a JSON coming from server which was not nested. Lets take example of Movies: var movies = [ {"name":"Ice Age 3", "language":"English", "year":...
I have 4 text columns, a mix of Varchar and Text. I need to find rows in a table where all words searched for are present across the 4 columns. The 4 columns are: name type keywords description So if someone searches for "london wildlife museum", it would only return rows where all words were found across the 4 colu...
I am new to modular JavaScript code, and after reading an article on the Internet, I wrote a very basic calculator. This works fine, but due to some unknown reason, I feel that this code is not well written. I will appreciate it if someone could improve my code below so that it will be helpful with learning modular Jav...
I am maintaining an application and have seen something like this Permission p = new UserModel().GetPermission(userToTestPerrmission, permissionWeCheck); if(p.CanChange) //sometihing else //something else This approach looks a little "dirty" to me. The part I have problems with is this new UserModel().GetPermiss...
This is an OOP Rock, Paper, Scissors program I wrote in Python. I am just learning about using classes and I'd appreciate some advice on improving it. # rock.py # example of OOP import random class Rock: def main(self): self.Make_players() print("Best of Five - Let's play!\n") done = Fals...
For Project Euler problem 14 I wrote code that runs for longer than a minute to give the answer. After I studied about memoization, I wrote this code which runs for nearly 10 seconds on Cpython and nearly 3 seconds on PyPy. Can anyone suggest some optimization tips? import time d={} c=0 def main(): global c t=t...
I created a simple todo kind of app using JavaScript. It is working fine but the code which I wrote is not proper. Please review my code and improve it if it is needed. $(function () { var todo = new Todo('contents'); $('.addBtn').on('click', function() { var name = $(this).parent().find('input[type="t...
I'm new to coding and have written a script from scratch to do an auto-correlation function. It's too slow and I have to run it on a few thousand files over the next few days. I'm sure it's terribly written (and you can see my brain ticking in basic ways through it) and can be faster. I know that Python has an inbuilt ...
I have following code on my login page (now i use it for preventing POST variable resubmit on page refresh): <?php $cleaner = md5(uniqid(rand(), TRUE)); $_SESSION["cleaner"]=(empty($_SESSION["cleaner"])) ? $cleaner : $_SESSION["cleaner"]; if($_POST['login_button'] && !empty($_POST['cleaner']) && $_SESSION['cleaner'] ...
Currently on my ASP.NET website when I define a new user I write their data to a .txt file like this: public class User { public string UserName; public string PassWord; public string Email; public string FirstName; public string LastName; public string Twitter; public string FaceBook; public int Age; public DateTime D...
I'm sorry if I have not worded the question title to well, so let me explain. I am creating a game, actually a few and I see that most of the time when painting ect I use a JPanel, so I went and found a good method of painting (i.e it has great performance when multiple sprites etc are being painted) see here: https://...
I have an array of values of the form: configs = ["26W", "27W", "28W"...] They correspond to some of the a elements in a list: <ul id="value-list"><li><a data-value="26W">...</a></li> <li><a data-value="27W">...</a></li>...</ul> When the data in the list does correspond to an existing a, I need to set the parent li c...
Can anyone refactor this code without the for loop? <?php function lorem($paragraph_count = 1, $times = 1, $content = '') { $paragraph = array( "Lorem ipsum dolor sit amet ......... Fusce a ante.", "Praesent sit amet est. Vestibulum quis elit ......... consectetuer quis, quam.", "Suspendiss...
Yes, I'm bad at conditionals. I don't use them so much and I feel a bit lost with them. How would you (if possible) refactor or change this little piece of code? Second improved version: $MAX_FNAME_LEN = 255; $clientFilename = $this->file->getClientOriginalName(); $clientExtension = $this->file->guessExtension(); /...
As a learn-by-doing project to learn Java webapps, I'm creating a website for registering and displaying happenings using JSP/Servlets, Apache Tomcat server, JDBC and a MySQL database. I use JSP for views, Servlets for controller functionality and business logic, and I've created ONE DBManager.java class (my only DAO) ...
I'm doing exercise 11.8 from Scala for impatient, asking to write a matrix class: Provide a class Matrix - you can choose whether you want to implement 2 x 2 matrices, square matrices of any size, or m x n matrices. Supply operations + and *. The latter should also work with scalars, for example mat * 2. A single ...
Is there a better way to do this? I'm kinda ending up having a lot of if statements. if params[:custom_url] || params[:user_id] if !params[:user_id].blank? @user = User.find(params[:user_id]).first @url = @user.custom_url else @url = params[:custom_url] @user = User.where(:custom_url => ...
I calculate a highscore and find the users current rank like shown here. This is the query: SELECT * FROM (SELECT q.*, @r := @r + 1 AS rank FROM ( SELECT @r := 0 ) vars, ( SELECT p.*, MAX(punkte) AS max_points FROM olympia_punkte_alle p WHERE markt_id = 1 GROUP BY fb_id ORDER BY max_points DESC )...
I wrote a quick function to create a set of radio buttons, three per table row. I would like some feedback about how I can shorten this bit of code using algebraic functions, or different jQuery functionality. var arr = [ "earth", "mars", "jupiter", "saturn", "venus", "argus", "pluto", "janus", "canary", "orange", "but...
I was asked to implement a hash map in this phone interview (screen-share), so time was limited and this is what I came up with. I'd appreciate if someone can take a minute to critique/review it and help me improve. Here is an online version of the code. #include <list> #include <iostream> using namespace std; const i...
I saw How to wait current thread execution and execute another thread completedly? on StackOverflow, and I answered it there, but would like more eyes on the code I posted. The requirement is to pause one thread whilst a different thread is running. Could you please review and comment on this implementation? public cla...
I'm very very fresh to programming. This is one of my first experiments with Python and I'm wondering in what ways I could have made this program less clunky. Specifically, is there a way that I could have used classes instead of defining my x, y, and z variables globally? def getx(): try: global x ...
I'd like to use lock objects that are specific to the person I'm updating. In other words, if thread A is updating Person 1, thread B is blocked from also updating Person 1, but thread C is not blocked from updating Person 2. 99% of the time, I don't really need the locks since I'm working with different Person.Id valu...
I've just finished a week long adventure of creating an HTML5 Drag and Drop scheduler. As the prototype stands it works fine, but I'm curious if some of the code can be optimized. I mostly focused on it being readable and well documented, but I'm curious if someone can come up with any optimizations. I've noticed that ...
I an a newcomer in the Scala world, and I would like some advice from more experienced people to find out whether what I am writing goes in the direction of idiomatic code. In particular, I have to write a simple algorithm that will do the following. We are given an integer number of, say, candies to be distributed, an...
I have been writing a jQuery widget for a couple of days now. Originally I needed this functionality for something I am writing at work, but I felt like I could abstract it a little more so here I am. I think it's about finished for now, I may add some features depending on how It gets used (if it does). This is my fir...
I find this code quite ugly, but in fact, I can't find a finer way of achieving the goal. private static final String TABLE_NAME = "table_name"; private static final String[] allNeededColumns = {"col_id","col_one","col_two"}; public int[] getItemIds(int category_id) { ArrayList<Integer> ids = new ArrayList<Integer...
Inspired by another thread on here I was wondering if I could have an expert eye passed over this script? If I run the script with App1, App2 or App3 individually it takes about 3 mins per run. However when I invoke the ALL option that time increases to an hour. I'm no doubt managing my memory awfully so any advise w...
I like the modular aspect of AMDs (Asynchronous Module Definition; see this Stack Overflow reply) and it's quite neat to structure JS. But I typically compile all my JS files into one JS file. Therefore I don't really need the asynchronous part. So I thought I could quickly write such "infile" Module Loader. var load=(...
I'm wrote a simple function isBalanced which takes some code and returns true if the brackets in the code are balanced and false otherwise: function isBalanced(code) { var length = code.length; var delimiter = ''; var bracket = []; var matching = { ')': '(', ']': '[', '}': '{' ...
Example of a C++ function which removes duplicates from a string: string remove_duplicates(string subject) { string no_duplicates(""); for(int i = 0; i < (int) subject.length(); i++) { bool found = false; for(int j = 0; j < (int) no_duplicates.length(); j++) { if (no_duplicates[j] == subject[i]) {...
Is the test flexible? describe "self.sort" do before(:each) do @tee = FactoryGirl.create :author, nickname: "tee jia hen", user: FactoryGirl.create(:user) @jon = FactoryGirl.create :author, nickname: "jon", user: FactoryGirl.create(:user) @tee_article1 = FactoryGirl.create :article, author: @tee...
I'm creating a MVC structured content management system as both a means to learn better OOP and redesign my tacky website to me more modular and simplistic. My aim is to approach everything with regard for minimalism so I want all my code to be precise and to the point. As this is my first go at both MVC and true OOP p...
I have written some code in Java that consists of two classes. I have tried my best and I want you to tell me if I can improve and how good this is. Also, how important is OOP? Java is an object oriented language, so I have also tried my best to use it that way (although I don't know whether I have succeeded or not). M...
I've written my first class to interact with a database. I was hoping I could get some feedback on the design of my class and areas that I need to improve on. Is there anything I'm doing below that is considered a bad habit that I should break now? public IEnumerable<string> ReturnSingleSetting(int settingCode) intera...
Basically, I have a list, newtry of blocks, and I want to find a value of catchtype that makes them all return true for block.isCatchExtendable(newhandler, catchtype) or report an error if this can't be done. block.isCatchExtendable returns two values, success and a new type to try on failure. My current code works, bu...
I'm currently in the process of learning scala, and I'm looking for some best practices/proper idioms for the use of pattern matching with BigInts. I'm writing some algorithmic code (for Project Euler) as a way to learn the language. The problem I am running into is what is the best idiomatic way to match a BigInt, si...
Is there any room for improvement on this code? I use mechanize to get the links of a job listing web site. There are pages with pagination (when jobs > 25) and pages without. If there is, then the link number 5 is labelled after "Next >" and link number 6 is "Last >>". In order to identify them, I make assertions on t...
I've spend the last several hours working on a loop designed to take items in an array and arrange them as a so to speak "gird" of UIButtons. As far as I've been able to see through testing this code works perfectly. However, I am new to creating loops and I was wondering if anyone could give me any pointers on how I c...
I redid a Python Reversi move preview routine that is online. I could use comments about using Python better and/or better OOP design since the original did not use classes. There are three main classes: Board for the Reversi board Location to hold an x,y coordinate (0-7,0-7) Move to store a location to put a disc on ...
I'm doing some coding challenges to get better practiced at my coding. I'm trying to do one that requires us to do a ROT13. I've got the implementation correct, and I just want to know a couple of things. The space character is showing up as a crazy character in my terminal screen, which I'm assuming is because of ch...
We're preparing for an exam at the moment, and our lecturer has given us a sample problem to work on. I have it completed, but would like to know a) If it is actually doing what it's supposed to, and b) if it could be done more efficiently or there are any questionable coding aspects. It certainly seems to be working, ...
I am trying to learn Mongodb and decided to build a simple blog application using Zend Framework and Mongodb (using Shanty for ZF). I have the following document for Post class App_Model_Post extends Shanty_Mongo_Document { protected static $_db = 'blog'; protected static $_collection = 'posts'; protected s...
I'm working on my own PHP framework for a long while now. Right now I'm in a refactoring process. I'm came up with the question what a programmer would excpect what happens when he see following code: // working object orientated with a database. $UserGroup = new UserGroupModel(); $UserGroup->Title = 'Guest'; $UserGro...
Anonymous functions are one of the best features of C++11. They make everything so beautiful! However, one can get carried away and start overusing them. This code calls a function that reads through a file and invokes a callback everytime that something matches a regex. Since I read two different files but I want cal...
Is this PDO wrapper structure dynamic? Can using self:: rather than $this cause problems? class Database extends PDO { /*@var mixed $stmt Used as a temporary variable to hold queries*/ private $stmt = Null; /*@var $scopeSelectVar Used as a temporary variable to hold queries*/ private $scopeSelectVar = Null; /*@...
I built my first long running AJAX heavy app and memory leaks are eating me alive. I don't want to post too much code because it should be my job to fix it all, but I need some help. Does this code leak? Where? Why? and if you'd be so kind as to suggest a fix. function list_stuff(data, type, where, order) { var it...
I have followed the TGA specs described here (the info at the end of the page is what this method is based on) and have written a method that takes a TGA file's pixel data section and creates a bitmap out of it. It works, but the code looks sloppy. Particularly, when I'm actually reading the bytes. You'll notice that I...
I want to get just the first line of a big string. Currently, here's how I do it: def getFirstParagraph(txt: String) = { val newLineIdx = txt.indexOf("\n") match { case i: Int if i > 0 => i case _ => txt.length } txt.substring(0, newLineIdx) } But my friend sees some downfall...
Trying to come up with a way to have a fixed space (eg 20px) between two blocks on a single line which dynamically resize to fit that line (50% each minus the fixed space between). I ended up with the following code (demo): HTML: <div class="cont"> <div class="left">foo</div> <div class="right">bar</div> </div>...
I have written some code for finding a level in a binary tree, having a maximum number of elements. I have a few questions: Is it a good design? I have used 2 queues but the total sum of elements both queues store will be less than n. So I think it should be OK. Can there be a better design? public class MaxSumL...
I need to create an image on the fly where one large image covers a small image. The large image is a mask which makes the underlying image visible. Here is a quick sketch of what I'm trying to accomplish: It's important that Y lies beneath X. I have created to code for this and it works, but I was wondering how I ca...
I watched this live coding of Sokoban in Haskell and thought I'd take a crack at writing it using State and lenses, since I've never tried that before. My problem is that the control flow seems to be complicated by isWall and friends now being monadic values that I need to unwrap, so I can't use the otherwise obvious a...
A modified review request has been made here. Can I please have someone review this simple database design below and tell me if this is the correct way to achieve what I want to do? What I am trying to do: When a cardID is deleted this cascades and deletes the surveyID associated row. When a trackID is deleted th...
I am currently working on an unfinished project about Chess, it will (at some point) be able to help me to make some chess variations just by pasting the FEN position while I play online. But before continuing, my code must have good structure or it will become a nightmare to fix it later. So now that I have some basic...
How can I format this code so it's more readable? $(".card").click(function(){ $(this).stop().animate({ width:'0px', marginLeft: margin+'px', opacity: 0.5}, 500, function(){ $(this).siblings('.card').animate({ wid...
I have a jQuery function using a series of if and else statements. I am wondering if there is a more elegant way I can code this. I am thinking I could create an array with my "hashtag names" and then loop it through a function. However, I am not quite sure how to go about doing that. setTimeout(function() { var i ...
This is just a simple login form with a very vanilla HTML markup, but I just wanted to get some professional feedback. I know about jslint and try to adhere to there principals where possible. <script> //event listeners $('#sign_in_button').on('click', sign_in); $('#create_new_account').on('click', create); $('#create...
It seems it could be written shorter. It's especially annoying when I have to do this in multiple languages, so the button labels will be different. <button id="egyes" class="btn btn-danger">Hide</button>&nbsp;some text <button id="kettes" class="btn btn-warning">Hide</button>&nbsp;other text <button id="harmas" class=...
I'm just getting into SQL injection and data sanitization and seeking some advice on my script to get started. I have made this simple program which allows the user to enter their name into a form and the information gets saved into the database. There is also a button that lists all the current names in the database. ...
For a website I'm working on, I had to get all the unique entries in an array and count their occurrence. It is possible a certain entry is only found once, but it can also be found 20 times. So I designed the following bit of code: for ($i = 0; $i < count($nodes); $i++) { for ($j = 0; $j < count($nodes[$i]); $j++)...
Based on a python name generator grammar I found here I've decided to write my own in objective-C. The idea is I can load the grammar from a plist file and generate random names from it. I'm looking for a general code review and any comments and or suggestions. NameGenerator.h: @interface NameGenerator : NSObject - (id...
I'm very new to C++, but I really want to write good code and increase my development skill, so I ask you for some review. Scheme of socket server This is the scheme of how my socket server works. It creates a socket, binds it, sets to listen state, creates a new thread (in order not to block the execution of the progr...
This is a buy and sell game. I've revised it, though it's still unfinished. I would appreciate it if someone could review it again for me. #include<stdio.h> #include<conio.h> #include<time.h> #include<stdlib.h> void end() { system("cls"); int P, L, choice; printf(" *********** \n"); printf(" ...
The following code is pretty ugly. I suspect that there is a more functional and elegant way of achieving this result. var lines = new[]{ new{Head="A",Value="1"}, new{Head="",Value="2"}, new{Head="",Value="3"}, new{Head="",Value="4"}, new{Head="B",Value="5"}, new{Head="B",Value="6"}, new{H...
JavaScript is the language everyone uses without bothering to learn it first, and I'm no exception. I'm trying to set up autorefresh with longpolling. What I have on the client side is the following: var getAjaxer = function(element) { return function() { $.ajax({ url: "/path/to/resource", ...
I've got the following code, which works, but seems repetitive. Under DRY principle, how can I clean this up? puts "Blurt out a word" word = gets.chomp word_list = [] word_list.push word until word == "" word = gets.chomp word_list.push word end puts word_list.sort
I would like to convert ($data): Array ( [login] => Log in [logout] => Log out [label] => Array ( [email] => test@test.com [name] => Some name ) [controllers] => Array ( [page] => Array ( [title_new] => Ne...
How does this look? It has been over a year since my database concepts class and I have never worked with MySQL. I have chosen InnoDB as my engine because of foreign key support using UTF-8 based on advice from an earlier review. Everything works as it should when deleting and updating, but I am worried I am doing s...
I have a class called Foo public class Foo { private String optionalProperty; private String name; private long uniqueId; // getters/setters for above properties } For some business reason I need to create an Identifier which I can use to 'identify' Foo instances (having some name/uniqueId) in some bu...