Search Results

Search found 323 results on 13 pages for 'shaun murphy'.

Page 11/13 | < Previous Page | 7 8 9 10 11 12 13  | Next Page >

  • Only the last run in a for loop in Javascript works

    - by Mengfei Murphy
    Here is a for loop written by Javascript. It is trying to apply queries for websql. for (var i = 0; i < 10; i++){ db.transaction(function (tx){ tx.executeSql('INSERT INTO ProjSetsT (ProjID) VALUES (?);', [i]); }); } The attempt is obvious, I tried to add values "0, 1, 2, ... 9" into column ProjID in table ProjSetsT. It does not work. I only got the last element, i.e. "9" inserted, but not the first eight numbers. Is there any syntax mistakes?

    Read the article

  • How do I implement something like pointers in javascript?

    - by Shaun
    I know that javascript doesn't have pointers in terms of a variable referring to a place in memory but what I have is a number of variables which are subject to change and dependent on each other. For example: Center (x,y) = (offsetLeft + width/scale , offsetTop + height/scale) As of now I have rewritten the equation in terms of each individual variable and after any changes I call the appropriate update function. For example: If scale changes, then then the center, height, and width stay the same. So I call updateoffset() { offsetLeft = centerx - width/scale; offsetTop = centery - height/scale; } Is this the easiest way to update each of these variables when any of them changes?

    Read the article

  • Calling a subclass method from a superclass

    - by Shaun
    Preface: This is in the context of a Rails application. The question, however, is specific to Ruby. Let's say I have a Media object. class Media < ActiveRecord::Base end I've extended it in a few subclasses: class Image < Media def show # logic end end class Video < Media def show # logic end end From within the Media class, I want to call the implementation of show from the proper subclass. So, from Media, if self is a Video, then it would call Video's show method. If self is instead an Image, it would call Image's show method. Coming from a Java background, the first thing that popped into my head was 'create an abstract method in the superclass'. However, I've read in several places (including Stack Overflow) that abstract methods aren't the best way to deal with this in Ruby. With that in mind, I started researching typecasting and discovered that this is also a relic of Java thinking that I need to banish from my mind when dealing with Ruby. Defeated, I started coding something that looked like this: def superclass_method # logic this_media = self.type.constantize.find(self.id) this_media.show end I've been coding in Ruby/Rails for a while now, but since this was my first time trying out this behavior and existing resources didn't answer my question directly, I wanted to get feedback from more-seasoned developers on how to accomplish my task. So, how can I call a subclass's implementation of a method from the superclass in Rails? Is there a better way than what I ended up (almost) implementing?

    Read the article

  • How to create a compact Qt4 vBoxLayout

    - by Gearoid Murphy
    Hello all, I've got a vBoxLayout which contains 3 simple buttons, when I increase the size of the widget containing the layout, the spacing between the buttons increases. I would like to stop this behaviour and keep the buttons in a consistent and compact layout, regardless of the size of the parent widget. This is what I've got so far, but it doesn't change the spacing, any suggestions?, thanks. button_layout = new QVBoxLayout ; button_layout -> setSpacing(0); button_layout -> setContentsMargins(0,0,0,0);

    Read the article

  • C# socket blocking behavior

    - by Gearoid Murphy
    My situation is this : I have a C# tcp socket through which I receive structured messages consisting of a 3 byte header and a variable size payload. The tcp data is routed through a network of tunnels and is occasionally susceptible to fragmentation. The solution to this is to perform a blocking read of 3 bytes for the header and a blocking read of N bytes for the variable size payload (the value of N is in the header). The problem I'm experiencing is that occasionally, the blocking receive operation returns a partial packet. That is, it reads a volume of bytes less than the number I explicitly set in the receive call. After some debugging, it appears that the number of bytes it returns is equal to the number of bytes in the Available property of the socket before the receive op. This behavior is contrary to my expectation. If the socket is blocking and I explicitly set the number of bytes to receive, shouldn't the socket block until it recv's those bytes?, any help, pointers, etc would be much appreciated.

    Read the article

  • CheckedState inconsisten in Treeview using Find Method

    - by M Murphy
    Hello, I'm using a Treeview control in a .NET 3.5 c# project and I'm noticing inconsistencies in the checked property when I use the find method of the Treeview control. I'll check some leaves (nodes with no children) and then click a button. Inside the button click I'm using the find method of the treeview control to locate the node and interrogate the value of the checked property. On screen the leaf will be checked but according to the checked property of the node returned from the Find method its not checked. Has anyone else run into this? Thanks

    Read the article

  • Autorelease with elements in a UITableViewCell - memory leak

    - by Shaun Budhram
    In my 'cellForRowAtIndexPath' method for a UITableView delegate, I'm allocating a cell if it doesn't exist, and in this cell, I'm creating a new activity spinner like so: UIActivityIndicatorView *actView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray ] autorelease]; I'm using Leaks to detect memory leaks in my program, and for some reason, this is coming up as a leak, even though it's autoreleasing. The cell itself is also autoreleasing. Has anyone had experience with autoreleasing variables coming up as leaks in the Leaks instrument, and how to tackle these problems? Also, if it helps, this is the history Leaks is displaying for this memory location. It looks like it at some point gets an additional retain message? This is not being done in my code.

    Read the article

  • Search dir using wildcard string, return filename, and loop.

    - by Charlie Murphy
    Hello all, I'm having some problems, and looking for some help. I'm trying to create a photo gallery in javascript, that will be able to 'update' it's self automatically. I need to be able to search a directory, and grab a file with a specific prefix. I need to output the followng HTML code: <li><a href="images/resize_FILENAME.ext"><img src="images/thumb_FILENAME.ext"></a></li> The 'resize_' and 'thumb_' use a timestamp to identify, so they have the same ending, just a different prefix. So, for example, if I search the directory for an image with a prefix of 'resize_', I need to insert that into the a tag, and then remove the '_resize' prefix, and add the '_thumb' prefix for the img tag. I then need to be able to do that for each image in the directory. Any help would be greatly appreciated. Oh, I should add: I'm assuming php would be easiest for this, but if an alternative exists that would work too. I'm also using jQuery if javascript would be better.

    Read the article

  • Get Rails to save a record to the database in a non-UTC time

    - by Shaun
    Is there a way to get Rails to save records to the database without it automagically converting the timestamp into UTC before saving? The problem is that I have a few models that pull data from a legacy database that saves everything in Mountain Time and occasionally I have to have my Rails app write to that database. The problem is that every time it does, it converts the time I give it from Mountain Time to UTC, which is 6-7 hours ahead (depending on DST)! Needless to say, this really messes with reporting on that database. If I could get around doing this, I would. Unfortunately, I can't do anything about the fact that this other database uses a different timezone, nor can I really get away from the need for this app to save to that database occasionally. If I could just get Rails to stop trying to help me, it'd be great.

    Read the article

  • How do you work on Strategic Development initiatives when Tactical work takes priority?

    - by Shaun F
    My day-to-day job consists of maintaining large volume websites and this has given me exposure to developing better methods to develop and maintain the code. This has also given me a large body of knowledge in the code base in terms of troubleshooting that is beneficial to the company. I'm also the maintainer of an IDE plug in I created to help navigate and generate code that is used. Operationally though, my job is to handle any client requests that come in of that are emergencies and make any enhancements and additions to the code base required. This work, along with the daily managing and feeding of the the project managers will take up my entire day. How does one manage the time between the tactical day job and the strategic initiatives? How does one get and ask for recognition for taking strategic initiatives? Is the 8-9 hour day just not going to cut it? Is there even a job out there for programmers to develop strategic initiatives and solutions for a company? I want to also point out that this isn't a problem with the company at all. I think this is more of a personal-improvement decision. Nobody will say no to the improvements at all. I believe in making the things happen but I don't think I'm going to get time from the company to do it...

    Read the article

  • listing network shares with python

    - by Gearoid Murphy
    Hello, if I explicitly attempt to list the contents of a shared directory on a remote host using python on a windows machine, the operation succeeds, for example, the following snippet works fine: os.listdir("\\\\remotehost\\share") However, if I attempt to list the network drives/directories available on the remote host, python fails, an example of which is shown in the following code snippet: os.listdir("\\\\remotehost") Is anyone aware of why this doesn't work?, any help/workaround is appreciated.

    Read the article

  • Getting the last User ID in Zend Framework

    - by Ryan Murphy
    Using MySQL query browser, I manually made a table called users and input some date in the fields. I set the primary key to id and set it to auto increment. There are 3 rows, the highest id is 3. I then made the following class in the method directory to call upon the data in the table etc. class Application_Model_DbTable_User extends Zend_Db_Table_Abstract { protected $_name = 'user'; public function getLatestUserId() { $id = $this->getAdapter()->lastInsertId(); return $id; } } In the controller I do the following which gets the value generated by the method and lets the view access it: $usersDbModel = new Application_Model_DbTable_User(); $lastUserId = $usersDbModel->getLatestUserId(); $this->view->lastUserId = $lastUserId; In the view I then echo it to display it to the user: echo $this->lastUserId; However, even though my last id in the users table is 3. It displays 0. I have also tried: public function getLatestUserId() { $sql = 'SELECT max(id) FROM user'; $query = $this->query($sql); $result = $query->fetchAll(); return $result; } But this just throws out a server error. What have I done wrong? Am I missing something? Is there another way of doing this?

    Read the article

  • Python function argument scope (Dictionaries v. Strings)

    - by Shaun Meyer
    Hello, given: foo = "foo" def bar(foo): foo = "bar" bar(foo) print foo # foo is still "foo"... foo = {'foo':"foo"} def bar(foo): foo['foo'] = "bar" bar(foo) print foo['foo'] # foo['foo'] is now "bar"? I have a function that has been inadvertently over-writing my function parameters when I pass a dictionary. Is there a clean way to declare my parameters as constant or am I stuck making a copy of the dictionary within the function? Thanks!

    Read the article

  • Does ASP.NET Make Request Scheduling Decisions Based Upon SessionID?

    - by Mike Murphy
    I know that a properly implemented SessionStateStoreProvider maintains an exclusive lock on session data for the duration of a request. However, considering that multiple requests could arrive simultaneously (e.g. via IFRAMEs) all but one would be able to make forward progress. All the other requests would block for a bit and reduce the number of worker threads available during that time. It seems if ASP.NET "peeked" at the session IDs on the requests early on, it could avoid running requests simultaneously that were on the same session. This would improve throughput under load for pages that didn't want to give up using IFRAMEs. This seems plausible enough that it might be true.

    Read the article

  • Why do Java and C# not have implicit conversions to boolean?

    - by Shaun
    Since I started Java it's been very aggravating for me that it doesn't support implicit conversions from numeric types to booleans, so you can't do things like: if (flags & 0x80) { ... } instead you have to go through this lunacy: if ((flags & 0x80) != 0) { ... } It's the same with null and objects. Every other C-like language I know including JavaScript allows it, so I thought Java was just moronic, but I've just discovered that C# is the same (at least for numbers, don't know about null/objects): http://msdn.microsoft.com/en-us/library/c8f5xwh7(VS.71).aspx Microsoft changed it on purpose from C++, so why? Clearly I'm missing something. Why change (what I thought was) the most natural thing in the world to make it longer to type? What on Earth is wrong with it?

    Read the article

  • How to refactor models without breaking WPF views?

    - by Tim Murphy
    I've just started learning WPF and like the power of databinding it presents; that is ignoring the complexity and confusion for a noob. My concern is how do you safely refactor your models/viewmodels without breaking the views that use them? Take the following snippet of a view for example: <Grid> <ListView ItemsSource="{Binding Contacts}"> <ListView.View> <GridView> <GridViewColumn Header="First Name" DisplayMemberBinding="{Binding Path=FirstName}"/> <GridViewColumn Header="Last Name" DisplayMemberBinding="{Binding Path=FirstName}"/> <GridViewColumn Header="DOB" DisplayMemberBinding="{Binding Path=DateOfBirth}"/> <GridViewColumn Header="# Pets" DisplayMemberBinding="{Binding Path=NumberOfPets}"/> <GridViewColumn Header="Male" DisplayMemberBinding="{Binding Path=IsMale}"/> </GridView> </ListView.View> </ListView> </Grid> The list is bound to the Contacts property, IList(Of Contact), of the windows DataSource and each of the properties for a Contact is bound to a GridViewColumn. Now if I change the name of the NumberOfPets property in the Contact model to PetCount the view will break. How do I prevent the view breaking?

    Read the article

  • Scoping two models on approved

    - by Shaun Frost Duke Jackson
    I have three models (Book,Snippet,User) and I'd like to create a scope for where(:approved = true) I'm doing this so I can use the merit gem to define ranking based on count of approved. I'm thinking that writing this as a scope might be to complex but I don't know as I've just started leaning scopes. I've currently got this in my Book & Snippet Model: scope :approved, -> { where(approved: true) } I've playing around with this in my user model but I don't think it's correct: scope :approved, joins(:books && :snippets) Could anyone help start me off or give me some suggestions on what to read?

    Read the article

  • pagerAnchorBuilder - trying to add classes

    - by Bert Murphy
    I'm using Cycle2 to build a carousel gallery and I've run into a little problem regarding styling the pager buttons. What I've gathered is that Cycle2 creates its own pager span tags for each slide which is a bummer becaus I've already styled my the sub-nav markup. This should be a minor issue as long as I can assign individual classes to the spans and change my css accordingly. However, I can't get this to work. TLDR: I was hoping that I could use pagerAnchorBuilder to create individual classes for each span. I can't. Help. The original markup (pre Cycle2) looks like the following: <div id ="sub-nav" class="sub-nav"> <ul> <li><a id="available" class="available" href="#"></a></li> <li><a id="reliable" class="reliable" href="#"></a></li> <li><a id="use" class="use" href="#"></a></li> <li><a id="reports" class="reports" href="#"></a></li> <li class="last"><a id="software" class="software" href="#"></a></li> </ul> </div> With Cycle2 it looks like this (note the addition of the span tags) <div id ="sub-nav" class="sub-nav"> <ul> <li><a id="available" class="available" href="#"></a></li> <li><a id="reliable" class="reliable" href="#"></a></li> <li><a id="use" class="use" href="#"></a></li> <li><a id="reports" class="reports" href="#"></a></li> <li class="last"><a id="software" class="software" href="#"></a></li> </ul> <span class="cycle-pager-active">•</span><span>•</span><span>•</span><span>•</span><span>•</span></nav> </div> Cycle2 $('#sliding-gallery ul').cycle({ fx: 'carousel', carouselVisible: 1, speed: 'fast', timeout: 10000, slides: '>li', next: '.next', prev: '.prev', pager: '.sub-nav', pagerAnchorBuilder: function(idx, slide) { return '.sub-nav span:eq(' + idx + ')'; } });

    Read the article

  • How to move a Mercurial repository created on a local PC to a web server?

    - by Tim Murphy
    I have created and committed to Mercurial repository that was created on my local drive. I now have a remote Windows 2003 web server setup to serve repositories via hgwebdir.cgi. How do I move the locally created repository to the web server? It looks like an ftp of the .hg folder on the local drive to the remote web server does the trick. Am I doing it the right way. Is there a more efficient way?

    Read the article

< Previous Page | 7 8 9 10 11 12 13  | Next Page >