« first day (425 days earlier)      last day (3579 days later) » 

12:09 AM
:-)
 
12:33 AM
@JohnP do use use VisualBasic namespace often in C#? I thought that namespace only existed to ease transition from VB6 to VB.NET...
Can I ask why you didn't just import microsoft.visualbasic.fileio and use the native textfieldparser class? — JohnP 2 hours ago
 
1:10 AM
Ok. I quit. Rome wasn't built in a day. Cya guys.
 
@Phrancis No, I don't know which, if either, is faster. I'd hope that under the covers the implementation is the same and the efficiency is identical.
Is there a way to find out who the last person to edit a tag was?
 
@nhgrif Yes
 
Can you see who last edited ? They asked me to make sure it sounded good in chat, but now I can't find the message and forgot who wanted me to look.
 
Aha.
@ckuhn203 wiki looks fine.
 
1:30 AM
30K Thanks, santa!
 
Nice, congrats @rolfl!
@Cornstalks Everyone thinks differently if we didn't life would be pretty stale :). — Simon yesterday
Life would be pretty stale without people who use goto?
1
Q: CsvReader class in C#

Leopold AspergerFor the amusement I fully implemented a CSV reader. I think I did pretty well, considering that most popular CSV readers that I know take thousands of lines to achieve the same thing while being slower. Since CSV is a pretty hacky format to begin with I decided to forgive any malformations, like ...

 
1:53 AM
0
Q: Generate random 10% of file to be used in testing with ruby

pgreen2I'm new to ruby, but not to programming. I just need a simple script that given a text file will pull out around 10% of the lines at random. Below is what I came up with based upon a python script I wrote. What do I need to do differently to make it more ruby-like? prng = Random.new File.ope...

0
Q: Convert total minutes into "Hours:minute:seconds" for marathon data using ruby

pgreen2The point of the script below is to read in the 10th column which is the total number of minutes a runner took to finish the marathon and convert it into form of "hours:minutes:seconds". Is there a better way? require 'csv' File.open('bostonmarathon-2012-results.txt', 'w') { |f| skip = tru...

 
Hmm, so... many people in Objective-C make the mistake of trying to define a constant as NSString const * myString; but the correct way to do it is NSString * const myString;. When I point this out to people, I sometimes wonder how many lines of code through how many projects they have to go back and change to get it all right.
 
...both compile?
 
0
Q: For loop for Mixing Audio (Left Channel, Stereo to Mono)

ZerowalkerAs the topic says, it's a very simple For loop doing that, but i find it very, complex looking, and hope you can give me some insight on how it may be improved. int Tindex = 0; int16_t Test[960]; int TestSize = SampleSize / 2; //Test is 16Bit, Half size of 32bit i...

 
2:14 AM
Hello, World!
I got an experienced database dev to look at this and got some awesome advice. Will likely post a new code soon
Unfortunately he's not a member of CR
 
@Mat'sMug - Not often, but we do a LOT with parsing out csv/text files, and rather than write my own parser, I went looking. I found a pretty decent CSV parser on...codemonkey? and I found a blog post delineating the VB library, and it worked great.
All right, math time, peeps.
Given the following values:
Pre-ride weight: 183.2
Post ride weight: 178.5 (Yes, ~ 9 lb gross weight loss)
Total fluid intake: 70 oz.
Total ride time/distance: 29 miles, 1:47:14.2

Solve for the average ambient temperature and humidity.
 
2:36 AM
42
2
 
Close, but that's how many roads a man must bike down (Or walk down if you subscribe to the original interpretation)
 
@JohnP How does fluid intake affect weight?
(asking that as completely pragmatic question)
 
2:58 AM
In any case, it's pretty cryptic and likely above my knowledge level, but I think this could be calculated moderately easily
Or not... given the question "Solve for the average ambient temperature and humidity."
 
I've only scratched the surface, and this answer is getting pretty long already. You have a nice little spaghetti plate there. Refactor, my friend. Refactor. Extract smaller methods: if you can look at a block of code and put a comment above it that says what it does (don't do that, it's a bad commenting habit to have), you'd find that everytime you have such a block of code, it can be extracted into its own method pretty neatly.

I have to say something about your Assert method though:

Bad, bad, bad, bad name.
0
A: CSV reader and parser

Mat's MugIncluding the signature, scope opening and closing braces, and all the superfluous vertical whitespace you've got here, the Read method has 223 lines of code, checks if the end was reached in 7 places and includes 4 goto instructions. Looking at the comments on this post I understand that you're...

I hope I don't come out too harsh
 
3:14 AM
No, did not, and got my +1 (though it took a while to get through)
 
Yay, 17000!
 
Great answer, actually
 
why, thanks!
 
Meh, I am still not certain of the intent of the question
We'll see what response my edit/comment gets
 
reading OP's comments pushed me to write an answer
 
3:18 AM
The thing is, the code sucks..... it's a really bad implementation of a state machine
I have implemented a CSV parser using a state machine, and if you do it right, it's really nice
I think this may be a opportunity
 
totally
upvoted your comment BTW
91 @Simon's on the wall, TTGTB
 
Night
 
Bye @Mat'sMug
Bah, got a sick cat; not fun. He must have eaten some animal that has been dead too long or something... poor thing.
 
0
Q: Haskell idioms in functions/arguments handling

CraniumI came up with this function rangedReplace as an exercice to use recursion and try different ways to make it work (I made at least 3 completely different versions). I think this version is the best but I have a feeling I can improve the way the functions/arguments are handled especially in the ce...

0
Q: How do I simplify this MySQL query for Max Nth per group?

Braydon BatungbacalI'm trying to write the most efficient query I can to pull the relevant data I need for retrieving the latest conversations for a user, ordering groupings of conversations by most recent message in that conversation. Here's my query, I don't like the idea of using a subselect to match the max tim...

 
4:01 AM
0
Q: Using XDocument properly

TRSI have a WCF service in which I am reading and adding some records to a .xml file. I load the .xml document in the constructor and use it in all the methods and save when it's updated. I want to know if this is the correct way of using it. I have seen code around where people load the xDocumen...

 
@Mat'sMug Simon the timer
 
2
A: Should we do something about our meta tags?

JamalThe selected meta tags will be burninated in phases, based on usefulness. This post will be updated as burninations are done, up until the question is tagged as status-completed. Phase 1: status-completed refactoring clean-code code-smell You can help keep questions from retaining bad t...

 
4:15 AM
0
Q: Explaination and Implementation Required ASP.NET MVC Complex Views

NoobNewbieI am new to MVC framework. below are my questions. as I'm new to this framework, Please give a detail info how to achieve it. 1) Is it possible to retrieve all the data from these tables through single view. 2) If yes then what will be the procedure to generate such kind of view. 3) what will ...

 
@Phrancis - It's a basic equation. If I start at weight X, and drink Y fluids, my "weight" is X+Y. Subtract post weight and you get gross weight loss. Net weight loss is just X - post weight.
 
@CaptainObvious No code
 
4:33 AM
TTGTB .... night all.
 
Goodnight!
 
Hmmm... at the moment my home network is running on my backup firewall, it is slow.... (which is better than my primary firewall, which is dead).
Life is soooo ..... laggggyyyy
 
Everything is running fine for me, except for Facebook. :-P
 
and nothing of value was lost :P
2
 
lol
 
4:48 AM
morning @all
@jamal what to do with this?
I can see the adding of ) is correct but the rest I don't know
 
@chillworld I'm not sure of that one. I may just wait for Mug to look at it.
 
k, the first post is also strange, looks more of a construction of code but I'm not sure it's actual working code yet
skipped it also :)
 
5:08 AM
Does this make me sound like an ass?
"Sounds like your answers may be in the manual... – Phrancis 47 secs ago"
Also, how the hell do you quote a comment in chat?
 
right click on the 47 seconds ago and copy chortcut
 
Sounds like your answers may be in the manual... — Phrancis 2 mins ago
OH that's fantastic thanks @chillworld :D
 
yw @Phrancis
now, since when is MVC a framework?
 
@chillworld looks like this guy needs more SQL in his life.
 
0
Q: Plotting 3D Cube from Center

Devashish DasI wanted to plot a 3D Cube of Size 1.0 and return a dictionary of Coordinates if the center coordinate is provided. import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D #Concept.py def printer(Coordinates): A = B = C = 1.0 X,Y,Z = Coordinates S = 1.0 Q = ...

 
5:17 AM
@CaptainObvious you funny guy, was I looking at your question for phrancis his comment ^^
@Phrancis I think he just need to take a course or start reading
lol, occupied on new project => for one reason a VM can't initialize yesterday.
busy with looking for the fault => a second can't initialize also (without changes ...)
I think it has to do with this :
this.catalog = (T) HashBiMap
.create(AbstractCatalogViewModel.catalogs).inverse()
.get(this.getClass()).newInstance();
 
@Jamal I looked at it, and figured it was right....
 
yeah, just got a stacktrace and I was correct
 
^^^ isn't that an oxymoron?
 
@rolfl well if you catch the error and give a very bad logging without stacktrace, you can search for a while
changed the logger and got the stacktrace
 
So, what you are saying, is that you were wrong, not that you were correct... ;-)
The only difference, is now you have more understanding of how you were wrong.
 
5:27 AM
@rolfl it's not mine code I'm seaching in atm (it's from mine designer)
 
@rolfl And the only difference is, now you know where to insert the comma. ;-)
 
Ahh, get a different developer (one who makes error conditions easier to debug ... :p
@Phrancis ^^^and the missing parenthesis.
 
I sure do speak with him when he get's here. Never throw away the exception without logging
 
@chillworld *gets :)
 
lol, now it works :)
@rolfl do you know why netbeans jerks around about calling an abstract method in constructor?
 
5:31 AM
Undervalued answer:
1
A: Detect a complete binary tree

abraimport java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.NoSuchElementException; import java.util.Queue; public class CompleteBinaryTreeDetection<T> { why is this not final? private TreeNode<T> root; /** * Constructs a binary tree in order of...

 
they do have to implement correct otherwise the class never works correct.
So if they implemented it with a NotSupportedOperation mine class never inits
indeed undervalued. he make nice work of it
 
What is this <T> thing?
e.g.: private void create (List<T> items) {
 
0
Q: Anyone know why the image would not properly be updated here? I have it in the asset catalogue. [Swift]

bobimport UIKit /* A controller object that manages a simple model. The controller serves as the data source for the page view controller; it therefore implements pageViewController:viewControllerBeforeViewController: and pageViewController:viewControllerAfterViewController:. It also implements...

 
@Phrancis Java Generics.... the explanation would take more than a chat message.
 
@Phrancis It's a generic parameter. The basic idea is that it can be filled in with an arbitrary type (though if memory serves, it does have to be something derived from Object). IOW, the basic idea is that if you have (for example) classes Foo and Bar, then you can create List<Foo> or List<Bar> to be a list of Foo or list of Bar respectively.
 
5:41 AM
But, relatively simply, if you have an array of, for example String.....
 String[] data = {"a", "b", "c"} .....
 
it's something great in java but a lot of people don't dare to create there own generic classes
Generics and reflection are the 2 things not so experience programmers would avoid
 
you could store those in a list of String..... List<String> with: List<String> slist = Arrays.asList(data);
So, that's easy enough, converting the array to a List, using the Arrays.asList method..... but, how do you implement the Arrays.asList method?
 
@chillworld I have relatively little experience (with Java), but if I were forced to use it, my code would almost certainly be fairly heavy on generics (and lambdas, but probably not so much reflection).
 
It takes an array containing some type of data, and returns a List containing the same type.
 
@JerryCoffin usage of generics or really create generic classes?
 
5:45 AM
For convenience, and since we don't know the type before hand, we just call it T, but it could be anything.
So we declare a temporary generic type <T> and have the method:
 public static <T> List<T> asList(T... a)
 
@chillworld Given how...weak most generic classes already available in Java are, I'd have little choice but to define my own.
 
which says, expect some array containing data of type T, and then return a list of the same type.
 
It appears I don't understand the distinction between an array and a list... I guess when all you have is a RDBMS everything looks like a table... lol.
3
 
@JerryCoffin well I really have to watch out here. If I use reflection, some people can't follow anymore. If I create a generic class they looks like it's an alien but they can use it
 
@chillworld - you have to learn to ignore Jerry, his attitude toward Java gives you the impression that Java generics are broken. Of course, he's right. But, given the alternatives (which are all also broken...), it's not that bad.
2
 
5:50 AM
@rolfl It's not that they're broken, just that they're, well, weak. Gauva uses them better than most Java, but it's still quite limited. The simple fact is, most of Java's use of generics comes down to little more than containers of some generic type (with a limited ability to constrain the types over which the container is instantiated).
 
So an array from my understanding is a list of values, e.g., (1,2,3,n) but a list is... what?
 
Alright, Java questions with no-upvoted-answers has been cut from 24 to 16....
There are two differences of major significance between a List, and an array.
The first is that you can only store objects in a List (and you cannot store primitives like int, long, double, byte, etc.)
 
@Phrancis An array gives random access with in the collection (i.e., takes roughly the same length of time to access any item in the collection) but takes roughly linear time to insert an item in the middle of the collection. A list reverses though: linear time to access an item, constant time to insert in the middle.
 
@JerryCoffin well, that's the reason you could make your own generics :)
 
(but, the int, long, etc. can be autoboxed - or converted - to Objects that represent them like Integer, Long, etc.).
The second major difference is that Lists can grow (and shrink), but arrays are fixed-length.
 
5:53 AM
oke wish me succes with a delegator for viewmodels :)
 
Monking
 
monking @skiwi
 
@chillworld It's why you'd have to, but Java places pretty severe limits on what you can do with generics too (at least compared to what I'm accustomed to, anyway).
 
@JerryCoffin This is not accurate description of List in the Java world....
 
What are you still doing here @rolfl?!
 
5:54 AM
ArrayList is a List, but it is randomly accessible in O(1) time.
 
@skiwi he waits till his bed comes to him :D
 
We need to find a table with the data types for @Phrancis ;)
well, more specifically, the storage containers I think they're called
 
@rolfl Oh, did they mess that up too? I know they use bad names for a lot of things, but had forgotten that List was one of them. My apologies.
 
^^^ thats a stupid comment.
 
A List is just a List
Nothing more, nothing less
 
5:56 AM
It's called a Linked List, what you were describing, and just because C++ chose to implement List in a linked way does not make it the only way.
 
The specialization is in the concrete types
:o on SO
 
Lost. Guess I better keep reading that book about Java...
 
@JerryCoffin well each language has its pro en cons. We have to live with it. At school I never wanted to be a JAVA developer but I do felt it was more powerfull then .net
 
@Phrancis Where did you lose it?
 
@rolfl Sorry, but that's not specific to C++, nor anything close to it. Long before C++ came along, the word "list" (in the computer science context) meant "linked list" unless specific qualifications to the contrary were given.
 
5:59 AM
:16398143
 
@JerryCoffin You're right, it's not specific to C++, but the rest of your argument reinforces my assertion that Java has it right (with ArrayList and LinkedList (and other) implementations of a List concept.
 
0
Q: Is there a better way to cache a static property in PHP?

paranoid-androidI have an arbitrary number of classes already extending a base class, and I'd like for each of these extending classes to have a static function with the same name. This function is often very expensive and by nature should only need to be calculated once as its result will always be the same. Th...

 
Er... that did not work at all
 
@chillworld I don't know anything about this "JAVA", but Java is pretty comparable to .NET. Almost any major advantage in either direction comes down to specific versions.
 
Not that Java has naming of things right in all cases, but it is certainly not wrong in this case.
and, C++ has plenty of claims to naming things wrong.
 
6:00 AM
The first is that you can only store objects /* <-there */ in a List (and you cannot store primitives like int, long, double, byte, etc.) @skiwi
 
The constant jibes at Java are unnecessary
There, there's a PHP thing we can poke fun at.
Like, duh, it's a static property, why cache it?
 
@JerryCoffin .net is also not so holy as you think. Take the fileupload of asp.net => you can't get the file his size BEFORE uploading it to your server
 
@Phrancis That's unfortunate thing of Java... an int, etc. is a primitive, the other things are objects
 
so you always get an error there
 
primitives map pretty much 1:1 to memory and are hence efficient, objects reference some other thing in memory
an int maps pretty much 1:1 to your memory, while an Integer (object) has an unique identifier to the JVM, and references an int, hence costing more memory
 
6:02 AM
@rolfl No, Java isn't wrong in anywhere close to all cases--but it is in this particular case. Is there somebody who honestly things (for example) that Lisp was really about manipulation of some sort of generic sequences, not linked lists?
 
@skiwi Sure. I just have no concept of what an object is... as opposed to a primitive... I guess I need to work my way up to
 
time for coffee
 
primitive: byte bytez = 0b00000000;
It uses 8 bits, aka 1 byte, and is stored exactly like that in memory, that's all there is to a primitive on the basic level
object is somewhat harder to explain
 
@chillworld Not sure where you'd get the idea that I think .NET is "holy". If you're developing GUIs for Windows, you can put up with .NET because it's nearly the only framework for which you can get really good tools. Certainly nothing to get particularly excited about though.
 
You can create an Object object = new Object() for example, it only is some abstract object residing somewhere in memory with no 'real' value
The values come into objects by adding variables to them
Every object ultimately can be decomposed into zero or more number of primitives
 
6:05 AM
@skiwi so an object is conceptual (in memory) while a primitive is literal (also in memory)?
 
Sorry, gotta run for work, back in 30
 
In computer science, a list or sequence is an abstract data type that implements a finite ordered collection of values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (potentially) infinite analog of a list is a stream. Lists are a basic example of containers, as they contain other values. Each instance of a value in the list is usually called an item, entry, or element of the list; if the same value occurs multiple times, each occurrence is considered a distinct item. Lists are distin...
Argue with Wikipedia
The underlying implementation of List is independent of the interaction with it.
 
@rolfl *independent :)
 
You seem to be under the impression that List implementations all have to be linked to be 'right'.
meh ;-)
 
Beat me to it
 
6:17 AM
@rolfl Hmmm...Wikipedia being quoted as authoritative source. I think I'd better go away before I get myself in trouble by giving a retort as nasty as that deserves.
Later.
 
SELECT * FROM Brain WHERE Understands = 'Java';
(0) rows affected.
Bye @JerryCoffin
 
0
Q: Iterating over each two consecutive items of a collection

user40171Given a collection of Foos, I'd like to return a new Collection of Bars, according to the following logic: Each Foo has a Type (let's leave it as an int for now, even though it is an Enum in reality) and I should consider each two consecutive items in the given collection: if they are of certain ...

0
Q: Given a BST, transform it into greater sum tree

JavaDeveloperGiven a BST, transform it into greater sum tree where each node contains sum of all nodes greater than that node. Diagram is here. Looking for code review, optimizations and best practices. public class GreaterSumTree implements Iterable { private TreeNode root; public GreaterSumTree(...

 
6:35 AM
Wee, exactly 30 minutes
@Phrancis still around?
 
@skiwi yes, sporadically.
 
Where were we with explanation, objects?
Please close all web browsers before starting install.
 
The part where I'm lost, i.e. are objects
But I think hope I got the jest of it
 
Objects are everything and nothing, your holy grail and the horror, all in one.
2
 
0
Q: is generating the property name of an object bad practice?

tareq $roleId = pg_escape_string($_POST['role']); $grantValue = pg_escape_string($_POST['grant']); $feature = pg_escape_string($_POST['feature']); $permission = pg_escape_string($_POST['permission']); $permissionsModel = new Permissions(); $record = $per...

 
6:39 AM
@Phrancis ^^^that (not Cpt.O)
it's somewhat like your:
WITH Object AS (
      BLA BLA BLA
}
 
@skiwi funny enough, that's the best definition of objects I've heard so far
2
 
They're so good for abstractions, and so horrendous for performance.
 
An object is often a mere container
but the fun part is, an object can do things.
or rather, can tell you you can make me do things
these things depend on the object you have.
 
@Vogel612 if only it were that easy...
 
@Phrancis in fact it is that easy.
 
6:47 AM
Pseudo code: declare wifeTask, make Wife do Laundry
^^ easy
 
You'll be using objects most of the time I'd guess
Except for calculations
 
I feel shame I'm such a at this stuff
 
Don't worry, you'll feel like that for a while
Mastering generics is... hard
 
I feel all this stuff is multiple levels of abstraction above where I'm at right now...
 
well it's simple: Wife myWife = new Wife(); myWife.doLaundry();
 NullPointerException, myWife is null
 
6:54 AM
@Phrancis Start with int a = 2; int b = 3; int c = a + b;
End up with:
static <T extends Enum<T> & IntValuedEnum<T>> Pointer<IntValuedEnum<T>> allocateEnumPointer(final Class<T> enumClass) {
    return Pointer.allocate(Pointer.intEnumType(Objects.requireNonNull(enumClass)));
}
 
@Vogel612 I was thinking along the lines of: SELECT * FROM Person p INNER JOIN Task t ON p.Id = t.PersonId WHERE p.PersonType = 'Wife' AND t.TaskType = 'Laundry';
But yours might be more efficient
 
Oops, I borked down some server now already with too many invalid login attempts.
 
Well you could structure it like that too: Person wife = new Person(PersonType.WIFE); wife.doTask(TaskType.LAUNDRY);
 
^^ that
Now just gotta train my wife to fetch and execute ;)
2
 
@BenVoigt I don't understand what you're getting at. Also there's no static keyword in Java. What is the difference between a nested and an inner class?? — Vogel612 7 secs ago
 
7:10 AM
So many different terms... this time: node... does not compute
 
@Vogel612 Since when is there no static keyword in Java?
 
Rejoice yourselves, there is a const keyword.
 
INSERT INTO Home (Bed) VALUES (SELECT * FROM [The 2nd Monitor] WHERE UserName = 'Phrancis';
Good night
 
And goto.
 
@chillworld can't you just look at the Content-Length header?
 
7:24 AM
@JeroenVannevel Borked...
 
0
Q: Get specific Class from a package including sub packages

chillworldI have the need of getting the Class from a String. The string is just the class his name without the package declaration. While I could use Class.forName(className); this requires me to give the FQN. Here is just where I have the problem. I know its base package : be.chillworld.catalog but thi...

@DaggNabbit I can get the length from the DB but that involves connection to DB (what I find a very useless trafic, cause the length in the DB is prob never changed so you can hard code it)
 
@chillworld oh, thought you were trying to get the size of some uploaded data
(before it's fully uploaded)
 
is this commercial or not?
It says it is but I can just install it from NuGet and use it..
 
@DaggNabbit oh lol was thinking of yesterday. the asp.net problem I don't have anymore, that was at school. I did try and search a lot for that but most solutions just didn't helped me. (I moved the problem to allow 1Gb upload to server and after upload I checked it was not above mine size. Teacher was already impressed that I knew the problem and did search a solution, but the solution wasn't waterproof)
 
@chillworld The way to do it is generally going to be checking the Content-Length header field that gets sent along with POST requests. IDK if asp.net makes that easy, but I assume it's possible. It won't be exactly the size of the file, it'll be the size of the entire request. That's probably what you want, though
 
7:43 AM
@DaggNabbit that could indeed be the solution to that problem. Now back to mine current problem
 
8:16 AM
0
Q: Two while for the same query

AngeloIf I have to loop results of a query, but in the middle of them I want to insert something I don't want to be repeated, I usually repeat the query two times like this <?php mysqli_connect(); $query1 = mysqli_query($con,"SELECT * FROM table"); while($assoc1=mysqli_fetch_assoc($query1)){echo $asso...

 
8:39 AM
Good morning all
 
8:49 AM
good morning @CodeX
 
9:03 AM
morning @CodeX and @Vogel612
 
Hey
Do you know MySQLi and/or php?
 
sorry sql a little bit, php not
 
not really..
we're having PHP in school right now...
but our teacher uses mysql and not mysqli
Welcome to Code Review! We require the code reviewed to be directly in the question. This is due to various reasons, read more here on meta.. Until you edit your question I/we will consider it as off-topic. — Vogel612 1 min ago
incoming missing code question
 
9:18 AM
Ok, trying to work out how to automatically determine the parameters in a prepared statement
why teach you mysql when its deprecated :/
 
0
Q: Improving my jQuery script

user3800667I did a jquery code that works, but I'm novice on jquery and I want to know how to improve my code if possible... Thanks !! Here is my code http://jsfiddle.net/968pA/5/ Thanks again !

 
He "did" a jquery code, i hope i dont step in it..
 
@CodeX still he needs to put it in the question..
so what exactly do you mean??
 
In PDO:
// BIND
public function bind($param, $value, $type = null){
if (is_null($type)) {
switch (true) {
case is_int($value):
$type = PDO::PARAM_INT;
break;
case is_bool($value):
$type = PDO::PARAM_BOOL;
break;
case is_null($value):
$type = PDO::PARAM_NULL;
break;
default:
$type = PDO::PARAM_STR;
}
}
$this->stmt->bindValue($param, $value, $type);
}
I want to do the same in MySQLi
im sure i could do $type = 'i'; or s or b
 
prob somewhat the same....
 
9:24 AM
or d
 
yea.
 
ill try it out
 
and then you go: mysqli_params($type, $params)
or however it's done ;)
 
yep, ;)
and this:
case is_null($value):
$type = PDO::PARAM_NULL;
break;
just NULL?
 
still 150 k triangles to go...
and each 25 triangles give me 62.5 k $
 
9:28 AM
Triangles = $$$'s?
// BIND
public function bind($param, $value, $type = null){
if (is_null($type)) {
switch (true) {
case is_int($value):
$type = 'i';
break;
case is_bool($value):
$type = 'b';
break;
case is_null($value):
$type = NULL;
break;
default:
$type = 's';
}
}
$this->$stmt->bind_param($param, $value, $type);
}
added a double:
case is_double($value):
$type = 'd';
break;
sorted
 
what does that do?
 
nothing..
it's just like 2048
a timekiller.
 
oh know!
wtf
lol
this has distracted me
 
9:49 AM
lol gaming.stackexchange is blocked under games :)
well TTGH :)
I'll work tomorrow already whole day :D
 
0
Q: jQuery multiple drop down validation - re factoring

WebbI have written some jQuery which validates a group of drop downs, it checks the text value selected in all the drop downs (first three characters), if there is a duplicate it warns the user. This code seems quite messy, I was wondering if anyone would like to attempt to re factor this... Here i...

0
Q: small jquery mobile plugin to handle touch events

IazertyuiopI Why this plugin : I am developing a mobile app - at some point, I felt like this would be a good idea to give the users the possibility to control everything in the app with touch gestures, hence the need for a plugin able to recognize more than the basic swipe events. What it does : When t...

0
Q: Javscript getters and setters best practices

user2405469I have very quickly mocked this up as an example model in Angular JS .factory('car', function() { function car(serial, name, type, manufacturer) //intended to be private var serial = serial; var name = name; var type = type; var manufacturer = manufacturer; this.getSer...

 
hey @SimonAndréForsberg
 
10:22 AM
@CodeX I don't think null is a type in mysqli. Not sure though.
 
Ill google it, thanks
 
10:33 AM
This should keep it as a valid NULL
case is_null($value):
$type = NULL;
break;
7
Q: using nulls in a mysqli prepared statement

ceejayozIn a mysqli prepared statement, a NULL gets turned into '' (in the case of a string) or 0 (in the case of an integer). I would like to store it as a true NULL. Is there any way of doing this?

 
10:50 AM
Assert clashes with Debug.Assert, takes no parameters and returns nothing. This is Code Review; you're asking for other programmers' point of view. If I read your code and say "WTF" you can explain all you want, I still WTF'd and that means you have written something that increases your code's "WTF-per-minute" count (the only valid code quality measurement, right?), and got something to fix to make your intent clearer so you don't have to explain everything your code itself could tell all by itself. What you call "regular assertions" are guard clauses. — Mat's Mug 7 mins ago
WTFs per minute indeed. OP is trolling hard.
 
0
Q: Date validation function can be simplified further or is it the correct approach?

3gwebtrainI am doing a date validation. I have no.of pages, which have the date field. User can input the date like "220875" or "22AUG75" - both i need to test and need to check length as well. any expert look in this? my function: function isValidDate(newDate) { newDate[1] = newDate[1]-1; newDa...

 
my collegue next to me is playing counterstrike
Work is fun!
 
0
Q: asynchronous retry method

Ned StoyanovI've written an asynchronous retry method as an answer for this question. I'd like to get your opinion of the implementation and whether there are better ways to implement this. You could also implement this with async-await but I thought this would be a more efficient implementation. public sta...

 
@JeroenVannevel Hehe, interesting workplace
 
11:06 AM
Startups huh
 
0
Q: Refactoring JavaScript functions that differentiate only by condition and return value

Joe SmithCurrently I have 3 functions which are really similar. They differentiate only in input parameter name, condition and return value. I'm going to refactor them, and I thought you guys might tell me what is the best way in your opinion to refactor these. Feels like there has to be 1 function but wi...

 
Hmm, I see 3 others with headphones on
I'm pretty sure they're having a teamgame
 
11:25 AM
Damn, I need to use C#
 
@JeroenVannevel If you cant beat them join them!
 
@SimonAndréForsberg To fix something of a Java program
 
@skiwi It's been proven! C# > Java
 
		if (oSession.HostnameIs("top-secret"))
		{
			oSession.oRequest["Content-Type"] = oSession.oRequest["Content-Type"].Replace("charset=utf-8", "charset=UTF-8");
		}
Nope, even C# cannot help
 
11:38 AM
Hello and Welcome to Code Review! Unknowingly you became the second contestant in our new CR-Game. For more information see rags-to-riches. Feel free to drop by in Code Review Chat or on Code Review Meta ;) — Vogel612 26 secs ago
 
I was just coming here to share that @Vogel612
 
@ckuhn203 (fastest commenter and chat sharer in the west)
 
Lol.
 
got him in the first posts queue
 
That's awesome. I like that someone random found that tag.
 
11:47 AM
@ckuhn203 he didn't T.T
 
Ahhhh.
 
monking
 
Monking too.
 
Monking @all.
Everyone ready for some beer & BBQ? (Stateside at least)
 
Let's make a celebration as soon as we graduate.. Maybe I can even come over to the states / canada...
we all check out @rolfl's estate ♪♪♫
 
11:52 AM
Go to Canada. The people are more friendly there.
 
Go away, we want to keep it that way ...... ;-)
3
Meh, you know you are all welcome.... especially in February
 
why February?
 
@rolfl That's cool. Good powder that time of year?
 
Monking again @rolfl
 
@Vogel612 ckuhn203 got it right.... "That's Cool", It's like, -30 (pick F or C), and many Canadians have snow-goosed to Florida, so we have lots of space, and need the people to warm the country up.
 
12:03 PM
Ughhhh bitwise comparisons....
 
Where? ^^^^
 
I'm learning.
So, in my code.
 
0
Q: Base conversion error in matlab code

green_leafI created the following simple matlab functions to convert a number from an arbitrary base to decimal and back this is the first one function decNum = base2decimal(vec, base) decNum = vec(1); for d = 1:1:length(vec)-1 decNum = decNum*base + vec(d+1); end and here is the other one ...

0
Q: Oauth 2.0 handler functions for Tornado

aviWith Tornado 3.2 they made some updates to auth module and have updated the code. Earlier I was using open id for Google login, since it will be deprecated in the future I am switching the code to Oauth 2.0 login. Also I was using tornado.web.asynchronous, now I have updated the code to use torna...

0
Q: Add number of hours to 24 hour clock

DrahcirThis function adds a number of hours to a 24 hour clock: /** * @param {Integer} now The current hours * @param {Integer} add The number of hours to add */ function addHours(now, add){ var h = (now + add) % 24; return h < 0 ? 24 + h : h; }; addHours(2, 5) //7 addHours(23, 5) //4 ad...

 
12:33 PM
SOOOO HOT HERE!
 
0
Q: C# Basic Entity Framework Repository implementation

AntonHere is simple repository pattern that i use to access data in my database. I whant and advise to improving this codes. Commenting of my code quality is also welcome too! Thanks a lot! public static class ProdRepository { private static Entities context = null; public static Entities ...

 
@CodeX How hot is it?
 
26C
77F
 
12:54 PM
0
Q: First Python Code

user2630270I am kind of new to programming. Picked up some perl about a year ago and now learning some python. I am pretty confident in perl, but python seems un natural to me. I wrote a little script that parses Solr log files and indexes them back to Solr in JSON... this is for some reporting. I wante...

 

« first day (425 days earlier)      last day (3579 days later) »