instruction
stringlengths
71
71.9k
Here is my code. It works fine but I need to make the code more efficient. def o(s): l=len(s) return len(set([a+b+c for a in s for b in s for c in s]) )==l*(l+1)*(l+2)//6 M=int(input()) N=3**M i=1 s=M*[i] while i: if s[i]-N: s[i]=s[i]+1 if o(s[:i+1]): ...
I have written a Manchester Encoding encoder / decoder based on my misconception of how it works (whoops). My encoder accepts an array of ones and zeroes, and returns the 'manchester encoded' data (pretending there is a constant clock to overlay onto the data). I am reasonably new to C++, and would like to advance my k...
I made this program in C that tests if a number is prime. I'm as yet unfamiliar with Algorithm complexity and all that Big O stuff, so I'm unsure if my approach, which is a combination of iteration and recursion, is actually more efficient than using a purely iterative method. #include<stdio.h> #include<stdlib.h> #incl...
This is one of codeeval challenges Challenge Description: Credits: Programming Challenges by Steven S. Skiena and Miguel A. Revilla The problem is as follows: choose a number, reverse its digits and add it to the original. If the sum is not a palindrome (which means, it is not the same number from left to right...
I am learning from C++ Primer 5th edition. This is exercise 5.17: Given two vectors of ints, write a program to determine whether one vector is a prefix of the other. For vectors of unequal length, compare the number of elements of the smaller vector. For example, given the vectors containing 0, 1, 1, and 2 and 0, 1, ...
Essentially I'm attempting to select the top read (based on read_date), and check if it has a type in ( 'R','S','C','B','Q','F','I','A') select * from ( select * from ( select * FROM table WHERE id = 369514 order by read_date desc ) where...
I've nearly got this working. I wanted to know if there is a much better way. One problem is that no matter what there will be cases where a URL is incorrectly identified and as such the end result will be dependent on requirements. My requirements are lackadaisy, I just want something that works most of the time. ...
I am thinking of writing some online notes/book. Amongst other things, I want to use Backbone to show different sections within a chapter as separate views. In other words, I want each chapter to behave like a single page application; different chapters will behave as separate single page applications. Within a chapt...
I wanted to write a script, which starts a rails app, and opens it in the browser. I'm trying to implement this in a peculiar way though - I expect two things: the script must wait until the server is started, then open the browser within a short time when I stop the script (Ctrl+C), the server process must stop. The...
This is a function designed to return all the prime factors of a given number, in sorted order from least to greatest, in a list. It relies on another function that checks if a given number is prime. Here is the prime checking function: def isPrime(x): if x <= 1 or isinstance(x,float): return False else...
I've hacked a method that auto-fits text into an Imagick image, given a bounding box: the image's width (minus optional margins) and a certain maximum height. What it does is find the optimal font size and line lengths within the bounding box. It's still a work in progress (still needs thorough checking of the validity...
I wrote an FAQ on a third-party website which pertains to thread-protecting objects in Delphi. What I'd like to know is if this thread-protection approach is accurate, or if I should change anything about it. I don't intend to ask about the FAQ in general, just the aim at the actual topic of multi-threading. This code ...
Which of the following is cleaner / more adopted standard of handling exceptions while coding a stream ? I would also appreciate a reason why one of the following trumps over other ? In my opinion I find option 1 better but nested try where first try does nothing more than a wrapper is making me not satisfied with app...
I have written a custom endless/infinite scroll, which allows the user to load images as they scroll down. How can i make this code below modular and easily reusable? <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Endless Scroll Flicker feed test 2<...
Consider an interface: public interface IWindowOperations { // Some operation methods. } Class definitions: public abstract class BaseWindow<T> : IWindowOperations { // partially implemented class. } public class TraditionalWindow<T> : BaseWindow<T> { // Fully implemented class. } public class ModernWin...
I'm having an argument with my boss about whether or not it's better to have a separate function for a single line of code. The code reads something like: while (count <= poscount) { key = etc.substr(pos2prev+1, pos-pos2prev-1); std::string::iterator end_pos = std::remove(key.begin(), key.end(), ' '); key.e...
I need to call a function exactly at certain hour, daily, my programs runs 24/7. I wrote the following timer mechanism, which generally works that way: Calculate time until hour and generate timer with that interval. When timer elapse, call timer event and generate another 24h timer. Go back to step 2. private stat...
The following code takes a decimal number and gives its IEEE 754 floating point representation. However, the code is not complete and I am totally fine because it does the job for me: It does not consider negative numbers. The input number is not a fraction. Its always in the form xx.yy As of now, it does not give r...
I have created a function using jQuery Ajax which create a new CSS element whenever I update the database using a form. Is it ok? If not, hat can be the best method to do it? $(document).ready(function(){ $('#statusupdater').submit(function(e) { updatestatus(); e.preventDefault(); }); }); func...
I would like some feedback on the appropriate way of ordering a numerical list using the most elementary scheme functions (sorry, i realise that elementary is not well defined). By way of background: I've been learning a bit of scheme on my ipad, where I have only a basic implementation -- this is a nice challenge as...
I have a static class: public static class ConfigurationDetails { public static string SharepointServer { get; set; } public static string Username { get; set; } public static string Password { get; set; } public static string SharepointDomain { get; set; } public static string ServiceLibrary { get;...
I have the following structure: struct Keys { //value of word in the vector<string> words. string word; //index of word in the vector<string> words. int index; //I want to compare the element **word** of the structure, this is why i overloaded the operators //After Editing bool operator>(const Keys...
I have a form that I feel I am overcomplicating because of the relationship between models that are involved. Can you let me know if there's a more elegant solution to what I have? (for reference) The form ultimately looks like this: The relationship between the involved models: user_relation has_many :user_relation_...
I'm working on implementing a syntax highlighter for a simple text editor I've been working on. To do this, I need a simple lexer for various languages (I don't need a full one - I'm only interested in highlighting things like comments, strings, numbers and keywords). The way my editor component works is it highlights ...
I'm trying to solve 15 puzzle using A* algorithm, but something really bad goes on in my get_solution() function that ruins performance. I guess there is a too much usage of maps in here, but I don't understand why it slows down my program so much. What do you think? I would be really happy if you could review my codi...
This code completes under a second, however its seems like I've taken the "Mr. Bean" way around getting there. The goal is to get the average number of orders processed in a single day based on how many days exist in the current database. The loadcount column represents how many orders are processed in a single batch. ...
As explained here, I'm learning a limited subset of Scheme. My task has been to sort a numerical list. To implement a simple insertion sort, I need to remove a single element from a list. I've done the following (in the spirit of The Little Schemer): (define remove-elem (lambda (ll elem) (cond ((null? ll) '...
I've been reading too many papers and writing too little code. These are my first 300 lines of Haskell: {-# LANGUAGE NoMonomorphismRestriction, TemplateHaskell #-} module Forth where import qualified Data.Map.Lazy as Map import Control.Monad.State import Control.Monad.Error import Text.Read (readMaybe) import Text...
I am trying to simplify my code, which will do several things: Give the same width to every columns no matter how many columns the table has. Add input field if there is no text inside a td Make sure the input field is no wider than its table cell Make sure, if the input field has size attribute, the input field size ...
I am studying the composite pattern and have created a very simple project that uses composite to introduce family members. I have decided to go with the 'fully transparent' implementation by defining all of my common functions in the interface class, I feel this is the neatest implementation and am considering throwin...
public void something() { Session session = HibernateUtil.newSession(); AModelDAO amd = new AModelDAO(session); BModelDAO bmd = new BModelDAO(session); Transaction tx = session.beginTransaction(); amd.savesomething(object); bmd.savesomething(object2); tx.commit(); session.close(); } I ...
I am pretty new to iOS development - I'm writing an app the uses web services, pretty extensively. With that in mind, I decided to use AFNetworking 2.0 and subclass AFHTTPSessionManager. I created a method to build a URL for me - based on NSDictionary parameters and then I use the URL with the parameters to execute a ...
I've got a string that has values that are delimited by comma's, like so: $var = '1,23,45,123,145,200'; I'd like to get just the first value, so what I do is create an array from it and get the first element: $first = current(explode(',', $var)); Fine enough. But this string can sometimes contain perhaps hundreds of ...
Even Fibonacci numbers Problem 2 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the...
As a challenge I decided to do the following problem: How many different numbers with n digits are there whose digits add up to k? As this is an embarrassingly parallel problem I decided to use a bit of GPGPU programming (partly for learning purposes) using C++AMP and came up with the following solution: #include <io...
public static DateTime NextByDayOfWeek(this DateTime target, IEnumerable<DayOfWeek> validDaysOfWeek) { validDaysOfWeek = validDaysOfWeek .OrderBy(item => item); var nextDayOfWeek = validDaysOfWeek .Where(item => item > target.DayOfWeek) .FirstOrDefault(); return nextDayOfWeek != 0 ...
I have wrote a simple util to submit my code to a online judge site, how to avoid the evil function? (setq url-proxy-services '(("http" . "localhost:8888"))) (setq debug-on-error t) (require-package 'http-post-simple) (require 'http-post-simple) (eval-when-compile (require 'cl)) (defstruct form action (method "POST"...
I have created a module/factory/directive for AngularJS which allows to save user input to localStorage and restore it if needed. Although it works quite good, I am sure that I could improve its code base and am looking for advice to do so. It can be found on github: https://github.com/sprottenwels/saintAnthony.js Code...
So I was trying to do this exercise from Tour of Go. I managed to get it working. I am not at all sure that it is correctly concurrent or idiomatic (I started learning Go, like, 4 hours ago). I would really appreciate feedback about my solution. Here's the relevant meat of the code. Full code available below. type urlT...
I'll gladly appreciate it if you could review my code below and let me know if they are sufficiently secure. My main website and these scripts will use same database, so I need to make sure they are sufficiently secure before I put them live. Since I cannot post more than two links, I'll post my Anti-SQL Injection scri...
Given a particular Date, want to find the next occurring Friday. I solved it using the below code. Various tested scenarios work good for me. Are there any boundary conditions the code might break? Can it be written any better? function dates() { var dayOfWeek = 5;//friday var date = new Date(2013, 10, 13...
This was a revision, made when the code failed after an update (at least that is what I think happened). So I fixed it and now it works, but I think that this code can be written better and more efficiently, and perhaps made easier to read. Note that VBScript/VBA/VB6 isn't (aren't) my primary language(s), the closest t...
I have a piece of C++ code that transforms a vector where an element only stays one if itself and both of it's neighbors are one as well. End-points are handled as if the missing element is one. For example: old: 1 1 0 1 1 1 0 1 1 0 new: 1 0 0 0 1 0 0 0 0 0 The following block of code works, but I'm not sure if it is ...
I am helping a friend with her Java homework and I adapted a solution I used in a similar project of my own for this. It is supposed to use loose/generous regex to make sure an email entered matches the forms abc123@xyz.net or abc.123@xyz.net. import java.util.Scanner; public class App { Scanner scanner; pub...
Requires Underscore and jQuery I'm looking for suggestions on how to make this a little more readable and additional suggestions on flow, logic, etc. The game can be run in a browser by just copying and pasting the code(HTML/JS/CSS) below. JavaScript: app/js/app.js var Utils = { rules: { isHorizontal: fun...
I have recently written this Minesweeper game in Python: import random class Cell(object): def __init__(self, is_mine, is_visible=False, is_flagged=False): self.is_mine = is_mine self.is_visible = is_visible self.is_flagged = is_flagged def show(self): self.is_visible = True ...
I have the following declaration in my String.h file: private: char* nstring; int nlength; }; The following are three constructors I've implemented in String.cpp. I would like these to be reviewed. // Default constructor for this class. Initializes an empty string. string::string() { nlength = 1; // for "...
I have implemented a DOM parser. I would like any comments for optimizing, improving, and making the code coherent to best coding practices. final class Node { private final String nodeName; private final String nodeValue; private final NodeTypeEnum nodeType; private final Map<String, String> attribute...
dem_rows and dem_cols contain float values for a number of things i can identify in an image, but I need to get the nearest pixel for each of them, and than to make sure I only get the unique points, and no duplicates. The problem is that this code is ugly and as far as I get it, as unpythonic as it gets. If there wou...
I am solving this problem on SPOJ Upper Right King (Hard): There is a king in the lower left corner of the \$ n \times n \$ chess board. The king can move one step right, one step up or one step up-right. How many ways are there for him to reach the upper right corner of the board? Give the answer modulo 1000003. The...
Trying to write a substring function in Clojure. I am sure there is a more idiomatic way. Can anyone enlighten me? Otherwise, here is my version. Thoughts? (defn substring? "is 'sub' in 'str'?" [sub str] (if (not= (.indexOf str sub) -1) true false))
I'm using ABCPDF (Version 8) to update an existing PDF document and I believe its API is hurting me in this situation and was curious whether anyone had any comments on how this looks as it appears ugly to me. The situation: I am replacing pages in PDF documents that are all generated by an in-house process so I can re...
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>QR code generator</title> <style> body { font-family: arial, sans-serif; } section { margin: 50px auto; max-width: 350px; text-align: center; } textarea { width: 100%; height: 50px; margin-bottom: 10px; } #size { max-width: ...
i am looking for a faster and more efficient way of this code. What the code does is simply compares message context of (user, application, service and operation) and compares it with some rules. private boolean match(Context messageContext, ContextRule contextRule) { if(contextRule.getMessageContext().getUser(...
I am writing a simple image rotation script. Users press either the prev or next button to view the previous or next images. It works well, but the code looks over the top. Is there a way I can reduce the amount of code used? index.php <div id="container"> <img src="pic1" id="pic1" class="top-pic" alt="" /> <img src="p...
I presented a code solution to a startup as part of their interview polity. The problem statement is to find the frequency of words occurring in a sentence. I got the code rejected saying, "Evaluating code is always subjective, but people generally leave a "fingerprint" with their design approach and the nature of the...
I keep using a pattern in ruby over and over again. Here are some examples: def get_row_numbers_for_id(id_to_search_for) @results = [] (0...row_count).each do |row| get_row(row).css('td').each do |cell| @results << row unless row.nil? if (cell['id'] == id_to_search_for) && !(cell.to_html =~ /cont...
I put together a sample of how I am using the Unit of Work & Repository pattern based on my understanding. Can anyone please let me know if I am implementing this the correct way? If I am not, how can I improve it? I have an EF model with two entities: Topic and Subtopic. The EF model is called CommonGood. Unit of Work...
This is bit long, but I need to explain something before I can ask for actual reviews/advice. I have to test generated C code from Matlab Simulink model. I can create a executable binary from those. I need to test this application using tests developed using Python scripting. I came up with following approach: inter-p...
The overall intent is to consolidate individual sales transactions to total debits/credits summing up the totals by year and month--retaining a running balance from start to end. This code uses multiple #temp tables. I am interested in having this code reviewed in order to find a more efficient way to achieve this. The...
I have a backup job that walks across a huge directory with potentially millions of files. Python's os.walk() works just fine. Now, I have implemented a feature to ignore files based in a black list of patterns. I just want it to behave like a .gitignore file. Currently I do this: import os from fnmatch import fnmatch ...
My homework was to organize semaphores into a pyramid. The task was accomplished, but I ended up with this long ugly conditional and was wondering if anyone can see a better way/algorithm to accomplish the same thing. if (me==0) { wait_sem(semaphore[1]); wait_sem(semaphore[2]); signal_sem(semaphore[0]); } ...
This program takes a huge data set as input, processes it, calculates and then writes the output to an array. Most calculations may be quite simple, such as summation. In the input file, there are about 100 million rows and 3 columns. first column is the name of the gene (total 100 millions) second column is the spec...
I was trying another approach of sorting a linked list. Aside from the available methods, I've decided to take each node from the linked list and place it into an array. With that, I would be able to compare the data variables easily. I applied quickSort() on the array, and this is what I have. I would appreciate any...
Simplification of code would be appreciated. var textarea = document.getElementById("textarea"), statusBar = document.getElementById("status-bar"), inputFile = document.getElementById("input-file"), appname = "notepad", isModified = false, showStatusBar = true, filename; function changeDocTitle(newFilename...
I wrote this method that does the job and passes the assertion tests for a large java backend project but I'm not all happy with the way it reads, perhaps you can tell me how to refactor and/or improve this method? public Set<ProductOfferingJsonDto> getJsonProductOfferings() { Set<ProductOfferingJsonDto> set = new ...
Ever since reading Crockford's "Good Parts" and Johansen's TDD book, I have wanted to use more of the differential inheritance pattern in my coding at work (as in avoiding new by using Object.create()), but I find that I am having a hard time argumenting for the clearness of the code when trying to make "types" that ca...
Me and my colleagues do a small TDD-Kata practice everyday for 30 minutes. For reference this is the link for the excercise http://osherove.com/tdd-kata-1/ The objective is to write better code using TDD. This is my code which I've written public class Calculator { public int Add( string numbers ) { c...
The problem is not very complicated (I mean it is easy to solve it), but the question is how to make it in the easiest way (Java) Input String: String inputString = "[value=20][param=304.2][indicator=1500]"; Expected output: array of doubles : [20.0][304.2][1500.0] Sample solution: String[] chunks = inputString.split...
I have the following tables: player | id | name | surname | |:-----------|------------:|:------------:| | 1001 | Mike | Tyson | | 2001 | John | Carlin | | 3001 | Dan | StanH | | 4001 | Alen | Derl | ...
Wanted some opinions on something I have been working with, I've tried a few ways of structuring the way I retrieve and return data to my WebAPI, and I'm pretty happy with what I have so far, but I was looking for a comparison of the pro's and con's of using models vs entities for returning data on the WebAPI. In my op...
This is a query to return search results, but I feel it could be cleaned up a little. I just don't know how. var queryResult = (from r in dc.Retailers where (string.IsNullOrEmpty(firstName) || SqlFunctions.PatIndex(firstName.Trim(), r.FirstName.Trim...
I want to return a list of the values from the binary tree. Is there a shorter and more efficient way to write the method for numbers? class BTNode(object): """A node in a binary tree.""" def __init__(self, item, left=None, right=None): """(BTNode, object, BTNode, BTNode) -> NoneType Initializ...
I've looked at boost::exception and realized it is too advanced for my project, as my colleagues mostly have legacy C background. I do not need arbitrarily complex information in exception, just some error messages and trace info that can be written to process log. Someone on Stack Overflow wrote such code as an exampl...
I'm working on a simple decorator that creates and manages a database cursor. The goal is to 'inject' the cursor as the first argument of the function, but not expose it to the caller. Usage: import psycopg2 @needsNewCursor def findItem(cursor, item_id): cursor.execute('SELECT name FROM items WHERE id = %s', [ite...
I've been working on this word search algorithm and had some issues about its speed. It kinda looks like it takes a little too much time. If anyone could offer suggestions on making this better and improving my skills, that would be great. #include <iostream> #include <string> #include <fstream> using ...
I have a working solution for the given problem of A/B Optimization, but you as an experienced Python (3) developer will agree with me, that this solution is not very pythonic at all. My Question here is: How do I make this code more pythonic? It's a very procedural process that one would expect from a Basic program, b...
I'd like to simplify this Scala code: private def getToken() = { val token = getTokenFromDb() token match { case Some(x) => token case None => { val remoteToken = getTokenRemote() remoteToken match { case Some(x) => { writeTokenToDb(x) remoteToken ...
I have written this code which finds duplicate numbers and the occurrence of a particular number in an array. I have used a HashMap, but I want to know if there is a more efficient way to do the same, or whether I should be using another method. import java.util.*; class test7 { public static void main(String ...a)...
I posted a couple of weeks ago with a double linked list. It was recommended that I rewrite the code as a singlely linked list and replace the recursive parts with loops. I've gone ahead and made several edits and was hoping to get another critique of the code. #include <stdio.h> #include <stdlib.h> #include <stdbool....
I write quite a bit of code in C, but haven't done much C++ since my college CS classes. I have been revisiting C++ recently, and thought I would re-implement a program I had previously written in C, but this time in C++. I particularly took advantage of containers and other features standardized recently by the C++11 ...
I'm going to post some of my solutions to common interview questions. I would love it if you could critique me from a C++ purist's standpoint. Also, tell me if there's a better algorithm for each one of these. Find the mode (most common element) of an array. Note: My solution returns an arbitrary mode if there's a tie...
var textarea = document.getElementById("textarea"), statusBar = document.getElementById("status-bar"); function updateStatusBar() { var text = textarea.value, chars = text.length, words = text.split(/\b\S+\b/g).length - 1, lines = text.split("\n").length; statusBar.value = line...
I'm making a database program that reads from a file info on tennis players. Everything works, but is there a simpler way of doing this? Is there anything I can improve here? #include <stdio.h> #include <string.h> #include <stdlib.h> const int MAX_PLAYERS = 5; struct player { char *fullname[2]; int age; ...
I wrote a small Java class with documentation that is going to be a part of a library I am writing. I learned Java as my first programming language from many different sources on the web, and therefore I have developed my own style without any direct criticism along the way. So I would like some feedback on the class b...
I've written some code to solve this problem: Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. My solution functions correctly, but I'm having some trouble deciding how I should be handling exceptions, especially with regards to the class's constructor. I went the route of creat...
Might there be a simpler way to write this code? I'd like to learn to write code more efficiently. def leaves_and_internals(self): """(BTNode) -> ([object], [object]) Return a pair of lists: (list of all the items stored in the leaves of the subtree rooted at this node, list of all the items stored in the ...
In an old project I tinker with from time to time, I have a DOM-like structure in an MMF database. I'd like the nodes to act like they have some C++ typing based on the content, and accessor methods that go along with that. Yet in actuality, the data is independent of the type system in C++. The problems with trying ...
I started learning OOP in JavaScript at school and I have to do my homework in OOP. It is a shopping list, one fills in a product and price and that is put into an array, the array its contents are put in a table in HTML. The list also has got delete buttons for every product, I have thought about using this in JavaScr...
I understand that if you don't know the trick, it's not easy create a solution with a complexity of \$O(N)\$. However, I would like to ask you how to solve this tricky question: You are given two non-empty zero-indexed arrays A and B consisting of N integers. Arrays A and B represent N voracious fish in a river, orde...
I've tried to write a configurable OOP-style FizzBuzz program in PHP for learning purposes. I hope everything is quite easy to understand. What do you think of the overall architecture? Are OOP principles kept well? What can be improved? How could error-handling and input-checking (i.e. currently you can break the pro...
I've just created a script in Google Spreadsheet in order to archive some things. I have data from four countries. If something is marked done, then that line could be archived into that country's archive. My code is pretty ugly. Is there a clearer way to do this? function CroatianArchive() { var source_sheet = S...
I have coded my own lightbox for the sake of my own custom needs because I want to be able to do this kind of thing myself and learn all the various things involved. I realize I could use a plugin, but that is not the point here. Last week I posted this vague question to get some feedback on the style, and ultimately t...
How do I improve the below code, which takes input from a file and does some word analysis? I find a lot of redundancy in it. I want to know a better way of implementing it. analysis = {} wordanalysis = {} found = True for line in sys.stdin: (n1,n2,n3,n4,n5,n6) = re.split("\t+",line.strip()) tweet = re.split("...
My project uses at least 100 helper classes like the below: .pa5 {padding:5px} .pa10 {padding:10px} /* ... */ .pt5 {padding-top:5px} .pt10 {padding-top:10px} /* ... */ .pr5 {padding-right:5px} .pr10 {padding-right:10px} /* ... */ /* ... */ It comes handy in some cases like <div class="pa10">...</div> but I think we o...
I need help making this code run faster. I am using it to import a CSV file into Excel. It works, but it is very slow. The file is almost 20MB. {Sub OpenTextFile() Dim FilePath As String Dim linitem As Variant FilePath = "filepath.txt" Open FilePath For Input As #1 row_number = 0 Do Line Input #1, LineFromFile LineIt...
So I introduced myself to templates in C++11 and I have to say it's really confusing, but also very fascinating. I just need to get my head around what happens at compile time so that I don't wind up making one line of driver code amount to a megabyte of asm... Anyway, to teach myself I wrote a little container class....
I want to collect all fields which have given Modifier(s) of a class. I have written following pieces of codes: /** * Method getFields * @author TapasB * @since 03-Nov-2013 - 2:03:17 pm * @version DAM 1.0 * @param instanceClass * @return */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static List<Field>...
I've got a JavaScript object and I am not sure how to implement the last part: adding up all of the prices and putting that in the last row of the table. Besides this question, I would also like to ask you to look at the code and advice me if I can make the code slimmer, less lines of code. This is the code I would lik...
I have the following SQL. I want to make that the SP should work under load. Means it should not have any synchronization issues. ALTER PROCEDURE [dbo].[DeleteOldDeviceID] ( @OldDeviceID VARCHAR(500) ,@NewDeviceID VARCHAR(500) ) AS BEGIN SET NOCOUNT ON; DECLARE @TranCount INT; SET @TranCount = @@TRANCOUNT; BE...