Search Results

Search found 817 results on 33 pages for 'overriding'.

Page 25/33 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • Cocoa/Objective-C - Child window with text input without main window becoming inactive

    - by Josh
    Hello All, I have a need to spawn a window that will hover just above my main window in a cocoa application. I want this main window to allow the user to enter some text in an input box. All is well until the text input box actually gains focus. The main window becomes "deactivated." This window is borderless and is a slightly custom shape -- its more like a hover card than anything else, I suppose. Basically, I'd like this thing to work almost exactly like Spotlight (Apple + Space) -- you can enter text, but this is such an an ancillary operation that in the context of the greater UX, you don't want the jarring effect of the main window graying out (becoming inactive). You'll notice when you have some application open and in-focus, spotlight will not cause the window of that application to become inactive. This problem arises because text input seems to REQUIRE that the child window become the key window (it will not let you place the cursor in the text input field). When it becomes key, the main window becomes inactive. So far I've tried: Subclassing NSWindow for my main application and overriding isKeyWindow such that it only loses key when the application is no longer the users focus (as opposed to the window). This had the unintended effect of colliding with key status of the child window and having very strange effects on the keyboard input (some keys are not captured, like delete) Creating a view instead of a window. Doesn't work because of this problem -- you cannot draw over a Webkit WebView these days. Anybody Cocoa/OSX wizards have any ideas? I've become a little obsessed with this one. An itch I can't scratch.

    Read the article

  • How to pass binary data between two apps using Content Provider?

    - by Viktor
    I need to pass some binary data between two android apps using Content Provider (sharedUserId is not an option). I would prefer not to pass the data (a savegame stored as a file, small in size < 20k) as a file (ie. overriding openFile()) since this would necessitate some complicated temp-file scheme to cope with concurrency with several content provider accesses and a running game. I would like to read the file into memory under a mutex lock and then pass the binary array in the simplest way possible. How do I do this? It seems creating a file in memory is not a possibility due to the return type of openFile(). query() needs to return a Cursor. Using MatrixCursor is not possible since it applies toString() to all stored objects when reading it. What do I need to do? Implement a custom Cursor? This class has 30 abstract methods. Do I read the file, put it in a SQLite db and return the cursor? The complexity of this seemingly simple task is mindboggling.

    Read the article

  • Integrating Magento with SAP ECC 6.0 Backend

    - by ikarous
    I'm a freshly graduated (read: inexperienced) developer who's been tasked with determining the feasibility of integrating Magento with an SAP-based backend. No developer at our company has any experience working with either SAP or Magento, so I was hoping that the Stack Overflow community may be able to point me in the right direction with my research. We're a small company (four full-time developers) and the timeline on this project would be tight, so I'm trying to gather as much information as possible. The client has a tiered pricing structure, tax calculation logic, promotional deals, and automatic freight determination all implemented in an SAP ECC 6.0 system. They would like to migrate all their online stores over to Magento while continuing to utilize all existing functionality in SAP. The idea is to accomplish this by overriding certain modules in Magento to place remote calls to SAP BAPIs. I've investigated SAPRFC, which looks promising but relatively stale in terms of update frequency. Do any developers have experience using SAPRFC with SAP ECC 6.0 (with or without Magento integration)? If so, what were your experiences, and what were the biggest risk factors involved? Any comments, suggestions, or links to resources would be greatly appreciated.

    Read the article

  • Layering Cocoa WebView - Drawing on top?

    - by Josh
    http://stackoverflow.com/questions/1618498/webview-in-core-animation-layer The only other thread I can find is the above which doesn't necessarily fit my needs. Is there a reliable way to simply draw a view on top of a webview? I've tried to layer a regular NSView on top of WebView, and it draws right at first, but any movement in the webview (scrolling the page etc) appears to invalidate the view and produces visual artifacts. I've tried: [[[NSApp mainWindow] contentView] addSubview:view positioned:NSWindowAbove relativeTo:webView]; No luck there, same problems -- z-ordering doesn't seem to work unless I'm missing something. Is this just a limitation of webviews? I also tried implementing the view above as a window, which worked much better (just controlled the location of the window programmatically). However, the desired behavior is for the user to enter some text into this window, but for it not to steal "focus" -- ie the main window goes inactive (the x - + go gray) when the user clicks on the text field in the new window. Any way to avoid that? I've tried subclassing NSWindow and overriding canBecomeKey (return YES) and canBecomeMain (return NO) but the window still steals focus. Josh

    Read the article

  • ASP.NET RadioButton messing with the name (groupname)

    - by Hojou
    I got a templated control (a repeater) listing some text and other markup. Each item has a radiobutton associated with it, making it possible for the user to select ONE of the items created by the repeater. The repeater writes the radiobutton setting its id and name generated with the default asp.net naming convention making each radiobutton a full 'group'. This means all radiobuttons are independant on each other, which again unfortunately means i can select all radiobuttons at the same time. The radiobutton has the clever attribute 'groupname' used to set a common name so they get grouped together and thus should be dependant (so i can only select one at a time). The problem is - this doesn't work - the repeater makes sure the id and thus the name (which controls the grouping) are different. Since i use a repeater (could have been a listview or any other templated databound control) i can't use the RadioButtonList. So where does that leave me? I know i've had this problem before and solved it. I know almost every asp.net programmer must have had it too, so why can't i google and find a solid solution to the problem? I came across solutions to enforce the grouping by javascript (ugly!) or even to handle the radiobuttons as non-server controls, forcing me to do a Request.Form[name] to read the status. I also tried experimenting with overriding the name attribute on the PreRender event - unfortunately the owning page and masterpage again overrides this name to reflect the full id/name so i end up with the same wrong result. If you have no better solution than i posted, you are still very welcome to post your thoughts - atleast i'll know that my friend 'jack' is right about how messed up 'asp.net' is sometimes ;)

    Read the article

  • ActiveScaffold custom action_link that should respond like update

    - by doug316
    I have a custom action link which is :inline and :post. It's a quick-link to update an attribute, and that part works just fine. After the action, my intent is to respond just like it was an update, so the row is re-rendered in the index. After the record is updated in my controller action, I call respond_to_action(:create) Just like in the create method in active scaffold. It seems like the content of the javascript response is returned correctly to the client, however, the problem: The content-type of the response header is "text/html" instead of "text/javascript", unlike with an actual update. So the JS is not executed and the row doesn't update. I can't figure out what the difference could possibly be here, I've traced extensively and even have replaced the respond_to_action with: respond_to do |format| format.js do render ... end end And it still won't set the content-type like every other action in the app. Anybody have a clue here? Something in active scaffold must be overriding the content-type and I can't figure out what it might be. Surprising this isn't documented, this doesn't seem like an unusual use-case, making an action a slave to the update re-render.

    Read the article

  • Android - Dealing with a Dialog on Screen Orientation change

    - by Donal Rafferty
    I am overriding the onCreateDialog and onPrepareDialog methods or the Dialog class. I have followed the example from Reto Meier's Professional Android Application Development book, Chapter 5 to pull some XML data and then use a dialog to display the info. I have basically followed it exactly but changed the variables to suit my own XML schema as follows: @Override public Dialog onCreateDialog(int id) { switch(id) { case (SETTINGS_DIALOG) : LayoutInflater li = LayoutInflater.from(this); View settingsDetailsView = li.inflate(R.layout.details, null); AlertDialog.Builder settingsDialog = new AlertDialog.Builder(this); settingsDialog.setTitle("Provisioned Settings"); settingsDialog.setView(settingsDetailsView); return settingsDialog.create(); } return null; } @Override public void onPrepareDialog(int id, Dialog dialog) { switch(id) { case (SETTINGS_DIALOG) : String afpunText = " "; if(setting.getAddForPublicUserNames() == 1){ afpunText = "Yes"; } else{ afpunText = "No"; } String Text = "Login Settings: " + "\n" + "Password: " + setting.getPassword() + "\n" + "Server: " + setting.getServerAddress() + "\n"; AlertDialog settingsDialog = (AlertDialog)dialog; settingsDialog.setTitle(setting.getUserName()); tv = (TextView)settingsDialog.findViewById(R.id.detailsTextView); if (tv != null) tv.setText(Text); break; } } It works fine until I try changing the screen orientation, When I do this onPrepareDialog gets call but I get null pointer exceptions on all my variables. The error still occurs even when I tell my activity to ignore screen orientation in the manifest. So I presume something has been left out of the example in the book do I need to override another method to save my variables in or something?

    Read the article

  • How can I draw on JPanel using another quadrant for the coordinates?

    - by Sanoj
    I would like to draw some shapes on a JPanel by overriding paintComponent. I would like to be able to pan and zoom. Panning and zooming is easy to do with AffineTransform and the setTransform method on the Graphics2D object. After doing that I can easyli draw the shapes with g2.draw(myShape) The shapes are defined with the "world coordinates" so it works fine when panning and I have to translate them to the canvas/JPanel coordinates before drawing. Now I would like to change the quadrant of the coordinates. From the 4th quadrant that JPanel and computer often uses to the 1st quadrant that the users are most familiar with. The X is the same but the Y-axe should increase upwards instead of downwards. It is easy to redefine origo by new Point(origo.x, -origo.y); But How can I draw the shapes in this quadrant? I would like to keep the coordinates of the shapes (defined in the world coordinates) rather than have them in the canvas coordinates. So I need to transform them in some way, or transform the Graphics2D object, and I would like to do it efficiently. Can I do this with AffineTransform too?

    Read the article

  • Question about the Cloneable interface and the exception that should be thrown

    - by Nazgulled
    Hi, The Java documentation says: A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class. Invoking Object's clone method on an instance that does not implement the Cloneable interface results in the exception CloneNotSupportedException being thrown. By convention, classes that implement this interface should override Object.clone (which is protected) with a public method. See Object.clone() for details on overriding this method. Note that this interface does not contain the clone method. Therefore, it is not possible to clone an object merely by virtue of the fact that it implements this interface. Even if the clone method is invoked reflectively, there is no guarantee that it will succeed. And I have this UserProfile class: public class UserProfile implements Cloneable { private String name; private int ssn; private String address; public UserProfile(String name, int ssn, String address) { this.name = name; this.ssn = ssn; this.address = address; } public UserProfile(UserProfile user) { this.name = user.getName(); this.ssn = user.getSSN(); this.address = user.getAddress(); } // get methods here... @Override public UserProfile clone() { return new UserProfile(this); } } And for testing porpuses, I do this in main(): UserProfile up1 = new UserProfile("User", 123, "Street"); UserProfile up2 = up1.clone(); So far, no problems compiling/running. Now, per my understanding of the documentation, removing implements Cloneable from the UserProfile class should throw an exception in up1.clone() call, but it doesn't. I've read around here that the Cloneable interface is broken but I don't really know what that means. Am I missing something?

    Read the article

  • Winforms, databinding, Listbox and textbox

    - by Snake
    Hi dear friends, I have a ListBox (MyListBox) on my screen, and a Textbox (MyTextBox). The ListBox is filled with a List(Of T), which are all custom items. Now I try to do this: The ListBox' datasource is the List(Of T). Now when an Item changes I want the textbox to be updated to a particular property of the selected item in my ListBox. In code this means: Me.MyListBox.DisplayMember = "SelectionName" Me.MyListBox.ValueMember = "Id" MyTextbox.DataBindings.Add(New Binding("Text", Me._listOfItems, "SelectedItem.Comment", True, DataSourceUpdateMode.OnPropertyChanged)) Me.MyListBox.DataSource = Me._listOfItems this does not work. But when I bind to SelectedValue instead of SelectedItem it works perfectly. The _listOfItems is declared as this: Dim _listOfItems As List(Of MyItem) = New List(Of MyItem)() Where MyItem is this: public class MyItem { public string SelectionName { get; set; } public int Id { get; set; } public string Comment { get; set; } } I tried overriding the ToString() in MyItem so that it would use that. But that doesn't work either. Anybody care to give it a try? Thanks! -Snakiej

    Read the article

  • Perf4J Graph Output from Log File

    - by manyxcxi
    I currently have a long running process that I am trying to analyze with Perf4J. I currently have it writing results in CSV format to its own log file using the AsyncCoalescingStatisticsAppender and a StatisticsCsvLayout on the file appender. My question is; when I try and use the --graph option from the command line (using the perf4j jar) it isn't populating the data points- it isn't populating anything. Are my appenders set incorrectly? The log file contains hundreds (sometimes thousands) of data points of about 10 different tag names. <appender name="perfAppender" class="org.apache.log4j.FileAppender"> <param name="File" value="perfStats.log"/> <layout class="org.perf4j.log4j.StatisticsCsvLayout"> </layout> </appender> <appender name="CoalescingStatistics" class="org.perf4j.log4j.AsyncCoalescingStatisticsAppender"> <!-- The TimeSlice option is used to determine the time window for which all received StopWatch logs are aggregated to create a single GroupedTimingStatistics log. Here we set it to 10 seconds, overriding the default of 30000 ms --> <param name="TimeSlice" value="10000"/> <appender-ref ref="ConsoleAppender"/> <appender-ref ref="CompositeRollingFileAppender"/> <appender-ref ref="perfAppender"/> </appender>

    Read the article

  • Is it possible to have anonymous purchases with ubercart without the creation of a new user account?

    - by DKinzer
    I would like to be able to have anonymous users purchase a product but not have a new account created when they purchase it. Unfortunately the creation of a new user seems to be very tightly integrated into ubercart's ordering system. And, because the order module is part of the ubercart core, it's behavior cannot be overridden easily. One possibility for overriding is the creation of a new user account by supplying ubercart with an bogus anonymous account: hook into hook_form_alter at $form_id == 'uc_cart_checkout_review_form' because this is where ubercart first associates the $order to an uid. Add our submit function to the queue: //Find out if the user is anonymous: global $user; if ($user->uid == 0 ) { //Load a previously created anonymous user account $anonymous_user = mymodule_get_anonymous_user(); //create the order and assign our anonymous_user_id to it $order = uc_order_load($_SESSION['cart_order']); $order->uid = $anonymous_user->uid; uc_order_save($order); //Assign the global user our anonymous user uid $user->uid = $anonymous_user->uid; } But what I really need is to be able to have an anonymous purchase without being forced to create a new account, this solution does not work for me. Apart from which, using this technique will automatically login the anonymous_user into our bogus_anonymous_user account. Which is definitely something I don't want. Is there a better non-duct-tape way around the creation of a new user account for anonymous purchases in ubercart?. AND FYI - at this point I'm kind of stuck with ubercart so I cannot use something else. Thanks! D

    Read the article

  • How do I sort an internationalized i18n table with symfony and doctrine?

    - by Maurizio
    I would like to display a list of records from an internationalized table using sfDoctrinePager. Not all the records have been translated to all the languages supported by the application, so I had to implement a fallback mechanism for some fields (by overriding the getFoo() function in the Bar.class.php, as explained in another post here). I have different fallback list for each culture. Everything works fine until when it comes to sorting the records in alphabetical order. I'm sorting the records at the SQL (Dql) level, by adding an -orderBy('t.name') to the query: $q = Doctrine::getTable('Foo') ->createQuery('f') ->leftJoin('f.Translation t') ->orderBy('t.name') But here come the troubles: the list gets not sorted correctly, regardless of the active culture. I get rather better results when I limit the translations to the active culture, like this: ->leftJoin('f.Translation t WITH lang = ?', $request->getParameter('sf_culture'); Then the sorting is correct, as far as all the translations exist for the active culture. If a translation does not exist and I have to take the name from the fallback language, the record will be displayed at the very beginning of the list (I understand this happens because the value for the current culture is null). My question is: is there a best practice for getting internationalized fields (needing fallbacks) sorted correctly with doctrine and sfDoctrinePager? Thank you in advance.

    Read the article

  • tabBarController and navigationControllers in landscape mode, episode II

    - by unforgiven
    I have a UITabBarController, and each tab handles a different UIViewController that pushes on the stack new controllers as needed. In two of these tabs I need, when a specific controller is reached, the ability to rotate the iPhone and visualize a view in landscape mode. After struggling a lot I have found that it is mandatory subclassing UITabBarController to override shouldAutorotateToInterfaceOrientation. However, if i simply return YES in the implementation, the following undesirable side effect arises: every controller in every tab is automatically put in landscape mode when rotating the iPhone. Even overriding shouldAutorotateToInterfaceOrientation in each controller to return NO does not work: when the iPhone is rotated, the controller is put in landscape mode. I implemented shouldAutorotateToInterfaceOrientation as follows in the subclassed UITabBarController: (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if([self selectedIndex] == 0 || [self selectedIndex] == 3) return YES; return NO; } So that only the two tabs I am interested in actually get support for landscape mode. Is there a way to support landscape mode for a specific controller on the stack of a particular tab? I tried, without success, something like (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if([self selectedIndex] == 0 || [self selectedIndex] == 3) { if ([[self selectedViewController] isKindOfClass: [landscapeModeViewController class]]) return YES; } return NO; } Also, I tried using the delegate method didSelectViewController, without success. Any help is greatly appreciated. Thank you.

    Read the article

  • JS Object this.method() breaks via jQuery

    - by Peter Boughton
    I'm sure there's a simple answer to this, but it's Friday afternoon and I'm tired. :( Not sure how to explain it, so I'll just go ahead and post example code... Here is a simple object: var Bob = { Stuff : '' , init : function() { this.Stuff = arguments[0] } , doSomething : function() { console.log( this.Stuff ); } } And here it is being used: $j = jQuery.noConflict(); $j(document).ready( init ); function init() { Bob.init('hello'); Bob.doSomething(); $j('#MyButton').click( Bob.doSomething ); } Everything works, except for the last line. When jQuery calls the doSomething method it is overriding 'this' and stopping it from working. Trying to use just Stuff doesn't work either. So how do I refer to an object's own properties in a way that allows jQuery to call it, and also allows the object to work with the calling jQuery object? i.e. I would like to be able to do things like this: doSomething : function() { console.log( <CurrentObject>.Stuff + $j(<CallerElement>).attr('id') ); } (Where <CurrentObject> and <CallerElement> are replaced with appropriate names.)

    Read the article

  • segfault during __cxa_allocate_exception in SWIG wrapped library

    - by lefticus
    While developing a SWIG wrapped C++ library for Ruby, we came across an unexplained crash during exception handling inside the C++ code. I'm not sure of the specific circumstances to recreate the issue, but it happened first during a call to std::uncaught_exception, then after a some code changes, moved to __cxa_allocate_exception during exception construction. Neither GDB nor valgrind provided any insight into the cause of the crash. I've found several references to similar problems, including: http://wiki.fifengine.de/Segfault_in_cxa_allocate_exception http://forums.fifengine.de/index.php?topic=30.0 http://code.google.com/p/osgswig/issues/detail?id=17 https://bugs.launchpad.net/ubuntu/+source/libavg/+bug/241808 The overriding theme seems to be a combination of circumstances: A C application is linked to more than one C++ library More than one version of libstdc++ was used during compilation Generally the second version of C++ used comes from a binary-only implementation of libGL The problem does not occur when linking your library with a C++ application, only with a C application The "solution" is to explicitly link your library with libstdc++ and possibly also with libGL, forcing the order of linking. After trying many combinations with my code, the only solution that I found that works is the LD_PRELOAD="libGL.so libstdc++.so.6" ruby scriptname option. That is, none of the compile-time linking solutions made any difference. My understanding of the issue is that the C++ runtime is not being properly initialized. By forcing the order of linking you bootstrap the initialization process and it works. The problem occurs only with C applications calling C++ libraries because the C application is not itself linking to libstdc++ and is not initializing the C++ runtime. Because using SWIG (or boost::python) is a common way of calling a C++ library from a C application, that is why SWIG often comes up when researching the problem. Is anyone out there able to give more insight into this problem? Is there an actual solution or do only workarounds exist? Thanks.

    Read the article

  • Does Android XML Layout's 'include' Tag Really Work?

    - by Eric Burke
    I am unable to override attributes when using <include> in my Android layout files. When I searched for bugs, I found Declined Issue 2863: "include tag is broken (overriding layout params never works)" Since Romain indicates this works in the test suites and his examples, I must be doing something wrong. My project is organized like this: res/layout buttons.xml res/layout-land receipt.xml res/layout-port receipt.xml The buttons.xml contains something like this: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button .../> <Button .../> </LinearLayout> And the portrait and landscape receipt.xml files look something like: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> ... <!-- Overridden attributes never work. Nor do attributes like the red background, which is specified here. --> <include android:id="@+id/buttons_override" android:background="#ff0000" android:layout_width="fill_parent" layout="@layout/buttons"/> </LinearLayout> What am I missing?

    Read the article

  • What's the best practice to add default function to jQuery Dialog open/close events?

    - by BlueFox
    Hi All, I'm trying to define some default behaviours for my jQuery Dialogs like the following: (function($) { /** * Overriding default options **/ $.ui.dialog.defaults.bgiframe = true; $.ui.dialog.defaults.open = function() { if ($('.ui-widget-overlay').length == 0) return; if ($.browser.msie) { // scrollbar fix for IE $('html').css('overflow-y','hidden'); $('html').css('overflow-x','hidden'); } else { // disable scrollbar for other browsers $('body').css('overflow','hidden'); } }; $.ui.dialog.defaults.beforeclose = function(event, ui) { if ($('.ui-widget-overlay').length == 0) return; if ($.browser.msie) { // scrollbar fix for IE $('html').css('overflow-y','auto'); $('html').css('overflow-x','auto'); } else { // disable scrollbar for other browsers $('body').css('overflow','auto'); } }; })(jQuery); The above works when I have no custom open/beforeclose function specified when the dialog is created. So I'm wondering what is the best practice to add these functionality into all my dialogs, while preserving the ability to specify open/beforeclose functions.

    Read the article

  • WPF validation red border doesn't show If UserControl collapsed first

    - by Creepy Gnome
    There seems to be a bug with WPF in 3.5, and I was hoping someone may have found a workaround. Basically if you have a custom UserControl that contains a TextBox and it is in a Window but initialized to be Collapsed by default in the xaml or code behind if it fails validation when you make the control visible it will not show the red border until it fails while visible. However, this works correctly when visibility is set to Hidden, just no when Collapsed. I am already overriding the ErrorTemplate with a style to workaround the Adornment issue with the red border staying visibile when you collapse the control. Below is my full style for the TextBox. If there is any additional changes or additions to make it work correctly with collapsed controls that would be great. <Style TargetType="TextBox"> <Setter Property="Margin" Value="3" /> <Setter Property="Validation.ErrorTemplate"> <Setter.Value> <ControlTemplate> <ControlTemplate.Resources> <BooleanToVisibilityConverter x:Key="converter" /> </ControlTemplate.Resources> <DockPanel LastChildFill="True"> <Border BorderThickness="2" BorderBrush="Red" Visibility="{ Binding ElementName=placeholder, Mode=OneWay, Path=AdornedElement.IsVisible, Converter={StaticResource converter}}" > <AdornedElementPlaceholder x:Name="placeholder" /> </Border> </DockPanel> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="Validation.HasError" Value="true" > <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" /> </Trigger> </Style.Triggers> </Style>

    Read the article

  • Hotkeys in webapps

    - by Johoo
    When creating webapps, is there any guidelines on which keys you can use for your own hotkeys without overriding too many of the browsers default hotkeys. For example i might want to have a custom copy command for copying entire sets of data that only makes sense for my program instead of just text. The logical combination for this would be ctrl+c but that would destroy the default copy hotkey for normal text. One solution i was thinking about is to only catch the hotkey when it "makes sense" but when you use some advanced custom selection it might be hard to differentiate if your data is focused, if text is selected or both. Right now i am only using single keys as the hotkey, so just 'c' for the example above and this seems to be what most other sites are doing too. The problem is that if you have text input this doesn't work so good. Is this the best solution? To clarify I'm talking about advanced webapps that behave more like normal programs and not just some website presenting information(even though i think these guidlines would be valid for both cases). So for the copy example it might not be a big deal if you can't copy the text in the menu but when ctrl+tab, alt+d or ctrl+e doesn't work i would be really pissed, cough flash cough.

    Read the article

  • Java method keyword "final" and its use

    - by Lukas Eder
    When I create complex type hierarchies (several levels, several types per level), I like to use the final keyword on methods implementing some interface declaration. An example: interface Garble { int zork(); } interface Gnarf extends Garble { /** * This is the same as calling {@link #zblah(0)} */ int zblah(); int zblah(int defaultZblah); } And then abstract class AbstractGarble implements Garble { @Override public final int zork() { ... } } abstract class AbstractGnarf extends AbstractGarble implements Gnarf { // Here I absolutely want to fix the default behaviour of zblah // No Gnarf shouldn't be allowed to set 1 as the default, for instance @Override public final int zblah() { return zblah(0); } // This method is not implemented here, but in a subclass @Override public abstract int zblah(int defaultZblah); } I do this for several reasons: It helps me develop the type hierarchy. When I add a class to the hierarchy, it is very clear, what methods I have to implement, and what methods I may not override (in case I forgot the details about the hierarchy) I think overriding concrete stuff is bad according to design principles and patterns, such as the template method pattern. I don't want other developers or my users do it. So the final keyword works perfectly for me. My question is: Why is it used so rarely in the wild? Can you show me some examples / reasons where final (in a similar case to mine) would be very bad?

    Read the article

  • ListView Final Column Autosize creates scrollbar

    - by Courtney de Lautour
    Hi There, I am implementing a custom control which derives from ListView. I would like for the final column to fill the remaining space (Quite a common task), I have gone about this via overriding the OnResize method: protected override void OnResize(EventArgs e) { base.OnResize(e); if (Columns.Count == 0) return; Columns[Columns.Count - 1].Width = -2; // -2 = Fill remaining space } or via another method: protected override void OnResize(EventArgs e) { base.OnResize(e); if (!_autoFillLastColumn) return; if (Columns.Count == 0) return; int TotalWidth = 0; int i = 0; for (; i < Columns.Count - 1; i++) { TotalWidth += Columns[i].Width; } Columns[i].Width = this.DisplayRectangle.Width - TotalWidth; } Edit: This works fine until I dock the ListView into a parent container and resize via that control. Every second time the control size shrinks (IE, drag the the border one pixel), I get a scroll bar on the bottom which can't move at all (not even one pixel). The result of which is when I drag the size of the parent I am left with a flickering scroll bar in the ListView, and a 50% chance it will be there when the dragging stops.

    Read the article

  • jQuery JSON .each problem

    - by Aran
    I have a JSON object that looks like this. [ { "id" : "23", "event_id" : "0", "sport_title" : null, "event_title" : null, "title" : "Under 1 day!", "content" : "It\\'s all hotting up and battle commences in under one day!", "link" : "" }, { "id" : "20", "event_id" : "0", "sport_title" : null, "event_title" : null, "title" : "Getting Exciting", "content" : "Less than two days till it all kicks off, with cricket....", "link" : "" }] and I am trying to get the details out of this JSON Object and prepend them to a <ul> the code that I am currently trying looks like this and is having problems var writeup_list = writeuplist; $.getJSON('../json/getWriteups.json', function(data) { $.each(data.items, function(i, item) { writeup_list.html(function() { var output; output = '<li><a href="/writeups/index.php#writeup_' + item.id + '">'; if(item.sport_title != null) { output += item.sport_title + ' - '; } output += item.title + '</a></li>'; return output; }); }); }); writeuplist is just the ul object. I am also worried about overriding information that is already in the list or just adding again. Don't want to keep adding the same data. What is a good way to avoid this? I seem to be having a problem in getting the data out of the JSON file I believe it has something to do with the way am trying to access it in the .each function. Can anyone spot where am going wrong?

    Read the article

  • Fluent Nhibernate Mapping Single class on two database tables

    - by nabeelfarid
    Hi guys, I am having problems with Mapping. I have two tables in my database as follows: Employee and EmployeeManagers Employee EmployeeId int Name nvarchar EmployeeManagers EmployeeIdFk int ManagerIdFk int So the employee can have 0 or more Managers. A manager itself is also an Employee. I have the following class to represent the Employee and Managers public class Employee { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual IList<Employee> Managers { get; protected set; } public Employee() { Managers = new List<Employee>(); } } I don't have any class to represent Manager because I think there is no need for it, as Manager itself is an Employee. I am using autoMapping and I just can't figure out how to map this class to these two tables. I am implementing IAutoMappingOverride for overriding automappings for Employee but I am not sure what to do in it. public class NodeMap : IAutoMappingOverride { public void Override(AutoMapping<Node> mapping) { //mapping.HasMany(x => x.ValidParents).Cascade.All().Table("EmployeeManager"); //mapping.HasManyToMany(x => x.ValidParents).Cascade.All().Table("EmployeeManager"); } } I also want to make sure that an employee can not be assigned the same manager twice. This is something I can verify in my application but I would like to put constraint on the EmployeeManager table (e.g. a composite key) so a same manager can not be assigned to an employee more than once. Could anyone out there help me with this please? Awaiting Nabeel

    Read the article

  • Deleting objects with FK constraints in Spring/Hibernate

    - by maxdj
    This seems like such a simple scenario to me, yet I cannot for the life of my find a solution online or in print. I have several objects like so (trimmed down): @Entity public class Group extends BaseObject implements Identifiable<Long> { private Long id; private String name; private Set<HiringManager> managers = new HashSet<HiringManager>(); private List<JobOpening> jobs; @ManyToMany(fetch=FetchType.EAGER) @JoinTable( name="group_hiringManager", joinColumns=@JoinColumn(name="group_id"), inverseJoinColumns=@JoinColumn(name="hiringManager_id") ) public Set<HiringManager> getManagers() { return managers; } @OneToMany(mappedBy="group", fetch=FetchType.EAGER) public List<JobOpening> getJobs() { return jobs; } } @Entity public class JobOpening extends BaseObject implements Identifiable<Long> { private Long id; private String name; private Group group; @ManyToOne @JoinColumn(name="group_id", updatable=false, nullable=true) public Group getGroup() { return group; } } @Entity public class HiringManager extends User { @ManyToMany(mappedBy="managers", fetch=FetchType.EAGER) public Set<Group> getGroups() { return groups; } } Say I want to delete a Group object. Now there are dependencies on it in the JobOpening table and in the group_hiringManager table, which cause the delete function to fail. I don't want to cascade the delete, because the managers have other groups, and the jobopenings can be groupless. I have tried overriding the remove() function of my GroupManager to remove the dependencies, but it seems like no matter what I do they persist, and the delete fails! What is the right way to remove this object?

    Read the article

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