Search Results

Search found 51 results on 3 pages for 'mikael eriksson'.

Page 1/3 | 1 2 3  | Next Page >

  • Is there ever a reason to use C++ in a Mac-only application?

    - by Emil Eriksson
    Is there ever a reason to use C++ in a Mac-only application? I not talking about integrating external libraries which are C++, what I mean is using C++ because of any advantages in a particular application. While the UI code must be written in Obj-C, what about logic code? Because of the dynamic nature of Objective-C, C++ method calls tend to be ever so slightly faster but does this have any effect in any imaginable real life scenario? For example, would it make sense to use C++ over Objective-C for simulating large particle systems where some methods would need to be called over and over in short time? I can also see some cases where C++ has a more appropriate "feel". For example when doing graphics, it's nice to have vector and matrix types with appropriate operator overloads and methods. This, to me, seems like it would be a bit clunkier to implement in Objective-C. Also, Objective-C objects can never be treated plain old data structures in the same manner as C++ types since Objective-C objects always have an isa-pointer. Wouldn't it make sense to use C++ instead in something like this? Does anyone have a real life example of a situation where C++ was chosen for some parts of an application? Does Apple use any C++ except for the kernel? (I don't want to start a flame war here, both languages have their merits and I use both equally though in different applications.)

    Read the article

  • Problem with Validate Anti Forgery

    - by Mikael Egnér
    Hi! I have a problem regarding MVC Anti forgery token. When I do my authentication I have pseudo code like this: var user = userRepository.GetByEmail(email); System.Threading.Thread.CurrentPrincipal = HttpContext.Current.User = user; by doing so I'm able to get the current user in my code like this: var user = HttpContext.Current.User as EntityUser; This works fine until I add the [ValidateAntiForgeryToken] attribute to an action. When I add the attribute I get A required anti-forgery token was not supplied or was invalid. If I comment out this line: System.Threading.Thread.CurrentPrincipal = HttpContext.Current.User = user; The antiforgery validation works fine, but the I don't have my convenient way of getting my "EntityUser" from the HttpContext. Any ideas of how to work around this? Best regards Mikael

    Read the article

  • How to get useful feedback/bug reports from users

    - by Mikael Eliasson
    I'm sure most webmasters have recived a mail like this: Creating [insert item here] is not working! When you check it out there is no general problem with the function but rather the user has discovered an edge case. Almost every mail I get is like this and in the long run it gets a bit annoying to always have to ask the user for more information. Is there anything I can do to get my users provide more useful feedback? Right now I have a mailto: for the webmaster mail in the page footer. I was thinking of changing this so that they have to report through a form on the site. Anyone got any experience with this? Do you get better/more reports by having a feedback form instead of giving the users the email?

    Read the article

  • What different ways are there to model restitution in a physics engine?

    - by Mikael Högström
    In my physics engine I give a body a value for restitution between 0 and 1. When two bodies collide there seems to be different views on how the restitution of the collision should be calculated. To me the most intuitive seems to be to take the average of the two but some seem to take only the largest one. Are there other ways to do it? Also, could the closing velocity or some other parameter come into effect?

    Read the article

  • remap Caps Lock on OSX 10.6.8

    - by Jakob Eriksson
    I have for a long time used KeyRemap4MacBook in Snow Leopard. I have always stayed on top of OS update. Today, suddenly my CapsLock no longer was remapped to Control, but it was just a regular CapsLock. So I went into the settings for KeyRemap4MacBook and noticed that CapsLock could no longer be set. Instead it gave a link to PCKeyboardHack. So I downloaded that and tried to use it. But when I try to select the Control key to remap to, it just becomes some kind erratic delete key or something. Definitely not a Control key.

    Read the article

  • CommandBinding broken in inner Custom Control when nesting two Custom Controls of the same type.

    - by Fredrik Eriksson
    I've done a Custom Control in form of a GroupBox but with an extra header which purpose is to hold a button or a stackpanel with buttons at the other side. I've added the a Dependency Property to hold the extra header and I've connected the customized template. Everything works fine until I put one of these controls in another one. Now the wierd stuff begins(at least in my eyes xP), the command binding in the inner control simply isn't set. I tried to use Snoop to gather some data, the see if the inherits is broken and when I clicked on the buttons which isn't doing what I want it to, boom, breakpoint triggered. So in some wierd way the Command isn't set until something that I don't know what it is, happens, which snoops triggers. I've also tried to put the buttons in the regular Header property and that works fine, but not with my own made. I could just switch places with them to make it like I want but now I'm curious to know where the problem lies... Now I wonder, what can I've missed? The control class: public class TwoHeaderedGroupBox : GroupBox { static TwoHeaderedGroupBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TwoHeaderedGroupBox), new FrameworkPropertyMetadata(typeof(TwoHeaderedGroupBox))); } public static DependencyProperty HeaderTwoProperty = DependencyProperty.Register("HeaderTwo", typeof(object), typeof(TwoHeaderedGroupBox), new FrameworkPropertyMetadata()); public object HeaderTwo { get { return (object)GetValue(HeaderTwoProperty); } set { SetValue(HeaderTwoProperty, value);} } } And here is the Template (which by the way is created by blend from the beginning): <ControlTemplate TargetType="{x:Type Controls:TwoHeaderedGroupBox}"> <Grid SnapsToDevicePixels="true"> <Grid.ColumnDefinitions> <ColumnDefinition Width="6"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="6"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="6"/> </Grid.RowDefinitions> <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="4" Grid.Column="0" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3"/> <Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.Row="0" Grid.RowSpan="2" VerticalAlignment="Center"> <ContentControl Content="{TemplateBinding Header}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> </Border> <ContentPresenter Grid.ColumnSpan="2" Grid.Column="1" Margin="{TemplateBinding Padding}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> <Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3"> <Border.OpacityMask> <MultiBinding ConverterParameter="7" Converter="{StaticResource BorderGapMaskConverter}"> <Binding ElementName="Header" Path="ActualWidth"/> <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/> <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/> </MultiBinding> </Border.OpacityMask> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3"> <Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/> </Border> </Border> <Border x:Name="HeaderTwo" Grid.Column="2" Padding="3,5,3,5" Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Right"> <ContentControl Content="{TemplateBinding HeaderTwo}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" DataContext="{TemplateBinding DataContext}"/> </Border> </Grid> </ControlTemplate>

    Read the article

  • Does DB2 have an "insert or update" statement?

    - by Mikael Eriksson
    From my code (Java) I want to ensure that a row exists in the database (DB2) after my code is executed. My code now does a select and if no result is returned it does an insert. I really don't like this code since it exposes me to concurrency issuses when running in a multi-threaded environment. What I would like to do is to put this logic in DB2 instead of in my Java code. Does DB2 have an "insert-or-update" statement? Or anything like it that I can use? For example: insertupdate into mytable values ('myid') Another way of doing it would probably be to allways do the insert and catch "SQL-code -803 primary key already exists", but I would like to avoid that if possible.

    Read the article

  • MySQL LEFT JOIN, INNER JOIN etc, complicated query, PHP + MySQL for a forum

    - by Sven Eriksson
    So I've got a little forum I'm trying to get data for, there are 4 tables, forum, forum_posts, forum_threads and users. What i'm trying to do is to get the latest post for each forum and giving the user a sneak peek of that post, i want to get the number of posts and number of threads in each forum aswell. Also, i want to do this in one query. So here's what i came up with: SELECT lfx_forum_posts.*, lfx_forum.*, COUNT(lfx_forum_posts.pid) as posts_count, lfx_users.username, lfx_users.uid, lfx_forum_threads.tid, lfx_forum_threads.parent_forum as t_parent, lfx_forum_threads.text as t_text, COUNT(lfx_forum_threads.tid) as thread_count FROM lfx_forum LEFT JOIN (lfx_forum_threads INNER JOIN (lfx_forum_posts INNER JOIN lfx_users ON lfx_users.uid = lfx_forum_posts.author) ON lfx_forum_threads.tid = lfx_forum_posts.parent_thread AND lfx_forum_posts.pid = (SELECT MAX(lfx_forum_posts.pid) FROM lfx_forum_posts WHERE lfx_forum_posts.parent_forum = lfx_forum.fid GROUP BY lfx_forum_posts.parent_forum) ) ON lfx_forum.fid = lfx_forum_posts.parent_forum GROUP BY lfx_forum.fid ORDER BY lfx_forum.fid ASC This get the latest post in each forum and gives me a sneakpeek of it, the problem is that lfx_forum_posts.pid = (SELECT MAX(lfx_forum_posts.pid) FROM lfx_forum_posts WHERE lfx_forum_posts.parent_forum = lfx_forum.fid GROUP BY lfx_forum_posts.parent_forum) Makes my COUNT(lfx_forum_posts.pid) go to one (aswell as the COUNT(lfx_forum_threads.tid) which isn't how i would like it to work. My question is: is there some somewhat easy way to make it show the correct number and at the same time fetch the correct post info (the latest one that is)? If something is unclear please tell and i'll try to explain my issue further, it's my first time posting something here.

    Read the article

  • OpenLDAP, howto allow both secure (TLS) and unsecure (normal) connections?

    - by Mikael Roos
    Installed OpenLDAP 2.4 on FreeBSD 8.1. It works for ordinary connections OR for TLS connections. I can change it by (un)commenting the following lines in slapd.conf. # Enable TLS #security ssf=128 # Disable TLS security ssf=0 Is there a way to allow the clients to connect using TLS OR no-TLS? Can the ldap-server be configured to support both TLS connections and no-TLS connections? Tried to find the information in the manual, but failed: http://www.openldap.org/doc/admin24/access-control.html#Granting%20and%20Denying%20access%20based%20on%20security%20strength%20factors%20(ssf) http://www.openldap.org/doc/admin24/tls.html#Server%20Configuration Tried to read up on 'security' in manualpage for ldap.conf, didn't find the info there either. I guess I need to configure the 'secure' with some negotiation mechanism, "try to use TLS if client has it, otherwise continue using no-TLS". Connecting with a client (when slapd.conf is configure to use TLS): gm# ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts ldap_bind: Confidentiality required (13) additional info: TLS confidentiality required gm# ldapsearch -Z -x -b '' -s base '(objectclass=*)' namingContexts (this works, -Z makes a TLS connection) So, can I have my ldap-server supporting client connections using TLS and ordinary (no-TLS) connections? Thanx in advance.

    Read the article

  • Single application through OpenVPN tunnel (Debian Lenny)

    - by mikael
    I'm using Debian Lenny and I want to tunnel rtorrent only through a OpenVPN tunnel. I have a tunnel running, the config file looks like this: client dev tun proto udp remote openvpn.xxx.com 1194 resolv-retry infinite nobind persist-key persist-tun ca /etc/openvpn/xxx/keys/ca.crt cert /etc/openvpn/xxx/keys/client.crt key /etc/openvpn/xxx/keys/client.key tls-auth /etc/openvpn/xxx/keys/tls.key 1 ns-cert-type server comp-lzo verb 3 auth-user-pass script-security 3 reneg-sec 0 My idea is that I could run a sockd proxy internally that redirects traffic to the openvpn tunnel. I could use the *nix "proxifier" application "tsocks" to make it possible for rtorrent to connect through that proxy (as rtorrent doesn't support proxies). I have trouble configuring sockd as my IP inside the VPN changes every time I connect. This is a config file someone said would help: http://ircpimps.org/sockd.conf As my IP changes at each connect I don't know what to put in that config file. I have no control over the host side config file. Any help wanted. Any other method is very welcome.

    Read the article

  • How to use different scaling for every monitor?

    - by Mikael Koskinen
    One of the new features in Windows 8.1 is the new "Desktop display scaling", which allows user to configure scaling per monitor. I've been trying to get this working in preview but with no success. If I configure the scaling, it always affects all of my monitors. I have two monitors, the main one with a higher resolution and the secondary with "normal" resolution. The secondary monitor is used in portrait mode. I would like to configure the main monitor's scaling as the text is currently too small. Here's how things look at the configuration screen by default: Now if I adjust the scaling, click apply and do relogin, everything is bigger. On both of my monitors. I haven't clicked the "Let me choose one scaling level for all my displays", but still the slider seems to affect both of them. If I check the "Let me choose one scaling level", the UI changes to look similar to what we have in Windows 8: Still the problem persists. The scaling is applied to both of my monitors. So, it doesn't matter if I check the box or not, the scaling is always applied to all the displays. Any idea how I could get this to work in preview? I've read some comments which seem to indicate that this should work in preview, though Paul Thurrott mentioned at his Winsupersite article that he either didn't get this to work.

    Read the article

  • Best way to install multiple versions of Apache, PHP and MySQL on a single FreeBSD host

    - by Mikael Roos
    I want a test- and development-environment for web using Apache, PHP and MySQL. I need to be able to test a single web-application with multiple versions of PHP (5.2, 5.3, etc) and multiple versions of MySQL (5.0, 5.1, 5.5, etc). It shall be hosted on a FreeBSD server. My idea is to compile each version into a directory structure and running them on separate portnumbers. For example: opt/apache2.2-php5.2-mysql-5.0 (httpd on port 8801, mysql on port 8802) (directory contains each software, compiled and linked towards eachother) opt/apache2.2-php5.3-mysql-5.1 (httpd on port 8803, mysql on port 8804) (and so on) Any thoughts or suggestions of the best way to setup this type of environment?

    Read the article

  • Silent and scripted install of CPAN and Perl modules?

    - by Mikael Grönfelt
    I need to install CPAN and some Perl modules automatically in a Scientific Linux (RHEL) installation script. Unfortunately the specific modules I want (at least one of them) cannot be found as RPM:s as far as I've seen. So I need to install CPAN, configure it automatically (or with a config file) and then install the wanted modules (including dependencies) automatically as well. This doesn't seem like a very unusual requirement, but I haven't seen any really good documentation on this. The problem is that whenever CPAN is launched for the first time an interactive configuration runs. Can this be skipped somehow? And how do I launch module installations directly from the command line?

    Read the article

  • Disable pop-up for "Faulting application" on login - Windows Server 2003

    - by Mikael Svenson
    I have a service running on a Windows 2003 server. The service executes a .exe file to process some data. Sometimes the .exe crashes due to incorrect input and it logs an error to the Application Log which is fine. If I remote login to the server I get a pop-up of the .exe file crash, for each crash which has occured since I last logged in. The crashes can safely be ignored and I'd like to ignore these pop-ups. Is there a way to disable these pop-ups?

    Read the article

  • Windows Server Task Scheduler: Running scheduled executable fail-safe?

    - by Mikael Koskinen
    I have an executable which I've scheduled to run once in every five minutes (using Window's built-in Task Scheduler). It's crucial that this executable is run because it updates few time critical files. But how can I react if the virtual server running the executable goes down? At no point there shouldn't be more than 15 minutes break between the runs. As I'm using Windows Server and its Task Scheduler, I wonder is it possible to create some kind of a cluster which automatically handles the situation? The problem is that the server in question is running on Windows Azure and I don't think I can create actual clusters using the virtual machines. If the problem can be solved using a 3rd party tool, that's OK too. To generalize the question a little bit: How to make sure that an executable is run once in every 5 minutes, even if there might be server failures?

    Read the article

  • Change owner recursively with Powershell?

    - by Mikael Grönfelt
    I'm trying to use Powershell to change owner of a folder, recursively. I'm basically using this code: $acct1 = New-Object System.Security.Principal.NTAccount('DOMAIN\Enterprise Admins') $profilefolder = Get-Item MyFolder $acl1 = $profilefolder.GetAccessControl() $acl1.SetOwner($acct1) set-acl -aclobject $acl1 -path MyFolder This will change ownership at the first level, but not for any subfolders or files. Is there a way to extend the scope to all content of MyFolder?

    Read the article

  • Save a single web page (with background images) with Wget

    - by mikael
    I want to use Wget to save single web pages (not recursively, not whole sites) for reference. Much like Firefox's "Web Page, complete". My first problem is: I can't get Wget to save background images specified in the CSS. Even if it did save the background image files I don't think --convert-links would convert the background-image URLs in the CSS file to point to the locally saved background images. Firefox has the same problem. My second problem is: If there are images on the page I want to save that are hosted on another server (like ads) these wont be included. --span-hosts doesn't seem to solve that problem with the line below. I'm using: wget --no-parent --timestamping --convert-links --page-requisites --no-directories --no-host-directories -erobots=off http://domain.tld/webpage.html

    Read the article

  • Problem uploading .docx through html form

    - by Mikael
    I've made a simple form, with the proper enctype for uploading files. When i try to upload a .docx everything works fine in IE 8 and Safari, but in Firefox or IE 7 or 6 i can't even click submit, nothing happens! Could this still be a server issue? It's an apache server. Everything works fine if i choose to upload a .doc file <form enctype="multipart/form-data" method="post" action="index.php"> <input name="file" type="file" /> <input type="submit" name="btnSubmit" value="Submit"/> </form>

    Read the article

  • Generic type parameters using out

    - by Mikael
    Im trying to make a universal parser using generic type parameters, but i can't grasp the concept 100% private bool TryParse<T>(XElement element, string attributeName, out T value) where T : struct { if (element.Attribute(attributeName) != null && !string.IsNullOrEmpty(element.Attribute(attributeName).Value)) { string valueString = element.Attribute(attributeName).Value; if (typeof(T) == typeof(int)) { int valueInt; if (int.TryParse(valueString, out valueInt)) { value = valueInt; return true; } } else if (typeof(T) == typeof(bool)) { bool valueBool; if (bool.TryParse(valueString, out valueBool)) { value = valueBool; return true; } } else { value = valueString; return true; } } return false; } As you might guess, the code doesn't compile, since i can't convert int|bool|string to T (eg. value = valueInt). Thankful for feedback, it might not even be possible to way i'm doing it. Using .NET 3.5

    Read the article

  • Optimal storage of data structure for fast lookup and persistence

    - by Mikael Svenson
    Scenario I have the following methods: public void AddItemSecurity(int itemId, int[] userIds) public int[] GetValidItemIds(int userId) Initially I'm thinking storage on the form: itemId -> userId, userId, userId and userId -> itemId, itemId, itemId AddItemSecurity is based on how I get data from a third party API, GetValidItemIds is how I want to use it at runtime. There are potentially 2000 users and 10 million items. Item id's are on the form: 2007123456, 2010001234 (10 digits where first four represent the year). AddItemSecurity does not have to perform super fast, but GetValidIds needs to be subsecond. Also, if there is an update on an existing itemId I need to remove that itemId for users no longer in the list. I'm trying to think about how I should store this in an optimal fashion. Preferably on disk (with caching), but I want the code maintainable and clean. If the item id's had started at 0, I thought about creating a byte array the length of MaxItemId / 8 for each user, and set a true/false bit if the item was present or not. That would limit the array length to little over 1mb per user and give fast lookups as well as an easy way to update the list per user. By persisting this as Memory Mapped Files with the .Net 4 framework I think I would get decent caching as well (if the machine has enough RAM) without implementing caching logic myself. Parsing the id, stripping out the year, and store an array per year could be a solution. The ItemId - UserId[] list can be serialized directly to disk and read/write with a normal FileStream in order to persist the list and diff it when there are changes. Each time a new user is added all the lists have to updated as well, but this can be done nightly. Question Should I continue to try out this approach, or are there other paths which should be explored as well? I'm thinking SQL server will not perform fast enough, and it would give an overhead (at least if it's hosted on a different server), but my assumptions might be wrong. Any thought or insights on the matter is appreciated. And I want to try to solve it without adding too much hardware :) [Update 2010-03-31] I have now tested with SQL server 2008 under the following conditions. Table with two columns (userid,itemid) both are Int Clustered index on the two columns Added ~800.000 items for 180 users - Total of 144 million rows Allocated 4gb ram for SQL server Dual Core 2.66ghz laptop SSD disk Use a SqlDataReader to read all itemid's into a List Loop over all users If I run one thread it averages on 0.2 seconds. When I add a second thread it goes up to 0.4 seconds, which is still ok. From there on the results are decreasing. Adding a third thread brings alot of the queries up to 2 seonds. A forth thread, up to 4 seconds, a fifth spikes some of the queries up to 50 seconds. The CPU is roofing while this is going on, even on one thread. My test app takes some due to the speedy loop, and sql the rest. Which leads me to the conclusion that it won't scale very well. At least not on my tested hardware. Are there ways to optimize the database, say storing an array of int's per user instead of one record per item. But this makes it harder to remove items.

    Read the article

  • isnt as a c# keyword

    - by Mikael
    To check if an object is of a certain class one can write: if (item is Class) why isn't the opposite possible? if (item isnt Class) instead one would write if (!(item is Class) which isn't as easy to read as if "isnt" was a keyword just as "is" is. Is there something that makes it so that only "is" should be available or has "isnt" just been forgotten about?

    Read the article

  • Deleting YouTube videos using Zend/PHP

    - by Mikael
    Hello, I'm using Zend and PHP to upload and delete videos from my home page. The uploading part is working fine but to download is more complicated. $videoEntryToDelete = $yt->getVideoEntry($videoId); $yt->delete($videoEntryToDelete); I use this code to delete a video and the first row do work. The video object is created and I can get all data from it. But when I try to delete it I get this error message: "You must specify an URI to which to post" Do anyone know how to solve this problem? Thanks!

    Read the article

  • KeyUp processed for wrong control

    - by Mikael
    I have made a simple test application for the issue, two winforms each containing a button. The button on the first form opens the other form when clicked. It also subscribes to keyup events. The second form has its button set as "AcceptButton" and in the Clicked event we sleep for 1s and then set DialogResult to true (the sleep is to simulate some processing done) When enter is used to close this second form the KeyUp event of the button on the first form is triggered, even though the key was released well before the second had passed so the second form was still shown and focused. If any key other then enter is pressed in the second form the event is not triggered for the button on the first form. First form: public Form1() { InitializeComponent(); buttonForm2.KeyUp += new KeyEventHandler(cntKeyUp); } void cntKeyUp(object sender, KeyEventArgs e) { MessageBox.Show(e.KeyCode.ToString()); } private void buttonForm2_Click(object sender, EventArgs e) { using (Form2 f = new Form2()) { f.ShowDialog(); } } Second form: private void button1_Click(object sender, EventArgs e) { Thread.Sleep(1000); this.DialogResult = DialogResult.OK; } Does anyone know why the event is triggered for the button on the non active form and what can be done to stop this from happening?

    Read the article

1 2 3  | Next Page >