Daily Archives

Articles indexed Saturday March 13 2010

Page 4/89 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • sql: can i do a max(count(*)) ?

    - by every_answer_gets_a_point
    here's my code: select yr,count(*) from movie join casting on casting.movieid=movie.id join actor on casting.actorid = actor.id where actor.name = 'John Travolta' group by yr here's the question Which were the busiest years for 'John Travolta'. Show the number of movies he made for each year. here's the table structure movie(id, title, yr, score, votes, director) actor(id, name) casting(movieid, actorid, ord) this is the output i am getting: yr count(*) 1976 1 1977 1 1978 1 1981 1 1994 1 etcetc i need to get the rows for which count(*) is max how do i do this?

    Read the article

  • Databind List Of Objects To A WinForms DataGridView, But Not Show Certain Public Properties

    - by Pyronaut
    I'm not even sure if i'm doing this correctly. But basically I have a list of objects that are built out of a class. From there, I am binding the list to a datagrid view that is on a Windows Form (C#) From there, it shows all the public properties of the object, in the datagrid view. However there is some properties that i still need accessible from other parts of my application, but aren't really required to be visible in the DataGridView. So is there an attribute or something similar that I can write above the property to exclude it from being shown. P.S. Im binding at runtime. So i cannot edit the columns via the designer. P.P.S. Please no answers of just making public variables (Although if that is the only way, let me know :)).

    Read the article

  • LiteSpeed vs Apache httpd

    - by Luke
    I've been hearing things lately about the LiteSpeed webserver as being a drop-in replacement for Apache webserver. Even my web host is going to replace their shared webhost environment with LiteSpeed (I'm currently not sure if I must be happy about that or not). Does anyone have any experience with the LiteSpeed webserver (both in development and production)? It would be appreciated if you could share your experience here.

    Read the article

  • Webservice complex types and class inheritance

    - by pygorex1
    Using the following Webservice definition using aClientArgs as a complex type: [System.Web.Script.Services.ScriptService] public class Controller : System.Web.Services.WebService { [WebMethod] public void save_client(aClientArgs client) { // Save client data } } Then defining aClientArgs as a sub-class: public class aArgs { public string id = null; public string name = null; } public class aClientArgs : aArgs { public string address = null; public string website = null; } Returns the following WSDL fragment for the save_client args: <save_client xmlns="http://tempuri.org/"> <client> <address>string</address> <website>string</website> </client> </save_client> When I'm expecting the following: <save_client xmlns="http://tempuri.org/"> <client> <id>string</id> <name>string</name> <address>string</address> <website>string</website> </client> </save_client> So it appears that the .NET WebService is not treating inherited properties as arguments/variables for purposes of a web service. How do I get .NET to also use the properties of the base class?

    Read the article

  • How can a component at designtime determine the project directory

    - by Heinz Z.
    Hello, I write a component which should store some information relative to the project directory. Every time a property of my component is changed it should write a file. So how can a component determine the current project directory at design time. Thanks in advance EDIT: I want to generate a delphi source file every time a property of my component is changed, so that I always get the latest version when I compile my code. Think of it as a kind of code generator. At the moment I set whole path and filename where the source should be stored but I prefer a relative path to the project (or the form/datamodule which contains my component) to make it easier to copy the project on different developer machines.

    Read the article

  • Confused as to which Prototype helper to use

    - by user284194
    After reading http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html I just can't seem to find what I'm looking for. I have a simplistic model that deletes the oldest message after the list of messages reaches 24, the model is this simple: class Message < ActiveRecord::Base after_create :destroy_old_messages protected def destroy_old_messages messages = Message.all(:order => 'updated_at DESC') messages[24..-1].each {|p| p.destroy } if messages.size >= 24 end end There is a message form below the list of messages which is used to add new messages. I'm using Prototype/RJS to add new messages to the top of the list. create.rjs: page.insert_html :top, :messages, :partial => @message page[@message].visual_effect :grow #page[dom_id(@messages)].replace :partial => @message page[:message_form].reset My index.html.erb is very simple: <div id="messages"> <%= render :partial => @messages %> </div> <%= render :partial => "message_form" %> When new messages are added they appear just fine, but when the 24 message limit has been reached it just keeps adding messages and doesn't remove the old ones. Ideally I'd like them to fade out as the new ones are added, but they can just disappear. The commented line in create.rjs actually works, it removes the expired message but I lose the visual effect when adding a new message. Does anyone have a suggestion on how to accomplish adding and removing messages from this simple list with effects for both? Help would be greatly appreciated. Thanks for reading. P.S.: would periodically_call_remote be helpful in this situation?

    Read the article

  • Are there any ASP.NET MVC subscription-based starter kits or examples?

    - by Wayne M
    Basically something that handles the low-level "plumbing" code for a subscription-based service. I see a lot of things dealing with basic membership, but nothing that handles the subscription aspect (recurring billing, automated jobs for setting up billing, notification for billing, etc). This might be the one thing that keeps me from using ASP.NET MVC for my SaaS idea, since it would take a fair amount of development time to write my own; if I go with my other option, Ruby on Rails, I can buy a kit that does all of this for $250. I haven't found anything even remotely close to this for .NET - all of the SaaS sample apps I've seen are more like StackOverflow et all where you have one site that multiple people log on to, not the web application model where you have subscribers who are billed monthly, each of whom has users and other entities (e.g. Customers, Tasks, etc) for their own site. Is there anything similar for ASP.NET, or some kind of guidelines for writing my own if I have to, so I don't waste too much time? As a startup that means that I'm doing all the coding myself. I've found this, but it seems to only be for billing and didn't seem to have much (any?) documentation on exactly how to set it up.

    Read the article

  • Accessing the ASP.NET Cache from a Separate Thread?

    - by maxp
    Normally i have a static class that reads and writes to HttpContext.Current.Cache However since adding threading to my project, the threads all get null reference exceptions when trying to retrieve this object. Is there any other way i can access it, workarounds or another cache i can use?

    Read the article

  • asp.net MVC: binary deployment of mvc views

    - by user287107
    Hi, how can I deploy an mvc application, without publishing the aspx view files. Is there a way to publish the generated dll assemblies? In the project file is an option "MvcBuildViews", which builds these dll files. But they are build in a temp directory and not used in the publishment process. Is there a way to include these files? best regards

    Read the article

  • WAN Optimization Resources

    - by Paul
    I'm looking for resources on writing software to do WAN optimization. I've googled this and searched SO, but there doesn't seem to be much around. The only things I've found are high-level articles in tech magazines, and info for network admins on how to make use of existing WAN optimization products. I'm looking for something on the techniques etc. used to write WAN optimization software. It seems to be a dark art, and the people who know how to do it, guard their secrets closely. Any suggestions?

    Read the article

  • iPhone SDK 3.2 beta 4 missing arm architecture

    - by David Beck
    Ever since I upgraded to iPhone SDK 3.2 beta 4, when I try to compile for device I get a warning for most of my libraries (libxml2.dylib, libobjc.A.dylib etc.) saying that it is missing the required architecture arm in file. Checking the libraries with lipo, I see that they all have arm5-7. Surely someone else had to of run into this.

    Read the article

  • CSS: background image does not fill when scrolling

    - by rekindleMyLoveOf
    Hi, working on a very small site which loads in one go, so there is a div which holds all the background images, and on top of that (i.e. higher z-index) there is a content div which holds everything. I can switch backgrounds easily based on what content is selected. Unfortunately, I noticed if you launch in a small window so that scrollbars appear, if you scroll there is no background image in the 'revealed' portions of the page. :-( Page structure: <body> <div id="bg"> <div class="bgone"></div> <div class="bgtwo"></div> </div> <div id="container"> <!-- content panels here --> </div> </body> css: #bg { margin: 0px; position: absolute; top: 0px; left: 0px; width:100%; height: 1024px; z-index:1; } .bgone { margin: 0px; position: absolute; width:100%; height: 1024px; background-image:url(../images/one.jpg); background-position:top; background-repeat:repeat-x; z-index:2; } .bgtwo { margin: 0px; position: absolute; width:100%; height: 1024px; background-image:url(../images/two.jpg); background-position:top; background-repeat:repeat-x; z-index:3; } #container { position:relative; width:900px; padding:0px; margin:0px auto; height:600px; z-index:10; }

    Read the article

  • Django manager for _set in model

    - by Daniel Johansson
    Hello, I'm in the progress of learning Django at the moment but I can't figure out how to solve this problem on my own. I'm reading the book Developers Library - Python Web Development With Django and in one chapter you build a simple CMS system with two models (Story and Category), some generic and custom views together with templates for the views. The book only contains code for listing stories, story details and search. I wanted to expand on that and build a page with nested lists for categories and stories. - Category1 -- Story1 -- Story2 - Category2 - Story3 etc. I managed to figure out how to add my own generic object_list view for the category listing. My problem is that the Story model have STATUS_CHOICES if the Story is public or not and a custom manager that'll only fetch the public Stories per default. I can't figure out how to tell my generic Category list view to also use a custom manager and only fetch the public Stories. Everything works except that small problem. I'm able to create a list for all categories with a sub list for all stories in that category on a single page, the only problem is that the list contains non public Stories. I don't know if I'm on the right track here. My urls.py contains a generic view that fetches all Category objects and in my template I'm using the *category.story_set.all* to get all Story objects for that category, wich I then loop over. I think it would be possible to add a if statement in the template and use the VIEWABLE_STATUS from my model file to check if it should be listed or not. The problem with that solution is that it's not very DRY compatible. Is it possible to add some kind of manager for the Category model too that only will fetch in public Story objects when using the story_set on a category? Or is this the wrong way to attack my problem? Related code urls.py (only category list view): urlpatterns += patterns('django.views.generic.list_detail', url(r'^categories/$', 'object_list', {'queryset': Category.objects.all(), 'template_object_name': 'category' }, name='cms-categories'), models.py: from markdown import markdown import datetime from django.db import models from django.db.models import permalink from django.contrib.auth.models import User VIEWABLE_STATUS = [3, 4] class ViewableManager(models.Manager): def get_query_set(self): default_queryset = super(ViewableManager, self).get_query_set() return default_queryset.filter(status__in=VIEWABLE_STATUS) class Category(models.Model): """A content category""" label = models.CharField(blank=True, max_length=50) slug = models.SlugField() class Meta: verbose_name_plural = "categories" def __unicode__(self): return self.label @permalink def get_absolute_url(self): return ('cms-category', (), {'slug': self.slug}) class Story(models.Model): """A hunk of content for our site, generally corresponding to a page""" STATUS_CHOICES = ( (1, "Needs Edit"), (2, "Needs Approval"), (3, "Published"), (4, "Archived"), ) title = models.CharField(max_length=100) slug = models.SlugField() category = models.ForeignKey(Category) markdown_content = models.TextField() html_content = models.TextField(editable=False) owner = models.ForeignKey(User) status = models.IntegerField(choices=STATUS_CHOICES, default=1) created = models.DateTimeField(default=datetime.datetime.now) modified = models.DateTimeField(default=datetime.datetime.now) class Meta: ordering = ['modified'] verbose_name_plural = "stories" def __unicode__(self): return self.title @permalink def get_absolute_url(self): return ("cms-story", (), {'slug': self.slug}) def save(self): self.html_content = markdown(self.markdown_content) self.modified = datetime.datetime.now() super(Story, self).save() admin_objects = models.Manager() objects = ViewableManager() category_list.html (related template): {% extends "cms/base.html" %} {% block content %} <h1>Categories</h1> {% if category_list %} <ul id="category-list"> {% for category in category_list %} <li><a href="{{ category.get_absolute_url }}">{{ category.label }}</a></li> {% if category.story_set %} <ul> {% for story in category.story_set.all %} <li><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></li> {% endfor %} </ul> {% endif %} {% endfor %} </ul> {% else %} <p> Sorry, no categories at the moment. </p> {% endif %} {% endblock %}

    Read the article

  • jQuery - how to repeat a function within itself to include nested files

    - by brandonjp
    I'm not sure what to call this question, since it involves a variety of things, but we'll start with the first issue... I've been trying to write a simple to use jQuery for includes (similar to php or ssi) on static html sites. Whenever it finds div.jqinclude it gets attr('title') (which is my external html file), then uses load() to include the external html file. Afterwards it changes the class of the div to jqincluded So my main index.html might contain several lines like so: <div class="jqinclude" title="menu.html"></div> However, within menu.html there might be other includes nested. So it needs to make the first level of includes, then perform the same action on the newly included content. So far it works fine, but it's very verbose and only goes a couple levels deep. How would I make the following repeated function to continually loop until no more class="jqinclude" elements are left on the page? I've tried arguments.callee and some other convoluted wacky attempts to no avail. I'm also interested to know if there's another completely different way I should be doing this. $('div.jqinclude').each(function() { // begin repeat here var file = $(this).attr('title'); $(this).load(file, function() { $(this).removeClass('jqinclude').addClass('jqincluded'); $(this).find('div.jqinclude').each(function() { // end repeat here var file = $(this).attr('title'); $(this).load(file, function() { $(this).removeClass('jqinclude').addClass('jqincluded'); $(this).find('div.jqinclude').each(function() { var file = $(this).attr('title'); $(this).load(file, function() { $(this).removeClass('jqinclude').addClass('jqincluded'); }); }); }); }); }); });

    Read the article

  • Entity Framework SaveChanges error details

    - by Marek Karbarz
    When saving changes with SaveChanges on a data context is there a way to determine which Entity causes an error? For example, sometimes I'll forget to assign a date to a non-nullable date field and get "Invalid Date Range" error, but I get no information about which entity or which field it's caused by (I can usually track it down by painstakingly going through all my objects, but it's very time consuming). Stack trace is pretty useless as it only shows me an error at the SaveChanges call without any additional information as to where exactly it happened. Note that I'm not looking to solve any particular problem I have now, I would just like to know in general if there's a way to tell which entity/field is causing a problem. Quick sample of a stack trace as an example - in this case an error happened because CreatedOn date was not set on IAComment entity, however it's impossible to tell from this error/stack trace [SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.] System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value) +2127345 System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value) +232 System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb) +46 System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj) +4997789 System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) +6248 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues) +8084396 System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) +267 [UpdateException: An error occurred while updating the entries. See the inner exception for details.] System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) +389 System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache) +163 System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) +609 IADAL.IAController.Save(IAHeader head) in C:\Projects\IA\IADAL\IAController.cs:61 IA.IAForm.saveForm(Boolean validate) in C:\Projects\IA\IA\IAForm.aspx.cs:198 IA.IAForm.advance_Click(Object sender, EventArgs e) in C:\Projects\IA\IA\IAForm.aspx.cs:287 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5019

    Read the article

  • What might cause ruby to lock up while exiting?

    - by user30997
    I have a ruby script that does a few perforce operations (through the scripting API) then simply ends: def foo() ... end def bar() ... end foo() bar() puts __LINE__ exit 0 #end of file ...and while the LINE will print out, the process never ends, whether the exit(0) is there or not. This is ruby 1.8.6, primarily on the mac, but I'm seeing this on the PC as well. I'm doing the usual google poking around, but hoped there might be a voice of experience here to bank on. Thanks.

    Read the article

  • need help with mvc & routes

    - by geoff
    I'm very new to MVC and I'm trying to get a new site set up using it. For SEO reasons we need to make the url of a page something like "Recruiter/4359/John_Smith" or basically {controller}/{id}/{name}. I have that working when I create the url in the code behind like so... //r is a recruiter object that is part of the results for the view r.Summary = searchResult.Summary + "... &lt;a href=\"/Recruiter/" + r.Id + "/" + r.FirstName + "_" + r.LastName + "\"&gt;Read More&lt;/a&gt;" But when I am using the collection of results from a search in my view and iterating through them I am trying to create another link to the same page doing something like <%=Html.ActionLink<RecruiterController>(x => x.Detail((int)r.Id), r.RecruiterName)%> but that doesn't work. When I use that code in the view it gives me a url in the form of /Recruiter/Detail/4359 I was told by a coworker that I should use the Html.ActionLink to create the link in both the view and the controller so that if the route changes in the future it will automatically work. Unfortunately he wasn't sure how to do that in this case. So, my problems are... How can I make the Html.ActionLink work in the view to create a url like I need (like r.Summary above)? How do I use the Html.ActionLink in a controller instead of hardcoding the link like I have above?

    Read the article

  • Vista not supporting trueSpeech!

    - by csmba
    My web application has (server side) a wav file saved using truespeech and then a client (ie6, ie7) can ask to plat the file and the web server serves it.. All you need on xp is to have WMP 9 or higher and it all works. but on vista.. suddenly the vista client box can't play the file cause it doesn't support truespeech (some upgrade!) anyone has an idea of what should I do? You can suggest a way to make it work on the client (but in general, I don't like having to say that the solution includes installing anything on the client box) you can suggest I don't save the server side file in truespeech, and instead use something else (what?)

    Read the article

  • Script to create ODBC connection

    - by Mathew
    I need to deploy some software through SMS/SCCM and the software requires that an ODBC connection be created in Windows. The connection information I was given requires a user name and password. I have a batch script to import the connection information into the registry, however I don't know how to go about putting the user name and password in. I'd like to script this or put it in some kind of distributable package. Thanks, -Mathew

    Read the article

  • text-area-text-to-be-split-with-conditions repeated

    - by desmiserables
    I have a text area wherein i have limited the user from entering more that 15 characters in one line as I want to get the free flow text separated into substrings of max limit 15 characters and assign each line an order number. This is what I was doing in my java class: int interval = 15; items = new ArrayList(); TextItem item = null; for (int i = 0; i < text.length(); i = i + interval) { item = new TextItem (); item.setOrder(i); if (i + interval < text.length()) { item.setSubText(text.substring(i, i + interval)); items.add(item); } else { item.setSubText(text.substring(i)); items.add(item); } } Now it works properly unless the user presses the enter key. Whenever the user presses the enter key I want to make that line as a new item having only that part as the subText. I can check whether my text.substring(i, i + interval) contains any "\n" and split till there but the problem is to get the remaining characters after "\n" till next 15 or till next "\n" and set proper order and subText.

    Read the article

  • Best way to implement a Parsing/Editable Richtextbox in WPF

    - by lozzar
    I'm trying to implement (as a prototype initially), a richtextbox control which can be parsed in real time to apply certain formatting options to it. This is being done in WPF so I thought the best way to go about it would be to extend the existing rich text box control. I've run into the issue where it isn't documented well and the examples are quite slow (the ones I found have parse the whole document on every keystroke). The way I've currently decided to go about it is to create a custom Inline element which can hold the formatting tags, and the contents. Hence I only have to parse the current paragraph and the runs in that paragraph for formatting tags. Is there a better way to achieve this? Note this isn't for code/syntax based documents (so AvalonEdit isn't appropriate). Cheers

    Read the article

  • Forbid access to DVD/CD/USB for some users

    - by alex2k8
    I need to forbid all users except administrators to write into DVD/CD/USB drives on Windows XP. Googled around and there is a way to disable devices completely: Cdrom: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cdrom\Start (from 1 to 4) Usb: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR (from 3 to 4) but I need to disable them only for particular users.

    Read the article

  • Exchange 2003: Fresh install, couple noob questions.

    - by Eli
    Hi All, Thanks for reading! I have a small network set up for a local office here, and have a fresh install of Exchange 2003 on our sole-server PDC. The network uses one domain, call it ourdomain.net, which is DNSed locally, but not DNSed for the actual domain, so ourdomain.net works from within the network, but from outside, it's just pointed to some domain parking. I have a completely different domain, call it emaildomain.com, which is currently setup for our website and email, which is hosted with a standard hosting company. We've been using a combination of Thunderbird and Outlook (with local .pst files) for email. I've been asked to setup Exchange to work with our email, but am not familiar with it. The install seems to have gone just fine. The question is: How do I get email from a domain outside our network to work with the exchange server? Do I need to move the email for that domain to point to our local server (I so hope not!), or can I just set exchange so somehow slurp mail from the existing mailboxes on our host for that domain's mail? Or are there better ideas I don't know to ask for? Any help very appreciated - thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >