Search Results

Search found 11954 results on 479 pages for 'gets'.

Page 12/479 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • running "./script" gets syntax error after import statements, but "python script" works fine

    - by nzomkxia
    I'm doing something with the sys.argv in python here is the code: age1.py import datetime import os import sys if len(sys.argv) == 2: now_time = datetime.datetime.now() future_time = now_time + datetime.timedelta(int(sys.argv[1])) print "date in", sys.argv[1],"days",future_time elif len(sys.argv) == 4: print "three paras" spe_time = datetime.datetime(int(sys.argv[1]),int(sys.argv[2]),int(sys.argv[3])) now_time = datetime.datetime.now() diff_time = now_time - spe_time print "days since then..." , diff_time if I run the code in bash like: python age1.py xxxx, the program goes fine but if I run that like ./age1.py xxxx, the mouse will become a symbol like "+", then the program ends up with: "./age1.py: line 5: syntax error near unexpected token `sys.argv' ./age1.py: line 5: `if len(sys.argv) == 2:' system: Ubuntu 10.10 Python 2.7.3 any reason for that?

    Read the article

  • cvs to mercurial conversion gets tags wrong

    - by Mark Borgerding
    I've tried all the recommended conversion techniques Mostly they manage to get the latest version of the files right, but every one of them trashes my history. Many (most?) of the tags from my cvs project have at least one file in error when I run "hg up $tag" My cvs repo is not all that complicated. Why can't anything convert it? I'd like to dump cvs and convert to mercurial, but not without history. To recap my frustration: I tried hg convert (tried --branchsort,--timesort, fuzz=0) I tried cvs2svn and then hg convert. tailor does not work with recent versions of mercurial fromcvs disappeared from the face of the earth hg-cvs-import has been abandoned for 4 years and doesn't work with recent versions of hg I have tried using the two most recent versions of mercurial ( 1.5 and 1.5.1 ).

    Read the article

  • Embedded media player gets inconsistent currentPosition on both IE8 and Firefox3

    - by logoin
    I have a embedded media player in the browser that is controlled by javascript to handle all the mediaChange event. The code looks like mediaChangeHandler: function(media) { if (media && this.offset && !this.offsetJumpPerformed) { if (parseFloat(media.duration) > this.offset) { pos = parseInt(pos); this.getPlayer().controls.currentPosition = pos; alert("jump to position: " + this.getPlayer().controls.currentPosition); this.play(); this.offsetJumpPerformed = true; alert("currentPosition:" + this.getPlayer().controls.currentPosition); } } } The first alert indicates the currentPosition is where I want it to be. However, the second alert would get currentPosition that's couple seconds less than what I have set up. Does anyone have idea why? I tried googled it but haven't found anything useful. Thanks!

    Read the article

  • Form gets disposed somehow

    - by mnn
    I have a client-server application, in which I use classic Sockets and threads for receiving/sending data and listening for clients. The application works fine, but after some random time I get the ObjectDisposedException: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'MainForm'. at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous) at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args) at System.Windows.Forms.Control.Invoke(Delegate method) That code is called from client Socket thread and I use Invoke() method to run the code on UI thread. I'm sure that I don't manually dispose the form nor using Close() (form is closed by user clicking Close button), so I don't know what could cause its disposing.

    Read the article

  • Thinking Sphinx - sorting by a string attribute gets out of sync when changes are made

    - by Scott Brown
    I have a "restaurants" table with a "name" column. I've defined the following index: indexes "REPLACE(UPPER(restaurants.name), 'THE ', '')", :as => :restaurant_name, :sortable => true ... because I want to sort the restaurant names without respect to the prefix "The ". My problem is that whenever one of these records is updated (in any way) the new record jumps to the top of the sort order. If another record is updated, it also jumps ahead of the rest. I end up with two lists: a list of restaurants that have been updated since the last re-indexing and a list of those that haven't. Each respective list is in alphabetical order, but I don't understand why the overall list is getting segregated this way. I do have a delayed delta index set up, and I assume the issue is related to this.

    Read the article

  • How Linux system monitor gets process stats

    - by paultop6
    Hi all, Im making a simple alternative to the default linux system monitor. Im looking to know how it lifts the process stats, which is displays in the Processes tab. It probably runs off /proc, but im unsure. Also, where could i find the source code for the system monitor program? Regards Paul

    Read the article

  • CM_Get_Device_ID gets correct values from win7 but not xp

    - by Jon W. Jones
    When using CM_Get_Device_ID(...) I am getting the correct value from windows 7. When using windows xp I am getting an incorrect value. For Example, on xp I get "USB\VID_2132&PID_0001\5&36FF4167&0&7" and on 7 I get "USB\VID_2132&PID_0001\413031000576". The value after the \ on PID is our serial number and it is correct on 7 but xp keeps giving back what appears to be a nonsensical value. My question is has anyone else encountered this and know of a workaround?

    Read the article

  • Change column height as other column gets longer

    - by Infiniti Fizz
    Hi, I have tried a few things to solve this problem but I can't seem to get it working. The problem is that I have 2 columns as the main part of my website, right and left. On some pages, there is a lot of text in the left column, therefore it is very long, the problem is that the right column doesn't elongate with the left column. Both columns have the same background colour and a footer s displayed across the width of both columns after the columns finish. My first thought was to put both columns inside a div which would have the same background colour as them and therefore if the left column became 1500px long in total and the right column stayed at around 600px (due to the elements inside it) then this wouldn't show as the new, outer div would elongate along with the left column. But for some reason this didn't work. Could it be because the columns are floated? Does anyone have any other ideas? Here is the website (Obviously not finished yet): Beansheaf Hotel I have chosen a page where there is a lot of text in the left column so the problem is apparent. Thanks in advance, InfinitiFizz

    Read the article

  • jquery live event gets executed twice

    - by victor_foster
    I am loading content into a page with ajax that will have live click events attached to them. It seems like the first time I load this content everything works as expected. If I load this again, the events fire twice (when put breakpoints in the code). What am I doing wrong? Is there a way I can clear the dom of these elements before they get loaded again?

    Read the article

  • C# System.IO.FileInfo gets virtual address which has sessions key

    - by Anicho
    Okay so the following line returns null because its path cannot be found: System.IO.FileInfo fi = di.GetFiles()[position]; What I am currently doing is: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <ctl:Gallery runat="server" ID="Gallery1" FolderUrl="~/images/1/" Size="100" /> When this is invoked System.IO.FileInfo fi = di.GetFiles()[position]; it has the value similar to this: C:\Users\SomeUsername\Desktop\Tiamo\(S(mr1h0l55ycuixfbtqxbmttek))\images\1 Any idea how I can return the virtual path without actually having the session key in there? Thank you in advanced for any help you may give :) much appreciated.

    Read the article

  • Derby gets stuck closing?

    - by bmargulies
    I've got unit tests (in maven) that use derby. At the end of the test run, there is a very long pause, with these log messages before the pause. INFO: Closing Hibernate SessionFactory Nov 16, 2009 8:30:31 PM org.hibernate.impl.SessionFactoryImpl close INFO: closing Nov 16, 2009 8:30:31 PM org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: Running hbm2ddl schema export Nov 16, 2009 8:30:31 PM org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: exporting generated schema to database Hibernate config: <hibernate-configuration> <session-factory> <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property> <property name="hbm2ddl.auto">create-drop</property> <property name="show_sql">false</property> </session-factory> </hibernate-configuration> referenced from: <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- data source elsewhere --> <property name="dataSource" ref="dataSource" /> <property name="mappingResources"> <list> <value>com/basistech/configdb/dao/Gazetteer.hbm.xml</value> <value>com/basistech/configdb/dao/FileGazetteer.hbm.xml</value> <value>com/basistech/configdb/dao/Regexpset.hbm.xml</value> <value>com/basistech/configdb/dao/Redactjoiner.hbm.xml</value> <value>com/basistech/configdb/dao/Misc.hbm.xml</value> </list> </property> <property name="configLocation" value="classpath:com/basistech/configdb/dao/hibernate.xml"/> and finally maven: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.2</version> <executions> <execution> <id>codegen</id> <goals> <goal>hbm2java</goal> </goals> <phase>generate-sources</phase> <configuration> <components> <component> <name>hbm2java</name> </component> </components> <componentProperties> <configurationfile>src/main/hibernate/codegen-hibernate.xml</configurationfile> </componentProperties> </configuration> </execution> </executions> </plugin>

    Read the article

  • foldmethod=indent gets confused

    - by intuited
    Normally a great boon to humanity, on occasion vim's indent-based folding will get confused and need a reset via :set foldmethod=indent. Symptoms include the appearance of consecutive folded lines in the window. Is there a way to avoid having this happen? Is it just me?

    Read the article

  • Troubles with list "dropdowns" and which list item gets the dropdown

    - by Andrew
    I'm working on a project for an MMO "guild" that gives members of the guild randomly generated tasks for the game. They can "block" three tasks from being assigned. The lists will look something like this: <ul> <li class="blocked">Task that is blocked</li> <li class="blocked-open">Click to block a task</li> <li class="blocked-open">Click to block a task</li> </ul> The blocked-open class means they haven't chosen a task to block yet. The blocked task means they've already blocked a task. When they click the list item, I want this to appear: <ul class="tasks-dropdown no-display"> <li><h1>Click a Task to Block</h1></li> <ul class="task-dropdown-inner"> <?php //output all tasks foreach($tasks as $task) { echo '<li class="blocked-option"><span id="'.$task.'">'.$task.'</span></li>'; } ?> <br class="clear" /> </ul> </ul> I don't quite know how, when the user clicks the .blocked-open line-item, to show that dropdown under only the one they clicked. My jQuery looked like this before I became confused. $("li.blocked-open").click(function() { $("ul.no-display").slideToggle("900"); }); $(".blocked-option span").click(function() { var task = $(this).attr('id'); alert("You have blocked: " + task); location.reload(true); }); I tested it by putting the dropdown under a line item in the code, and it worked fine, but when I have more than one dropdown in the code, clicking on one line item toggles all the dropdowns. I'm not sure what to do. :-p.

    Read the article

  • JavaScript on jQuery created code never gets called

    - by mare
    This is my view in ASP.NET MVC. <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Administration.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server"> <script type="text/javascript"> var ddlContentTypes; $(document).ready(function () { ddlContentTypes = $("#ContentTypes"); ddlContentTypes.bind("change", loadCreate); loadCreate(); }); function loadCreate() { var typeId = $("#ContentTypes option:selected").val(); $.get('~/' + typeId + '/Create', function (data) { $("#CreateForm").html(data); }); $("fieldset input").each(function (index, item) { $(item).attr("disabled", true); }); } </script> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server"> <h2> <%=Resources.Localize.CreateWidget %></h2> <p> <% Html.RenderPartial("ContentTypeSelector"); %></p> <div id="CreateForm"> </div> </asp:Content> As you can see, it loads some HTML (actually user control) and adds it to the CreateForm div. This actually works fine. The problem is this $("fieldset input").each(function (index, item) { $(item).attr("disabled", true); }); never runs. The fieldset tag is in the response, so you don't see it here but it's there - everything is returned back fine (I checked with Firebug). Why do the above two lines of JS never run or have any effect?

    Read the article

  • Hadoop reduce task gets hung

    - by user806098
    I set up a hadoop cluster with 4 nodes, When running a map-reduce task, the map task finishes quickly, while the reduce task hangs at 27% percent. I checked the log, it's that the reduce task fails to fetch map output from map nodes. The job tracker log of master shows messages like this: 2011-06-27 19:55:14,748 INFO org.apache.hadoop.mapred.JobTracker: Adding task (REDUCE) 'attempt_201106271953_0001_r_000000_0' to tip task_201106271953_0001_r_000000, for tracker 'tracker_web30.bbn.com.cn:localhost/127.0.0.1:56476' And the name node log of master shows messages like this: 2011-06-27 14:00:52,898 INFO org.apache.hadoop.ipc.Server: IPC Server handler 4 on 54310, call register(DatanodeRegistration(202.106.199.39:50010, storageID=DS-1989397900-202.106.199.39-50010-1308723051262, infoPort=50075, ipcPort=50020)) from 192.168.225.19:16129: error: java.io.IOException: verifyNodeRegistration: unknown datanode 202.106.199.3 9:50010 However, neither the "web30.bbn.com.cn" or 202.106.199.39, 202.106.199.3 is the slave node. I think such ip/domains appear because hadoop fails to resolve a node(first in the Intranet DNS server), then it goes to a higher-level DNS server, later to the top, still fails, then the "junk" ip/domains are returned. But I checked my config, it goes like this: /etc/hosts: 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.225.16 master 192.168.225.66 slave1 192.168.225.20 slave5 192.168.225.17 slave17 conf/core-site.xml: hadoop.tmp.dir /root/hadoop_tmp/hadoop_${user.name} fs.default.name hdfs://master:54310 io.sort.mb 1024 hdfs-site.xml: dfs.replication 3 masters: master slaves: master slave1 slave5 slave17 Also, all firewalls(iptables) are turned off, and ssh between each 2 nodes is ok. so I don't know where exact the error comes from. Please help. Thanks a lot.

    Read the article

  • Alarm not working if application gets killed

    - by Tobia Loschiavo
    Hi, I am trying to use an alarm to set my widget layout after some minutes. Everything works correctly in normal situation but, if I try to delete the process of my application, simulating a system kill, after the alarm is set, then no alarm is executed. Why? From documentation it seems that alarms are executed by AlarmManager service...so it should work. Thanks Tobia Loschiavo

    Read the article

  • Nothing gets displayed when debugging Microsoft Surface

    - by leftend
    I am trying to write my first Microsoft Surface application, and am doing the development on the Surface unit itself. I successfully re-created the quick "Photos" application that is shown on the PDC Video, however, now that I'm trying to create my own app - nothing actually shows up when I run it. I'm mainly just adding ScatterViews right now - and they show up fine in the designer, but as soon as I hit F5 - the shell is shown on the surface - but none of the ScatterViews show up. Here's my xaml code so far. Am I missing something?? <s:SurfaceWindow x:Class="SurfaceUITreeDemo.TreeDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="http://schemas.microsoft.com/surface/2008" Title="WYITT Tree Demo" AllowsTransparency="False" Background="Beige"> <s:SurfaceWindow.Resources> <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/TreeDemoBackground.jpg"/> </s:SurfaceWindow.Resources> <Grid Background="{StaticResource WindowBackground}" > <s:ScatterView Name="test"> <Image Source="C:\dev\Network-Alt-icon.png"/> </s:ScatterView> <s:ScatterView Height="100" Margin="456,160,348,0" Name="scatterView1" VerticalAlignment="Top" Background="Black"> <s:ScatterViewItem Height="100" Width="150"> <Image Source="C:\dev\Network-Alt-icon.png"/> </s:ScatterViewItem> <s:ScatterViewItem></s:ScatterViewItem> ScatterView </s:ScatterView> </Grid> </s:SurfaceWindow>

    Read the article

  • UpdateModel not working consistently for me if a ddl gets hidden by jQuery

    - by awrigley
    Hi My jQuery code hides a ddl under certain circumstances. When this is the case, after submitting the form, using the UpdateModel doesn't seem to work consistently. My code in the controller: // POST: /IllnessDetail/Edit [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(IllnessDetail ill) { IllnessDetailFormViewModel mfv = new IllnessDetailFormViewModel(ill); if (ModelState.IsValid) { try { IllnessDetail sick = idr.GetLatestIllnessDetailByUsername(User.Identity.Name); UpdateModel(sick); idr.Save(); return RedirectToAction("Current", "IllnessDetail"); } catch { ModelState.AddRuleViolations(mfv.IllnessDetail.GetRuleViolations()); } } return View(new IllnessDetailFormViewModel(ill)); } I have only just started with MVC, and working under a deadline, so am still hazy as to how UpdateModel works. Debugging seems to reveal that the correct value is passed in to the action method: public ActionResult Edit(IllnessDetail ill) And the correct value is put into sick in the following line: IllnessDetailFormViewModel mfv = new IllnessDetailFormViewModel(ill); However, when all is said, done and returned to the client, what displays is the value of: sick.IdInfectiousAgent instead of the value of: ill.IdInfectiousAgent The only reason I can think of is that the ddlInfectiousAgent has been hidden by jQuery. Or am I barking up the wrong lamp post? Andrew

    Read the article

  • SerialVersionUID with "private static final long" still gets InvalidClassException

    - by Buggieboy
    I have compiled and jarred the various projects in my Java application, generating serialVersionUIDs automatically through Eclipse for all my classes derived from Serializable. I read the answers to this question, and verified that serialVersionUids are all private static final long. Nevertheless, I get an error like this when I try to run: java.io.InvalidClassException: com.acme.product.Widget; local class incompatible: stream classdesc serialVersionUID = 5226096973188250357, local class serialVersionUID = -5432967318654384362 What am I missing?

    Read the article

  • JUnit: checking if a void method gets called

    - by nkr1pt
    I have a very simple filewatcher class which checks every 2 seconds if a file has changed and if so, the onChange method (void) is called. Is there an easy way to check ik the onChange method is getting called in a unit test? code: public class PropertyFileWatcher extends TimerTask { private long timeStamp; private File file; public PropertyFileWatcher(File file) { this.file = file; this.timeStamp = file.lastModified(); } public final void run() { long timeStamp = file.lastModified(); if (this.timeStamp != timeStamp) { this.timeStamp = timeStamp; onChange(file); } } protected void onChange(File file) { System.out.println("Property file has changed"); } } @Test public void testPropertyFileWatcher() throws Exception { File file = new File("testfile"); file.createNewFile(); PropertyFileWatcher propertyFileWatcher = new PropertyFileWatcher(file); Timer timer = new Timer(); timer.schedule(propertyFileWatcher, 2000); FileWriter fw = new FileWriter(file); fw.write("blah"); fw.close(); Thread.sleep(8000); // check if propertyFileWatcher.onChange was called file.delete(); }

    Read the article

  • iphone Memory gets freed in debug mode but not in release mode

    - by gdr
    I have been testing my iPhone debug build on both my device and simulator with activity monitor, leaks, and object allocations. The code is pretty well optimized so I have decided to test the release build. I went into the project Menu and set the target build to be release, I then added the necessary header paths that my app is using to the headers search paths and ran the release build on the device with the above mentioned instruments. What I have noticed now is that memory that was freed when I used the debug build does not get freed when using release version. There is one place in my App that I remove a scroll view with some images which frees up a significant amount of memory when I use the debug build, but no memory is freed up in that place when I use the release version. Does someone have any ideas where I need to start looking at? did I setup my release build wrong?

    Read the article

  • Google App Engine with local Django 1.1 gets Intermittent Failures

    - by Jon Watte
    I'm using the Windows Launcher development environment for Google App Engine. I have downloaded Django 1.1.2 source, and un-tarrred the "django" subdirectory to live within my application directory (a peer of app.yaml) At the top of each .py source file, I do this: import settings import os os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' In my file settings.py (which lives at the root of the app directory, as well), I do this: DEBUG = True TEMPLATE_DIRS = ('html') INSTALLED_APPS = ('filters') import os os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' from google.appengine.dist import use_library use_library('django', '1.1') from django.template import loader Yes, this looks a bit like overkill, doesn't it? I only use django.template. I don't explicitly use any other part of django. However, intermittently I get one of two errors: 1) Django complains that DJANGO_SETTINGS_MODULE is not defined. 2) Django complains that common.html (a template I'm extending in other templates) doesn't exist. 95% of the time, these errors are not encountered, and they randomly just start happening. Once in that state, the local server seems "wedged" and re-booting it generally fixes it. What's causing this to happen, and what can I do about it? How can I even debug it? Here is the traceback from the error: Traceback (most recent call last): File "C:\code\kwbudget\edit_budget.py", line 34, in get self.response.out.write(t.render(template.Context(values))) File "C:\code\kwbudget\django\template\__init__.py", line 165, in render return self.nodelist.render(context) File "C:\code\kwbudget\django\template\__init__.py", line 784, in render bits.append(self.render_node(node, context)) File "C:\code\kwbudget\django\template\__init__.py", line 797, in render_node return node.render(context) File "C:\code\kwbudget\django\template\loader_tags.py", line 71, in render compiled_parent = self.get_parent(context) File "C:\code\kwbudget\django\template\loader_tags.py", line 66, in get_parent raise TemplateSyntaxError, "Template %r cannot be extended, because it doesn't exist" % parent TemplateSyntaxError: Template u'common.html' cannot be extended, because it doesn't exist And edit_budget.py starts with exactly the lines that I included up top. All templates live in a directory named "html" in my root directory, and "html/common.html" exists. I know the template engine finds them, because I start out with "html/edit_budget.html" which extends common.html. It looks as if the settings module somehow isn't applied (because that's what adds html to the search path for templates).

    Read the article

  • Question about gets and sets and when to use super classes

    - by Nazgulled
    Hi, I have the following get method: public List<PersonalMessage> getMessagesList() { List<PersonalMessage> newList = new ArrayList<PersonalMessage>(); for(PersonalMessage pMessage : this.listMessages) { newList.add(pMessage.clone()); } return newList; } And you can see that if I need to change the implementation from ArrayList to something else, I can easily do it and I just have to change the initialization of newList and all other code that depends on what getMessageList() returns will still work. Then I have this set method: public void setMessagesList(ArrayList<PersonalMessage> listMessages) { this.listMessages = listMessages; } My question is, should I use List instead of `ArrayList in the method signature? I have decided to use ArrayList because this way I can force the implementation I want, otherwise there could be a mess with different types of lists here and there. But I'm not sure if this is the way to go...

    Read the article

  • Socket.recv works but not gets or read?

    - by Earlz
    Hello I've been messing around with Sockets in Ruby some and came across some example code that I tried modifying and broke. I want to know why it's broken. Server: require "socket" dts = TCPServer.new('127.0.0.1', 20000) loop do Thread.start(dts.accept) do |s| print(s, " is accepted\n") s.write(Time.now) print(s, " is gone\n") s.close end end Client that works: require 'socket' streamSock = TCPSocket.new( "127.0.0.1", 20000 ) streamSock.print( "Hello\n" ) str = streamSock.recv( 100 ) print str streamSock.close Client that is broken require 'socket' streamSock = TCPSocket.new( "127.0.0.1", 20000 ) streamSock.print( "Hello\n" ) str=streamSock.read #this line modified print str streamSock.close I know that the streamSock.print is unnecessary (as well as the naming scheme being non-ruby) but I don't understand why read doesn't work while recv does, Why is this?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >