@Jamal That's DeadMG, aka "the Puppy". Fairly well known for some pretty out of control...antics like this. Used to be a room owner in Lounge<C++>, but had to be dumped from the role because he caused too many problems. Oh, and probably in a particularly crappy mood at the moment because he just underwent stomach surgery yesterday.
Fighting the urge to post an answer using the my new, innovative, and modern anti-functional, anti-OO, goto-based programming paradigm. I think I'm going to call it Imperative Spaghetti Programming (ISP).
I am implementing Kd Tree in 3D space where I get a point cloud and I need to store it in a kdTree structure. My problem is that it doesn't work as it should, it add the same numbers as in an infinite loop, can someone check with me the code please, thank you. And Is there anything to do to incre...
@Jamal So you're saying people (like him) who aren't room owners of Lounge<C++> are harsh, but people (like me) who are room owners of Lounge<C++> are the only ones who are really nice?
@Jamal Really? I'd never have guessed! (I probably should have appended a smiley to the previous comment--it definitely wasn't intended seriously). Oh, but this one is 100% serious. Really.
A few days ago I wrote an entire powershell function that would recursively search a directory for CSV files and remove them if they matched a specific wildcard. I just realized Remove-Item -Path $dir -Filter $filter -Recurse could probably do all of that in one line...
I'm not 100% sure what the rest of your code is doing, but here is the code to get the days of a specified week using date:
<?php
// Set current date
$date = '06/29/2014';
// Parse into a Unix timestamp
$ts = strtotime($date);
// Find the year and the current week
$year = date('o', $ts);
$week ...
I'm trying to calculate what time a certain time in a time zone is today, so I can schedule something to happen at that time in that time zone.
I've got a table with what I have termed the Nominal Time, which is stored as a datetimeoffset with an arbitrary date, as the only parts I care about i...
I am trying to generate a dataset from a query that has a where statement. If the user passes a value additional things need to be added to the where statement. Is this the best way to go about this?
class TableAdapters
{
public class FindScriptByTargetVDN
{
public static DataSet...
@Malachi I do disagree with your newline thing though. I like there to be space between my if-block and else-block, but I guess that's personal preference.
I maintain a VBA process that prints a large number of PDFs. It was awful when I inherited it and I've been making improvements over time, but I'm a bit stuck on this one. There are at least 4 functions with this exact same code used to check to see if the program has been initialized properly. T...
During breaks, I find myself playing Emerald version a lot and was tired of having to use the school's slow wifi to access the internet. I wrote a scraper to obtain cheat codes and send them to my psp device. I couldn't come up with a better way of removing the extra whitespace. Any areas I could...
For some odd reason, when I use tabstospaces.com on my work PC, when I click to add 4 spaces in front, it does but also adds an extra line break in between each line. Pretty annoying.
I'm a C++ programmer learning Java in preparation for an OOP class this fall. That being said, Java is fairly new to me so I'd love to hear feedback on how to improve this code.
A few notes:
Code works as expected and is ported from my C++ equivalent code I wrote some time ago.
Not all operati...
There is an article on crackstation https://crackstation.net/hashing-security.htm#javasourcecode where they show you how to hash a password correctly. I've implemented the Java version of it which is working fine, but is the method they use secure?
import java.math.BigInteger;
import java.securi...
A couple of months ago, I suggested a set of badges for asking questions. The responses were... mixed. The top answer can be summarized:
In practice, all this would do is encourage people to ask yet more stupid, worthless questions and we have quite enough of that as it is.
We believe that ...
Over on MSE, I've proposed a series of badges for asking good questions on separate days. While implementing them on Stack Overflow, where the primary motivation does not apply, we decided to explain why we are also bringing them here. The last thing we want is to create busy work for people by i...
always have to steal my questions @Mat'sMug, well I guess you, me and @ckuhn203 are probably the only ones that look at vba questions or post them.....
I have a script that creates a diff of two images using PIL. That part works fine. Now I need to find an efficient way to count all the non-black pixels (which represent parts of the two images that are different). The diff image is in RGB mode.
My initial cut was something like this:
return su...
there is a lot of crazy things about time. unless we can actually travel through time, I don't think it really exists, so it makes dealing with time a Crazy persons sport
My first ASP.NET MVC 6 / jQuery web site - the site header has a "Change Language" selector (named 'LanguagePicker') - this is actually placed in a _Layout view, a container shared by all views.
When users change the language, I need to save that in the db, and reload current page, with languag...
Formatting
First off, I reformatted your code to make it easier to read. When writing SQL it is best to be consistent with capitalization, and using indenting makes it much easier to read. So here is your code in my (personally preferred) format, including SQL keywords in all caps and indentatio...
I'm building an in house query tool. The main form has a drop down which allows the user to select how they want to find scripts, and a drop down for what server they want to run the query on. There is also a text box to allow the user to populate a specific value which can be left blank. I thi...
I have these two methods which are generating two different xml files formats whose header section is same and detail secction varies. The roor node is different for both the xml file. Here i have two methods written for both. i want to optimize the code by avoiding the duplicate repeating code ...
@EricLaw: Well, NOT ONLY on Win8. I'm using Windows 7 right now and I can see those X buttons in my IE10. So you might say it's an IE10+ only feature (not sure about IE9, though), but definitely NOT Win8 only, since this appears in the Win7 version of IE10. Anyway, thanks for the tip, @minitech! — OMASep 17 '13 at 11:13
this seems to have been minitech...
found that under the top-voted answer, and there were no minitechs before..
You need to look at what's common to both methods:
StringBuilder builder = new StringBuilder();
using (StringWriter stringWriter = new StringWriter(builder))
{
using (XmlWriter writer = XmlWriter.Create(stringWriter))
{
writer.WriteStartDocument();
writer.WriteStartElemen...
@chillworld Is your disagreement with the fact that a delegate method has a return value? Or simply with the name I've picked for the method itself? If the former, well, there's not much point to delegate-protocol pattern without letting delegates return values... otherwise we can just use notifications. If the latter, the naming of my methods in the answer matches identically to the naming scheme Apple uses for their delegate protocols.
While Marc-Andre already talked a lot about Java Style Conventions, here's my 2 cents on your implementation.
Inheriting:
You did create a List. In Java it's customary to implement Interfaces if you have classes with similar use-cases and methods.
public class list<T> {
This should be:
pu...
And you can call NSSetUnhandledExceptionHandler() (which takes a function pointer as an argument) to set the function for handling your unhandled exceptions.
So now, if your app has a UE from anywhere under any circumstance, it goes through this custom function you wrote, and then your app crashes.
The idea is that I wrap some expected exceptions in AutomaticExecutionFailedException and there act upon the exception probably... If I fail to do so, it will automatically be moved to the rejected folder in that handler
Seems like a reasonable approach. It's similar to one that I've used when building a query completely from an XML file, except I used parameters rather than adding in the string.
selectString = string.Format("{0} WHERE {1}='{2}' {3};",
selectString,
dateColumn,
...
I have the following "working" static map
private static final Map<String, Object[]> S_MAP;
static {
Map<String, Object[]> map = new HashMap<String, Object[]>();
map.put("somekey", new Object[] {"SSS", new Integer("6")});
map.put("bad", new Object[] {new Integer("6"), "VVV"});// different
S_MAP ...
@nhgrif no completly not, mine diagreement is more of the lazy type ;) the name was just incorrect, you added the piece how he should do the right way for that method's name.
@jiv902: Technically less efficient. Actually I don't know if I would not make that bet. To upper is simply an array access operation. So it boils down to: if (sequenceType == 'F' || sequenceType == 'f') Vs if (ToUpper[sequenceType] == 'F') Thats a very hard one to call. So I would go for the most readable one as my argument. — Loki Astari10 mins ago
This is my first post here - I hope I don't break any rules..
After reading the same question on SO about how to bold a word in a label for the nth time today, I decided to write a formatted Label.
At first I toyed with the idea of writing a MarkDown clone (again), but I really wanted a rather...