Search Results

Search found 1518 results on 61 pages for 'adam martinez'.

Page 10/61 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Python many-to-one mapping (creating equivalence classes)

    - by Adam Matan
    Hi, I have a project of converting one database to another. One of the original database columns defines the row's category. This coulmn should be mapepd to a new category in the new databse. For example, let's assume the original categories are:parrot, spam, cheese_shop, Cleese, Gilliam, Palin Now that's a little verbose for me, And I want to have these rows categorized as sketch, actor - That is, define all the sketches and all the actors as two equivalence classes. >>> monty={'parrot':'sketch', 'spam':'sketch', 'cheese_shop':'sketch', 'Cleese':'actor', 'Gilliam':'actor', 'Palin':'actor'} >>> monty {'Gilliam': 'actor', 'Cleese': 'actor', 'parrot': 'sketch', 'spam': 'sketch', 'Palin': 'actor', 'cheese_shop': 'sketch'} That's quite awkward- I would prefer having something like: monty={ ('parrot','spam','cheese_shop'): 'sketch', ('Cleese', 'Gilliam', 'Palin') : 'actors'} But this, of course, sets the entire tuple as a key: >>> monty['parrot'] Traceback (most recent call last): File "<pyshell#29>", line 1, in <module> monty['parrot'] KeyError: 'parrot' Any ideas how to create an elegant many-to-one dictionary in Python? Thanks, Adam

    Read the article

  • Integrate with Hawk Monitoring System

    - by Joel Martinez
    Hello, I am looking to integrate an existing product with Hawk (http://www.hawkms.com/), which our application support team uses to keep an eye on operations. I've never used the product so I was wondering if anyone could point me to some resources about how to expose performance data so that it can be monitored with Hawk. Specifically, the technologies we're using is asp.net and wcf ... but resources on other technology stacks would still be useful if they are available. Thanks!

    Read the article

  • How to load JPG file into NSBitmapImageRep?

    - by Adam
    Objective-C / Cocoa: I need to load the image from a JPG file into a two dimensional array so that I can access each pixel. I am trying (unsuccessfully) to load the image into a NSBitmapImageRep. I have tried several variations on the following two lines of code: NSString *filePath = [NSString stringWithFormat: @"%@%@",@"/Users/adam/Documents/phoneimages/", [outLabel stringValue]]; //this coming from a window control NSImageRep *controlBitmap = [[NSImageRep alloc] imageRepWithContentsOfFile:filePath]; With the code shown, I get a runtime error: -[NSImageRep imageRepWithContentsOfFile:]: unrecognized selector sent to instance 0x100147070. I have tried replacing the second line of code with: NSImage *controlImage = [[NSImage alloc] initWithContentsOfFile:filePath]; NSBitmapImageRep *controlBitmap = [[NSBitmapImageRep alloc] initWithData:controlImage]; But this yields a compiler error 'incompatible type' saying that initWithData wants a NSData variable not an NSImage. I have also tried various other ways to get this done, but all are unsuccessful either due to compiler or runtime error. Can someone help me with this? I will eventually need to load some PNG files in the same way (so it would be nice to have a consistent technique for both). And if you know of an easier / simpler way to accomplish what I am trying to do (i.e., get the images into a two-dimensional array), rather than using NSBitmapImageRep, then please let me know! And by the way, I know the path is valid (confirmed with fileExistsAtPath) -- and the filename in outLabel is a file with .jpg extension. Thanks for any help!

    Read the article

  • SEO redirects for removed pages

    - by adam
    Hi, Apologies if SO is not the right place for this, but there are 700+ other SEO questions on here. I'm a senior developer for a travel site with 12k+ pages. We completely redeveloped the site and relaunched in January, and with the volatile nature of travel, there are many pages which are no longer on the site. Examples: /destinations/africa/senegal.aspx /destinations/africa/features.aspx Of course, we have a 404 page in place (and it's a hard 404 page rather than a 30x redirect to a 404). Our SEO advisor has asked us to 30x redirect all our 404 pages (as found in Webmaster Tools), his argument being that 404's are damaging to our pagerank. He'd want us to redirect our Senegal and features pages above to the Africa page (which doesn't contain the content previously found on Senegal.aspx or features.aspx). An equivalent for SO would be taking a url for a removed question and redirecting it to /questions rather than showing a 404 'Question/Page not found'. My argument is that, as these pages are no longer on the site, 404 is the correct status to return. I'd also argue that redirecting these to less relevant pages could damage our SEO (due to duplicate content perhaps)? It's also very time consuming redirecting all 404's when our site takes some content from our in-house system, which adds/removes content at will. Thanks for any advice, Adam

    Read the article

  • Existing LINQ extension method similar to Parallel.For?

    - by Joel Martinez
    The linq extension methods for ienumerable are very handy ... but not that useful if all you want to do is apply some computation to each item in the enumeration without returning anything. So I was wondering if perhaps I was just missing the right method, or if it truly doesn't exist as I'd rather use a built-in version if it's available ... but I haven't found one :-) I could have sworn there was a .ForEach method somewhere, but I have yet to find it. In the meantime, I did write my own version in case it's useful for anyone else: using System.Collections; using System.Collections.Generic; public delegate void Function<T>(T item); public delegate void Function(object item); public static class EnumerableExtensions { public static void For(this IEnumerable enumerable, Function func) { foreach (object item in enumerable) { func(item); } } public static void For<T>(this IEnumerable<T> enumerable, Function<T> func) { foreach (T item in enumerable) { func(item); } } } usage is: myEnumerable.For<MyClass>(delegate(MyClass item) { item.Count++; });

    Read the article

  • How can I get read-ahead bytes?

    - by Bruno Martinez
    Operating systems read from disk more than what a program actually requests, because a program is likely to need nearby information in the future. In my application, when I fetch an item from disk, I would like to show an interval of information around the element. There's a trade off between how much information I request and show, and speed. However, since the OS already reads more than what I requested, accessing these bytes already in memory is free. What API can I use to find out what's in the OS caches? Alternatively, I could use memory mapped files. In that case, the problem reduces to finding out whether a page is swapped to disk or not. Can this be done in any common OS?

    Read the article

  • strange run time error message from CIImage initWithContentsOfURL

    - by Adam
    When executing the following code I receive a run time error when the code executes the second line of code. The error (which shows up in the debugger) says: [NSButton initWithContentsOfURL:]: unrecognized selector sent to instance 0x100418e10. I don't understand this message, because it looks to me (based on my source code) like the initWithContentsOfURL message is being sent to the myImage instance (of the CIImage class) ... not NSButton. Any idea what is going on? If it matters ... this code is in the Application Controller class module of an Xcode project (a Cocoa application) -- within a method that is called when I click on a button on the application window. There is only the one button on the window ... // Step1: Load the JPG file into CIImage NSURL *myURL = [NSURL fileURLWithPath:@"/Users/Adam/Documents/Images/image7.jpg"]; CIImage *myImage = [myImage initWithContentsOfURL: myURL]; if (myImage = Nil) { NSLog(@"Creating myImage failed"); return; } else { NSLog(@"Created myImage successfully"); }

    Read the article

  • Select elements based on class and element type

    - by Beau Martínez
    How can I select all elements within an HTML document with a specific class and specific element type? I'm trying to select all anchors with the class title loggedin from an HTML document (and then open them within the browser). These are within parragraphs with the class title. They are leafs in the following DOM tree: + body + div class='content' + div id='siteTable' class='sitetable linklisting' + div class='thing id-t3_xxxx xxx xxx link' + div class='entry unvoted' + p class='title' + a class='title loggedin ' Where x indicates variable content. (I'm looking to do this in raw JavaScript, ie, not in jQuery.)

    Read the article

  • Maven Java Source Code Generation for Hibernate

    - by Adam
    Hi, I´m busy converting an existing project from an Ant build to one using Maven. Part of this build includes using the hibernate hbm2java tool to convert a collection of .hbm.xml files into Java. Here's a snippet of the Ant script used to do this: <target name="dbcodegen" depends="cleangen" description="Generate Java source from Hibernate XML"> <hibernatetool destdir="${src.generated}"> <configuration> <fileset dir="${src.config}"> <include name="**/*.hbm.xml"/> </fileset> </configuration> <hbm2java jdk5="true"/> </hibernatetool> </target> I've had a look around on the internet and some people seem to do this (I think) using Ant within Maven and others with the Maven plugin. I'd prefer to avoid mixing Ant and Maven. Can anyone suggest a way to do this so that all of the .hbm.xml files are picked up and the code generation takes place as part of the Maven code generation build phase? Thanks! Adam.

    Read the article

  • How to break on unhandled exceptions in Silverlight

    - by Bruno Martinez
    In console .Net applications, the debugger breaks at the point of the throw (before stack unwinding) for exceptions with no matching catch block. It seems that Silverlight runs all user code inside a try catch, so the debugger never breaks. Instead, Application.UnhandledException is raised, but after catching the exception and unwinding the stack. To break when unhandled exceptions are thrown and not catched, I have to enable first chance exception breaks, which also stops the program for handled exceptions. Is there a way to remove the Silverlight try block, so that exceptions get directly to the debugger?

    Read the article

  • Converting PDF to PostScript with GhostScript

    - by Joel Martinez
    I installed ghostscript and updated the appropriate path variables ... however, I'm getting an error when I try to execute this command: C:\PROGRA~1\gs\gs8.64\lib>pdf2ps mydocument.pdf mydocument.ps Access is denied. Unable to open command line file _.at Is this the right command? did I miss some configuration or path setting? Otherwise, is there a sane method of doing this conversion? Thanks!

    Read the article

  • Internet Access in Ubuntu on VirtualBox

    - by Joel Martinez
    I recently installed Ubuntu on a VirtualBox VM ... it installed just fine (much easier than on VirtualPC). However, I'm unable to get internet access from the guest OS (ie. Ubuntu). Can anyone give me any pointers on how I might enable this? The Host OS is Windows Vista, and the hardware is an IBM Lenovo. Thanks! :-)

    Read the article

  • Table clusters in SQLServer

    - by Bruno Martinez
    In Oracle, a table cluster is a group of tables that share common columns and store related data in the same blocks. When tables are clustered, a single data block can contain rows from multiple tables. For example, a block can store rows from both the employees and departments tables rather than from only a single table: http://download.oracle.com/docs/cd/E11882_01/server.112/e10713/tablecls.htm#i25478 Can this be done in SQLServer?

    Read the article

  • Apply dynamic list of templates to an argument

    - by Diego Martinez
    I need apply a variable sequence of templates to an argument. example 1: arg:tpl1():tpl2():...:tplN() Suppose that i have other multi valued argument, and each value is the name for a dynamic template invocation. ¿What is the better form of apply all the templates from the list to my argument? tplNames : {name | <(name)(arg)>} not works, just apply a template ever to the same innitial value of my argument, i need the same result of example 1 but in a dynamic way. Thank you!!

    Read the article

  • What are the performance characteristics of SignalR at scale?

    - by Joel Martinez
    I'm interested in the performance characteristics of SignalR at scale ... particularly, how it behaves at the fringes of capability. When a server is at capacity, what happens? Does it drop messages? Do some clients not get notified? Are messages queued until all are delivered? And if so, will the queue eventually overflow and crash the server? I ask because conducting such a test myself would be impractical, and I'm hoping someone could point me to documentation speaking to this ... or perhaps someone could comment that has seen how SignalR behaves at scale. Thanks! note: I'm familiar with this other stackoverflow question on the stability and scalability of SignalR. But I believe my question is asking a slightly different question in that I'm not concerned with the theoretical scaling limits, I want to know how it behaves when it reaches the limits ... so I know what to be on the lookout for.

    Read the article

  • Tracking/Counting Word Frequency

    - by Joel Martinez
    I'd like to get some community consensus on a good design to be able to store and query word frequency counts. I'm building an application in which I have to parse text inputs and store how many times a word has appeared (over time). So given the following inputs: "To Kill a Mocking Bird" "Mocking a piano player" Would store the following values: Word Count ------------- To 1 Kill 1 A 2 Mocking 2 Bird 1 Piano 1 Player 1 And later be able to quickly query for the count value of a given arbitrary word. My current plan is to simply store the words and counts in a database, and rely on caching word count values ... But I suspect that I won't get enough cache hits to make this a viable solution long term. Can anyone suggest algorithms, or data structures, or any other idea that might make this a well-performing solution?

    Read the article

  • Should I worry about running out of HierarchyIDs?

    - by Bruno Martinez
    When you ask for a new HierarchyID between two others, the result gets progressively longer. For example, between 2/5.6 and 2/5.7 there's only 2/5.6.1 and other 4 component paths. The HierarchyID data type is limited to 800 some bytes, so you can't repeat this forever. Then again, integer types are also limited, but it isn't a problem in practice. Should I periodically defragment my table so that height doesn't grow unbounded?

    Read the article

  • How to refer to enum constants in c# xml docs

    - by Bruno Martinez
    I want to document the default value of an enum typed field: /// <summary> /// The default value is <see cref="Orientation.Horizontal" />. /// </summary> public Orientation BoxOrientation; The compiler warns that it couldn't resolve the reference. Prefixing F: or M: silences the compiler, but E: also does, so I'm unsure what prefix is correct.

    Read the article

  • Help with PHP MySQL join

    - by kester martinez
    Please help me to understand proper join syntax. I have table named inventory which has: trans_id trans_items items -> item_id trans_user employees -> person_id trans_date trans_comment trans_inventory As you can see above, trans_items is a foreign key in items table, and trans_user is a foreign key in employees table. Now what I want to do is to display in HTML the inventory table, but instead of displaying the item id, I want the ITEM NAME to be displayed. Here is what I have done. Please note I'm using CodeIgniter. public function getData(array $inputs) { $this->db->select('trans_items, trans_user, trans_date, trans_inventory, trans_comment'); $this->db->from('inventory'); $this->db->order_by('trans_date desc'); return $this->db->get()->result_array(); }

    Read the article

  • Can a CSS class inherit one or more other classes?

    - by Joel Martinez
    I feel dumb for having been a web programmer for so long and not knowing the answer to this question, I actually hope it's possible and I just didn't know about rather than what I think is the answer (which is that it's not possible). My question is whether it is possible to make a CSS class that "inherits" from another CSS class (or more than one). For example, say we had: .something { display:inline } .else { background:red } What I'd like to do is something like this: .composite { .something; .else } where the ".composite" class would both display inline and have a red background

    Read the article

  • Dynamic access to tables from another database inside an user function

    - by Alberto Martinez
    I have an user defined table function in SQL Server that aggregate data from several tables including a couple of tables of another database. That is done hardcoding the name of the database in the queries, but we want to make the database name configurable (because our databases usually share the server with the databases of other applications). I tried to construct a dynamic query string inside the function using the database name that is stored in a configuration table, but: When I tried exec(@sqlStatement) SQL Server said that execute string is not allowed inside a function. Then I tried exec sp_executesql @sqlStatement and the function was created, but when you execute it SQL Server says that inside a function you can only run extended functions and procedures. So the question is: is possible create a function or stored procedure that access a table in another database without having to recreate the function when the database name is different? TIA.

    Read the article

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