Search Results

Search found 1021 results on 41 pages for 'has and belongs to many'.

Page 23/41 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • How to reliably measure available memory in Linux?

    - by Alex B
    Linux /proc/meminfo shows a number of memory usage statistics. MemTotal: 4040732 kB MemFree: 23160 kB Buffers: 163340 kB Cached: 3707080 kB SwapCached: 0 kB Active: 1129324 kB Inactive: 2762912 kB There is quite a bit of overlap between them. For example, as far as I understand, there can be active page cache (belongs to "cached" and "active") and inactive page cache ("inactive" + "cached"). What I want to do is to measure "free" memory, but in a way that it includes used pages that are likely to be dropped without a significant impact on overall system's performance. At first, I was inclined to use "free" + "inactive", but Linux's "free" utility uses "free" + "cached" in its "buffer-adjusted" display, so I am curious what a better approach is. When the kernel runs out of memory, what is the priority of pages to drop and what is the more appropriate metric to measure available memory?

    Read the article

  • Max number of web methods?

    - by Rippo
    Guys I have a web service in asp.net 2.0 that has 234 methods. It seems that when I add another method the site does not compile in VS2005 until I remove one first. I get a message saying that the new method I just added does not exist in a file that belongs in the Microsoft.Net/.../Temporary Files directory. I have restarted IIS, closed down VS2005, removed all files from this temp directory but to no avail. The only way to get the code to compile is to remove another one so as to keep 234 methods.... I can consistency replicate this behaviour so it cannot be my code. Now I know this seems strange but it is true! One other strange thing is that exactly 100 of the method names begin with the word GetXXXyyyZZZ Has anyone else experienced problems with the maximum number of methods that are allowed in a web service? Many Thanks

    Read the article

  • Feature categories for a social network

    - by mafutrct
    Not sure if this question belongs on SO. Anyway, please let me try to clarify the issue. I'm currently planning a social program. It's basically a chat server with the major additional ability to play games. I'd like to create categories of features that are offered to users. My question is, are there any useful standard feature categories? Does not have to be specific to my case, I'm interested in the general case as well. Just to give you an idea of what I'm thinking: functional e.g. play games social e.g. chatting operational e.g. 24/7 service availability I'm entirely unsure if this is the right place to ask, if you know of any better site to ask please don't hesitate to add a comment.

    Read the article

  • View plain text files with different background colors in Mac OSX, for different programming languag

    - by Werner
    Hi, I work with Mac OS X Leopard. I usually have 5 or 10 text files opened at the same time with different programming languages; one for a bash script, another for a python one, etc. When I use exposé all of them look the same, so it is difficult to select them. I wonder how could I work with just plain text files in OSX, so when they are opened in an editor the background color changes or some other thign, so when using exposé it is clear to me which window belongs to what language. I thought about inserting some kind of info to the last line of each document, and then creat some applescript that converts it to RTF or someother text document which includes color in bacjground, so then it is opened with textmate or someother app. Do you know a better approach for this? Thanks

    Read the article

  • Nested sql queries in rails when :has_and_belongst_to_many

    - by Godisemo
    Hello, In my application I the next task that has not already been done by a user. I have Three models, A Book that has many Tasks and then I have a User that has has and belongs to many tasks. The table tasks_users table contains all completed tasks so I need to write a complex query to find the next task to perform. I have came up with two solutions in pure SQL that works, but I cant translate them to rails, thats what I need help with SELECT * FROM `tasks` WHERE `tasks`.`book_id` = @book_id AND `tasks`.`id` NOT IN ( SELECT `tasks_users`.`task_id` FROM `tasks_users` WHERE `tasks_users`.`user_id` = @user_id) ORDER BY `task`.`date` ASC LIMIT 1; and equally without nested select SELECT * FROM tasks LEFT JOIN tasks_users ON tasks_users.tasks_id = task.id AND tasks_users.user_id = @user_id WHERE tasks_users.task_id IS NULL AND tasks.book_id = @book_id LIMIT 1; This is what I Have done in rails with the MetaWhere plugin book.tasks.joins(:users.outer).where(:users => {:id => nil}) but I cant figure out how to get the current user there too, Thanks for any help!

    Read the article

  • Fast parsing of PHP in C#

    - by Jessica Shea
    Hello there, I've got a requirement for parsing PHP files in C#. We essentially require some of the devs in another country to upload PHP files and once uploaded we need to check the php files and get a list of all the methods and classes/functions etc. I thought of using a regex but I can't workout if a function belongs to a class etc, so I was wondering if theres already something 'out there' that will parse out PHP files and spit out its functions (I'm trying to avoid writing a full blow AST implementation). Does anyone have any idea? I looked at Coco/R but I couldn't find a PHP grammar file. I'm using .NET 2.0 and C#.

    Read the article

  • Most efficient way for a lookup/search in a huge list (python)

    - by user229269
    Hey guys, -- I just parsed a big file and I created a list containing 42.000 strings/words. I want to query [against this list] to check if a given word/string belongs to it. So my question is: What is the most efficient way for such a lookup? A first approach is to sort the list [list.sort()] and then just use the if word in list: print 'word' -- which is really trivial and I am sure there is a better way to do it. My goal is to apply a fast lookup that finds whether a given string is in this list or not. If you have any ideas of another data structure, they are welcome. Yet, I want to avoid for now more sophisticated data-structures like Tries etc. I am interested in hearing ideas (or tricks) about fast lookups or any other python library methods that might do the search faster than the simple 'in'. Thanks in advance!

    Read the article

  • How do i serlialize the product using php?

    - by Ibrahim Azhar Armar
    hi, i am building a real estate application where in it will store the properties and search it. the property will have different categories like (residential, commercial, industrial or agricultural). based upon the category i want to serailize each and every property listing . for example the property with id 1 belongs to resedential will have the serial code rs_SOMERANDOMUNIQUENUMBER. and for commercial it can be cm_SOMERANDOMUNIQUENUMBER and so on. for this my database table looks like this. CREATE TABLE IF NOT EXISTS `propSerials` ( `id` bigint(20) NOT NULL auto_increment, `serial` varchar(50) NOT NULL, `property_id` int(10) UNIQUE NOT NULL, PRIMARY KEY  (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; what would be the best possible format to store the serial with the prefix according to category? thank you

    Read the article

  • Rails has_and_belongs_to_many join across 3 tables

    - by Birdman
    I have a three models: listing, category, and site. There is a many to many relationship between listing and site and there is a many to many relationship between listing and category. A listing thus belongs to one or more sites and one or more categories (a listing can appear on multiple sites and multiple categories). Given a site id and a category id, I want a set of all the listings. I understand how to get the listings from a site id (listings = site.listings) and how to get the listings from a category id (listings = category.listings), but how do I get the triple join of the set of listings from both a site id and category id? The sql would look something like (sit_id and cat_id are input): select l.name from listings l, categories_listings cl, listings_sites, ls where cl.category_id = cat_id and ls.site_id = sit_id and cl.listing_id = l.id and ls.listing_id = l.id Thanks in advance

    Read the article

  • Animation of UINavigationController's UIToolbar

    - by Michael Waterfall
    When presenting a view controller that has toolbar items, is it possible for the toolbar to slide in with the view controller (i.e. slide in from the right) as opposed to it sliding from the bottom? In the view controller that is being presented, I've got the toolbar being shown within the -viewWillAppear: method, but the toolbar is being slid up from the bottom of the screen as opposed to it looking like it belongs to the view controller. - (void)viewWillAppear:(BOOL)animated { [self.navigationController setToolbarHidden:NO animated:YES]; ... }

    Read the article

  • How to Select Multiple Records from Multiple Tables at Once - SQL Server/C#/.NET/T-SQL

    - by peace
    I have two tables Customer and CustomerPhone. Customer usually has multiple phone numbers, so when i run select statement on customer 101, i will get multiple records due to the multiple phone numbers. As you see below all the "Phone" and "Fax" field belongs to CustomerPhone table. These are considered as two records in the CustomerPhone table whereas the rest of fields relate to Customer table which is a single record. What should i do to fill Phone and Fax field in this case? Should i run select statement on CustomerPhone first and then run select statement on Customer?

    Read the article

  • PHP: detecting IP's entry to a specific IP range

    - by ilnur777
    I have the PHP function that determines whether one IP goes to a specific IP range, but I don't know how to find out the IP's network and mask. Can anyone help with this? <? // Example of calling and checking IP-address 192.168.0.4 // belonging to a network 192.168.0.0 with mask 255.255.255.248 if(ip_vs_net("192.168.0.4","192.168.0.0","255.255.255.248")){ print "Address belongs to a netwok<BR>"; } else { print "Address is out of subnetwork's range<BR>"; } function ip_vs_net($ip,$network,$mask){ if(((ip2long($ip))&(ip2long($mask)))==ip2long($network)){ return 1; } else { return 0; } } ?>

    Read the article

  • MySQL query for initial filling of order column

    - by Sejanus
    Sorry for vague question title. I've got a table containing huge list of, say, products, belonging to different categories. There's a foreign key column indicating which category that particular product belongs to. I.e. in "bananas" row category might be 3 which indicates "fruits". Now I added additional column "order" which is for display order within that particular category. I need to do initial ordering. Since the list is big, I dont wanna change every row by hand. Is it possible to do with one or two queries? I dont care what initial order is as long as it starts with 1 and goes up. I cant do something like SET order = id because id counts from 1 up regardless of product category and order must start anew from 1 up for every different category.

    Read the article

  • Generalised XML Serialization

    - by Tom W
    I apologise for asking a question that's probably been asked hundreds of times before, but I don't seem to be able to find an answer in the archives; probably because my question is too basic. I know that XML Serialization by default only touches public members and properties. Properties very often mask a private variable; particularly if they're readonly. Serializing these is fine; the value that the instance exposes to the world is what goes into the XML. But if Deserialization of the same data can't put the value back where it belongs, what's the point of doing it? Is there something I'm missing about how XML Serialization is normally used for classes with masking properties? Surely it can't be that the only answer is explicitly implementing Read/WriteXML - because that's more effort than it's worth!

    Read the article

  • What can I use the Google App Engine for?

    - by Sergio Boombastic
    This question possibly doesn't belong here. We'll see how the answers pan out, if this doesn't belong here please move it to where it belongs. I'm following the getting started guide for Google App Engine, and I'm seeing what it can and can't do. Basically, I'm seeing it's very similar to an MVC pattern. You create your model, then create a View that uses that Model to display information. Not only that, but it uses a controller of some kind in this fashion: application = webapp.WSGIApplication( [('/', MainPage)], debug=True) My question is, why would you use this Google App Engine if it's the same as using a number of other MVC frameworks? Is the only benefit you gain the load balancing being handled by Google automagically? What is a good example of something you would need the App Engine for? I'm trying to learn, so thanks for the discussion.

    Read the article

  • Ruby - model.rb:20: syntax error, unexpected keyword_end, expecting $end

    - by Yasir Adnan
    I don't understand what's wrong with my code. model.rb require 'Gemfile' DataMapper.setup(:default, 'mysql://root:password@localhost/rengine') Class User include DataMapper::Resource property :id, Serial # An auto-increment integer key property :email, String, format: :email_address property :username, String, required: true property :password, String , length: 10..255, required: true property :created_at, DateTime property :updated_at, DateTime #User can have mutiple posts has n, :posts end Class Post include DataMapper::Resource property :id, Serial # An auto-increment integer key property :title, String, required: true property :body, Text, required: true property :created_at, DateTime property :updated_at, DateTime #Posts belongs to a USer belongs_to :user end DataMapper.auto_upgrade! I didn't able to figure out. What's problem is here??

    Read the article

  • MySQL query : all records of one table plus count of another table

    - by Ricardo
    Hello Guys! I have 2 tables: User and Picture. The Picture table has the key of the user. So basically each user can have multiple pictures, and each picture belongs to one user. Now, I am trying to make the following query: I want to select all the user info plus the total number of pictures that he has (even if it's 0). How can I do that? Probably it sounds quite simple, but I am trying and trying and can't seem to find the right query. The only thing I could select is this info, but only for users that have at least 1 picture, meaning that the Pictures table has at least one record for that key... But I also wanna consider the users that don't have any. Any idea? Thanks!

    Read the article

  • What's the cross-browser way to capture all single clicks on a button?

    - by sany
    What's the best way to execute a function exactly once every time a button is clicked, regardless of click speed and browser? Simply binding a "click" handler works perfectly in all browsers except IE. In IE, when the user clicks too fast, only "dblclick" fires, so the "click" handler is never executed. Other browsers trigger both events so it's not a problem for them. The obvious solution/hack (to me at least) is to attach a dblclick handler in IE that triggers my click handler twice. Another idea is to track clicks myself with mousedown/mouseup, which seems pretty primitive and probably belongs in a framework rather than my application. So, what's the best/usual/right way of handling this? (pure javascript or jQuery preferred)

    Read the article

  • how to populate an entity you have extended in the Entity Framework?

    - by user169867
    I have an entity in my EDMX that I've extended with a few fields in a partial class like this: public partial class Employee { public string JobName {get;set;} } These properties are for display only. In the above example say the entity has a JobTypeID property. I wish JobName to be populated w/ the name that belongs to that JobTypeID. Is there anyway to query the employee record in EF including the value for the JobName property w/o explicity assigning each field using select()? The reason I ask is that there are a lot of fields in the Employee entity so I'd like to be able to take advantage of something like: ctx.Employees.Where(e=>e.EmployeeID==employeeID).Single() ...add somehow fill in JobName too Is this possible?

    Read the article

  • Inheritance in kohana

    - by Binaryrespawn
    Hi all, I have recently started to use Kohana and I know inheritance is in infancy stages at the moment. The work around is using a $_has_one annotation on the child class model. In may case i have "page" as the parent of "article". I have something like, protected $_has_one = array('mypage'=>array('model'=>'page', 'foreign_key'=>'id')); In my controller, I have an action which queries the database. In this query I am trying to access fields form the parent of "article" which is the "page". $n->articles=ORM::factory('article')->where('expires','=',0) ->where('articledate','<',date('y-m-d')) ->where('expirydate','>',date('y-m-d')) ->where('mypage->status','=','PUBLISHED') ->order_by('articledate','desc') ->find_all(); The status column resides in the page table and my query is generating an error to the effect of "cannot find status", clearly because it belongs to the parent. Any ideas ?

    Read the article

  • Using multiple databases within one application

    - by Alex
    I have a web application made for several groups of people not connected with each other. Instead of using one database for all of them, I'm thinking about making separate databases. This will improve the speed of the queries and make me free from checking to what group the user belongs. But since I'm working with LINQ to SQL, my classes are explicitly connected with the databases, so I will have to make separate DataContexts for all of the databases. So how can I solve this problem? Or should I just not bother and use one database only?

    Read the article

  • How can I copy an XmlNode from one XmlDocument to another?

    - by Chris Wenham
    I'm building a tool that authors/edits XML files, and I want to be able to populate it with template fragments defined in another XML file. For example, the tool has an "Add FooBarBaz Element" button that adds a element to the new document being created, and I want to add FooBarBaz by copying it from a template. Or let's say this is my template file: <Templates> <FooBarBaz Attribute="Value"> <ChildElement/> </FooBarBaz> </Templates> I can then grab a template fragment with .GetElementsByTagName("FooBarBaz"), and I'd like to be able to inject it into the new document with something like .AppendChild(templateNode). But the problem is that an XmlNode cannot be copied from one XmlDocument to another, even if you use .Clone() or .CloneNode(), because AppendChild() throws an exception saying that the template element belongs to another context. Is there an easy way to copy a System.Xml.XmlNode between System.Xml.XmlDocuments?

    Read the article

  • Branching and remote heads in Mercurial

    - by hekevintran
    I created a new branch using this command: hg branch new_branch After the first commit to the new branch, the default branch becomes inactive. If this is pushed the central repository will have only one head which belongs to the new branch. When my colleague pushes his commits on the default branch, he will get this error: pushing to ssh://... searching for changes abort: push creates new remote heads! (did you forget to merge? use push -f to force) Is there anything bad about forcing the push? Why are remote heads bad? How do you work remotely on separate branches and push to one repository?

    Read the article

  • How to refactor this Ruby on Rails code?

    - by yuval
    I want to fetch posts based on their status, so I have this code inside my PostsController index action. It seems to be cluttering the index action, though, and I'm not sure it belongs here. How could I make it more concise and where would I move it in my application so it doesn't clutter up my index action (if that is the correct thing to do)? if params[:status].empty? status = 'active' else status = ['active', 'deleted', 'commented'].include?(params[:status]) ? params[:status] : 'active' end case status when 'active' #active posts are not marked as deleted and have no comments is_deleted = false comments_count_sign = "=" when 'deleted' #deleted posts are marked as deleted and have no comments is_deleted = true comments_count_sign = "=" when 'commented' #commented posts are not marked as deleted and do have comments is_deleted = false comments_count_sign = ">" end @posts = Post.find(:all, :conditions => ["is_deleted = ? and comments_count_sign #{comments_count_sign} 0", is_deleted])

    Read the article

  • What is the difference between remote procedure call and web service

    - by xiao
    Is there any clear definition about RPC and Web Service? A quick wikipedia search shows: RPC: Remote procedure call (RPC) is an Inter-process communication technology that allows a computer program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction. Web Service: Web services are typically application programming interfaces (API) or web APIs that are accessed via Hypertext Transfer Protocol and executed on a remote system hosting the requested services. Web services tend to fall into one of two camps: Big Web Services[1] and RESTful Web Services. I am not quite clear what the real difference between the two things. It seems that one thing could belongs to RPC and is kind of web service at the same time. Is Web Service a higher level representation of RPC?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >