Search Results

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

Page 139/717 | < Previous Page | 135 136 137 138 139 140 141 142 143 144 145 146  | Next Page >

  • Converting SQL with subselect in select to HQL

    - by UltraVi01
    I have the following SQL that I am having problems converting to HQL. A NPE is getting thrown -- which I think has something to do with the SUM function. Also, I'd like to sort on the subselect alias -- is this possible? SQL (subselect): SELECT q.title, q.author_id, (SELECT IFNULL(SUM(IF(vote_up=true,1,-1)), 0) FROM vote WHERE question_id = q.id) AS votecount FROM question q ORDER BY votecount DESC HQL (not working) SELECT q, (SELECT COALESCE(SUM(IF(v.voteUp=true,1,-1)), 0) FROM Vote v WHERE v.question = q) AS votecount FROM Question AS q LEFT JOIN q.author u LEFT JOIN u.blockedUsers ub WHERE q.dateCreated BETWEEN :week AND :now AND u.id NOT IN ( SELECT ub.blocked FROM UserBlock AS ub WHERE ub.blocker =:loggedInUser ) AND (u.blockedUsers IS EMPTY OR ub.blocked !=:loggedInUser) ORDER BY votecount DESC

    Read the article

  • Building a linked list with LINQ

    - by FreshCode
    What is the fastest way to order an unordered list of elements by predecessor (or parent) element index using LINQ? Each element has a unique ID and the ID of that element's predecessor (or parent) element, from which a linked list can be built to represent an ordered state. Example ID | Predecessor's ID --------|-------------------- 20 | 81 81 | NULL 65 | 12 12 | 20 120 | 65 The sorted order is {81, 20, 12, 65, 120}. An (ordered) linked list can easily be assembled iteratively from these elements, but can it be done in fewer LINQ statements? Edit: I should have specified that IDs are not necessarily sequential. I chose 1 to 5 for simplicity. See updated element indices which are random.

    Read the article

  • Class Members Over Exports

    - by VirusEcks
    When Using DLLs or Code-injecting to be Specific this is an example class only intended for explaining class test { int newint1; char newchararray[512]; void (*newfunction1)( int newarg1 ); int newfunction2( bool newarg1, char newarg2 ) { return newint1; } } mynewclass1; that covers most common elements that's included in classes now when exporting this function to another DLL or application and missed an element of those, either data member or function member, private or public what happens or changed their order ? and if each function is assigned it's value when Code-Injecting like mynewclass1.newfunction1 = (void *)(newexportedfunction); what's the happens in this case, if members of the class are pointers that are assigned after class construction and then missed one member or changed their order ?

    Read the article

  • Dropdown list with a "Select All" option

    - by shawnboy
    I have three dropdown boxes, Region, District, and City. I want my District dropdown to have a "Select All" option so the user can get all Cities in the Region, else just display the City based on the selected District. My query looks like this: IF @district =-2 THEN (SELECT DISTINCT city FROM myTable WHERE RIGHT(Region, 3) = ?) ORDER BY city) ELSE (select DISTINCT city FROM myTable WHERE District = ?) Order by city I'm using vb.net/sql I couldn't find any complex case scenarios in my search either. Any sugguestions would be appreciated!

    Read the article

  • Why can't a bind linux service to the loop-back only?

    - by Jon Trauntvein
    I am writing a server application that will provide a service on an ephemeral port that I only want accessible on the loopback interface. In order to do this, I am writing code like the following: struct sockaddr_in bind_addr; memset(&bind_addr,0,sizeof(bind_addr)); bind_addr.sin_family = AF_INET; bind_addr.sin_port = 0; bind_addr.sin_addr.s_addr = htonl(inet_addr("127.0.0.1")); rcd = ::bind( socket_handle, reinterpret_cast<struct sockaddr *>(&bind_addr), sizeof(bind_addr)); The return value for this call to bind() is -1 and the value of errno is 99 (Cannot assign requested address). Is this failing because inet_addr() already returns its result in network order or is there some other reason?

    Read the article

  • What are good Opensource Billing Solution with Customer Portal?

    - by krunaloverflow
    I'm looking for an Online Billing Solution along with a Customer Portal in open source space so that I can customize it the way as required in future. My requires are: Flat & Subscription(Periodical) based Billing (orders/invoices) Able to set products/services, its prices add customers or customers can register themselves from client end (a web page) and mange their profile themselves from customer portal, pay online, order products, check invoices, cancel order / subscription, etc. An interface (web service or API) that would provide a mechanism to check when customer recieves service, his current status and then allow them access to the services (similar to subscription membership website ) Please provide me with the options I should consider.

    Read the article

  • execute javascsript for loop alternately forward and backward

    - by Stiff Mittens
    What I'm trying to do is iterate through an array in chunks, alternating the direction of iteration from chunk to chunk. Confused? So am I. For example, if I want to loop thru an array with 25 elements, but I want to do it in this order: 0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14, 19, 18, 17, 16, 15, 20, 21, 22, 23, 24, what would be the most efficient way of doing this? I'm looking for something scalable because the array I'm working with now is actually 225 elements and I want to traverse it in 15 element chunks, but that may change at some point. So far, the only method I've figured out that actually works is to hard-wire the iteration order into a second array and then iterate through that in the normal way to get the indices for the original array. But that sucks. Any help would be greatly appreciated.

    Read the article

  • Update int array based on parent

    - by Pickels
    I have the following int[] in my database: '{0}' '{0,0}' '{0,0,0}' '{0,0,0,0}' This column is used to sort my tree data. Now when a parent updates it's order the children should also update. For example if the second record updates it's order to 1 it should result in the following. '{0}' '{0,1}' '{0,1,0}' '{0,1,0,0}' So I was wondering what the query would be to update record 3 and 4. In case it's not clear what I am asking leave a comment I can add additional information. Screenshot of my actual data:

    Read the article

  • Shuffling a list with a constraint

    - by 500
    Preparing a new psychophysic experiment, I have 48 original stimuli displayed 4 times (4 conditions). Resulting in 192 trials. Trying to randomize the order of presentation during the experiment, I need to maximize the distance between the 4 display of the same original stimuli. Please Consider : Table[{j, i}, {j, Range[48]}, {i, Range[4]}] Where j is the original stimuli number and i the condition Output Sample : {{1, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, ... {47, 1}, {47, 2}, {47, 3},{47, 4}, {48, 1}, {48, 2}, {48, 3}, {48, 4}} How could I shuffle the order of presentation of those 192 items, maximizing the distance between identical item with regard to j the original stimuli number ?

    Read the article

  • Selecting previous and next row using sp

    - by davor
    I want to select previous and next row from table based on current id. I send current id to stored procedure and use this query: -- previous select top 1 id from table where id < @currentId order by id desc -- next select top 1 id from table where id < @currentId order by id asc The problem is when I send currentId which is the last id in the table and want to select next row. Then is nothing selected. Same problem for previous row, when I send currentId which is first id in table Is it possible to solve this in sql without additional queries?

    Read the article

  • How to synchronize two (or n) replication processes for MS SQL databases?

    - by Yauheni Sivukha
    There are two master databases and two read-only copies updated by standard transactional replication. It is needed to map some entity from both read-only databases, lets say that A databases contains orders and B databases contains lines. The problem is that replication to one database can lag behind replication of second database, and at the moment of mapping R-databases will have inconsistent data. For example. We stored 2 orders with lines at 19:00 and 19:03. Mapping process started at 19:05, but to the moment of mapping A database replication processed all changes up to 19:03, but B database replication processed only changes up to 19:00. After mapping we will have order entity with order as of 19:03 and lines as of 19:00. The troubles are guaranteed:) In my particular case both databases have temporal model, so it is possible to fetch data for every time slice, but the problem is to identify time of latest replication. Question: How to synchronize replication processes for several databases to avoid situation described above?

    Read the article

  • Get name and value from the input tag

    - by DroidIn.net
    Before you say "oh no, not again" here I'm stating my case. I'm parsing part of HTML output and the only thing I'm interested in is name and value attributes of each <input/ tag. HTML is actually HTML fragment, may not be well-formed. I don't have DOM or HTML parser and I don't try to parse nested elements anyway. The problem is that I don't know the order or number of attributes so it could be <input name="foo" value="boo"/> or <input type="hidden" name=foo> or <input id=blah value='boo' src="image.png" name="foo" type="img"/>. Is there a single regular expression that would get me values of name and value attribute in predictable order? I wouldn't have asked the question if I could assume that name attribute always precedes value but unfortunately this is not the case

    Read the article

  • jQuery infinite loop w/ tablesorter

    - by Wells
    Got myself in a funny situation: page has three tables. Using sortEnd, any time you sort one table, it sorts the other three. However, since I bound sortEnd to the function that does the sorting, you get a infinite loop of sorting/resorting. It looks like: $("table.tablesorter").tablesorter({widgets: ['zebra']}).bind("sortEnd", function() { $(this).find("th.headerSortDown,.headerSortUp").each(function(i) { index = $(this).attr("cellIndex"); order = ($(this).is(".headerSortDown")) ? 1 : 0; $("table.tablesorter").tablesorter({sortList: [[index,order]]}); }); }); Any tips on how to clean this up?

    Read the article

  • How to get the next prefix in C++?

    - by Vicente Botet Escriba
    Given a sequence (for example a string "Xa"), I want to get the next prefix in order lexicographic (i.e "Xb"). As I don't want to reinvent the wheel, I'm wondering if there is any function in C++ STL or boost that can help to define this generic function easily? If not, do you think that this function can be useful? Notes The next of "aZ" should be "b". Even if the examples are strings, the function should work for any Sequence. The lexicographic order should be a template parameter of the function.

    Read the article

  • Should member variables of global objects be made global as well?

    - by David Wong
    I'm developing plugins in Eclipse which mandates the use of singleton pattern for the Plugin class in order to access the runtime plugin. The class holds references to objects such as Configuration and Resources. In Eclipse 3.0 plug-in runtime objects are not globally managed and so are not generically accessible. Rather, each plug-in is free to declare API which exposes the plug-in runtime object (e.g., MyPlugin.getInstance() In order for the other components of my system to access these objects, I have to do the following: MyPlugin.getInstance().getConfig().getValue(MyPlugin.CONFIGKEY_SOMEPARAMETER); , which is overly verbose IMO. Since MyPlugin provides global access, wouldn't it be easier for me to just provide global access to the objects it manages as well? MyConfig.getValue(MyPlugin.CONFIGKEY_SOMEPARAMETER); Any thoughts? (I'm actually asking because I was reading about the whole "Global variable access and singletons are evil" debates)

    Read the article

  • How to redirect non-www site to www site?

    - by Mohan Ahire
    I have created one wordpress site. As I write domain name without www then it opens correctaly but as I write www. in url it's not showing the site. Please help me.. Thank you in advance. I have edited my question and added the following part : Following is my file : Where I have to put code provided by you ? I tried it before the "Begin Wordpress" line but still not working. plugable.php -FrontPage- IndexIgnore .htaccess /.?? *~ *# /HEADER */README* */_vti* order deny,allow deny from all allow from all order deny,allow deny from all AuthName example.com AuthUserFile /home/example/public_html/_vti_pvt/service.pwd AuthGroupFile /home/example/public_html/_vti_pvt/service.grp BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] END WordPress

    Read the article

  • php script to generate checksum from md5

    - by sumit
    In order to calculate the checksum i need following things. these parameters are concatenated in a constant (no spaces) string made up of the values of the following parameters in the exact order listed below: o Secret Key o Merchant id o Currency o Total amount o Item list (item_name_1, Item_amount_1, item_quantity_1 to item_name_N, Item_amount_N, item_quantity_N) o Timestamp e.g In that case the string befor hash will be: pLAZdfhdfdNh57583USD69.99Tier2 item69.9912010-06-14.14:34:33 And using the MD5 hash function the result is: ghvsaf764t3w784tbjkegbjhdbgf i want to know how can i create a php script that will call md5 hash function with the inputs given above and based on that it will generate the hash function value that will be the checksum value for my coding..

    Read the article

  • upload multiple images, display thumbnails, manipulate image

    - by robert
    hy, i need a little help here i want to be able to upload multiple images after i upload all i want to display thumbnails, when i click on a thumb i want to be able to rotate the image (rotate the original image not only the thumb) All uploaded images i want to be in one php array, in the order they have been uploaded. Or if i can to change the order of the images, i know is possible with jQuery! how i can code this?? i started but i can't get this done! here is my project so far: http://www.mediafire.com/?3uzzgx5onzn any help is welcome! Thanks!

    Read the article

  • Basics of html5 and canvas

    - by René Nyffenegger
    As I browse through different questions here, I see that there are a number of questions tagged with html5 and canvas, so I guess they sort of belong together. Now, I have absolutely no idea about the canvas (which is obviously (?) rendered in html5), but it seems that It could be useful one day in the future. So, in order to be prepared when that day comes, I'd like to know the basics about these things. I found a html snippet that is supposed to render such a canvas, but when opened in my browser (firefox) nothing is displayed. So, I guess I need a special plugin or another browser. My question: what are the absolute basic things I need to know and have in order to create a hello world thingy. Please bear in mind that I am completely new with this and don't need no fancy advanced stuff.

    Read the article

  • Call functions in an event/function chain?

    - by acidzombie24
    I have 3 functions. They can be called in any order (later they may need specific order). The return value of one function should be the first param of the next. How do i do this? what i am thinking is something like the below. Whats the best way to do this? string void fn(string sz, data d, eventhdl nextFunc) { //do stuff if(nextFunc == null) return ret; else return nextFunc(ret, d, nextFunc.Next); }

    Read the article

  • Programming to interfaces while mapping with Fluent NHibernate.

    - by Lucious
    Fluent Mapping I Have the following scenario public class CustomerMap : ClassMap { public CustomerMap() { Table("Customer"); Id(c = c.Id); Map(c = c.Name); HasMany(c = c.Orders); } } public class OrderMap : ClassMap<IOrder> { public OrderMap() { Table("Orders"); References(o => o.Customer).Access.; Id(o => o.Id); Map(o => o.DateCreated); } } Problems When schema exported the order table has two columns ICustomer_Id,Customer_Id. refers to an unmapped class Order exception Can you please help me out?

    Read the article

< Previous Page | 135 136 137 138 139 140 141 142 143 144 145 146  | Next Page >