Search Results

Search found 1735 results on 70 pages for 'andrew myers'.

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

  • Spring MVC 3.0: Avoiding explicit JAXBElement<> wrapper in method arg

    - by Keith Myers
    I have the following method and want to avoid having to explicitly show the JAXBElement< syntax. Is there some sort of annotation that would allow the method to appear to accept raw MessageResponse objects but in actuality work the same as shown below? I'm not sure how clear that was so I'll say this: I'm looking for some syntactic sugar :) @ServiceActivator public void handleMessageResponse(JAXBElement<MessageResponse> jaxbResponse) { MessageResponse response = jaxbResponse.getValue(); MessageStatus status = messageStatusDao.getByStoreIdAndMessageId(response.getStoreId(), response.getMessageId()); status.setStatusTimestamp(response.getDate()); status.setStatus("Complete"); }

    Read the article

  • how do simple SQLAlchemy relationships work?

    - by Carson Myers
    I'm no database expert -- I just know the basics, really. I've picked up SQLAlchemy for a small project, and I'm using the declarative base configuration rather than the "normal" way. This way seems a lot simpler. However, while setting up my database schema, I realized I don't understand some database relationship concepts. If I had a many-to-one relationship before, for example, articles by authors (where each article could be written by only a single author), I would put an author_id field in my articles column. But SQLAlchemy has this ForeignKey object, and a relationship function with a backref kwarg, and I have no idea what any of it MEANS. I'm scared to find out what a many-to-many relationship with an intermediate table looks like (when I need additional data about each relationship). Can someone demystify this for me? Right now I'm setting up to allow openID auth for my application. So I've got this: from __init__ import Base from sqlalchemy.schema import Column from sqlalchemy.types import Integer, String class Users(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) username = Column(String, unique=True) email = Column(String) password = Column(String) salt = Column(String) class OpenID(Base): __tablename__ = 'openid' url = Column(String, primary_key=True) user_id = #? I think the ? should be replaced by Column(Integer, ForeignKey('users.id')), but I'm not sure -- and do I need to put openids = relationship("OpenID", backref="users") in the Users class? Why? What does it do? What is a backref?

    Read the article

  • [MySQL/PHP] Avoid using RAND()

    - by Andrew Ellis
    So... I have never had a need to do a random SELECT on a MySQL DB until this project I'm working on. After researching it seems the general populous says that using RAND() is a bad idea. I found an article that explains how to do another type of random select. Basically, if I want to select 5 random elements, I should do the following (I'm using the Kohana framework here)? If not, what is a better solution? Thanks, Andrew <?php final class Offers extends Model { /** * Loads a random set of offers. * * @param integer $limit * @return array */ public function random_offers($limit = 5) { // Find the highest offer_id $sql = ' SELECT MAX(offer_id) AS max_offer_id FROM offers '; $max_offer_id = DB::query(Database::SELECT, $sql) ->execute($this->_db) ->get('max_offer_id'); // Check to make sure we're not trying to load more offers // than there really is... if ($max_offer_id < $limit) { $limit = $max_offer_id; } $used = array(); $ids = ''; for ($i = 0; $i < $limit; ) { $rand = mt_rand(1, $max_offer_id); if (!isset($used[$rand])) { // Flag the ID as used $used[$rand] = TRUE; // Set the ID if ($i > 0) $ids .= ','; $ids .= $rand; ++$i; } } $sql = ' SELECT offer_id, offer_name FROM offers WHERE offer_id IN(:ids) '; $offers = DB::query(Database::SELECT, $sql) ->param(':ids', $ids) ->as_object(); ->execute($this->_db); return $offers; } }

    Read the article

  • How to tie a Hudson job to a user who has access to run MSIExec

    - by Andrew
    Hi All, I have a batch file that calls "MSIExec /X {MyGUID} /qn". This runs successfully when run with my admin user. When I run it as a Window Batch command from a Hudson job it fails with "T?h?e? ?i?n?s?t?a?l?l?a?t?i?o?n? ?s?o?u?r?c?e? ?f?o?r? ?t?h?i?s? ?p?r?o?d?u?c?t? ?i?s? ?n?o?t? ?a?v?a?i?l?a?b?l?e?.? ? ?V?e?r?i?f?y? ?t?h?a?t? ?t?h?e? ?s?o?u?r?c?e? ?e?x?i?s?t?s? ?a?n?d? ?t?h?a?t? ?y?o?u? ?c?a?n? ?a?c?c?e?s?s? ?i?t?.? " I am inclined to think that the issue is that the job is started by the "anonymous" user rather than my admin user. How in hudson do I "tie" the job to be run under the admin user? Thanks in advance. Regards, Andrew

    Read the article

  • Changing folder names in Visual Studio when using SVN

    - by Piers Myers
    I am using VS2008/VS2010 with Resharper 5, TortoiseSVN 1.6.8.19260-x64, and AnkhSVN 2.1.8420.8. Most operations I do in Visual Studio are reflected fine in SVN, however, renaming folders in a project can cause problems when I try to submit my changes. Also all the namespaces in the C# source files under the renamed folder need to be updated to reflect the name change. What is the best way to rename the main project folder or any sub folders and ensure there are no issues with SVN? Should it be done outside Visual Studio? What is the best way to update all the namespace changes? Is search/replace the only way? Are there any best practices regarding folder names and their contents?

    Read the article

  • RegisterClientScriptInclude doesn't work for some reason...

    - by Andrew
    Hey, I've spent at least 2 days trying anything and googling this...but for some reason I can't get RegisterClientScriptInclude to work the way everyone else has it working? First off, I am usting .NET 3.5 Ajax,...and I am including javascript in my partial page refreshes...using this code: ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "MyClientCode", script, true); It works perfectly, my javascript code contained in the script variable is included every partial refresh. The javascript in script is actually quite extensive though, and I would like to store it in a .js file,..so logically I make a .js file and try to include it using RegisterClientScriptInclude ...however i can't for the life of my get this to work. here's the exact code: ScriptManager.RegisterClientScriptInclude(this, typeof(Page), "mytestscript", "/js/testscript.js"); the testscript.js file is only included in FULL page refreshes...ie. when I load the page, or do a full postback....i can't get the file to be included in partial refreshes...have no idea why..when viewing the ajax POST in firebug I don't see a difference whether I include the file or not.... both of the ScriptManager Includes are being ran from the exact same place in "Page_Load"...so they should execute every partial refresh (but only the ScriptBlock does). anyways,..any help or ideas,..or further ways I can trouble shoot this problem, would be appreciated. Thanks, Andrew

    Read the article

  • Generic TryParse

    - by Piers Myers
    I am trying to create a generic extension that uses 'TryParse' to check if a string is a given type: public static bool Is<T>(this string input) { T notUsed; return T.TryParse(input, out notUsed); } this won't compile as it cannot resolve symbol 'TryParse' As I understand, 'TryParse' is not part of any interface. Is this possible to do at all?

    Read the article

  • CRONTAB doesn't finish svndump

    - by Andrew
    I just discovered that the automated dumps I've been creating of my SVN repository have been getting cut off early and basically only half the dump is there. It's not an emergency, but I hate being in this situation. It defeats the purpose of making automated backups in the first place. The command I'm using is below. If I execute it manually in the terminal, it completes fine; the output.txt file is 16 megs in size with all 335 revisions. But if I leave it to crontab, it bails at the halfway mark, at around 8.1 megs and only the first 169 revisions. # m h dom mon dow command 18 00 * * * svnadmin dump /var/svn/repos/myproject > /home/andrew/output.txt I actually save to a dated gzipped file, and there's no shortage of space on the server, so this is not a disk space issue. It seems to bail after two seconds, so this could be a time issue, but the file size is the same every single time for the past month, so I don't think it's that either. Does crontab execute within a limited memory space?

    Read the article

  • Table Disobeys W3C Box Model, Ie8 Ignores Fixed Table Width !

    - by Axel Myers
    Hi, I'm having hard time with tables and column widths. Update: I'm using XHTML Strict 1.0. The page is: http://www.pro-turk.net/try The first problem I have is, I have a column with a fixed width of 100px and 4px padding, but it disobeys my padding depending on the value. The column width (as the distance between two borders according to W3C Box Model) is 156 px even if padding is 0 or 4. Only the position of the text changes. According to W3C Box Model ( available at www.pro-turk.net/box_model.png ), borders and paddings aren't included in WIDTH attribute, so why does it render wrongly ? The second problem is, when you look the page I gave with IE8, the first cell in the second row has 150px fixed width, but ie shows it about 50% of the total table width regardless of what i say.

    Read the article

  • Haskell Cons Operator (:)

    - by Carson Myers
    I am really new to Haskell (Actually I saw "Real World Haskell" from O'Reilly and thought "hmm, I think I'll learn functional programming" yesterday) and I am wondering: I can use the construct operator to add an item to the beginning of a list: 1 : [2,3] [1,2,3] I tried making an example data type I found in the book and then playing with it: --in a file data BillingInfo = CreditCard Int String String | CashOnDelivery | Invoice Int deriving (Show) --in ghci $ let order_list = [Invoice 2345] $ order_list [Invoice 2345] $ let order_list = CashOnDelivery : order_list $ order_list [CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, CashOnDelivery, ...- etc... it just repeats forever, is this because it uses lazy evaluation? -- EDIT -- okay, so it is being pounded into my head that let order_list = CashOnDelivery:order_list doesn't add CashOnDelivery to the original order_list and then set the result to order_list, but instead is recursive and creates an infinite list, forever adding CashOnDelivery to the beginning of itself. Of course now I remember that Haskell is a functional language and I can't change the value of the original order_list, so what should I do for a simple "tack this on to the end (or beginning, whatever) of this list?" Make a function which takes a list and BillingInfo as arguments, and then return a list? -- EDIT 2 -- well, based on all the answers I'm getting and the lack of being able to pass an object by reference and mutate variables (such as I'm used to)... I think that I have just asked this question prematurely and that I really need to delve further into the functional paradigm before I can expect to really understand the answers to my questions... I guess what i was looking for was how to write a function or something, taking a list and an item, and returning a list under the same name so the function could be called more than once, without changing the name every time (as if it was actually a program which would add actual orders to an order list, and the user wouldn't have to think of a new name for the list each time, but rather append an item to the same list).

    Read the article

  • Changing an Action Type="click" to an auto action in SVG

    - by Dustin Myers
    I have a SVG document that I exported from Visio 2003 that would like to edit. This file has an action where you click a button it will navigate to a new screen. What I would like to do is have the navigation be based off of a data point rather than having to click the button. As an example I have a dynamic point data being brought into the SVG file and when that value changes from 0 to 1, I want this screen to automatically navigate to another screen. Below is the code I for clicking the button. <title content="structured text">Sheet.1107</title> <desc content="structured text">Button 1</desc> <v:custProps> <v:cp v:ask="false" v:langID="1033" v:invis="false" v:cal="0" v:val="VT4(Test Graphic 2)" v:type="0" v:prompt="" v:nameU="ObjRef" v:sortKey="" v:lbl="" v:format=""/> <v:cp v:ask="false" v:langID="1033" v:invis="false" v:cal="0" v:val="VT4(SF-S)" v:type="0" v:prompt="" v:nameU="DataPt" v:sortKey="" v:lbl="" v:format=""/> </v:custProps> <v:userDefs> <v:ud v:prompt="" v:nameU="NAVIGATE" v:val="VT4(NAVIGATE Test Graphic 2,&apos;&apos;,)"/> </v:userDefs> <v:textBlock v:margins="rect(4,4,4,4)"/> <v:textRect width="125.01" height="35" cx="62.5" cy="517.5"/> <rect x="0" width="125" y="500" height="35" class="st3"/> <text x="40.15" y="521.1" v:langID="1033" class="st4"><v:paragraph v:horizAlign="1"/><v:tabList/>Button 1</text> <jci:action type="click" count="1">if(evt.button == 0) nav(&apos;Test Graphic 2&apos;,&apos;&apos;,&apos;&apos;);</jci:action></g></a> In the above code I am bringing in the data value from SF-S. Once that value is equal to 1 I want this screen to automatically navigate to Test Graphic 2. I don't have any experience with coding so I am hoping someone here will be able to help me. Thanks, DMyers

    Read the article

  • How can I create a simple message box in Python?

    - by Carson Myers
    I'm looking for the same effect as alert() in JavaScript. I wrote a simple web-based interpreter this afternoon using Twisted.web. You basically submit a block of Python code through a form, and the client comes and grabs it and executes it. I want to be able to make a simple popup message, without having to re-write a whole bunch of boilerplate wxPython or TkInter code every time (since the code gets submitted through a form and then disappears). I've tried tkMessageBox: import tkMessageBox tkMessageBox.showinfo(title="Greetings", message="Hello World!") but this opens another window in the background with a tk icon. I don't want this. I was looking for some simple wxPython code but it always required setting up a class and entering an app loop etc. Is there no simple, catch-free way of making a message box in Python?

    Read the article

  • Shortcut to create automatic properties using Visual Studio 2008/2010 or Resharper 5

    - by Piers Myers
    I have a class that contains a load of properties that contain results of some calculations e.g: public class Results { public double Result1 { get; set; } public double Result2 { get; set; } } In a different class I am doing calculations to populate the above properties, e.g: public class Calc { private Results Calc() { Results res = new Results(); res.Result1 = ... some calculation res.Result2 = ... some other calculation res.Result3 = ... // not yet defined in 'Results' class return res; } } When I am writing the Calc class, 'Result3' will be highlighted in red as it is not yet defined in the 'Results' class. Currently I am using the Resharper ALT-Enter shortcut, selecting "Create Property 'Result3'" which will create the following code int the 'Results' class: public double Result3 { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } Which I need to manually change to: public double Result3 { get; set; } Then I use the CTRL-Shift-Backspace shortcut to take me back to the 'Calc' class. How can I easily create automatic properties in the 'Results' class if they are not yet defined directly from the 'Calc' class?

    Read the article

  • Floating Tables Problem Unwanted Space XHTML Strict

    - by Axel Myers
    Hi I have two floating tables side by side. One is set to float left, the other one is set to float right. The problem is when two table are floating, they both are out of flow so next table comes without any spacing. So I add a width attribute clear:both. But now it gave me a lot of unwanted space! it's height set to:0 (the div's) and nothing has changed. So what's the problem ? Website url: http://www.animetr.com/prv/

    Read the article

  • How do I handle the messages for a simple web-based live chat, on the server side?

    - by Carson Myers
    I'm building a simple live chat into a web application running on Django, but one thing I'm confused about is how I should store the messages between users. The chat will support multiple users, and a chat "session" is composed of users connected to one user that is the "host." The application is a sort of online document collaboration thing, so user X has a document, and users Y and Z would connect to user X to talk about the document, and that would be one chat session. If user Y disconnected for five minutes, and then signed back in and reconnected to user X, he should not get any of the messages shared between users X and Z while he was away. if users X, Y, and Z can have a chat session about user X's document, then users X and Y can connect to a simultaneous, but separate discussion about user Z's document. How should I handle this? Should I keep each message in the database? Each message would have an owner user and a target user (the host), and a separate table would be used to connect users with messages (which messages are visible to what users). Or should I store each session as an HTML file on the server, which messages get appended to? The problem is, I can't just send messages directly between clients. They have to be sent to the server in a POST request, and then each client has to periodically check for the messages in a GET request. Except I can't just have each message cleared after a client fetches it, because there could be multiple clients. How should I set this up? Any suggestions?

    Read the article

  • accessing private variable from member function in PHP

    - by Carson Myers
    I have derived a class from Exception, basically like so: class MyException extends Exception { private $_type; public function type() { return $this->_type; //line 74 } public function __toString() { include "sometemplate.php"; return ""; } } Then, I derived from MyException like so: class SpecialException extends MyException { private $_type = "superspecial"; } If I throw new SpecialException("bla") from a function, catch it, and go echo $e, then the __toString function should load a template, display that, and then not actually return anything to echo. This is basically what's in the template file <div class="<?php echo $this->type(); ?>class"> <p> <?php echo $this->message; ?> </p> </div> in my mind, this should definitely work. However, I get the following error when an exception is thrown and I try to display it: Fatal error: Cannot access private property SpecialException::$_type in C:\path\to\exceptions.php on line 74 Can anyone explain why I am breaking the rules here? Am I doing something horribly witty with this code? Is there a much more idiomatic way to handle this situation? The point of the $_type variable is (as shown) that I want a different div class to be used depending on the type of exception caught.

    Read the article

  • associating a filetype with a batch script, and getting parameters passed to file of that type.

    - by Carson Myers
    Sorry for the cryptic title. I have associated python scripts with a batch file that looks like this: python %* I did this because on my machine, python is installed at C:\python26 and I prefer not to reinstall it (for some reason, it won't let me add a file association to the python interpreter. I can copy the executable to Program Files and it works -- but nothing out of Program Files seems to work). Anyways, I can do this, so far: C:\py django-admin C:\py python "C:\python26\Lib\site-packages\django\bin\django-admin.py" Type 'django-admin.py help' for usage. C:\py django-admin startproject myProj C:\py python "C:\python26\Lib\site-packages\django\bin\django-admin.py" Type 'django-admin.py help' for usage. but the additional parameters don't get passed along to the batch script. This is getting very annoying, all I want to do is run python scripts :) How can I grab the rest of the parameters in this situation?

    Read the article

  • Is it acceptable to wrap PHP library functions solely to change the names?

    - by Carson Myers
    I'm going to be starting a fairly large PHP application this summer, on which I'll be the sole developer (so I don't have any coding conventions to conform to aside from my own). PHP 5.3 is a decent language IMO, despite the stupid namespace token. But one thing that has always bothered me about it is the standard library and its lack of a naming convention. So I'm curious, would it be seriously bad practice to wrap some of the most common standard library functions in my own functions/classes to make the names a little better? I suppose it could also add or modify some functionality in some cases, although at the moment I don't have any examples (I figure I will find ways to make them OO or make them work a little differently while I am working). If you saw a PHP developer do this, would you think "Man, this is one shoddy developer?" Additionally, I don't know much (or anything) about if/how PHP is optimized, and I know that usually PHP performace doesn't matter. But would doing something like this have a noticeable impact on the performance of my application?

    Read the article

  • How should I build a simple database package for my python application?

    - by Carson Myers
    I'm building a database library for my application using sqlite3 as the base. I want to structure it like so: db/ __init__.py users.py blah.py etc.py So I would do this in Python: import db db.users.create('username', 'password') I'm suffering analysis paralysis (oh no!) about how to handle the database connection. I don't really want to use classes in these modules, it doesn't really seem appropriate to be able to create a bunch of "users" objects that can all manipulate the same database in the same ways -- so inheriting a connection is a no-go. Should I have one global connection to the database that all the modules use, and then put this in each module: #users.py from db_stuff import connection Or should I create a new connection for each module and keep that alive? Or should I create a new connection for every transaction? How are these database connections supposed to be used? The same goes for cursor objects: Do I create a new cursor for each transaction? Create just one for each database connection?

    Read the article

  • Adding variably named fields to Python classes

    - by Carson Myers
    I have a python class, and I need to add an arbitrary number of arbitrarily long lists to it. The names of the lists I need to add are also arbitrary. For example, in PHP, I would do this: class MyClass { } $c = new MyClass(); $n = "hello" $c.$n = array(1, 2, 3); How do I do this in Python? I'm also wondering if this is a reasonable thing to do. The alternative would be to create a dict of lists in the class, but since the number and size of the lists is arbitrary, I was worried there might be a performance hit from this. If you are wondering what I'm trying to accomplish, I'm writing a super-lightweight script interpreter. The interpreter walks through a human-written list and creates some kind of byte-code. The byte-code of each function will be stored as a list named after the function in an "app" class. I'm curious to hear any other suggestions on how to do this as well.

    Read the article

  • Overloading assignment operator in C#

    - by Carson Myers
    I know the = operator can't be overloaded, but there must be a way to do what I want here: I'm just creating classes to represent quantitative units, since I'm doing a bit of physics. Apparently I can't just inherit from a primitive, but I want my classes to behave exactly like primitives -- I just want them typed differently. So I'd be able to go, Velocity ms = 0; ms = 17.4; ms += 9.8; etc. I'm not sure how to do this. I figured I'd just write some classes like so: class Power { private Double Value { get; set; } //operator overloads for +, -, /, *, =, etc } But apparently I can't overload the assignment operator. Is there any way I can get this behavior?

    Read the article

  • Adding a method to a function object at runtime

    - by Carson Myers
    I read a question earlier asking if there was a times method in Python, that would allow a function to be called n times in a row. Everyone suggested for _ in range(n): foo() but I wanted to try and code a different solution using a function decorator. Here's what I have: def times(self, n, *args, **kwargs): for _ in range(n): self.__call__(*args, **kwargs) import new def repeatable(func): func.times = new.instancemethod(times, func, func.__class__) @repeatable def threeArgs(one, two, three): print one, two, three threeArgs.times(7, "one", two="rawr", three="foo") When I run the program, I get the following exception: Traceback (most recent call last): File "", line 244, in run_nodebug File "C:\py\repeatable.py", line 24, in threeArgs.times(7, "one", two="rawr", three="foo") AttributeError: 'NoneType' object has no attribute 'times' So I suppose the decorator didn't work? How can I fix this?

    Read the article

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