Search Results

Search found 613 results on 25 pages for 'tony lambert'.

Page 15/25 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How can I order by the result of a recursive SQL query

    - by Tony
    I have the following method I need to ORDER BY: def has_attachments? attachments.size > 0 || (!parent.nil? && parent.has_attachments?) end I have gotten this far: ORDER BY CASE WHEN attachments.size > 0 THEN 1 ELSE (CASE WHEN parent_id IS NULL THEN 0 ELSE (CASE message.parent ...what goes here ) END END END I may be looking at this wrong because I don't have experience with recursive SQL. Essentially I want to ORDER by whether a message or any of its parents has attachments. If it's attachment size is 0, I can stop and return a 1. If the message has an attachment size of 0, I now check to see if it has a parent. If it has no parent then there is no attachment, however if it does have a parent then I essentially have to do the same query case logic for the parent. UPDATE The table looks like this +---------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | message_type_id | int(11) | NO | MUL | | | | message_priority_id | int(11) | NO | MUL | | | | message_status_id | int(11) | NO | MUL | | | | message_subject_id | int(11) | NO | MUL | | | | from_user_id | int(11) | YES | MUL | NULL | | | parent_id | int(11) | YES | MUL | NULL | | | expires_at | datetime | YES | MUL | NULL | | | subject_other | varchar(255) | YES | | NULL | | | body | text | YES | | NULL | | | created_at | datetime | NO | MUL | | | | updated_at | datetime | NO | | | | | lock_version | int(11) | NO | | 0 | | +---------------------+--------------+------+-----+---------+----------------+ Where the parent_id refers to the parent message, if it exists. Thanks!

    Read the article

  • Upload Excel or CSV file to MySQL with PHP

    - by Tony
    I'm looking to allow users to upload an Excel or CSV file to MySQL for a contact management system. Need to be able to allow users to map their columns so that they are imported into the correct column in the table. Anyone know of a good site or tutorial on this?

    Read the article

  • Function Object in Java .

    - by Tony
    I wanna implement a javascript like method in java , is this possible ? Say , I have a Person class : public class Person { private String name ; private int age ; // constructor ,accessors are omitted } And a list with Person objects: Person p1 = new Person("Jenny",20); Person p2 = new Person("Kate",22); List<Person> pList = Arrays.asList(new Person[] {p1,p2}); I wanna implement a method like this: modList(pList,new Operation (Person p) { incrementAge(Person p) { p.setAge(p.getAge() + 1)}; }); modList receives two params , one is a list , the other is the "Function object", it loops the list ,and apply this function to every element in the list. In functional programming language,this is easy , I don't know how java do this? Maybe could be done through dynamic proxy, does that have a performance trade off?

    Read the article

  • WPF Composite - Expose EF model to all modules

    - by Tony
    Hi All, I have an application that uses WPF Composite, and I have an issue. I've got a big database that is attached to the application and I need it exposed to different modules as part of the application. What is the best way to expose my Entity Framework model to all my different modules and views inside them? Do I have one EF model or a separate one for each module and then only the tables that each module needs. The only problem being that some tables have a relationship and will have different views and those views will be in different modules. Any ideas how to resolve this?

    Read the article

  • jquery tabs dissapear when re-clicked

    - by tony noriega
    Here is my test page (dont mind the layout right now) https://www.bcidaho.com/test_kalyani/employer-plans-test.asp i found something weird. if you click back and forth between tab 1 and tab 2, its fine. if you click tab 3, and got to another tab, the content dissapears... and i can not figure out why??? I am boggled, and can not figure out why it does this.... is it a display:hide element in the CSS? here is a link to the CSS file: https://www.bcidaho.com/css/employer.css here is a link to the javascript files that i use: https://www.bcidaho.com/js/ui.toggle-employers.js https://www.bcidaho.com/js/tabbed-menu3.js

    Read the article

  • recursion tree and binary tree cost calculation

    - by Tony
    Hi all, I've got the following recursion: T(n) = T(n/3) + T(2n/3) + O(n) The height of the tree would be log3/2 of 2. Now the recursion tree for this recurrence is not a complete binary tree. It has missing nodes lower down. This makes sense to me, however I don't understand how the following small omega notation relates to the cost of all leaves in the tree. "... the total cost of all leaves would then be Theta (n^log3/2 of 2) which, since log3/2 of 2 is a constant strictly greater then 1, is small omega(n lg n)." Can someone please help me understand how the Theta(n^log3/2 of 2) becomes small omega(n lg n)?

    Read the article

  • How do you filter a view of a DataTable in .Net 3.5 sp1 using WPF c# and xaml?

    - by Tony
    I found the MSDN example code for getting the default view of a collection and adding a filter to the view, but most of it is for .Net 4.0. I'm on a team that is not currently switching to 4.0, so I don't have that option. None of the examples I found used a DataTable as the source, so I had to adapt it a little. I'm using a DataTable because the data is comming from a DB ans it's easy to populate. After trying to implement the MSDN examples, I get a "NotSupportedException" when I try to set the Filter. This is the c# code I have: protected DataTable _data = new DataTable(); protected BindingListCollectionView _filteredDataView; ... private void On_Loaded(Object sender, RoutedEventArgs e) { _filteredDataView = (BindingListCollectionView)CollectionViewSource.GetDefaultView(_data); _filteredDataView.Filter = new Predicate(MatchesCurrentSelections); // throws NotSupportedException } ... public bool MatchesCurrentSelections(object o){...} It seems that either BindingListCollectionView does not support filtering in .Net 3.5, or it just doesn't work for a DataTable. I looked at setting it up in XAML instead of the C# code, but the XAML examples use collections in resources instead of a collection that is a memberof the class, so I have no idea how to set that up. Does any one know how to filter a view to a DataTable?

    Read the article

  • Ajax PageMethods troubles

    - by Tony
    Hi http://stackoverflow.com/questions/2709245/ajax-without-updatepanel/2709262#2709262 I tried to use these methodologies to remove UpdatePanel from application, I have a page with search keyword which call the PageMethods and I load the user control manually and render it then place rendering output to the page, but something strange happen, while search results is 100 and there is DataPager in the user control, the data pager did not appear, and also only one element appear, it looks that ItemTemplate did not resolve more than once. What is chances ??

    Read the article

  • jQuery Audio Player

    - by tony noriega
    I was given 2 MP3 files, one that is 4.5Mb and one that is 5.6Mb. I was instructed to have them play on a website i am managing. I have found a nice, clean looking CSS based jQuery audio player. My question is, is this the right solution for files that big? I am not sure if the player preloads the file, or streams it ? (if that is the correct terminology) i dont deal much with audio players and such... this player is from happyworm.com/jquery/jplayer/latest/demo-01.htm is there another approach i shoudl take to get this to play properly? I dont want it to have to buffer, and the visitor to wait, or slow page loading...etc..etc.. i want it to play clean and not affect the visitors session to the site. thanks

    Read the article

  • C# A random BigInt generator

    - by Tony
    Hi, I'm about to implement the DSA algorithm, but there is a problem: choose "p", a prime number with L bits, where 512 <= L <= 1024 and L is a multiple of 64 How to implement a random generator of that number? Int64 has "only" 63 bits length

    Read the article

  • java asynchronous task.

    - by Tony
    For some of HTTP requests from clients, there was very complex business logic in server side. Some of these business logics doesn't require to response to the client immediately, like sending a email to somebody. Can I put those tasks in an asynchronous method.

    Read the article

  • Theory of computation - Using the pumping lemma for CFLs

    - by Tony
    I'm reviewing my notes for my course on theory of computation and I'm having trouble understanding how to complete a certain proof. Here is the question: A = {0^n 1^m 0^n | n>=1, m>=1} Prove that A is not regular. It's pretty obvious that the pumping lemma has to be used for this. So, we have |vy| = 1 |vxy| <= p (p being the pumping length, = 1) uv^ixy^iz exists in A for all i = 0 Trying to think of the correct string to choose seems a bit iffy for this. I was thinking 0^p 1^q 0^p, but I don't know if I can obscurely make a q, and since there is no bound on u, this could make things unruly.. So, how would one go about this?

    Read the article

  • PHP auto refresh page without losing user input

    - by Tony
    I'm working on a PHP collaboration software project. I have a page that shows the latest updates from other users who are adding content to the database, but also has a form input to allow the user to enter text. I am currently using this code to refresh the page automatically every 30 seconds: header('Refresh: 30'); The problem is that the header code refreshes the entire page, and not just what is pulled from the database. Is there any PHP code that will just pull any new data from the database without refreshing the entire page? If someone could point me in the right direction I'd appreciate it.

    Read the article

  • Would you use a UITableViewController to implement a check list on the iPhone?

    - by Tony
    I am creating an application that will have a list of items that can be checked. I just implemented it as a Table View by subclassing UITableViewController. Now I am realizing that since individual items don't have a child view (i.e. clicking on an item "Dinner" does not need to pull up a child list of "Dinner Items") then maybe I should have just created a custom view for the list. In your experience, would it be better to use the Table View or create something custom? thanks! p.s. I am a bit new to iPhone dev, but NOT new to C

    Read the article

  • Where did Pylons beautiful error handling go? Using Nginx + Paster + Flup#fcgi_thread

    - by Tony
    I need to run my development through nginx due to some complicated subdomain routing rules in my pylons app that wouldn't be handled otherwise. I had been using lighttpd + paster + Flup#scgi_thread and the nice error reporting by Pylons had been working fine in that environment. Yesterday I recompiled Python and MySQL for 64bit, and also switched to Ngix + paster + Flup#fcgi_thread for my development environment. Everything is working great, but I miss the fancy error reports. This is what I get now, and it is a mess compared to what I got used to: http://drp.ly/Iygeg . And here are the pylons/nginx configs. Pylons: [server:main] use = egg:Flup#fcgi_thread host = 0.0.0.0 port = 6500 Nginx: location / { #include /usr/local/nginx/conf/fastcgi.conf; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param QUERY_STRING $query_string; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_pass_header Authorization; fastcgi_intercept_errors off; fastcgi_pass 127.0.0.1:6500; }

    Read the article

  • How can I use offline access with the Facebook javascript SDK?

    - by Tony
    In the Facebook javascript api there is a login function in which you specify extended permissions: http://developers.facebook.com/docs/reference/javascript/FB.login One of these permissions is offline access. So I can save the facebook user's session key and assume it will not expire for a long time. The question I have is simple - how do I use the session key? I understand that the session key will last longer, but I don't understand how to use it in the Facebook API. For one of my products, a user must restart his/her browser and I would like to recognize them when they restart. The problem is that they are logged out of facebook, so they must login on my site again where I would rather just use offline access. Sample code would be great! Thanks

    Read the article

  • Creating a table with an initial element selected

    - by Tony
    I want to create a table which displays in each row a set of data, in addition to a radio button for possible selection. This can be achieved easily by using a simple table model class which extends the DefaultTableModel and a cell renderer and editor class which implements the TableCellRenderer and TableCellEditor interfaces respectively. What I really couldn't manage to do is to make the table to display initially one of the elements (rows) initially selected. It seems straightforward but it isn't...does anybody have a clue about it?

    Read the article

  • Qt4Dotnet on Mac OS X

    - by Tony
    Hello everyone. I'm using Qt4Dotnet project in order to port application originally written in C# on Linux and Mac. Port to Linux hasn't taken much efforts and works fine. But Mac (10.4 Tiger) is a bit more stubborn. The problem is: when I try to start my application it throws an exception. Exception states that com.trolltech.qt.QtJambi_LibraryInitializer is unable to find all necessary ibraries. QtJambi library initializer uses java.library.path VM environment variable. This variable includes current working directory. I put all necessary libraries in a working directory. When I try to run the application from MonoDevelop IDE, initializer is able to load one library, but the other libraries are 'missing': An exception was thrown by the type initializer for com.trolltech.qt.QtJambi_LibraryInitializer --- java.lang.RuntimeException: Loading library failed, progress so far: No 'qtjambi-deployment.xml' found in classpath, loading libraries via 'java.library.path' Loading library: 'libQtCore.4.dylib'... - using 'java.library.path' - ok, path was: /Users/chin/test/bin/Debug/libQtCore.4.dylib Loading library: 'libqtjambi.jnilib'... - using 'java.library.path' Both libQtCore.4.dylib and libqtjambi.jnilib are in the same directory. When I try to run it from the command prompt, the initializer is unable to load even libQtCore.4.dylib. I'm using Qt4Dotnet v4.5.0 (currently the latest) with QtJambi v4.5.2 libraries. This might be the source of the problem, but I'm neither able to compile Qt4Dotnet v4.5.2 by myself nor to find QtJambi v4.5.0 libraries. Project's page states that some sort of patch should be applied to QtJambi's source code in order to be compatible with Mono framework, but this patch hasn't been released yet. Without this patch application crashes in a strange manner (other than library seek fault). I must note that original QtJambi loads all necessary libraries perfectly, so it might be issues of IKVM compiler used to translate QtJambi into .Net library. Any suggestions how can I overcome this problem?

    Read the article

  • CSS horizontal scrolling box

    - by tony noriega
    im trying to create a horizontal scrolling box to create a "timeline" effect... but i cant seem to get it to scroll horizontally, versus the vertical scroll bar that shows up...thoughts? #container{ width:500px; height:250px; border:1px solid #cc61b8; overflow:auto; } .container-bits{ width:250px; height:498px; float:left; } <div id="container"> <div class="container-bits">Content Here</div> <div class="container-bits">Content Here</div> <div class="container-bits">Content Here</div> <div class="container-bits">Content Here</div> <div class="container-bits">Content Here</div> <div class="container-bits">Content Here</div> </div>

    Read the article

  • best practice for passing many arguments to method ?

    - by Tony
    Occasionally , we have to write methods that receive many many arguments , for example : public void doSomething(Object objA , Object objectB ,Date date1 ,Date date2 ,String str1 ,String str2 ) { } When I encounter this kind of problem , I often encapsulate arguments into a map. Map<Object,Object> params = new HashMap<Object,Object>(); params.put("objA",ObjA) ; ...... public void doSomething(Map<Object,Object> params) { // extracting params Object objA = (Object)params.get("objA"); ...... } This is not a good practice , encapsulate params into a map is totally a waste of efficiency. The good thing is , the clean signature , easy to add other params with fewest modification . what's the best practice for this kind of problem ?

    Read the article

  • Slow form submission.

    - by Tony
    When I submit a form, I can see my browser's progress bar slowly increased, it takes 4-6s to submit a form. It was a generic form like : <form id="someid" name="someName" action="someAction.do"> ... </form> I test it in IE8 and Firefox 3,both are very slow. My network condition is fine, my server works great. What could be the problem?

    Read the article

  • Missing prop-base file problem

    - by Tony
    I am using Eclipse and SVNSubversion as a repository for a Java project. After updating the local repository and starting Eclipse, an error (in the Problems tab) appeared stating that a specific prop-base file was missing from the build path. Being inexperienced, I have accidentally deleted the prop-base file icon from the project build-path library section. Since then the numbers of errors have grown exponentially... What should I do? Updating the local repository and/or starting a new Eclipse project from the same source did not solve the problem, does anyone have an idea?

    Read the article

  • Weird Rails URL issue when rendering a new action

    - by Tony
    I am rendering a new action but somehow getting the "index" URL. To be more specific, my create action looks like this: class ListingsController < ApplicationController def create @listing = Listing.new(params[:listing]) @listing.user = @current_user if @listing.save redirect_to @listing else flash[:error] = "There were errors" render :action => "new" end end end When there are errors, I get the "new" action but my URL is the index URL - http://domain.com/listings Anyone know why this would happen? My routes file is fairly standard: map.connect 'listings/send_message', :controller => 'listings', :action => 'send_message' map.resources :listings map.root :controller => "listings" map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format'

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >