Random walk in limited range
2D random walk within a bounded area
Is there a word for colloquial forms of address? For example, "dude," "man," "buddy," "pal," etc, when used to stand in for someone's name.  "Hey, pal, how's it going?"  Is there a word for terms like these?  Or is "colloquialism" as close as we can get? Bash while read loop breaking early I've been banging my head against for wall for a while with this one.  I want to SSH into a set of machines and check whether they are available (accepting connections and not being used). I have created a small script, tssh, which does just that:  #!/bin/bash  host=$1 timeout=${2:-1}  ssh -qo "ConnectTimeout $timeout" $host "[ \`who | cut -f1 | wc -l \` -eq 0 ] &amp;&amp; exit 0 || exit 1"   This script works correctly. Returning 255 if there was a connection problem, 1 if the machine is busy and 0 if everything is good. If anyone knows a better way to do this please let me know.  So next I try and call tssh on my set of machines using a while read loop, and this is where it all goes wrong. The loop exits as soon as tssh returns 0 and never completes the full set.   while read nu ; do tssh "MYBOXES$nu" ; done &lt; &lt;(ruby -e '(0..20).each { |i| puts i }')   At first I thought this was a subshell problem but apparently not. Any help, along with comments on style/content, would be much appreciated! I know I'm going to kick myself when I find out why... Password Protect QGIS project On a shared computer, I have a QGIS project which links up to a PostGIS database that contains my data. If a user wants to access layers from the db, they have to enter the db credentials, so that's OK.   However, I have previously logged on and imported layers from my db into QGIS, and manipulated them in QGIS (styling options based on meta-data, etc.)... Anybody who opens my QGIS project can view these layers in QGIS, and can therefore see the data I wish to be protected in my db.  Is there a way to password protect my QGIS project? Check Constraint with Case Statement I want to add a check constraint on a column if entered value for column is greater than 3 than it should be saved as 1 else entered value. For that scenario I am using below query but on insertion of data it shows an error message.  create table tblTestCheckConstraint  ( id int, NewColumn int )   alter table tblTestCheckConstraint add constraint chk_tblTestCheckConstraint_NewColumn1 CHECK   (     CASE         WHEN NewColumn &gt;4 THEN 1         ELSE NewColumn     END = 1 )   Insert Statement:   insert into tblTestCheckConstraint values ( 1,5) insert into tblTestCheckConstraint values ( 1,2)   Error Message:   Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the CHECK constraint "chk_tblTestCheckConstraint_NewColumn1". The conflict occurred in database "DBName" , table "dbo.tblTestCheckConstraint", column 'NewColumn'. The statement has been terminated. Temporarily suspend bash_history on a given shell? Is there a way to temporarily suspend history tracking in bash, so as to enter a sort of "incognito" mode? I'm entering stuff into my terminal that I don't want recorded, sensitive financial info. Does a 2100W angle grinder need an earth pin? I have recently purchased a Makita 2100W angle grinder. It has just the live (L) and neutral (N) connectors unlike the one I previously used, which had a third protected earth (PE) connection.   Would it be better if I changed the connections to a 3 pin connector? How to use a decimal range() step value? Is there a way to step between 0 and 1 by 0.1?   I thought I could do it like the following, but it failed:  for i in range(0, 1, 0.1):     print i   Instead, it says that the step argument cannot be zero, which I did not expect. The use of weak references is something that I've never seen an implementation of so I'm trying to figure out what the use case for them is and how the implementation would work. When have you needed to use a WeakHashMap or WeakReference and how was it used? What is the benefit/downside to using a switch statement vs. an if/else in C#.  I can't imagine there being that big of a difference, other than maybe the look of your code. Is there any reason why the resulting IL or associated runtime performance would be radically different? Related: Removing overlapping/duplicate polygons in same layer using QGIS? I have been trying to create a function that does basically the same thing that the QGIS "dissolve" function. I thought it would be super easy but well apparently not. So from what I have gathered around, the use of fiona with shapely should be the best option here. I just began to mess around with vector files so this world is pretty new to me and python as well.  For these example, I am working with a county shapefile founded here  So here are some piece of code I gathered but can't find a way to make them work together  For now my best method is the following based on : . It works fine and I get a list of the 52 states as Shapely geometry. Please feel free to comment if there is a more straight forward way to do this part.  from osgeo import ogr from shapely.wkb import loads from numpy import asarray from shapely.ops import cascaded_union  ds = ogr.Open('counties.shp') layer = ds.GetLayer(0)  #create a list of unique states identifier to be able #to loop through them later STATEFP_list = [] for i in range(0 , layer.GetFeatureCount()) :     feature = layer.GetFeature(i)     statefp = feature.GetField('STATEFP')     STATEFP_list.append(statefp)  STATEFP_list = set(STATEFP_list)  #Create a list of merged polygons = states  #to be written to file polygons = []  #do the actual dissolving based on STATEFP #and append polygons for i in STATEFP_list :      county_to_merge = []     layer.SetAttributeFilter("STATEFP = '%s'" %i )      #I am not too sure why "while 1" but it works      while 1:         f = layer.GetNextFeature()         if f is None: break         g = f.geometry()         county_to_merge.append(loads(g.ExportToWkb()))      u = cascaded_union(county_to_merge)     polygons.append(u)  #And now I am totally stuck, I have no idea how to write  #this list of shapely geometry into a shapefile using the #same properties that my source.   So the writing is really not straight forward from what I have seen, I really just want the same shapefile only with the country dissolve into states, I don't even need much of the attribute table but I am curious to see how you can pass it on from the source to the new created shapefile.  I found many pieces of code for writing with fiona but I am never able to make it work with my data. Example from  :  from shapely.geometry import mapping, Polygon import fiona  # Here's an example Shapely geometry poly = Polygon([(0, 0), (0, 1), (1, 1), (0, 0)])  # Define a polygon feature geometry with one attribute schema = {     'geometry': 'Polygon',     'properties': {'id': 'int'}, }  # Write a new Shapefile with fiona.open('my_shp2.shp', 'w', 'ESRI Shapefile', schema) as c:     ## If there are multiple geometries, put the "for" loop here     c.write({         'geometry': mapping(poly),         'properties': {'id': 123},     })   The problem here is how to do the same with a list of geometry and how to recreate the same properties than the source. OS volume shows as type 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF' Yesterday, I have tried to delete an Ubuntu partition. Since, my Mac (13", MBPro mid-2014) doesn't boot. Now, I boot on Mac OS copy with an USB. i follow different subject of this forum (like this : ), and my volume partition change from FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF to 48465300-0000-11AA-AA11-00306543ECAC. But I still can't boot to it...    Thank you very much ! What determines the number of comments that are displayed? How do I change the screen resolution using Ubuntu command line? Say I have a variable named choice it is equal to 2. How would I access the name of the variable? Something equivalent to  In [53]: namestr(choice) Out[53]: 'choice'   for use in making a dictionary. There's a good way to do this and I'm just missing it.  EDIT:  The reason to do this is thus. I am running some data analysis stuff where I call the program with multiple parameters that I would like to tweak, or not tweak, at runtime. I read in the parameters I used in the last run from a .config file formated as  filename no_sig_resonance.dat  mass_peak 700  choice 1,2,3   When prompted for values, the previously used is displayed and an empty string input will use the previously used value.  My question comes about because when it comes to writing the dictionary that these values have been scanned into. If a parameter is needed I run get_param which accesses the file and finds the parameter.   I think I will avoid the problem all together by reading the .config file once and producing a dictionary from that. I avoided that originally for... reasons I no longer remember. Perfect situation to update my code! Gave up waiting for root device on Ubuntu Why is HMAC-SHA1 still considered secure? This Q &amp; A   says that the security of HMAC-SHA1 does not depend on resistance to collisions? Are they are saying specifically with respect to HOTP or for HMAC-SHA1 for any use?     If HMAC-SHA1 is used for verifying the integrity of a document and you can find a collision, you can make changes in the document, right?      Even the RFC says that resistance to collisions is relevant       The security of the message authentication mechanism presented here depends on cryptographic properties of the hash function H: the resistance to collision finding (limited to the case where the initial value is secret and random, and where the output of the function is not explicitly available to the attacker), and the message authentication property of the compression function of H when applied to single blocks    What am I missing here? Any Set with Associativity, Left Identity, Left Inverse is a Group Related Link:    Reference: Fraleigh p. 49 Question 4.38 in A First Course in Abstract Algebra     I will present my proof (distinct from those in the link) for critique and then ask my question.  $G$ is a set and $ \times $ is an associative binary operation.  Suppose that there exists a $e \in G$ such that, for all $a \in G$, $ea = a$ and $a^{-1}a = e$ for some $a^{-1} \in G$.  Show that for the same $e$, $ae = a$ and $aa^{-1} = e$.  $a^{-1}(aa^{-1})a = (a^{-1}a)(a^{-1}a) = ee = e = a^{-1}a = a^{-1}(a^{-1}a)a$  Since $a^{-1} \in G$, it has a left inverse; apply it to both ends, and we have $(aa^{-1})a = (a^{-1}a)a$.  As a result, $ae$ = $a(a^{-1}a) = (aa^{-1})a = (a^{-1}a)a = ea$.  For the right inverse, start with $aa^{-1} = a(a^{-1}a)a^{-1} = (aa^{-1})(aa^{-1})$.  Since $\times$ is a binary operation, $aa^{-1} \in G$ and has a left inverse; apply it to both ends, and we have $e = aa^{-1}$.  In second comment following the question in the link, Mr. Derek Holt pointed out that the requester did not word his/her question correctly.  Specifically, the identity in the second axiom is not well-defined.     Let $(G, *)$ be a semi-group. Suppose    1. $ \exists e \in G$ such that $\forall a \in G,\  ae = a$;    2. $\forall a \in G, \exists a^{-1} \in G$ such that $aa^{-1} = e$.    How can we prove that $(G,*)$ is a group?    This formulation makes the same technical error as many textbooks. The $e$ in your second axiom is not well-defined. "But obviously it's intended to be the same $e$ as in the first axiom" you reply. But the first axiom does not necessarily specify a unique element $e$. So should we interpret the second axiom as meaning "for some $e$ as in 1" or "for all $e$ as in 1"? –  Derek Holt Sep 17 '11 at 15:31   Was he saying that if, in axiom 1, we have $ae_1 = a, ae_2 = a$, but $e_1 \neq e_2$,  when we get to axiom 2, do we have $aa^{-1} = e_1, aa^{-1} = e_2$, or two different inverses so that $aa_1^{-1} =  e_1, aa^{-1}_2 = e_2$?  I think my wording eliminated the ambiguity.  It does not imply that $e$ is unique, but if $e$ is a left identity and produces left inverses, then it is also a right identity and produces right inverses. I tried really hard on this one; please kindly point out my mistakes. Linux Command Not Functioning As Alias How to fix the incompatility between BiBer and BiBLaTeX versions in TeXmaker?