Search Results

Search found 82 results on 4 pages for 'mikael johansson'.

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

  • How to use custom IComparer for SortedDictionary?

    - by Magnus Johansson
    I am having difficulties to use my custom IComparer for my SortedDictionary<. The goal is to put email addresses in a specific format ([email protected]) as the key, and sort by last name. When I do something like this: public class Program { public static void Main(string[] args) { SortedDictionary<string, string> list = new SortedDictionary<string, string>(new SortEmailComparer()); list.Add("[email protected]", "value1"); list.Add("[email protected]", "value2"); foreach (KeyValuePair<string, string> kvp in list) { Console.WriteLine(kvp.Key); } Console.ReadLine(); } } public class SortEmailComparer : IComparer<string> { public int Compare(string x, string y) { Regex regex = new Regex("\\b\\w*@\\b", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled ); string xLastname = regex.Match(x).ToString().Trim('@'); string yLastname = regex.Match(y).ToString().Trim('@'); return xLastname.CompareTo(yLastname); } } I get this ArgumentException: An entry with the same key already exists. when adding the second item. I haven't worked with a custom IComparer for a SortedDictionary before, and I fail to see my error , what am I doing wrong?

    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

  • Should i scrap my own leader board and go for the Facebook built in one?

    - by Magnus Johansson
    Currently I'm rolling my own score and leader board functionality in my FB canvas game. In my game, users can see what score they have, in addition I have a public leader board where everybody can see all scores from all other users.(I also have possibility for each user to set themselves as anonymous in the leader board, if desired) But now I started thinking; why do I have my own leader board system? Facebook has this scores API and I started play around with it. It, of course, integrates well with Facebook, scores and achievement showing up in the ticker and what not. But it seems that I can't let each user see a public leader board in much the same way I currently have it. But it do let the users see their friends score. Let's face it, this is all what FB is all about, right? Friends. So the question is; should i scrap my own leader board and go for the Facebook built in one (and skip the public part of it)? My gut feeling says yes, but I wanted to hear what other thinks.

    Read the article

  • Automatic login vs. manual login and screensaver lock

    - by Erik Johansson
    Is there a way to prevent a command from running when I login manually, but having it run when the computer starts up and GDM automatically logs me in. This is the setup: in the Gnome "on start programs" settings I have a command that locks the screen gnome-screensaver-command -l I have automatic login turned on. That means that the screen will be locked when I turn on the computer, but it will also be locked when I manually login from GDM, is there a way to prevent this?

    Read the article

  • Running a webbrowser on the screen saver or login screen.

    - by Erik Johansson
    I would really like people to beable to use my locked computer to surf, so I would like some way to run a browser on login screen. So can I make GDM run firefox in some way? It would be cooler if I could have a browser as a screensaver, but that seems a bit harder. Please ignore all the security problems with this, if you let someone use your computer you have lost that race anyways. Though of course it would be nice to have a browser running as another user.

    Read the article

  • Unmounted disk still spins up regularly

    - by Erik Johansson
    I just added a disk, with partitions but none of them are mounted. The disk will still spin up every now and then. it goes like this: ### disk spins up hdparm -Y /dev/sdb;date /dev/sdb: issuing sleep command 9 feb 2011 23.37.08 CET ### disk spins up hdparm -Y /dev/sdb;date /dev/sdb: issuing sleep command 9 feb 2011 23.46.12 CET Also it always spins up when I shut down the computer. Any tips are welcome, e.g. how can I figure out which process is accessing the disk, are there any daemons doing this? I know it isn't a cron job.

    Read the article

  • GUI device for throwing a ball

    - by Fredrik Johansson
    The hero has a ball, which shall be thrown with accuracy in a court on iPhone/iPad. The player is seen from above, in a 2D view. In game play, the player reach is between 1/15 and 1/6 of the height of the iPhone screen. The player will run, and try to outmaneuver his opponent, and then throw the ball at a specific location, which is guarded by the opponent (which is also shown on the screen). The player is controlled by a joystick, and that works ok, but how shall I control the stick? Maybe someone can propose a third control method? I've tried the following two approaches: Joystick: Hero has a reach of 1 meter, and this reach is marked with a semi-opaque circle around the player. The ball can be moved by a joystick. When the joystick is moved south, the ball is moved south within the reach circle. There is a direct coupling with the joystick and the position of the ball. I.e. when the joystick is moved max south, the ball is max south within the player reach. At each touch update the speed is calculated, and the Box2d ball position and ball speed are updated. NB, the ball will never be moved outside the reach as long as the player push the joystick. The ball is thrown by swiping the joystick to make the ball move, and then releasing the joystick. At release, the ball will get a smoothed speed of the joystick. Joystick Problem: The throwing accuracy gets bad, because the joystick can not be that big, and a small movement results in quite a large movement of the ball. If the user does not release before the end of the joystick maximum end point, the ball will stop, and when the user releases the joystick the speed of the ball will be zero. Bad... Touch pad A force is applied to the ball by a sweep on a touchpad. The ball is released when the sweep is ended, or when the ball is moved outside the player reach. As there is no one to one mapping between the swipe and the ball position, the precision can be improved. A large swipe can result in a small ball movement. Touch Pad Problem A touchpad is less intuitive. Users do not seem to know what to do with the touch pad. Some tap the touchpad, and then the ball just falls to the ground. As there is no one-to-one mapping, the ball can be moved outside the reach, and then it will just fall to the ground. It's a bit hard to control the ball, especially if the player also moves.

    Read the article

  • Is there a decent way to maintain development of wordpress sites using the same base?

    - by Joakim Johansson
    We've been churning out wordpress sites for a while, and we'd like to keep a base repository that can be used when starting a new project, as well as updating existing sites with changes to the wordpress base. Am I wrong in assuming this would be a good thing? We take care of updating the sites, so having a common base would make this easier. I've been looking at solutions using git, such as forking a base repository and using it to pull changes to the wordpress base, but committing the site to it's own repository. Or maybe, if it's possible, storing the base as a git submodule, but this would require storing themes and plugins outside of that. Is there any common way to go about this kind of website development?

    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

  • Complexity of defense AI

    - by Fredrik Johansson
    I have a non-released game, and currently it's only possible to play with another human being. As the game rules are made up by me, I think it would be great if new players could learn basic game play by playing against an AI opponent. I mean it's not like Tennis, where the majority knows at least the fundamental rules. On the other hand, I'm a bit concerned that this AI implementation can be quite complex. I hope you can help me with an complexity estimation. I've tried to summarize the gameplay below. Is this defense AI very hard to do? Basic Defense Game Play Player Defender can move within his land, i.e. inside a random, non-convex, polygon. This land will also contain obstacles modeled as polygons, that Defender has to move around. Player Attacker has also a land, modeled as another such polygon. Assume that Defender shall defend against Attacker. Attacker will then throw a thingy towards Defender's land. To be rewarded, Attacker wants to hit Defender's land, and Defender will want to strike away the thingy from his land before it stops to prevent Attacker from scoring. To feint Defender, Attacker might run around within his land before the throw, and based on these attacker movements Defender shall then continuously move to the best defense position within his land.

    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

  • Natural talent vs experience [on hold]

    - by Tord Johansson Munk
    Hi i have a question for you guys if you had a choice of hiring one of two programmers. One of them is a natural born programming talent, he has been programming since he was 14 year old and he has been programming all sorts of things by him self, 3d renders,games,his own frameworks, he is really good at algorithms and problem solving. He is now about 25 years old and is looking for a job after some unchallenged years of college the only experience he has is working on his own/university stuff and some open source project. This guy spends all his free time programming and has several pet projects at home. The other person is a 37 year old career programmer. He has been programming since he graduated from university at the age of 26 and have been working since then. He did not have an interest in programming before university. During his studies he discovered that programming was fun and challenging but it never was a "passion". During his career he mainly worked with "enterprise" platforms such as .net or javaEE. He mainly have done database business applications and thus is lacking skills of the young talent like abstract problem solving or algorithms. But he know the tools he has been using during the years and is reliable and almost always makes his boss happy. He keeps him self updated in the platform and tools he has and is using. But outside the office walls he don't touch any code at all. Witch one would you hire? Would you favor one of them in certain projects? Do you think that if the young talent learns his tools he will be a better programmer than the older one? Would your decision be different if both of them where lacking a degree? or if only one of them was lacking a degree be the old and experienced or the young genius.

    Read the article

  • ZendX_JQuery dialogContainer usage

    - by Kalle Johansson
    Hi ! I'm aming to make use of the ZendX_JQuery dialogContainer view helper, in order to produce a modal window, were users can input specified information(for example send a message). I'm trying to use the dialogContainer view helper in this fashion. First of, include the ZendX library in the applications library folder. Secondly, include the following row in the initViewHelper method within the Bootstrap.php file "$view-addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');" third, adding the following conditional enabling of js in the layout.phtml "<?php if($this->jQuery()->isEnabled()){ $this->jQuery()->setLocalPath($this->baseUrl() .'/js/jquery/js/jquery-1.4.2.min.js') ->setUiLocalPath($this->baseUrl() .'/js/jquery/js/jquery-ui-1.8.custom.min.js') ->addStylesheet($this->baseUrl() .'/js/jquery/css/ui-lightness/jquery-ui-1.8.custom.css'); echo $this->jQuery(); } ?>" fourth, creating my Application_Form_JQueryForm extending ZendX_JQuery_Form "<?php class Application_Form_JQueryForm extends ZendX_JQuery_Form { private $form; public function init() { $this->form = $this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl() . '/index/index') ->setMethod('post'); $this->form->setDecorators(array( 'FormElements', 'Form', array ('DialogContainer', array( 'id' => 'tabContainer', 'style' => 'width: 600px;', 'title' => 'Send a private message to Kalle', 'JQueryParams' => array( 'tabPosition' => 'top', ), )), )); $topic = new Zend_Form_Element_Text('topic'); $topic->setValue('topic') ->setRequired(true) ->setValidators(array('validators' => array( 'validator' => 'StringLength', 'options' => array(1,15) ))) ->setDecorators(array( 'ViewHelper', 'Description', 'Errors', array('HtmlTag', array('tag' => 'dl')))); $textarea = new Zend_Form_Element_Textarea('textarea'); $textarea->setValue('post a comment') ->setAttribs(array( 'rows' => 4, 'cols' => 20 )) ->setRequired(true) ->setValidators(array('validators' => array( 'validator' => 'StringLength', 'options' => array(1,15) ))) ->setDecorators(array( 'ViewHelper', 'Description', 'Errors', array('HtmlTag', array('tag' => 'dl')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Send your comment') ->setDecorators(array( 'ViewHelper', 'Description', 'Errors', array('Description', array('escape' => false, 'tag' => 'span')), array('HtmlTag', array('tag' => 'dl')))) ->setDescription('or <a href="/index/index/send/false">Cancel</a>'); $this->form->addElements(array($topic, $textarea, $submit)); } }" This form is then instanciated in the controllers action method, and called in the view. And so to the problem of mine, no matter what i try, in order to for instance set, the width of the dialogContainer or any other parameter (color, css, height, so on and so forth), this being in the JQueryForm's setDecorator part for the form, i can't seem to get any change whatsoever in the resulting modal when called in the view, any help in the proper direction would be greatly appreciated Thanks in advance, Kalle Johansson

    Read the article

  • Zend_Nav in zend framework issue getting menu to show up

    - by Kalle Johansson
    Hi ! First time of here, so please bare with me. I have to following problem, using zend framework, specifically zend_nav to create a reusable menu to be passed in via the layout/layout.phtml page. These are the code fragments in their respective files. first of in application/configs/navigation.xml, <configdata> <nav> <label>Home</label> <controller>index</controller> <action>index</action> <pages> <add> <label>Add</label> <controller>post</controller> <action>add</action> </add> <login> <label>Admin</label> <controller>login</controller> <action>login</action> </login> </pages> </nav> </configdata> this is then passed into an object in the Bootstrap.php file(only showing that specific method) protected function __initNavigation(){ $this->bootstrap('layout'); $layout = $this->getResource('layout'); $view = $layout->getView(); $config = new Zend_Config_Xml(APPLICATION .'/config/navigation.xml', 'nav'); $container = new Zend_Navigation($config); $view->navigation($container); } and then finally in the view layout.phtml, the object should return the menu <!-- application/layouts/scripts/layout.phtml --> <?php echo $this->doctype() ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Zend Blog !</title> <?php echo $this->headLink()->appendStylesheet('/css/global.css')?> </head> <body> <div id="header"> <div id="header-logo"> <b>Blog Me !</b> </div> </div> <div id="menu"> <?php echo $this->navigation()->menu() ?> </div> <div id="content"> <?php echo $this->layout()->content ?> </div> </body> </html> The menu does however not show up when i start up my app in the browser, any ideas as to might have gone wrong, is humbly received. Thanks in advance Kalle Johansson

    Read the article

  • SSH tunnels with multiple outbound IPs

    - by Peter Johansson
    I have a VPS with multiple IP addresses allocated to it (we can use debian, centos or ubuntu). I can ssh into the server using any of the IP addresses. However, any ssh tunnel I set up always uses just one of the IP addresses as its origination IP. How do I configure the server so that when I ssh tunnel into IP1, its outbound IP is IP1. And when I ssh tunnel into IP2, its outbound IP is IP2?

    Read the article

  • Airport Extreme roaming setup

    - by Daniel Johansson
    We've got three Apple AirPort extremes and want to setup them as a roaming wlan network on my company. My question is what's the correct setup for this? All three AP:s is supposed to create the same wireless network "MyWlan" and we want roaming supoprt between them so that client can move from floor to floor without having to switch wlan or reconnect. We don't want to use any kind of DHCP or NAT on the AirPorts, only bridge mode. Do we connect the AirPorts to the lan/ethernet using the WAN port or one of the LAN ports? What's the correct settings in the config utility? Have one of the AirPorts create a network and setup the other two to extend the created network from AirPort 1 or have them all create the same network and set the same wlan password?

    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 start process as a daemon?

    - by Markus Johansson
    I have created a service which consists of a web fronted (nginx), python runner glue handler (uwsgi) and my own python code (fetcher). I have made a script (deploy.sh) to start the difference services: nginx uwsgi --ini inifie.ini python fetcher.py & disown My question is regarding how I start my python daemon. I want it to run in the background. It should not print anything to my current terminal. If I add "print" calls to my fetcher script I currently see them in the terminal window. So my question is: how do I start my fetcher.py script as a daemon?

    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

  • How to confirm memcache memory increase?

    - by Peter Johansson
    Alright, I have downloaded /etc/sysconfig/memcache And edited the file that contained "PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS="" to 1000 cachesize. I uploaded the file back to the server. Now I know there is a way to check if the changes took effect, but I cant remember how. I tried "memcached-tool 127.0.0.1:11211 stats" but it didnt show me the RAM size. Any help would be appreciated.

    Read the article

1 2 3 4  | Next Page >