Daily Archives

Articles indexed Tuesday March 30 2010

Page 33/126 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • Django Distinct on queryset in forms.py

    - by Thomas
    Hi all, I try to get a list with distinct into the forms.py like this: forms.ModelMultipleChoiceField(queryset=Events.objects.values('hostname'), required=False).distinct() In the python shell this command works perfect, but when trying it in forms.py leaves me a blank form, so nothing appears. When i just do Events.objects.all() the form appears, but distinct doesn't work with Events.objects.all()... i also tried values_list etc but doesn't seem to fit into the forms neither... anyone got an idea how to get a SELECT DISTINCT into a ModelMultipleChoiceField? I read some other questions about this at stackoverflow but nothing seems to work out with me, so hopefully someone knows how to do this in forms.py. Thxs in advance

    Read the article

  • Biztalk suspended messages in database

    - by WtFudgE
    Hi, I was wondering if some1 knows where I can see the data of a suspended message in the biztalk database. I need this because about 900 messages have been suspended because of a validation and I need to edit all of them, resuming isn't possible. I know that info of suspended messages are shown in "BizTalkMsgBoxDb" in the table "InstancesSuspended" and that the different parts of each message are shown in the table "MessageParts". However I can't find the table where the actual data is stored. Does anyone have any idea where this can be done? Thx

    Read the article

  • iphone sdk: finding the direction of scrolling in UIScrollView

    - by Alex1987
    I have a UIScrollView with only horizontal scrolling allowed, and I would like to know which direction (left, right) the user scrolls. What I did was to subclass the UIScrollView and override the touchesMoved method: - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches withEvent:event]; UITouch *touch = [touches anyObject]; float now = [touch locationInView:self].x; float before = [touch previousLocationInView:self].x; NSLog(@"%f %f", before, now); if (now > before){ right = NO; NSLog(@"LEFT"); } else{ right = YES; NSLog(@"RIGHT"); } } But this method sometimes doesn't get called at all when I move. What do you think?

    Read the article

  • making the div width stretch to fit its contents

    - by Lina
    Hi, I have the following html code: <table> <tr> <td> <div id="fixmywidth" style="position:relative; height:30px;"> <div style="z-index: 2000; margin-top: 5px; height: inherit; position: absolute;"> <table style="height:inherit"> <tr style="height:inherit"> <td align="center" style="width: 31px; height: inherit;">&nbsp;</td> <td align="center" style="width: 31px; height: inherit;">&nbsp;</td> <td align="center" style="width: 31px; height: inherit;">&nbsp;</td> <td align="center" style="width: 31px; height: inherit;">&nbsp;</td> <td align="center" style="width: 31px; height: inherit;">&nbsp;</td> <td align="center" style="width: 31px; height: inherit;">&nbsp;</td> ........300 tds later <td align="center" style="width: 31px; height: inherit;">&nbsp;</td> </tr> </table> </div> </div> </td> </tr> </table> how do i make the div with the id "fixmywidth" width fit the width of the containing elemets? i tried width=100% and widht = auto but they wouldn't work thanks a trillion in advance, Lina

    Read the article

  • OutOfMemoryException, stack size is huge, large number of threads

    - by Captain Comic
    Hello, I was profiling my .net windows service. I was trying to discover OutOfMemoryException and discovered that my stack size is huge and is growing because the the number of threads keeps growing. Each thread gets 1024 KB on Windows x64 machine. Thus when my app has 754 threads the stack size would be 772 MB. The problem for me is that i don't know where these thread come from. Initially my app has a very limited number of threads and they keep growing with time. I have two suspicions - either these threads are created by WCF or by database connection. My application uses both WCF and datasets. Also I tried to profile my app in Ants do Trace i can see large number of System.ServiceModel.Channels.ClientReliableDuplexSessionChannel and this number is increasing with time. I can see thousands of these objects created. So what I want to know is who is creating threads (tools to discover, profilers) and if it is WCF who is creating these threads.

    Read the article

  • 10013 error (AccessDenied) on Silverlight Socet application

    - by Samvel Siradeghyan
    I am writing silverlight 3 application which is working on network. It works like client-server application. There is WinForm application for server and silverlight application for client. I use TcpListener on server and connect from client to it with Socket. In local network it works fine, but when I try to use it from internet it don't connect to server. I use IP address on local network and real IP with port number for internet version. I get error 10013 AccessDenied. Port number is correct and access policy exist. Firewall is turned of. Where is the problem? Thanks.

    Read the article

  • What is validating a binary search tree?

    - by dotnetdev
    I read on here of an exercise in interviews known as validating a binary search tree. How exactly does this work? What would one be looking for in validating a binary search tree? I have written a basic search tree, but never heard of this concept. Thanks

    Read the article

  • Logfile per Component Hierarchy

    - by Daniel Marbach
    Hello I have the following problem: ComponentA with Unique Name ChildComponent ChildChild AnotherChild Everytime a new instance of ComponentA is created I want to redirect the output to a unique file named ComponentA-UniqueName including all child component log entries. How can this be achieved? Daniel

    Read the article

  • GWT 1.4 TO 2.0 UiBinder

    - by manu sinha
    Hi I am upgrading a project with around 60 java classes, from 1.4 to 2.0 . Apart from replacing deprecated functions, adding generics, will converting the whole project into UI Binder approach i.e. XML and Corresponding working Java classes, be recommended. Or shall i go on adding new UI requirments using Ui Binder and leaving the existing code as it is?

    Read the article

  • case-insensitive regexp match on non-english text in perl cgi script

    - by jonny
    ok. I have list of catalog paths and need to filter out some of them. Match pattern comes in non-Unicode encoding. Tried following: require 5.004; use POSIX qw(locale_h); my $old_locale = setlocale(LC_ALL); setlocale(LC_ALL, "ru_RU.cp1251"); @{$data -> {doc_folder_rights}} = grep { $_->{doc_folder} =~/$_REQUEST{q}/i; # catalog path pattern in $_REQUEST{q} } @{$data -> {doc_folder_rights}}; setlocale(LC_ALL, $old_locale); What I need is case-insensitive regexp pattern matching when pattern contains russsian letters.

    Read the article

  • Very Intermittent Orientation on Device & Simulator

    - by Michael Waterfall
    I've noticed that I'm getting very intermittent orientation on my device & the simulator. I have a modal view controller that I present, and that is the only thing in my app which supports rotation. If I launch the app in portrait without moving the device, open the modal VC and then rotate the device, it usually works. However sometimes if I open the app holding the device in landscape, then rotate to portrait, launch the VC and then rotate the device, no rotation occurs. It seems very intermittent. Sometimes if I launch the app in portrait mode and then open the VC and rotate the device, nothing happens, and until I quit and relaunch it no orientation occurs in the app. It's strange because 50% of the time it works! Whenever I launch it through Xcode and set breakpoints in shouldAutorotateToInterfaceOrientation it always works! Anyone ever had this or know what's going on?

    Read the article

  • Automaticaly update ActiveRecord object

    - by Aleksandr Koss
    I have same models: class Father < ActiveRecord::Base has_many :children end class Child < ActiveRecord::Base  belongs_to :father end Then do something like that: $ script/console test Loading test environment (Rails 2.3.5) >> @f1 = Father.create :test => "Father" => #<Father id: 1, test: "Father", created_at: "2010-03-30 08:01:41", updated_at: "2010-03-30 08:01:41"> >> @f2 = Father.find :first => #<Father id: 1, test: "Father", created_at: "2010-03-30 08:01:41", updated_at: "2010-03-30 08:01:41"> >> @f1 == @f2 => true >> @f1.children => [] >> @f2.children => [] >> @f1.children.create :test => "Child1" => #<Child id: 1, test: "Child1", father_id: 1, created_at: "2010-03-30 08:02:15", updated_at: "2010-03-30 08:02:15"> >> @f1.children => [#<Child id: 1, test: "Child1", father_id: 1, created_at: "2010-03-30 08:02:15", updated_at: "2010-03-30 08:02:15">] >> @f2.children => [] >> @f2.reload => #<Father id: 1, test: "Father", created_at: "2010-03-30 08:01:41", updated_at: "2010-03-30 08:01:41"> >> @f2.children => [#<Child id: 1, test: "Child1", father_id: 1, created_at: "2010-03-30 08:02:15", updated_at: "2010-03-30 08:02:15">] As you see rails cache @f2 object. To get actual data we should call reload. There is a way to automatically reload @f2 after children update without calling method "reload"?

    Read the article

  • Ruby on Rails: Model.all.each vs find_by_sql("SELECT * FROM model").each ?

    - by B_
    I'm fairly new to RoR. In my controller, I'm iterating over every tuple in the database. For every table, for every column I used to call SomeOtherModel.find_by_sql("SELECT column FROM model").each {|x| #etc } which worked fine enough. When I later changed this to Model.all(:select => "column").each {|x| #etc } the loop starts out at roughly the same speed but quickly slows down to something like 100 times slower than the the find_by_sql command. These calls should be identical so I really don't know what's happening. I know these calls are not the most efficient but this is just an intermediate step and I will optimize it more once this works correctly. Thanks!

    Read the article

  • Java mail encoding

    - by Argiropoulos Stavros
    Using the code below i can send an email written in non-english and although the subject appears correctly the body appears as gibberish. Any ideas? Thank you public void postMail(String recipient, String subject, String message, String from) throws MessagingException, UnsupportedEncodingException { //Set the host smtp address Properties props = new Properties(); props.put("mail.smtp.host", "mail.infodim.gr"); // create some properties and get the default Session Session session = Session.getDefaultInstance(props, null); // create a message Message msg = new MimeMessage(session); // set the from and to address InternetAddress addressFrom = new InternetAddress(from); msg.setFrom(addressFrom); InternetAddress addressTo=new InternetAddress(recipient); msg.setRecipient(Message.RecipientType.TO, addressTo); // Setting the Subject and Content Type msg.setSubject(subject); msg.setContent(message, "text/plain"); Transport.send(msg); }

    Read the article

  • Active Directory: User UPN or DN for NTLM name, using pure LDAP?

    - by Bernd Haug
    I have a Java app that can authenticate to LDAP by logging users into the AD LDAP server with the NTLM name (which they are used to - this is a requirement). I now also need to do authorization, and hence need to find a forest-unique identifier for the user (DN or UPN should work), from which I can further query the directory. The method needs to be absolutely portable, even if the AD is structured in an unusual fashion, otherwise I could just do a string replacement and search for a UPN of "${ntlm-user}@${ntlm-domain}.${configured-trailing-domain}" How can I do this, using pure LDAP? Currently, I'm using the java.naming.directory package, which I'd like to keep using, since it doesn't throw up problems when not binding with a DN but logging in with an NTLM name?

    Read the article

  • Efficiency: Creating an array of doubles incrementally?

    - by Alan
    Consider the following code: List<double> l = new List<double>(); //add unknown number of values to the list l.Add(0.1); //assume we don't have these values ahead of time. l.Add(0.11); l.Add(0.1); l.ToArray(); //ultimately we want an array of doubles Anything wrong with this approach? Is there a more appropriate way to build an array, without knowing the size, or elements ahead of time?

    Read the article

  • Calling MethodBase's Invoke on a constructor (reflection)

    - by Alix
    Hi everyone. First of all, sorry if this has been asked before. I've done a pretty comprehensive search and found nothing quite like it, but I may have missed something. And now to the question: I'm trying to invoke a constructor through reflection, with no luck. Basically, I have an object that I want to clone, so I look up the copy constructor for its type and then want to invoke it. Here's what I have: public Object clone(Object toClone) { MethodBase copyConstructor = type.GetConstructor( new Type[] { toClone.GetType() }); return method.Invoke(toClone, new object[] { toClone }); //<-- doesn't work } I call the above method like so: List list = new List(new int[] { 0, 1, 2 }); List clone = (List) clone(list); Now, notice the invoke method I'm using is MethodBase's invoke. ConstructorInfo provides an invoke method that does work if invoked like this: return ((ConstructorInfo) method).Invoke(new object[] { toClone }); However, I want to use MethodBase's method, because in reality instead of looking up the copy constructor every time I will store it in a dictionary, and the dictionary contains both methods and constructors, so it's a Dictionary<MethodBase>, not Dictionary<ConstructorInfo>. I could of course cast to ConstructorInfo as I do above, but I'd rather avoid the casting and use the MethodBase method directly. I just can't figure out the right parameters. Any help? Thanks so much.

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >