Search Results

Search found 14236 results on 570 pages for 'times square'.

Page 27/570 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Adding a method to a function object at runtime

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

    Read the article

  • Use CSS (and maybe JavaScript) to make an element be square (or maintain a specific aspect ratio)

    - by David Pfeffer
    I have a div that I want to have the following characteristics: Width = 50% of its parent element Height equal to whatever it needs to be in order to maintain a certain aspect ratio. I need to use percentages because the object will resize left-right when the browser is resized. I want the object to be resized top-bottom to ensure the object maintains the same aspect ratio. I don't think there's any way to use pure CSS to do this, but does anyone know of a way? Alternatively, is there an easy JavaScript way to do this? (JQuery is fine.)

    Read the article

  • Prinicipal component analysis c#

    - by vj4u
    Hi, im presently working with data in text files i need to use algorithm called principal component analysis so i have counted the words in text filw which occurred more than one time in text file for eg relation occured times help occured 6 times between OCCURED 3 TIMES Analysis occurred 4 times component occured 5 times present occurred 6 times so by taking count of above distinct words i need to form matrix of m x n in c# help me its bit urgent for me

    Read the article

  • Is it faster to compute values in a query, call a Scalar Function (decimal(28,2) datatype) 4 times,

    - by Pulsehead
    I have a handful of queries I need to write in SQL Server 2005. Each Query will be calculating 4 unit cost values based on a handful of (up to 11) fields. Any time I want 1 of these 4 unit cost values, I'll want all 4. Which is quicker? Computing in the SQL Query ((a+b+c+d+e+f+g+h+i)/(j+k)), calling ComputeScalarUnitCost(datapoint.ID) 4 times, or joining to ComputeUnitCostTable(datapoint.ID) one time?

    Read the article

  • referencing struct fields in c with square brackets and an index instead of . and ->?

    - by lsiebert
    Assuming I have a structure such as: typedef struct { char * string1; char * string2; } TWO_WORDS; such that all the fields are of the same type, and my main has TWO_WORDS tw; can I reference string1 with tw[0] and string2 with two[1]? If so: is this part of the c standard? do i have to cast the struct to an array first? what about fields which are different sizes in memory what about fields which are different types but the same size? can you do pointer arithmetic within a structure? -

    Read the article

  • Why is my GreaseMonkey function unexpectedly being called multiple times?

    - by Ryan Fisher
    I am missing something, I'm not sure why the function 'addIcon()' is being called multiple times. Given: <div class="ticketpostcontainer">Some text</div> <div class="ticketpostcontainer">Some text</div> <div class="ticketpostcontainer">Some text</div> Using the utility function waitForKeyElements, the result is that each div element receives my "collapse icon" three times: // ==UserScript== // @name Collapse Kayako Response // @grant Sandbox // @namespace http://my.chiromatrixbase.com/fisher.chiromatrix.com/collaps_div.js // @include http://imatrixsupport.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js // ==/UserScript== /*jslint plusplus: true, undef: true, sloppy: true, vars: true, white: true, indent: 2, maxerr: 30 */ //Enable or disable GreaseMonkey function, GM_log var GM_Debug = 1; if (!GM_Debug) { var GM_log = function () {}; } //If FireBig is active, send GM log events to FB. if (unsafeWindow.console && GM_Debug) { var GM_log = unsafeWindow.console.log; } GM_log("Running collapse kayako response script"); //Don't run on frames or iframes. if (window.top !== window.self) { return; } waitForKeyElements(".ticketpostcontainer", addIcon); function addIcon() { var i, toCollapse = document.getElementsByClassName('ticketpostcontainer'), j = toCollapse.length; GM_log("Number of elements to collapse: " + toCollapse.length); for (i = 0; i < j; i++) { var curElement = toCollapse[i]; var p = document.createElement('p'); var a = document.createElement('a'); var span = document.createElement('span'); styleLink(a); styleParagraph(p); styleSpan(span); p.appendChild(a); p.appendChild(span); a.appendChild(document.createTextNode('-')); span.appendChild(document.createTextNode(' Some text')); a.addEventListener("click", toggle, false); curElement.parentNode.insertBefore(p, curElement); } function toggle(e) { if (this.firstChild.nodeValue === '-') { this.parentNode.nextSibling.style.display = 'none'; this.firstChild.nodeValue = '+'; this.nextSibling.style.display = 'inline'; } else { this.parentNode.nextSibling.style.display = 'block'; this.firstChild.nodeValue = '-'; this.nextSibling.style.display = 'none'; } e.preventDefault(); } function styleLink(a) { a.href = '#'; a.style.fontWeight = 'bold'; a.style.background = '#F6F1E7'; a.style.border = '1px solid #cccccc'; a.style.color = '#B24C58'; a.style.textDecoration = 'none'; a.style.width = '15px'; a.style.height = '15px'; a.style.textAlign = 'center'; a.style.fontSize = '100%'; a.style.margin = '0 5px 5px 8px'; a.style.cssFloat = 'left'; a.style.display = 'block'; a.style.lineHeight = '13px'; } function styleParagraph(p) { p.style.margin = '0 0 0 0'; p.style.lineHeight = '16px'; p.style.clear = 'both'; p.style.height = '15px'; } function styleSpan(span) { span.style.display = 'none'; } }

    Read the article

  • How to keep , instead of . and how to make % form calculation need to be times 100

    - by rockers
    in my database table i have filed called Value.. its showing somethign like.. 1234231.23 but I need to dispaly this as , all currency values should include commas when appropriate such as after the millions and thousands digits.. This is the filed I am getting from data base.. value= !dr.IsDBNull(3) ? dr.GetDecimal(3) : new decimal(), and I need to chnage other value as % times 100.. i am gettnig from data base something liek this -021222 i need to display -2.1222% Percentage= !dr.IsDBNull(4) ? dr.GetDecimal(4) : new decimal(), Can I change in the my class? public decimal value { get;set;} public decimal Percentage {get;set;}

    Read the article

  • Why is the SelectTemplate Method run 2 times in debug mode?

    - by msfanboy
    Hello, debuging this class the SelectTemplate Method is run 2 times, but why? The first time the item is always null. public class PersonDataTemplateSelector : DataTemplateSelector { public override DataTemplate SelectTemplate(object item,DependencyObject container) { if (item is Person) { Person person = item as Person; Window window = Application.Current.MainWindow; if (System.ComponentModel.DesignerProperties.GetIsInDesignMode( window)) return null; if (person.Gender == "male") return window.FindResource("boysViewTemplate") as DataTemplate; else return window.FindResource("girlsViewTemplate") as DataTemplate; } return null; } }

    Read the article

  • Font Times New Roman 11,25 Regular is not supported in telerik reporting.

    - by Tio
    Hi all.. I'm having some trouble exporting to PDF in Telerik Reporting Q2 2008. It seems that for some reason, exporting to PDF ( or printing, which is the same, it first exports to PDF, and then prints ), is giving me this error. First it started with Arial, I found the bug with the font Arial, replaced the textbox with Times New Roman, and it keeps on giving me this error. The strange thing, is that this only happens on the production server ( Windows Server 2008 ), on my development machine, this works flawlessly, I even tried to copy the fonts from my windows font folder, to my production server, but that didn't help anything... Does someone know what is happening? EDIT: Problem solved...a server reboot solved the problem instantly, unfortunately at the time I posted this question I couldn't do a server restart, later that day ( at night ) my boss restarted the server and all was good again.. Thanks all..

    Read the article

  • ASP.NET Web User Control with Javascript used multiple times on a page - How to make javascript func

    - by Jason Summers
    I think I summed up the question in the title. Here is some further elaboration... I have a web user control that is used in multiple places, sometimes more than once on a given page. The web user control has a specific set of JavaScript functions (mostly jQuery code) that are containted within *.js files and automatically inserted into page headers. However, when I want to use the control more than once on a page, the *.js files are included 'n' number of times and, rightly so, the browser gets confused as to which control it's meant to be executing which function on. What do I need to do in order to resolve this problem? I've been staring at this all day and I'm at a loss. All comments greatly appreciated. Jason

    Read the article

  • ASP.NET How expensive is it to call an Application Variable many times?

    - by Matias Nino
    The short of it is: Is it costly to check an Application Variable such as Application("WebAppName") more 10-20 times each time a page loads? Background: (feel free to critique) Some includes in my site contain many links and images which cannot use relative urls due to their inclusion in different paths. Hence these includes contain frequent instances of <img src="<%=Application("Webroot")%>images\image.gif"> Is it expensive to keep calling an Application variable like this? Should I just put the Application value in some local variable to use where needed? IMPORTANT NOTE: I need my webapp to run fine on a server whether it be in the root web ("/") or in a virtual subweb ("/app"). Thanks in advance for any wisdom shared.

    Read the article

  • If I specify a System property multiple times when invoking JVM which value is used?

    - by RobV
    If I specify a system property multiple times when invoking the JVM which value will I actually get when I retrieve the property? e.g. java -Dprop=A -Dprop=B -jar my.jar What will be the result when I call System.getProperty("prop");? The Java documentation on this does not really tell me anything useful on this front. In my non-scientific testing on a couple of machines running different JVMs it seems like the last value is the one returned (which is actually the behavior I need) but I wondered if this behavior is actually defined officially anywhere or can it vary between JVMs?

    Read the article

  • Android: duplicate items in ListVew. Maybe getView() called too many times?

    - by gonzobrains
    Hi, I am trying to create a simple program which displays a "shopping cart" list of items, along with a few buttons below it to manage the cart. The biggest problem is that items are getting duplicate entries in the list view. That is, for every item I want to enter I see it appear two times in the list view. What's the problem? Also, the scrollable area of my cart is not big enough. How do I set it so that it is bigger but I can still see my buttons? Perhaps I should put the buttons above the cart? Here is my shopping cart's layout XML: Here is the layout for individual row items: <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"> <TextView android:id="@+id/BookTitle" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:singleLine="true" android:gravity="center_vertical" / <TextView android:id="@+id/BookPrice" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:singleLine="true" android:ellipsize="marquee" / Thanks, gb

    Read the article

  • How can I match end-of-line multiple times in a regex without interpolation?

    - by harschware
    Hi, if I have a input with new lines in it like: [INFO] xyz [INFO] How can I pull out the xyz part? I tried a pattern like /^\[INFO\]$(.*?)$\[INFO\]/ms, but perl gives me: Use of uninitialized value $\ in regexp compilation at scripts\t.pl line 6. I've been trying things to get interpolation to stop like using qr// but alas, no love. EDIT: The key is that the end-of-line anchor is a dollar sign but at times it may be necessary to intersperse the end-of-line anchor through the pattern. If the pattern is interpolating then you might get problems such as uninitialized $\. For instance an acceptable solution here is /^\[INFO\]\s*^(.*?)\s*^\[INFO\]/ms but that does not solve the crux of the first problem. I've changed the anchors to be ^ so there is no interpolation going on, and with this input I'm free to do that. But what about when I really do want to reference EOL with $ in my pattern? How do I get the regex to compile?

    Read the article

  • How can match end-of-line multiple times in a regex without interpolation?

    - by harschware
    Hi, if I have a input with new lines in it like: [INFO] xyz [INFO] How can I pull out the xyz part? I tried a pattern like /^\[INFO\]$(.*?)$\[INFO\]/ms, but perl gives me: Use of uninitialized value $\ in regexp compilation at scripts\t.pl line 6. I've been trying things to get interpolation to stop like using qr// but alas, no love. EDIT: The key is that the end-of-line anchor is a dollar sign but at times it may be necessary to intersperse the end-of-line anchor through the pattern. If the pattern is interpolating then you might get problems such as uninitialized $\. For instance an acceptable solution here is /^\[INFO\]\s*^(.*?)\s*^\[INFO\]/ms but that does not solve the crux of the first problem. I've changed the anchors to be ^ so there is no interpolation going on, and with this input I'm free to do that. But what about when I really do want to reference EOL with $ in my pattern? How do I get the regex to compile?

    Read the article

  • How can I loop over a query for a specific number of times that may be greater than the result?

    - by JS
    I need to loop over a query exactly 12 times to complete rows in a form but rarely will the query return 12 rows. The cfquery endRow attribute doesn't force the loop to keep going if the result is < 12. If it did that would be ideal to use something like cfloop query="myQuery" endRow="12"... The 2 options that I have now are to skip the loop and write out all 12 rows but that results in a lot of duplicate code (there are 20 columns), or do a query of queries for each row which seems like a lot of wasted processing. Thanks for any ideas.

    Read the article

  • Order a sentence alphabetically and count the number of times each words appears and print in a table

    - by JaAnTr
    I am struggling with the print in a table part of the question. So far I have managed to order the user inputted sentence alphabetically and count the number of times each word occurs. Here is the code: thestring = (raw_input()) sentence = thestring.split(" ") sentence.sort() count = {} for word in thestring.split(): try: count[word] += 1 except KeyError: count[word] = 1 print sentence print count And when I run the code I get this: ['apple', 'apple', 'banana', 'mango', 'orange', 'pear', 'pear', 'strawberry'] {'apple': 2, 'pear': 2, 'strawberry': 1, 'mango': 1, 'orange': 1, 'banana': 1} However, ideally I want it printed in a table that looks something like: apple.....|.....2 banana....|.....1 mango.....|.....1 orange....|.....1 pear......|.....2 strawberry|.....1 Thanks for any help!

    Read the article

  • Facebook Open Graph - Grab how many times a page has been liked?

    - by DoMx
    I have a site that allows users to create a saying and then users "like" those sayings on Facebook. http://www.likeylikey.net/ I got a friend to throw up this simple code in less than 2 hours so it's basic. He knows little to nothing regarding the Open Graph API. Basically, I want to know how I can programmatically store how many times a page has been liked so I can list a "Top 10, most liked pages" list. Right now the index shows a list of all created pages and now I just wish to show the 10 most liked but I need a way of pulling that information from Facebook. Is this possible?

    Read the article

  • Finding which files were "FIXED"and how many times between two specific date by using Trac?

    - by mkafkas
    I need to find out that how many times and which files are fixed or changed due to a bug between two specific dates in an open source project which uses Trac. I selected Webkit project for that purpose. (https://trac.webkit.org/) However, it can be any open source project. What can I do for that? How do I start? Do i have to use version control systems like svn or git for intergration? I am kinda newbie for these bug-tracking and issue-tracking systems.

    Read the article

  • Trace output not getting logged in output file at times.

    - by Mini
    I'm using TextWriterTraceListener to log error messages to a text file.The TraceOutputFile has been mentioned in the web.config file as "trace.log.txt". The error messages are getting logged to the trace.log.txt. But at times I notice that some files are getting generated randomly under root folder with the exception details instead of logging to the trace.log.txt. This is not happening in any particular page and hence I am unable to detect the reason as to why these files are getting generated.Ex:14dbc20a-9eb8-4fec-b6bd-54400db2ceatrace.log.txt . Can u suggest me any circumstances when this might happen?

    Read the article

  • how to avoid storing several times a repeated field of a Symfony form?

    - by user454760
    Hello everybody, I am working with Symfony 1.4 and Doctrine. I have a model A with an email field. The form of A displays an input in which the user should insert the email correctly. But as everybody knows, sometimes they don't do it. To fix this I have inserted an extra field in the model (and in the form), called *repeat_email* to prevent the misspellings. Then, in the validation process, after validating all the fields, i use a global validator to compare the data of the two fields. This works, but I don't want to have the email stored two times in the database (I don't want the *repeat_email*). Is there any mechanism to use it in the validation process, but not to store it in the database? Thanks,

    Read the article

  • Power cycles on/off 3 times before booting properly from cold start, no other issues (New System)

    - by James
    Relevant Specs: Sapphire 5850, core i7 920, Seasonic x750 power supply, ECS X58B-A2 mobo. From a cold boot, meaning all power totally disconnected at the wall, the system will power on for less than a second and then power off completely. After two seconds of being powered off this will repeat and on the third "attempt" the computer will boot. To be very specific here is what happens: The power is turned on at the wall and on the psu, the orange stdby LED on the mobo is illuminated but the system is 'off'. I hit the power button on the case or on the mobo itself I hear the relay (?) in the psu closing The case light comes on and the mobo power light comes on. The fans start rotating. Immediately after this the I hear some relay click - the power lights extinguish, the fans stop, the stdby light remains on. Less than 2 seconds pass and the cycle repeats without any intervention from me. On the third attempt it boots normally and the machine runs perfectly. If I do a soft reboot or a full shutdown the computer starts normally the next time. It's only if I pull the power cord or flick the switch off on the PSU that I get the cycling again. Basically any time the stdby light on the mobo goes out. I have removed the graphics card and I get the same problem. I have removed the PSU, hotwired it to the ON position and verified voltages on all lines. The relay does not cycle when I do this. If I connect only the 24 pin ATX connector to the mobo and not the 8 pin ATX12V / CPU connector then I will not get the cycling, the fans run, the power light stays on, but obviously the system can't boot. Disconnecting all fans has no effect on the problem. My feeling it that it's something to do with the motherboard like a capacitor that's taking a long time to charge because it's leaking or something along those lines. But I can't imagine what could be 'wrong' with it and only manifest itself as a problem under these very specific circumstances. Any ideas? Thanks.

    Read the article

  • Why does RDP Licensing is licensing the same device multiple times? [closed]

    - by NeerPatel
    Possible Duplicate: Can you help me with my software licensing issue? I've got a Citrix XenApp 6.5 Farm running on Win 2008 R2 Servers. I purchased 300 Device RDP/Remote App Licenses for ~200 users. We went with Device licenses, because most of the end users use the same machines. After 1 month of operating, we started to run out of licenses. It turns out the licensing service is consuming multiple licenses for the same machine. I can revoke licenses, but there is a limit to how many I can do. Is this operating correctly? The only explanation I can come up with is that the Licensing service is giving a license to a device for every server it connects to in our Citrix farm.

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >