Search Results

Search found 13450 results on 538 pages for 'recent items'.

Page 108/538 | < Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >

  • Need help translating rate limiting iptables rules to Puppet format

    - by geoffroy
    I use Puppet Iptables module to manage Iptables rules on my machine. I'd like to implement to rate limit failed SSH connections as described here : Hundreds of failed ssh logins iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 5 --name SSH --rsource -j DROP iptables -A INPUT -p tcp --dport 22 -m recent --set --name SSH --rsource -j ACCEPT Is it possible to translate it to Puppet syntax, such as firewall { '015 drop 5 failed attemps to connect to SSH in a minute ': proto => 'tcp', port => 22, action => 'drop', // what are the other paramters ? } Any help welcome. Best regards Geoffroy

    Read the article

  • how properly remove item from list

    - by dygi
    // tmpClientList is List<Client> type if (txtboxClientName.Text != "") foreach (Client cli in tmpClientList) if (cli.Name != txtboxClientName.Text) tmpClientList.Remove(cli); Error: "Collection was modified; enumeration operation may not execute." How can i remove items from the list, in some simple way, without saving indexes of these items in another list or array, and removing them in another place in the code. Tried also RemoveAt(index) but it's exactly the same situation, modifying when loop runs.

    Read the article

  • Fastest way to copy a set (100+) of related SQLAlchemy objects and change attribute on each one

    - by rebus
    I am developing an app that keeps track of items going in and out of factory. For example, lets say you have 3 kinds of plastic coming in, they are mixed in various ratios and then sent out as a new product. So to keep track of this I've created following database structure: This is very simplified overview of my SQLAlchemy models: IN <- RATIO <- OUT <- REPORT ITEMS -> REPORT IN are products coming in, RATIO is various information on measurements, and OUT is a final product. REPORT is basically a header model which has a lot of REPORT ITEMS attached to it, which in turn relate it to OUT products. This would all work perfectly, but IN and RATION values can change. These changes ultimately change the OUT product which would mean the REPORT values would change. So in order to change an attribute on IN object for example I should copy that object with that attribute changed. I would think this is basically a question about database normalization, because i didn't want to duplicate all the IN, RATIO and OUT information by writing it in REPORT ITEMS table for example, but I've came across this problem (well not really a problem but rather a feature I'd like for a user to have). When the attribute on IN object is changed I want related objects (RATIO and OUT) automatically copied and related to a new IN object. So I was thinking something like: Take an existing instance of model IN that needs to change (call it old_in) Create a new one out of it with some attributes changed (call it new_in) Collect all the RATIO objects that are related to old_in Copy each RATIO and relate them to a new_in Collect all the OUT objects that are related to old RATIO Copy each OUT and relate them to a new RATIO Few questions pop to mind when i look at this problem: Should i just duplicate the data, does all this copying even make sense? If it does, should i rather do it in plain SQL? If no what would be the best approach to do it with Python and SQLAlchemy? Any general answer would suffice really, at least a pointer in right direction. I really want to free then end user for hassle of having create new ratios and out products.

    Read the article

  • Rails: Pass association object to the View

    - by Fedyashev Nikita
    Model Item belongs_to User. In my controller I have code like this: @items = Item.find(:all) I need to have a corresponding User models for each item in my View templates. it works in controller(but not in View template): @items.each { |item| item.user } But manual looping just to build associations for View template kinda smells. How can I do this not in a creepy way?

    Read the article

  • Reading data from a COM port

    - by Demonick
    I want to get input from a barcode-scanner, which is connected to a CHD cash register, which is connected to a Windows XP PC trough a COM port. I want to read the data from the scanner and the cash register, and send the data to a program, which has a table with items in a shop. And provide a function which removes items, too. Where should I start? Is there a code in Delphi or Java, that can get that data into a program?

    Read the article

  • Android TabLayout custom menu

    - by MostafaEweda
    I have a TabLayout containing tabs as intents to activities. I want to set custom menu items for each tab, but the onCreateOptionsMenu version called is the Host's version. How can I make the menu items created by each activity on its own.

    Read the article

  • Linq-to-Entities Dynamic sorting

    - by verror
    This is my query, how can I use string as orderby parameter? string sortColumn="Title"; var items = (from ltem in ctxModel.Items where ltem.ItemID == vId orderby //something here select ltem).Skip(PageSize * PageIndex).Take(PageSize);

    Read the article

  • problem with selecting a rows in advanced datagrid using keydown event

    - by user365559
    Hi, I have advanced datagrid with list of items is displayed.I am using keydown for selecting the rows.But the actual problem is when i am selecting the items after the 2nd item it should move to the 3rd item but instead of that its moving back to the 1st item.I have defined selectionmode property to singlerows even then the result same to be same.can any one give me the soloution.

    Read the article

  • How to push_back without operator=() for const members?

    - by WilliamKF
    How to push_back() to a C++ std::vector without using operator=() for which the default definition violates having const members? struct Item { Item(int value) : _value(value) { } const int _value; } vector<Item> items; items.push_back(Item(3)); I'd like to keep the _value const since it should not change after the object is constructed, so the question is how do I initialize my vector with elements without invoking operator=()?

    Read the article

  • Mod_rewrite on all website images

    - by Esteve Camps
    I'm designing an image repository. I want to uncouple the filename from the image html link. For instance: image in filesystem is called images/items/12543.jpg HTML is <img src="images/car.jpg" /> Does anyone strongly discourages me to rewrite all image requests using PHP so when retrieving images/car.jpg, Apache really replies content from images/items/12543.jpg? I don't know if I may get performance problems.

    Read the article

  • Bulk update & occasional insert (coredata) - Too slow

    - by Andrew
    Update: Currently looking into NSSET's minusSet links: http://stackoverflow.com/questions/1475636/comparing-two-arrays Hi guys, Could benefit from your wisdom here.. I'm using Coredata in my app, on first launch I download a data file and insert over 500 objects (each with 60 attributes) - fast, no problem. Each subsequent launch I download an updated version of the file, from which I need to update all existing objects' attributes (except maybe 5 attributes) and create new ones for items which have been added to the downloaded file. So, first launch I get 500 objects.. say a week later my file now contains 507 items.. I create two arrays, one for existing and one for downloaded. NSArray *peopleArrayDownloaded = [CoreDataHelper getObjectsFromContext:@"person" :@"person_id" :YES :managedObjectContextPeopleTemp]; NSArray *peopleArrayExisting = [CoreDataHelper getObjectsFromContext:@"person" :@"person_id" :YES :managedObjectContextPeople]; If the count of each array is equal then I just do this: NSUInteger index = 0; if ([peopleArrayExisting count] == [peopleArrayDownloaded count]) { NSLog(@"Number of people downloaded is same as the number of people existing"); for (person *existingPerson in peopleArrayExisting) { person *tempPerson = [peopleArrayDownloaded objectAtIndex:index]; // NSLog(@"Updating id: %@ with id: %@",existingPerson.person_id,tempPerson.person_id); // I have 60 attributes which I to update on each object, is there a quicker way other than overwriting existing? index++; } } else { NSLog(@"Number of people downloaded is different to number of players existing"); So now comes the slow part. I end up using this (which is tooooo slow): NSLog(@"Need people added to the league"); for (person *tempPerson in peopeArrayDownloaded) { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"person_id = %@",tempPerson.person_id]; // NSLog(@"Searching for existing person, person_id: %@",existingPerson.person_id); NSArray *filteredArray = [peopleArrayExisting filteredArrayUsingPredicate:predicate]; if ([filteredArray count] == 0) { NSLog(@"Couldn't find an existing person in the downloaded file. Adding.."); person *newPerson = [NSEntityDescription insertNewObjectForEntityForName:@"person" inManagedObjectContext:managedObjectContextPeople]; Is there a way to generate a new array of index items referring to the additional items in my downloaded file? Incidentally, on my tableViews I'm using NSFetchedResultsController so updating attributes will call [cell setNeedsDisplay]; .. about 60 times per cell, not a good thing and it can crash the app. Thanks for reading :)

    Read the article

  • Drupal 6 Forms formatting

    - by Steven1350
    I am trying to create a form in drupal 6 that has multiple items on the same line. More specificly, I want a right alligned form what has a textfield, dropdown-box, and button all on the same line. I know how to create the items, but drupal tends to put them all on seperate lines. How do I put it on one line? Thanks

    Read the article

  • jQuery querying the database

    - by mazhar kaunain baig
    The thing is that there are number of items in the HTML select list. I want to click on any of the items, then query the database on the id of that item, retrieve the value and then display that in the textbox. How would I query the database? I would really appreciate that if someone provides a code sample for querying the database.

    Read the article

  • C# recursive programming with lists

    - by David Torrey
    I am working on a program where each item can hold an array of items (i'm making a menu, which has a tree-like structure) currently i have the items as a list, instead of an array, but I don't feel like I'm using it to its full potential to simplify code. I chose a list over a standard array because the interface (.add, .remove, etc...) makes a lot of sense. I have code to search through the structure and return the path of the name (i.e. Item.subitem.subsubitem.subsubsubitem). Below is my code: public class Item { //public Item[] subitem; <-- Array of Items public List<Item> subitem; // <-- List of Items public Color itemColor = Color.FromArgb(50,50,200); public Rectangle itemSize = new Rectangle(0,0,64,64); public Bitmap itemBitmap = null; public string itemName; public string LocateItem(string searchName) { string tItemName = null; //if the item name matches the search parameter, send it up) if (itemName == searchName) { return itemName; } if (subitem != null) { //spiral down a level foreach (Item tSearchItem in subitem) { tItemName = tSearchItem.LocateItem(searchName); if (tItemName != null) break; //exit for if item was found } } //do name logic (use index numbers) //if LocateItem of the subitems returned nothing and the current item is not a match, return null (not found) if (tItemName == null && itemName != searchName) { return null; } //if it's not the item being searched for and the search item was found, change the string and return it up if (tItemName != null && itemName != searchName) { tItemName.Insert(0, itemName + "."); //insert the parent name on the left --> TopItem.SubItem.SubSubItem.SubSubSubItem return tItemName; } //default not found return null; } } My question is if there is an easier way to do this with lists? I've been going back and forth in my head as to whether I should use lists or just an array. The only reason I have a list is so that I don't have to make code to resize the array each time I add or remove an item.

    Read the article

  • Get spiral index from location

    - by ricick
    I'm using Alberto Santini's solution to this question to get a spiral grid reference based on an items index Algorithm for iterating over an outward spiral on a discrete 2D grid from the origin It's not the accepted solution, but it's the best for my needs as it avoids using a loop. It's working well, but what I want now is to do the inverse. Based on a known x and y coordinate return the index of a location. This is as a precursor to returning the items surrounding a given location.

    Read the article

  • jQuery div container

    - by vanzylv
    I'm looking for a component to manage programmaticaly added items (div's) in a parent container.The component should scale child items. Almost like a task bar,if a new item gets added it goes in the div container.

    Read the article

  • How to check results of LINQ to SQL query?

    - by rem
    In a WPF app I'd like to check if a return of a LINQ to SQL query contains some records, but my approach doesn't work: TdbDataContext context = new TdbDataContext(); var sh = from p in context.Items where p.Selected == true select p; if (sh == null) { MessageBox.Show("There are no Selected Items"); } Where am I wrong?

    Read the article

  • Endless scroll paging in jquery Safari

    - by socheata
    I'm using : $(window).scroll(function () { if ($(window).scrollTop() + 10 >= ($(document).height() - $(window).height())) { loadContent(); } } It works fine with Chrome, IE, Firefox but except in Safari. In function loadContent, I used JSON to load data, as this tutorial. But while I test in Safari, It takes the content twice from JSON. If the other takes 9 items, then Safari takes 18 items. Does anyone know how to solve this problem? Thanks.

    Read the article

< Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >