Search Results

Search found 5180 results on 208 pages for 'outside'.

Page 46/208 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • C# naming convention for enum and matching property

    - by Serge - appTranslator
    Hi All, I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict? public class Car { public enum Status { Off, Starting, Moving }; Status status = Status.Off; public Status Status // <===== Won't compile ===== { get { return status; } set { status = value; DoSomething(); } } } If the Status enum were common to different types, I'd put it outside the class and the problem would be solved. But Status applies to Car only hence it doesn't make sense to declare the enum outside the class. What naming convention do you use in this case? NB: This question was partially debated in comments of an answer of this question. Since it wasn't the main question, it didn't get much visibility. EDIT: Filip Ekberg suggests an IMO excellent workaround for the specific case of 'Status'. Yet I'd be interesting to read about solutions where the name of the enum/property is different, as in Michael Prewecki's answer. EDIT2 (May 2010): My favorite solution is to pluralize the enum type name, as suggested by Chris S. According to MS guidelines, this should be used for flag enums only. But I've come to like it more and more. I now use it for regular enums as well.

    Read the article

  • python NameError: name '<anything>' is not defined (but it is!)

    - by BenjaminGolder
    Note: Solved. It turned out that I was importing a previous version of the same module. It is easy to find similar topics on StackOverflow, where someone ran into a NameError. But most of the questions deal with specific modules and the solution is often to update the module. In my case, I am trying to import a function from a module that I wrote myself. The module is named InfraPy, and it is definitely on sys.path. One particular function (called listToText) in InfraPy returns a NameError, but only when I try to import it into another script. Inside InfraPy, under if __name__=='__main__':, the listToText function works just fine. From InfraPy I can import other functions with no problems. Including from InfraPy import * in my script does not return any errors until I try to use the listToText function. How can this occur? How can importing one particular function return a NameError, while importing all the other functions in the same module works fine? Using python 2.6 on MacOSX 10.6, also encountered the same error running the script on Windows 7, using IronPython 2.6 for .NET 4.0 Thanks. If there are other details you think would be helpful in solving this, I'd be happy to provide them. As requested, here is the function definition inside of InfraPy: def listToText(inputList, folder=None, outputName='list.txt'): ''' Creates a text file from a list (with each list item on a separate line). May be placed in any given folder, but will otherwise be created in the working directory of the python interpreter. ''' fname = outputName if folder != None: fname = folder+'/'+fname f = open(fname, 'w') for file in inputList: f.write(file+'\n') f.close() This function is defined above and outside of if __name__=='__main__': I've tried moving InfraPy around in relation to the script. The most baffling situation is that when InfraPy is in the same folder as the script, and I import using from InfraPy import listToText, I receive this error: NameError: name listToText is not defined. Again, the other functions import fine, they are all defined outside of if __name__=='__main__': in InfraPy.

    Read the article

  • C# client to Java web service

    - by tomislavg
    I have received wsdl file from outside company. I'm using VS2005 c#. With wsdl.exe I have created class containing methods and types for the given web service. To connect to the service outside company requires that certificate from the smart card is inputed in the header. I think i have achieved this with service.ClientCertificates.Add("Path to exported cert" - at least for now, after probably later i will take it from Certificate Store When service is called there are three steps that are taken and visible by the Fidller(Web Debugging Proxy)). service is called on the url http://test.company.com/webservice.wsdl service redirects the request to certificate server and pin needs to be inputed to get cookie for the server service is again redirected to url http://test.company.com/webservice.wsdl At point 1. I can see that my request send to the server contains .... but at point 3. i can not see request` just a empty string. The exception is thrown Msg: Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. Does somebody have an example how to connect to java web service with certificate and AlowRedirect enabled for the web service? Any ideas what i am doing wrong are more that welcome.

    Read the article

  • Debugging in VS 2008 locks a stored procedure

    - by larryq
    Hi everyone, I've got a strange one here. I have a .Net executable that, under the hood, calls a few stored procedures. For whatever reason, one of the stored procs hangs when I'm debugging. If I run the executable outside of visual studio things go fine, including this stored proc. It's when I'm debugging that this hangs, and it really hangs. If I stop the debugging session the IDE freezes and I have to kill it via taskmanager. I know which stored procedure has the trouble, as well as the actual statement within it that's the problem. It's calling an update statement that doesn't stand out as particularly special. I can run the identical statement (and the stored procedure itself) from SQL management studio wtih no problem. And, as I mentioned, the exe runs just fine outside the debugger. If I use the SQL activity monitor to see why things are hanging, the wait type says PREEMPTIVE_DEBUG. I'm not sure if that's helpful but if you need more info I'll try to get it to you. I've rebooted my machine (the SQL Server in question is on this box as well) and that didn't do anything, nor did rebuilding the executable. I'm scratching my head on this one and if you have any ideas what to check on next, I'm be happy to listen. Thanks!

    Read the article

  • Matlab - Propagate points orthogonally on to the edge of shape boundaries

    - by Graham
    Hi I have a set of points which I want to propagate on to the edge of shape boundary defined by a binary image. The shape boundary is defined by a 1px wide white edge. I also have the coordinates of these points stored in a 2 row by n column matrix. The shape forms a concave boundary with no holes within itself made of around 2500 points. I want to cast a ray from each point from the set of points in an orthogonal direction and detect at which point it intersects the shape boundary at. What would be the best method to do this? Are there some sort of ray tracing algorithms that could be used? Or would it be a case of taking orthogonal unit vector and multiplying it by a scalar and testing after multiplication if the end point of the vector is outside the shape boundary. When the end point of the unit vector is outside the shape, just find the point of intersection? Thank you very much in advance for any help!

    Read the article

  • Javascript "this" variable confusion

    - by Assaf M
    Hi I am currently reading the book "Javascript: The Good Parts" and was playing with Functions. I produced a test script to test some properties and I am somewhat confused by the results. Here is the code: <h3>Object</h3> <div style="padding-left: 10px;"> <script type="text/javascript"> function outterF() { document.writeln("outterF.this = " + this + "<br>"); function innerF() { document.writeln("innerF.this = " + this + "<br>"); return this; }; var inner = innerF(); return this; } document.writeln("<b>From Inside:</b><br>"); var outF = outterF(); var inF = outF.inner; document.writeln("<br>"); document.writeln("<b>From Outside:</b><br>"); document.writeln("outterF.this = " + outF + "<br>"); document.writeln("innerF.this = " + inF + "<br>"); </script> </div> Result is: Object From Inside: outterF.this = [object Window] innerF.this = [object Window] From Outside: outterF.this = [object Window] innerF.this = undefined Notice that outF.inner returns "undefined", is that some kind of a language bug? Obviously, outF.inner points to Window object that has nothing to do with my object but shouldn't it be at least pointing to a Function object instead? Thanks -Assaf

    Read the article

  • h:commandButton action not working inside a h:datatable.

    - by Chris
    I'm stuck with this piece of jsf code that I don't understand why it's working when used outside a datatable and doesn't inside a datatable... <h:dataTable id="myTable" rendered="true" value="#{bean.selectedItemsList}" var="items"> <h:column> <h:commandButton action="#{bean.removeItemFromList}" image="/resources/images/deleterow.gif"> <f:actionListener binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/> </h:commandButton> </h:column> <h:column> <h:outputText value="#{items}" /> </h:column> </h:dataTable> I read around the net to put value="#{items}" inside the action listener so the action can get the items in the row like this: <f:actionListener value="#{items}" binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/> But it's doesn't work either. Bu if I do the action outside the data table everything work fine. <h:commandButton action="#{bean.removeItemFromList}" image="/resources/images/deleterow.gif"> <f:actionListener binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/> </h:commandButton> Side note I also tried a4j:commandButton and didn't so I guess my problem is probably the actionlistener or how the bean handling it.

    Read the article

  • Ajax Javascript method cannot be called

    - by blackmage
    I made this method to load javascript functions dynamically. It does include the .js file but when I call a method, the method says that it is undefinited. The following to .js files are ajax_object.js and user_manager.js . The alert outside the function is read and works but the alert inside does not. enter code here //ajax_object.js //Load a javascript library function loadJavascript( src, url ){ XMLHttpRequestObject=getXmlHttpRequestObject(); if( XMLHttpRequestObject){ XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 ){ if (XMLHttpRequestObject.status == 200 || XMLHttpRequestObject.status == 304) { includeJavaScript( src, url, XMLHttpRequestObject.responseText ); } } } } XMLHttpRequestObject.open('GET', url, true); XMLHttpRequestObject.send(null); }//end LoadJavaScript //Add Library to header function includeJavaScript(src, fileUrl, xmlObject) { if ( ( xmlObject != null ) && ( !document.getElementById( src ) ) ){ var documentHead = document.getElementsByTagName('HEAD').item(0); var includeScript = document.createElement( "script" ); includeScript.language = "javascript"; includeScript.type = "text/javascript"; //includeScript.id = src; includeScript.src=fileUrl.concat(src); includeScript.defer = true; includeScript.text = xmlObject; documentHead.appendChild( includeScript ); } } //user_manager.js //First alert is read alert("Outside User Manager"); function selectUserManagerModuleType(){ XMLHttpRequestObject=getXmlHttpRequestObject(); //This doesn't work //throws selectUserManagerModuleType undefined alert("Inside The User Manager"); }

    Read the article

  • Colorbox does not refresh its contents when I change URL

    - by Josef Sábl
    I am trying to make use of Colorbox on my webpage. One specific feature does not work as expected, though. In their example (Outside Webpage - Iframe specifically) Google appears in the Colorbox when clicked. When you change href on that link (Using Firebug or JavaScript, e.g.) to, let's say, Yahoo, it works as expected and Yahoo is displayed after click. But not in my case. Once I click the link, I have no way to change the URL. Href, as displayed in browser, changes (to Yahoo), but click always opens the first page (Google). What might be the problem? I almost copy-pasted their example: <script src="/lib/jquery.js"></script> <script src="/lib/jquery.colorbox.js"></script> <p><a class='example7' href="http://yahoo.com">Outside Webpage (Iframe)</a></p> <script> $(document).ready(function(){ $(".example7").colorbox({width:"80%", height:"80%", iframe:true}); }); </script> My jquery version is 1.4.1 but I also tried same version as their example uses (1.3.2)

    Read the article

  • Monotouch threads, GC, WCF

    - by cvista
    Hi This is a question about best practices i guess but it applies directly to my current MT project. I'm using WCF services to communicate with the server. To do this i do the following: services.MethodToCall(params); and the asynch: services.OnMethodToCallCompleted += delegate{ //do stuff and ting }; This can lead to issues if you're not careful in that variables defined within the scope of the asynch callback can sometimes be cleaned up by the gc and this can cause crashes. So - I am making it a practice to declare these outside of the scope of the callback unless I am 100% sure they are not needed. Now - when doing stuff and ting implies changing the ui - i wrap it all in an InvokeOnMainThread call. I guess wrapping everything in this would slow the main thread down and rubbish the point of having multi threads. Even though I'm being careful about all this i am still getting crashes and I have no idea why! I am certain it has something to do with threads, scope and all that. Now - the only thing I can think of outside of updating the UI that may need to happen inside of InvokeOnMainThread is that I have a singleton 'Database' class. This is based on the version 5 code from this thread http://www.yoda.arachsys.com/csharp/singleton.html So now if the service method returns data that needs to be added/updated to the Database class -I also wrap this inside an InvokeOnMainThread call. Still getting random crashes. So... My question is this: I am new to thick client dev - I'm coming from a web dev perspective where we don't need to worry about threads so much :) Aside from what I have mentioned -are there any other things I should be aware of? Is the above stuff correct? Or am i miss-understanding something? Cheers w://

    Read the article

  • Object addSubview only works in viewDidLoad

    - by DecodingSand
    Hi, I'm new to iPhone dev and need some help with adding subViews. I have a reusable object that I made that is stored in a separate .h .m and xib file. I would like to use this object in my main project's view controller. I have included the header and the assignment of the object generates no errors. I am able to load the object into my main project but can only do things with it inside my viewDidLoad method. I intend to have a few of these objects on my screen and am looking fora solution that is more robust then just hard wiring up multiple copies of the shape object. As soon as I try to access the object outside of the viewDidLoad it produces a variable unknown error - first use in this function. Here is my viewDidLoad method: shapeViewController *shapeView = [[shapeViewController alloc] initWithNibName:@"shapeViewController" bundle:nil]; [self.view addSubview: shapeView.view]; // This is the problem line // This code works changes the display on the shape object [shapeView updateDisplay:@"123456"]; ---- but the same code outside of the viewDidLoad generates the error. So to sum up, everything works except when I try to access the shapeView object in the rest of the methods. Thanks in advance

    Read the article

  • Sybase stored procedure - how do I create an index on a #table?

    - by DVK
    I have a stored procedure which creates and works with a temporary #table Some of the queries would be tremendously optimized if that temporary #table would have an index created on it. However, creating an index within the stored procedure fails: create procedure test1 as SELECT f1, f2, f3 INTO #table1 FROM main_table WHERE 1 = 2 -- insert rows into #table1 create index my_idx on #table1 (f1) SELECT f1, f2, f3 FROM #table1 (index my_idx) WHERE f1 = 11 -- "QUERY X" When I call the above, the query plan for "QUERY X" shows a table scan. If I simply run the code above outside the stored procedure, the messages show the following warning: Index 'my_idx' specified as optimizer hint in the FROM clause of table '#table1' does not exist. Optimizer will choose another index instead. This can be resolved when running ad-hoc (outside the stored procedure) by splitting the code above in two batches by addding "go" after index creation: create index my_idx on #table1 (f1) go Now, "QUERY X" query plan shows the use of index "my_idx". QUESTION: How do I mimique running the "create index" in a separate batch when it's inside the stored procedure? I can't insert a "go" there like I do with the ad-hoc copy above. P.S. If it matters, this is on Sybase 12.

    Read the article

  • User Friendly Video Review with Locking

    - by James Cori
    We have a jquery/php/mysql system that allows a user to log in and review videos built by a system for online viewing. When a user begins reviewing a video, the video is marked as such. But now we've cornered ourselves into the classic browser-based application problem of the user navigating away or closing the browser without completing review. That video would then enter a state of limbo of constantly being reviewed, but never completed, and never re-entering the queue. Options we have are: Build a service (which we already have others) to find review sessions that are outside a duration boundary and reset them back into the queue. Reset review sessions outside a duration boundary when that user logs in. Essentially, if a user locks out a video for review, it'll be unlocked the next time they log in. A suggestion made to me was to use the php/apache session length and on expiration, reset any pending review jobs. I don't even know where to look to implement this as this is one project on a shared server, so it shouldn't be an apache config, but the reset mechanism would need to know the database credentials to be able to reset it... The worst solution everyone hates is preventing the user from navigating away with javascript, asking "Are you sure?!" This system is used by a few hired reviewers, so I'm not exactly dealing with the public here, but I can't prevent users from sharing logins for speedier review, which would knock out the 2nd option above because it would unlock a video being reviewed by someone else using the same login.

    Read the article

  • Access/Download server files, not in site root, with PHP

    - by user271619
    Usually I save documents (images, mpegs, excel, word docs, etc...) for my friends or family on my website's root, inside a directory called /files/ or something similar. Nothing too uncommon. But, I have been playing with user session control, and allowing users to upload files to the dedicated /files/ directory. (the file names are saved in a db, with that user's ID) But, that means other people could try to guess and locate other people's files. I do randomize the file names, upon upload. And I stop the apache from displaying the /files/ directory content. However, I'd like to start saving the files outside of the website's root. This way it can't be accessible via the browser. I don't have any code to show, but I didn't want to even start on this endeavor if it's not able to be accomplished. I did find this snippet that shows how to display an image, from outside your website root: $file = $_GET['file']; $fileDir = '/path/to/files/'; if (file_exists($fileDir . $file)) { // Note: You should probably do some more checks // on the filetype, size, etc. $contents = file_get_contents($fileDir . $file); // Note: You should probably implement some kind // of check on filetype header('Content-type: image/jpeg'); echo $contents; } ? Maybe I can use this for any file type, but has anyone heard of a better way to allow users (logged in) to access their files from online, but not letting other users has similar access?

    Read the article

  • Does complex JOINs causes high coupling and maintenance problems ?

    - by ashkan.kh.nazary
    Our project has ~40 tables with complex relations.A colleague believes in using long join queries which enforces me to learn about tables outside of my module but I think I should not concern about tables not directly related to my module and use data access functions (written by those responsible for other modules) when I need data from them. Let me clarify: I am responsible for the ContactVendor module which enables the customers to contact the vendor and start a conversation about some specific product. Products module has it's own complex tables and relations with functions that encapsulate details (for example i18n, activation, product availability etc ...). Now I need to show the product title of some product related to some conversation between the vendor and customers. I may either write a long query that retrieves the product info along with conversation stuff in one shot (which enforces me to learn about Product tables) OR I may pass the relevant product_id to the get_product_info(int) function. First approach is obviously demanding and introduces many bad practices and things I normally consider fault in programming. The problem with the second approach seems to be the countless mini queries these access functions cause and performance loss is a concern when a loop tries to fetch product titles for 100 products using functions that each perform a separate query. So I'm stuck between "don't code to the implementation, code to interface" and performance. What is the right way of doing things ? UPDATE: I'm specially concerned about possible future modifications to those tables outside of my module. What if the Products module decided to change the way they are doing things? or for some reason modify the schema? It means some other modules would break or malfunction until the change is integrated to them. The usual ripple effect problem.

    Read the article

  • Do complex JOINs cause high coupling and maintenance problems ?

    - by ashkan.kh.nazary
    Our project has ~40 tables with complex relations.A colleague believes in using long join queries which enforces me to learn about tables outside of my module but I think I should not concern about tables not directly related to my module and use data access functions (written by those responsible for other modules) when I need data from them. Let me clarify: I am responsible for the ContactVendor module which enables the customers to contact the vendor and start a conversation about some specific product. Products module has it's own complex tables and relations with functions that encapsulate details (for example i18n, activation, product availability etc ...). Now I need to show the product title of some product related to some conversation between the vendor and customers. I may either write a long query that retrieves the product info along with conversation stuff in one shot (which enforces me to learn about Product tables) OR I may pass the relevant product_id to the get_product_info(int) function. First approach is obviously demanding and introduces many bad practices and things I normally consider fault in programming. The problem with the second approach seems to be the countless mini queries these access functions cause and performance loss is a concern when a loop tries to fetch product titles for 100 products using functions that each perform a separate query. So I'm stuck between "don't code to the implementation, code to interface" and performance. What is the right way of doing things ? UPDATE: I'm specially concerned about possible future modifications to those tables outside of my module. What if the Products module decided to change the way they are doing things? or for some reason modify the schema? It means some other modules would break or malfunction until the change is integrated to them. The usual ripple effect problem.

    Read the article

  • Open a new browser window from embeded Internet Explorer

    - by Buddy
    I am working on a Windows desktop app (C++) that has an embedded Internet Explorer page. I'm working on the html page that is displayed in the There is not a back button control, so one of the requests is that links clicked on in the page should open the link in a browser window. It can open the link in the users default browser or in IE. Is this possible? I realize that this is not possible because javascript is in a sandbox and cannot touch outside applications. I'm thinking there might be a way because it is using the IE. I have tried the two methods that have worked for me in the past. Using jquery, I've tried these two approaches, but neither work in the app. They both work fine in normal browsers. Using target="_blank" $( "a" ).attr( "target", "_blank" ); The other is using window.open: $( "a" ).click( function() { window.open( $( this ).attr( "href" ) ); } ); I'm afraid that writing windows desktop applications is outside my area of expertise, so I cannot give more information regarding that side of the issue.

    Read the article

  • How to disable other touch gestures after adding another tap gesture to the view?

    - by Hudson Duan
    I have a view with some tables and buttons on it, and then I want to add a tap gesture to the entire view, but I only want that gesture recognizer to recognize taps. Ideally, I want to do something when the added gesture recognizer is tapped, then remove that gesture recognizer after so the other buttons and tables can be accessed. Basically a tap to dismiss functionality that replicates something like the facebook notifications window, tap outside to dismiss, but not interfere with the buttons outside of the notifications view. Can anybody help? My current code is: NotificationsWindow *customView = [[[NSBundle mainBundle]loadNibNamed:@"NotificationsWindow" owner:self options:nil]objectAtIndex:0]; customView.frame= CGRectMake(12, 12, customView.frame.size.width, customView.frame.size.height); UITapGestureRecognizer *recognizerForSubView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehindAgain:)]; [recognizerForSubView setNumberOfTapsRequired:1]; recognizerForSubView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView addGestureRecognizer:recognizerForSubView]; [self.view addSubview:customView]; UITapGestureRecognizer *recognizerForSuperView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)]; [recognizerForSuperView setNumberOfTapsRequired:1]; recognizerForSuperView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView.superview addGestureRecognizer:recognizerForSuperView]; (void)handleTapBehind:(UITapGestureRecognizer *)sender { NSLog(@"tapped"); [[self.view.subviews lastObject] removeFromSuperview]; [self.view removeGestureRecognizer:sender]; } I want to make it so that the recognizer for the super view dismisses the subview, but not to interfere with the other taps on the super view.

    Read the article

  • django: control json serialization

    - by abolotnov
    Is there a way to control json serialization in django? Simple code below will return serialized object in json: co = Collection.objects.all() c = serializers.serialize('json',co) The json will look similar to this: [ { "pk": 1, "model": "picviewer.collection", "fields": { "urlName": "architecture", "name": "\u0413\u043e\u0440\u043e\u0434 \u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430", "sortOrder": 0 } }, { "pk": 2, "model": "picviewer.collection", "fields": { "urlName": "nature", "name": "\u041f\u0440\u0438\u0440\u043e\u0434\u0430", "sortOrder": 1 } }, { "pk": 3, "model": "picviewer.collection", "fields": { "urlName": "objects", "name": "\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043d\u0430\u0442\u044e\u0440\u043c\u043e\u0440\u0442", "sortOrder": 2 } } ] You can see it's serializing it in a way that you are able to re-create the whole model, shall you want to do this at some point - fair enough, but not very handy for simple JS ajax in my case: I want bring the traffic to minimum and make the whole thing little clearer. What I did is I created a view that passes the object to a .json template and the template will do something like this to generate "nicer" json output: [ {% if collections %} {% for c in collections %} {"id": {{c.id}},"sortOrder": {{c.sortOrder}},"name": "{{c.name}}","urlName": "{{c.urlName}}"}{% if not forloop.last %},{% endif %} {% endfor %} {% endif %} ] This does work and the output is much (?) nicer: [ { "id": 1, "sortOrder": 0, "name": "????? ? ???????????", "urlName": "architecture" }, { "id": 2, "sortOrder": 1, "name": "???????", "urlName": "nature" }, { "id": 3, "sortOrder": 2, "name": "??????? ? ?????????", "urlName": "objects" } ] However, I'm bothered by the fast that my solution uses templates (an extra step in processing and possible performance impact) and it will take manual work to maintain shall I update the model, for example. I'm thinking json generating should be part of the model (correct me if I'm wrong) and done with either native python-json and django implementation but can't figure how to make it strip the bits that I don't want. One more thing - even when I restrict it to a set of fields to serialize, it will keep the id always outside the element container and instead present it as "pk" outside of it.

    Read the article

  • Behavior of local variables in JavaScripts with()-statement

    - by thr
    I noticed some weird (and to my knowledge undefined behavior, by the ECMA 3.0 Spec at least), take the following snippet: var foo = { bar: "1", baz: "2" }; alert(bar); with(foo) { alert(bar); alert(bar); } alert(bar); It crashes in both Firefox and Chrome, because "bar" doesn't exist in the first alert(); statement, this is as expected. But if you add a declaration of bar inside the with()-statement, so it looks like this: var foo = { bar: "1", baz: "2" }; alert(bar); with(foo) { alert(bar); var bar = "g2"; alert(bar); } alert(bar); It will produce the following: undefined, 1, g2, undefined It seems as if you create a variable inside a with()-statement most browsers (tested on Chrome or Firefox) will make that variable exist outside that scope also, it's just set to undefined. Now from my perspective bar should only exist inside the with()-statement, and if you make the example even weirder: var foo = { bar: "1", baz: "2" }; var zoo; alert(bar); with(foo) { alert(bar); var bar = "g2"; zoo = function() { return bar; } alert(bar); } alert(bar); alert(zoo()); It will produce this: undefined, 1, g2, undefined, g2 So the bar inside the with()-statement does not exist outside of it, yet the runtime somehow "automagically" creates a variable named bar that is undefined in its top level scope (global or function) but this variable does not refer to the same one as inside the with()-statement, and that variable will only exist if a with()-statement has a variable named bar that is defined inside it. Very weird, and inconsistent. Anyone have an explanation for this behavior? There is nothing in the ECMA Spec about this.

    Read the article

  • asp net jquery popup dialog form in asp:formview

    - by qwebek
    Hi, i have following problem, i am using a popup jquery dialog with asp:formview . the purpose of this popup is for user to enter a hyperlink which is placed then in textbox control in formview the popup dialog div is located outside a formview just after body tag <body style="background-color: #FFFFFF; font-family:Lucida Console;"> <div id="dialog-form" title="sdfdfsdf" style="font-size:14px; "> <form> <fieldset> <label for="link">sdfdf</label> <input type="text" name="sdfsdf" id="link" size="32" /> </fieldset> </form> </div> <form id="form1" runat="server" style="margin-top:50px;" > <div> <asp:FormView ID="FormView1" ....... <InsertItemTemplate> ... <sometextbox ...../> <button id="create-user" class="ui-state-default ui-corner-all">Create link</button> ... </InsertItemTemplate> After clicking a button a popup window is shown BUT the page starts to refresh immidiately ((( and ofc popup s hidden after that if relocate the button outside the formview - the page is not refreshed, but i need it in formview.. any ideas what to do?

    Read the article

  • about c# OBJECTS and the Possibilties it has.

    - by user527825
    As a novice programmer and i always wonder about c# capabilities.i know it is still early to judge that but all i want to know is can c# do complex stuffs or something outside windows OS. 1- I think c# is a proprietary language (i don't know if i said that right) meaning you can't do it outside visual studio or windows. 2-also you cant create your own controller(called object right?) like you are forced to use these available in toolbox and their properties and methods. 3-can c# be used with openGL API or DirectX API . 4-Finally it always bothers me when i think i start doing things in visual studio, i know it sounds arrogant to say but sometimes i feel that i don't like to be forced to use something even if its helpful, like i feel (do i have the right to feel?) that i want to do all things by myself? don't laugh i just feel that this will give me a better understanding. 5- is visual c# is like using MaxScript inside 3ds max in that c# is exclusive to do windows and forms and components that are windows related and maxscript is only for 3d editing and manipulation for various things in the software. If it is too difficult for a beginner i hope you don't answer the fourth question as i don't have enough motivation and i want to keep the little i have. thank you for your time. Note: 1-sorry for my English, i am self taught and never used the language with native speakers so expect so errors. 2-i have a lot of questions regarding many things, what is the daily ratio you think for asking (number of questions) that would not bother the admins of the site and the members here. thank you for your time.

    Read the article

  • Is it possible to recreate User Gestures in iPhone?

    - by MadhavanRP
    I am developing an app and I have encountered a problem that comes down to this scenario: Consider a superview with two buttons(button1,button2) and a text view, all as its subviews. When I click on one button, I display the text view. When I tap on anywhere outside the textview, but in the super view, I need to dismiss the text view. I have added a UITapGestureRecognizer to the super view and it calls a method tap:. In tap:, I get the point of the tap and if it is outside the text view, I dismiss the text view and remove the GestureRecognizer. Now the problem occurs when I tap on button 2. I need to dismiss the text view as well as execute the action for button 2. But it enters tap: and I do not wish to call the button 2's method from there. What I want to know is if it would be possible to emulate the same tap at the same co ordinates after the gesture recognizer is removed? If not what is the way I proceed to solve this issue?

    Read the article

  • Strategies for when to use properties and when to use internal variables on internal classes?

    - by Edward Tanguay
    In almost all of my classes, I have a mixture of properties and internal class variables. I have always chosen one or the other by the rule "property if you need it externally, class variable if not". But there are many other issues which make me rethink this often, e.g.: at some point I want to use an internal variable from outside the class, so I have to refactor it into a property which makes me wonder why I don't just make all my internal variables properties in case I have to access them externally anyway, since most classes are internal classes anyway it aren't exposed on an API so it doesn't really matter if the internal variables are accessible from outside the class or not but then since C# doesn't allow you to instantiate e.g. List<string> property in the definition, then these properties have to be initialized in every possible constructor, so these variables I would rather have internal variables just to keep things cleaner in that they are all initialized in one place C# code reads more cleanly if constructor/method parameters are camel case and you assign them to pascal case properties instead of the ambiguity of seeing "templateIdCode" and having to look around to see if it is a local variable, method parameter or internal class variable, e.g. it is easier when you see "TemplateIdCode = templateIdCode" that this is a parameter being assigned to a class property. This would be an argument for always using only properties on internal classes. e.g.: public class TextFile { private string templateIdCode; private string absoluteTemplatePathAndFileName; private string absoluteOutputDirectory; private List<string> listItems = new List<string>(); public string Content { get; set; } public List<string> ReportItems { get; set; } public TextFile(string templateIdCode) { this.templateIdCode = templateIdCode; ReportItems = new List<string>(); Initialize(); } ... When creating internal (non-API) classes, what are your strategies in deciding if you should create an internal class variable or a property?

    Read the article

  • How to move point on arc?

    - by bbZ
    I am writing an app that is simulating RobotArm movement. What I want to achieve, and where I have couple of problems is moving a Point on arc (180degree) that is arm range of movement. I am moving an arm by grabbing with mouse end of arm (Elbow, the Point I was talking about), robot can have multiple arms with diffrent arm lenghts. If u can help me with this part, I'd be grateful. This is what I have so far, drawing function: public void draw(Graphics graph) { Graphics2D g2d = (Graphics2D) graph.create(); graph.setColor(color); graph.fillOval(location.x - 4, location.y - 4, point.width, point.height); //Draws elbow if (parentLocation != null) { graph.setColor(Color.black); graph.drawLine(location.x, location.y, parentLocation.x, parentLocation.y); //Connects to parent if (arc == null) { angle = new Double(90 - getAngle(parentInitLocation)); arc = new Arc2D.Double(parentLocation.x - (parentDistance * 2 / 2), parentLocation.y - (parentDistance * 2 / 2), parentDistance * 2, parentDistance * 2, 90 - getAngle(parentInitLocation), 180, Arc2D.OPEN); //Draws an arc if not drawed yet. } else if (angle != null) //if parent is moved, angle is moved also { arc = new Arc2D.Double(parentLocation.x - (parentDistance * 2 / 2), parentLocation.y - (parentDistance * 2 / 2), parentDistance * 2, parentDistance * 2, angle, 180, Arc2D.OPEN); } g2d.draw(arc); } if (spacePanel.getElbows().size() > level + 1) {//updates all childElbows position updateChild(graph); } } I just do not know how to prevent moving Point moving outside of arc line. It can not be inside or outside arc, just on it. Here I wanted to put a screenshot, sadly I don't have enough rep. Am I allowed to put link to this? Maybe you got other ways how to achieve this kind of thing. Here is the image: Red circle is actual state, and green one is what I want to do. EDIT2: As requested, repo link: https://github.com/dspoko/RobotArm

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >