Search Results

Search found 330 results on 14 pages for 'erik carlson'.

Page 2/14 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • ReadOnlyCollection or IEnumerable for exposing member collections?

    - by Erik Öjebo
    Is there any reason to expose an internal collection as a ReadOnlyCollection rather than an IEnumerable if the calling code only iterates over the collection? class Bar { private ICollection<Foo> foos; // Which one is to be preferred? public IEnumerable<Foo> Foos { ... } public ReadOnlyCollection<Foo> Foos { ... } } // Calling code: foreach (var f in bar.Foos) DoSomething(f); As I see it IEnumerable is a subset of the interface of ReadOnlyCollection and it does not allow the user to modify the collection. So if the IEnumberable interface is enough then that is the one to use. Is that a proper way of reasoning about it or am I missing something? Thanks /Erik

    Read the article

  • Unit Testing & Fake Repository implementation with cascading CRUD operations

    - by Erik Ashepa
    Hi, i'm having trouble writing integration tests which use a fake repository, For example : Suppose I have a classroom entity, which aggregates students... var classroom = new Classroom(); classroom.Students.Add(new Student("Adam")); _fakeRepository.Save(classroom); _fakeRepostiory.GetAll<Student>().Where((student) => student.Name == "Adam")); // This query will return null... When using my real implementation for repository (NHibernate based), the above code works (because the save operation would cascade to the student added at the previous line), Do you know of any fake repository implementation which support this behaviour? Ideas on how to implement one myself? Or do you have any other suggestions which could help me avoid this issue? Thanks in advance, Erik.

    Read the article

  • PHP - CSRF - How to make it works in all tabs?

    - by Erik Persson
    Hi there, I have readed about how to prevent CSRF-attacks in the last days. I am going to update the token in every pageload, save the token in the session and make a check when submitting a form. But what if the user has, lets say 3 tabs open with my website, and I just store the last token in the session? This will overwrite the token with another token, and some post-action is going to fail. Do I need to store all tokens in the session, or is there a better solution to get this working? Best regards, Erik Persson

    Read the article

  • How to configure Spring JavaMailSenderImpl for Gmail

    - by Andrew Carlson
    I am trying to find the correct properties to use to connect to the Gmail SMTP sever using the JavaMailSenderImpl class. Let me first say that I have tried the approach found here. This worked fine. But when I tried the configuration below that post with the exact same authentication information I received a javax.mail.AuthenticationFailedException. My currently configuration looks like this. <bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" > <property name="username" value="[email protected]" /> <property name="password" value="XXX" /> <property name="javaMailProperties"> <props> <prop key="mail.smtp.host">smtp.gmail.com</prop> <prop key="mail.smtp.port">587</prop> <prop key="mail.smtp.auth">true</prop> <prop key="mail.smtp.starttls.enable">true</prop> </props> </property> </bean> Why am I still getting this javax.mail.AuthenticationFailedException if I know that my credentials are correct. Update Here is my updated code based on the answers below. I am still receiving the same exception. <bean id="mailSender" class ="org.springframework.mail.javamail.JavaMailSenderImpl" > <property name="username" value="[email protected]" /> <property name="password" value="XXX" /> <property name="javaMailProperties"> <props> <prop key="mail.smtp.from">[email protected]</prop> <prop key="mail.smtp.user">[email protected]</prop> <prop key="mail.smtp.password">XXX</prop> <prop key="mail.smtp.host">smtp.gmail.com</prop> <prop key="mail.smtp.port">587</prop> <prop key="mail.smtp.auth">true</prop> <prop key="mail.smtp.starttls.enable">true</prop> </props> </property> </bean>

    Read the article

  • cgi.FieldStorage always empty - never returns POSTed form Data

    - by Dan Carlson
    This problem is probably embarrassingly simple. I'm trying to give python a spin. I thought a good way to start doing that would be to create a simple cgi script to process some form data and do some magic. My python script is executed properly by apache using mod_python, and will print out whatever I want it to print out. My only problem is that cgi.FieldStorage() is always empty. I've tried using both POST and GET. Each trial I fill out both form fields. <form action="pythonScript.py" method="POST" name="ARGH"> <input name="TaskName" type="text" /> <input name="TaskNumber" type="text" /> <input type="submit" /> </form> If I change the form to point to a perl script it reports the form data properly. The python page always gives me the same result: number of keys: 0 #!/usr/bin/python import cgi def index(req): pageContent = """<html><head><title>A page from""" pageContent += """Python</title></head><body>""" form = cgi.FieldStorage() keys = form.keys() keys.sort() pageContent += "<br />number of keys: "+str(len(keys)) for key in keys: pageContent += fieldStorage[ key ].value pageContent += """</body></html>""" return pageContent I'm using Python 2.5.2 and Apache/2.2.3. This is what's in my apache conf file (and my script is in /var/www/python): <Directory /var/www/python/> Options FollowSymLinks +ExecCGI Order allow,deny allow from all AddHandler mod_python .py PythonHandler mod_python.publisher </Directory>

    Read the article

  • How can I construct and parse a JSON string in Scala / Lift

    - by David Carlson
    I am using JsonResponse to send some JSON to the client. To test that I am sending the correct response it seemed natural to me to parse the resulting JSON and validate against a data structure rather than comparing substrings. But for some reason I am unable to parse the JSON I just constructed: def tryToParse = { val jsObj :JsObj = JsObj(("foo", "bar")); // 1) val jsObjStr :String = jsObj.toJsCmd // 2) jsObjStr is: "{'foo': 'bar'}" val result = JSON.parseFull(jsObjStr) // 3) result is: None // the problem seems to be caused by the quotes: val works = JSON.parseFull("{\"foo\" : \"bar\"}") // 4) result is: Some(Map(foo -> bar)) val doesntWork = JSON.parseFull("{'foo' : 'bar'}") // 5) result is: None } How do I programmatically construct a valid JSON message in Scala/Lift that can also be parsed again?

    Read the article

  • Need to add WHERE condition to query

    - by Angel Carlson
    I am trying to modify edit_orders.php in Zen Cart. Hoping someone might be able to help me add a condition to a query. I need the queries below to specify that the items selected from TABLE_PRODUCTS_DESCRIPTION and TABLE_CATEGORIES_DESCRIPTION must have a language_id = 1. Would be so grateful for any help you could provide. // ############################################################################ // Get List of All Products // ############################################################################ //$result = zen_db_query("SELECT products_name, p.products_id, x.categories_name, ptc.categories_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON pd.products_id=p.products_id LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc ON ptc.products_id=p.products_id LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " cd ON cd.categories_id=ptc.categories_id LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " x ON x.categories_id=ptc.categories_id ORDER BY categories_id"); $result = $db -> Execute("SELECT products_name, p.products_id, categories_name, ptc.categories_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON pd.products_id=p.products_id LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc ON ptc.products_id=p.products_id LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " cd ON cd.categories_id=ptc.categories_id ORDER BY categories_name");

    Read the article

  • Fading transition slideshow

    - by Simon Carlson
    I've got a JavaScript that produces a slideshow. It loads the pictures before starting the actual slideshow. Code below. var image1=new Image() image1.src="filename1.jpg" var image2=new Image() image2.src="filename2.jpg" var image3=new Image() image3.src="filename3.jpg" var step=1 function slideit(){ if (!document.images) return document.images.slide.src=eval("image"+step+".src") if (step<3) step++ else step=1 setTimeout("slideit()",1000) } And this is the required HTML for it to work: <img src="filename1.jpg" name="slide" /> Now, if I want to have fading transitions instead of just having new pictures popping up, how do I approach this? By fading I mean either have the old picture fade out, the new fade in or possibly and most likely both fade in/out. Can this be achieved with pure JavaScript and no jQuery or Ajax?

    Read the article

  • Passing function-specific variables

    - by Simon Carlson
    Say I got two functions that looks like this: function main(Index) { doStuff(); } function doStuff() { if(Index == 1) { document.write("Hello world!") } } And some HTML: <input type="button" value="Click me" onclick="main(1)" /> I realize this is a very stupid way to use function-specific variables and such, but it's just out of curiosity. So is it possible to pass the variable Index from the main function to the doStuff function?

    Read the article

  • Create Rails model with argument of associated model?

    - by Kyle Carlson
    I have two models, User and PushupReminder, and a method create_a_reminder in my PushupReminder controller (is that the best place to put it?) that I want to have create a new instance of a PushupReminder for a given user when I pass it a user ID. I have the association via the user_id column working correctly in my PushupReminder table and I've tested that I can both create reminders & send the reminder email correctly via the Rails console. Here is a snippet of the model code: class User < ActiveRecord::Base has_many :pushup_reminders end class PushupReminder < ActiveRecord::Base belongs_to :user end And the create_a_reminder method: def create_a_reminder(user) @user = User.find(user) @reminder = PushupReminder.create(:user_id => @user.id, :completed => false, :num_pushups => @user.pushups_per_reminder, :when_sent => Time.now) PushupReminderMailer.reminder_email(@user).deliver end I'm at a loss for how to run that create_a_reminder method in my code for a given user (eventually will be in a cron job for all my users). If someone could help me get my thinking on the right track, I'd really appreciate it. Thanks!

    Read the article

  • MVVM/Presentation Model With WinForms

    - by Erik Ashepa
    Hi, I'm currently working on a brownfield application, it's written with winforms, as a preparation to use WPF in a later version, out team plans to at least use the MVVM/Presentation model, and bind it against winforms... I've explored the subject, including the posts in this site (which i love very much), when boiled down, the main advantage of wpf are : binding controls to properties in xaml. binding commands to command objects in the viewmodel. the first feature is easy to implement (in code), or with a generic control binder, which binds all the controls in the form. the second feature is a little harder to implement, but if you inherit from all your controls and add a command property (which is triggered by an internal event such as click), which is binded to a command instance in the ViewModel. The challenges I'm currently aware of are : implementing a commandmanager, (which will trigger the CanInvoke method of the commands as necessery. winforms only supports one level of databinding : datasource, datamember, wpf is much more flexible. am i missing any other major features that winforms lacks in comparison with wpf, when attempting to implement this design pattern? i sure many of you will recommend some sort of MVP pattern, but MVVM/Presentation model is the way to go for me, because I'll want future WPF support. Thanks in advance, Erik.

    Read the article

  • function (blurClass) NOT WORKING IN IE

    - by Erik
    I can't get this plugin to function properly in IE.... Check out my homepage and look at the huge search field toward the top... www.naturalskin.com Whenever I refresh the screen the "blur" looses its function and I'm stuck with text..... Here is the script that I place in an external js page: http://www.naturalskin.com/src/js/javascript/batches.js jQuery.fn.hint = function (blurClass) { if (!blurClass) { blurClass = 'blur'; } return this.each(function () { // get jQuery version of 'this' var $input = jQuery(this), // capture the rest of the variable to allow for reuse title = $input.attr('title'), $form = jQuery(this.form), $win = jQuery(window); function remove() { if ($input.val() === title && $input.hasClass(blurClass)) { $input.val('').removeClass(blurClass); } } // only apply logic if the element has the attribute if (title) { // on blur, set value to title attr if text is blank $input.blur(function () { if (this.value === '') { $input.val(title).addClass(blurClass); } }).focus(remove).blur(); // now change all inputs to title // clear the pre-defined text when form is submitted $form.submit(remove); $win.unload(remove); // handles Firefox's autocomplete } }); }; Erik

    Read the article

  • PHP: Next Available Value in an Array, starting with a non-indexed value

    - by Erik Smith
    I've been stumped on this PHP issue for about a day now. Basically, we have an array of hours formatted in 24-hour format, and an arbitrary value ($hour) (also a 24-hour). The problem is, we need to take $hour, and get the next available value in the array, starting with the value that immediately proceeds $hour. The array might look something like: $goodHours = array('8,9,10,11,12,19,20,21). Then the hour value might be: $hour = 14; So, we need some way to know that 19 is the next best time. Additionally, we might also need to get the second, third, or fourth (etc) available value. The issue seems to be that because 14 isn't a value in the array, there is not index to reference that would let us increment to the next value. To make things simpler, I've taken $goodHours and repeated the values several times just so I don't have to deal with going back to the start (maybe not the best way to do it, but a quick fix). I have a feeling this is something simple I'm missing, but I would be so appreciative if anyone could shed some light. Erik

    Read the article

  • Why can't i change the permissions of files I have access to?

    - by Erik
    I'm logged into a server as user "ubuntu" and I've got files that look like this: -rw-rw-r-- 1 www-data www-data 33150 2012-06-04 22:17 file-a.png -rw-rw-r-- 1 www-data www-data 36371 2012-06-04 22:15 file-b.png -rw-rw-r-- 1 www-data www-data 41439 2012-06-04 22:16 file-c.png the ubuntu user is a member of the group www-data: > groups unbuntu ubuntu : ubuntu www-data so shouldn't I be able to change other permissions since I have access to the file? I'm not an expert on the user/group stuff ... so this is just perplexing me. I'm trying to run: > chmod o-r * I realize I can do it with sudo, easily, but I'm trying to understand why I can't modify the files without sudo. Thanks for any help!

    Read the article

  • Can I use CodeSynthesis XSD (C++/Tree mapping) together with a GPLv3-licensed library?

    - by Erik Sjölund
    Is it possible to write an open source project that uses generated code from CodeSynthesis XSD (C++/Tree) and then link it to a third-party library that is licensed under the GPL version 3? Some background information: CodeSynthesis XSD is licensed under the GPL version 2 but with an extra FLOSS exception (http://www.codesynthesis.com/projects/xsd/FLOSSE). C++ source code generated from CodeSynthesis XSD (C++/Tree) needs to be linked against Xerces (http://xerces.apache.org/xerces-c/) that is licensed under the Apache License 2.0. Update I posted a similar question on the xsd-users mailing list two years ago but I didn't fully understand the answers. In that email thread, I wrote: I think it is the GPL version 3 software that doesn't allow itself be linked to software that can't be "relicensed" to GPL version 3 ( for instance GPL version 2 software ). That would also include XSD as the FLOSS exception doesn't give permission to "relicense" XSD to GPL version 3.

    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

  • VIM does not detect syntax of .ssh/config

    - by Erik
    On a plain Ubuntu installation (12.04 in my case) when I have no ~/.vimrc VIM does not detect syntax of .ssh/config. Syntax highlighting works, but it does not set the correct filetype. vi ~/.ssh/config :set syn? >syntax=conf When I do: set syn=sshconfig Then the syntax highlighting is as it should be. Why isn't the filetype automatically identified? And how can it be set automatically?

    Read the article

  • New Management Console in Java SE Advanced 8u20

    - by Erik Costlow-Oracle
    Java SE 8 update 20 is a new feature release designed to provide desktop administrators with better control of their managed systems. The release notes for 8u20 are available from the public JDK release notes page. This release is not a Critical Patch Update (CPU). I would like to call attention to two noteworthy features of Oracle Java SE Advanced, the commercially supported version of Java SE for enterprises that require both support and specialized tools. The new Advanced Management Console provides a way to monitor and understand client systems at scale. It allows organizations to track usage and more easily create and manage client configuration like Deployment Rule Sets (DRS). DRS can control execution of tracked applications as well as specify compatibility of which application should use which Java SE installation. The new MSI Installer integrates into various desktop management tools, making it easier to customize and roll out different Java SE versions. Advanced Management Console The Advanced Management Console is part of Java SE Advanced designed for desktop administrators, whose users need to run many different Java applications. It provides usage tracking for those Applet & Web Start applications to help identify them for guided DRS creation. DRS can then be verified against the tracked data, to ensure that end-users can run their application against the appropriate Java version with no prompts. Usage tracking also has a different definition for Java SE than it does for most software applications. Unlike most applications where usage can be determined by a simple run-count, Java is a platform used for launching other applications. This means that usage tracking must answer both "how often is this Java SE version used" and "what applications are launched by it." Usage Tracking One piece of Java SE Advanced is a centralized usage tracker. Simply placing a properties file on the client informs systems to report information to this usage tracker, so that the desktop administrator can better understand usage. Information is sent via UDP to prevent any delay on the client. The usage tracking server resides at a central location on the intranet to collect information from those clients. The information is stored in a normalized database for performance, meaning that a single usage tracker can handle a large number of clients. Guided Deployment Rule Sets Deployment Rule Sets were introduced in Java 7 update 40 (September 2013) in order to help administrators control security prompts and guide compatibility. A previous post, Deployment Rule Sets by Example, explains how to configure a rule set so that most applications run against the most secure version but a specific applet may run against the Java version that was current several years ago. There are a different set of questions that can be asked by a desktop administrator in a large or distributed firm: Where are the Java RIAs that our users need? Which RIA needs which Java version? Which users need which Java versions? How do I verify these answers once I have them? The guided deployment rule set creation uses usage tracker data to identify applications both by certificate hash and location. After creating the rules, a comparison tool exists to verify them against the tracked data: If you intend to run an RIA, is it green? If something specific should be blocked, is it red? This makes user-testing easier. MSI Installer The Windows Installer format (MSI) provides a number of benefits for desktop administrators that customize or manage software at scale. Unlike the basic installer that most users obtain from Java.com or OTN, this installer is built around customization and integration with various desktop management products like SCCM. Desktop administrators using the MSI installer can use every feature provided by the format, such as silent installs/upgrades, low-privileged installations, or self-repair capabilities Customers looking for Java SE Advanced can download the MSI installer through their My Oracle Support (MOS) account. Java SE Advanced The new features in Java SE Advanced make it easier for desktop administrators to identify and control client installations at scale. Administrators at organizations that want either the tools or associated commercial support should consider Java SE Advanced.

    Read the article

  • How to credit other authors in an open source project

    - by erik
    I have a pet project that I am planning to release as open source at some point in the not-too-distant future. A couple of the files use or are mostly code that was taken from a project released under the New BSD License. While I have changed it to fit my needs and added some small stuff, the algorithm and the functionality is basically exactly the same. I want to make sure that the author of the code gets credit and that the license is not broken, but I also want to make the reader aware that this is not the code as it was orignally released. How should I approach this? Should I isolate the code as much as possible and just retain the original license? Maybe put all the files that contain foreign code in their own folder and add a readme explaining what has been added/removed? There must have been tons of projects using other open source code. What is the standard approach to 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

  • Difference left/right super button

    - by Erik Keemink
    When I press my left super key the gnome shell appears and when I press the right super key it does not. Moreover pressing right super + T does open a terminal at once, but when using left super I have to press the t twice, when I press the t only once it is similar to just pressing the t without holding super left. This last point also occurs with other shortcuts that I defined (like super+L, super+E), but not with super+up/down/left/right. What I want is to press either super key to get the gnome shell and to use either super key in combination with T to open a terminal immediately (and similar with other shortcuts). I use Ubuntu 12.04 LTS and the gnome 3 shell.

    Read the article

  • Are there any formalized/mathematical theories of software testing?

    - by Erik Allik
    Googling "software testing theory" only seems to give theories in the soft sense of the word; I have not been able to find anything that would classify as a theory in the mathematical, information theoretical or some other scientific field's sense. What I'm looking for is something that formalizes what testing is, the notions used, what a test case is, the feasibility of testing something, the practicality of testing something, the extent to which something should be tested, formal definition/explanation of code coverage, etc. UPDATE: Also, I'm not sure, intuitively, about the connection between formal verification and what I asked, but there's clearly some sort of connection.

    Read the article

  • Wubi 12.04 installation error executing command command

    - by Erik Lau
    I have tried to install wubi but have not had luck because there is an error executing command: command=C:\Users\Me\AppData\Local\Temp\pyl4266.tmp\bin\resize2fs.exe-f C:\ubuntu\disks\root.disk 17744M retval=1 stderr= stdout=resize2fs1.40.6 (09-Feb-2008) Usage: /cygdrive/c/Users/Eriks/AppData/Local/Temp/pyl4266.tmp/bin/resize2fs.exe-f C:/unbuntu/disks.root.disk17744M [-d debug_flags][-f][-F][-p] device[new_size] I do not understand what is the problem. Here is my log file. https://skydrive.live.com/redir?resid=B4F19CA027FFAD89!324 Please let me know what can be done to fix this error.

    Read the article

  • How to define type-specific scripts when using a 'type object' programming pattern?

    - by Erik
    I am in the process of creating a game engine written in C++, using the C/C++ SQLite interface to achieve a 'type object' pattern. The process is largely similar to what is outlined here (Thank you Bob Nystrom for the great resource!). I have a generally defined Entity class that when a new object is created, data is taken from a SQLite database and then is pushed back into a pointer vector, which is then iterated through, calling update() for each object. All the ints, floats, strings are loaded in fine, but the script() member of Entity is proving an issue. It's not much fun having a bunch of stationary objects laying around my gameworld. The only solutions I've come up with so far are: Create a monolithic EntityScript class with member functions encompassing all game AI and then calling the corresponding script when iterating through the Entity vector. (Not ideal) Create bindings between C++ and a scripting language. This would seem to get the job done, but it feels like implementing this (given the potential memory overhead) and learning a new language is overkill for a small team (2-3 people) that know the entirety of the existing game engine. Can you suggest any possible alternatives? My ideal situation would be that to add content to the game, one would simply add a script file to the appropriate directory and append the SQLite database with all the object data. All that is required is to have a variety of integers and floats passed between both the engine and the script file.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >