Search Results

Search found 1533 results on 62 pages for 'rdbms agnostic'.

Page 12/62 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • When/Why to use Cascading in SQL Server?

    - by Joel Coehoorn
    When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it? This probably applies to other databases as well. I'm looking most of all for concrete examples of each scenario, preferably from someone who has used them successfully.

    Read the article

  • Database/NoSQL - Lowest latecy way to retreive the following data...

    - by Nickb
    I have a real estate application and a "house" contains the following information: house: - house_id - address - city - state - zip - price - sqft - bedrooms - bathrooms - geo_latitude - geo_longitude I need to perform an EXTREMELY fast (low latency) retrieval of all homes within a geo-coordinate box. Something like the SQL below (if I were to use a database): SELECT * from houses WHERE latitude IS BETWEEN xxx AND yyy AND longitude IS BETWEEN www AND zzz Question: What would be the quickest way for me to store this information so that I can perform the fastest retrieval of data based on latitude & longitude? (e.g. database, NoSQL, memcache, etc)?

    Read the article

  • Database Optimization techniques for amateurs.

    - by Zombies
    Can we get a list of basic optimization techniques going (anything from modeling to querying, creating indexes, views to query optimization). It would be nice to have a list of these, one technique per answer. As a hobbyist I would find this to be very useful, thanks. And for the sake of not being too vague, let's say we are using a maintstream DB such as MySQL or Oracle, and that the DB will contain 500,000-1m or so records across ~10 tables, some with foreign key contraints, all using the most typical storage engines (eg: InnoDB for MySQL). And of course, the basics such as PKs are defined as well as FK contraints.

    Read the article

  • mySQL: How many rows in a table before performance is affected?

    - by Industrial
    Hi everybody, Is there a "known limit" for columns & rows in a mySQL table that when passed, it can be safe to say that performance is severely affected? I've think that I had heard that there is a "golden number" that you really dont want to exceed in either columns or rows in a table. - Or is it all about the size of the index and available RAM + CPU on the server? Thanks!

    Read the article

  • What is the MVC version of this code?

    - by Ian Boyd
    i'm trying to wrap my head around how to enterprise up my code: taking a simple routine and splitting it up into 5 or 6 methods in 3 or 4 classes. i quickly came up three simple examples of code how i currently write it. Could someone please convert these into an MVC/MVP obfuscated version? Example 1: The last name is mandatory. Color the text box red if nothing is entered. Color it green if stuff is entered: private void txtLastname_TextChanged(object sender, EventArgs e) { //Lastname mandatory. //Color pinkish if nothing entered. Greenish if entered. if (txtLastname.Text.Trim() == "") { //Lastname is required, color pinkish txtLastname.BackColor = ControlBad; } else { //Lastname entered, remove the coloring txtLastname.BackColor = ControlGood; } } Example 2: The first name is optional, but try to get it. We'll add a bluish tint to this "try to get" field: private void txtFirstname_TextChanged(object sender, EventArgs e) { //Firstname can be blank. //Hint them that they should *try* to get it with a bluish color. //If they do enter stuff: it better be not all spaces. if (txtFirstname.Text == "") { //Nothing there, hint it blue txtFirstname.BackColor = ControlRequired; } else if (txtFirstname.Text.Trim() == "") { //They entered spaces - bad user! txtFirstname.BackColor = ControlBad; } else { //Entered stuff, remove coloring txtFirstname.BackColor = SystemColors.Window; } } Example 3 The age is totally optional. If an age is entered, it better be valid: private void txtAge_TextChanged(object sender, EventArgs e) { //Age is optional, but if entered it better be valid int nAge = 0; if (Int32.TryParse(txtAge.Text, out nAge)) { //Valid integer entered if (nAge < 0) { //Negative age? i don't think so txtAge.BackColor = ControlBad; } else { //Valid age entered, remove coloring txtAge.BackColor = SystemColors.Window; } } else { //Whatever is in there: it's *not* a valid integer, if (txtAge.Text == "") { //Blank is okay txtAge.BackColor = SystemColors.Window; } else { //Not a valid age, bad user txtAge.BackColor = ControlBad; } } } Every time i see MVC code, it looks almost like random splitting of code into different methods, classes, and files. i've not been able to determine a reason or pattern to their madness. Without any understanding of they why it's being one some way, it makes no sense. And using the words model, view, controller and presenter, like i'm supposed to know what that means, doesn't help. The model is your data. The view shows data on screen. The controller is used to carry out the users actions And oranges taste orangy. Here's my attempt at splitting things up in order to make the code more difficult to follow. Is this anywhere close to MVC? private void txtFirstname_TextChanged(object sender, EventArgs e) { FirstnameTextChangedHandler(sender, e); } private void FirstnameTextChangedHandler(sender, e) { string firstname = GetFirstname(); Color firstnameTextBoxColor = GetFirstnameTextBoxColor(firstname); SetFirstNameTextBoxColor(firstnameTextBoxColor); } private string GetFirstname() { return txtFirstname.Text; } private Color GetFirstnameTextBoxColor(string firstname) { //Firstname can be blank. //Hint them that they should *try* to get it with a bluish color. //If they do enter stuff: it better be not all spaces. if (firstname == "") { //Nothing there, hint it blue return GetControlRequiredColor(); } else if (firstname.Trim() == "") { //They entered spaces - bad user! return GetControlBadColor(); } else { //Entered stuff, remove coloring return GetControlDefaultColor(); } } private Color GetControlRequiredColor() { return ControlRequired; } private Color GetControlBadColor() { return ControlBad; } private Color GetControlGoodColor() { return ControlGood; } //am i doin it rite i've obfuscated the code, but it's still altogether. The next step in the MVC obfuscation, i gather, is to hide the code in 3 or 4 different files. It's that next step that i don't understand. What is the logical separation of which functions are moved into what other classes? Can someone translate my 3 simple examples above into full fledged MVC obfuscation? Edit: Not ASP/ASP.NET/Online. Pretend it's on a desktop, handheld, surface, kiosk. And pretend it's language agnostic.

    Read the article

  • When is it better to offload work to the RDBMS rather than to do it in code?

    - by GeminiDomino
    Okay, I'll cop to it: I'm a better coder than I am at databases, and I'm wondering where thoughts on "best practices" lie on the subject of doing "simple" calculations in the SQL query vs. in the code, such as this MySQL example (I didn't write it, I just have to maintain it!) -- This returns the username, and the users age as of the last event. SELECT u.username as user, IF ((DAY(max(e.date)) - DAY(u.DOB)) &lt; 0 , TRUNCATE(((((YEAR(max(e.date))*12)+MONTH(max(e.date))) -((YEAR(u.DOB)*12)+MONTH(u.DOB)))-1)/12, 0), TRUNCATE((((YEAR(max(e.date))*12)+MONTH(max(e.date))) - ((YEAR(u.DOB)*12)+MONTH(u.DOB)))/12, 0)) AS age FROM users as u JOIN events as e ON u.id = e.uid ... Compared to doing the "heavy" lifting in code: Query: SELECT u.username, u.DOB as dob, e.event_date as edate FROM users as u JOIN events as e ON u.id = e.uid code: function ageAsOfDate($birth, $aod) { //expects dates in mysql Y-m-d format... list($by,$bm,$bd) = explode('-',$birth); list($ay,$am,$ad) = explode('-',$aod); //Insert Calculations here ... return $Dy; //Difference in years } echo "Hey! ". $row['user'] ." was ". ageAsOfDate($row['dob'], $row['edate']) . " when we last saw him."; I'm pretty sure in a simple case like this it wouldn't make much difference (other than the creeping feeling of horror when I have to make changes to queries like the first one), but I think it makes it clearer what I'm looking for. Thanks!

    Read the article

  • ??1???????????????!???????????????|Oracle Coherence|??????

    - by ???02
    ????????????3????????????????????????????3??????????????????????????(?????????1?????????????????)????????????????????????RDBMS1?????????RDBMS??????????????????????????RDBMS????????????????RDBMS????????????????????????????????????SQL ????????????????????????????????????????RDBMS?????????????????????????????·???????????·??????????????????·???????????????????????????????(?????)????????????????????????????????????????????????????????????????????????????2??????????????????????????????????·??????????2?????????????????????????????·??????????????????????????????????????(?????????)???????????????????????????(????????)???????????????????·????????????????JBoss Cache??????????1????Java Map API????put/get?????????????????Java ?????????????????·??????????????????????????????????????????????1:JBoss Cache 3.0???????????????????????(Java Map API???????Java???????????????????????????)// ??????????Person????????????????// CacheFactory?DefaultCacheFactory?Cache?Fqn?Node?JBoss Cache????CacheFactory factory = new DefaultCacheFactory();// ????????Cache cache = factory.createCache();Fqn personData = Fqn.fromString("/person");// ???????????(?????·???)???Person???Node personNode = cache.getRoot().addChild(personData);// ??Person?????????????Person p1 = new Person(1234, "??", "??", "?????");// ?????·???????????personNode.put(1234, p1);?????·???·?????????·????????????????????????????????????·???·??????????????????????????·??????????????????2?????????????????????????????????????????????????????????????????????????????????????????????????????1????????RDBMS??????????????????????????2??????????????????Java API???????????????????????????????????????????????????????????·???·????????????????????????????·?????????·????????????????????????????????????????????·???·?????????????????????MapReduce???????????????????????????????????????????(?????)????????????????????·???·????????????????????????????????????????????????????????????·???????????????????????????????????????IT??????????????Web 2.0??????????????????????????????????????????????????????????????????????????????????????????????????????????????????2:??????????·???·???????Oracle Coherence?????????????????????(??????·?????JBoss Cache?????)// ??????????Person????????????????// CacheFactory?Oracle Coherence????// Person????????Map personCache = CacheFactory.getCache("person");// ??Person?????????????Person p1 = new Person(1234, "??", "??", "?????");// ?????·??????????personCache.put(1234, p1);??????????????????????3 ???????????????????????????????????·???????????????????????????·???·??????????????????????????????????·???????????????????12

    Read the article

  • Algorithm for creating a school timetable.

    - by cand
    Hello all. I've been wondering if there are known solutions for algorithm of creating a school timetable. Basically, it's about optimizing "hour-dispersion" (both in teachers and classes case) for given class-subject-teacher associations. We can assume that we have sets of classes, lesson subjects and teachers associated with each other at the input and that timetable should fit between 8AM and 4PM. I guess that there is probably no accurate algorithm for that, but maybe someone knows a good approximation or hints for developing it. P.S. I know, there was http://stackoverflow.com/questions/1259686/school-timetable-generation-algorithm-closed , but unlike in that case, I'm not looking for actual implementation, rather for thoughts on how to do it or why it's impossible.

    Read the article

  • Stack data storage order

    - by Jamie Dixon
    When talking about a stack in either computing or "real" life we usually assume a "first on, last off" type of functionality. Because the idea of a stack is based around something in the physical world, does it matter how the data in the stack is stored? I notice in a lot of examples that the storage of the stack data is quite often done using an array and the newest item added to the stack is placed at the bottom of the array. (like adding a new plate to an existing stack of plates except putting it underneath the other plates rather than on top). As a paradigm, does it matter in what order the data is stored within the stack as long as the operation of the stack acts as expected?

    Read the article

  • Ball to Ball Collision - Detection and Handling

    - by Simucal
    With the help of the Stack Overflow community I've written a pretty basic-but fun physics simulator. You click and drag the mouse to launch a ball. It will bounce around and eventually stop on the "floor". My next big feature I want to add in is ball to ball collision. The ball's movement is broken up into a x and y speed vector. I have gravity (small reduction of the y vector each step), I have friction (small reduction of both vectors each collision with a wall). The balls honestly move around in a surprisingly realistic way. I guess my question has two parts: What is the best method to detect ball to ball collision? Do I just have an O(n^2) loop that iterates over each ball and checks every other ball to see if it's radius overlaps? What equations do I use to handle the ball to ball collisions? Physics 101 How does it effect the two balls speed x/y vectors? What is the resulting direction the two balls head off in? How do I apply this to each ball? Handling the collision detection of the "walls" and the resulting vector changes were easy but I see more complications with ball-ball collisions. With walls I simply had to take the negative of the appropriate x or y vector and off it would go in the correct direction. With balls I don't think it is that way. Some quick clarifications: for simplicity I'm ok with a perfectly elastic collision for now, also all my balls have the same mass right now, but I might change that in the future. In case anyone is interested in playing with the simulator I have made so far, I've uploaded the source here (EDIT: Check the updated source below). Edit: Resources I have found useful 2d Ball physics with vectors: 2-Dimensional Collisions Without Trigonometry.pdf 2d Ball collision detection example: Adding Collision Detection Success! I have the ball collision detection and response working great! Relevant code: Collision Detection: for (int i = 0; i < ballCount; i++) { for (int j = i + 1; j < ballCount; j++) { if (balls[i].colliding(balls[j])) { balls[i].resolveCollision(balls[j]); } } } This will check for collisions between every ball but skip redundant checks (if you have to check if ball 1 collides with ball 2 then you don't need to check if ball 2 collides with ball 1. Also, it skips checking for collisions with itself). Then, in my ball class I have my colliding() and resolveCollision() methods: public boolean colliding(Ball ball) { float xd = position.getX() - ball.position.getX(); float yd = position.getY() - ball.position.getY(); float sumRadius = getRadius() + ball.getRadius(); float sqrRadius = sumRadius * sumRadius; float distSqr = (xd * xd) + (yd * yd); if (distSqr <= sqrRadius) { return true; } return false; } public void resolveCollision(Ball ball) { // get the mtd Vector2d delta = (position.subtract(ball.position)); float d = delta.getLength(); // minimum translation distance to push balls apart after intersecting Vector2d mtd = delta.multiply(((getRadius() + ball.getRadius())-d)/d); // resolve intersection -- // inverse mass quantities float im1 = 1 / getMass(); float im2 = 1 / ball.getMass(); // push-pull them apart based off their mass position = position.add(mtd.multiply(im1 / (im1 + im2))); ball.position = ball.position.subtract(mtd.multiply(im2 / (im1 + im2))); // impact speed Vector2d v = (this.velocity.subtract(ball.velocity)); float vn = v.dot(mtd.normalize()); // sphere intersecting but moving away from each other already if (vn > 0.0f) return; // collision impulse float i = (-(1.0f + Constants.restitution) * vn) / (im1 + im2); Vector2d impulse = mtd.multiply(i); // change in momentum this.velocity = this.velocity.add(impulse.multiply(im1)); ball.velocity = ball.velocity.subtract(impulse.multiply(im2)); } Source Code: Complete source for ball to ball collider. Binary: Compiled binary in case you just want to try bouncing some balls around. If anyone has some suggestions for how to improve this basic physics simulator let me know! One thing I have yet to add is angular momentum so the balls will roll more realistically. Any other suggestions? Leave a comment!

    Read the article

  • What makes a good software developer? [closed]

    - by David Johnstone
    Previously there have been questions on what makes a good team lead and what makes a good programming team, but I can't find any questions on what makes a good programmer. I believe the answer to this question is especially important in the context of hiring. Hiring the best people you can afford only works when you are able to identify who the best people are. Being able to consistently identify the best people is only possible when you know what makes the best people the best people. The easy answer is "smart and gets things done" (see "Done, and Gets Things Smart" for an interesting response). But surely there is more to being a good software developer than this aphorism. So, what makes a good software developer a good software developer? (Note: For the purposes of this question, I'm not interested in how to actually tell if somebody is a good software developer.)

    Read the article

  • What is the difference between these two nloglog(n) sorting algorithms? (Andersson et al., 1995 vs.

    - by Yktula
    Swanepoel's comment here lead me to this paper. Then, searching for an implementation in C, I came across this, which referenced another paper on an algorithm described here. Both papers describe integer sorting algorithms that run in O(nloglog(n)) time. What is the difference between the two? Have there been any more recent findings about this topic? Andersson et al., 1995 Han, 2004

    Read the article

  • Using a Mac for cross platform development?

    - by mdec
    Who uses Macs for cross-platform development? By cross platform I essentially mean you can compile to target Windows or Unix (not necessarily both at the same time). I understand that this also has a lot to do with writing portable code, but I am more interested in people's experience with Mac OS X to develop software. I understand that there are a range of IDEs to choose from, I would probably use Eclipse (I like the GCC toolchain) however Xcode seems to be quite popular. Could it be used as described above? At a pinch I could always virtualise with VirtualBox or VMware Player or parallels to use Visual Studio (or dual boot for that matter). Having said that I am open to any other suggested compilers (with preferably an IDE that uses GCC.) Also with the range of Macs available, which one would you recommend? I would prefer a laptop (as I already have a desktop) but am unsure of reasonable specifications. If you are currently using a Mac to do development, I would love to hear what you develop on your Mac and what you like and don't like about it. I would primarily be developing in C/C++/Java. I am also looking to experiment with Boost and Qt, so I'm interested in hearing about any (potential) compatibility issues. If you have any other tips I'd love you hear what you have to say.

    Read the article

  • Have you ever bought a commercial implementation of a programming language for personal programming

    - by Nelson
    Commercial products are often a source of ideas and inspiration for open source projects. There are free and open source implementations of almost every programming language ever devised, and a lot of them are very good. For non-work related personal programming projects, have you ever bought an expensive commerical implementation of a programming language and found it well worth the investment? If so, which one and why?

    Read the article

  • Code Golf: Collatz Conjecture

    - by Earlz
    Inspired by http://xkcd.com/710/ here is a code golf for it. The Challenge Given a positive integer greater than 0, print out the hailstone sequence for that number. The Hailstone Sequence See Wikipedia for more detail.. If the number is even, divide it by two. If the number is odd, triple it and add one. Repeat this with the number produced until it reaches 1. (if it continues after 1, it will go in an infinite loop of 1 -> 4 -> 2 -> 1...) Sometimes code is the best way to explain, so here is some from Wikipedia function collatz(n) show n if n > 1 if n is odd call collatz(3n + 1) else call collatz(n / 2) This code works, but I am adding on an extra challenge. The program must not be vulnerable to stack overflows. So it must either use iteration or tail recursion. Also, bonus points for if it can calculate big numbers and the language does not already have it implemented. (or if you reimplement big number support using fixed-length integers) Test case Number: 21 Results: 21 -> 64 -> 32 -> 16 -> 8 -> 4 -> 2 -> 1 Number: 3 Results: 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 Also, the code golf must include full user input and output.

    Read the article

  • I need to choose a compression algorithm

    - by chiz
    I need to choose a compression algorithm to compress some data. I don't know the type of data I'll be compressing in advance (think of it as kinda like the WinRAR program). I've heard of the following algorithms but I don't know which one I should use. Can anyone post a short list of pros and cons? For my application the first priority is decompression speed; the second priority is space saved. Compression (not decompression) speed is irrelevant. Deflate Implode Plain Huffman bzip2 lzma

    Read the article

  • How should I Test a Genetic Algorithm

    - by James Brooks
    I have made a quite few genetic algorithms; they work (they find a reasonable solution quickly). But I have now discovered TDD. Is there a way to write a genetic algorithm (which relies heavily on random numbers) in a TDD way? To pose the question more generally, How do you test a non-deterministic method/function. Here is what I have thought of: Use a specific seed. Which wont help if I make a mistake in the code in the first place but will help finding bugs when refactoring. Use a known list of numbers. Similar to the above but I could follow the code through by hand (which would be very tedious). Use a constant number. At least I know what to expect. It would be good to ensure that a dice always reads 6 when RandomFloat(0,1) always returns 1. Try to move as much of the non-deterministic code out of the GA as possible. which seems silly as that is the core of it's purpose. Links to very good books on testing would be appreciated too.

    Read the article

  • Code Golf: 1x1 black pixel

    - by Joey Adams
    Recently, I used my favorite image editor to make a 1x1 black pixel (which can come in handy when you want to draw solid boxes in HTML cheaply). Even though I made it a monochrome PNG, it came out to be 120 bytes! I mean, that's kind of steep. 120 bytes. For one pixel. I then converted it to a GIF, which dropped the size down to 43 bytes. Much better, but still... Challenge The shortest image file or program that is or generates a 1x1 black pixel. A submission may be: An image file that represents a 1x1 black pixel. The format chosen must be able to represent larger images than 1x1, and cannot be ad-hoc (that is, it can't be an image format you just made up for code golf). Image files will be ranked by byte count. A program that generates such an image file. Programs will be ranked by character count, as usual in code golf. As long as an answer falls into one of these two categories, anything is fair game.

    Read the article

  • What do you mean by the expressiveness in a programming language?

    - by prosseek
    I see a lot of the word 'expressiveness' when people want to stress one language is better than the other. But I don't see exactly what they mean by it. Is it the verboseness/succinctness? I mean, if one language can write down something shorter than the other, does that mean expressiveness? Please refer to my other question - http://stackoverflow.com/questions/2411772/article-about-code-density-as-a-measure-of-programming-language-power Is it the power of the language? Paul Graham says that one language is more powerful than the other language in a sense that one language can do that the other language can't do (for example, LISP can do something with macro that the other language can't do). Is it just something that makes life easier? Regular expression can be one of the examples. Is it a different way of solving the same problem: something like SQL to solve the search problem? What do you think about the expressiveness of a programming language? Can you show the expressiveness using some code? What's the relationship with the expressiveness and DSL? Do people come up with DSL to get the expressiveness?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >