Search Results

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

Page 100/199 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • Linux: multiple network connections - 3G/4G / Wifi / LAN / etc; how can i set a preferred network connection to use?

    - by Alex
    I've been looking at how I can setup a laptop that has multiple network interfaces, but a problem exists if all the connections are active, i.e. 3G, WiFi and LAN are all connected, I would like it to default to LAN. I would like to set "weights" or "priority" to each connection, so that if the LAN is unplugged, it'll default to WiFi - if its in range and working, otherwise, it'll switch and use the 3G dongle; I've been looking around and I can see that the "metric" counter for route isn't being used for recent kernels. I thought that would be able to set the preferred gateway / connections - but according to the man page: man route: OUTPUT Metric The 'distance' to the target (usually counted in hops). It is not used by recent kernels, but may be needed by routing daemons. So I'm confused, are there any scripts / apps / anything that can detect active network connections, and by way of configuration, send my default gateway network traffic through that interface if its active / alive?

    Read the article

  • Matlab: Optimization by perturbing variable

    - by S_H
    My main script contains following code: %# Grid and model parameters nModel=50; nModel_want=1; nI_grid1=5; Nth=1; nRow.Scale1=5; nCol.Scale1=5; nRow.Scale2=5^2; nCol.Scale2=5^2; theta = 90; % degrees a_minor = 2; % range along minor direction a_major = 5; % range along major direction sill = var(reshape(Deff_matrix_NthModel,nCell.Scale1,1)); % variance of the coarse data matrix of size nRow.Scale1 X nCol.Scale1 %# Covariance computation % Scale 1 for ihRow = 1:nRow.Scale1 for ihCol = 1:nCol.Scale1 [cov.Scale1(ihRow,ihCol),heff.Scale1(ihRow,ihCol)] = general_CovModel(theta, ihCol, ihRow, a_minor, a_major, sill, 'Exp'); end end % Scale 2 for ihRow = 1:nRow.Scale2 for ihCol = 1:nCol.Scale2 [cov.Scale2(ihRow,ihCol),heff.Scale2(ihRow,ihCol)] = general_CovModel(theta, ihCol/(nCol.Scale2/nCol.Scale1), ihRow/(nRow.Scale2/nRow.Scale1), a_minor, a_major, sill/(nRow.Scale2*nCol.Scale2), 'Exp'); end end %# Scale-up of fine scale values by averaging [covAvg.Scale2,var_covAvg.Scale2,varNorm_covAvg.Scale2] = general_AverageProperty(nRow.Scale2/nRow.Scale1,nCol.Scale2/nCol.Scale1,1,nRow.Scale1,nCol.Scale1,1,cov.Scale2,1); I am using two functions, general_CovModel() and general_AverageProperty(), in my main script which are given as following: function [cov,h_eff] = general_CovModel(theta, hx, hy, a_minor, a_major, sill, mod_type) % mod_type should be in strings angle_rad = theta*(pi/180); % theta in degrees, angle_rad in radians R_theta = [sin(angle_rad) cos(angle_rad); -cos(angle_rad) sin(angle_rad)]; h = [hx; hy]; lambda = a_minor/a_major; D_lambda = [lambda 0; 0 1]; h_2prime = D_lambda*R_theta*h; h_eff = sqrt((h_2prime(1)^2)+(h_2prime(2)^2)); if strcmp(mod_type,'Sph')==1 || strcmp(mod_type,'sph') ==1 if h_eff<=a cov = sill - sill.*(1.5*(h_eff/a_minor)-0.5*((h_eff/a_minor)^3)); else cov = sill; end elseif strcmp(mod_type,'Exp')==1 || strcmp(mod_type,'exp') ==1 cov = sill-(sill.*(1-exp(-(3*h_eff)/a_minor))); elseif strcmp(mod_type,'Gauss')==1 || strcmp(mod_type,'gauss') ==1 cov = sill-(sill.*(1-exp(-((3*h_eff)^2/(a_minor^2))))); end and function [PropertyAvg,variance_PropertyAvg,NormVariance_PropertyAvg]=... general_AverageProperty(blocksize_row,blocksize_col,blocksize_t,... nUpscaledRow,nUpscaledCol,nUpscaledT,PropertyArray,omega) % This function computes average of a property and variance of that averaged % property using power averaging PropertyAvg=zeros(nUpscaledRow,nUpscaledCol,nUpscaledT); %# Average of property for k=1:nUpscaledT, for j=1:nUpscaledCol, for i=1:nUpscaledRow, sum=0; for a=1:blocksize_row, for b=1:blocksize_col, for c=1:blocksize_t, sum=sum+(PropertyArray((i-1)*blocksize_row+a,(j-1)*blocksize_col+b,(k-1)*blocksize_t+c).^omega); % add all the property values in 'blocksize_x','blocksize_y','blocksize_t' to one variable end end end PropertyAvg(i,j,k)=(sum/(blocksize_row*blocksize_col*blocksize_t)).^(1/omega); % take average of the summed property end end end %# Variance of averageed property variance_PropertyAvg=var(reshape(PropertyAvg,... nUpscaledRow*nUpscaledCol*nUpscaledT,1),1,1); %# Normalized variance of averageed property NormVariance_PropertyAvg=variance_PropertyAvg./(var(reshape(... PropertyArray,numel(PropertyArray),1),1,1)); Question: Using Matlab, I would like to optimize covAvg.Scale2 such that it matches closely with cov.Scale1 by perturbing/varying any (or all) of the following variables 1) a_minor 2) a_major 3) theta Thanks.

    Read the article

  • VPN to Buffalo WHR-HP-G300N produces a Connection Error 807

    - by Darius
    My friend has modem/router from Clear and I have sent him Buffalo router to put it between his Clear device and the Network. I walked him thru establishing VPN in DD-WRT but when I try to VPN I get a VPN Connection Error 807. I am out of ideas how to solve this. Any suggestion? Clear Modem WAN: xx.xx.xx.xx Clearn Modem NAT's to: 192.168.15.XXX Clear Modem DHCP: 192.168.15.2 - 192.168.15.2 (range is limited to that of ONE ip address) Clear Modem DMZ: 192.168.15.2 the LAN of the clear modem is 192.168.15.XXX The DD-WRT IP: 192.168.4.1 Port FWD: 1723 to 192.168.4.1 PPTP server listens on 192.168.4.1 Where is the problem with this setup?

    Read the article

  • JQuery SelectToUISlider Issues

    - by David Savage
    Hopefully this hasn't been asked before as just a slider question, but I couldn't find an answer when already browsing questions. So, here goes: I have a SelectToUISlider (http://www.filamentgroup.com/lab/update_jquery_ui_slider_from_a_select_element_now_with_aria_support/) which is basically a modified JQuery UI Slider, and I'm using a range value. So, I start with one handle at 60, and another at 100 (scale from 0 to 100). What I want to do is click a radio button so that the 100 changes to a 0, and be able to change back to 100. I have been unsuccessful at changing it via JQuery selectors/javascript. However, when changing the selects to move the handles, this works, but the range appears not to follow if the second handle (at 100) moves to 0 behind the first handle (at 60). I'm thinking I might have to destroy the slider and rebuild it with the second handle (that starts as 100) become the first handle at 0 in this scenario (although I've tried destroying it and it doesn't seem to respond to that either.) Here's what I've tried so far that doesn't work: <script type="text/javascript"> {literal} $(function(){ $('select').selectToUISlider({ labels: 10 }); }); function event_occurs(does) { if (does == 1) { $('.ui-slider').slider('option', 'values', [60,100]); } else { $('.ui-slider').slider('option', 'values', [0,60]); } } </script> <style type="text/css"> form {font-size: 62.5%; font-family:"Segoe UI","Helvetica Neue",Helvetica,Arial,sans-serif; } fieldset { border:0; margin: 1em; height: 12em;} label {font-weight: normal; float: left; margin-right: .5em; font-size: 1.1em;} select {margin-right: 1em; float: left;} .ui-slider {clear: both; top: 5em;} .ui-slider-tooltip {white-space: nowrap;} </style> {/literal} <form action="#"> <fieldset> <select name="valueA" id="my_estimate"> {section name="estimates" loop=101} <option value="{$smarty.section.estimates.index}"{if $smarty.section.estimates.index == 60} selected{/if}>{$smarty.section.estimates.index}</option> {/section} </select> <select name="valueB" id="payout"> {section name="estimates" loop=101} <option value="{$smarty.section.estimates.index}"{if $smarty.section.estimates.index == 100} selected{/if}>{$smarty.section.estimates.index}</option> {/section} </select> </fieldset> </form> <input type="radio" onclick="event_occurs(1)" name="Event" checked="checked"> Event Occurs<br /> <input type="radio" onclick="event_occurs(0)" name="Event"> Event Does Not Occur As it is now, nothing happens when clicking the radio buttons, but I'm also not getting any Javascript errors. After I get this working, I would also like to find some way to disable one of the handles through changing the slider property. Ie leave the handle where its at but not allow it to be dragged. Any help is greatly appreciated.

    Read the article

  • Postgres error messages in Apache error log

    - by Warren Pena
    I'm running Apache 2.2, PHP 5.2, and Postgres 8.2 on Windows, and I'm seeing something funky in Apache's error.log file. Occasionally, I'll see the message "row number -1 is out of range 0..-1" pop up over and over. Unlike all the other lines in that log file, there's no timestamp or log level. Just that exact string. Googling around, it appears that message is, character for character, a common Postgres error message, but is not an Apache error. I've seen it happen multiple times, and on several different servers. I can't seem to reproduce it, though. I've tried throwing all sorts of error ridden database queries and result set inquiries at Postgres via PHP, and none of them seem to trigger that line being written to the log file. Is it possible for Postgres errors to be ending up in my Apache log file, and if so, how? What would trigger an error message like that? Thanks!

    Read the article

  • CPU Cooling with Heatsinks

    - by Jason Tzen
    I've constructed a server that uses 2 Xeon E5-2620 CPUs and per Intel's recommendation I'm in the process of ordering heatsinks for each and I'm slightly concerned about thermal management. The case I'm using is well ventilated (the Coolermaster Cosmos II) but I have a few concerns regarding the adequacy of the heatsinks recommended by the MB manufacturer (Supermicro CPU HeatSink SNK-P0048PS). As you can see these heatsinks come without a fan and I'm wondering if they can keep the Xeons within their normal temperature range... Due to the low volume of literature on the topic I wasn't able to find anything conclusive.

    Read the article

  • UPS recommendations for three grey boxes?

    - by Margaret
    Hey all We have a series of grey-box style computers acting as servers at my workplace (rather than rack-mount). We were looking to get Uninterruptible Power Supplies for them. However, I'm not sure how many at what capacity are required. I'd assume it would be a good idea to hook the peripherals in as well - there's a 18.5" LCD monitor with a KVM, along with a couple of USB hard drives that require power. I currently have the most vital machine hooked up to a cheap (temporary) UPS, but it's probably close to worse than nothing. I'm looking for reasonable value for money, though I can probably negotiate with my boss on price range. I recognise that I may well need to buy two (or even three) UPSs to support the three machines. Any recommendations?

    Read the article

  • why would you create two different subnets on the same physical network?

    - by xirtyllo
    I'm working at a messy location, one of the strange (for me) things is that on the same physical network there are two different subnets. Specifically some computers will have 10.0.0.0/24 and some others will have 172.16.0.0/24. There is only one DHCP server, which gives IPs on the 10.0.0.0/24 range, and there are two internet gateways, one with IP 172.16.0.1 and one with IP 10.0.0.1 . To give an example, I can easily swap one PC from one subnet to the other just by changing its IP and gateway settings. I am trying to imagine why they created the network this way, and which may be the possible advantages and/or drawbacks of having two different subnets on the same physical network. Any thoughts?

    Read the article

  • Server Fault Wiki: How does Subnetting Work?

    - by Kyle Brandt
    How does Subnetting Work, and How do you do it by hand or in your head? Can someone explain both conceptually and with several examples? Server Fault gets lots of subnetting homework questions, so we could use an answer to point them to on Server Fault itself. If I have a network, how do I figure out how to split it up? If I am given a netmask, how do I know what the network Range is for it? Sometimes there is a slash followed by a number, what is that number? Sometimes there is a subnet mask, but also a wildcard mask, they seem like the same thing but they are different? Someone mentioned something about knowing binary for this? Not looking for links to other sites (unless maybe you have one post with a bunch of good ones). I already know how to subnet, I just thought it would be nice if Server Fault had a generic subnetting answer.

    Read the article

  • Which is better for running Ubuntu and other Linux OSes, Chromebook or Windows, why? [on hold]

    - by Serge
    I'm learning programming and I would like to switch to a Linux OS, perhaps Ubuntu, to continue this, but the current machine is generally getting pretty old and slow and Windows is the least favorite option for production, and I can manage getting something new right around the price range of the nicest Chromebook on the market right now. However, I have compared specs of HP Chromebook 14 with those of regular PC laptops that roughly cost the same, and the latter consistently have approximately the same and sometimes higher (like the processor speed) specs. Yet usage of Chromebooks for this purpose is pretty widespread nowadays. Is this because they were initially built for a Linux OS - and is it really THAT crucial - or are there other major factors at play here?

    Read the article

  • Options for gaming remotely on a LAN?

    - by Schwern
    I have a Windows 7 desktop for gaming, a big bulky tower with a nice graphics card. I'd like to sit out on my porch rather than inside while the weather is nice and play games. I have a high end Macbook Pro. What are my options? I figure either remote desktop over the LAN on the Macbook or maybe wireless video, keyboard and mouse. Something so I don't have to physically move the PC. The sort of games range from things like Skyrim to SW:TOR to Torchlight 2. What are my options? They have to do a better than running Boot Camp on the Macbook (MacBookPro8,1 i7 2.7 Ghz but Intel Graphics 3000). I realize there's a lot of issues involved in running a game over a remote desktop with a decent frame rate, I'm interested in a practical answer with real experience behind them. Ideally something that works on a OS X so I don't have to reboot into Windows.

    Read the article

  • JSF command button attribute is transferred incorrectly

    - by Oleg Rybak
    I have following code in jsf page, backed by jsf managed bean <h:dataTable value="#{poolBean.pools}" var="item"> <h:column> <f:facet name="header"> <h:outputLabel value="Id"/> </f:facet> <h:outputText value="#{item.id}"/> </h:column> <h:column> <f:facet name="header"> <h:outputLabel value="Start Range"/> </f:facet> <h:inputText value="#{item.startRange}" required="true"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="End Range"/> </f:facet> <h:inputText value="#{item.endRange}" required="true"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Pool type"/> </f:facet> <h:selectOneMenu value="#{item.poolType}" required="true"> <f:selectItems value="#{poolBean.poolTypesMenu}"/> </h:selectOneMenu> </h:column> <h:column> <f:facet name="header"/> <h:commandButton id="ModifyPool" actionListener="#{poolBean.updatePool}" image="img/update.gif" title="Modify Pool"> <f:attribute name="pool" value="#{item}"/> </h:commandButton> </h:column> </h:dataTable> This code fragment is dedicated to editing come collection of items. Each row of the table contains "edit" button that submits changed values of the row to the server. It has the item itself as an attribute. Submit is performed by calling actionListener method in the backing managed bean. This code runs correctly on Glassfish v 2.1 But when the server was updated to Glassfish v 2.1.1, the attribute stopped to be passed correctly. Instead of passing edited item (when we change the values in table row, we are actually changing the underlying object fields), the source item is submitted to server, i.e. the item that was previously given to the page. All the changes that were made on the page are discarded. I tried to update jsf version from 1.2_02 to 1.2_14 (we are using jsf RI), but it had no effect. Perhaps anyone came across the same problem? Any help and suggestions will be appreciated.

    Read the article

  • How small is too small (of laptop for a programmer)

    - by defn
    Im thinking of replacing my HP Pavilion dv5-1004nr with Acer Aspire AS5738-6444, I'm a CS student... so im torn between screen size (liking the 15in and decent gpu.. but it weight nearly 8 pounds and battery can barely last 2 hours in power saver mode) and wanting something portable to carry to classes/take notes ect (3 pounds and up to 8 hour battery life of the acer) what would you guys suggest? acer any good? i love my hp keyboard.. (or have links to other good laptops, im aiming for 600$ range?)

    Read the article

  • Slow internet using Arch Linux

    - by GZaidman
    after a week or so of using Arch Linux I cant access the internet - it takes around 5 mins to load google (most of the other websites just give me a timeout), pacman's downloading speed range between 5-2Kbs, and pinging google takes around 9Kms. I'm connected using wireless network (wifi card is Intel Ultimate 6300 and router is Edimax 6524n). Every other Windows machine that's connected to the network (and even the T410 running Windows) is fine, so the problem lies in Linux. So far, i checked the resolv.conf file (my router ip address is listed), and the hosts file (pretty much default), and I disabled the ipv6 module. None of that helped. PS: i'm using NetworkManager (but the problem still occurs when connecting using wicd) running on Gnome3. Thanks in advance for any help you can provide! EDIT: something really strange happens whenever I ping google: i get an unknown host 'google.com', but the bit rate from the card jumps at the exact second I ping google (so far, the bit rate jumped to 54Mb/s from 1Mb/s over the course of 4 pings).

    Read the article

  • Automatically keeping two excel data tables in-sync (w/out VBA)

    - by Neil
    I'm putting together a workbook for tracking a stock portfolio. The primary sheet contains a table with the list of the transactions. From this I would like to create an overview table on another sheet with only one row per unique stock symbol that includes things like cost basis, returns, etc. The problem is that nothing I've tried updates the overview table correctly when rows are added to the transaction table. The closest I've got is something like the following: http://www.get-digital-help.com/2009/04/14/create-a-unique-alphabetically-sorted-list-extracted-from-a-column/ However, this requires applying that formula to every cell in the primary column of the overview sheet. And even then the range of the table isn't extended down to include new rows as they become valid. Essentially I'm looking for a way that auto-adds rows to a table and copies the formula based on a different table changing without using VBA. Trivial example data Sheet1 Symbol Type Shares Price F Buy 100 12 MSFT Buy 100 25 MSFT Sell 50 28 F Buy 100 16 Sheet2 Symbol Quantity F 200 MSFT 50

    Read the article

  • Postgres error messages in Apache error log

    - by Warren Pena
    I'm running Apache 2.2, PHP 5.2, and Postgres 8.2 on Windows, and I'm seeing something funky in Apache's error.log file. Occasionally, I'll see the message "row number -1 is out of range 0..-1" pop up over and over. Unlike all the other lines in that log file, there's no timestamp or log level. Just that exact string. Googling around, it appears that message is, character for character, a common Postgres error message, but is not an Apache error. I've seen it happen multiple times, and on several different servers. I can't seem to reproduce it, though. I've tried throwing all sorts of error ridden database queries and result set inquiries at Postgres via PHP, and none of them seem to trigger that line being written to the log file. Is it possible for Postgres errors to be ending up in my Apache log file, and if so, how? What would trigger an error message like that? Thanks!

    Read the article

  • Reduce the I/O priority of Windows Backup (Windows Server 2008 R2)

    - by HelloSam
    I have a PostgreSQL running on Windows Server 2008 R2 x64 box. And I have scheduled a backup everyday from the RAID 1 DB disk to a dedicated standalone disk. They are SAS 15k on Dell PERC 6i. I am using the built-in Windows Server Backup for purpose. The problem is, whenever the backup process is kicked in, the database performance is hogged. I would say almost a 10x of performance reduction. From the resource monitor, the disk queue is in the double digit range when backing up, and less than 1 during the day. The disk activity is like ~30-50MB/s during backup, so I guess the hardware is acting normally, though wbengine.exe takes up most of the portions. I think reduce the IO priority of the backup process would be an answer, but I couldn't find a way to. Tuning process CPU priority does not seems to help.

    Read the article

  • Net Screen manager setup

    - by Codezy
    I'm having an issue with our NSMExpress box. I'm trying to manage all our devices, range from ns5gt to ssg320m, and some of those devices have addresses assigned by dhcp from the ISP (like pppoe or dsl). The addresses are actually static but we have the register the MAC address in order to get this address. I can actually add the device in NSM except the IP that's on the untrust side isn't imported in as it's dynamic. Because of this I cannot change many options that pertian to the untrust interface as there is no IP. I've talked to JTAC on this and they didn't know if there was a way to do this or not but then they stated that Tim Hortons does this so I'm confused on how to get this working. Maybe i'm just missing something as I imagine that other people must be doing this as well. Any assistance is appreciated! Furthermore when I import a device this is the message I get: Warnings: Interface ethernet0/0 is a pppoe/dhcp/pppoa client and its ip is NOT IMPORTED because it may be dynamic.

    Read the article

  • Recover from a corrupted couchbase install

    - by jcolebrand
    We have a couchbase installation on a Windows 2008 R2 server that got corrupted (this was from before my tenure, now I want to clean it up). There is no add-remove entry in the Programs and Features list. There is no active service in services.msc. However, something still thinks Couchbase is installed. Shy of wiping the box (we aren't quite to "redeploy test environment servers at the push of a button" altho I'm working on it), how can I ensure that all remnants of couchbase installs prior are now gone? I believe the previous install was in the Couchbase 2.x range, but it may have been 1.7+ Running the installer again gives "Installer needs to update registry value in order to upgrade from the previous version. Please run installer again to continue."

    Read the article

  • Mac download speed keeps decreasing

    - by hatorade
    I have a Mac that is getting extremely low connection speed from my WiFi. The other 3 computers in this house have a fast connection. However, on this Mac, once I connect to WiFi it's fast, but as time goes on the speed decreases dramatically. I thought it was the browser or something (Safari) so I downloaded Firefox, but I have watched the download speed decrease consistently as time goes by and right now it's at 8kb/sec instead of the 60-200 range it started at. Any suggestions?

    Read the article

  • dhcpd won't let go of old leases

    - by Jakobud
    We have DHCP setup to hand out leases in the following range: 192.168.10.190 - 192.168.10.254 (roughly 65 leases) Our small business network only has about 30 computers that use DHCP. We noticed that dhcpd stopped handing out new dynamic leases to the computers, even though there are definitely not 65 computers on the network. Why has it stopped handing out leases? Is it not releasing old un-used leases? How do we tell dhcpd to let go of old leases and start handing out fresh ones again?

    Read the article

  • Blackjack game reshuffling problem

    - by Jam
    I am trying to make a blackjack game where before each new round, the program checks to make sure that the deck has 7 cards per player. And if it doesn't, the deck clears, repopulates, and reshuffles. I have most of the problem down, but for some reason at the start of every deal it reshuffles the deck more than once, and I can't figure out why. Help, please. Here's what I have so far: (P.S. the imported cards and games modules aren't part of the problem, I'm fairly sure my problem lies in the deal() function of my BJ_Deck class.) import cards, games class BJ_Card(cards.Card): """ A Blackjack Card. """ ACE_VALUE = 1 def get_value(self): if self.is_face_up: value = BJ_Card.RANKS.index(self.rank) + 1 if value > 10: value = 10 else: value = None return value value = property(get_value) class BJ_Deck(cards.Deck): """ A Blackjack Deck. """ def populate(self): for suit in BJ_Card.SUITS: for rank in BJ_Card.RANKS: self.cards.append(BJ_Card(rank, suit)) def deal(self, hands, per_hand=1): for rounds in range(per_hand): for hand in hands: if len(self.cards)>=7*(len(hands)): top_card=self.cards[0] self.give(top_card, hand) else: print "Reshuffling the deck." self.cards=[] self.populate() self.shuffle() top_card=self.cards[0] self.give(top_card, hand) class BJ_Hand(cards.Hand): """ A Blackjack Hand. """ def init(self, name): super(BJ_Hand, self).init() self.name = name def __str__(self): rep = self.name + ":\t" + super(BJ_Hand, self).__str__() if self.total: rep += "(" + str(self.total) + ")" return rep def get_total(self): # if a card in the hand has value of None, then total is None for card in self.cards: if not card.value: return None # add up card values, treat each Ace as 1 total = 0 for card in self.cards: total += card.value # determine if hand contains an Ace contains_ace = False for card in self.cards: if card.value == BJ_Card.ACE_VALUE: contains_ace = True # if hand contains Ace and total is low enough, treat Ace as 11 if contains_ace and total <= 11: # add only 10 since we've already added 1 for the Ace total += 10 return total total = property(get_total) def is_busted(self): return self.total > 21 class BJ_Player(BJ_Hand): """ A Blackjack Player. """ def is_hitting(self): response = games.ask_yes_no("\n" + self.name + ", do you want a hit? (Y/N): ") return response == "y" def bust(self): print self.name, "busts." self.lose() def lose(self): print self.name, "loses." def win(self): print self.name, "wins." def push(self): print self.name, "pushes." class BJ_Dealer(BJ_Hand): """ A Blackjack Dealer. """ def is_hitting(self): return self.total < 17 def bust(self): print self.name, "busts." def flip_first_card(self): first_card = self.cards[0] first_card.flip() class BJ_Game(object): """ A Blackjack Game. """ def init(self, names): self.players = [] for name in names: player = BJ_Player(name) self.players.append(player) self.dealer = BJ_Dealer("Dealer") self.deck = BJ_Deck() self.deck.populate() self.deck.shuffle() def get_still_playing(self): remaining = [] for player in self.players: if not player.is_busted(): remaining.append(player) return remaining # list of players still playing (not busted) this round still_playing = property(get_still_playing) def __additional_cards(self, player): while not player.is_busted() and player.is_hitting(): self.deck.deal([player]) print player if player.is_busted(): player.bust() def play(self): # deal initial 2 cards to everyone self.deck.deal(self.players + [self.dealer], per_hand = 2) self.dealer.flip_first_card() # hide dealer's first card for player in self.players: print player print self.dealer # deal additional cards to players for player in self.players: self.__additional_cards(player) self.dealer.flip_first_card() # reveal dealer's first if not self.still_playing: # since all players have busted, just show the dealer's hand print self.dealer else: # deal additional cards to dealer print self.dealer self.__additional_cards(self.dealer) if self.dealer.is_busted(): # everyone still playing wins for player in self.still_playing: player.win() else: # compare each player still playing to dealer for player in self.still_playing: if player.total > self.dealer.total: player.win() elif player.total < self.dealer.total: player.lose() else: player.push() # remove everyone's cards for player in self.players: player.clear() self.dealer.clear() def main(): print "\t\tWelcome to Blackjack!\n" names = [] number = games.ask_number("How many players? (1 - 7): ", low = 1, high = 8) for i in range(number): name = raw_input("Enter player name: ") names.append(name) print game = BJ_Game(names) again = None while again != "n": game.play() again = games.ask_yes_no("\nDo you want to play again?: ") main() raw_input("\n\nPress the enter key to exit.")

    Read the article

  • How to Shrink large Hyper-V VM

    - by autrevo
    Using Disk2VHD utility I converted my bare-metal OS into Hyper-V VHD - http://technet.microsoft.com/en-us/sysinternals/ee656415.aspx And I could obtain a huge 190GB VHD file. Apart from performance issues, this VHD worked fine as guest when hosted on Windows Server 200 R2, Hyper-V. Having realized need to keeping only system files and application installations on VHD. I have deleted most of the junk data from this VHD and now it contains only 20-25 GB. But I am not able to shrink the VHD VM. Having done some research, I came to know, this as a limitation of .VHD files. Subsequently I followed these two step using Edit Virtual Hard Wizard on Windows 2012 Box. Convert from VHD to VHDX (took close to 3 hrs.) Compact (Another 4 hrs.) This did not ever shrink the VHDX either. Does Hyper-V does not provide proper support to handle large VHDs or VHDXs whose size are the range of 200GB.

    Read the article

  • Assigning security groups different ranges

    - by Mustafa Ismail Mustafa
    Is it possible to assign a security group in windows 2008 a specific DHCP scope? Meaning, let's say we have 2 groups, employees and managers in the superscope Company. Assuming that each user is distinctly in either group and there are no overlaps, would it be possible to assign members of the security group employees a dhcp address in the range 192.168.1.0/24 and managers 192.168.2.0/24 ? The DHCP server is the same server. This is on Windows SBS 2008 if it makes any difference If it is possible, how do you go about setting it up. TIA

    Read the article

  • On a router, how do I block wan access for a particular machine without blocking its access to the local network?

    - by HappyEngineer
    On my tp-link TL-WR1043ND router I want to prevent a particular machine from having access to the WAN while still allowing that machine to access other machines on the LAN. My assumption is that I need to do something in the "Access Control" section, however the problem is that it wants an ip range or domain name for the target of the rule. The router uses DHCP to get an address from the WAN, so I don't have any guarantee what the ip address of the wan will be. If the answer is that it's not possible with this router, could someone describe how to do it using OpenWRT instead?

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >