I am kind of thinking like SteveB
I think that you should shorten up your code a little bit and make it straight to the point
static void Main(string[] args)
{
long result = 0;
for (int i = 100; i < 1000; i++)
{
for (int k = 100; k < 1000; k++)
...
Which part of "It's against my company's policy to give pricing to consumers, you will have to get pricing from a participating dealership" is ambiguous? jackass
The problem:
a Node is located in a specific coordinate (x, y, z).
a Node can be one of these types: None, Hinge, Roll, Fixed. (it is called Boundary Condition)
Different boundary condition type determine a Node's Degree of Freedom.
Here's my code, I have one Abstract NodeBase class and multiple...
I can't make any promises for that. I'll say the same as I told the Code Golf folks - even if I were to say "Yay you guys are on the road the graduating!", there's no guarantee that we'd actually have all the components in place for your wanted time. Right now our site design queue is backed up to I believe 3 sites?
I will say that we're thus far quite happy with how this site is looking now, but without one of us going into a new review session I can't give much stats on that department.
@Vogel612 thank you. I am thinking about someone else's answer on there now. I think that I can optimize their answer with not repeating Multiplication using a more complex for loop.
This library registers a new user. Questions:1. Where should the DB class instantiation happen for user class. I tried instantiation in the constructor but that property doesn't seem to be available to the rest of the user class. As a work-around im creating a new instance with every function tha...
I just know that I would be quite pissed initially if I would need to work together with someone having a different style in the same project... but I could g3t over it I hope
Wondering though for open source projects... Usually when a pull request is being made, the other person has invested quite some work in it. Is it correct to just reject & comment if the coding style is "wrong"?
> I'm tired of it. I have better things to do with my time, things I want to create, software I want to support, hobbies and interests I want to pursue. Debating brace placement, tabs vs spaces (for the umpteenth time), or whether or not annotations have a place in programming in a dynamic language? Not so much.
> It is a very sad thing to see him resign, I can understand his frustration (I stopped reading halfway through the tabs vs. spaces threads due to the level of hostility).
I'm trying to figure out the cleanest way to implement a fluent interface with unique_ptr and other "modern" C++ language constructs. Here's my first attempt:
#include <iostream>
#include <memory>
#include <vector>
// Backported from C++14
template<typename T, typename ...Args>
std::unique_ptr<T>...
> PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data.
Basically, Perl created DBI about 10 years before, and PHP copied it after not learning the perl lessons the first time.
Just for the fun of it, here's a one-liner using LINQ.
Dim names = (From i In {0, 35, 70} Where i < input.Length Select input.Substring(i, Math.Min(35, (input.Length - i))))
Example
Dim names As String() = (From i In {0, 35, 70} Where i < input.Length Select input.Substring(i, Math.Min(35, (i...
Because the parameterized version of PDO queries are easy, and standard, people tend not to do the wrong version which is "select * from " + somecode + " where " + ....
@rolfl If this was my code I would be tempted to write more of it in SQL into a transaction that checks for exiting user name or email, and COMMIT if it they are unique or ROLLBACK if they are not...
I implemented a generic deque data structure.
Deque.java:
import java.util.Iterator;
import java.util.NoSuchElementException;
class Deque<T> implements Iterable<T> {
private class Node<T> {
public Node<T> left, right;
private final T item;
public Node(T item) {
// FIXME: m...
@skiwi I suppose bad wiring could happen if it were handled roughly... LEDs can go out... I suppose electronics (e.g. chip, capacitor, etc.) could fail
@SimonAndréForsberg how would I see if it is parametrized as opposed to... what? Is it that thing you keep saying about not concatenating SQL into PHP?
@skiwi I believe Ctrl + Pause/Break was used in some old MS DOS programs to either pause or terminate. Don't remember. The button is actually used in Age of Empires III to pause the game.
@Phrancis Yes. Parametrized queries are when you use PDO properly, to where you replace all the parameters with either ? or :parametername and call methods on PDO to put the PHP variables there.
You can use PDO and prepared queries without using parametrized queries, which is just as dangerous as if it would be regular concatenated SQL - because it is in that case concatenated SQL.
The following question has been originally posted in stackoverflow.com (original thread here) but i was suggested that Code Review is a better place for these kind of questions, so i decided to move it here.
So I have been writing an event class for my game engine and i came across to the follo...
@ckuhn203 , thank you very much for the bounty!! This really livened things up :-) I will test everything before the end of the bounty and get back to you. Million thanks! — Wim9 hours ago
If you're talking about SQL data types, those are not stored with the data in the schema (e.g. myDatabase.dbo.table but rather myDatabase.INFORMATION_SCHEMA.columns )
consider this $id = $id << This is an array of ID's To delete all rows with the ID's in the array i can do a simple PREPARE, BIND EXECUTE like so. $where = implode(',',$id); $query = 'DELETE FROM wcx_articles WHERE article_id IN (?) '; $stmt = $backend->prepareIt($query); $stmt->bind_param('i', $where);
as all ID's are integers
what if i wanted to delete a string an integer and a double?
I'm implementing the K-nearest neighbours classification algorithm in C# for a training and testing set of about 20,000 samples and 25 dimensions.
There are only two classes, represented by '0' and '1' in my implementation. For now, I have the following simple implementation :
// testSamples ...
where do you put the statements though in SSRS? this is that deal where I want to keep it from running the datasets at all because it will run reports that end in an error because there is no information to query
I've a feeling I'm overdoing my Auth class, and that it could be done in a simple more understandable way?
Could you give me an advice on this, please?
Note this is for my learning process... I just want to learn. This is why I am 'reinventing the wheel'
class Auth
{
protected $pdo;
p...
@200_success no, I found out our IT dept doesn't like when non-IT staff modify their "creations" no matter how bad they are. I should make me a folder and just make my own however unfortunately all I have access to is the web-browser based interface so making reports from there is a PITA.
I'm looking to actually apply for our data services team soon maybe I can get into IT myself and make reports that actually work predictably. You're not going to see SELECT DISTINCT * when I make a report ;)
I did. On an INNER JOIN to two tables, one of which is over one hundred million records deep and 200+ columns wide. No wonder it took like 45 minutes to run.
Well, no one other than me seemed to think that was unusual. All this work just to find duplicate entries? ... how about WHERE COUNT(Serial_Number) > 1overkill
Select * from dbo.contract_detail WITH (NOLOCK) where contract_number = '32749588' and sequence_number = '001' SELECT * from dbo.contract_detail WITH (NOLOCK) where contract_number = '31687032' and sequence_number = '001' UNION ALL
@Phrancis Select * from dbo.contract_detail WITH (NOLOCK) where contract_number in ('32749588', '31687032') and sequence_number = '001' <--- is that better?
It's also very shy on standards... In 3 different tables we have the following primary keys Contract_Number .. Product_ID .. Brand_Codemake-up-your-mind
@Phrancis For the primary key (if one of those are that), I'd agree. For the rest, it often makes sense to keep it as a string. Consider a phone number for example. It should be stored as a string rather than a number.
@SimonAndréForsberg Yes but for indexing it treats VARCHAR funny... like 1234 and 1234567 would be next to each other even though one is orders of magnitude larger
All the SQL is hard-coded into VB and passed ad hoc each time the application calls the db. Which is, constantly. With close to 500 users querying 24/7. It would require a redeploy of all applications after someone goes into to remove all the quotation marks.
It's when you've been staring at your screen for an hour wondering how you're going to shove this Foo into that Bar and still have something that's going to work. But it's not going to work. Then you say "Mu. Unask the question. What's the real problem here." Then it's easy to see that you shouldn't shove Foo into Bar, but you need to refactor them both and add a Baz @CodeX.
I'm trying to loop through android contacts and upload them to our server. What I have now is unusably slow. The query itself is taking about two and a half minutes for 10,000 contacts and it appears to stop parsing data after the first batch.
private static void syncContacts() {
Res...
I'm trying to loop through android contacts and upload them to our server. What I have now is unusably slow. The query itself is taking about two and a half minutes for 10,000 contacts and it appears to stop parsing data after the first batch.
private static void syncContacts() {
Res...
Below is a sample of the CSV file I'm trying to index with Solr (I can't change the first line displaying as a header here). As you can see it has 3 columns of data.
I assumed that it read 4 fields from the first line, but when I take that out it throws an error saying the document is missing a...
@Phrancis I don't know how bad they are in SQL, but in Java they can be necessary. There is a Cursor class somewhere that is used for iterating through the resultset.
@Nobody Never mind, just an ordinary @Nobody joke.
Sounds like that Android guy could use some more SQL in his life. Seems overkill to make a Cursor to go through that many records, it would be a trivial task even for MySQL engine to move all this data at once
@ckuhn203 even systems that don't have friend lists use it for data mining though. If a bunch of your contacts are interested in X, they are going to assume you might also be interested in X
and again not just your contacts but people who have you in their contacts
@SimonAndréForsberg in SQL you want to avoid cursors unless absolutely necessary. Imagine his 150,000 records, suppose you have one INSERT INTO .. SELECT query that takes 5 seconds to do on the the whole table at once, your execution time with a cursor instead would be approximately (150,000 * 5) seconds
@Phrancis But if he wants the data to his Android app, then he needs to use a Java-Cursor to do the iteration. I don't think a Java-cursor is the same as a SQL-Cursor.
But all the SQL cursor does, basically, is take the query you write inside the cursor, and go through the dataset(s) and executes the query once for each record, so you can imagine how slow it is
I'm a beginner in js and I am sure that there is a better way to do it (basic one minute timer from 01:00 to 00:00 running from pageload):
window.onload=function(){
(function(){
setInterval(function(){
cro();
document.getElementById('unminut').innerHTML="0"+jocminut+":"+jocsecunda...
Phrancis, Simon, the Java implementation of JDBC to the database imposes a virtual cursor on every resultset. Sometimes that virtual cursor is implemented with a real cursor on the database.
So, even running something like "select * from customers" has a Cursor.
Also, Oracle, only had cursors available for a while, IIRC.
@rolfl this code is giving me an error I haven't seen before. Trying to emulate a cursor-like behavior on SEDE
DECLARE @start INT = 1, @stop INT = (SELECT MAX(User.ID) FROM Users)
WHILE @start < @stop
BEGIN
SELECT User.Id, User.Reputation FROM Users WHERE User.Id = @start
SET @start = @start + 1
END
Cannot call methods on nvarchar.Cannot call methods on nvarchar.
But you get the idea. In this case if @stop INT = (SELECT MAX(User.ID) FROM Users) was 10,000 then it would SELECT User.Id, User.Reputation FROM Users WHERE User.Id = @start 10,000 times (assuming continuous User.ID)
DECLARE @start INT = 1, @stop INT;
select @stop = MAX(User.ID) FROM Users;
WHILE @start < @stop
BEGIN
SELECT User.Id, User.Reputation FROM Users WHERE User.Id = @start;
select @start = @start + 1;
END
Note, additional semicolons everywhere, and change set to select.
I get confused where to put semicolons in SQL Server
I tried your method but got the same error
OK it looks like the RDBMS that's installed with Android software is SQLite. I would be tempted to take the user data, shove it into a temp table or extract it to a file, and pass that along to the server... thoughts?