Using Linq to SQL, how do I find min and max of a column in a table?

Using Linq to SQL, how do I find min and max of a column in a table?

I want to find the fastest way to get the min and max of a column in a table with a single Linq to SQL roundtrip. So I know this would work in two roundtrips:int min = MyTable.Min(row => row.FavoriteNumber);int max = MyTable.Max(row => row

What are the differences between throws and rethrows in Swift?

What are the differences between throws and rethrows in Swift?

After searching for some references to figure it out, -unfortunately- I could not find useful -and simple- description about understanding the differences between throws and rethrows. It is kind of confusing when try to understand how we sh

How do I round a number in JSTL?

How do I round a number in JSTL?

I'm doing a division in a JSP and I'd like to round the result - how should I do this?i.e. ...how do I round the result?Thanks, 1:As an alternative:This way you do not lose localization (commas and dots). 2:I used:${fn:substringBefore

Execute only one unit test while debugging in Visual Studio 2008

Execute only one unit test while debugging in Visual Studio 2008

Is there a way to select which TestMethods you want to execute in Visual Studio 2008 Unit Test project while debugging? I want to debug one particular test without having my other TestMethods execute during each debug session. 1:Click o

Missing SDK platform Android, API 18

Missing SDK platform Android, API 18

While I am trying to Install API 18 it shows only "Google API 18"(nothing more). Nowif I tries to install these google APIs from Android SDK Manager it shows a message "this package depends on "Missing SDK platform Android, API 18". and I

How to achieve a blur effect in PHP?

How to achieve a blur effect in PHP?

I've been looking for PHP code to apply a Gaussian blur to images.What I've done was like this:However the effect is very weak, and if I repeat the blur effect, it takes a very long time to process and the end result is still not that good.

How can you remove duplicate characters in a string?

How can you remove duplicate characters in a string?

I have to implements a function that takes a string as an input and finds the non-duplicate character from this string.So an an example is if I pass string str = "DHCD" it will return "DHC"or str2 = "KLKLHHMO" it will return "KLHMO" 1:A

Understanding Knuth-Morris-Pratt Algorithm

Understanding Knuth-Morris-Pratt Algorithm

Can someone explain this to me? I've been reading about it and it still is hard to follow. text : ababdbaababapattern: ababatable for ababa is -1 0 0 1 2. I think I understand how the table is constructed but, I dont understand how to shift

Implementing Server Push

Implementing Server Push

Read about Server push here.I want to push data to client from my web application in real time.I was looking at TCP sockets as one of the options.For HTTP I found a variety of frameworks for Java, PHP, Python and others over here.However I

Restrict access to .NET assembly?

Restrict access to .NET assembly?

Is there a way to have a .NET assembly accessible for only authorized sources?I mean I want to have a DLL that contains components, but I don't want anyone to be able to use these components but the other DLLs EXEs in my solution.I do want

Is There An XSL Code Generator That Can Create XSLT By Example?

Is There An XSL Code Generator That Can Create XSLT By Example?

Given a source XML document and a sample of what it should look like after it is transformed, is there a code generator that could create an XSL transform to accomplish that.I am not expecting it to be perfect but, much like the code genera

iCloud Integration for uploading and downloading files

iCloud Integration for uploading and downloading files

I want to design an app which stores documents on iCloud. But there are some question which has answer before doing actual implementation.The question are as follows,What is maximum file size to upload on iCloud?Can I programmatically calcu

Tree cut and Rectangles around clusters for a horizontal dendrogram in R

Tree cut and Rectangles around clusters for a horizontal dendrogram in R

I am trying to plot the results of a hierarchical clustering in R as a dendrogram, with rectangles identifying clusters. The following code does the trick for a vertical dendrogram, but for a horizontal dendrogram, (horiz=TRUE), the rectang

How to ensure garbage collection of a FutureTask that is submitted to a ThreadPoolExecutor and then

How to ensure garbage collection of a FutureTask that is submitted to a ThreadPoolExecutor and then

I am submitting Callable objects to a ThreadPoolExecutor and they seem to be sticking around in memory.Looking at the heap dump with the MAT tool for Eclipse see that the Callable objects are being referenced by a FutureTask$Sync's callable

Egit adding Eclipse project folder to git repository

Egit adding Eclipse project folder to git repository

I've created a new empty git repository on BitBucket and now I want to link it to Eclipse.I added the repo to the "Git Repositories" view and created a new project with the same name.I select "Team -> Share Project" then commit and push ups

How to limit list items display in ListView by 10 and next 10after clicking next button

How to limit list items display in ListView by 10 and next 10after clicking next button

i have a listview with 100 items and i want to display first 10 items and on click of next button i have to display next 10 ie.,from 11 to 20, i have the code for getting first 10 items public int getCount() { return 10; }but how

Fast numpy fancy indexing

Fast numpy fancy indexing

My code for slicing a numpy array (via fancy indexing) is very slow. It is currently a bottleneck in program.a.shape(3218, 6)ts = time.time(); a[rows][:, cols]; te = time.time(); print('%.8f' % (te-ts));0.00200009What is the correct numpy c

System.Linq.Dynamic - Can I use IN clause in WHERE statement

System.Linq.Dynamic - Can I use IN clause in WHERE statement

I have dynamic linq WHERE statement:dataContext.Table.Where("id = 0 Or id = 1 Or id = 2 Or ...");I want change to:dataContext.Table.Where("id IN (0, 1, 2, ...)");But it doesn´t work. How can I do this for better performance? 1:From How

Cheapest way to to determine if a MySQL connection is still alive

Cheapest way to to determine if a MySQL connection is still alive

I have a pool of MySQL connections for a web-based data service. When it starts to service a request, it takes a connection from the pool to use. The problem is that if there has been a significant pause since that particular connection has

What's so different about OpenGL 3.x?

What's so different about OpenGL 3.x?

I've been looking for an OpenGL book lately and noticed that the OpenGL programming guide (2010) is deprecated. What's so different about OpenGL 3.x from 2.x? 1:Edit: Major changes, and some better arguments which has eluded many, inclu

Magento issue with calling isInStock() method on a product

Magento issue with calling isInStock() method on a product

I want to check if some products are in stock but whatever I do the isInStock() method always returns TRUE. My products are configurable products with no associated products and under the "Inventory" tab "Stock Availability" is set to "Out

How to implement a hash-key navigation?

How to implement a hash-key navigation?

i want to implement a ajax based hash-key navigation like this:http://www.foo.bar/#/about/http://www.foo.bar/#/news/http://www.foo.bar/#/products/any advice here?thanks in advance! 1:With a hash-based navigation structure, you'll be defi

How can I hash a string to an int using c++?

How can I hash a string to an int using c++?

I have to write my own hash function. If I wanted to just make the simple hash function that maps each letter in the string to a numerical value (i.e. a=1, b=2, c=3, ...), is there a way I can perform this hash on a string without having to

Fix the Animation of a Circular ViewPager

Fix the Animation of a Circular ViewPager

GoalBuild a Circular ViewPager.The first element lets you peak to the last element and swipe to it, and vice versa. You should be able to swipe in either direction forever.Now this has been accomplished before, but these questions do not wo

Patterns when to use Activity Transition vs Dynamic Fragments

Patterns when to use Activity Transition vs Dynamic Fragments

Are there any patterns on how to handle UI Transitions in Android Activities vs Fragments? I am currently looking into a UI that has at most 3 columns in Landscape.I would like the UI to start with 1 column all the way across the screen and