Search Results

Search found 9744 results on 390 pages for 'k means'.

Page 23/390 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Eager load this rails association

    - by dombesz
    Hi, I have rails app which has a list of users. I have different relations between users, for example worked with, friend, preferred. When listing the users i have to decide if the current user can add a specific user to his friends. -if current_user.can_request_friendship_with(user) =add_to_friends(user) -else =remove_from_friends(user) -if current_user.can_request_worked_with(user) =add_to_worked_with(user) -else =remove_from_worked_with(user) The can_request_friendship_with(user) looks like: def can_request_friendship_with(user) !self.eql?(user) && !self.friendships.find_by_friend_id(user) end My problem is that this means in my case 4 query per user. Listing 10 users means 40 query. Could i somehow eager load this?

    Read the article

  • Between/Timerange LINQ

    - by dezza
    My intention here is to select all entries (Bookings) between "begin" (begin_prefix) and "end" (end_prefix) BUT! The important thing is: If I have a booking at 07:25-10:00 - you query for 09:00-10:00 it should still show the booking because it reserves the room until 10 no matter what .. So .. 07.25-10.00 booking means query for 09:00-10.00 still returns a list of bookings within 09:00-10.00 (which means 07.25-10.00 is included) public static List<booking> Today(DateTime begin, DateTime end) { try { IFormatProvider Culturez = new CultureInfo(ConfigurationManager.AppSettings["locale"].ToString(), true); DateTime begin_prefix = DateTime.ParseExact(begin.ToString(), "dd-MM-yyyy HH:mm:ss", Culturez); DateTime end_prefix = DateTime.ParseExact(end.ToString(), "dd-MM-yyyy HH:mm:ss", Culturez); dbDataContext db = new dbDataContext(); // gives bookings BEFORE begin_prefix (why?) IQueryable<booking> bQ = from b in db.bookings where begin_prefix >= b.Starts && b.Ends <= end_prefix && b.Ends > b.Starts && b.pointsbookings.Count > 0 select b; // ^gives bookings BEFORE begin_prefix (why?) List<booking> bL = bQ.ToList(); return bL; } catch (Exception) { throw; } } I've tried getting this right for some time now .. Seems everytime I correct it to something new, a new overlap or selection outside the two begin/end dates seem to appear :( UPDATE CRITERIA and SOURCE: Bookings has to be WITHIN "begin_prefix" and "end_prefix" or on the exact same time .. .. currently the above code gives me bookings BEFORE begin_prefix date, which is not intentioned! We're in 2011, I got bookings from 2010 as well! ** NEW!! UPDATED: This is what I have: SEARCH.START = BOOKING.START BOOKING.END <= SEARCH.END ... the problem comes up when .. BOOKING entry: 10:00(Start)-14:00(End) This means according to above: 08.59 = 10.00 (SEARCH.START = BOOKING.START) It will never include it. But it should, since this is the same room and the seats are booked individually!

    Read the article

  • iPhone/iPad universal build problem with firmware version

    - by DigitalVanilla
    Hello guys, I was doing a project as Universal binary for iPhone/iPad. I created the iPhone app side and I was doing to complete the iPad too. I noticed one thing, on iPad classes I use the UIPopoverController class, means that when I build now for 3.2 in the Simulator, it runs te iPad one and it works fine, BUT if I want to see the iPhone version app, means 3.1.3, It give me an error of framework missing in the iPad classes. I have no idea how to solve this problem because I cannot anymore see the iPhone version of the app and make changes. I can only remove all the iPad classes and after reimport again. thanks guys!

    Read the article

  • How do I get the path of the current executed file in python?

    - by Sorin Sbarnea
    This may seam a newbie question but it is not. It looks that common approaches are not always working: Currently I know only two options but none of them looks to work an all cases. sys.argv[0] This means using path = os.path.abspath(os.path.dirname(sys.argv[0])) but this does not work if you are running from another python script from another directory, and this can really happen in real life. __file__ this means that path = os.path.abspath(os.path.dirname(__file__)) but I found that this doesn't work: py2exe that doesn't have a __file__ attribute but there is an workaround. when you run from IDLE with execute() there is no __file__ attribute OS X 10.6 where I get NameError: global name '__file__' is not defined Related questions with incomplete answers: http://stackoverflow.com/questions/1296501/python-find-path-to-file-being-run http://stackoverflow.com/questions/1483827/python-path-to-current-file-depends-on-how-i-execute-the-program http://stackoverflow.com/questions/2259503/how-to-know-the-path-of-the-running-script-in-python http://stackoverflow.com/questions/509742/python-chdir-to-dir-the-py-script-is-in

    Read the article

  • What is the 'noreq' Filter Type an Alias for?

    - by Alan Storm
    I'm looking in to Magento's filtering options (Ecommerce System and PHP Framekwork with an expansive ORM system). Specifically the addFieldToFilter method. In this method, you specify a SQLish filter by passing in a single element array, with the key indicating the type of filter. For example, array('eq'=>'bar') //eq means equal array('neq'=>'bar') //neq means not equal would each give you a where clause that looks like where field = 'bar'; where field != 'bar'; So, deep in the bowels of the source, I found a comparison type named 'moreq' that maps to a = comparison operator array('moreq'=>'27') where field >= 27 The weird thing is, there's already a 'gteq' comparision type array('gteq'=>'27') where field >= 27 So, my question is, what does moreq stand for? Is is some special SQL concept that's supported in other databases that the Magento guys wants to map to MySQL, or is it just "more required" and an example what happens when you're doing rapid agile and trying to maintain backwards compatibility.

    Read the article

  • Is both approach same ?

    - by Harikrishna
    I have one datatable which is not bindided and records are coming from the file by parsing it in the datatable dynamically every time. Now there is three columns in the datatable Marks1,Marks2 and FinalMarks. And their types is decimal. Now for making addition of columns Marks1 and Marks2 's records and store it into FinalMarks column,For that what I do is : datatableResult.Columns["FinalMarks"].Expression="Marks1+Marks2"; It's works properly. It can be done in other way also is foreach (DataRow r in datatableResult.Rows) { r["FinalMarks"]=Convert.ToDecimal(r["Marks1"])+Convert.ToDecimal(r["Marks2"]); } Now I don't know that which is the best way to do this means performance wise. Is first approach same as second approach in background means is both approach same or what?

    Read the article

  • Cloud HUGE data storage options?

    - by ToughPal
    Hi, Does anyone have a good suggestion on how to do video recording? We have a camera that can record and then stream live video to a server. So this means we can have 1000's of cameras sending data 24X7 for recording. We will store data for over 7 / 14 / 30 days depending on the package. Per day if a camera is sending data to the server then it will store 1.5GB. So that means there is a traffic of 1.5GB / day / camera Total monthly 45GB / month / camera (Data + bandwidth for one camera) Please let me know the most cost effective way to get this data stored? Thanks!

    Read the article

  • How to fetch redio button value and save this value in app.config at installation time?

    - by Ashwin
    i have one question related to add-in installation.......... qus is: i want to combine shared addin for msword created in visual studio 2005, to my project that means if i install my product then addin is also install with this........ and if i uninstall my product add-in is also uninstall........... and i also have another question other than addin i want to give language choosen option at installation time that means if user want to select hindi then our product install in hindi language and if select english than install in english... how this facility give in setup creation plzzz discribe in detail.

    Read the article

  • Produce high-quality, custom-size thumbnails from Office documents on Windows?

    - by Edwin
    Hi, What do you think would be the best way to produce custom size image thumbnail from MS Office documents (doc, xls and ppt) on Windows with native code (means all means besides .NET/JAVA)? My current research result: IExtractImage COM. Problem: The size of the generated result is fixed and low quality, and you can't be sure all the source documents contain the thumbnails. Use a programmable virtual printer to print the specified page, and the printer must support image output, any good suggestion for this? What else would you suggest? thanks!

    Read the article

  • C++ get method - returning by value or by reference

    - by HardCoder1986
    Hello! I've go a very simple question, but unfortunately I can't figure the answer myself. Suppose I've got some data structure that holds settings and acts like a settings map. I have a GetValue(const std::string& name) method, that returns the corresponding value. Now I'm trying to figure out - what kind of return-value approach would be better. The obvious one means making my method act like std::string GetValue(const std::string& name) and return a copy of the object and rely on RVO in performance meanings. The other one would mean making two methods std::string& GetValue(...) const std::string& GetValue(...) const which generally means duplicating code or using some evil constant casts to use one of these routines twice. #Q What would be your choice in this kind of situation and why?

    Read the article

  • integration of Asp.net and worpress blog

    - by vatsalit
    My website in asp.net. In this website when member register at that time wordpress blog will be created for that member. For another member another wordpress blog will be created for that member. When member change password in our means asp.net website also password will be change for his or her wordpress blog. It means asp.net is directly interact with wordpress blog. Is it possible? If yes then how it will be work? Please help me in detail. Thank you.

    Read the article

  • Interface issue

    - by peter
    i added a property 'WrmVersion' in interface IResourcePolicy but i am not getting those thing in the implementation side means here it should come in the List view data. means SubItems.Add(((IResourcePolicy)Data).WrmVersion is not getting This is the interface public interface IResourcePolicy { DataVersion WrmVersion { get; set; } bool ResourcePolicyEnabled { get; set; } } i am implementing it in public new IResourcePolicy Data { get { return (IResourcePolicy)base.Data; } } protected override void OnUpdate() { if(Data != null) { Text = base.Data.Name; if(SubItems.Count == 1) { SubItems.Add(((IResourcePolicy)Data).ResourcePolicyEnabled.ToString()); }

    Read the article

  • Frustrated With Wpf DataGrid

    - by user197373
    Hello Experts, I have a tabcontrol and I place datagrid inside a tabcontrol... But I could not focus that Datagrid at the load event ... Focus means I couldn't navigate through keyboard into it... I'm getting this problem only inside of the tab control otherwise it works fine...my sample project link as follows.. http://cid-0255f3152326d2b1.skydrive.live.com/browse.aspx/WPF%20Datagrid%20Problem?uc=1&nl=1 (1) Please remember note that focus means I couldn't navigate a datagrid through keyboard (2) It should be in load event......Because it works fine in other events... (3) Datagrid should be placed inside a tab control... Because it works fine outside a tab control..... I hope u wil help me... please help me out Thanks in Advance

    Read the article

  • Hudson results one step behind

    - by kaerast
    I'm using the filesytem plugin for Hudson, and when a build happens it looks for new/modified files, copies them to the Workspace, runs tests using Rake, and then publishes those junit xml result files. However, the updated junit xml result files don't get pushed to the workspace until the next build. This means that when the publishing of the junit xml result files happens, it's always one step behind. And this means I need to run a build twice before the results show. The Rake task is creating the junit xml files in the project directory. I've tried outputting to the workspace directory, but it seems to make things worse and the results don't get published at all. Am I doing something fundamentally wrong here? Is there a simple way of getting those junit xml results pushed to the workspace so that the post-build "Publish JUnit test result report" actually runs against the newly created xml files?

    Read the article

  • Loading HTML5 video on iPad via onclick event tied to a div

    - by joncys
    I'm developing an HTML5 application (a game), that automatically preloads 5 video files. I'm able to do so correctly on Safari for PC, so there are no overlooked problems with file formats, codecs or such. The load fails on an iPad. As an official guide for video on iOS puts it: This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not. Does this mean, that I have no means to initiate the loading of video after a user initiated action, if that action hasn't been tied to a video element (user clicked on a regular div — I request loading and displaying of a video, compared to the user actually clicking on a video element to load and play that particular element)? Thanks for your help!

    Read the article

  • for loop vs while loop

    - by Atul
    We can use for loop and while loop for same purpose. in what means they effect our code if I use for instead of while? same question arises between if-else and switch-case? how to decide what to use? for example which one you would prefer? This code: int main() { int n; cin>>n; for(int i=0;i<n;i++) { do_something(); } return 0; } Or this code: int main() { int n,i=0; cin>>n; while(i<n) { do_something(); i++; } return 0; } if using for or while loop does not effect the code by any means then may I know What was the need to make 2 solution for same problem?

    Read the article

  • Fixing CSS positioning and scaling

    - by Louis
    I was contemplating writing a UI toolkit where setting the position and size of an element/widget was intuitive and powerful. Here are some examples of how it would be used (not currently implemented): ui("Panel").size(". 40").pos("0 0").attach(element); ui("Textarea").size(". %-10").pos("0 40").attach(element); ui("Panel").size(". 10").pos("0 bottom+5"); Where . means auto, % means 100% and the possibility to add pixels to percentages. Does anything like said exist (even as a jQuery plugin or something)? Somethings just aren't possible with pure CSS.

    Read the article

  • wrap text around image control in C#.Net

    - by Ravi
    Hi, I am working on C#.DotNet windows application project, here i am using Infragistics control. In this project i want to add image over text control. This image contains two portion, 35% of image have white color another 65% of image have green color.In this image 2nd portion(green color) i have to display dynamic string , this string size may dynamically updating. But this string dont go first portion(white color) of image. For that i am using UltraLabel control. I have add image in UltraLabel ImageBackground property and TextHAlign set as Right. But here small 15 charecter string means appear only second portion(green color), 20 charecter string means appeaer second & first portion. I don't want to display first portion of image. Thanks

    Read the article

  • About first-,second- and third-class value

    - by forest58
    First-class value can be passed as an argument returned from a subroutine assigned into a variable. Second-class value just can be passed as an argument. Third-class value even can't be passed as an argument. Why should these things defined like that? As I understand, "can be passed as an argument" means it can be pushed into the runtime stack;"can be assigned into a variable" means it can be moved into a different location of the memory; "can be returned from a subroutine" almost has the same meaning of "can be assigned into a variable" since the returned value always be put into a known address, so first class value is totally "movable" or "dynamic",second class value is half "movable" , and third class value is just "static", such as labels in C/C++ which just can be addressed by goto statement, and you can't do nothing with that address except "goto" .Does My understanding make any sense? or what do these three kinds of values mean exactly?

    Read the article

  • Tool to maintain a Data Mapping between two systems

    - by ktaylorjohn
    We have XML interfaces between multiple systems. An Enterprise Domain Model is missing in the overall architecture, hence the terms Product/Customer/User means different things to different systems. We currently use excel sheets to map the elements in incoming XML to what the actual Field means within our system. Additionally, it contains the values of Mandatory/Optional and length of each field. We call this the Data Dictionary. Any changes to the XML go through rounds of deliberation and updates to Word and Excel documents. Is there a better way to do this? Any tool/GUI based approach which all systems and owners can view?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >