Search Results

Search found 1421 results on 57 pages for 'arbitrary'.

Page 8/57 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • tar: How to create a tar file with arbitrary leading directories w/o 'cd'ing to parent dir

    - by Yan
    Say I have a directory of files at /home/user1/dir1 and I want to create a tar with only "dir1" as the leading directory: /dir1/file1 /dir1/file2 I know I can first cd to the directory cd /home/user1/ tar czvf dir1.tar.gz dir1 But when writing scripts, jumping from directory to directory isn't always favorable. I am wondering is there a way to do it with absolute paths without changing current directories? I know I can always create a tar file with absolute paths INSIDE and use --strip-components when extracting but sometimes extra path names are extra private information that you don't want to distribute with your tar files. Thanks!

    Read the article

  • How to go about rotating logs which are arbitrary named and placed in deeply nested directories?

    - by Roman Grazhdan
    I have a couple of hosts which are basically a playground for developers. On these hosts, each of them has a directory under /tmp where he is free to do all he wants - store files, write logs etc. Of course, the logs are to be rotated, or else the disc will be 100% full in a week. The files can be plenty, but I've dealt with it with paths like /tmp/[a-e]*/* and so on and lived happily for a while, but as they try new cool stuff on the machine logrotate rules grow ugly and unmanageable, and it's getting more difficult to understand which files hit the glob. Also, logrotate would segfault if asked to rotate a socket. I don't feel like trying to enforce some naming policies in that environment, I think it's going to take quite a lot of time and get people annoyed and still would fail at some point. And I still need to manage the logs, not just rm the dirs at night. So is it a good idea in circumstances like these to write a script which would handle these temporary files? I prefer sticking with standard utilities whenever possible, but here I think logrotate is getting less and less manageable. And probably someone heard of some logrotate alternatives which would work well in such an environment? I don't need emailing logs or some other advanced features, so theoretically some well commented find | xargs would do. P.S. I do have a log aggregator but this stuff is not going to touch my little cute logstash machine.

    Read the article

  • How can I set an arbitrary (non default) attribute for an AD user or AD Contact?

    - by makerofthings7
    I have AD Users, or contacts that are not Exchange Mailbox users, or contacts. I also have a SSO system (Ping Identity... technology similar to Microsoft ADFS), where it leverages the AD Schema attribute: CustomAttribute1 to store information needed for SSO. This CustomAttribute1 was created by the Exchange Schema. I would like to use CustomAttribute1 for both AD Users and AD Contacts, as well as the Exchange equivalent user and contacts. Question Since the Exchange tools will only allow me to modify "Exchange" users, what is the way to modify the AD counterpart? e.g. if the following command sets a mailbox... set-mailbox -Identity [email protected] -CustomAttribute1 [email protected] -WarningAction silentlyContinue What command will allow me to update an AD user (non-mailbox) under the same schema attribute?

    Read the article

  • Algorithm: Determine shape of two sectors delineated by an arbitrary path, and then fill one.

    - by Arseniy Banayev
    NOTE: This is a challenging problem for anybody who likes logic problems, etc. Consider a rectangular two-dimensional grid of height H and width W. Every space on the grid has a value, either 0 1 or 2. Initially, every space on the grid is a 0, except for the spaces along each of the four edges, which are initially a 2. Then consider an arbitrary path of adjacent (horizontally or vertically) grid spaces. The path begins on a 2 and ends on a different 2. Every space along the path is a 1. The path divides the grid into two "sectors" of 0 spaces. There is an object that rests on an unspecified 0 space. The "sector" that does NOT contain the object must be filled completely with 2. Define an algorithm that determines the spaces that must become 2 from 0, given an array (list) of values (0, 1, or 2) that correspond to the values in the grid, going from top to bottom and then from left to right. In other words, the element at index 0 in the array contains the value of the top-left space in the grid (initially a 2). The element at index 1 contains the value of the space in the grid that is in the left column, second from the top, and so forth. The element at index H contains the value of the space in the grid that is in the top row but second from the left, and so forth. Once the algorithm finishes and the empty "sector" is filled completely with 2s, the SAME algorithm must be sufficient to do the same process again. The second (and on) time, the path is still drawn from a 2 to a different 2, across spaces of 0, but the "grid" is smaller because the 2s that are surrounded by other 2s cannot be touched by the path (since the path is along spaces of 0). I thank whomever is able to figure this out for me, very very much. This does not have to be in a particular programming language; in fact, pseudo-code or just English is sufficient. Thanks again! If you have any questions, just leave a comment and I'll specify what needs to be specified.

    Read the article

  • How would you structure your entity model for storing arbitrary key/value data with different data t

    - by Nathan Ridley
    I keep coming across scenarios where it will be useful to store a set of arbitrary data in a table using a per-row key/value model, rather than a rigid column/field model. The problem is, I want to store the values with their correct data type rather than converting everything to a string. This means I have to choose either a single table with multiple nullable columns, one for each data type, or a set of value tables, one for each data type. I'm also unsure as to whether I should use full third normal form and separate the keys into a separate table, referencing them via a foreign key from the value table(s), or if it would be better to keep things simple and store the string keys in the value table(s) and accept the duplication of strings. Old/bad: This solution makes adding additional values a pain in a fluid environment because the table needs to be modified regularly. MyTable ============================ ID Key1 Key2 Key3 int int string date ---------------------------- 1 Value1 Value2 Value3 2 Value4 Value5 Value6 Single Table Solution This solution allows simplicity via a single table. The querying code still needs to check for nulls to determine which data type the field is storing. A check constraint is probably also required to ensure only one of the value fields contains non-nulll data. DataValues ============================================================= ID RecordID Key IntValue StringValue DateValue int int string int string date ------------------------------------------------------------- 1 1 Key1 Value1 NULL NULL 2 1 Key2 NULL Value2 NULL 3 1 Key3 NULL NULL Value3 4 2 Key1 Value4 NULL NULL 5 2 Key2 NULL Value5 NULL 6 2 Key3 NULL NULL Value6 Multiple-Table Solution This solution allows for more concise purposing of each table, though the code needs to know the data type in advance as it needs to query a different table for each data type. Indexing is probably simpler and more efficient because there are less columns that need indexing. IntegerValues =============================== ID RecordID Key Value int int string int ------------------------------- 1 1 Key1 Value1 2 2 Key1 Value4 StringValues =============================== ID RecordID Key Value int int string string ------------------------------- 1 1 Key2 Value2 2 2 Key2 Value5 DateValues =============================== ID RecordID Key Value int int string date ------------------------------- 1 1 Key3 Value3 2 2 Key3 Value6 How do you approach this problem? Which solution is better? Also, should the key column be separated into a separate table and referenced via a foreign key or be should it be kept in the value table and bulk updated if for some reason the key name changes?

    Read the article

  • WPF Layout algorithm woes - control will resize, but not below some arbitrary value.

    - by Quantumplation
    I'm working on an application for a client, and one of the requirements is the ability to make appointments, and display the current week's appointments in a visual format, much like in Google Calender's or Microsoft Office. I found a great (3 part) article on codeproject, in which he builds a "RangePanel", and composes one for each "period" (for example, the work day.) You can find part 1 here: http://www.codeproject.com/KB/WPF/OutlookWpfCalendarPart1.aspx The code presents, but seems to choose an arbitrary height value overall (440.04), and won't resize below that without clipping. What I mean to say, is that the window/container will resize, but it just cuts off the bottom of the control, instead of recalculating the height of the range panels, and the controls in the range panels representing the appointment. It will resize and recalculate for greater values, but not less. Code-wise, what's happening is that when you resize below that value, first the "MeasureOverride" is called with the correct "new height". However, by the time the "ArrangeOverride" method is called, it's passing the same 440.04 value as the height to arrange to. I need to find a solution/workaround, but any information that you can provide that might direct me for things to look into would also be greatly appreciated ( I understand how frustrating it is to debug code when you don't have the codebase in front of you. :) ) The code for the various Arrange and Measure functions are provided below. The "CalendarView" control has a "CalendarViewContentPresenter", which handles several periods. Then, the periods have a "CalendarPeriodContentPresenter", which handles each "block" of appointments. Finally, the "RangePanel" has it's own implementation. (To be honest, i'm still a bit hazy on how the control works, so if my explanations are a bit hazy, the article I linked probably has a more cogent explanation. :) ) CalendarViewContentPresenter: protected override Size ArrangeOverride(Size finalSize) { int columnCount = this.CalendarView.Periods.Count; Size columnSize = new Size(finalSize.Width / columnCount, finalSize.Height); double elementX = 0; foreach (UIElement element in this.visualChildren) { element.Arrange(new Rect(new Point(elementX, 0), columnSize)); elementX = elementX + columnSize.Width; } return finalSize; } protected override Size MeasureOverride(Size constraint) { this.GenerateVisualChildren(); this.GenerateListViewItemVisuals(); // If it's coming back infinity, just return some value. if (constraint.Width == Double.PositiveInfinity) constraint.Width = 10; if (constraint.Height == Double.PositiveInfinity) constraint.Height = 10; return constraint; } CalendarViewPeriodPersenter: protected override Size ArrangeOverride(Size finalSize) { foreach (UIElement element in this.visualChildren) { element.Arrange(new Rect(new Point(0, 0), finalSize)); } return finalSize; } protected override Size MeasureOverride(Size constraint) { this.GenerateVisualChildren(); return constraint; } RangePanel: protected override Size ArrangeOverride(Size finalSize) { double containerRange = (this.Maximum - this.Minimum); foreach (UIElement element in this.Children) { double begin = (double)element.GetValue(RangePanel.BeginProperty); double end = (double)element.GetValue(RangePanel.EndProperty); double elementRange = end - begin; Size size = new Size(); size.Width = (Orientation == Orientation.Vertical) ? finalSize.Width : elementRange / containerRange * finalSize.Width; size.Height = (Orientation == Orientation.Vertical) ? elementRange / containerRange * finalSize.Height : finalSize.Height; Point location = new Point(); location.X = (Orientation == Orientation.Vertical) ? 0 : (begin - this.Minimum) / containerRange * finalSize.Width; location.Y = (Orientation == Orientation.Vertical) ? (begin - this.Minimum) / containerRange * finalSize.Height : 0; element.Arrange(new Rect(location, size)); } return finalSize; } protected override Size MeasureOverride(Size availableSize) { foreach (UIElement element in this.Children) { element.Measure(availableSize); } // Constrain infinities if (availableSize.Width == double.PositiveInfinity) availableSize.Width = 10; if (availableSize.Height == double.PositiveInfinity) availableSize.Height = 10; return availableSize; }

    Read the article

  • YAML front matter for Jekyll and nested lists

    - by motleydev
    I have a set of nested yaml lists with something like the following: title: the example image: link.jpg products: - top-level: Product One arbitrary: Value nested-products: - nested: Associated Product sub-arbitrary: Associated Value - top-level: Product Two arbitrary: Value - top-level: Product Three arbitrary: Value I can loop through the products with no problem using for item in page.products and I can use a logic operator to determine if nested products exist - what I CAN'T do is loop through multiple nested-products per iteration of top-level I have tried using for subitem in item and other options - but I can't get it to work - any ideas?

    Read the article

  • defining a simple implicit Arbitary

    - by FredOverflow
    I have a type Foo with a constructor that takes an Int. How do I define an implicit Arbitrary for Foo to be used with scalacheck? implicit def arbFoo: Arbitrary[Foo] = ??? I came up with the following solution, but it's a bit too "manual" and low-level for my taste: val fooGen = for (i <- Gen.choose(Int.MinValue, Int.MaxValue)) yield new Foo(i) implicit def arbFoo: Arbitrary[Foo] = Arbitrary(fooGen) Ideally, I would want a higher-order function where I just have to plug in an Int => Foo function. I managed to cut it down to: implicit def arbFoo = Arbitrary(Gen.resultOf((i: Int) => new Foo(i))) But I still feel like there has got to be a slightly simpler way.

    Read the article

  • Is it possible to define XML schemata with node names specified via regular expressions?

    - by MartyIX
    Hello, I know it is probably a question against XML philosophy but still is it possible to define schemata for XML like this: <Root> <arbitrary-name-of-node> <Name></Name> <Position></Position> <!-- ... --> </arbitrary-name-of-node> <arbitrary-name-of-node> <Name></Name> <Position></Position> <!-- ... --> </arbitrary-name-of-node> </Root> where arbitrary-name-of-node matches regular expression [a-zA-Z0-9]? Thanks for an answer!

    Read the article

  • Is it possible to define XML scheme with node names specified via regular expressions?

    - by MartyIX
    Hello, I know it is probably a question against XML philosophy but still is it possible to define scheme for XML like this: <Root> <arbitrary-name-of-node> <Name></Name> <Position></Position> <!-- ... --> </arbitrary-name-of-node> <arbitrary-name-of-node> <Name></Name> <Position></Position> <!-- ... --> </arbitrary-name-of-node> </Root> where arbitrary-name-of-node matches regular expression [a-zA-Z0-9]? Thanks for an answer!

    Read the article

  • How can I line up WPF items in a Horizontal WrapPanel so they line up based on an arbitrary vertical

    - by Scott Whitlock
    I'm trying to create a View in WPF and having a hard time figuring out how to set it up. Here's what I'm trying to build: My ViewModel exposes an IEnumerable property called Items Each item is an event on a timeline, and each one implements ITimelineItem The ViewModel for each item has it's own DataTemplate to to display it I want to display all the items on the timeline connected by a line. I'm thinking a WrapPanel inside of a ListView would work well for this. However, the height of each item will vary depending on the information it displays. Some items will have graphic objects right on the line (like a circle or a diamond, or whatever), and some have annotations above or below the line. So it seems complicated to me. It seems that each item on the timeline has to render its own segment of the line. That's fine. But the distance between the top of the item to the line (and the bottom of the item to the line) could vary. If one item has the line 50 px down from the top and the next item has the line 100 px down from the top, then the first item needs 50 px of padding so that the line segments add up. I think I could solve that problem, however, we only need to add padding if these two items are on the same line in the WrapPanel! Let's say there are 5 items and only room on the screen for 3 across... the WrapPanel will put the other two on the next line. That's ok, but that means only the first 3 need to pad together, and the last 2 need to pad together. This is what's giving me a headache. Is there another approach I could look at?

    Read the article

  • Python: How would i write this 'if' statement for a word of arbitrary length?

    - by ElCarlos
    This is what I currently have: wordlist = [fox, aced, definite, ace] for word in wordlist: a = len(word) if (ord(word[a-(a-1)] - ord(word[(a-a)])) == ord(word[a-(a-2)])-ord(word[a-(a-1)]: print "success", word else: print "fail", word What I'm trying to do is calculate the ASCII values between each of the letters in the word. And check to see if the ord of the letters are increasing by the same value. so for fox, it would check if the difference between the ord of 2nd and 1st letters are equal to the ord difference of the 3rd and 2nd letters. However, with my current 'if' statement, only the first 3 letters of a word are compared. How can I rewrite this statement to cover every letter in a word of length greater than 3? Sorry if I can't present this clearly, thanks for your time.

    Read the article

  • Guessing the time zone from an arbitrary "location" string?

    - by Thomas
    I'm trying to run some statistics over the Stack Overflow data dump, and for that I would like to know the time zone for each user. However, all I have to go on is the completely free-form "location" string. I'll stress that I'm only looking for an approximation of the time zone; of course, in general this is an unsolvable problem. However, many people fill out their country, state and/or city, which should give a pretty good indication. It's okay if it fails for other cases. It doesn't have to be reliable, it doesn't have to be accurate, it doesn't have to cover all bases. I don't want to waste too much time on this, so I'm wondering if there is some code out there that can make a reasonable guess. Any language, platform, API or library goes. Any ideas?

    Read the article

  • Get Mechanize to handle cookies from an arbitrary POST (to log into https://www.t-mobile.com/ progra

    - by Horace Loeb
    I want to log into https://www.t-mobile.com/ programmatically. My first idea was to use Mechanize to submit the login form: However, it turns out that this isn't even a real form. Instead, when you click "Log in" some javascript grabs the values of the fields, creates a new form dynamically, and submits it. "Log in" button HTML: <button onclick="handleLogin(); return false;" class="btnBlue" id="myTMobile-login"><span>Log in</span></button> The handleLogin() function: function handleLogin() { if (ValidateMsisdnPassword()) { // client-side form validation logic var a = document.createElement("FORM"); a.name = "form1"; a.method = "POST"; a.action = mytmoUrl; // defined elsewhere as https://my.t-mobile.com/Login/LoginController.aspx var c = document.createElement("INPUT"); c.type = "HIDDEN"; c.value = document.getElementById("myTMobile-phone").value; // the value of the phone number input field c.name = "txtMSISDN"; a.appendChild(c); var b = document.createElement("INPUT"); b.type = "HIDDEN"; b.value = document.getElementById("myTMobile-password").value; // the value of the password input field b.name = "txtPassword"; a.appendChild(b); document.body.appendChild(a); a.submit(); return true } else { return false } } I could simulate this form submission by POSTing the form data to https://my.t-mobile.com/Login/LoginController.aspx with Net::HTTP#post_form, but I don't know how to get the resultant cookie into Mechanize so I can continue to scrape the UI available when I'm logged in. Any ideas?

    Read the article

  • Django: How do I add arbitrary html attributes to input fields on a form?

    - by User
    I have an input field that is rendered with a template like so: <div class="field"> {{ form.city }} </div> Which is rendered as: <div class="field"> <input id="id_city" type="text" name="city" maxlength="100" /> </div> Now suppose I want to add an autocomplete="off" attribute to the input element that is rendered, how would I do that? Or onclick="xyz()" or class="my-special-css-class"?

    Read the article

  • Divide a large amount of text on an arbitrary number of equal parts.

    - by kalininew
    I probably already fed up with their stupid questions, but I have one more question. I have a large piece of text <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? </p> <p> Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum </p> <p> soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? </p> <p> Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum </p> <p> soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. </p> <p> Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> <p> soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. </p> <p> Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, </p> At the exit I need to divide the text on the "n" equal parts, so that in these parts was about the same amount of text. Then I these part are arranged in columns and the need for these columns look about the same height. Another condition: Tags you can break (I mean that if the tag "p" contains a lot of text, it can be divided into two parts, to bring in another column). I think this is a monumental task, I shall be grateful for any help.

    Read the article

  • Is writing to a socket an arbitrary limitation of the sendfile() syscall?

    - by Sufian
    Prelude sendfile() is an extremely useful syscall for two reasons: First, it's less code than a read()/write() (or recv()/send() if you prefer that jive) loop. Second, it's faster (less syscalls, implementation may copy between devices without buffer, etc...) than the aforementioned methods. Less code. More efficient. Awesome. In UNIX, everything is (mostly) a file. This is the ugly territory from the collision of platonic theory and real-world practice. I understand that sockets are fundamentally different than files residing on some device. I haven't dug through the sources of Linux/*BSD/Darwin/whatever OS implements sendfile() to know why this specific syscall is restricted to writing to sockets (specifically, streaming sockets). I just want to know... Question What is limiting sendfile() from allowing the destination file descriptor to be something besides a socket (like a disk file, or a pipe)?

    Read the article

  • fitnesse test framework, arbitrary properties for test and queries/test runs based on them?

    - by Marcel
    hi, our testers have the requirement to store multiple properties for a test that are not present in the "properties". e.g. they want to store priority, a description(not in the wiki page itself) and so on. they don't want to use the tagging mechanism. is there a way to store any kind of new xml node in the properties.xml for a test? these properties should then be used to: query the fields via the search screen run tests based on the "SuiteResponder" ?suite=xxx&TAGx=abc&TAGy=cde they should be returned by "?properties" responder. they should appear in the test history of the test run in essence they want to store any kind of "meta" information in the properties.xml and work with them in all kinds of ways, search, run etc. does anybody here know if there is already something available in that direction? if not i think we have to "pimp" these features into fitnesse to make our testers happy. thanks a lot any help appreciated marcel ps: i've also posted the question in the yahoo fitnesse group

    Read the article

  • How to convert an arbitrary object to String with JSTL? (calling toString())

    - by hstoerr
    Is there any way to call toString() on an object with the JSTL? (I need the String representation of an enum as index in a map in a JSP EL expression.) I hoped something like ${''+object} would work like in java, but JSTL isn't that nice, and there does not seem to be any function that does it. Clarification: I have a variable somemap that maps Strings to Strings, and I have a variable someenum that is an enumeration. I'd like to do something like ${somemap[someenum.toString()]}. (Of course .toString() does not work, but what does?)

    Read the article

  • What is the best method to call an arbitrary JSON server from .NET (Specifically Windows Phone 7)

    - by davidhayes
    Hi, I have a server that I have no control over, it's JSON based and I've put together a simple proof of concept that calls the server using HTTPWebRequest etc and it works fine (if a little wordy since MS have removed all Synchronous I/O calls). Is there a better way of doing this? I've been looking at WCF as an option but any stable and reasonably performant library should do the job. This is a new area for me so I'm a little unsure what the best practice is (or where to find it out) Thanks in advance Dave

    Read the article

  • How do I read an arbitrary chunk from a PNG file?

    - by Mason Wheeler
    I've got some custom metadata to put into a PNG file. It's being saved through libpng, and it's not difficult to write out a custom chunk. I just call png_write_chunk with the name, length and data. But I can't see how to get the data back out again. I'd expect there to be a png_read_chunk function that takes a chunk name and returns a pointer to the data or something like that, but there's nothing like that in png.h. Does anyone know how to accomplish this?

    Read the article

  • Can I get a bitmap of an arbitrary window in another application process?

    - by Chris Farmer
    I am trying to automate a third-party Win32 application where I want to capture the graphics content of a particular window at defined time intervals. I am in the early phases of this, and I'm currently trying to use the Microsoft UI Automation API via C# to do most of the interaction between my client app and the external app. I can now get the external app to do what I want it to do, but now I want to capture the graphics from a specific window that seems to be some third-party owner-drawn control. How can I do this? The window I want to capture is the one marked by the red rectangle in this image: I have an implementation that sort of works, but it's dependent on the external app's UI being on top, and that's not guaranteed for me, so I'd prefer to find something more general. var p = Process.Start("c:\myapp.exe"); var mainForm = AutomationElement.FromHandle(p.MainWindowHandle); // "workspace" below is the window whose content I want to capture. var workspace = mainForm.FindFirst(TreeScope.Descendents, new PropertyCondition(AutomationElement.ClassNameProperty, "AfxFrameOrView70u")); var rect = (Rect) workspace.GetCurrentPropertyValue(AutomationElement.BoundingRectangleProperty); using (var bmp = new Bitmap((int)rect.Width, (int)rect.Height)) { using (var g = Graphics.FromImage(bmp)) { g.CopyFromScreen((int)rect.Left, (int)rect.Top, 0, 0, new Size((int)rect.Width, (int)rect.Height)); bmp.Save(@"c:\screenshot.png", ImageFormat.Png); } } The above works well enough when the automated app is on top, but it just blindly copies the screen in the rectangle, so my code is at the mercy of whatever happens to be running on the machine and might cover my app's window. I have read some suggestions to send the WM_PRINT message to the window. This question/answer from a few months back seemed promising, but when I use this code, I just get a white rectangle with none of my control's actual contents. var prop = (int)workspace.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty); var hwnd = new IntPtr(prop); using ( var bmp2 = new Bitmap((int)rect.Width, (int)rect.Height)) { using (Graphics g = Graphics.FromImage(bmp2)) { g.FillRectangle(SystemBrushes.Control, 0, 0, (int)rect.Width, (int)rect.Height); try { SendMessage(hwnd, WM_PRINT, g.GetHdc().ToInt32(), (int)(DrawingOptions.PRF_CHILDREN | DrawingOptions.PRF_CLIENT | DrawingOptions.PRF_OWNED)); } finally { g.ReleaseHdc(); } bmp2.Save(@"c:\screenshot.bmp"); } } So, first, is it even possible for me to reliably save a bitmap of a window's contents? If so, what is the best way, and what is wrong with my WM_PRINT with SendMessage attempt?

    Read the article

  • Sending the array of arbitrary length through a socket. Endianness.

    - by Negai
    Hi everyone, I'm fighting with socket programming now and I've encountered a problem, which I don't know how to solve in a portable way. The task is simple : I need to send the array of 16 bytes over the network, receive it in a client application and parse it. I know, there are functions like htonl, htons and so one to use with uint16 and uint32. But what should I do with the chunks of data greater than that? Thank you.

    Read the article

  • C++: select argmax over vector of classes w.r.t. arbitrary expression

    - by karpathy
    Hello, I have trouble describing my problem so I'll give an example: I have a class description that has a couple of variables in it, for example: class A{ float a, b, c, d; } Now, I maintain a vector<A> that contains many of these classes. What I need to do very very often is to find the object inside this vector that satisfies that one of it's parameters is maximal w.r.t to the others. i.e code looks something like: int maxi=-1; float maxa=-1000; for(int i=0;i<vec.size();i++){ res= vec[i].a; if(res > maxa) { maxa= res; maxi=i; } } return vec[maxi]; However, sometimes I need to find class with maximal a, sometimes with maximal b, sometimes the class with maximal 0.8*a + 0.2*b, sometimes I want a maximal a*VAR + b, where VAR is some variable that is assigned in front, etc. In other words, I need to evaluate an expression for every class, and take the max. I find myself copy-pasting this everywhere, and only changing the single line that defines res. What makes it even more complicated is that even the name of the vector changes. Sometimes it's vec, sometimes it can be something else. I have many vectors that contain A's. This could be changed if this makes the problem too hard. Is there some nice way to avoid this insanity in C++? What's the neatest way to handle this? Thank you!

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >