Daily Archives

Articles indexed Wednesday April 7 2010

Page 21/131 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Need help understanding WPF MeasureOverride and ArrangeOverride infinity and 0 sizes

    - by Scott Bilas
    I'm trying to build a simple panel that contains one child and will snap it to nearest grid sizes. I'm having a hard time figuring out how to do this by overriding MeasureOverride and ArrangeOverride. Here's what I'm after: I want my panel to tell its owner that (a) it wants to be as large as possible, then (b) when it finds out what that size is, it will size itself and its child UIElement according to the nearest smaller snap point. So if we're snapping to 10's, and I can be in a region no bigger than 192x184, the panel will tell its parent container "my actual size is going to be 190x180". That way anything bordering my control will be able to align to its edges, as opposed to the potential space. When I put my panel inside of a Grid, I get either 0 or PositiveInfinity (I forget) for the incoming size in the overrides, but what I need to know is "how big can my space actually get?" not infinities.. Part of the problem I think is what WPF considers magic values of PositiveInfinity and 0 for size. I need a way to say, via MeasureOverride "I can be as big as you will allow me" and in ArrangeOverride to actually size to the snapped size. Or am I going about this the completely wrong way? Measuring and arranging looks very complicated, just from wandering around a little in the code for the standard panels in Reflector.

    Read the article

  • Accessing XUL anonymous content using C++

    - by Vaibhav Gade
    Hi All, I am writing Firefox extension using C++. I am trying to access XUL:tabox element in "TabOpen" event handler, but I am unable access any XUL element. I am putting here pseudocode of my extension for reference: HandleEvent() { if (event type is TabOpen) { nsCOMPtr<nsIDOMNode> OriginalNode = do_QueryInterface(event->GetTarget); nsCOMPtr<nsIDOMNodeList> childlist; // // Note here that I got OriginalNode's local name as "tabbrowser" // OriginalNode->GetChildNodes(getter_AddRefs(childlist)); PRUint32 len; childlist->GetLength(&len); // Return 1; consider only "popup" child element. nsString localName; nsCOMPtr<nsIDOMNode> node1; childlist->Item(0, getter_AddRefs(node1)); node1->GetLocalName(localName); // Returns "popup" as the local name. } } By traversing the DOM tree through DOM Inspector, I came to know that XUL elements are anonymous content. How do I access these XUL elements? Very Thanks in advance, Vaibhav.

    Read the article

  • GAE modeling relationship options

    - by Sway
    Hi there, I need to model the following situation and I can't seem to find a consistent example on how to do it "correctly" for the google app engine. Suppose I've got a simple situation like the following: [Company] 1 ----- M [Stare] A company has one to many stores. Each store has an address made up of a address line 1, city, state, country, postcode etc. Ok. Lets say we need to create say an "Audit". An Audit is for a company and can be across one to many stares. So something like: [Audit] 1 ------ 1 [Company] 1 ------ M [Store] Now we need to query all of the "audits" based on the Store "addresses" in order to send the "Auditors" to the right locations. There seem to be numerous articles like this one: http://code.google.com/appengine/articles/modeling.html Which give examples of creating a "ContactCompany" model class. However they also say that you should use this kind of relationship only when you "really need to" and with "care" for performance. I've also read - frequently - that you should denormalize as much as possible thereby moving all of the "query-able" data into the Audit class. So what would you suggest as the best way to solve this? I've seen that there is an Expando class but I'm not sure if that is the "best" option for this. Any help or thoughts on this would be totally appreciated. Thanks in advance, Matt

    Read the article

  • How to Create a Folder in the Current Document Library if it's not already present?

    - by Rosh Malai
    All I want to do is to create a folder "MetaFolder" inside a document library. User can be on any document library and I would like to create this folder after item is added (so on itemAdded event handler). I do NOT want workflow so please dont suggest workflow. This code works but I have to hardcode the url but need to get url from current url. also need to verify the folder uHippo does not exists in the current doc library... public override void ItemAdded(SPItemEventProperties properties) { base.ItemAdded(properties); using (SPSite currentSite = new SPSite(properties.WebUrl)) using (SPWeb currentWeb = currentSite.OpenWeb()) { // This code works and creates Folder in the "My TEST Doc library" //SPList docLib = currentWeb.Lists["My TEST Doc Library"]; //SPListItem folder = docLib.Folders.Add(docLib.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, "My folder"); //folder.Update(); string doclibname = "Not a doclib"; //SPList doclibList = currentWeb.GetList(HttpContext.Current.Request.RawUrl); // NOT WORKING. Tried properties.weburl SPList doclibList = currentWeb.GetListFromUrl("https://mycompanyportal/sites/testsitecol/testwebsite/My%20TEST%20Doc%20Library/Forms/AllItems.aspx"); if (null != doclibList) { doclibname = doclibList.Title; } // this section also not working. // getting Object reference not set to an instance of an object or something like that. //if (currentWeb.GetFolder("uHippo").Exists == false) //{ SPListItem folder = doclibList.Folders.Add(doclibList.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, "uHippo"); folder.Update(); //} } }

    Read the article

  • "Strictly positive" in Agda

    - by Jason
    I'm trying to encode some denotational semantics into Agda based on a program I wrote in Haskell. data Value = FunVal (Value -> Value) | PriVal Int | ConVal Id [Value] | Error String In Agda, the direct translation would be; data Value : Set where FunVal : (Value -> Value) -> Value PriVal : N -> Value ConVal : String -> List Value -> Value Error : String -> Value but I get an error relating to the FunVal because; Value is not strictly positive, because it occurs to the left of an arrow in the type of the constructor FunVal in the definition of Value. What does this mean? Can I encode this in Agda? Am I going about it the wrong way? Thanks.

    Read the article

  • What is(are) currently the best language(s) for modern web site design? Recommendations?

    - by Jereme Hall
    I'm a little out of date, before HTML4 and javascript got AJAXy. Does anyone have opinions about the best tools for web site design? I'd rather avoid ASP and .NET, since I've got a limited budget. This seems like a good time to start fresh. Please keep the replies on the coding recommendations, as I already know how to register a domain name, redirect it, set up Apache. (I could use some opinions on the various Apache flavors)

    Read the article

  • Dynamically enable or disable RequiredFieldValidator based on value of DropDownList

    - by Jeremy
    I have an ASP.NET form with three text inputs, one each for "Work Phone", "Home Phone" and "Cell Phone". Each of these text inputs has a RequiredFieldValidator associated with it. I also have a DropDownList where the user can select the preferred phone type. I want to only require the field that is selected in the DropDownList. For example, if the user selects "Work Phone" from the DropDownList, I want to disable the RequiredFieldValidator for "Home Phone" and "Cell Phone", thereby only making the "Work Phone" field required. I have a method that enables and disables these validators based on the value of the DropDownList, but I cannot figure out when to call it. I want this method to run before the validation takes place on the page. How would I do that?

    Read the article

  • C: incompatible types in assignment

    - by The.Anti.9
    I'm writing a program to check to see if a port is open in C. One line in particular copies one of the arguments to a char array. However, when I try to compile, it says: error: incompatible types in assignment Heres the code. The error is on the assignment of addr #include <sys/socket.h> #include <sys/time.h> #include <sys/types.h> #include <arpa/inet.h> #include <netinet/in.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <netdb.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int main(int argc, char **argv) { u_short port; /* user specified port number */ char addr[1023]; /* will be a copy of the address entered by u */ struct sockaddr_in address; /* the libc network address data structure */ short int sock = -1; /* file descriptor for the network socket */ port = atoi(argv[1]); addr = strncpy(addr, argv[2], 1023); bzero((char *)&address, sizeof(address)); /* init addr struct */ address.sin_addr.s_addr = inet_addr(addr); /* assign the address */ address.sin_port = htons(port); /* translate int2port num */ sock = socket(AF_INET, SOCK_STREAM, 0); if (connect(sock,(struct sockaddr *)&address,sizeof(address)) == 0) { printf("%i is open\n", port); } if (errno == 113) { fprintf(stderr, "Port not open!\n"); } close(sock); return 0; } I'm new to C, so I'm not sure why it would do this.

    Read the article

  • jQuery live, change in not working in IE6, IE7

    - by fabian
    The code below works as expected in FF but not in IEs... $(document).ready(function() { $('div.facet_dropdown select').live('change', function() { var changed_facet = $(this).attr('id'); var facets = $('select', $(this).closest('form')); var args = window.location.href.split('?')[0] + '?ajax=1'; var clear = false; for(var i = 0; i < facets.length; i++) { var ob = $(facets[i]); var val = ob.val(); if(clear) { val = ''; } args += '&' + ob.attr('id') + '=' + val; if(ob.attr('id') == changed_facet) { clear = true; } } $.getJSON(args, function(json) { for(widget_id in json) { var sel = '#field-' + widget_id + ' div.widget'; $(sel).html(json[widget_id]); } }); }); });

    Read the article

  • Displaying build times in Visual Studio?

    - by Roger Lipscombe
    Our build server is taking too long to build one of our C++ projects. It uses Visual Studio 2008. Is there any way to get devenv.com to log the time taken to build each project in the solution, so that I know where to focus my efforts? Improved hardware is not an option in this case. I've tried setting the output verbosity (under Tools / Options / Projects and Solutions / Build and Run / MSBuild project build output verbosity). This doesn't seem to have any effect in the IDE. When running MSBuild from the command line (and, for Visual Studio 2008, it needs to be MSBuild v3.5), it displays the total time elapsed at the end, but not in the IDE. I really wanted a time-taken report for each project in the solution, so that I could figure out where the build process was taking its time. Alternatively, since we actually use NAnt to drive the build process (we use Jetbrains TeamCity), is there a way to get NAnt to tell me the time taken for each step?

    Read the article

  • how can i directly write or manage the graphics memory in c#?

    - by moon
    previously i was using picture box and its built in utilities to draw some heavy graphics initially it works very fine but when my GUI grows its response and update time becomes enough large that it shows delays, now i want to directly write in graphics memory to resolve this problem: first of all tell me is it a good idea if yes then i need some guide lines to do so, or any other good option will be accepted regards,

    Read the article

  • Hibernate Criteria: Return different entity type than rooted entity?

    - by Gilean
    I have entities similar to: ProductLine: id, name ProductLineContents: content_id, product_line_id Content: id, text, updated_time What I'd like to do is: for each product line, get the latest content (so if theres two content entries associated to one product line, the latest updated_time is rturned, and if one content item is associated to two product lines, it is returned twice). Something similar to: select content.* from productline inner join productlinecontents inner join content; However I can't seem to figure out how to have Hibernate Criteria return a different entity than the original one it was created with. So if I wanted to start the criteria at the product line with createCriteria(ProductLine.class) along with the proper joins, then it only returns ProductLine objects, but I need Content objects. What's the best way to accomplish this? The actual data model is much more complex and can't be modified

    Read the article

  • Prevent password leakage while using sql* loader

    - by Jai
    I have shell script calling Sql*loader utility which inturn uses username/password as arguments. This details cannot be stored on server in any form due to security related policies. i got 2 approaches to handle this situation, 1. create hidden parameter file with login details and limit the access to owner. again the implication is i cannot store login data in any format on server 2. Create the user as OS authenticated and straight away login into sql without any userid/password I am not able to figure out risks involved in 2nd approach which u experienced folks could have come across. let me know if there is any other approach to handle password leakage issue

    Read the article

  • Deploying CXF web service in weblogic 10.

    - by Rig Veda
    Earlier I used to create a war file out of web service and manually deploy it in weblogic. But now (somehow) weblogic doesn't recognize the web-service. Though the earlier jars continue to work. The WSDL's in both the cases are same. Any help would be welcome. But my question is how does weblogic find the web-service. Is it the WSDL or soemthing else?

    Read the article

  • Puzzle: find the minimum number of weights

    - by avd
    I came across this question: say given two weights 1 and 3, u can weigh 1,2 (by 3-1),3,4 (by 3+1). Now find the minimum number of weights so that you can measure 1 to 1000. So the answer was 1,3,9,27... I want to know how do you arrive at such a solution means powers of 3. What is the thought process? Source: http://classic-puzzles.blogspot.com/search/label/Google%20Interview%20Puzzles Solution: http://classic-puzzles.blogspot.com/2006/12/solution-to-shopkeeper-problem.html

    Read the article

  • Delphi - OnKeyPress occurs before TStringGrid updates cell with new character

    - by JMTyler
    Coding in Delphi, attaching an OnKeyPress event handler to a TStringGrid: The OnKeyPress event fires before the grid cell that the user is typing into has actually updated its value with the key that has been pressed. This is obviously a problem, when I want to know what the contents of that cell are at this moment, as in, as the user modifies it. The "hacked" solution is simple, if you're not considering every detail: just grab the value from the cell and, since the OnKeyPress event comes along with a Key parameter, append that value to the end - now you have the current value of the cell! False. What if the user has selected all the text in the cell (ie: "foo") and they are now typing 'b'. Since they selected the text, it will be erased and replaced with the letter 'b'. However, the value of the cell will still display as "foo" in OnKeyPress, and the value of Key will be 'b', so the above logic would lead the application to conclude that the cell now contains "foob", which we know is not true. So. Does anybody know how to get around this problem? Is there a way to make OnKeyPress react after the grid's contents have been updated, or perhaps a way to force an update at the start of the handler? I am desperately avoiding the use of the OnKeyUp event here, so any suggestions aside from that would be greatly appreciated.

    Read the article

  • FOSS HTML to PDF in Python, .Net or command line?

    - by jle
    I have google as much as I possible, checked stackoverflow several times, and yet I can not find a good html to pdf converter that can handle css. Is there a free and open source solution (even for commercial usage)? There are many solutions, with huge variety of price ranges, but I was looking for something open source and free. I have tried PISA for Python and it works fairly well, but is not free for commercial usage. Is there anything for .Net? I have not had success with iTextSharp.

    Read the article

  • how to attach window.close to cntrl+w keypress event in a xul window?

    - by Erik Vold
    I have a XUL window, and I want the cntrl+w hotkey to close the window, but when I attach: window.addEventListener("keypress", function(ev) { GM_log("onkeypress handler: \n" + "keyCode property: " + ev.keyCode + "\n" + "which property: " + ev.which + "\n" + "charCode property: " + ev.charCode + "\n" + "Character Key Pressed: " + String.fromCharCode(ev.charCode) + "\n"); }, true); to the page, it treats pressing 'w' and 'cntrl+w' the same, charCode 119.. how can I determine that cntrl+w was pressed so that I may window.close() ?

    Read the article

  • How to load a NIB inside of a view in another NIB?

    - by Sheehan Alam
    I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib contains a UIButton I want ChildViewController.xib to load in the ParentViewController.xib's UIView I have done the following: Created @property for UIView in ParentViewController Connected File's Owner to UIView in ParentViewController Set UIViewController in ParentViewController's NIB Name property to ChildViewController in Interface Builder Set ChildViewController view property to UIView in ParentViewController I was hoping this would load ChildViewController into my UIView in ParentViewController but no luck. I did get the following warning, which could be the culprit: 'View Controller (Child View)' has both its 'NIB Name' property set and its 'view' outlet connected. This configuration is not supported. I also have added additional code in ParentViewController's viewDidLoad(): - (void)viewDidLoad { [super viewDidLoad]; ChildViewController *childViewController = [[ChildViewController alloc]initWithNibName:@"ChildViewController" bundle:nil]; childViewController.view = self.myView; } Any thoughts on why ChildViewController does not load in the UIView of ParentViewController?

    Read the article

  • Mac OS X - Could not start Terminal.app - shell has illegal value

    - by chemm
    I can not run the Terminal.app after rolling back my system from time machine. Mac OS X Version 10.6.2 It displays the following error. "Your are not authorized to run this application" "The administrator has set your shell to an illegal value" After that I have deleted the file ~/Library/Preferences/com.apple.Terminal.plist But the same message is displayed. I have repaired all system rights with the DiskUtility but that did not help.

    Read the article

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