« first day (198 days earlier)      last day (2189 days later) » 

2:19 AM
Q: Increase efficiency of card shuffling program

LiondancerI was wondering how would I make this program faster or perhaps use less memory. I thought about using dictionaries instead of lists as they have faster look ups. I'm not sure how to decrease the memory size of this program. num_cards = input("Please enter the number of cards in the deck: ") de...

1 hour later…
3:26 AM
Q: Help with optimizing current data pulling fuctions

user1887261Here is what the below code does: The first function, sqlPull() connects to a local MySQL database and pulls the last 20 rows from the database every 5 seconds. The data coming in is a list of tuples, where MAC, RSSI and TimeStamp are the 3 elements in each tuple. The data is entering the data...

1 hour later…
4:38 AM
Q: Am I writing good Go here? Python functions converted to Go

AnaI originally asked this question on StackOverflow. Reproduced here by recommendation. I've got a number of Python scripts that I'm considering converting to Go. I'm seeking confirmation that I'm using Go in essentially the way it was meant to be used. Full code is available here: https://gist.gi...

5:37 AM
Q: rails controller set layout with Class#to_proc

ecoologicMy application_controller currently resolves the layout as follows: layout proc { |controller| LayoutService.resolve controller } Maybe I've been too long in javascript recently, but I'm wondering if it could be refactored to look more like: layout LayoutService And implement something like...

Q: How to create new Type in MPI?

melnajjarHi I am new to MPI and I want to create new datatype for Residence struct.just want to see if I create the new type right way ? struct Residence { double x; double y; }; MY new MPI Type MPI_Datatype createRecType() { // Set-up the arguments for the type constructor MPI_Datat...

6:10 AM
Q: How to refract an while loop with an necessary initial setting (Python)

pocI put the readable version in the gist file -> link Please ignore the print and comment in the following code. I often have to write this sort of logic is that Init the conditions, and deep into loop condition, get the variables in each iteration, break when the condition meets As you see,I ge...

6:49 AM
Q: Generating a list of alternatively positioned odd and even number out of an array of unsorted integers

user1836957I had an half an hour interview with Microsoft for an intern position. I was asked to generate a list of alternatively positioned odd and even number out of an array of unsorted integers. I guess it was below the interviewer expectations since I did not get the offer. Can any one give me some ...

2 hours later…
8:35 AM
Q: Improve my if-statement to prevent double checks

dTDesignTHe following version of a if-statement I write very often. And every time, I hate the way I make it. But I don't know how to improve it. For example, I've two ArrayList's. If one of them is not empty, I'll convert it to a StringBuilder and send it per mail. The problem is, first I check if one...

2 hours later…
10:27 AM
Q: Java beans performance with object inside object

JeyasitharI am developing a bean class which has multi face properties (name has first name, last name and middle name). The object is going to be used to create an xml file. Please compare my two methods to incorporate the same in my application. Method 1: public class SampleVO { String firstName; Strin...

11:27 AM
Q: Making this login javascript code more organized and more competent?

Jose the hoseI have this basic javascript that using a constructor, validates the form where the login fields cant be empty. All this WITHOUT using any js libraries. So far I have come up with this... function Validator(txtbox) { this.txtbox = txtbox; } var validator = new Validator([ "username", "pass...

Q: Image write in python and opencv

KyllopardiunThe code below isn't saving any image, I've tried printing the "image" after reading it and it does look normal. #!/usr/bin/env python import cv2 # opencv import sys # chamadas de sistema sys.exit() import numpy as np # numpy trabalhar de forma otimizada com arrays import argp...

3 hours later…
2:53 PM
Q: How to visualize information in a PCAP dump?

reoxI need a tool than can visualize (print some fancy charts are enough) of all communicating hosts in a pcap file. I need just how often a single host was contacted. For example: google.com ###################### 500 times ##################### bing.com ########### 200 times ########### I wrot...

3:06 PM
Q: A Covariant Tuple

Cyril GandonI was searching for a way to put a Tuple<List> into a Tuple<IEnumerable>, and I found that Tuple has no covariance. Is C# 4.0 Tuple covariant Co/Contravariance? Tuple<string, IEnumerable<string>> not satisfied with List<string> So I decide to make my own implementation of an interface which s...

3:36 PM
@retailcoder, are you there?
3:53 PM
@Malachi sort of - busy day at work :)
4:15 PM
@Malachi: I've just noticed that you now have the Strunk & White badge. :-) Gonna aim for Copy Editor?
@retailcoder: that code that you helped me with is being a little bit of a pill because the variables are sort of global in the context the code is used in so if they use the token twice and the second one doesn't have a first name it returns the previous first name, how do I clear the variable? I have tried setting the array variable to nothing before the end of the script, but it isn't working.
@Jamal, I have had Strunk & white for a while, I love editing! lol. I am going to go for every badge I can get!!!!
@Malachi: Shouldn't take you long to get to 500, then!
@Malachi the VBScript code? I'd have to relook at it..
@Jamal I thought you'd have a little diamond next to your name by now :)
@retailcoder: Not yet. Patience is a virtue. I have already decided on my first act of duty, though (nothing special).
@Malachi just looked at your VBScript again; I had a huge doubt about assigning those strings to null (not very vb-like), have you tried setting them to vbNullString instead? (and then the Coalescefunction should still work)
4:39 PM
@retailcoder: I thought that I would be able to take the setting the strings to nothing out, but I had to switch environments, for some reason they don't like me testing form stuff in Prod, imagine that, who do they think they are???? LOL I think I just need to put that back into the code. setting the name strings to nothing.
anyone care to revisit this question?
Q: Database schema suggestions for a Minecraft logging plugin

Andy ShulmanThis is my attempt at creating a database schema for a Minecraft logging plugin. I'm by no means a SQL expert, so suggestions would be greatly appreciated. -- -- Table structure for table `actions` -- DROP TABLE IF EXISTS `actions`; CREATE TABLE IF NOT EXISTS `actions` ( `id` tinyint(3) unsig...

I am not sure how many people actually follow this chat room, but... another one....
Q: Looking to optimize SQL Server merge statement

RomokuI have a merge statement that takes around 10 minutes to process 5 million or more records. The merge statement is part of a stored procedure that takes my newly bulk loaded staging table then runs data integrity checks, transforms the data into the proper format, and inserts that data where it ...

@Malachi AFAIK VB6/VBA/VBScript strings are value types, you don't set them to Nothing or Null - assign them to vbNullString instead. @ dev in prod env: chickens...
I am going through the unanswered questions for the SQL tag and noticed that I have answered some of these and I don't think anyone is looking at them, i was hoping that the OP would see that someone answered their questions. most of these people are active on other SE Sites
@retailcoder, I agree! I will try that vbNullString because that seems like the correct practice.
They're chickens. I quick-fix stuff in production all the time, what's the worst that could happen? Everybody in the company on break at the same time?
4:55 PM
@retailcoder: I like sarcasm tags
ugh, typo. I meant </sarcasm> - yeah!
Have you seen the answer where I quote "my humble opinion"? I thought that was funny too :)
4:56 PM
I dont' think I have seent hat one yet
A: Deleting folders is a risky business

retailcoderWhen all you have is a hammer, every problem looks like a nail. You're trying to do something with code, that's not the code's job. Delete all this code and tackle the problem at the root: make sure your code runs with the appropriate permissions. It's that simple. -- My humble opin...

hey can you tell me if this InStr Function looks correct?
if (isNull(InStr(varPartyName,",")))
FirstMiddleName = ""
MidName = ""
Hmm don't you mean If InStr(varPartyName, ",") <> 0 Then... ? and then FirstMiddleName = vbNullString... - "" and vbNullString are not exactly the same thing, vbNullString takes 0 memory :)
@Malachi InStr returns the index of your comma within varPartyName, 0 if not found.
I always forget Then when I write if statements in vb
The worst is when I start typing public property get ...in C#
5:02 PM
@Malachi yay, I'm at -45 rep score so far this week :)
did you post a bounty? lol
maybe I can catch up now...lol
@Malachi I'm the last user on the last user page!
oh duh I remember you telling me about that bounty, it is on my list to find something to say about that fun code.
5:18 PM
I answered this Question, but I think it might need to be closed..... up vote my answer and/or close vote if necessary.
Q: Converting looped row in table from datetime to string

phpyesphpI am trying to pull out the whole column for row[3] in the following script. Everything works, but unfortunately, the code is only pulling out the last row's data from the whole page while everything else is lost. I have never converted a whole array from datetime to string, and I am unsure of ...

And Another Question that should be Revisited as well....
Q: Slow MySQL query - 1200 rows in 5secs

zima10101Can anyone help me speed up this query? At present, it returns 1200 rows in 5 secs. I've notice that it is looking at 240000 response records. I think this is where the issue may be. I've created the following indexes: CREATE INDEX idx_eventid ON `action` (eventid); CREATE INDEX idx_actionid...

5:45 PM
Q: Comment on my first piece of jQuery code

athisI would like some comments on my code and implementation for this simple piece of jQuery and CSS. Basically it is 2 div boxes centered on a page, where the red box can be swung out by dragging it. http://jsfiddle.net/Sr4zw/ http://jsfiddle.net/Sr4zw/embedded/result/ Any comments would be hel...

Q: Injecting Data into XML using a dll

Malachithis is a template for one of our data injection tokens. when I first looked at the template it was worse than it is now, but I would like some input on this because I think that it can be cleaned up even better. Side note this is code that we got from a vendor to use in conjunction with their...

@Jamal thanks for the Edit. I am horrible with Capitalization....lol I have an itchy shift finger
6:18 PM
@Malachi: No problem!
Q: Ruby Kata Gem: WordWrap

user341493I've just completed the WordWrap Kata in the Ruby Kata gem and I'd love some feedback. Thanks! Here's the Kata: $kata take word_wrap.rb WordWrap Kata Create a "WordWrap" class that is initialized with an integer parameter - detail: The parameter is the wrap column - example: Word...

trying to figure out which is the most recent version of that code that I just posted, and I am working on putting in the using blocks. also trying to implement some cool syntax I didn't know about before @Jesse C. Slicer answered a previous question of mine codereview.stackexchange.com/a/33094/18427
@Jamal, it's called Object Initializer Syntax
I think I am going to like it a lot
Q: replace paranthesis code

user32281I am trying to write a string or integer formula which will look a code between parentheses. My logic is this: Search for the first parentheses, find the last parentheses, and return everything in between. Im sure there is a string or integer function, but not exactly sure which one will do the...

7:18 PM
Q: Please review my Actionsript 3 Code

Tim ValishinI am creating a Frogger game in Flash AS3 and just wanted to see if anyone can help me improve it without breaking the game. The reason I ask for it because I don't have any errors, but I do get over 50 of these: Warning: 3596: Duplicate variable definition. Any help is appreciated. packa...

7:31 PM
Q: Iterator Implementation

ashurI had to write my own iterator implementation for my structure which has ArrayList<Vector> field. An iterator is supposed to iterate over mentioned List. Any suggestions on improving it, or anything else? public class ExamplesIterator implements Iterator<Vector> { private List<Vector> examp...

Q: Encouraging users to include a code-snippet that proves that their code works

Simon André ForsbergI have stumbled across some questions where it is hard to determine whether or not the code in the question actually works or not. Example #1: Replacing parenthesis in code Example #2: Create a binary search tree, code review request This has got me thinking, can we do something to encourage u...

Q: Need review and best practice tips for a Backbone project

ElmarI made a simple app that fetches the favourite programming language of a Github user, by simply inserting their username. The full code is uploaded on Github, please feel free to fork it from https://github.com/elmargasimov/lovelanguage. The stack: Yo Backbone generator from Yeoman Require.js...

8:09 PM
We're down to 998 unanswered questions! Keep it up!
Very Nice
8:24 PM
Q: Web application structure review

Fez VrastaI'd like to have suggestions about the structure of my web application. What the app does: My app receives files from about 800 scanners around my country and the users see the scanned pages into this web application, then they can organize the pages in groups, choose which one keep and which ...

8:45 PM
@retailcoder, if a post like The Many Memes of Meta isn't posted when I get on my laptop tonight I will have to create one
9:20 PM
@Malachi what do you mean, on meta.CR?
@retailcoder: I was kind of joking. I don't know that we have very many, if any, memes that they don't have on StackOverflow...lol
are unanswered questions figured out by if the OP accepted an answer or not? or is it by upvoted answers?
something to check out if the latter is the case
Q: Sql Database design Ecommerce

NerdsRaisedHandOK so am new to database design but am fairly familiar with SQL and its syntax. I want to create a database for an E-commerce website that will sell a single product type such as a shirt. They could be different sizes, colors, and design. I formulated list of information I thought would be necca...

this question was posted here on CR and then the OP posted it on Database. I posted the answer that I gave on both questions, I am wondering if one of the questions should be close voted though. and if so, which one?
Q: Optimising a query

SparkyConsider the query given below: SELECT * FROM ((SELECT c.cust_id , c.username , REPLACE(qs.seg_type_ref_key_02, 'N/A', 'Non Vip') casino_group, REPLACE(qs.seg_type_ref_key_03, 'N/A', 'Non Vip') bingo_group, REPLACE(qs.seg_t...

it does show up on the unanswered list.
@Malachi Depends which tab you're looking at, unanswered questions list does include questions with unvoted answers under the "votes" tab.
I need to start posting some more answers tonight, by midnight I'd like to be down to 975 unanswered questions :)
9:36 PM
@retailcoder: I just posted another answer here....
Q: Correct use of my JOIN and arrays to fetch the data?

user2151983After learning a lot about programming, I've decided to write some code pertaining to scripting and use of different functions. I've come to a point where I'd like others to verify my code for correctness. Is there anything I can do better, different, or easier, to make my code more efficient? ...

trying to get 100 rep for that one badge!!!! we will see if I make it...lol
I'm running out of votes again!
9:57 PM
@Jamal: did you see my answer on this Question?
A: MySQL one-to-many relationship - is this the right way?

Malachiyour 3rd question is off-topic for the site, but I do believe that you are using the one-to-many relationships correctly. when you are finding a Player by steam_id you don't actually need to select the steam_id unless you are going to use it for something in an application, this will speed up t...

@Malachi: Yes I have. :-) Can't say I understand the technicalities too well, but the question still interests me.
you guys haven't gone over Databases at all?
here is one like a couple of other answers that I have given. but I don't see the OP giving any input on this one.....
Q: Building database from file C# Mysql

Dustin Taggartwell as the question reads I am building a database with 3 tables. Now these tables are going to be used to store names in. Table 1 will store First Names Table 2 will store Last Names Table 3 will be a one to one table linking the First names to the Last names Now all this data will be com...

10:17 PM
i got quite a few of the SQL questions cleaned up.
Q: is there a better way to handle asynctask?

YarhCode below is used to download jsonfile from web and use its data to fill spinner. I wish to know if there is better way. Is it wise to move everything from onGetPriceType to AsyncTask? Interface public interface GetBuildTypeInterface { public void onGetBuildType(HashMap<String,String> resu...

@Malachi: Me? That's not my area of expertise.
10:40 PM
@Jamal, don't you ever have to connect to a database? I suppose they are RDMS though if you do
I just realized that I have to make it to 200 rep in a day to get the badge, for some reason I thought it was 100
11:03 PM
Hi people :)
Seems like Malachi, Jamal and retailcoder have spent some time here. Big surprise :P But not much activity now. Guess I'm too late for the party.
Q: RSpec and Ruby - what could/should be done differently?

Andreas FinneThis is one of the first RSpec tests I've written, and I'm not really sure what the best practices are etc. My question basically is: what would you do differently? What is good? What is bad? The complete code can be found at: https://gist.github.com/asmand/d1ccbcd01789353c01c3 Here is the cl...

11:49 PM
Q: Teach an Ajax/Jquery noob how to submit to self

r3wtOk, i have been doing php awhile and i am undergoing the project of my life to date, a small exchange based around the digital currency bitcoin where users can trade between it and other virtual currencies, such as ripple and protoshares. One problem i'm having is understanding jquery and ajax. ...

@Malachi: Not in C++, at least at this stage. I still feel I'm learning the basics, though I've taken all the C++ classes at school.
Well hey there, Jamal.
@SimonAndréForsberg: Yes, and it is good to give the chatrooms more activity. :-) Starting tomorrow (hopefully), I'll be checking out Teacher's Lounge.
Sounds nice :) This is the first time I'm visiting an official chat room like this, and only the second time I'm using the chat at all :P
I assume the Teacher's Lounge is for Moderators? In that case, congratulations :)
@SimonAndréForsberg: Cool. Glad to have you here. And yes, it seems only the few of us are actually here.
Thanks! And yes, that's correct. Something came up, so it couldn't go in effect today.
11:57 PM
It's nice to be here. In one way it feels like I know you already just because we're so few active here.
Well, it's better later than never :) I guess we are patient enough to wait one more day :P
I think we're gonna have a new user (and question) soon! stackoverflow.com/questions/20060321/…

« first day (198 days earlier)      last day (2189 days later) »