Search Results

Search found 200 results on 8 pages for 'johannes nielsen'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • after return PartialView() Url.Actionlink("Action", "Controller"), the Controller is lost

    - by Johannes
    Well the Question is related to a problem I posted before (http://stackoverflow.com/questions/2403899/asp-net-mvc-partial-view-does-not-call-my-action). In practice I've a partial view which contains a Form, after submitting the Form the Controller returns the Partial View. Well the Problem is if I reload the page which contains the partial view the function <%= Url.Action("ChangePassword", "Account") %> returns "Account/ChangePassword", if I submit the form and the partial is returned by the controller. Using return PartialView() the function <%= Url.Action("ChangePassword", "Account") %> returns only "ChangePassword". Any Idea because? The View looks like: <form action="<%= Url.Action("ChangePassword", "Account") %>" method="post" id="jform"> <div> <fieldset> <legend>Account Information</legend> <p> <label for="currentPassword">Current password:</label> <%= Html.Password("currentPassword") %> <%= Html.ValidationMessage("currentPassword") %> </p> <p> <label for="newPassword">New password:</label> <%= Html.Password("newPassword") %> <%= Html.ValidationMessage("newPassword") %> </p> <p> <label for="confirmPassword">Confirm new password:</label> <%= Html.Password("confirmPassword") %> <%= Html.ValidationMessage("confirmPassword") %> </p> <p> <input type="submit" value="Change Password" /> </p> </fieldset> </div> </form> </div> <script> $(function() { $('#jform').submit(function() { $('#jform').ajaxSubmit({ target: '#FmChangePassword' }); return false; }); }); </script> Part of the Controller: if (!ValidateChangePassword(currentPassword, newPassword, confirmPassword)) { return PartialView(ViewData); }

    Read the article

  • Objective-C Xcode: Prefix.pch question?

    - by Johannes Jensen
    I have two files independant on each other. Let's just call it Class1 and Class2. In Class1, I need Class2, and in Class2 I need Class1. I have a prefix file where I include all my files, and I get some syntax errors because I do #import "Class1.h" #import "Class2.h" How would I define both of them so they can use each other? What am I doing wrong?

    Read the article

  • Rotate a Swing JLabel

    - by Johannes Rössel
    I am currently trying to implement a Swing component, inheriting from JLabel which should simply represent a label that can be oriented vertically. Beginning with this: public class RotatedLabel extends JLabel { public enum Direction { HORIZONTAL, VERTICAL_UP, VERTICAL_DOWN } private Direction direction; I thought it's be a nice idea to just alter the results from getPreferredSize(): @Override public Dimension getPreferredSize() { // swap size for vertical alignments switch (getDirection()) { case VERTICAL_UP: case VERTICAL_DOWN: return new Dimension(super.getPreferredSize().height, super .getPreferredSize().width); default: return super.getPreferredSize(); } } and then simply transform the Graphics object before I offload painting to the original JLabel: @Override protected void paintComponent(Graphics g) { Graphics2D gr = (Graphics2D) g.create(); switch (getDirection()) { case VERTICAL_UP: gr.translate0, getPreferredSize().getHeight()); gr.transform(AffineTransform.getQuadrantRotateInstance(-1)); break; case VERTICAL_DOWN: // TODO break; default: } super.paintComponent(gr); } } It seems to work—somehow—in that the text is now displayed vertically. However, placement and size are off: Actually, the width of the background (orange in this case) is identical with the height of the surrounding JFrame which is ... not quite what I had in mind. Any ideas how to solve that in a proper way? Is delegating rendering to superclasses even encouraged?

    Read the article

  • ORM Persistence by Reachability violates Aggregate Root Boundaries?

    - by Johannes Rudolph
    Most common ORMs implement persistence by reachability, either as the default object graph change tracking mechanism or an optional. Persistence by reachability means the ORM will check the aggregate roots object graph and determines wether any objects are (also indirectly) reachable that are not stored inside it's identity map (Linq2Sql) or don't have their identity column set (NHibernate). In NHibernate this corresponds to cascade="save-update", for Linq2Sql it is the only supported mechanism. They do both, however only implement it for the "add" side of things, objects removed from the aggregate roots graph must be marked for deletion explicitly. In a DDD context one would use a Repository per Aggregate Root. Objects inside an Aggregate Root may only hold references to other Aggregate Roots. Due to persistence by reachability it is possible this other root will be inserted in the database event though it's corresponding repository wasn't invoked at all! Consider the following two Aggregate Roots: Contract and Order. Request is part of the Contract Aggregate. The object graph looks like Contract->Request->Order. Each time a Contractor makes a request, a corresponding order is created. As this involves two different Aggregate Roots, this operation is encapsulated by a Service. //Unit Of Work begins Request r = ...; Contract c = ContractRepository.FindSingleByKey(1); Order o = OrderForRequest(r); // creates a new order aggregate r.Order = o; // associates the aggregates c.Request.Add(r); ContractRepository.SaveOrUpdate(c); // OrderAggregate is reachable and will be inserted Since this Operation happens in a Service, I could still invoke the OrderRepository manually, however I wouldn't be forced to!. Persistence by reachability is a very useful feature inside Aggregate Roots, however I see no way to enforce my Aggregate Boundaries.

    Read the article

  • Objective-C RGB to HSB

    - by Johannes Jensen
    Let's say I've got the colour FF0000, which is red. Finding a darker colour is easy, I just type maybe CC instead of the FF, but let's say I've got the colour AE83FC, which is a complicated colour, how the heck would I find a lighter or darker version of it automatically? I figured the easy way to do this is to convert my RGB to HSB [Hue, Saturation, Brightness] How would I do that in Objective-C? Let's say I've got a RGB which is: 1.0, 0.0, 0.0. That's red. CGFloat r = 1.0; CGFloat g = 0.0; CGfloat b = 0.0; How would I convert that to HSB and then transform the colors and make it go back to RGB to I can use CGContextRGBSetFillColor? Are there any HSB functions? Please help. :)

    Read the article

  • How to round CGFloat

    - by Johannes Jensen
    I made this method + (CGFloat) round: (CGFloat)f { int a = f; CGFloat b = a; return b; } It works as expected but it only rounds down. And if it's a negative number it still rounds down. This was just a quick method I made, it isn't very important that it rounds correctly, I just made it to round the camera's x and y values for my game. Is this method okay? Is it fast? Or is there a better solution?

    Read the article

  • Regular expressions in findstr

    - by Johannes Rössel
    I'm doing a little string validation with findstr and its /r flag to allow for regular expressions. In particular I'd like to validate integers. The regex ^[0-9][0-9]*$ worked fine for non-negative numbers but since I now support negative numbers as well I tried ^([1-9][0-9]*|0|-[1-9][0-9]*)$ for either positive or negative integers or zero. The regex works fine theoretically. I tested it in PowerShell and it matches what I want. However, with findstr /r /c:"^([1-9][0-9]*|0|-[1-9][0-9]*)$" it doesn't. While I know that findstr doesn't have the most advanced regex support (even below Notepad++ which is probably quite an achievement), I would have expected such simple expressions to work. Any ideas what I'm doing wrong here?

    Read the article

  • ASP.NET MVC partial view does not call my Action

    - by Johannes
    I just started building a small simple Website on ASP.NET MVC, in a page I am using a Partial view, the Partial View represents a simple Form which should be submitted on button click, and If I click the first Time it is submitted with success and does return my partial view with my validation Messages (if the content is invalid) but if I wish to try again the Action isn't called again. Any Idea? View: <form action="<%= Url.Action("ChangePassword", "Account") %>" method="post" id="jform"> <div> <fieldset> <legend>Account Information</legend> <p> <label for="currentPassword">Current password:</label> <%= Html.Password("currentPassword") %> <%= Html.ValidationMessage("currentPassword") %> </p> <p> <label for="newPassword">New password:</label> <%= Html.Password("newPassword") %> <%= Html.ValidationMessage("newPassword") %> </p> <p> <label for="confirmPassword">Confirm new password:</label> <%= Html.Password("confirmPassword") %> <%= Html.ValidationMessage("confirmPassword") %> </p> <p> <input type="submit" value="Change Password" /> </p> </fieldset> </div> </form> <!--<% } %>--> </div> <script> $(function() { $('#jform').submit(function() { $('#jform').ajaxSubmit({ target: '#FmChangePassword' }); return false; }); }); /*$(document).ready(function() { $('#jform').live('submit', function() { $.post($(this).attr('action'), $(this).serialize(), function(data) { $("#jform").replaceWith($(data)); }); return false; }); });*/ </script> Part of the Controller: if (!ValidateChangePassword(currentPassword, newPassword, confirmPassword)) { return PartialView(ViewData); }

    Read the article

  • Blackberry how to display message in app if device got no internet connection?

    - by Johannes
    Hello I've just started with programming for the Blackberry device. I'm using version 5 of the API. I'm building a very simple application which is just a browserfield. So far it's all working great. I can display my browserfield with the content I need. The problem I'm having now is if the device doesn't have an active internet connection I get the ugly "Error requesting content for" message. I would need to someone display my own message if the device doesn't have an active connection. Something like "You need to have an active internet connection to use this application" with an Exit button which closes the app. I've tried to find this for hours but no luck. Hopefully it's something relatively easy so I can get help here. Here's my code so far: package com.mycompany.webview; import net.rim.device.api.browser.field2.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*; public class webview extends UiApplication { public static void main(String[] args) { webview app = new webview(); app.enterEventDispatcher(); } public webview() { pushScreen(new webviewScreen()); } } class webviewScreen extends MainScreen { public webviewScreen() { BrowserField myBrowserField = new BrowserField(); add(myBrowserField); myBrowserField.requestContent("http://www.google.com"); } } Would really appreciate some help please. Thanks

    Read the article

  • dlopen / dlsym with as little linking as possible

    - by johannes
    I have an application which can make use of plugins which are loaded at runtime using dlopen. Each of the plugins defines a function toretrieve the plugin information which is defined using a common structure. Something like that: struct plugin { char *name; char *app_version; int app_verion_id; char *plugin_version; int plugin_version_id; /* ... */ }; struct plugin p = { "sample plugin",APP_VERION,APP_VERSION_ID,"1.2.3",10203 }; struct plugin *get_plugin() { return &p; } This works well and plugins can be loaded. Now i want to build a small tool to read these properties without linking the whole application. For doing that I have some code like this: void *handle; struct plugin *plugin; struct plugin *(get_plugin*)(); handle = dlopen(filename, RTLD_LAZY); if (!handle) { /*...return; ...*/ } get_plugin = dlym(handle, "get_plugin"); if (!get_plugin) { /*...return; ...*/ } plugin = get_plugin(); printf("Plugin: %s\n", plugin->name); This works nice for simple plugins. The issue is that many plugins reference further symbols from the application, which are resolved even though RTLD_LAZY was set. (like global variables from the application which are used to initialize plugin-global things) So the dlopen() call fails with an error like fatal: relocation error: file sample_plugin.so: symbol application_some_symbol: referenced symbol not found. As I just want to have access to the single simple structure I was wondering how I can prevent the linker from doing that much of his work.

    Read the article

  • iPhone Landscape FAQ and Solutions

    - by Johannes Rudolph
    There has been a lot of confusion and a set of corresponding set of questions here on SO how iPhone applications with proper handling for Landscape/Portrait mode autorotation can be implemented. It is especially difficult to implement such an application when starting in landscape mode is desired. The most common observed effect are scrambled layouts and areas of the screen where touches are no longer recognized. A simple search for questions tagged iphone and landscape reveals these issues, which occur under certain scenarios: Landscape only iPhone app with multiple nibs: App started in Landscape mode, view from first nib is rendered fine, everything view loaded from a different nib is not displayed correctly. Iphone Landscape mode switching to Portraite mode on loading new controller: Self explanatory iPhone: In landscape-only, after first addSubview, UITableViewController doesn’t rotate properly: Same issue as above. iPhone Landscape-Only Utility-Template Application: Layout errors, controller does not seem to recognize the view should be rotated but displays a clipped portrait view in landscape mode, causing half of the screen to stay blank. presentModalViewController in landscape after portrait viewController: Modal views are not correctly rendered either. A set of different solutions have been presented, some of them including completely custom animation via CoreGraphics, while others build on the observation that the first view controller loaded from the main nib is always displayed correct. I have spent a significant amount of time investigating this issue and finally found a solution that is not only a partial solution but should work under all these circumstances. It is my intend with this CW post to provide sort of a FAQ for others having issues with UIViewControllers in Landscape mode. Please provide feedback and help improve the quality of this Post by incorporating any related observations. Feel free to edit and post other/better answers if you know of any.

    Read the article

  • Haskell Linear Algebra Matrix Library for Arbitrary Element Types

    - by Johannes Weiß
    I'm looking for a Haskell linear algebra library that has the following features: Matrix multiplication Matrix addition Matrix transposition Rank calculation Matrix inversion is a plus and has the following properties: arbitrary element (scalar) types (in particular element types that are not Storable instances). My elements are an instance of Num, additionally the multiplicative inverse can be calculated. The elements mathematically form a finite field (??2256). That should be enough to implement the features mentioned above. arbitrary matrix sizes (I'll probably need something like 100x100, but the matrix sizes will depend on the user's input so it should not be limited by anything else but the memory or the computational power available) as fast as possible, but I'm aware that a library for arbitrary elements will probably not perform like a C/Fortran library that does the work (interfaced via FFI) because of the indirection of arbitrary (non Int, Double or similar) types. At least one pointer gets dereferenced when an element is touched (written in Haskell, this is not a real requirement for me, but since my elements are no Storable instances the library has to be written in Haskell) I already tried very hard and evaluated everything that looked promising (most of the libraries on Hackage directly state that they wont work for me). In particular I wrote test code using: hmatrix, assumes Storable elements Vec, but the documentation states: Low Dimension : Although the dimensionality is limited only by what GHC will handle, the library is meant for 2,3 and 4 dimensions. For general linear algebra, check out the excellent hmatrix library and blas bindings I looked into the code and the documentation of many more libraries but nothing seems to suit my needs :-(. Update Since there seems to be nothing, I started a project on GitHub which aims to develop such a library. The current state is very minimalistic, not optimized for speed at all and only the most basic functions have tests and therefore should work. But should you be interested in using or helping out developing it: Contact me (you'll find my mail address on my web site) or send pull requests.

    Read the article

  • How does NHibernate handle cascade="all-delete-orphan"?

    - by Johannes Rudolph
    I've been digging around the NHibernate sources a little, trying to understand how NHibernate implements removing child elements from a collection. I think I've already found the answer, but I'd ideally like this to be confirmed by someone familiar with the matter. So far I've found AbstractPersistentCollection (base class for all collection proxies) has a static helper method called GetOrphans to find orphans by comparing the current collection with a snapshot. The existence of this method suggests NHibernate tries to find all oprhaned elements and then deletes them by key. Is this correct, in terms of the generated SQL?

    Read the article

  • Automatically check bounced emails via POP3 ?

    - by Johannes
    Hi all, Can anyone recommend software or even a .net library to develop software, that will check for bounced emails and the reason for the bounce? I get bounced emails into a pop3 account that I can read then... I need it to keep my user database clean from invalid email addresses and want to automate this (mark user as invalid email). Thanks

    Read the article

  • AutoFac Autowiring Conventions

    - by Johannes
    StructureMap has the ability to apply conventions when scanning. Thus IFoo = Foo, without explicit registration. Is something simular available in AutoFac? Looked around and just can't find anything helpfull. Thanks,

    Read the article

  • Rotate image in Quartz? Image is upside down! (iPhone)

    - by Johannes Jensen
    I don't want to transform the ENTIRE context. I'm making a game with Quartz, and I'm drawing my player with lines, rects and ellipses. And then I have diamong.png which I rendered at 0,0 in the top left of the screen. Problem is... It renders upside down! How would I rotate it 180 degrees? Here's some of my code: CGImageRef diamondImage = CGImageRetain([UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Diamond.png" ofType:nil]].CGImage); CGContextDrawImage(context, CGRectMake(0, 0, 32, 24), diamondImage); If it's of any help, I'm using Landscape mode, with home button to the right. It's defined both in my .plist, and in my ViewController's -shouldAutorotateToInterfaceOrientation:interfaceOrientation: How would I rotate/transform it?

    Read the article

  • Wrong background colors in Swing ListCellRenderer

    - by Johannes Rössel
    I'm currently trying to write a custom ListCellRenderer for a JList. Unfortunately, nearly all examples simply use DefaultListCellRenderer as a JLabel and be done with it; I needed a JPanel, however (since I need to display a little more info than just an icon and one line of text). Now I have a problem with the background colors, specifically with the Nimbus PLAF. Seemingly the background color I get from list.getBackground() is white, but paints as a shade of gray (or blueish gray). Outputting the color I get yields the following: Background color: DerivedColor(color=255,255,255 parent=nimbusLightBackground offsets=0.0,0.0,0.0,0 pColor=255,255,255 However, as can be seen, this isn't what gets painted. It obviously works fine for the selected item. Currently I even have every component I put into the JPanel the cell renderer returns set to opaque and with the correct foreground and background colors—to no avail. Any ideas what I'm doing wrong here? ETA: Example code which hopefully runs. public class ParameterListCellRenderer implements ListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // some values we need Border border = null; Color foreground, background; if (isSelected) { background = list.getSelectionBackground(); foreground = list.getSelectionForeground(); } else { background = list.getBackground(); foreground = list.getForeground(); } if (cellHasFocus) { if (isSelected) { border = UIManager.getBorder("List.focusSelectedCellHighlightBorder"); } if (border == null) { border = UIManager.getBorder("List.focusCellHighlightBorder"); } } else { border = UIManager.getBorder("List.cellNoFocusBorder"); } System.out.println("Background color: " + background.toString()); JPanel outerPanel = new JPanel(new BorderLayout()); setProperties(outerPanel, foreground, background); outerPanel.setBorder(border); JLabel nameLabel = new JLabel("Factory name here"); setProperties(nameLabel, foreground, background); outerPanel.add(nameLabel, BorderLayout.PAGE_START); Box innerPanel = new Box(BoxLayout.PAGE_AXIS); setProperties(innerPanel, foreground, background); innerPanel.setAlignmentX(Box.LEFT_ALIGNMENT); innerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); JLabel label = new JLabel("param: value"); label.setFont(label.getFont().deriveFont( AffineTransform.getScaleInstance(0.95, 0.95))); setProperties(label, foreground, background); innerPanel.add(label); outerPanel.add(innerPanel, BorderLayout.CENTER); return outerPanel; } private void setProperties(JComponent component, Color foreground, Color background) { component.setOpaque(true); component.setForeground(foreground); component.setBackground(background); } } The weird thing is, if I do if (isSelected) { background = new Color(list.getSelectionBackground().getRGB()); foreground = new Color(list.getSelectionForeground().getRGB()); } else { background = new Color(list.getBackground().getRGB()); foreground = new Color(list.getForeground().getRGB()); } it magically works. So maybe the DerivedColor with nimbusLightBackground I'm getting there may have trouble?

    Read the article

  • Map Reduce Frameworks/Infrastructure

    - by Johannes Rudolph
    Map Reduce is a pattern that seems to get a lot of traction lately and I start to see it manifest in one of my projects that is focused on an event processing pipeline (iPhone Accelerometer and GPS data). I needed to built a lot of infrastructure for this project, in fact it overweighs the logic code interacting with it by 2x. Some of the components I built where EventProcessors (with in- and output plus buffering, timing etc.), multiplexers and aggregators. This leads me to my question what the "common" required infrastrucutre for map reduce is. Since I am working with .Net a lot I can see map reduce infrastructure built into the Framework and language constructs. Functional languages support this paradigm per se. It seems every language can be used with map reduce, some have better support than others, others again are built around that concept (e.g. Go). And there are Frameworks like Apache Hadoop to support map reduce.

    Read the article

  • Xpath: Selecting all of an element type?

    - by Johannes
    I'm just starting to learn Xpath, I'm trying to write a line of code that will select all of the actors in EACH movie parent (through Java!). Below, I have an example of one movie, but there are multiple <Movie> elements, each with <Actor> elements. <Movie Genre = 'Other'> <Title>Requiem For A Dream</Title> <ReleaseYear>2000</ReleaseYear> <Director>Darren Aronofsky</Director> <Actor Character = 'Sara Goldfarb'>Ellen Burstyn</Actor> <Actor Character = 'Harry Goldfarb'>Jared Leto</Actor> <Actor Character = 'Marion Silver'>Jennifer Connelly</Actor> <Actor Character = 'Tyrone C. Love'>Marlon Wayans</Actor> </Movie> Currently, I can only select the first <Actor> element of each <Movie> element -- is it possible to select all of them without using a for loop? Here is my current line of code that displays the first <Actor> element of every <Movie> element: System.out.println("Starring: " + xpath.evaluate("Actor", movieNode) + " as " + xpath.evaluate("Actor/@Character", movieNode) + "\n"); Any and all help if much appreciated!

    Read the article

  • Chipmunk physics: Velocity question

    - by Johannes Jensen
    I'm making an iPhone game where the main actor is a ball that rolls depending on the device's accelerometer rotation. I haven't started on this part of the coding yet, but I was wondering if you guys had a nice way of solving this: I tried looking a little into chipmunk, and I noticed that bodies have the property v, which is a point containing x and y velocities. I was thinking it'd be a bad idea to just do like: playerBody->v = ccp(accelerometer.x * 5, playerBody->v.y); because it'd just roll up of walls and stuff, is there a better solution to do this?

    Read the article

  • Avoid being blocked by web mail companies for mass/bulk emailing ?

    - by Johannes
    Our company is sending out a lot of emails per day and planning to send even more in future. (thousands) Also there are mass mailouts as well in the ten thousands every now and then. Anybody has experience with hotmail, yahoo (web.de, gmx.net) and similar webmail companies blocking your emails because "too many from the same source in a period of time" have been sent to them? What can be done about it? Spreading email mailouts over a whole day/night? At what rate? (we are talking about legal emailing just to make sure...)

    Read the article

  • Different results when applying function to equal values

    - by Johannes Stiehler
    I'm just digging a bit into Haskell and I started by trying to compute the Phi-Coefficient of two words in a text. However, I ran into some very strange behaviour that I cannot explain. After stripping everything down, I ended up with this code to reproduce the problem: let sumTup = (sumTuples°concat) frequencyLists let sumFixTup = (138, 136, 17, 204) putStrLn (show ((138, 136, 17, 204) == sumTup)) putStrLn (show (phi sumTup)) putStrLn (show (phi sumFixTup)) This outputs: True NaN 0.4574206676616167 So although the sumTupand sumFixTup show as equal, they behave differently when passed to phi. The definition of phi is: phi (a, b, c, d) = let dividend = fromIntegral(a * d - b * c) divisor = sqrt(fromIntegral((a + b) * (c + d) * (a + c) * (b + d))) in dividend / divisor

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >