Search Results

Search found 5346 results on 214 pages for 'filter'.

Page 10/214 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Using Take and skip keyword to filter records in LINQ

    - by vik20000in
    In LINQ we can use the take keyword to filter out the number of records that we want to retrieve from the query. Let’s say we want to retrieve only the first 5 records for the list or array then we can use the following query     int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };     var first3Numbers = numbers.Take(3); The TAKE keyword can also be easily applied to list of object in the following way. var first3WAOrders = (         from cust in customers         from order in cust.Orders         select cust ) .Take(3); [Note in the query above we are using the order clause so that the data is first ordered based on the orders field and then the first 3 records are taken. In both the above example we have been able to filter out data based on the number of records we want to fetch. But in both the cases we were fetching the records from the very beginning. But there can be some requirements whereby we want to fetch the records after skipping some of the records like in paging. For this purpose LINQ has provided us with the skip method which skips the number of records passed as parameter in the result set. int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var allButFirst4Numbers = numbers.Skip(4); The SKIP keyword can also be easily applied to list of object in the following way. var first3WAOrders = (         from cust in customers         from order in cust.Orders         select cust ).Skip(3);  Vikram

    Read the article

  • Laplacian of gaussian filter use

    - by maximus
    This is a formula for LoG filtering: Also in applications with LoG filtering I see that function is called with only one parameter: sigma(s). I want to try LoG filtering using that formula (previous attempt was by gaussian filter and then laplacian filter with some filter-window size ) But looking at that formula I can't understand how the size of filter is connected with this formula, does it mean that the filter size is fixed? Can you explain how to use it?

    Read the article

  • Higher order function « filter » in C++

    - by Red Hyena
    Hi all. I wanted to write a higher order function filter with C++. The code I have come up with so far is as follows: #include <iostream> #include <string> #include <functional> #include <algorithm> #include <vector> #include <list> #include <iterator> using namespace std; bool isOdd(int const i) { return i % 2 != 0; } template < template <class, class> class Container, class Predicate, class Allocator, class A > Container<A, Allocator> filter(Container<A, Allocator> const & container, Predicate const & pred) { Container<A, Allocator> filtered(container); container.erase(remove_if(filtered.begin(), filtered.end(), pred), filtered.end()); return filtered; } int main() { int const a[] = {23, 12, 78, 21, 97, 64}; vector<int const> const v(a, a + 6); vector<int const> const filtered = filter(v, isOdd); copy(filtered.begin(), filtered.end(), ostream_iterator<int const>(cout, " ")); } However on compiling this code, I get the following error messages that I am unable to understand and hence get rid of: /usr/include/c++/4.3/ext/new_allocator.h: In instantiation of ‘__gnu_cxx::new_allocator<const int>’: /usr/include/c++/4.3/bits/allocator.h:84: instantiated from ‘std::allocator<const int>’ /usr/include/c++/4.3/bits/stl_vector.h:75: instantiated from ‘std::_Vector_base<const int, std::allocator<const int> >’ /usr/include/c++/4.3/bits/stl_vector.h:176: instantiated from ‘std::vector<const int, std::allocator<const int> >’ Filter.cpp:29: instantiated from here /usr/include/c++/4.3/ext/new_allocator.h:82: error: ‘const _Tp* __gnu_cxx::new_allocator<_Tp>::address(const _Tp&) const [with _Tp = const int]’ cannot be overloaded /usr/include/c++/4.3/ext/new_allocator.h:79: error: with ‘_Tp* __gnu_cxx::new_allocator<_Tp>::address(_Tp&) const [with _Tp = const int]’ Filter.cpp: In function ‘Container<A, Allocator> filter(const Container<A, Allocator>&, const Predicate&) [with Container = std::vector, Predicate = bool ()(int), Allocator = std::allocator<const int>, A = const int]’: Filter.cpp:30: instantiated from here Filter.cpp:23: error: passing ‘const std::vector<const int, std::allocator<const int> >’ as ‘this’ argument of ‘__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> > std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = const int, _Alloc = std::allocator<const int>]’ discards qualifiers /usr/include/c++/4.3/bits/stl_algo.h: In function ‘_FIter std::remove_if(_FIter, _FIter, _Predicate) [with _FIter = __gnu_cxx::__normal_iterator<const int*, std::vector<const int, std::allocator<const int> > >, _Predicate = bool (*)(int)]’: Filter.cpp:23: instantiated from ‘Container<A, Allocator> filter(const Container<A, Allocator>&, const Predicate&) [with Container = std::vector, Predicate = bool ()(int), Allocator = std::allocator<const int>, A = const int]’ Filter.cpp:30: instantiated from here /usr/include/c++/4.3/bits/stl_algo.h:821: error: assignment of read-only location ‘__result.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* [with _Iterator = const int*, _Container = std::vector<const int, std::allocator<const int> >]()’ /usr/include/c++/4.3/ext/new_allocator.h: In member function ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, size_t) [with _Tp = const int]’: /usr/include/c++/4.3/bits/stl_vector.h:150: instantiated from ‘void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(_Tp*, size_t) [with _Tp = const int, _Alloc = std::allocator<const int>]’ /usr/include/c++/4.3/bits/stl_vector.h:136: instantiated from ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = const int, _Alloc = std::allocator<const int>]’ /usr/include/c++/4.3/bits/stl_vector.h:286: instantiated from ‘std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const _Alloc&) [with _InputIterator = const int*, _Tp = const int, _Alloc = std::allocator<const int>]’ Filter.cpp:29: instantiated from here /usr/include/c++/4.3/ext/new_allocator.h:98: error: invalid conversion from ‘const void*’ to ‘void*’ /usr/include/c++/4.3/ext/new_allocator.h:98: error: initializing argument 1 of ‘void operator delete(void*)’ /usr/include/c++/4.3/bits/stl_algobase.h: In function ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false, _II = const int*, _OI = const int*]’: /usr/include/c++/4.3/bits/stl_algobase.h:435: instantiated from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false, _II = __gnu_cxx::__normal_iterator<const int*, std::vector<const int, std::allocator<const int> > >, _OI = __gnu_cxx::__normal_iterator<const int*, std::vector<const int, std::allocator<const int> > >]’ /usr/include/c++/4.3/bits/stl_algobase.h:466: instantiated from ‘_OI std::copy(_II, _II, _OI) [with _II = __gnu_cxx::__normal_iterator<const int*, std::vector<const int, std::allocator<const int> > >, _OI = __gnu_cxx::__normal_iterator<const int*, std::vector<const int, std::allocator<const int> > >]’ /usr/include/c++/4.3/bits/vector.tcc:136: instantiated from ‘__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> > std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = const int, _Alloc = std::allocator<const int>]’ Filter.cpp:23: instantiated from ‘Container<A, Allocator> filter(const Container<A, Allocator>&, const Predicate&) [with Container = std::vector, Predicate = bool ()(int), Allocator = std::allocator<const int>, A = const int]’ Filter.cpp:30: instantiated from here /usr/include/c++/4.3/bits/stl_algobase.h:396: error: no matching function for call to ‘std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m(const int*&, const int*&, const int*&)’ Please tell me what I am doing wrong here and what is the correct way to achieve the kind of higher order polymorphism I want. Thanks.

    Read the article

  • Enabling browser caching via java

    - by Franz See
    Good day, I am using CacheFilter to filter a certain path to my server (which outputs an image stream to the response stream). And I've configured it in my web.xml as follows: <filter> <filter-name>imagesCache</filter-name> <filter-class>com.samaxes.cachefilter.presentation.CacheFilter</filter-class> <init-param> <param-name>privacy</param-name> <param-value>public</param-value> </init-param> <init-param> <param-name>expirationTime</param-name> <param-value>2592000</param-value> </init-param> </filter> ... <filter-mapping> <filter-name>imagesCache</filter-name> <url-pattern>/my/path/*</url-pattern> </filter-mapping> Using my firefox, if I access my url via the address bar, it hits the server the first time but uses the cache during succeeding calls. However, if the url is inside my page ( i.e. <img src="..."/> ), it seems to hit the server all the time. [EDIT] After a few more testing, accessing my image via the address bar does not work all the time. But caching does seem to work more often with it than . As to whether it really, I am not sure. Additional Info: my path is something like /my/path?then=some&query=strings. Notice that it doesn't have an extension (i.e. gif, png, jpeg ) but it's mimetype is set properly ( image/gif, image/png, image/jpeg ). I am not sure if the lack of extension or the presence of the query strings have any impact. (Also, another note. though my url have query strings, I am using the same uri + query string over and over again with my tests). Any ideas why? Thanks

    Read the article

  • Custom Django admin URL + changelist view for custom list filter by Tags

    - by Botondus
    In django admin I wanted to set up a custom filter by tags (tags are introduced with django-tagging) I've made the ModelAdmin for this and it used to work fine, by appending custom urlconf and modifying the changelist view. It should work with URLs like: http://127.0.0.1:8000/admin/reviews/review/only-tagged-vista/ But now I get 'invalid literal for int() with base 10: 'only-tagged-vista', error which means it keeps matching the review edit page instead of the custom filter page, and I cannot figure out why since it used to work and I can't find what change might have affected this. Any help appreciated. Relevant code: class ReviewAdmin(VersionAdmin): def changelist_view(self, request, extra_context=None, **kwargs): from django.contrib.admin.views.main import ChangeList cl = ChangeList(request, self.model, list(self.list_display), self.list_display_links, self.list_filter, self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self.list_editable, self) cl.formset = None if extra_context is None: extra_context = {} if kwargs.get('only_tagged'): tag = kwargs.get('tag') cl.result_list = cl.result_list.filter(tags__icontains=tag) extra_context['extra_filter'] = "Only tagged %s" % tag extra_context['cl'] = cl return super(ReviewAdmin, self).changelist_view(request, extra_context=extra_context) def get_urls(self): from django.conf.urls.defaults import patterns, url urls = super(ReviewAdmin, self).get_urls() def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view)(*args, **kwargs) return update_wrapper(wrapper, view) info = self.model._meta.app_label, self.model._meta.module_name my_urls = patterns('', # make edit work from tagged filter list view # redirect to normal edit view url(r'^only-tagged-\w+/(?P<id>.+)/$', redirect_to, {'url': "/admin/"+self.model._meta.app_label+"/"+self.model._meta.module_name+"/%(id)s"} ), # tagged filter list view url(r'^only-tagged-(P<tag>\w+)/$', self.admin_site.admin_view(self.changelist_view), {'only_tagged':True}, name="changelist_view"), ) return my_urls + urls Edit: Original issue fixed. I now receive 'Cannot filter a query once a slice has been taken.' for line: cl.result_list = cl.result_list.filter(tags__icontains=tag) I'm not sure where this result list is sliced, before tag filter is applied. Edit2: It's because of the self.list_per_page in ChangeList declaration. However didn't find a proper solution yet. Temp fix: if kwargs.get('only_tagged'): list_per_page = 1000000 else: list_per_page = self.list_per_page cl = ChangeList(request, self.model, list(self.list_display), self.list_display_links, self.list_filter, self.date_hierarchy, self.search_fields, self.list_select_related, list_per_page, self.list_editable, self)

    Read the article

  • protecting grails melody with grails filter

    - by batmannavneet
    I have an application where I am using spring security along with grails melody. I am planning to run grails melody in production environment, but don't want visitors to have access to it. How should I achieve that ? I tried creating a filter in grails (just showing the sample of what I am trying, not the actual code)- def filters = { allURIs(uri:'/**') { before = { //... if(request.forwardURI.indexOf("admin") != -1 || request.forwardURI.indexOf("monitoring") != -1) { response.sendError 404 return false } } } } But this doesnt work as the request for "monitoring" doesnt hit this filter. I dont even want the user to know that such a URL exists, so I want to check in the filter that if "monitoring" is the URL, I show the 404 error page. Thats also the reason why I dont want to protect this URL with spring security as it will show "access denied" page. Basically I want the URL to exist but they should be invisible to users. I want the access to be open to only certain IP addresses for these special URLs. On another note, Is it possible to write a grails filter that "acts" before the spring security filter is hit ? I want to be able to do some filtering before I forward requests to spring security. Writing a grails filter like above doesnt help. Spring security filter gets hit first if I access a protected resource and this filter doesn't get called. Thanks

    Read the article

  • Stairway to PowerPivot and DAX - Level 2: The DAX COUNTROWS() and FILTER() Functions

    Bill Pearson, business intelligence architect and author, exposes the DAX COUNTROWS() and FILTER() functions, while generally exploring, comparing and contrasting the nature and operation of calculated columns and calculated measures, in the second Level of our Stairway to PowerPivot and DAX series. 12 essential tools for database professionalsThe SQL Developer Bundle contains 12 tools designed with the SQL Server developer and DBA in mind. Try it now.

    Read the article

  • PowerPivot FILTER condition optimizations

    - by Marco Russo (SQLBI)
    In the comments of a recent post from Alberto Ferrari there was an interesting note about different performance related to the order of conditions in a FILTER call. I investigated about that and Jeffrey Wang has been so nice to give me some info about actual implementation that I can share on a blog post. First of all, an important disclaimer: PowerPivot is intended to make life easier, not requiring the user to think how to write the order of elements in a formula just to get better performance....(read more)

    Read the article

  • Gridview Header Filter

    To help you filter gridview using it's header...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • PowerPivot FILTER condition optimizations

    - by Marco Russo (SQLBI)
    In the comments of a recent post from Alberto Ferrari there was an interesting note about different performance related to the order of conditions in a FILTER call. I investigated about that and Jeffrey Wang has been so nice to give me some info about actual implementation that I can share on a blog post. First of all, an important disclaimer: PowerPivot is intended to make life easier, not requiring the user to think how to write the order of elements in a formula just to get better performance....(read more)

    Read the article

  • Using Stop, Filter Words in Search Optimization

    There are certain words that the search engines ignore when they are indexing your website. The engines also ignore single digit numbers as well as single letters. These are known within the SEO industry as stop words. The search engines filter these words out because they tend to slow down searches significantly and they do not help to improve the search results.

    Read the article

  • Filter any mailing list in GMail using the "list:" meta-data

    - by Binary255
    Hi, If I ask GMail to create a filter for a mailing list it creates a rule containing list:mailing-list-identifier, in the case of the NAnt mailing list it wrote: Has the words: list: "nant-users.lists.sourceforge.net" Is there a way to filter any mailing list? I would like to filter conversations from any mailing list containing answers to things I've previously asked (or answered to). Part of that filter is identifying "anything which is part of a mailing list" and I'm wondering if there is a better way than adding another label to all mailing list posts (which is cumbersome).

    Read the article

  • Detach a filter driver from certain drivers?

    - by Protector one
    The driver for my laptop's keyboard has a kernel-mode filter driver from Synaptics (SynTP.sys) attached. Is it possible to detach the SynTP.sys filter driver from my keyboard's driver, without detaching it from my Touchpad's driver? This Microsoft Support page explains how to completely disable a filter driver, but my touchpad requires SynTP.sys as well. I'm trying to do this is because the Synaptics driver disables my touchpad when I type. (Explained fully in this question: Use touchpad while "typing"?.) Since I don't have a solution to that problem, I figured removing the filter driver from the keyboard could prevent the Synaptics driver from detecting key strokes, thus stopping it from disabling the touchpad.

    Read the article

  • Wireshark Display Filter protocol==TLSV1? (and PacketLength)

    - by NealWalters
    What would the filter expression be to just select the protocols where the protocol = TLSV1? Something obvious like protocol == "TLSV1" or TCP.protocol == "TLSV1" is apparently not the right way. ip.proto == "TLSV1" says "ip.proto cannot accept strings as values" Update - additional tips: Another great but hidden search is on PacketLength: You can add packet length to your display by clicking "Edit Preferences" (menu or icon), and adding the PacketLength as a new column, but to filter on it you have to use the more cryptic: frame.len == ### where ### is your desired number. We were using this to determine how many packets had been sent and/or received, when you filter, the status-bar at the bottom of the screen shows the number of items matching the filter.

    Read the article

  • Duplicate an AppEngine Query object to create variations of a filter without affecting the base quer

    - by Steve Mayne
    In my AppEngine project I have a need to use a certain filter as a base then apply various different extra filters to the end, retrieving the different result sets separately. e.g.: base_query = MyModel.all().filter('mainfilter', 123) Then I need to use the results of various sub queries separately: subquery1 = basequery.filter('subfilter1', 'xyz') #Do something with subquery1 results here subquery2 = basequery.filter('subfilter2', 'abc') #Do something with subquery2 results here Unfortunately 'filter()' affects the state of the basequery Query instance, rather than just returning a modified version. Is there any way to duplicate the Query object and use it as a base? Is there perhaps a standard Python way of duping an object that could be used? The extra filters are actually applied by the results of different forms dynamically within a wizard, and they use the 'running total' of the query in their branch to assess whether to ask further questions. Obviously I could pass around a rudimentary stack of filter criteria, but I'd rather use the Query itself if possible, as it adds simplicity and elegance to the solution.

    Read the article

  • HTG Explains: How the SmartScreen Filter Works in Windows 8

    - by Chris Hoffman
    Windows 8 includes a SmartScreen filter that prevents unknown and malicious programs from running. SmartScreen is part of Internet Explorer 8 and 9 – with Windows 8, it’s now integrated into the operating system. SmartScreen is a useful security feature that will help prevent bad applications from running, but it may occasionally prevent a legitimate application from running. SmartScreen reports some information to Microsoft, so it may have some privacy implications. HTG Explains: Is ReadyBoost Worth Using? HTG Explains: What The Windows Event Viewer Is and How You Can Use It HTG Explains: How Windows Uses The Task Scheduler for System Tasks

    Read the article

  • Auto save, filter applied screen shots

    - by DUKE
    Unlike Windows, it is very easy to take screen shots of selected area of the screen in Ubuntu. But I am researching how to have the following features when taking screen shots of the selected area: (1) The final output should be automatically saved to a location, for example on the desktop. (This feature is available in Mac OSX) (2) A filter (such as drop down shadow) should be automatically applied to the image. The above should happen as soon as the selection is done, without poping up any dialogs and expecting any inputs from the user.

    Read the article

  • Learn Where Windows 8 Stores SmartScreen Filter Information for Downloaded Files

    - by Taylor Gibb
    In previous versions of Windows the SmartScreen filter was a feature of Internet Explorer, with Windows 8 it becomes part of the Windows file system. But how does it know which files have been downloaded and which ones originated from your PC? Read on to see how How-To Geek went exploring in the file system. Note: The information provided in this article is for educational purposes only. 6 Ways Windows 8 Is More Secure Than Windows 7 HTG Explains: Why It’s Good That Your Computer’s RAM Is Full 10 Awesome Improvements For Desktop Users in Windows 8

    Read the article

  • Struts2 + Sitemesh + Freemarker doesn't work

    - by jdoklovic
    I've tried following every example i ccould find and i can't get struts2 + sitemesh + freemarker to work on a simple jsp. I have a very simple web.xml, a single action that just goes to index.jsp, and a simple .ftl decorator that just adds some text to the result. When i hit index.action, the page "seems" to be decorated, but I get the literal ${body} instead of the actual contents. here's my setup: web.xml <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <description>struts2 test</description> <display-name>struts 2 test</display-name> <filter> <filter-name>struts-prepare</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class> </filter> <filter> <filter-name>sitemesh</filter-name> <filter-class>org.apache.struts2.sitemesh.FreeMarkerPageFilter</filter-class> </filter> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts-prepare</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <welcome-file-list> <welcome-file>index.action</welcome-file> </welcome-file-list> </web-app> struts.xml <struts> <constant name="struts.devMode" value="true"/> <package name="basicstruts2" extends="struts-default"> <action name="index"> <result>/index.jsp</result> </action> </package> </struts> sitemesh.xml <sitemesh> <property name="decorators-file" value="/WEB-INF/decorators.xml" /> <excludes file="${decorators-file}" /> <page-parsers> <parser default="true" class="com.opensymphony.module.sitemesh.parser.DefaultPageParser"/> <parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.HTMLPageParser"/> </page-parsers> <decorator-mappers> <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper"> <param name="config" value="${decorators-file}" /> </mapper> </decorator-mappers> </sitemesh> decorators.xml <decorators defaultdir="/decorators"> <decorator name="main" page="main.ftl"> <pattern>/*</pattern> </decorator> </decorators> main.ftl <html> <head> <title>${title}</title> ${head} </head> <body> I'm Fancy!<br> ${body}<br /> </body> </html> index.jsp <html> <head> <title>my title</title> </head> <body> my body </body> </html> Any ideas???

    Read the article

  • How to create filter option in RDLC report column ?

    - by prasanna
    I wanted to have filter option (like the one available in Excel sheet) in rdlc report column. is it possible and how ? http://img62.imageshack.us/img62/2223/sample1n.png i am trying in Visual studio 2005 and Microsoft report viewer. kindly let me know the option for this or a work around for it. Thanks

    Read the article

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