Search Results

Search found 1506 results on 61 pages for 'ben mezger'.

Page 39/61 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • Avoiding secondary selects or joins with Hibernate Criteria or HQL query

    - by Ben Benson
    I am having trouble optimizing Hibernate queries to avoid performing joins or secondary selects. When a Hibernate query is performed (criteria or hql), such as the following: return getSession().createQuery(("from GiftCard as card where card.recipientNotificationRequested=1").list(); ... and the where clause examines properties that do not require any joins with other tables... but Hibernate still performs a full join with other tables (or secondary selects depending on how I set the fetchMode). The object in question (GiftCard) has a couple ManyToOne associations that I would prefer to be lazily loaded in this case (but not necessarily all cases). I want a solution that I can control what is lazily loaded when I perform the query. Here's what the GiftCard Entity looks like: @Entity @Table(name = "giftCards") public class GiftCard implements Serializable { private static final long serialVersionUID = 1L; private String id_; private User buyer_; private boolean isRecipientNotificationRequested_; @Id public String getId() { return this.id_; } public void setId(String id) { this.id_ = id; } @ManyToOne @JoinColumn(name = "buyerUserId") @NotFound(action = NotFoundAction.IGNORE) public User getBuyer() { return this.buyer_; } public void setBuyer(User buyer) { this.buyer_ = buyer; } @Column(name="isRecipientNotificationRequested", nullable=false, columnDefinition="tinyint") public boolean isRecipientNotificationRequested() { return this.isRecipientNotificationRequested_; } public void setRecipientNotificationRequested(boolean isRecipientNotificationRequested) { this.isRecipientNotificationRequested_ = isRecipientNotificationRequested; } }

    Read the article

  • Watir not working in Windows 7

    - by Ben Mills
    I recently did a fresh install of Windows 7. I installed Ruby 1.8.6 and Watir via RubyGems. When I try to run a Watir script, IE opens and the first page is called, but the problem seems to be that the script doesn't wait for the page to finish loading (which it's always done in the past). Subsequent lines in the script try to access page elements that haven't loaded yet. Is anyone else having this problem?

    Read the article

  • A hooked DirectX 9 program crashes on window resize, texture related.

    - by Ben
    I'm using EasyHook and SlimDX to overlay some graphics using SlimDX's Sprite and Texture classes. When I resize windows some programs fine, but others will crash - Winamp's MilkDrop 2 gives me an ambiguous memory error for example. I expect this is due to the after market Texture I created. The question is what VTable function should I hook and/or how/when do I dispose and recreate the Texture? Reset perhaps? If it isn't obvious I don't know much about DirectX.

    Read the article

  • C# webservice async callback not getting called on HTTP 407 error.

    - by Ben
    Hi, I am trying to test the use-case of a customer having a proxy with login credentials, trying to use our webservice from our client. If the request is synchronous, my job is easy. Catch the WebException, check for the 407 code, and prompt the user for the login credentials. However, for async requests, I seem to be running into a problem: the callback is never getting called! I ran a wireshark trace and did indeed see that the HTTP 407 error was being passed back, so I am bewildered as to what to do. Here is the code that sets up the callback and starts the request: TravelService.TravelServiceImplService svc = new TravelService.TravelServiceImplService(); svc.Url = svcUrl; svc.CreateEventCompleted += CbkCreateEventCompleted; svc.CreateEventAsync(crReq, req); And the code that was generated when I consumed the WSDL: public void CreateEventAsync(TravelServiceCreateEventRequest CreateEventRequest, object userState) { if ((this.CreateEventOperationCompleted == null)) { this.CreateEventOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateEventOperationCompleted); } this.InvokeAsync("CreateEvent", new object[] { CreateEventRequest}, this.CreateEventOperationCompleted, userState); } private void OnCreateEventOperationCompleted(object arg) { if ((this.CreateEventCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.CreateEventCompleted(this, new CreateEventCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } Debugging the WS code, I found that even the SoapHttpClientProtocol.InvokeAsync method was not calling its callback as well. Am I missing some sort of configuration?

    Read the article

  • Common one-to-many table for multiple entities

    - by Ben V
    Suppose I have two tables, Customer and Vendor. I want to have a common address table for customer and vendor addresses. Customers and Vendors can both have one to many addresses. Option 1 Add columns for the AddressID to the Customer and Vendor tables. This just doesn't seem like a clean solution to me. Customer Vendor Address -------- --------- --------- CustomerID VendorID AddressID AddressID1 AddressID1 Street AddressID2 AddressID2 City... Option 2 Move the foreign key to the Address table. For a Customer, Address.CustomerID will be populated. For a Vendor, Address.VendorID will be populated. I don't like this either - I shouldn't need to modify the address table every time I want to use it for another entity. Customer Vendor Address -------- --------- --------- CustomerID VendorID AddressID CustomerID VendorID Option 3 I've also seen this - only 1 foreign key column on the Address table with another column to identify which foreign key table the address belongs to. I don't like this one because it requires all the foreign key tables to have the same type of ID. It also seems messy once you start coding against it. Customer Vendor Address -------- --------- --------- CustomerID VendorID AddressID FKTable FKID So, am I just too picky, or is there something I haven't thought of?

    Read the article

  • License similar to the MIT license but without the ability to sell?

    - by Ben
    I'm trying to decide how I want to license my Wordpress themes to the public. I know that the GPL is recommended to Wordpress theme creators, however I feel it might not be liberal enough for me because I want businesses to be able to use them if they want to. I really like the MIT license, the only thing that gets me is the freedom to sell part. I don't want someone taking my themes and selling them on some theme farm site, they should be free for everyone, however I don't want to require them to republish any changes under the MIT as well, I think that that freedom should remain intact. Is there a license that sort of fits into the terms I specified here? I'm not a lawyer so I have trouble reading through the complicated language of licenses. If there is not a similar license to the MIT but with the terms I have specified, should I just license under a modified MIT? If so, can anyone help me write it? Thanks very much!

    Read the article

  • Emulate disk IO speeds in Android SDK

    - by Ben L.
    I don't have a physical Android device to work with, so all I can use is the emulator. I'm wondering if there's something I could use to make the IO speeds more realistic - How do I slow down disk access to the speed it would be on a physical device? Also, this may be unrelated, but when I change the speed and latency options in Eclipse ADT DDMS view, I don't notice any change in internet speed on the emulator. Is this a bug?

    Read the article

  • NHibernate - is property lazy loading possible?

    - by Ben
    I've got some binary data that I store and was going to separate this out into a separate table so it could be lazy loaded. However, i then came across this post by Ayende (http://ayende.com/Blog/archive/2010/01/27/nhibernate-new-feature-lazy-properties.aspx) which suggests that property lazy loading is now possible. I have added the lazy="true" attribute to my property mapping but the field is still loaded from the database (I am using a simple text field to test). My query: return _session.CreateQuery("from Product") .SetMaxResults(1) .UniqueResult<Product>(); Mapping: <property name="Description" type="string" column="FullDescription" lazy="true"/> Has anyone been able to get this working? Personally I prefer this approach than having to add another table to my database.

    Read the article

  • Why do I not see stricter scoping more often?

    - by Ben
    I've found myself limiting scope fairly often. I find it makes code much clearer, and allows me to reuse variables much more easily. This is especially handy in C where variables must be declared at the start of a new scope. Here is an example of what I mean. { int h = 0; foreach (var item in photos) { buffer = t.NewRow(); h = item.IndexOf("\\x\\"); buffer["name"] = item.Substring(h, item.Length - h); t.Rows.Add(buffer); } } With this example, I've limited the scope of h, without initializing it in every iteration. But I don't see many other developers doing this very often. Why is that? Is there a downside to doing this?

    Read the article

  • What is the "Dispatcher" design pattern?

    - by Ben Farmer
    What is the "dispatcher" pattern and how would I implement it in code? I have a property bag of generic objects and would like to have the retrieval delegated to a generic method. Currently, I have properties looking for a specific key in the bag. For example: private Dictionary<String, Object> Foo { get; set; } private const String WidgetKey = "WIDGETKEY"; public Widget? WidgetItem { get { return Foo.ContainsKey(WidgetKey) ? Foo[WidgetKey] as Widget: null; } set { if (Foo.ContainsKey(WidgetKey)) Foo[WidgetKey] = value; else Foo.Add(WidgetKey, value); } } It was suggested that this could be more generic with the "dispatcher" pattern, but I've been unable to find a good description or example. I'm looking for a more generic way to handle the property bag store/retrieve.

    Read the article

  • Scala and the Java Memory Model

    - by Ben Lings
    The Java Memory Model (since 1.5) treats final fields differently to non-final fields. In particular, provided the this reference doesn't escape during construction, writes to final fields in the constructor are guaranteed to be visible on other threads even if the object is made available to the other thread via a data race. (Writes to non-final fields aren't guaranteed to be visible, so if you improperly publish them, another thread could see them in a partially constructed state.) Is there any documentation on how/if the Scala compiler creates final (rather than non-final) backing fields for classes? I've looked through the language specification and searched the web but can't find any definitive answers. (In comparison the @scala.volatile annotation is documented to mark a field as volatile)

    Read the article

  • LINQ Query using UDF that receives parameters from the query

    - by Ben Fidge
    I need help using a UDF in a LINQ which calculates a users position from a fixed point. int pointX = 567, int pointY = 534; // random points on a square grid var q = from n in _context.Users join m in _context.GetUserDistance(n.posY, n.posY, pointX, pointY, n.UserId) on n.UserId equals m.UserId select new User() { PosX = n.PosX, PosY = n.PosY, Distance = m.Distance, Name = n.Name, UserId = n.UserId }; The GetUserDistance is just a UDF that returns a single row in a TVP with that users distance from the points deisgnated in pointX and pointY variables, and the designer generates the following for it: [global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.GetUserDistance", IsComposable=true)] public IQueryable<GetUserDistanceResult> GetUserDistance([global::System.Data.Linq.Mapping.ParameterAttribute(Name="X1", DbType="Int")] System.Nullable<int> x1, [global::System.Data.Linq.Mapping.ParameterAttribute(Name="X2", DbType="Int")] System.Nullable<int> x2, [global::System.Data.Linq.Mapping.ParameterAttribute(Name="Y1", DbType="Int")] System.Nullable<int> y1, [global::System.Data.Linq.Mapping.ParameterAttribute(Name="Y2", DbType="Int")] System.Nullable<int> y2, [global::System.Data.Linq.Mapping.ParameterAttribute(Name="UserId", DbType="Int")] System.Nullable<int> userId) { return this.CreateMethodCallQuery<GetUserDistanceResult>(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), x1, x2, y1, y2, userId); } when i try to compile i get The name 'n' does not exist in the current context

    Read the article

  • Programmatically execute vim commands?

    - by Ben Gartner
    I'm interested in setting up a TDD environment for developing Vim scripts and rc files. As a simple example, say I want to have vim insert 8 spaces when I press the tab key. I would set up a script that did the following: Launch vim using a sandboxed .vimrc file press i press tab press esc press :w test_out assert that test_out contains ' ' by the default config in vim, this would fail. However, once I add set expandtab to my .vimrc file, the test will pass. So the question is, how do I programmatically issue these commands? 'vim -c ' is close, but seems to only work for ex mode commands. Any suggestions? This question seem to be thoroughly google-proof.

    Read the article

  • Android - How to set the wallpaper image?

    - by asdf.BEN
    What i'm trying to do is, set the wallpaper using an image URI (no cropping) I'm a noob at dev on Android and dev in general. The internet has failed me... on providing code to set the wallpaper. yes the dev resource site says public void setStream (InputStream data) but i don't understand it, some sample code would greatly help me.

    Read the article

  • NOT A DUPLICATE! VS2010 - How to automatically stop compile on first compile error

    - by Ben Robbins
    {rant}First I'd like to say that this IS NOT A DUPLICATE. I've asked this question previously but it got closed as a duplicate when it isn't. This question is SPECIFIC to VS 2010 and the answers to the so-called duplicate work in VS 2008 but not in VS 2010 (at least not for me or anyone I know). So before you go closing something as a duplicate how about you read the question carefully and try the answer for yourself and see if it actually works. Apologies for the rant but there is no obvious way to contact the SO police that closed the issue or get it reopened. {/rant} At work we have a C# solution with over 80 projects. In VS 2008 we use a macro to stop the compile as soon as a project in the solution fails to build (see this question for several options for VS 2005 & VS 2008: http://stackoverflow.com/questions/134796/how-to-automatically-stop-visual-c-build-at-first-compile-error). Is it possible to do the same in VS 2010? What we have found is that in VS 2010 the macros don't work (at least I couldn't get them to work) as it appears that the environment events don't fire in VS 2010. The default behaviour is to continue as far as possible and display a list of errors in the error window. I'm happy for it to stop either as soon as an error is encountered (file-level) or as soon as a project fails to build (project-level). Answers for VS 2010 only please. If the macros do work then a detailed explanation of how to configure them for VS 2010 would be appreciated. Thanks.

    Read the article

  • XSLT: How do I trigger a template when there is no input file?

    - by Ben Blank
    I'm creating a template which produces output based on a single string, passed via parameter, and does not use an input XML document. xsltproc seems to happily run with a single parameter specifying the stylesheet, but I don't see a way to trigger a template without an input file (no parameter to xsltproc to run a named template, for example). I'd like to be able to run: xsltproc --stringparam bar baz foo.xsl But I'm currently having to run, with the "main" template matching "/": echo '<xml/>' | xsltproc --stringparam bar baz foo.xsl - How can I get this to work? I'm sure I've seen other templates in the past which were meant to be run without an input document, but I don't remember how they worked or where to find them again. :-)

    Read the article

  • Codeigniter Form validation problem

    - by ben robinson
    Please please please can someone help me $this-load-library('form_validation'); $this-load-helper('cookie'); $data = array(); if($_POST) { // Set validation rules including additional validation for uniqueness $this-form_validation-set_rules('yourname', 'Your Name', 'trim|required'); $this-form_validation-set_rules('youremail', 'Your Email', 'trim|required|valid_email'); $this-form_validation-set_rules('friendname', 'Friends Name', 'trim|required'); $this-form_validation-set_rules('friendemail', 'Friends Email', 'trim|required|valid_email'); // Run the validation and take action if($this-form_validation-run()) { echo 'valid; } } else{ echo 'problem'; } Form validation is coming back with no errors can cany one see why?

    Read the article

  • Finding the most common values from given data

    - by Ben Shelock
    I have some data that looks something like this... +----------+----------+----------+ | Column 1 | Column 2 | Column 3 | +----------+----------+----------+ | Red | Blue | Green | | Yellow | Blue | Pink | | Black | Grey | Blue | +--------------------------------+ I need to go through this data and find the 3 most common colours. The raw data is in CSV and there's likely to be thousands more rows. (link) What's the best way of doing this?

    Read the article

  • SharePoint 2010 Search not working.

    - by Ben
    I have installed and configured SharePoint 2010 to run on the same box as the SQL Server its running from in Windows Server 2008 R2. Everything is working fine except the search. I have uploaded several documents and tagged several items (documents, tasks, announcements etc), however whenever I search the site using the defaul search, i get nothing returned no matter what i search on, I simply get "We did not find any results for [search term]". I know there is setup needed if you wish to use "FAST search", but do I have to do anything to get the standard default search to work?

    Read the article

  • Strange behaviour when posting CGEvent to PSN

    - by Ben Packard
    If I set up a loop that posts some keyboard events to a PSN, I find that it works fine except for when first launched. The event only seems to post when i do something with the mouse manually - even just moving it slightly. Here's the details, if they help. An external application has a list box of text lines, which I am reading by posting copy commands (and checking the pasteboard). Unfortunately this is my only way to get this text. Sometimes, the application pulls focus away from the list, which I can detect. When this happens, the most reliable way to return focus is by sending a mouse event to click on a text field directly above the list, then send a 'tab' keyboard event to shift the focus onto the list. So at launch, the loop runs fine, scrolling down the list and copying the text. When focus is shifted away, its is detected fine, and the events are sent to move focus back to the list. But nothing seems to happen. The loop continues detecting that focus has changed, but the events only work once I move the mouse. Or even just use the scroll wheel. Strange. Once this has happened the first time, it works fine - each time focus moves, the PSN events switch it back without me having to do anything at all. Here's the code that runs in the loop - verified as working: //copy to pasteboard - CMD-V e3 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)8, true); CGEventSetFlags(e3, kCGEventFlagMaskCommand); CGEventPostToPSN(&psn, e3); CFRelease(e3); e4 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)8, false); CGEventPostToPSN(&psn, e4); CFRelease(e4); //move cursor down e1 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)125, true); CGEventPostToPSN(&psn, e1); CFRelease(e1); e2 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)125, false); CGEventPostToPSN(&psn, e2); CFRelease(e2); And here's where I switch focus, also working (except when first required): //click in text input box - point is derived earlier e6 = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, point, 0); CGEventPostToPSN(&psn, e6); CFRelease(e6); e7 = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseUp, point, 0); CGEventPostToPSN(&psn, e7); CFRelease(e7); //press tab key to move to chat log table CGEventRef e = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)48, true); //CGEventPost(kCGSessionEventTap, e); CGEventPostToPSN(&psn, e); CFRelease(e); CGEventRef e11 = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)48, false); CGEventPostToPSN(&psn, e11); CFRelease(e11);

    Read the article

  • Ordering recursive result set in SQL Server

    - by Ben
    I am having extreme difficulty constructing a query which returns an XML style hierarchy. We have a database table which contains a hierarchy of URLs for our website. The table contains the columns: ID, URL, DisplayName, ParentID, ItemOrder The parent ID forms a recursive relationship between the current item and it's parent. The item should site below it's parent in the hierarchy and it should also be ordered using the item order against items at the same level in the hierarchy. I have managed to get a recursive query working so it drills down the hierarchy sequentially but I cannot order this by the item order as well. My current query is below: WITH Parents AS ( SELECT MenuItemId, URL, ParentItemId, ItemOrder FROM CambsMenu UNION ALL SELECT si.MenuItemId, si.URL, si.ParentItemId, si.ItemOrder FROM CambsMenu si INNER JOIN Parents p ON si.ParentItemId = p.MenuItemId ) SELECT DISTINCT * FROM Parents

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >