order

Quickly alphabetize a large file via python

#!/usr/bin/python import random import string appendToFile = open("appendedFile", "a" ) # Generator for i in range(1, 100000): chars = "".join( [random.choice(string.letters) for i in xrange(15)] ) chars2 = "".join( [random.choice(string.letters) for i in xrange(15)] ) appendToFile.write(chars + ":" + chars2 + "\n") ap...

Storing Python dictionary entries in the order they are pushed

Fellows: A Python dictionary is stored in no particular order (mappings have no order), e.g., >>> myDict = {'first':'uno','second':'dos','third':'tres'} myDict = {'first':'uno','second':'dos','third':'tres'} >>> myDict myDict {'second': 'dos', 'third': 'tres', 'first': 'uno'} While it is possible to retrieve a sorted list or tuple fr...

Order a list of files by size via python

Example dump from the list of a directory: hello:3.1 GB world:1.2 MB foo:956.2 KB The above list is in the format of FILE:VALUE UNIT. How would one go about ordering each line above according to file size? I thought perhaps to parse each line for the unit via the pattern ":VALUE UNIT" (or somehow use the delimiter) then run it throug...

Order of items in a HashMap differ when the same program is run in JVM5 vs JVM6?

Hi, I have an application which displays a collection of objects in rows, one object = one row. The objects are stored in a HashMap. The order of the rows does not affect the functionality of the application (that is why a HashMap was used instead of a sortable collection). However I have noticed that the same aplication runs different...

Tab order in .NET Compact Framework

Hi all, In Compact framework application form,If we do tab-out from a datagrid's any cell to some controls outside the grid,next time when grid get focus ,it will point the old cell . Any idea on setting it to datagrids first cell? ...

Is it possible to keep the column order using the Python csv DictReader

For example, my csv has columns as below: ID, ID2, Date, Job No, Code I need to write the columns back in the same order. The dict jumbles the order immediately, so I believe it's more of a problem with the reader. ...

Float a control over other controls in WPF

I'm having a hard time even phrasing this question. I'm displaying preview images to users in my UI within a ListBox. When a user hovers over the image, I'd like to expand it so the user can see more detail. I've gotten to the point where I can "pop up" the image, but of course it is still within its normal position in the layout, mea...

Delphi - Creating controls before form Create is run?

Well, my problem is as follows: I have a Delphi 5 application that I'm essentially porting to Delphi 2010 (replacing old components with their latest versions, fixing the inevitable Ansi/Unicode string issues, etc.) and I've run into kind of a hitch. Upon creation of one of our forms, an access violation happens. After looking it over,...

Making parent's background to be on top of childrens in CSS

I have the following DIV structure: <div id="parent"> <div id="child"></div> <div id="child2"></div> </div> I want to apply one half opaque background into the parent DIV, and one fully visible background to the child DIVs. However, it seems that the child will take over the parent, so, I have now no idea how to come over with this. ...

Doctrine order by relation table with limit

I have two tables "series" and "programs" with programs being many to one one series. Series table id | name -------------- 1 | lorem 2 | ipsum 3 | foo 4 | bar Programs table id | name | series_id --------------------- 1 | program1 | 1 2 | program2 | 2 3 | program3 | 3 4 | program4 | 4 5 | program5 | 1 6 | progra...

Flex - Saving a new order of items of a HorizontalList through AMF

Hi, I've been working with the drag-and-drop of items inside an Horizontal List in Flex. It works fine, but now I need to save the new order through AMF in my database. I'm pretty sure it's quite easy, but I haven't figured it out yet. Is there a way to cycle (after the reordering) all the items so that I can get for each item its (new...

Python - Check Order of Lines in File

Hi Guys, How does one check the order of lines in a file? Example file: a b c d e f b c d e f g 1 2 3 4 5 0 Requirements: All lines beginning a, must precede lines beginning b. There is no limit on number of lines beginning a. Lines beginning a, may or may not be present. Lines containing integers, must follow lines beginning b. N...

Source Ordered Content - SOC in SEO

How much does source ordered content affect SEO optimization and ranking? Do spiders crawl SOC in an easier way? Typical html web page comprises elements in following order: header content sidebar footer (Content and sidebar exchange often in order) However source ordered content is a technique where the law is to place content and ...

MySQL row order for "SELECT * FROM table_name;"

Assume that the following query is issued to a MySQL database: SELECT * FROM table_name; Note that no ORDER BY clause is given. My question is: Does MySQL give any guarantees to which order the result set rows will be given? More specifically, can I assume that the rows will be returned in insertion order (that is the same order in ...

Customizing order of cells in UITableView??

Hey everyone- I need some help. I have a UITableView that has cells that hold the title of an entity. Naturally, inside of a UITableView Section Header, it orders all cells or titles alphabetically by name. Each of these entities have several attributes, and one is a numerical value representing priority. Is there a way to make it so tha...

MySQL efficient select / order on a range query with multiple / single column indices

I'm trying to do the most efficient select on a table with 3 million records. First some detailed info Table: CREATE TABLE IF NOT EXISTS `activities_index` ( `id` int(9) NOT NULL auto_increment, `activity_id` int(6) NOT NULL, `activity_status_id` int(2) NOT NULL, `activity_source_id` int(6) default NULL, `account_id` int(6) ...

Return mySQL results in the order they're called in an IN() statement

Is there a way I can return a set of mySQL rows in the order they're called. For instance, when I call this: SELECT * FROM heroes WHERE id IN ( 41 , 48 , 38 , 14 , 47 , 44 ) LIMIT 6 I'd like the rows returned in that order. Is there a php function I could apply to the results afterward to achieve this ordering? ...

Order of QObject children (strategy question)

For one of my projects I have a tree of QObject derived objects, which utilize QObject's parent/child functionality to build the tree. This is very useful, since I make use of signals and slots, use Qt's guarded pointers and expect parent objects to delete children when they are deleted. So far so good. Unfortunately now my project req...

How to sort within a sql view

I've created a sql view and I need to sort the results of select by using the ORDER BY on 4 fields, but I'm getting message that ORDER BY cannot be used in views unless I use TOP. Can someone explain why TOP is needed, and does someone have a workaround for sorting in a sql view? Thanks. ...

How can I change gridview templatecolumn order dynamically?

How can I change gridview templatecolumn order dynamically? ...