Search Results

Search found 332 results on 14 pages for 'baz'.

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

  • java xml pretty printing - preserve empty elements and white pace

    - by javamonkey79
    Basically, I am looking for a java library that will take this: <foo><bar> </bar><baz>yadda</baz></foo> And pretty print it to this: <?xml version="1.0" encoding="UTF-8"?> <foo> <bar> </bar> <baz>yadda</baz> </foo> e.g. preserving whitespace AND blank elements The closest I have got was with dom4j like so: OutputFormat format = OutputFormat.createPrettyPrint(); format.setTrimText( false ); However, this does not honor the whitespace unless the element contains other character data. I'm not opposed to writing something on my own, but I would think this has already been done, why reinvent the wheel?

    Read the article

  • Oracle - Parameterized Query has EXECUTIONS = PARSE_CALLS

    - by Cory Grimster
    We have a .NET application talking to Oracle 10g. Our DBA recently pulled a list of queries where executions is equal to parse_calls. We assumed that this would help us find all of the unparameterized queries in our code. Unexpectedly, the following query showed up near the top of this list, with 1,436,169 executions and 1,436,151 parses: SELECT bar.foocolumn FROM bartable bar, baztable baz WHERE bar.some_id = :someId AND baz.another_id = :anotherId AND baz.some_date BETWEEN bar.start_date AND (nvl(bar.end_date, baz.some_date + (1/84600)) - (1/84600)) Why is executions equal to parse_calls for this query?

    Read the article

  • CLR 4.0 inlining policy? (maybe bug with MethodImplOptions.NoInlining)

    - by ControlFlow
    I've testing some new CLR 4.0 behavior in method inlining (cross-assembly inlining) and found some strage results: Assembly ClassLib.dll: using System.Diagnostics; using System; using System.Reflection; using System.Security; using System.Runtime.CompilerServices; namespace ClassLib { public static class A { static readonly MethodInfo GetExecuting = typeof(Assembly).GetMethod("GetExecutingAssembly"); public static Assembly Foo(out StackTrace stack) // 13 bytes { // explicit call to GetExecutingAssembly() stack = new StackTrace(); return Assembly.GetExecutingAssembly(); } public static Assembly Bar(out StackTrace stack) // 25 bytes { // reflection call to GetExecutingAssembly() stack = new StackTrace(); return (Assembly) GetExecuting.Invoke(null, null); } public static Assembly Baz(out StackTrace stack) // 9 bytes { stack = new StackTrace(); return null; } public static Assembly Bob(out StackTrace stack) // 13 bytes { // call of non-inlinable method! return SomeSecurityCriticalMethod(out stack); } [SecurityCritical, MethodImpl(MethodImplOptions.NoInlining)] static Assembly SomeSecurityCriticalMethod(out StackTrace stack) { stack = new StackTrace(); return Assembly.GetExecutingAssembly(); } } } Assembly ConsoleApp.exe using System; using ClassLib; using System.Diagnostics; class Program { static void Main() { Console.WriteLine("runtime: {0}", Environment.Version); StackTrace stack; Console.WriteLine("Foo: {0}\n{1}", A.Foo(out stack), stack); Console.WriteLine("Bar: {0}\n{1}", A.Bar(out stack), stack); Console.WriteLine("Baz: {0}\n{1}", A.Baz(out stack), stack); Console.WriteLine("Bob: {0}\n{1}", A.Bob(out stack), stack); } } Results: runtime: 4.0.30128.1 Foo: ClassLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null at ClassLib.A.Foo(StackTrace& stack) at Program.Main() Bar: ClassLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null at ClassLib.A.Bar(StackTrace& stack) at Program.Main() Baz: at Program.Main() Bob: ClassLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null at Program.Main() So questions are: Why JIT does not inlined Foo and Bar calls as Baz does? They are lower than 32 bytes of IL and are good candidates for inlining. Why JIT inlined call of Bob and inner call of SomeSecurityCriticalMethod that is marked with the [MethodImpl(MethodImplOptions.NoInlining)] attribute? Why GetExecutingAssembly returns a valid assembly when is called by inlined Baz and SomeSecurityCriticalMethod methods? I've expect that it performs the stack walk to detect the executing assembly, but stack will contains only Program.Main() call and no methods of ClassLib assenbly, to ConsoleApp should be returned.

    Read the article

  • How do I include a module in a namespaced class?

    - by snl
    I am having trouble including a module in a namespaced class. The example below throws the error uninitialized constant Bar::Foo::Baz (NameError). What basic piece of Ruby knowledge am I missing here? module Foo module Baz def hello puts 'hello' end end end module Bar class Foo include Foo::Baz end end foo = Bar::Foo.new

    Read the article

  • Performance of .NET ILMerged assemblies

    - by matt
    I have two .NET libraries: "Foo.Bar" and "Foo.Baz". "Foo.Bar" is self-contained, while "Foo.Baz" references "Foo.Bar". Assuming I do the following: Use ILMerge to merge "Foo.Bar.dll" with "Foo.Baz.dll" into "Foo1.dll". Create a new solution containing the entirity of both "Foo.Bar" and "Foo.Baz" (since I have access to their source code), and compile this into "Foo2.dll". Will there be any differences in the performance of Foo1.dll and Foo2.dll when using their functionality from an external project? If so, how significant is this performance difference, and is it a once-off (on load?) or ongoing difference? Are there any other pros or cons with either approach?

    Read the article

  • Ant: make "available" throw an understandable error?

    - by digitala
    When running ant, how do I make an <available /> block throw an adequate error message? This is what I have so far: <target name="requirements"> <available classname="foo.bar.baz" property="baz.present" /> </target> <target name="directories" depends="requirements" if="baz.present"> <mkdir dir="build" /> </target> <target name="compile" depends="directories"> <!-- build some stuff --> </target> What I'm currently seeing when requirements fails is a message complaining about the ./build dir not being available. How can I change this so that a message is displayed about the missing class, such as "foo.bar.baz is not available"?

    Read the article

  • Java: autofiltering list?

    - by Jason S
    I have a series of items arriving which are used in one of my data structures, and I need a way to keep track of those items that are retained. interface Item {} class Foo implements Item { ... } class Baz implements Item { ... } class StateManager { List<Foo> fooList; Map<Integer, Baz> bazMap; public List<Item> getItems(); } What I want is that if I do the following: for (int i = 0; i < SOME_LARGE_NUMBER; ++i) { /* randomly do one of the following: * 1) put a new Foo somewhere in the fooList * 2) delete one or more members from the fooList * 3) put a new Baz somewhere in the bazMap * 4) delete one or more members from the bazMap */ } then if I make a call to StateManager.getItems(), I want to return a list of those Foo and Baz items, which are found in the fooList and the bazMap, in the order they were added. Items that were deleted or displaced from fooList and bazMap should not be in the returned list. How could I implement this? SOME_LARGE_NUMBER is large enough that I don't have the memory available to retain all the Foo and Baz items, and then filter them.

    Read the article

  • Coverting a vector of maps to map of maps in clojure

    - by Osman
    Hi, I've a vector of maps like this: [ {:categoryid 1, :categoryname "foo" } {:categoryid 2, :categoryname "bar" } {:categoryid 3, :categoryname "baz" } ] and would like to generate a map of maps like this for searching by categoryname { "foo" {:categoryid 1, :categoryname "foo" }, "bar" {:categoryid 2, :categoryname "bar" }, "baz" {:categoryid 3, :categoryname "baz" } } How can i achieve?

    Read the article

  • "Slice" out one element from a python dictionary

    - by BCS
    I have a dictionary: D = { "foo" : "bar", "baz" : "bip" } and I want to create new dictionary that has a copy of one of it's elements k. So if k = "baz": R = { "baz" : "bip" } what I'v got now is: R = { k : D[k] } But in my case k is a complex expression and I've got a whole stack of these. Caching k in a temporary looks about as ugly as the original option. What I'm looking for is a better (cleaner) way to do this.

    Read the article

  • Normalizing Strings using Regexes

    - by RasputinJones
    How do I match this string "1 & 2" from this string "Foo Bar 1 & 2"? How do I match this string "1, 2 & 3" from this string "Foo Baz 1, 2 & 3"? Trying to split out "Foo Bar" from the string using regexes while using the presence of "1 & 2" or "1, 2 & 3" as conditionals to normalize these strings into "Foo Bar 1" and "Foo Bar 2" or "Foo Baz 1", "Foo Baz 2" and "Foo Baz 3" respectively.

    Read the article

  • Flex 4 - Highlight keywords in a block of text using TextLine

    - by Baz
    I have a search and results page that I would like to highlight the keywords that were searched for, in the text of the results. It was suggested that I use TextLine for this, but I am having trouble figuring out how to make it work. I started a simple, compilable dummy application and was hoping someone could give me some tips on how to continue: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" initialize="initApp();"> <fx:Script> import flash.display.Sprite; import flash.text.engine.*; private var textLine:TextLine; private function initApp():void { var normalFormat:ElementFormat = new ElementFormat(null, 12, 0x000000); var highlightFormat:ElementFormat = new ElementFormat(null, 14, 0xff0000); var textBlock:TextBlock = new TextBlock(new TextElement("This is text that has KEYWORDS. I would like to highlight these KEYWORDS by changing their font color and adding a light yellow background graphic.", normalFormat)); textLine = textBlock.createTextLine(); textLine.y = 100; embeddedFontHolder.addChild(textLine); } </fx:Script> <mx:UIComponent width="100%" id="embeddedFontHolder" /> </s:Application> Anyone have any ideas? Cheers, Baz

    Read the article

  • Is it okay to define a [] method in ruby's NilClass?

    - by Silasj
    Ruby by default does not include the method [] for NilClass For example, to check if foo["bar"] exists when foo may be nil, I have to do: foo = something_that_may_or_may_not_return_nil if foo && foo["bar"] # do something with foo["bar"] here end If I define this method: class NilClass def [](arg) nil end end Something like that would make this possible, even if foo is nil: if foo["bar"] # do something with foo["bar"] end Or even: if foo["bar"]["baz"] # do something with foo["bar"]["baz"] here end Question: Is this a good idea or is there some reason ruby doesn't include this functionality by default?

    Read the article

  • Diff 2 files while ignoring parts of lines

    - by Millianz
    I would like to diff a file system. Currently my bash script prints out the file system recursively into a file (ls -l -R) and diffs it with an expected output. An example for a line in this file would be: drw---- 100000f3 00000400 0 ./foo/ My current diff command is diff "$TEMP_LOG" "$DIFF_FILE_OUT" --strip-trailing-cr --changed-group-format='%' --unchanged-group-format='' "$SubLog" As you can see I ignore additional lines in the current output file, I only care about lines that match with the master output. I now have the problem though that some files may differ in size, or a folder might even have a different name, but due to it's location I know what access rights it should have. For example: Output: ------- 00000000 00000000 528 ./foo/bar.txt Master: ------- 00000000 00000000 200 ./foo/bar.txt Only the size differs here, and it doesn't matter, I would like to just ignore certain parts of the diff, kind of like an ansi c comment. Master: ------- 00000000 00000000 /*200*/ ./foo/bar.txt -- OR -- Master: d------ 00000000 00000000 /*10*/ ./foo//*123123*///*76456546*//bar.txt Output: d------ 00000000 00000000 0 ./foo/asd/sdf/bar.txt And still have it diff correctly. Is this even possible with diff, or will I have to write a custom script for it? Since I'm fairly new to cygwin I might be using the completely wrong tool all together, I'm happy for any suggestions. Update: Taking a step back, here is the general task at hand that I want to achieve. I want to write a script that checks the file system to see if the read/write permissions are set up correctly. The structure of the file system is under my control, so I don't have to worry about it changing too much. Sometimes folders/files might not be present, but if they are their permissions must be checked. For Example assume that the following is a snapshot of the current file system structure drw ./foo drw ./foo/bar -rw ./foow/bar/bar.txt drw ./foo/baz -rw ./foo/baz/baz.txt And this is what the file system structure might dictate, i.e. if these folders / files are present, the permissions must match. drw ./foo drw ./foo/bar -rw ./foo/bar/bar.txt --- ./foo/bar/foobar.txt drw ./foo/baz -rw ./foo/baz/foobaz.txt In this case the file system checked out ok, since all files present match their expected values. The situation becomes more complicated as soon as certain folders might have any arbitrary name, only due to their location I know what their permissions should be. Assume that the directory ./foo/bar in the above example might be such a case, i.e. instead of bar the folder could have any name, but still match the -rw permissions. This seems like a very complicated situation, and I'm not even sure if I can solve it with bash scripting alone. I might have to write an actual application.

    Read the article

  • Cant deploy "war" file from Virtual Hosts, see a directory listing.

    - by Kaustubh P
    This is my httpd.conf configured with Virtual hosts: NameVirtualHost *:80 <VirtualHost *:80> ServerName http://foo.baz.in DocumentRoot /var/www/foo/ </VirtualHost> <VirtualHost *:80> ServerName http://bar.baz.in DocumentRoot /var/www/ </VirtualHost> The second virtual host is a Wordpress blog, configured with .htaccess, and index.php in the root i.e. /var/www, and rest of the files in wordpress's own folder. However, the first virtual host is a "war" file, and when I goto foo.baz.in, I see the directory listing, containing the war. I also tried changing the DocumentRoot to /var/www/foo/foo.war` but I get an error Restarting web server: apache2Warning: DocumentRoot [/var/www/foo/foo.war] does not exist I also changed the owner and permission of the war to www-data:www-data and changed the permissions to 755, but to no avail. How do I make apache deploy my "war"? Thanks.

    Read the article

  • In Sublime Text 2, how can I indent out to a straight column with multiple cursors on a ragged edge?

    - by mtoast
    Suppose I've got multiple cursors along several lines, like this: foo| barr| foobar| baz| How can I automatically push the whitespace at the end of each line out to a flat edge, like this?: foo | barr | foobar | baz | (In these examples, | is supposed to be my cursor.) EDIT #1 When you just Tab or Space from the initial arrangement, you get this: # Useful, but not what I'm looking for foo | barr | foobar | baz | That's useful, but not what I'm looking for. I'm looking for some kind of keyboard shortcut that will let me indent from a ragged multi-cursor insert out to a straight column.

    Read the article

  • Excel - Dynamic row reference based on the row I paste a formula into?

    - by michaelmichael
    I have a simple, oft-used formula that I paste as plain text into spreadsheets I receive. It looks something like this: =IF(D8="FOO", "BAR", "BAZ") It looks in D8 for the word "FOO". If it finds it it will show "BAR". If it doesn't it will show "BAZ" It works great. The problem is I have to paste this formula as plain text into many spreadsheets. It should ALWAYS look in column D for "FOO", however I don't always want it to look in row 8. I'd like it to look at whatever row I'm pasting it into. For example, if I pasted the above formula into row 25, say, I would like it to automatically change to this: =IF(D25="FOO", "BAR", "BAZ") Is there any way to achieve this?

    Read the article

  • NCurses, scrolling of multiline items, "current item" pointer and "selected items"

    - by mjf
    I am looking for hints/ideas for the best (most effective) way on how to scroll multi-line items as well as emphasizing of the "current item" and "selected items" such as: 1 FOO ITEM 1 Foo sub-item 2 Foo sub-item 3 Foo sub-item 2 BAR ITEM 1 Bar sub-item 3 BAZ ITEM 1 Baz sub-item 2 Baz sub-item 4 RAB ITEM 5 ZZZ ITEM 1 Zzz sub-item 2 Zzz sub-item 3 Zzz sub-item 4 Zzz sub-item using NCurses (some combination of windows, sub-windows, pads, copywin? Uff! In fact, the lines could exceed the stdscr's width so that possibility to scroll left/right would be also nice - pads?)... The whole items (including the sub-items) are supposed to be emphasized as full-width window/pad areas. The "current item" (including it's set of lines) should be emphasized (i.e. using A_BOLD), selected set of items of choice (including the set of lines for each the selected item) should be emphasized in another way (i.e. using A_REVERSE). What would you choose to cope with it the most effective NCurses way? (The less redrawals/refreshes the better and terminal is supposed to have the ability to change it's size - such as XTerm running under "floating window" management.) Thank you for your ideas (or perhaps some piece of code where something similar is already solved - I was not able to find anything helpful on the Internet. I mean I am not going to copy/paste foreign code but programming NCurses properly is still somehow difficult to me). P.S.: Would you suggest to "smooth-scroll" +1/-1 screen line or rather "jump-scroll" +lines/-lines of the items? (I personally prefer the latter one.) Sincerely, -- mjf

    Read the article

  • Best way to lay-out the website when sections of it are almost identical

    - by Linas
    so, I have a minisite for the mobile application that I did. The mobile application is a public transport (transit) schedule viewer for a particular city (let's call it Foo), and I'm trying to sell it via that minisite. I publish that minisite in www.myawesomeapplication.com/foo/. It has the usual "standard" subpages, like "About", "Compatible phones", "Contact", etc. Now, I have decided to create analogue mobile application for other cities, Bar and Baz. These mobile applications (products) would be almost identical to the one for the Foo city, thus the minisites for those would (should) look very similar too (except for some artwork and Foo = Bar replacement). The question is: what do you think would be the most logical way to lay-out the website in this situation, both from the business and search engine perspective? In other words, should I just duplicate the /foo/ website to /bar/ and /baz/, or would it be better to try to create a single website under root path (/)? I don't want search engine penalties for almost-duplicate information under /foo/, /bar/ and /baz/, and also I don't want a messy, non-localized website (I guess the user is more likely to buy something if he/she sees "This-and-that is the application for NYC, the city you live in", not "This-and-that is the application for city A, city B, ..., NYC, ..., and city Z.")

    Read the article

  • Partial specialization with reference template parameter fails to compile in VS2005

    - by Blair Holloway
    I have code that boils down to the following: template struct Foo {}; template & I struct FooBar {}; //////// template struct Baz {}; template & I struct Baz< FooBar { static void func(FooBar& value); }; //////// struct MyStruct { static const Foo s_floatFoo; }; // Elsewhere: const Foo MyStruct::s_floatFoo; void callBaz() { typedef FooBar FloatFooBar; FloatFooBar myFloatFooBar; Baz::func(myFloatFooBar); } This compiles successfully under GCC, however, under VS2005, I get: error C2039: 'func' : is not a member of 'Baz' with [ T=FloatFooBar ] error C3861: 'func': identifier not found However, if I change const Foo<T>& I to const Foo<T>* I (passing I by pointer rather than by reference), and defining FloatFooBar as: typedef FooBar FloatFooBar; Both GCC and VS2005 are happy. What's going on? Is this some kind of subtle template substitution failure that VS2005 is handling differently to GCC, or a compiler bug? (The strangest thing: I thought I had the above code working in VS2005 earlier this morning. But that was before my morning coffee. I'm now not entirely certain I wasn't under some sort of caffeine-craving-induced delirium...)

    Read the article

  • page wide bread crumb bar as at apple.com/store

    - by punkish
    I want to build a (don't know what to call it other than) bread crumb bar at the top of the page, kinda like at http://store.apple.com/us/browse/home/shop_mac/software, y'know, at the top of the page, the horizontal, light grey bar that looks like so [home icon] | Shop Mac | Mac Software Help | Account | Cart Actually, I've got that bar working, with a curved, square left edge, the intermediate chevrons, and the curved, square right edge. So, my bar looks like so [ Home > Foo > Bar > Baz ] I have little graphics fragments that make up the [ and the and the ] and the middle parts. The only problem is, I want the right edge to be at the right edge of my page. So, the above bar should look like so [ Home > Foo > Bar > Baz ] I want to have a variable number of entries in my bread crumb bar... so, I could have "Home, Foo, Bar, Baz" or I could have "Home, Foo" or "Home, Foo, Bar, Baz, Qux" and so on. In other words, I want the right edge of my bar to be dynamically long enough to extend to the edge of my web page. Suggestions?

    Read the article

  • jQuery does not return a JSON object to Firebug when JSON is generated by PHP

    - by Keyslinger
    The contents of test.json are: {"foo": "The quick brown fox jumps over the lazy dog.","bar": "ABCDEFG","baz": [52, 97]} When I use the following jQuery.ajax() call to process the static JSON inside test.json, $.ajax({ url: 'test.json', dataType: 'json', data: '', success: function(data) { $('.result').html('<p>' + data.foo + '</p>' + '<p>' + data.baz[1] + '</p>'); } }); I get a JSON object that I can browse in Firebug. However, when using the same ajax call with the URL pointing instead to this php script: <?php $arrCoords = array('foo'=>'The quick brown fox jumps over the lazy dog.','bar'=>'ABCDEFG','baz'=>array(52,97)); echo json_encode($arrCoords); ?> which prints this identical JSON object: {"foo":"The quick brown fox jumps over the lazy dog.","bar":"ABCDEFG","baz":[52,97]} I get the proper output in the browser but Firebug only reveals only HTML. There is no JSON tab present when I expand GET request in Firebug.

    Read the article

  • Formatting associative array declaration

    - by Drew Stephens
    When declaring an associative array, how do you handle the indentation of the elements of the array? I've seen a number of different styles (PHP syntax, since that's what I've been in lately). This is a pretty picky and trivial thing, so move along if you're interested in more serious pursuits. 1) Indent elements one more level: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); 2) Indent elements two levels: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); 3) Indent elements beyond the array constructor, with closing brace aligned with the start of the constructor: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); 4) Indent elements beyond the array construct, with closing brace aligned with opening brace: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); Personally, I like #3—the broad indentation makes it clear that we're at a break point in the code (constructing the array), and having the closing brace floating a bit to the left of all of the array's data makes it clear that this declaration is done.

    Read the article

  • pre_replace multi-dimensional array problem

    - by Martin
    I want to replace word groups by links. I use a multi-dimensional array to define these (in the real world there will be thousands of them). Here's the code: $text = "<html><body><pre> Here is Foo in text. Now come Baz? and Bar-X. Replace nothing here: Foo (followed by brackets). </pre></body></html>"; $s = array( array("t" => "Foo", "u" => "http://www.foo.com", "c" => "foo"), array("t" => "Baz?", "u" => "http://www.baz.net", "c" => "test"), array("t" => "Bar-X", "u" => "http://www.baz.org", "c" => "test") ); foreach ($s as $i => $row) { $replaced = preg_replace('/(?=\Q'.$row["t"].'\E[^(]+$)\b\Q'.$row["t"].'\E\b/m', '<a href="'.$row["u"].'" class="'.$row["c"].'">'.$row["t"].'</a>', $text); } echo $replaced; ?> The problem is that only one array element is replaced and not all. It's something about $text in peg_replace(). Anyone got a hint for me? Thanks!

    Read the article

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