Search Results

Search found 21663 results on 867 pages for 'result sets'.

Page 12/867 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Show different sub-sets in edit view

    - by Martin R-L
    In the context of C# 4, ASP.NET MVC 2, and NHibernate; I've got the following scenario: Let's assume an entity Product that have an association to ProductType. In a product edit view; how do I implement that only a sub-set of the product's properties are shown in an elegant and DRY way? Use a product view model builder, and from different view models automagically generate the view with my own Html.EditorForModel() (including drop-downs and other stuff not out-of-the-box)? Attribute the properties of one view model and use the Html.EditorForModel() way aforementioned? Use one model, but implement different web controls (view strategies) (can it be done DRY?)? Something else entirely?

    Read the article

  • dictionary interface for large data sets

    - by Richard
    I have a set of key/values (all text) that is too large to load in memory at once. I would like to interact with this data via a Python dictionary-like interface. Does such a module already exist? Reading key values should be efficient and values compressed on disk to save space.

    Read the article

  • Perl TDS character sets

    - by skiphoppy
    I'm using the FreeTDS driver with DBD::Sybase, connecting to an MS SQL Server. When I query certain values of certain records, I get this error: DBD::Sybase::st fetchrow_arrayref failed: OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (9) NUMBER = (99) Server , database Message String: WARNING! Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?'). This seems to happen for records that contain special Windows character-set characters, such as curly quotes, copied and pasted from people's Outlook and Word messages. Unfortunately, I do not have any control of this database; sanitizing the input on the way in is obviously the way to go, but is not available to me. What FreeTDS settings do I need to change to be able to successfully query these records?

    Read the article

  • Comparing two large sets of attributes

    - by andyashton
    Suppose you have a Django view that has two functions: The first function renders some XML using a XSLT stylesheet and produces a div with 1000 subelements like this: <div id="myText"> <p id="p1"><a class="note-p1" href="#" style="display:none" target="bot">?</a></strong>Lorem ipsum</p> <p id="p2"><a class="note-p2" href="#" style="display:none" target="bot">?</a></strong>Foo bar</p> <p id="p3"><a class="note-p3" href="#" style="display:none" target="bot">?</a></strong>Chocolate peanut butter</p> (etc for 1000 lines) <p id="p1000"><a class="note-p1000" href="#" style="display:none" target="bot">?</a></strong>Go Yankees!</p> </div> The second function renders another XML document using another stylesheet to produce a div like this: <div id="myNotes"> <p id="n1"><cite class="note-p1"><sup>1</sup><span>Trololo</span></cite></p> <p id="n2"><cite class="note-p1"><sup>2</sup><span>Trololo</span></cite></p> <p id="n3"><cite class="note-p2"><sup>3</sup><span>lololo</span></cite></p> (etc for n lines) <p id="n"><cite class="note-p885"><sup>n</sup><span>lololo</span></cite></p> </div> I need to see which elements in #myText have classes that match elements in #myNotes, and display them. I can do this using the following jQuery: $('#myText').find('a').each(function() { var $anchor = $(this); $('#myNotes').find('cite').each(function() { if($(this).attr('class') == $anchor.attr('class')) { $anchor.show(); }); }); However this is incredibly slow and inefficient for a large number of comparisons. What is the fastest/most efficient way to do this - is there a jQuery/js method that is reasonable for a large number of items? Or do I need to reengineer the Django code to do the work before passing it to the template?

    Read the article

  • Python Sets vs Lists

    - by mvid
    In Python, which data structure is more efficient/speedy? Assuming that order is not important to me and I would be checking for duplicates anyway, is a Python set slower than a Python list?

    Read the article

  • Vbscript - Creating a script that mirrors several sets of folders

    - by Kenny Bones
    Ok, this is my problem. I'm doing a logonscript that basically copies Microsoft Word templates from a serverpath on to a local path of each computer. This is done using a check for group membership. If MemberOf(ObjGroupDict, "g_group1") Then oShell.Run "%comspec% /c %LOGONSERVER%\SYSVOL\mydomain.com\scripts\ROBOCOPY \\server\Templates\Group1\OFFICE2003\ " & TemplateFolder & "\" & " * /E /XO", 0, True End If Previously I used the /MIR switch of robocopy, which is exellent. But, if a user is member of more than one group, the /MIR switch removes the content from the first group, since it's mirroring the content from the second group. Meaning, I can't have both contents. This is "solved" by not using the /MIR switch and just let the content get copied anyway. BUT the whole idea of having the templates on a server is so that I can control the content the users receive through the script. So if I delete a file or folder from the server path, this doesn't replicate on the local computer. Since I don't use the /MIR switch anymore. Comprende? So, what do I do? I did a small script that basically checks the folders and files and then removes them accordingly, but this actually ended up being the same functionality as the /MIR switch anyway. How do I solve this problem? Edit: I've found that what I actually need is a routine that scans my local template folder for files and folders and checks if the same structure exists in any of the source template folders. The server template folders are set up like this: \\fileserver\templates\group1\ \\fileserver\templates\group2\ \\fileserver\templates\group3\ \\fileserver\templates\group4\ \\fileserver\templates\group5\ \\fileserver\templates\group6\ And the script that does the copying is structures like this (pseudo): If User is MemberOf (group1) Then RoboCopy.exe \\fileserver\templates\group1\ c:\templates\workgroup *.* /E /XO End if If User is MemberOf (group2) Then RoboCopy.exe \\fileserver\templates\group2\ c:\templates\workgroup *.* /E /XO End if If User is MemberOf (group3) Then RoboCopy.exe \\fileserver\templates\group3\ c:\templates\workgroup *.* /E /XO End if Etc etc With the /E switch, I make sure it copies subfolders as well. And the /XO switch only copies files and folders that are newer than those in my local path. But it doesn't consider if the local path contains files or folders that doesn't exist on the server template path. So after the copying is done, I would like to check if any of the files or folders on my c:\templates\workgroup actually exists in either of the sources. And if they don't, delete them from my local path. Something that could be combined in these memberchecks perhaps?

    Read the article

  • Joomla 1.5 Media Manager sets incorrect file permissions when uploading

    - by Scott Mayfield
    Howdy all, I have a Joomla 1.5 installation running on Windows Server 2008, installed via the Web Platform Installer. When uploading images with the media manager (native uploader, not the flash bulk uploader), the files arrive on the server correctly, but are given incorrect permissions. Specifically, the IIS_IUSRS group is not given access to the file. I might be incorrect about what group/user is SUPPOSED to get access to the files, but so far, I've found that unless I give IIS_IUSRS access to the uploaded files, they won't appear on the site or in the media manager (appear as broken images). Once I give IIS_IUSRS permission to the files, they work fine. So far, all the research I've done has led me to linux specific fixes that involve either changing the umask on the server, or directly modifying the Joomla codebase to add an appropriate chmod command to the upload process, but I really don't want to modify Joomla directly. I have to believe there's a setting here somewhere that will do the job, either on the Joomla or Windows side of the equation. Any thoughts? Scott

    Read the article

  • Using IN with sets of tuples in SQL (SQLite3)

    - by gotgenes
    I have the following table in a SQLite3 database: CREATE TABLE overlap_results ( neighbors_of_annotation varchar(20), other_annotation varchar(20), set1_size INTEGER, set2_size INTEGER, jaccard REAL, p_value REAL, bh_corrected_p_value REAL, PRIMARY KEY (neighbors_of_annotation, other_annotation) ); I would like to perform the following query: SELECT * FROM overlap_results WHERE (neighbors_of_annotation, other_annotation) IN (('16070', '8150'), ('16070', '44697')); That is, I have a couple of tuples of annotation IDs, and I'd like to fetch records for each of those tuples. The sqlite3 prompt gives me the following error: SQL error: near ",": syntax error How do I properly express this as a SQL statement?

    Read the article

  • Query gives an unsorted result set when run from stored procedure using CTE

    - by irtizaur
    I am trying to create a paging query using CTE. It works fine when I execute it from Microsoft SQL Server Management Studio Query Editor. And the result set is perfectly sorted as I want. But when I modify it for a stored procedure it gives me a unsorted result and I don't have any clue why. Here is my Query, with items as ( select ROW_NUMBER() over (order by create_time desc) number , i.item_name item_name , i.create_time create_time , c.category_name category_name , i.category_id category_id from cb_item i, cb_category c where i.category_id = c.category_id and c.category_id = '4E5248FE-05DD-4D01-ABBB-80C6E3BA5CDA' ) select item_name , create_time , category_name , category_id from items where number between 1 and 25 And this is the Stored Procedure Version, create procedure ItemPage @category_id uniqueidentifier , @from int , @to int , @sortby nvarchar(50) as begin with items as ( select ROW_NUMBER() over (order by @sortby) number , i.item_name item_name , i.create_time create_time , c.category_name category_name , i.category_id category_id from cb_item i, cb_category c where i.category_id = c.category_id and c.category_id = @category_id ) select item_name , create_time , category_name , category_id from items where number between @from and @to end exec itempage '4E5248FE-05DD-4D01-ABBB-80C6E3BA5CDA' , 1, 25, 'create_time desc' The first one gives me sorted result but procedure gives me unsorted result. I don't know why?

    Read the article

  • how to find maximum frequent item sets from large transactional data file

    - by ANIL MANE
    Hi, I have the input file contains large amount of transactions like Transaction ID Items T1 Bread, milk, coffee, juice T2 Juice, milk, coffee T3 Bread, juice T4 Coffee, milk T5 Bread, Milk T6 Coffee, Bread T7 Coffee, Bread, Juice T8 Bread, Milk, Juice T9 Milk, Bread, Coffee, T10 Bread T11 Milk T12 Milk, Coffee, Bread, Juice i want the occurrence of every unique item like Item Name Count Bread 9 Milk 8 Coffee 7 Juice 6 and from that i want an a fp-tree now by traversing this tree i want the maximal frequent itemsets as follows The basic idea of method is to dispose nodes in each “layer” from bottom to up. The concept of “layer” is different to the common concept of layer in a tree. Nodes in a “layer” mean the nodes correspond to the same item and be in a linked list from the “Head Table”. For nodes in a “layer” NBN method will be used to dispose the nodes from left to right along the linked list. To use NBN method, two extra fields will be added to each node in the ordered FP-Tree. The field tag of node N stores the information of whether N is maximal frequent itemset, and the field count’ stores the support count information in the nodes at left. In Figure, the first node to be disposed is “juice: 2”. If the min_sup is equal to or less than 2 then “bread, milk, coffee, juice” is a maximal frequent itemset. Firstly output juice:2 and set the field tag of “coffee:3” as “false” (the field tag of each node is “true” initially ). Next check whether the right four itemsets juice:1 be the subset of juice:2. If the itemset one node “juice:1” corresponding to is the subset of juice:2 set the field tag of the node “false”. In the following process when the field tag of the disposed node is FALSE we can omit the node after the same tagging. If the min_sup is more than 2 then check whether the right four juice:1 is the subset of juice:2. If the itemset one node “juice:1” corresponding to is the subset of juice:2 then set the field count’ of the node with the sum of the former count’ and 2 After all the nodes “juice” disposed ,begin to dispose the node “coffee:3”. Any suggestions or available source code, welcome. thanks in advance

    Read the article

  • Combining data sets without losing observations in SAS

    - by John
    Hye guys, I know, another post another problem :D :(. I took a screenshot to easily explain my problem. http://i39.tinypic.com/rhms0h.jpg As you can see I want to merge two tables (again), the Base & Analyst table. What I want to achieve is displayed in the right bottom corner table. I’m calculating the number of total analysts and female analysts for each month in the analyst table. In the base table I have different observations for one company (here company Alcoa with ticker AA). When I use the following command: data want; merge base analyst; by month ; run; I get the right up corner problem. My observations in the main table are being narrowed down to only 4 observations (for each different year one observation, 2001, 2002, 2005, 2006). What I want is that the observations are not reduced but that for every year the same data is being placed as shown in the right bottom corner. What am I missing in my merge command? In both tables I have month as a time count variable ( the observations in my base table are monthly) on which I need to merge. For clarity I added 2 screenshots of my real databases in SAS. The base table: http://i42.tinypic.com/dr5jky.jpg The analyst table: http://i40.tinypic.com/eqpmqq.jpg Here is what my merged table looks like: http://i43.tinypic.com/116i62s.jpg You can clearly see that the merged table only has four observations left for AA (one for each unique year) instead of the original 8. Anyone an idea to solve this?

    Read the article

  • JQuery Post-Request question - FF doesn't get the result of the referenced php page

    - by OlliD
    Dear community, I just want to have my question posted here but just from the beginning: For a personal web project I use PHP + JQuery. Now I got stuck when I try to use the ajax posting method to send data to another php-page. I planned to have some navigational elements like next + previous on the bottom of the page by saving the user input / user given data. The code looks as follows: <div id="bottom_nav"> <div id="prev" class="flt_l"><a href="?&step=<?= $pages[$step-1] ?>">next</a></div> <div id="next" class="flt_r"><a href="?&step=<?= $pages[$step+1] ?>">previous</a></div> </div> The functionality of the page works fine. Lateron, I use the following code to sent data over via POST: $("#bottom_nav a").click( function() { alert("POST-Link: Parameter=" + $("#Parameter").val()); $.ajax( { type:"post", url:"saveParameter.php", data:"Parameter=" + $("#Parameter").val(), success: function(result) { alert(result); //$("#test").text(result); } }); }); The request itself work perfectly on IE, but on FF I'm not able to get back any result. within the PHP page, there just written: <? echo $_POST['Parameter']; ?> As IE returns the correct value, FF just provide an empty message box. I assumed that the behaviour on the -Link is different. While IE seems to handle the click event after the JS-Code execution, FF will interpret it before. My question was whether you has a solution on this regarding restructuring the code itself or using another method to reach the intened behaviour. Thanks for your assistance and recommendations, Olli

    Read the article

  • How to associate static entity instances in a Session without database retrieval

    - by Michael Hedgpeth
    I have a simple Result class that used to be an Enum but has evolved into being its own class with its own table. public class Result { public static readonly Result Passed = new Result(StatusType.Passed) { Id = [Predefined] }; public static readonly Result NotRun = new Result(StatusType.NotRun) { Id = [Predefined] }; public static readonly Result Running = new Result(StatusType.Running) { Id = [Predefined] }; } Each of these predefined values has a row in the database at their predefined Guid Id. There is then a failed result that has an instance per failure: public class FailedResult : Result { public FailedResult(string description) : base(StatusType.Failed) { . . . } } I then have an entity that has a Result: public class Task { public Result Result { get; set; } } When I save a Task, if the Result is a predefined one, I want NHibernate to know that it doesn't need to save that to the database, nor does it need to fetch it from the database; I just want it to save by Id. The way I get around this is when I am setting up the session, I call a method to load the static entities: protected override void OnSessionOpened(ISession session) { LockStaticResults(session, Result.Passed, Result.NotRun, Result.Running); } private static void LockStaticResults(ISession session, params Result[] results) { foreach (var result in results) { session.Load(result, result.Id); } } The problem with the session.Load method call is it appears to be fetching to the database (something I don't want to do). How could I make this so it does not fetch the database, but trusts that my static (immutable) Result instances are both up to date and a part of the session?

    Read the article

  • Prevent Firefox from going to first search result

    - by Dejan
    When I type some terms in the address bar (not the search box!) and hit enter, Firefox searches for those terms on Google, and, depending on some logic either takes me to the search results page or takes me to the first search result. Now, I want it to always take me to the search results page (like Chrome does). Is this possible? And, yes, I am aware that the search box does exactly that, but I'm using it for some other search engine. So, another solution would be to add additional search box, that can also work for me.

    Read the article

  • Http Digest Authentication, Handle different browser char-sets...

    - by user160561
    Hi all, I tried to use the Http Authentication Digest Scheme with my php (apache module) based website. In general it works fine, but when it comes to verification of the username / hash against my user database i run into a problem. Of course i do not want to store the user´s password in my database, so i tend to store the A1 hashvalue (which is md5($username . ':' . $realm . ':' . $password)) in my db. This is just how the browser does it too to create the hashes to send back. The Problem: I am not able to detect if the browser does this in ISO-8859-1 fallback (like firefox, IE) or UTF-8 (Opera) or whatever. I have chosen to do the calculation in UTF-8 and store this md5 hash. Which leads to non-authentication in Firefox and IE browsers. How do you solve this problem? Just do not use this auth-scheme? Or Store a md5 Hash for each charset? Force users to Opera? (Terms of A1 refer to the http://php.net/manual/en/features.http-auth.php example.) (for digest access authentication read the according wikipedia entry)

    Read the article

  • Exact match in regex character sets

    - by Dominik
    Hi all Consider the following string '35=_-235-b-35=35-35=2-135=a-35=123-235=2-35=a-53=1-53=a-553=b' I'd like to extract everything that matches 35= followed by 1 or 2 characters. What I came up with is the following regex \d[35]=[A-Za-z0-9]{1,2} The problem is the character set [35] matches both 35= and 53=. How can I achieve an exact match for a character set? Any suggestions, or different approaches are very much appreciated!

    Read the article

  • Show different sub-sets of a view model's properties in an edit view

    - by Martin R-L
    In the context of C# 4, ASP.NET MVC 2, and NHibernate; I've got the following scenario: Let's assume an entity Product that have an association to ProductType. In a product edit view; how do I implement that only a sub-set of the product's properties are shown based on the ProductType association in an elegant and DRY way? I.e., different properties shall be shown for different values of a property of the ProductType. Use a product view model builder, and from different view models automagically generate the view with my own Html.EditorForModel() (including drop-downs and other stuff not out-of-the-box)? Attribute the properties of one view model and use the Html.EditorForModel() way aforementioned? Use one model, but implement different web controls (view strategies) (can it be done DRY?)? Something else entirely?

    Read the article

  • Ranking/ weighing search result

    - by biso
    I am trying to build an application that has a smart adaptive search engine (lets say for cars). If I search for for 4x4 then the DB will return all the 4x4 cars I have (100 cars) - but as time goes by and I start checking out cars, liking them, commenting on them, etc the order of the search result should be the different. That means 1 month later when searching for 4x4, I should get the same result set ordered differently as per my previous interaction with the site. If I was mainly liking and commenting on German cars, BMW should be on the top and Land cruiser should be further down. This ranking should be based on attributes that I captureduring user interaction (eg: car origin, user age, user location, car type[4x4, coupe, hatchback], price range). So for each car result I get, I will be weighing it based on how well it is performing on the 5 attributes above. I intend to use the DB just as a repository and do the ranking and the thinking on the server. My question is, what kind of algorithm should I be using to weigh/rank my search result? Thanks.

    Read the article

  • Combine multiple DNS filtering result

    - by Martheen Cahya Paulo
    Several DNS servers provide filtering against different categories, mostly for the local government 'undesirable content', some for malware, and some for ads. What I want is to create/use a DNS server that compare against those filtering DNS servers and only provide the address if all the DNS server agrees. For example if DNS server G provide a clean, unfiltered result, DNS server N provide malware and/or pornography filter, and DNS server F provide ad filter, then G, N and F will only provide the same/similar answer if the query is not categorized as malware, pornography, or advertising. Thus, by creating a server M that only answer if all DNS server agree, M effectively filter against all those categories. Maybe it's possible to do this on DDWRT or Tomato, but if not, I would settle for a solution that can be run in Linux/Windows.

    Read the article

  • Best method for converting several sets of numbers with several different ratios

    - by C Patton
    I'm working on an open-source harm reduction application for opioid addicts. One of the features in this application is the conversion (in mg/mcg) between common opioids, so people don't overdose by accident. If you're morally against opioid addiction and wouldn't respond because of your morals, please consider that this application is for HARM REDUCTION.. So people don't end up dead. I have this data.. 3mg morphine IV = 10mcg fentanyl IV 2mg morphine oral = 1mg oxycodone oral 3mg oral morphine = 1mg oxymorphone oral 7.0mg morphine oral = 1mg hydromorphone oral 1mg morphine iv = .10mg oxymorphone iv 1mg morphine oral = 1mg hydrocodone oral 1mg morphine oral = 6.67mg codeine oral 1mg morphine oral = .10mg methadone oral And I have a textbox that is the source dosage in mg (a double) that the user can enter in. Underneath this, I have radio boxes for the source substance (ie: morphine) and the destination substance (ie oxycodone) for conversion.. I've been trying to think of the most efficient way to do this, but nearly every seems sloppy. If I were to do something like public static double MorphinetoOxycodone(string morphineValue) { double morphine = Double.Parse(morphineValue); return (morphine / 2 ); } I would also have to make a function for OxycodonetoMorphine, OxycodonetoCodeine, etc.. and then would end up with dozens functions.. There must be an easier way than this that I'm missing. If you'll notice, all of my conversions use morphine as the base value.. what might be the easiest way to use the morphine value to convert one opioid to another? For example, if 1mg morphine oral is equal to 1mg hydrocodone and 1mg morphine oral is equal to .10mg methadone, wouldn't I just multiply 1*.10 to get the hydrocodone-methadone value? Implementing this idea is what I'm having the most trouble with. Any help would be GREATLY appreciated.. and if you'd like, I would add your name/nickname to the credits in this program. It's possible that many, many people around the world will use this (I'm translating it into several languages as well) and to know that your work could've helped an addict from dying.. I think that's a great thing :) -cory

    Read the article

  • Core Data deleteObject: sets attributes to nil

    - by SG1
    I am implementing an undo/redo mechanism in my app. This works fine for lots of cases. However, I can't undo past deleteObject:. the object is correctly saved in the undo queue, and I get it back and reinsterted into the Core Data stack just fine when calling undo. The problem is that all it's attributes are getting set to nil when I delete it. I have an entity "Canvas" with a to-many relationship called "graphics" to a "Graphic" entity, which has its inverse set to "canvas". Deleting a Graphic, then inserting it back, doesn't work. Here's the code (the redo method is basically the same): - (void)deleteGraphic:(id)aGraphic { //NSLog(@"undo drawing"); //Prepare the undo/redo [self.undoManager beginUndoGrouping]; [self.undoManager setActionName:@"Delete Graphic"]; [[self.detailItem valueForKey:@"graphics"] removeObject:aGraphic]; [[self managedObjectContext] deleteObject:aGraphic]; //End undo/redo [self.undoManager registerUndoWithTarget:self selector:@selector(insertGraphic:) object:aGraphic]; [self.undoManager endUndoGrouping]; NSLog(@"graphics are %@", [self sortedGraphics]); //Update drawing [self.quartzView setNeedsDisplay]; } and here's the wierdness: Before delete: graphics are ( <NSManagedObject: 0x1cc3f0> (entity: Graphic; id: 0x1c05f0 <x-coredata:///Graphic/t840FE8AD-F2E7-4214-822F-7994FF93D4754> ; data: { canvas = 0x162b70 <x-coredata://A919979E-75AD-474D-9561-E0E8F3388718/Canvas/p20>; content = <62706c69 73743030 d4010203 04050609 0a582476 65727369 6f6e5424 746f7059 24617263 68697665 7258246f 626a6563 7473>; frameRect = nil; label = nil; order = 1; path = "(...not nil..)"; traits = "(...not nil..)"; type = Path; }) After redo: graphics are ( <NSManagedObject: 0x1cc3f0> (entity: Graphic; id: 0x1c05f0 <x-coredata:///Graphic/t840FE8AD-F2E7-4214-822F-7994FF93D4754> ; data: { canvas = nil; content = nil; frameRect = nil; label = nil; order = 0; path = nil; traits = nil; type = nil; }), You can see it's the same object, just totally bleached by Core Data. The relationship delete rouls apparently have nothing to do with it as I've set them to "No Action" in a test.

    Read the article

  • Question about gets and sets and when to use super classes

    - by Nazgulled
    Hi, I have the following get method: public List<PersonalMessage> getMessagesList() { List<PersonalMessage> newList = new ArrayList<PersonalMessage>(); for(PersonalMessage pMessage : this.listMessages) { newList.add(pMessage.clone()); } return newList; } And you can see that if I need to change the implementation from ArrayList to something else, I can easily do it and I just have to change the initialization of newList and all other code that depends on what getMessageList() returns will still work. Then I have this set method: public void setMessagesList(ArrayList<PersonalMessage> listMessages) { this.listMessages = listMessages; } My question is, should I use List instead of `ArrayList in the method signature? I have decided to use ArrayList because this way I can force the implementation I want, otherwise there could be a mess with different types of lists here and there. But I'm not sure if this is the way to go...

    Read the article

  • Python nested dict comprehension with sets

    - by Jasie
    Can someone explain how to do nested dict comprehensions? >> l = [set([1, 2, 3]), set([4, 5, 6])] >> j = dict((a, i) for a in s for i, s in enumerate(l)) >> NameError: name 's' is not defined I would have liked: >> j >> {1:0, 2:0, 3:0, 4: 1, 5: 1, 6: 1} I just asked a previous question about a simpler dict comprehension where the parentheses in the generator function were reduced. How come the s in the leftmost comprehension is not recognized?

    Read the article

  • getline() sets failbit and skips last line

    - by Thanatos
    I'm using std::getline() to enumerate through the lines in a file, and it's mostly working. It's left me curious however - std::getline() is skipping the very last line in my file, but only if it's blank. Using this minimal example: #include <iostream> #include <string> int main() { std::string line; while(std::getline(std::cin, line)) std::cout << "Line: “" << line << "”\n"; return 0; } If I feed it this: Line A Line B Line C I get those lines back at me. But this: Line A Line B Line C [* line is present but blank, ie, the file end is: "...B\nLine C\n" *] (I unfortunately can't have a blank line in SO's little code box thing...) So, first file has three lines ( ["Line A", "Line B", "Line C"] ), second file has four ( ["Line A", "Line B", "Line C", ""] ) This to me seems wrong - I have a four line file, and enumerating it with getline() leaves me with 3. What's really got me scratching my head is that this is exactly what the standard says it should do. (21.3.7.9) Even Python has similar behaviour (but it gives me the newlines too - C++ chops them off.) Is this some weird thing where C++ is expected lines to be terminated, and not separated by '\n', and I'm feeding it differently? Edit Clearly, I need to expand a bit here. I've met up with two philosophies of determining what a "line" in a file is: Lines are terminated by newlines - Dominant in systems such as Linux, and editors like vim. Possible to have a slightly "odd" file by not having a final '\n' (a "noeol" in vim). Impossible to have a blank line at the end of a file. Lines are separated by newlines - Dominant in just about every Windows editor I've ever come across. Every file is valid, and it's possible to have the last line be blank. Of course, YMMV as to what a newline is. I've always treated these as two completely different schools of thought. One earlier point I tried to make was to ask if the C++ standard was explicitly or merely implicitly following the first. (Curiously, where is Mac? terminated or separated?)

    Read the article

  • Character sets offered in the Eclipse properties

    - by bmargulies
    I've just been handed a pile of Java source that, I suspect, is in ISO-8859-8. Eclipse's menu of charsets, here on my Mac, does not include that. Or any of a wide variety of other encodings supported by the JDK. Is there a recipe for expanding the list of encodings that show up in the menu?

    Read the article

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