Search Results

Search found 17924 results on 717 pages for 'z order'.

Page 59/717 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • what is order notation f(n)=O(g(n))?

    - by Lopa
    2 questions: question 1: under what circumstances would this[O(f(n))=O(k.f(n))] be the most appropriate form of time-complexity analysis? question 2: working from mathematical definition of O notation, show that O(f(n))=O(k.f(n)), for positive constant k.? My view: For the first one I think it is average case and worst case form of time-complexity. am i right? and what else do i write in that? for the second one I think we need to define the function mathematically, so is the answer something like because the multiplication by a constant just corresponds to a readjustment of value of the arbitrary constant 'k' in definition of O.

    Read the article

  • Unit finalization order for application, compiled with run-time packages?

    - by Alexander
    I need to execute my code after finalization of SysUtils unit. I've placed my code in separate unit and included it first in uses clause of dpr-file, like this: project Project1; uses MyUnit, // <- my separate unit SysUtils, Classes, SomeOtherUnits; procedure Test; begin // end; begin SetProc(Test); end. MyUnit looks like this: unit MyUnit; interface procedure SetProc(AProc: TProcedure); implementation var Test: TProcedure; procedure SetProc(AProc: TProcedure); begin Test := AProc; end; initialization finalization Test; end. Note that MyUnit doesn't have any uses. This is usual Windows exe, no console, without forms and compiled with default run-time packages. MyUnit is not part of any package (but I've tried to use it from package too). I expect that finalization section of MyUnit will be executed after finalization section of SysUtils. This is what Delphi's help tells me. However, this is not always the case. I have 2 test apps, which differs a bit by code in Test routine/dpr-file and units, listed in uses. MyUnit, however, is listed first in all cases. One application is run as expected: Halt0 - FinalizeUnits - ...other units... - SysUtils's finalization - MyUnit's finalization - ...other units... But the second is not. MyUnit's finalization is invoked before SysUtils's finalization. The actual call chain looks like this: Halt0 - FinalizeUnits - ...other units... - SysUtils's finalization (skipped) - MyUnit's finalization - ...other units... - SysUtils's finalization (executed) Both projects have very similar settings. I tried a lot to remove/minimize their differences, but I still do not see a reason for this behaviour. I've tried to debug this and found out that: it seems that every unit have some kind of reference counting. And it seems that InitTable contains multiply references to the same unit. When SysUtils's finalization section is called first time - it change reference counter and do nothing. Then MyUnit's finalization is executed. And then SysUtils is called again, but this time ref-count reaches zero and finalization section is executed: Finalization: // SysUtils' finalization 5003B3F0 55 push ebp // here and below is some form of stub 5003B3F1 8BEC mov ebp,esp 5003B3F3 33C0 xor eax,eax 5003B3F5 55 push ebp 5003B3F6 688EB50350 push $5003b58e 5003B3FB 64FF30 push dword ptr fs:[eax] 5003B3FE 648920 mov fs:[eax],esp 5003B401 FF05DCAD1150 inc dword ptr [$5011addc] // here: some sort of reference counter 5003B407 0F8573010000 jnz $5003b580 // <- this jump skips execution of finalization for first call 5003B40D B8CC4D0350 mov eax,$50034dcc // here and below is actual SysUtils' finalization section ... Can anyone can shred light on this issue? Am I missing something?

    Read the article

  • How to use ORDER BY, LOWER .. in SQL SERVER 2008 with non-unicode languages

    - by hgulyan
    Hi, The question is about Armenian. I'm using sql server 2005, collation SQL_Latin1_General_CP1_CI_AS, data mostly is in Armenian and we can't use unicode. I tested on ms sql 2008 with a windows collation for armenian language ( Cyrillic_General_100_ ), I have found here, ( http://msdn.microsoft.com/en-us/library/ms188046.aspx ) but it didn't help. I have a function, that orders hex values and lower function, which takes each char in string and covnerts it to it's lower form, but it's not acceptable solution, it works really slow, calling that functions on every column of a huge table. Is there any solution for this issue not using unicode and working with hex values manually?

    Read the article

  • How can I get bitfields to arrange my bits in the right order?

    - by Jim Hunziker
    To begin with, the application in question is always going to be on the same processor, and the compiler is always gcc, so I'm not concerned about bitfields not being portable. gcc lays out bitfields such that the first listed field corresponds to least significant bit of a byte. So the following structure, with a=0, b=1, c=1, d=1, you get a byte of value e0. struct Bits { unsigned int a:5; unsigned int b:1; unsigned int c:1; unsigned int d:1; } __attribute__((__packed__)); (Actually, this is C++, so I'm talking about g++.) Now let's say I'd like a to be a six bit integer. Now, I can see why this won't work, but I coded the following structure: struct Bits2 { unsigned int a:6; unsigned int b:1; unsigned int c:1; unsigned int d:1; } __attribute__((__packed__)); Setting b, c, and d to 1, and a to 0 results in the following two bytes: c0 01 This isn't what I wanted. I was hoping to see this: e0 00 Is there any way to specify a structure that has three bits in the most significant bits of the first byte and six bits spanning the five least significant bits of the first byte and the most significant bit of the second? Please be aware that I have no control over where these bits are supposed to be laid out: it's a layout of bits that are defined by someone else's interface.

    Read the article

  • How to order a window to front if you are not in the Application in Objective-C

    - by ahmet2106
    Hello, Is there a way to make a "makeKeyAndOrderToFront" without beeing in the Application? If I am in Safari and in the Menu Bar there is a MenuItem to my App, after I press this, i want to show a window of my App in the Front (makeKeyAndOrderToFront makes this just if you are in the Application). Which way can I use? And how can I animate this Window (like Tweeties Add new Tweet - atebits.com). Thank you!

    Read the article

  • CSS precedence order? My lecture slides are correct or not?

    - by Michael Mao
    Hi all: I've noticed that there are a couple of similar questions and answers at SO already, but let me clarify my specific question here first: I've got lecture slides which states like this: To be frank, I haven't heard of this rule of css precedence myself, and I googled to find something with similar topic but not quite like that : here To have a test myself, I've made a test page on my own server here After running it on FireFox 3.6.3, I am sure it does not show the way as it should be, according to the statement in lecture slides: imported stylesheet ? am I doing it wrong? I cannot see its effect using FireBug it says that embedded stylesheet has a higher precedence over linked/imported stylesheets, however, it doesn't work, if I put the linked/imported tag AFTER that. inline style vs html attributes ? I've got an image where I firstly set its inline style to control the width and height, then use direct html attributes width/height to try modifying that, but failed... Below is the source code : <html> <head> <style type="text/css"> #target { border : 2px solid green; color : green; } </style> <link rel="stylesheet" href="./linked.css" type="text/css" media="screen" /> </head> <body> <div id="target">A targeted div tag on page.</div> <img src="cat.jpg" alt="" style="width : 102px; height : 110px;" width="204px" height="220px" /> </body> </html> Can any experienced CSS guys help me figure out if the slide is correct or not? Frankly speaking, I am puzzled myself, as I can clearly see some other "incorrect" statements here and there amongst the slides, such as JavaScript is on client-side (how about server-side JavaScript?) and "Embedded styles are in the head section of a web page "(what the heck? I am not allowed to put it inside the body tag?) Sorry about this silly question, the exam is on TOMORROW, and I now see a lot of things to think about :)

    Read the article

  • Guidelines regarding developing a flash web-site (especially loading - order swf, xml, etc...) ?

    - by shane.amon
    I would like to know, if you people out there could help me out, regarding the best practices or the a better way for creating a flash website... Actually I would like to know whether we should load the xml first and then the swf and other components or the other way round ? I am bit confused, even if anybody could refer some book to dig upon the steps or most common practices regarding the development... it would of great help... Thanks shane amon

    Read the article

  • Should I remove all inheritance from my model in order to work with ria services?

    - by TimothyP
    I've posted some questions on this before, but it's different. So consider a small portion of our model: Person Customer Employee Spouse Person is the base class which has 3 classes that inherit from it. These 4 are very central in our design and link to many other entities. I could solve all the problems I'm experiencing with ria-services by removing the inheritance but that would really increase the complexety of the model. The first problem I experienced was that I couldn't query for Customers, Employees or Spouses, but someone gave me a solution, which was to add something like this to the DomainService: public IQueryable<Employee> GetEmployees() { return this.ObjectContext.People.OfType<Employee>(); } public IQueryable<Customer> GetCustomers() { return this.ObjectContext.People.OfType<Customer>(); } public IQueryable<Spouse> GetSpouses() { return this.ObjectContext.People.OfType<Spouse>(); } Next I tried something that seemed very normal to me: var employee = new Employee() { //.... left out to reduce the length of this question }; var spouse = new Spouse() { //.... left out to reduce the length of this questions }; employee.Spouse = spouse; context.People.Add(spouse); context.People.Add(employee); context.SubmitChanges(); Then I get the following exception: Cannot retrieve an entity set for the derived entity type 'Spouse'. Use EntityContainer.GetEntitySet(Type) to get the entity set for the base entity type 'Person'. Even when the spouse is already in the database, and I retreive it first I get similar exceptions. Also note that for some reason in some places "Persons" is used instead of "People"... So how do I solve this problem, what am I doing wrong and will I keep running into walls when using ria services with inheritance? I found some references on the web, all saying it works and then some DomainService code in which they suposedly changed something but no details... I'm using VS2010 RC1 + Silveright 4

    Read the article

  • How can I match string order between two documents in PERL?

    - by Randy
    Hi, I've a problem in making a PERL program for matching the words in two documents. Let's say there are documents A and B So I want to delete the words in document A that's not in the document B A: I eat pizza B: She go to the market and eat pizza result: eat pizza I use Perl for the system and the sentences in each document isn't in a big numbers so I think I won't use SQL And the program is a subproram for automatic essay grading for Indonesian Language (Bahasa) Thanx, Sorry if my question is a bit confusing. I'm really new to 'this world' :)

    Read the article

  • PHP - Tricky... array into columns, but in a specific order.

    - by Joe
    <?php $combinedArray = array("apple","banana","watermelon","lemon","orange","mango"); $num_cols = 3; $i = 0; foreach ($combinedArray as $r ){ /*** use modulo to check if the row should end ***/ echo $i++%$num_cols==0 ? '<div style="clear:both;"></div>' : ''; /*** output the array item ***/ ?> <div style="float:left; width:33%;"> <?php echo $r; ?> </div> <?php } ?> <div style="clear:both;"></div> The above code will print out the array like this: apple --- banana --- watermelon lemon --- orange --- mango However, I need it like this: apple --- watermelon --- orange banana --- lemon --- mango Do you know how to convert this? Basically, each value in the array needs to be placed underneath the one above, but it must be based on this same structure of 3 columns, and also an equal amount of fruits per column/row (unless there was like 7 fruits there would be 3 in one column and 2 in the other columns. Sorry I know it's confusing lol

    Read the article

  • How to get a handle to all JCheckBox objects in order to loop?

    - by EmmyS
    I'm very new to Java and am having some issues looping through JCheckBoxes on a UI. The idea is that I have a bunch of checkboxes (not in a group because more than one can be selected.) When I click a JButton, I want to build a string containing the text from each selected checkbox. The issue I'm having is that our instructor told us that the checkboxes need to be created via a method, which means (see code below) that there isn't a discrete instance name for each checkbox. If there were, I could say something like if(checkBox1.isSelected()) { myString.append(checkBox.getText()); } That would repeat for checkBox2, checkBox3, and so on. But the method provided to us for adding checkboxes to a panel looks like this: public class CheckBoxPanel extends JPanel { private static final long serialVersionUID = 1L; public CheckBoxPanel(String title, String... options) { setBorder(BorderFactory.createTitledBorder(BorderFactory .createEtchedBorder(), title)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // make one checkbox for each option for (String option : options) { JCheckBox b = new JCheckBox(option); b.setActionCommand(option); add(b); } } } This is called like this: toppingPanel = new CheckBoxPanel("Each Topping $1.50", "Tomato", "Green Pepper", "Black Olives", "Mushrooms", "Extra Cheese", "Pepperoni", "Sausage"); So I now have a panel that contains a border with the title "Each Topping $1.50", and 7 visible checkboxes. What I need to do is get a list of all the selected toppings. We are not supposed to use an ActionListener for each checkbox, but rather get the list when a button is clicked. I'm feeling really clueless here, but I just can't figure out how to get the isSelected property of the checkboxes when the individual checkboxes don't have instance names. Ideally I'd like to somehow add all the checkboxes to an array and loop through the array in the button's action listener to determine which ones are checked, but if I have to check each one individually I will. I just can't figure out how to refer to an individual checkbox when they've been created dynamically.

    Read the article

  • How to order the images in a mysql database?

    - by user305270
    Hy! Here is my problem: i have a profile and this profile has for example 100 images. When someone visit this profile the first image will be the first result of my query that sorts by updated_at. But if the user would want to put the image with the (id = 8) to be the first, then (id = 22) then (id = 88) and so on? I need to put another field or is really necessary a new table to make a custom sort on images? and maybe someone explain this to me how to do? thanks, i appreciate your help ;)

    Read the article

  • Does the order I declare pointers really matter in C? getcwd() problem...

    - by chucknelson
    On a Solaris 5.8 machine, I have the following code: [non-working code] char *buf; char *dir; size_t psize; psize = (size_t) 1024; dir = getcwd(buf, psize); On this unix machine, the above does not work and I get a segmentation fault when trying to run the program. It only works if I declare dir before buf: [working code] char *dir; char *buf; ... dir = getcwd(buf, psize); When using another flavor of Unix, such as Mac OS X, I don't get any of these what seem to be very strict rules on how to write the code. Can anyone explain what's going on with the above example? Thanks!

    Read the article

  • Are there any guarantees in JLS about order of execution static initialization blocks?

    - by Roman
    I wonder if it's reliable to use a construction like: private static final Map<String, String> engMessages; private static final Map<String, String> rusMessages; static { engMessages = new HashMap<String, String> () {{ put ("msgname", "value"); }}; rusMessages = new HashMap<String, String> () {{ put ("msgname", "????????"); }}; } private static Map<String, String> msgSource; static { msgSource = engMessages; } public static String msg (String msgName) { return msgSource.get (msgName); } Is there a possibility that I'll get NullPointerException because msgSource initialization block will be executed before the block which initializes engMessages? (about why don't I do msgSource initialization at the end of upper init. block: just the matter of taste; I'll do so if the described construction is unreliable)

    Read the article

  • Does the order of arguments in a conditional statement affect execution time in php?

    - by dd0x
    Hi, As far as I know when writing a conditional statement in C such as the following: if ( some_function() == 100 && my_var == 5 ) { //do something } is slower to execute than if ( my_var == 5 && some_function() == 100 ) { //do something } because it's faster to execute the my_var == 5 rather than all of the code in the function ( because if my_var != 5, then the rest of the if statement would not even be executed )...so I am wondering if the same is true for conditional statements in PHP?

    Read the article

  • Why does a sub-class class of a class have to be static in order to initialize the sub-class in the

    - by Alex
    So, the question is more or less as I wrote. I understand that it's probably not clear at all so I'll give an example. I have class Tree and in it there is the class Node, and the empty constructor of Tree is written: public class RBTree { private RBNode head; public RBTree(RBNode head,RBTree leftT,RBTree rightT){ this.head=head; this.head.leftT.head.father = head; this.head.rightT.head.father = head; } public RBTree(RBNode head){ this(head,new RBTree(),new RBTree()); } public RBTree(){ this(new RBNode(),null,null); } public class RBNode{ private int value; private boolean isBlack; private RBNode father; private RBTree leftT; private RBTree rightT; } } Eclipse gives me the error: "No enclosing instance of type RBTree is available due to some intermediate constructor invocation" for the "new RBTree()" in the empty constructor. However, if I change the RBNode to be a static class, there is no problem. So why is it working when the class is static. BTW, I found an easy solution for the cunstructor: public RBTree(){ this.head = new RBNode(); } So, I have no idea what is the problem in the first piece of code.

    Read the article

  • How can we order a column as int using hibernate criteria API?

    - by Satya
    Hi I want to fetch the data form data base using hibernate Criteria API. That data should be ordered by some column as number. This column is defined as varchar in DB. But I have to fetch as numberic. I am facing problem using criteria API as it is ordering like string onyly. Ex: I am getting data like 9, 8, 7, 6, 5, 4, 3, 2, 1,10 but i want data as 10,9,8,7,6,5,4,3,2,1 Is there any Hibernate methods to covert varchar to number like convert("some column",int ) or cast("some column",int) ?

    Read the article

  • How can I make keyword order more relevant in my search?

    - by Atomiton
    In my database, I have a keywords field that stores a comma-delimited list of keywords. For example, a Shrek doll might have the following keywords: ogre, green, plush, hero, boys' toys A "Beanie Baby" doll ( that happens to be an ogre ) might have: beanie baby, kids toys, beanbag toys, soft, infant, ogre (That's a completely contrived example.) What I'd like to do is if the consumer searches for "ogre" I'd like the "Shrek" doll to come up higher in the search results. My content administrator feels that if the keyword is earlier in the list, it should get a higher ranking. ( This makes sense to me and it makes it easy for me to let them control the search result relevance ). Here's a simplified query: SELECT p.ProductID AS ContentID , p.ProductName AS Title , p.ProductCode AS Subtitle , 100 AS Rank , p.ProductKeywords AS Keywords FROM Products AS p WHERE FREETEXT( p.ProductKeywords, @SearchPredicate ) I'm thinking something along the lines of replacing the RANK with: , 200 - INDEXOF(@SearchTerm) AS Rank This "should" rank the keyword results by their relevance I know INDEXOF isn't a SQL command... but it's something LIKE that I would like to accomplish. Am I approaching this the right way? Is it possible to do something like this? Does this make sense?

    Read the article

  • Function parameters evaluation order: is undefined behaviour if we pass reference?

    - by bolov
    This is undefined behaviour: void feedMeValue(int x, int a) { cout << x << " " << a << endl; } int main() { int a = 2; int &ra = a; feedMeValue(ra = 3, a); return 0; } because depending on what parameter gets evaluated first we could call (3, 2) or (3, 3). However this: void feedMeReference(int x, int const &ref) { cout << x << " " << ref << endl; } int main() { int a = 2; int &ra = a; feedMeReference(ra = 3, a); return 0; } will always output 3 3 since the second parameter is a reference and all parameters have been evaluated before the function call, so even if the second parameter is evaluated before of after ra = 3, the function received a reference to a wich will have a value of 2 or 3 at the time of the evaluation, but will always have the value 3 at the time of the function call. Is the second example UB? It is important to know because the compiler is free to do anything if he detects undefined behaviour, even if I know it would always yield the same results. *Note: I think that feedMeReference(a = 3, a) is the exact same situation as feedMeReference(ra = 3, a). However it seems not everybody agrees, in the addition to having 2 completely different answers.

    Read the article

  • Is it possible to restrict instantiation of an object to only one other (parent) object in VB.NET?

    - by Casey
    VB 2008 .NET 3.5 Suppose we have two classes, Order and OrderItem, that represent some type of online ordering system. OrderItem represents a single line item in an Order. One Order can contain multiple OrderItems, in the form of a List(of OrderItem). Public Class Order Public Property MyOrderItems() as List(of OrderItem) End Property End Class It makes sense that an OrderItem should not exist without an Order. In other words, an OrderItem class should not be able to be instantiated on its own, it should be dependent on an Order class to contain it and instantiate it. However, the OrderItem should be public in scope so that it's properties are accessible to other objects. So, the requirements for OrderItem are: Can not be instantiated as a stand alone object; requires Order to exist. Must be public so that any other object can access it's properties/methods through the Order object. e.g. Order.OrderItem(0).ProductID. OrderItem should be able to be passed to other subs/functions that will operate on it. How can I achieve these goals? Is there a better approach?

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >