Search Results

Search found 344 results on 14 pages for 'erik johansson'.

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

  • How to use Python list comprehension (or such) for retrieving rows when using MySQLdb?

    - by Erik Nygren
    Hey all, I use MySQLdb a lot when dealing with my webserver. I often find myself repeating the lines: row = cursor.fetchone() while row: do_processing(row) row = cursor.fetchone() Somehow this strikes me as somewhat un-pythonic. Is there a better, one-line way to accomplish the same thing, along the lines of inline assignment in C: while (row = do_fetch()) { do_processing(row); } I've tried figuring out the syntax using list comprehensions, but I can't seem to figure it out. Any recommendations? Thanks, Erik

    Read the article

  • Youtube Downloader

    - by Erik Persson
    Hi, A time ago I had a script who got the flv-file from a specified youtube-video, which now is broken due to changes at their website. I am wondering if Youtube may have an API to download the flv-file, where can I find it in that case? Have anyone build an own script, may someone wanna help be building it? Is there any scripts in any other languages such as shell/bash that works? :) Best regards, Erik Persson

    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

  • Visual Studio Talk Show #118 is now online - Command-Query Responsibility Separation (French)

    http://www.visualstudiotalkshow.com Erik Renaud: La sparation des responsabilits entre les commandes et les requtes Nous discutons avec Erik Renaud de la sparation des responsabilits entre les commandes et les requtes (Command-Query Responsibility Separation - CQRS). La plupart des applications lisent les donnes beaucoup plus frquemment qu'ils font des critures. Sur la base de cette dclaration, une bonne ide consiste sparer le code qui est responsable de lcriture des donnes du code qui est...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • setting enablesReturnKeyAutomatically on UISearchBar

    - by Erik Carlson
    Hi There, I'm writing for iphone OS 3.1.3. I want the search button in the keyboard from my UISearchBar to have the search button enabled all the time. If this was any old UITextField (not a search bar) the property would be enablesReturnKeyAutomatically. I have tried setting this using the example given at http://discussions.apple.com/thread.jspa?messageID=8457910 which suggests: UITextField *searchTextField ; searchTextField = [[searchBar subviews]objectAtIndex:0]; searchTextField.enablesReturnKeyAutomatically = NO ; Should work. unfortunately it crashes: 2010-05-20 08:36:18.284 ARemote[5929:207] *** -[UISearchBarBackground setEnablesReturnKeyAutomatically:]: unrecognized selector sent to instance 0x3b31980 2010-05-20 08:36:18.284 ARemote[5929:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UISearchBarBackground setEnablesReturnKeyAutomatically:]: unrecognized selector sent to instance 0x3b31980' I have also tried ((UITextField *)[(NSArray *)[searchBar subviews] objectAtIndex:0]).enablesReturnKeyAutomatically = NO;</code> Which gives similar results. Any ideas? Cheers Erik

    Read the article

  • Random Gui errors using C# Mono on OSX

    - by Erik Karlsson
    Hello. Im developing a app in c# (winforms), which uses mono to run on osx. It contains some dynamic controls, for example a custom groupbox which contains some labels and textboxes, a button etc. these boxes can both be added and removed dynamically. Problem arises both when they are created, and removed, or even when a messagebox is shown. What happens is that sometimes on rendering white boxes appears, or some labels are not drawn correctly. And sometimes when a messagebox appears, it first opens up like 5 dummies which are just blank, and which you cant close. Am i doing something wrong, should i sleep the gui thread a bit after each creation, or should i invalidate stuff on my own? Or should i try GTK#? Many thanks on input on this, Erik

    Read the article

  • Change present working directory of a calling shell from a ruby script

    - by Erik Kastman
    I'm writing a simple ruby sandbox command-line utility to copy and unzip directories from a remote filesystem to a local scratch directory in order to unzip them and let users edit the files. I'm using Dir.mktmpdir as the default scratch directory, which gives a really ugly path (for example: /var/folders/zz/zzzivhrRnAmviuee+++1vE+++yo/-Tmp-/d20100311-70034-abz5zj) I'd like the last action of the copy-and-unzip script to cd the calling shell into the new scratch directory so people can access it easily, but I can't figure out how to change the PWD of the calling shell. One possibility is to have the utility print out the new path to stdout and then run the script as part of a subshell (i.e. cd $(sandbox my_dir) ), but I want to print out progress on the copy-and-unzipping since it can take up to 10 minutes, so this won't work. Should I just have it go to a pre-determined, easy-to-find scratch directory? Does anyone have a better suggestion? Thanks in advance for your help. -Erik

    Read the article

  • 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

  • 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

  • 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 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

  • What program sent which packet to the network [closed]

    - by Erik Johansson
    I would like to have a tcpdump like program that shows which program sent a specific packet, instead of just getting the port number. This is a generic problem I've had on and off sometimes when you have and old tcpdump file lying around you have no way to find what program was sending that data.. The solution in how i can identify which process is making UDP traffic on linux ? is an indication that I can solve this with auditd, dTrace, OProfile or SystemTap, but doesn't show how to do it. I.e. it doesn't show the source port of the program calling bind().. The problem I had was strange UDP packets, and since those ports are so short lived it took me a while to solve this issue. I solved this by running an ugly hack similar to: while true; date +%s.%N;netstat -panut;done So either a method better than this hack, a replacement for tcpdump, or some way to get this info from the kernel so I can patch tcpdump. EDIT: This was asked on superuser "tracking what programs sends to net", no good solution though.

    Read the article

  • Move mailbox to public folder

    - by Kim Johansson
    Hello there! I need some help moving a users mailbox to a public folder. I'm not really a sysadmin, I know some AD and Windows Server, but Exchange is new stuff to me. Basically, one user has left the company, so we disabled his account in the AD, but now it's time for the mail. I need to move his old mail to a mailbox which the owern of the company and I can acess, then I would like to forward any new emails to that public folde How can I do this with Exchange 2007?

    Read the article

  • Move mailbox to public folder

    - by Kim Johansson
    I need some help moving a users mailbox to a public folder. I'm not really a sysadmin, I know some AD and Windows Server, but Exchange is new stuff to me. Basically, one user has left the company, so we disabled his account in the AD, but now it's time for the mail. I need to move his old mail to a mailbox which the owern of the company and I can acess, then I would like to forward any new emails to that public folde How can I do this with Exchange 2007?

    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

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