Search Results

Search found 4955 results on 199 pages for 'range'.

Page 135/199 | < Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >

  • AWS Load Balancer with a static IP address

    - by user965904
    I have a set-up running on Amazon cloud with a couple of EC2 Instances running through a load balancer. It is important that the site has a unique(static) IP or set of IPs as I'm plugging in 3rd party APIs which only accept requests made from IPs which have been added to their whitelist. So basically unless we can give these 3rd parties a static IP or range of IPs that the requests from the site will always come from then we would be unable to make any calls to them. Anyone knows how to achieve this as I know that Elastic IPs are not compatible with load balancers? If I were to look up the IP of the load balancer DNS name (e.g. dualstack.awseb-BAMobile-ENV-xxxxxxxxx.eu-west-1.elb.amazonaws.com resolves to 200.200.200.200) would that IP be Static? Any help/advise is greatly appreciated guys.

    Read the article

  • Python 3.0 - Dynamic Class Instance Naming

    - by Jon
    I want to use a while loop to initialize class objects with a simple incremented naming convention. The goal is to be able to scale the number of class objects at will and have the program generate the names automatically. (ex. h1...h100...h1000...) Each h1,h2,h3... being its own instance. Here is my first attempt... have been unable to find a good example. class Korker(object): def __init__(self,ident,roo): self.ident = ident self.roo = roo b = 1 hwinit = 'h' hwstart = 0 while b <= 10: showit = 'h' + str(b) print(showit) #showit seems to generate just fine as demonstrated by print str(showit) == Korker("test",2) #this is the line that fails b += 1 The errors I get range from a string error to a cannot use function type error.... Any help would be greatly appreciated.

    Read the article

  • Extracting data points from a matrix and saving them in different matrixes in MATLAB

    - by Hossein
    Hi, I have a 2D Matrix consisting of some coordinates as below(example): Data(X,Y): 45.987543423,5.35000964 52.987544223,5,98765234 Also I have an array consisting of some integers =0 , for example: Cluster(M) 2,0,3,1 each of these numbers in this array corresponds with a row of my 2D Matrix above.For example, it says that row one(coordinate) in the Data Matirx belongs to the cluster 2,second row belongs to cluster 0 and so on. Now I want to have each of the datapoint of each cluster in a separate matrix, for example I want to save datapoints belonging to cluster 1 in a separate matrix, cluster 2 in a separate matrix and so on,.... I can do them manually, but the problem is this has to be an automatic extraction. which means that the number of clusters(range of the numbers in the cluster array varies in each run) so I have to have a general algorithm that does this extraction for me. Can someone help me please? thanks

    Read the article

  • Unwanted behaviour from dict.fromkeys

    - by Anthony Labarre
    Hi there, I'd like to initialise a dictionary of sets (in Python 2.6) using dict.fromkeys, but the resulting structure behaves strangely. More specifically: >>>> x = {}.fromkeys(range(10), set([])) >>>> x {0: set([]), 1: set([]), 2: set([]), 3: set([]), 4: set([]), 5: set([]), 6: set([]), 7: set([]), 8: set([]), 9: set([])} >>>> x[5].add(3) >>>> x {0: set([3]), 1: set([3]), 2: set([3]), 3: set([3]), 4: set([3]), 5: set([3]), 6: set([3]), 7: set([3]), 8: set([3]), 9: set([3])} I obviously don't want to add 3 to all sets, only to the set that corresponds to x[5]. Of course, I can avoid the problem by initialising x without fromkeys, but I'd like to understand what I'm missing here.

    Read the article

  • idiomatic way to take groups of n items from a list in Python?

    - by Wang
    Given a list A = [1 2 3 4 5 6] Is there any idiomatic (Pythonic) way to iterate over it as though it were B = [(1, 2) (3, 4) (5, 6)] other than indexing? That feels like a holdover from C: for a1,a2 in [ (A[i], A[i+1]) for i in range(0, len(A), 2) ]: I can't help but feel there should be some clever hack using itertools or slicing or something. (Of course, two at a time is just an example; I'd like a solution that works for any n.) Edit: related http://stackoverflow.com/questions/1162592/iterate-over-a-string-2-or-n-characters-at-a-time-in-python but even the cleanest solution (accepted, using zip) doesn't generalize well to higher n without a list comprehension and *-notation.

    Read the article

  • What techniques are available for filtering collections of objects when using zodb?

    - by Omega
    As the title says: What techniques are available for filtering objects when using zodb? The equivalent in SQL terms would be something like filtering results by a date range. Or only returning rows with a particular value set in a column. If I had a series of blog posts and only wanted ones done in the past month, what would I have to do? Is there any way to optimize these kinds of "queries"? My gut tells me iterating over all the objects in a relationship simply to perform a test is less than optimal.

    Read the article

  • ssrs 2008 programmatically add tables rows

    - by davethecoder
    Above is how my report looks, the part in yellow in hidden, and is only shown when the user clicks the + icon on the [name]. the result is basically the percentage difference from the Past [X] - [TERM] i.e there is a dropdown with, [weeks, months, days, hours] and a textbox of qty. so choosing qty = 4 and term = weeks will delivery a result set spread over 4 weeks based on the parent result sets date range and name ID I wish to populate here the number of rows, dependant on the value set by the user and the data will be from a dataset. Is it possible to dynamically add more sub rows ( like on row data bound ) if my first row is ID 123 [name], is it possible to send this value [123] to a dataset in order that all subrows are only relevant to the name with ID of 123? this is my first bash at SSRS so please no half cut answers, that just lead to more questions about the answer given :-) if this makes sense. Thanks

    Read the article

  • Value from UISlider method?

    - by fuzzygoat
    Can anyone point me in the right direction regarding sliders, the version below was my first attempt (the range is 0.0 - 100.0) The results I get are not right. // Version 1.0 -(IBAction)sliderMoved:(id)sender { NSLog(@"SliderValue ... %d",(int)[sender value]); } // OUTPUT: // [1845:207] SliderMoved ... -1.991753 // [1845:207] SliderMoved ... 0.000000 // [1845:207] SliderMoved ... 0.000000 // [1845:207] SliderMoved ... 32768.000435 With the version below I get the values I expect, what am I missing in version_001? // Version 2.0 -(IBAction)sliderMoved:(UISlider *)sender { NSLog(@"SliderValue ... %d",(int)[sender value]); } // OUTPUT: // [1914:207] SliderMoved ... 1 // [1914:207] SliderMoved ... 2 // [1914:207] SliderMoved ... 3 // [1914:207] SliderMoved ... 4 cheers Gary

    Read the article

  • How to stream an HttpResponse with Django

    - by muudscope
    I'm trying to get the 'hello world' of streaming responses working for Django (1.2). I figured out how to use a generator and the yield function. But the response still not streaming. I suspect there's a middleware that's mucking with it -- maybe ETAG calculator? But I'm not sure how to disable it. Can somebody please help? Here's the "hello world" of streaming that I have so far: def stream_response(request): resp = HttpResponse( stream_response_generator()) return resp def stream_response_generator(): for x in range(1,11): yield "%s\n" % x # Returns a chunk of the response to the browser time.sleep(1)

    Read the article

  • Using DAO's or static methods in Domain Object with nHibernate

    - by mickyjtwin
    I am using nHibernate for the first time, and after alot of reading/researching, plus looking at other projects done with nHibernate, have seen a couple of implementation practices. I am looking for opinions about which would be best to use and why. Essentially the two methods are as follows: Using Data Access Objects and a DAO Factory. Example usage: INotificationListDAO nListDAO = NHDaoFactory.GetNotificationListDAO(); NotificationList list = nListDAO.GetByListID(""); Use Static methods in the Domain Object. Example usage: NotificationList list = NotificationList.GetByListID(""); NHHelper.Session.Get(id); NHHelper.Session basically calls the NHibernateSessionManager.Instace.GetSessionFrom(""). While both look similar, it is more to do with best practice. From what I understand, the first option is more so if you are developing enterprise level applications, where my requirements are more for mid-range websites.

    Read the article

  • Have you ever derived a programming solution from nature?

    - by Ryu
    When you step back and look at ... the nature of animals, insects, plants and the problems they have organically solved perhaps even the nature and balance of the universe Have you ever been able to solve a problem by deriving an approach from nature? I've heard of Ant Colony Algorithms being able to optimize supply chain amongst other things. Also Fractal's being the "geometry of nature" have been applied to a wide range of problems. Now that spring is here again and the world is coming back to life I'm wondering if anybody has some experiences they can share. Thanks PS I would recommend watching the "Hunting the Hidden Dimension" Nova episode on fractals.

    Read the article

  • pl/sql does not work with %rowtype

    - by Manolo
    I want to do a simple PL/SQL program on the Oracle 10g internet environment. The program is: DECLARE stud_rec students%ROWTYPE; last_name VARCHAR2:='Clinton'; BEGIN SELECT * INTO stud_rec FROM students WHERE student_id=100; END; I have a table called students with data inside of it. The issue is that when I want to run this in the SQL command window I got this message: ORA-06550: line 3, column 11: PLS-00215: String length constraints must be in range (1 .. 32767) I have checked the syntax and I cannot find the error. Any help? Thanks in advance

    Read the article

  • Python elegant inverse function of int(string,base)

    - by random guy
    python allows conversions from string to integer using any base in the range [2,36] using: int(string,base) im looking for an elegant inverse function that takes an integer and a base and returns a string for example >>> str_base(224,15) 'ee' i have the following solution: def digit_to_char(digit): if digit < 10: return chr(ord('0') + digit) else: return chr(ord('a') + digit - 10) def str_base(number,base): if number < 0: return '-' + str_base(-number,base) else: (d,m) = divmod(number,base) if d: return str_base(d,base) + digit_to_char(m) else: return digit_to_char(m) note: digit_to_char() works for bases <= 169 arbitrarily using ascii characters after 'z' as digits for bases above 36 is there a python builtin, library function, or a more elegant inverse function of int(string,base) ?

    Read the article

  • Assign weight to a integer column for Sphinx search

    - by Daniel
    Hello: I have a note table with columns: title :string content :text rating :integer and a thinking_sphinx configuration: define_index do indexes :title, :sortable => true indexes :content end Then I can search the notes and assign weights to title and content to define the order or the result: Note.search "abc", :match_mode => :extended, :field_weights => { :title => 10, :content => 3 } Now I want to assign a weight to the rating column The type of the rating column is integer. The range of the rating is [1, 2, 3, 4, 5]. Can I just add weight at the :field_weights :field_weights => { :title => 10, :content => 3, :rating => 5 } or I need to do something else to make the note which has higer rating display first?

    Read the article

  • Regex to test if an input string contains a certain number of characters

    - by Dan
    So, I basically would like to test to see if a string contains a range of alphanumeric characters. It's to be used as a client-side validation and I don't want to prevent users from entering whatever they want. Best to give examples of what should/should not pass validation: So to be specific, the expression I'm looking for is to test to make sure string contains anywhere from 3 to 10 alphanumeric characters. I'd like to plug into an ASP.NET client side validator. NOTE: quotes not part of input (but could be!) " f o o " should pass since there are 3 chars "f_0_0" should pass " fo " should not "F......o......o......b.....a......r" should pass thx

    Read the article

  • Floating point precision nuances.

    - by user247077
    Hi, I found this code in NVIDIA's cuda SDK samples. void computeGold( float* reference, float* idata, const unsigned int len) { reference[0] = 0; double total_sum = 0; unsigned int i; for( i = 1; i < len; ++i) { total_sum += idata[i-1]; reference[i] = idata[i-1] + reference[i-1]; } // Here it should be okay to use != because we have integer values // in a range where float can be exactly represented if (total_sum != reference[i-1]) printf("Warning: exceeding single-precision accuracy. Scan will be inaccurate.\n"); } (C) Nvidia Corp Can somebody please tell me a case where the warning would be printed, and most importantly, why. Thank you very much.

    Read the article

  • Modifiers in Makefile rule's dependency list

    - by gnu_maker
    The problem is fairly simple. I am trying to write a rule, that given the name of the required file will be able to tailor its dependencies. Let's say I have two programs: calc_foo and calc_bar and they generate a file with output dependent on the parameter. My target would have a name 'target_*_*'; for example, 'target_foo_1' would be generated by running './calc_foo 1'. The question is, how to write a makefile that would generate outputs of the two programs for a range of parameters?

    Read the article

  • using .NET how to convert iso8859-1 encoded text files that contain Latin-1 accented characters to u

    - by Tim
    I am being sent text files saved in iso88591-1 format that contain accented characters from the Latin-1 range (as well as normal ASCII a-z etc). How to convert these files to utf-8 using C# so that the single-byte accented characters in iso8859-1 become valid utf-8 characters? I have tried to use a StreamReader with ASCIIEncoding, and then converting the ascii string to UTF-8 by instantiating an ascii encoding and a utf8 encoding and then using Encoding.Convert(ascii, utf8, ascii.GetBytes( asciiString) ) — but the accented characters are being rendered as question marks. What step am I missing?

    Read the article

  • Excel plugin: Finding a Chart's Source Data Number Format String

    - by Jack
    I'm currently working on a plugin for excel (using VB.net--not VBA) that will attempt (among other things) to recognize the format of the source data of a chart and configure the chart's series' number format strings appropriately. That is, yearly data should always be two numbers, monthly data should always be a 3-letter month followed by a 2-digit year, etc. The goal is to have a uniform representation across all charts for monthly data, annual data, daily data, etc. My question is this: how do I find the number format string for the cells (or any cell that is part of that series, as I will be assuming all cells that make up a particular series have the same format) that represent the source data for the chart? Note: I can assume that the chart will always point to a range of cells (not, for example, an array of data).

    Read the article

  • Python - List and Loop in one def

    - by Dunwitch
    I'm trying to get the def wfsc_pod1 and wfsc_ip into the same def. I'm not quite sure how to approach the problem. I want wfsc_pod1 to display all the information for name, subnet and gateway. Then wfsc_ip shows the ip addresses below it. I also get a None value when I run it as it. Not sure why. Anything more pythonic is more appreciated. class OutageAddress: subnet = ["255.255.255.0", "255.255.255.1"] # Gateway order is matched with names gateway = ["192.168.1.1", "192.168.1.2", "192.168.1.3", "192.168.1.4", "192.168.1.5", "192.168.1.6", "192.168.1.7", "192.168.1.8", "192.168.1.9"] name = ["LOC1", "LOC2", "LOC3", "LOC4", "LOC5", "LOC6", "LOC7", "LOC8", "LOC9"] def wfsc_pod1(self): wfsc_1 = "%s\t %s\t %s\t" % (network.name[0],network.subnet[0],network.gateway[0]) return wfsc_1 def wfsc_ip(self): for ip in range(100,110): ip = "192.168.1."+str(ip) print ip network = OutageAddress() print network.wfsc_pod1() print network.wfsc_ip()

    Read the article

  • Using Python simplejson for transmitting JSON to another server results in unicode encoding problems

    - by Mark
    Hi there, I'm encoding a string with Python's simplejson library with special characters: hello testing spécißl characters plusses: +++++ special chars :œ?´®†¥¨ˆøp“ß?ƒ©??°¬O˜çv?˜µ== However, when I encode it and transmit it to the other machine (using POST), it turns out like this: {'message': ['{"body": "hello testing sp\\u00e9ci\\u00dfl characters\\n\\nplusses: \\n\\nspecial chars :\\u0153\\u2211\\u00b4\\u00ae\\u2020\\u00a5\\u00a8\\u02c6\\u00f8\\u03c0\\u201c\\u00df\\u2202\\u0192\\u00a9\\u02d9\\u2206\\u02da\\u00ac\\u03a9\\u2248\\u00e7\\u221a\\u222b\\u02dc\\u00b5\\u2264\\u2265"}']} The + signs are completely stripped and the rest are in this unicode(?) format. My code for this is: data = {'body': data_string} data_encoded = json.dumps(data) Any ideas? Thanks! Edit: I've tried using json.dumps(data, ensure_ascii=False) but it results in a UnicodeError ordinal not in range error.

    Read the article

  • Understanding Clojure concurrency example

    - by dusha
    Hello, I just go through various documentation on Clojure concurrency and came accross the example on the website (http://clojure.org/concurrent_programming). (import '(java.util.concurrent Executors)) (defn test-stm [nitems nthreads niters] (let [refs (map ref (replicate nitems 0)) pool (Executors/newFixedThreadPool nthreads) tasks (map (fn [t] (fn [] (dotimes [n niters] (dosync (doseq [r refs] (alter r + 1 t)))))) (range nthreads))] (doseq [future (.invokeAll pool tasks)] (.get future)) (.shutdown pool) (map deref refs))) I understand what it does and how it works, but I don't get why the second anonymous function fn[] is needed? Many thanks, dusha. P.S. Without this second fn [] I get NullPointerException.

    Read the article

  • How to remove a single event in a recuring event

    - by albertos
    hi all. I' m having an issue with fullCalendar. I created a script that, adds an event to fullCalendar, along a day range, and set a unique id in order to have this event recur. let say for example that i have a recuring event from 1/1/10 till 10/1/10. i create 10 single event Objects with the same id, and place then on fullCalendar. my question is, that i want to exclude a single day over this recuring event. (for example 3/1/10). i found out, that if i remove that particural event from the sources table and then update the event its fine. but how can i get on runtime the actucal index of this eventObj on sources table? Note that, i add the events on the fullCalendar using the .fullCalendar("renderEvent") method. Thanks.

    Read the article

  • C++ Adding 2 arrays together quickly

    - by Tom Gullen
    Hello! Given the arrays: int canvas[10][10]; int addon[10][10]; Where all the values range from 0 - 100, what is the fastest way in C++ to add those two arrays so each cell in canvas equals itself plus the corresponding cell value in addon. IE, I want to achieve something like: canvas += another; So if canvas[0][0] =3 and addon[0][0] = 2 then canvas[0][0] = 5 Speed is essential here as I am writing a very simple program to brute force a knapsack type problem and there will be tens of millions of combinations.

    Read the article

  • Rapid spectral analysis of audio file using Python 2.6?

    - by Ephemeralis
    What I want to do is to have a subroutine that analyses every 200 milliseconds of a sound file which it is given and spits out the frequency intensity value (from 0 to 1 as a float) of a specific frequency range into an array which I later save. This value then goes on to be used as the opacity value for a graphic which is supposed to 'strobe' to the audio file. The problem is, I have never ventured into audio analysis before and have no clue where to start. I have looked pymedia and scipy/numpy thinking I would be able to use FFT in order to achieve this, but I am not really sure how I would manipulate this data to end up with the desired result. The documentation on the SpectrAnalyzer class of pymedia is virtually non-existant and the examples on the website do not actually work with the latest release of the library - which isn't exactly making my life easier. How would I go about starting this project? I am at a complete loss as to what libraries I should even be using.

    Read the article

< Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >