Daily Archives

Articles indexed Wednesday March 24 2010

Page 16/131 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Error: "an object reference is required for the non-static field, method or property..."

    - by user300484
    Hi! Im creating an application on C#. Its function is to evualuate if a given is prime and if the same swapped number is prime as well. When I build my solution on Visual Studio, it says that "an object reference is required for the non-static field, method or property...". Im having this problem with the "volteado" and "siprimo" methods. Can you tell me where is the problem and how i can fix it? thank you! namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.Write("Write a number: "); long a= Convert.ToInt64(Console.ReadLine()); // a is the number given by the user long av = volteado(a); // av is "a" but swapped if (siprimo(a) == false && siprimo(av) == false) Console.WriteLine("Both original and swapped numbers are prime."); else Console.WriteLine("One of the numbers isnt prime."); Console.ReadLine(); } private bool siprimo(long a) {// evaluate if the received number is prime bool sp = true; for (long k = 2; k <= a / 2; k++) if (a % k == 0) sp = false; return sp; } private long volteado(long a) {// swap the received number long v = 0; while (a > 0) { v = 10 * v + a % 10; a /= 10; } return v; } } }

    Read the article

  • j2ee deployment error

    - by Rajesh
    hi im new to j2ee.. the problem is while deploying a particular project i'm getting deployment error like "module has not been deployed".. but i'm able to deploy other projects... the error shown is as follows In-place deployment at F:\onlineexam_1\build\web deploy?path=F:\onlineexam_1\build\web&name=onlineexam_1&force=true failed on GlassFish v3 Domain F:\onlineexam_1\nbproject\build-impl.xml:577: The module has not been deployed. BUILD FAILED (total time: 3 seconds) pls assist me to overcome this problem Thnx in advance Raj

    Read the article

  • jQuery to get the text attribute of a checkbox

    - by Andriyev
    Hi I'm adding a check box to a page using the following statement; <script language="C#" runat="server"> protected void Page_Load ( object src, EventArgs e ) { if (!IsPostBack) { CheckBox XChkBox = new CheckBox(); //instance of System.Web.UI.WebControls.CheckBox XChkBox.ID = "someId" XChkBox.Text = "someText" somePlaceHolder.Controls.Add(XChkBox); } } </script> I need to get the Text attribute of that check box on click. I tried $(this).attr('Text'); inside $('input[type=checkbox]').click(function(){}); but it returns undefined. Where am I going wrong? Please suggest. cheers

    Read the article

  • Calling method on category included from iPhone static library causes NSInvalidArgumentException

    - by Corey Floyd
    I have created a static library to house some of my code like categories. I have a category for UIViews in "UIView-Extensions.h" named Extensions. In this category I have a method called: - (void)fadeOutWithDelay:(CGFloat)delay duration:(CGFloat)duration; Calling this method works fine on the simulator on Debug configuration. However, if try to run the app on the device I get a NSInvalidArgumentException: [UIView fadeOutWithDelay:duration:]: unrecognized selector sent to instance 0x1912b0 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIView fadeOutWithDelay:duration:]: unrecognized selector sent to instance 0x1912b0 It seems for some reason UIView-Extensions.h is not being included in the device builds. What I have checked/tried I did try to include another category for NSString, and had the same issue. Other files, like whole classes and functions work fine. It is an issue that only happens with categories. I did a clean all targets, which did not fix the problem. I checked the static library project, the categories are included in the target's "copy headers" and "compile sources" groups. The static library is included in the main projects "link binary with library" group. Another project I have added the static library to works just fine. I deleted and re-added the static library with no luck -ObjC linker flag is set Any ideas? nm output libFJSCodeDebug.a(UIView-Extensions.o): 000004d4 t -[UIView(Extensions) changeColor:withDelay:duration:] 00000000 t -[UIView(Extensions) fadeInWithDelay:duration:] 000000dc t -[UIView(Extensions) fadeOutWithDelay:duration:] 00000abc t -[UIView(Extensions) firstResponder] 000006b0 t -[UIView(Extensions) hasSubviewOfClass:] 00000870 t -[UIView(Extensions) hasSubviewOfClass:thatContainsPoint:] 000005cc t -[UIView(Extensions) rotate:] 000002d8 t -[UIView(Extensions) shrinkToSize:withDelay:duration:] 000001b8 t -[UIView(Extensions) translateToFrame:delay:duration:] U _CGAffineTransformRotate 000004a8 t _CGPointMake U _CGRectContainsPoint U _NSLog U _OBJC_CLASS_$_UIColor U _OBJC_CLASS_$_UIView U ___CFConstantStringClassReference U ___addsf3vfp U ___divdf3vfp U ___divsf3vfp U ___extendsfdf2vfp U ___muldf3vfp U ___truncdfsf2vfp U _objc_enumerationMutation U _objc_msgSend U _objc_msgSend_stret U dyld_stub_binding_helper

    Read the article

  • Python class design - Splitting up big classes into multiple ones to group functionality

    - by Ivo Wetzel
    OK I've got 2 really big classes 1k lines each that I currently have split up into multiple ones. They then get recombined using multiple inheritance. Now I'm wondering, if there is any cleaner/better more pythonic way of doing this. Completely factoring them out would result in endless amounts of self.otherself.do_something calls, which I don't think is the way it should be done. To make things clear here's what it currently looks like: from gui_events import GUIEvents # event handlers from gui_helpers import GUIHelpers # helper methods that don't directly modify the GUI # GUI.py class GUI(gtk.Window, GUIEvents, GUIHelpers): # general stuff here stuff here One problem that is result of this is Pylint complaining giving me trillions of "init not called" / "undefined attribute" / "attribute accessed before definition" warnings.

    Read the article

  • Rack middleware deadlock

    - by Joel
    I include this simple Rack Middleware in a Rails application: class Hello def initialize(app) @app = app end def call(env) [200, {"Content-Type" => "text/html"}, "Hello"] end end Plug it in inside environment.rb: ... Dir.glob("#{RAILS_ROOT}/lib/rack_middleware/*.rb").each do |file| require file end Rails::Initializer.run do |config| config.middleware.use Hello ... I'm using Rails 2.3.5, Webrick 1.3.1, ruby 1.8.7 When the application is started in production mode, everything works as expected - every request is intercepted by the Hello middleware, and "Hello" is returned. However, when run in development mode, the very first request works returning "Hello", but the next request hangs. Interrupting webrick while it is in the hung state yields this: ^C[2010-03-24 14:31:39] INFO going to shutdown ... deadlock 0xb6efbbc0: sleep:- - /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31 deadlock 0xb7d1b1b0: sleep:J(0xb6efbbc0) (main) - /usr/lib/ruby/1.8/webrick/server.rb:113 Exiting /usr/lib/ruby/1.8/webrick/server.rb:113:in `join': Thread(0xb7d1b1b0): deadlock (fatal) from /usr/lib/ruby/1.8/webrick/server.rb:113:in `start' from /usr/lib/ruby/1.8/webrick/server.rb:113:in `each' from /usr/lib/ruby/1.8/webrick/server.rb:113:in `start' from /usr/lib/ruby/1.8/webrick/server.rb:23:in `start' from /usr/lib/ruby/1.8/webrick/server.rb:82:in `start' from /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb:14:in `run' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from script/server:3 Something to do with the class reloader in development mode. There is also mention of deadlock in the exception. Any ideas what might be causing this? Any recommendations as to the best approach to debug this?

    Read the article

  • dojo.xhrPost and Zend Framwork action, no POST data, not using a form

    - by sims
    Hi all, I'm trying to send some data via dojo.xhrPost to an Zend Controller Action. I can see the data being sent in Firebug console. However, when inspecting the post data, the array is empty. I'm not sure if it is possible to send an arbitrary string of data via dojo.xhrPost without using a form. This is probably a very n00b mistake. In any case, I'll post my code here and see what you all think. In my layout script I have: <?php $sizeurl = $this->baseUrl() . '/account/uisize'; ?> function resizeText(multiplier) { if (document.body.style.fontSize == "") { document.body.style.fontSize = "1.0em"; } document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.1) + "em"; var size = document.body.style.fontSize; var xhrArgs = { url: "<?= $sizeurl; ?>", postData: size, handleAs: "text" } dojo.xhrPost(xhrArgs); } Then my action is: public function uisizeAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); print_r($_POST); $request = $this->getRequest(); if ($request->isXmlHttpRequest()) { $postdata = $request->getPost(); print_r($postdata); if ($postdata) { $user = new Application_Model_DbTable_User(); $user->updateSize($postdata); } } } I'm pretty sure that post data from a form is an array with the form elements' names as the keys. When looking at the dojo.xhrPost examples on the dojo campus web site (http://docs.dojocampus.org/dojo/xhrPost second one to be precise), it looks as if I can just send a string of data. How do I access this data from a Zend Controller Action? I'm using ZF 1.10 and Dojo 1.4.2 Thanks for your help! PS I'd try to ask on one of the related questions, but I cannot seem to comment.

    Read the article

  • Can Anyone point me to a Android Market catalog or application list.

    - by Doug
    I'm up and running in Eclipse, have worked through several tutorials and would like to start developing my first marketable app. Is there anyplace I can find a comprehensive list or catalog of what's available on the Android marketplace? I'd hate to waste a lot of development time building an app that has twelve free versions already available.

    Read the article

  • loops and conditionals inside triggers

    - by Ying
    I have this piece of logic I would like to implement as a trigger, but I have no idea how to do it! I want to create a trigger that, when a row is deleted, it checks to see if the value of one of its columns exists in another table, and if it does, it should also perform a delete on another table based on another column. So say we had a table Foo that has columns Bar, Baz. This is what id be doing if i did not use a trigger: function deleteFromFooTable(FooId) { SELECT (Bar,Baz) FROM FooTable WHERE id=FooId if not-empty(SELECT * FROM BazTable WHERE id=BazId) DELETE FROM BarTable WHERE id=BarId DELETE FROM FooTable WHERE id=FooId } I jumped some hoops in that pseudo code, but i hope you all get where im going. It seems what i would need is a way to do conditionals and to loop(in case of multiple row deletes?) in the trigger statement. So far, I haven't been able to find anything. Is this not possible, or is this bad practice? Thanks!

    Read the article

  • Transfer of control and data between C and C#

    - by Prithvi
    C# main program needs to call a C program GA.c This C code executes many functions and one function initialize() calls objective() function. But this objective function needs to be written in C#.This call is in a loop in the C code and the C code needs to continue execution after the return from objective() until its main is over and return control to C# main program. C# main() { //code call to GA in C; //remaining code; } GA in C: Ga Main() { //code call to initialize function(); //remaining code } initialize funtion() in GA { for(some condition) { //code call to objective(parameter) function in C#; //code } } How do we do this?

    Read the article

  • Django and Secure iCalendar Feed

    - by agoessling
    I would like to create a secure iCalendar Feed with Django. I currently have a feed working using vobject, but it is accesable to the public. Is there a way to secure a iCalendar feed used by iCal, Google Calendar, and Outlook?

    Read the article

  • Converting John Resig's JavaScript Templating Engine to work with PHP Templates

    - by Serhiy
    I'm trying to convert the John Resig's Templating Engine to work with PHP. Essentially what I would like to achieve is the ability to use certain Kohana Views via a JavaScript templating engine, that way I can use the same views for both a standard PHP request and a jQuery AJAX request. I'm starting with the basics and would like to be able to convert http://github.com/nje/jquery-tmpl/blob/master/jquery.tmpl.js To work with php like so... ### From This ### <li><a href="{%= link %}">{%= title %}</a> - {%= description %}</li> ### Into This ### <li><a href="<?= $link ?>"><?= $title ?></a> - <?= description ?></li> The RexEx in it is a bit over my head and it's apparently not as easy as changing the %} to ? in lines 148 to 158. Any help would be highly appreciated. I'm also not sure of how to take care of the $ difference that PHP variables have. Thanks, Serhiy

    Read the article

  • XElement Path Validation

    - by cw
    Hello, I am trying to validate Elements and Attributes exist in an XElement. Basically, I was wondering if anyone had a generic way to check if a give path is null. I don't have access to System.Xml.XPath (doing this for compact framework). Basically what I have is: <root value"1000"> <element1>test<element1> <element2>1<element2> .... <element30> <subElement1>stuff</subElement1> </element30> </root> Now I know you can "if this is null do this and that". But since there is upwards of 30 elements that can be under root, which are optional elements, I need a way to grab the value if it exists and convert it to the correct type (which I know) in a nice compact way. Any suggestions?

    Read the article

  • Target iframe Raphael Js

    - by user299343
    Ive been trying to target iframe using Raphael JS heres some sample code var c = paper.circle(10, 10, 10); c.attr({href: "http://google.com/", target: "top"}); v var t = paper.text(250, 50, "Raphaël\nkicks\nbutt!"); t.attr({href: "http://google.com/", target: "_blank"}); Also..cant get href to work with text ar t = paper.text(50, 50, "Raphaël\nkicks\nbutt!"); t.attr({href: "http://google.com/", target: "_blank"});

    Read the article

  • Windows Desktop Virtualization Gets Easier

    - by andrewbrust
    This past Thursday, Microsoft announced that Windows (7) Virtual PC (WVPC) and its XP Mode feature would no longer require hardware assisted virtualization (HAV).  That means any PC running Windows 7 Pro, or higher, can now run this software.  And that’s a great thing because, as I noted in a post almost five month ago, determining whether a given PC you might be planning to buy actually offers HAV can be extremely difficult.  That meant even dedicated, sophisticated PC users, with a budget for new hardware, might be blocked from using this technology.  And that was just plain silly. One of the features offered by WVPC, and utilized heavily by XP Mode, is the concept of virtual applications: apps within a guest VM that can actually run within the host’s desktop environment.  I find this feature so powerful that my February Redmond Review column entertained the notion of a future version of Windows that runs all applications in this manner. The elimination of the HAV requirement for XP Mode and WVPC was just one of many virtualization-related announcements Microsoft made on Thursday.  And, interestingly, most of the others were also desktop-related, rather than server-related.  This is a welcome change from the multi-year period in which Microsoft enhanced its server virtualization lineup (in Hyper-V) and let the desktop platform fester.  Microsoft now seems to understand desktop virtualization is in high-demand and strengthens the Windows franchise.  As I explained in the column, even cloud computing can have a desktop spin if desktop virtualization is part of the equation. One company that knows this well is Citrix, and a closer alliance between Microsoft and Citrix was one of the many announcements from Thursday.  In fact, there’s a whole Web site dedicated to the alliance at http://www.citrixandmicrosoft.com/. I’d love to see virtual applications and entire virtual desktops offered as Azure-branded services.  This could allow me to run, for example, the full Office client on a variety of desktops I might use, and for large organizations it could easily reduce the expense, burden and duration of the deployment cycle for new versions of Office.  Business Intelligence providers, including my own firm, twentysix New York, would find great relief in enabling their customers to run the newest version of Excel, with the latest BI capabilities, instead of having to wait the requisite two to three years it takes for many Fortune 500 customers to upgrade. Microsoft should do more, and faster.  WVPC still does not support 64-bit guest images, even on 64-bit hosts.  That needs to be fixed.  File access from the guest to the host needs to be improved (right now, it’s done through Terminal Services/Remote Desktop file sharing, and it’s slow) and VM load times need to be significantly reduced before virtualized apps can become the norm.  (I suppose the advance of solid state drive technology will help there.) I do think these improvements will come, because Microsoft is focused on the virtual desktop now.  And that’s a smart focus to have.

    Read the article

  • How to setup linux permissions the WWW folder?

    - by Xeoncross
    Updated Summery The /var/www directory is owned by root:root which means that no one can use it and it's entirely useless. Since we all want a web server that actually works (and no-one should be logging in as "root"), then we need to fix this. Only two entities need access. PHP/Perl/Ruby/Python all need access to the folders and files since they create many of them (i.e. /uploads/). These scripting languages should be running under nginx or apache (or even some other thing like FastCGI for PHP). The developers How do they get access? I know that someone, somewhere has done this before. With however-many billions of websites out there you would think that there would be more information on this topic. I know that 777 is full read/write/execute permission for owner/group/other. So this doesn't seem to be needed as it leaves random users full permissions. What permissions are need to be used on /var/www so that... Source control like git or svn Users in a group like "websites" (or even added to "www-data") Servers like apache or lighthttpd And PHP/Perl/Ruby can all read, create, and run files (and directories) there? If I'm correct, Ruby and PHP scripts are not "executed" directly - but passed to an interpreter. So there is no need for execute permission on files in /var/www...? Therefore, it seems like the correct permission would be chmod -R 1660 which would make all files shareable by these four entities all files non-executable by mistake block everyone else from the directory entirely set the permission mode to "sticky" for all future files Is this correct? Update: I just realized that files and directories might need different permissions - I was talking about files above so i'm not sure what the directory permissions would need to be. Update 2: The folder structure of /var/www changes drastically as one of the four entities above are always adding (and sometimes removing) folders and sub folders many levels deep. They also create and remove files that the other 3 entities might need read/write access to. Therefore, the permissions need to do the four things above for both files and directories. Since non of them should need execute permission (see question about ruby/php above) I would assume that rw-rw-r-- permission would be all that is needed and completely safe since these four entities are run by trusted personal (see #2) and all other users on the system only have read access. Update 3: This is for personal development machines and private company servers. No random "web customers" like a shared host. Update 4: This article by slicehost seems to be the best at explaining what is needed to setup permissions for your www folder. However, I'm not sure what user or group apache/nginx with PHP OR svn/git run as and how to change them. Update 5: I have (I think) finally found a way to get this all to work (answer below). However, I don't know if this is the correct and SECURE way to do this. Therefore I have started a bounty. The person that has the best method of securing and managing the www directory wins.

    Read the article

  • How can I broadcast video live (preferably wirelessly)?

    - by Blixt
    Update I've gotten plenty of feedback on the software solutions and the unanimous solution for having a handheld device to record video seems to be to use a mobile phone (I was hoping there'd be some webcam-like device with wifi support...) I'd appreciate more hardware suggestions now. That is, what mobile phones have good video recording quality (and battery time)? I'm looking for a solution to broadcast video live on the internet from a location (an apartment), with a device that can be carried around. What options are there? I'm looking for complete solutions (i.e., what hardware to use, what software to use, how it should all be set up.) Currently, I have my mobile phone (Nokia N95 8GB) with Qik installed connected to wifi, but unfortunately the videos get bad quality (especially since it's indoors with poor lighting) plus the battery gets used up quickly.

    Read the article

  • Free video capture programs for windows 7?

    - by chobo2
    I want to record my screen to make a tutorial. I tried to use camStudio but it goes all weird after a couple mins. Like I am recording then all of a sudden a popup from windows says that all the memory for colors is being used and it will stop using areo. Then a few mins later my screen starts going nuts and it starts flashing green. So I am not sure what to record and I can't afford to buy Camtasia.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >