;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Configuration;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;

namespace HandoffMatchmaker.Services
{
	public class AzureBlobCloudLock : ICloudLock
	{
		private static readonly Dictionary<string, LeaseTimer> _timerCache = new Dictionary<string, LeaseTimer>();
		private const string LockContainerName = "cloudlocks";
		private readonly CloudBlobContainer _blobContainer;
		public AzureBlobCloudLock(IConfiguration configuration)
		{
			string connectionString = configuration.GetValue<string>("AzureWebJobsStorage");

			StorageAccount storageAccount = StorageAccount.NewFromConnectionString(connectionString);
			CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
			_blobContainer = blobClient.GetContainerReference(LockContainerName);
			_blobContainer.CreateIfNotExistsAsync().Wait();
		}

		private class LeaseTimer
		{
			private readonly CloudBlockBlob _blob;
			private readonly string _leaseId;
			private readonly Timer _timer;
			public LeaseTimer(CloudBlockBlob blob, string leaseId)
			{
				_blob = blob;
				_leaseId = leaseId;
				_timer = new Timer(async (o) => await RenewLeaseAsync(), null, 15 * 1000, 15 * 1000);
			}
			private async Task RenewLeaseAsync()
			{
				try
				{
					await _blob.RenewLeaseAsync(new AccessCondition
					{
						LeaseId = _leaseId
					});
				}
				catch
				{
					Stop();
				}
			}
			public void Stop()
			{
				_timer.Change(-1, Timeout.Infinite);
				_timer.Dispose();
			}
		}

		public async Task<(bool, string)> GetLockAsync(string key)
		{
			try
			{
				CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(key);
				if (!await blob.ExistsAsync())
					await blob.UploadTextAsync("lock");
				string leaseId = await blob.AcquireLeaseAsync(TimeSpan.FromSeconds(30));
				lock (_timerCache)
				{
					if (_timerCache.ContainsKey(key)) _timerCache.Remove(key);
					_timerCache.Add(key, new LeaseTimer(blob, leaseId));
				}
				return (true, leaseId);
			}
			// TODO: Don't catch 'em all!
			catch
			{
				return (false, null);
			}
		}

		public async Task<bool> ReleaseLockAsync(string key, string leaseId)
		{
			CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(key);
			try
			{
				await blob.ReleaseLeaseAsync(new AccessCondition
				{
					LeaseId = leaseId
				});
				lock (_timerCache)
				{
					if (_timerCache.ContainsKey(key))
					{
						_timerCache[key].Stop();
						_timerCache.Remove(key);
					}
				}
				return true;
			}
			// TODO: Don't catch 'em all!
			catch
			{
				return false;
			}
		}
	}
}
Last night after our feast at a Vegas buffet, we searched long and hard and finally found an RV friendly casino to overnight park. It wasn’t exactly on the strip but just a few blocks away we found ourselves in the parking lot of the Orleans sleeping next to a bunch of 18 wheelers.
This morning again we woke up to a sky full of balloons. You’d think we’d get use to this after 4 days with them floating practically constantly in the sky but no, they are still breathtakingly amazing to see.
Our first night at the Balloon Fiesta campground was pretty pleasant. Except now Ava insists on sleeping on the bed with Marlene while I sleep on the converted gaucho seat because she claims to be too scared. I call BS, the bed is much more comfortable.
Our second night straight camping in Walmart got us just to the edge of town in Albuquerque. At long last, we made it to the balloon fiesta! Well, almost, we are headed to the RV camping area this morning that is a short 15 miles away.Following the BHB post January 2 that the Heights Veterinary Hospital at 59 Hicks Street closed without warning at year’s end, the Brooklyn Paper now shares the rest of the story.
Doc Richard Turoff told writer Natalie O’Neill that the November death of one-time co-worker and friend Bernard Wasserman, who lived above the business, prompted his decision to retire. “It seemed to be the end of an era. It’s a terrific neighborhood, full of people who take incredible care of their pets, but it’s time to go,” said the motorcycle-riding, earring-donning vet.
Before he adhered a “See Ya” sign to the door Jan. 1, Turoff transferred all pet patient files to Atlantic Animal Care on 85 Atlantic Street.
Turoff took over the animal hospital, first owned by Wasserman, in 1985, after the two vets had worked together for four years. When the latter died, the doc said he was ready to transition. “I was torn at first,” he said. “But it’s time to move on.” The Brooklyn Paper reports he will spend now time studying zoo medicine and hanging out with his cat at home in Prospect Park South.This is a high tension subsector between the two large empires, The 3:rd Imperium and The Zhodani Consulate, and the two local powers, The Darrians and the Avalars. The Imperium have a forward base at Hollis.
In the middle of this is a strange world that have kept its independence. This is Reidain, an ellipsoid waterworld with a 2 billion population. Reidain also controls two of its neighbour systems.
Since this is a high tension subsector, many of the worlds have a high tech-level. The highest TL is D at six different worlds. Five worlds have TL C. Reidain have benefited from this and also risen its TL to D.
The Avalars control four systems in this subsector. These systems were part of the former Kamrati League. The TL of these four systems is not very high. There is a jump-3 gap to the rest of the subsector, and therefore only limited contact. The Avalars have a defensive and trading base at Ryanbiwul.
The Alenzar and Raschev systems appeared in Double Adventure 5. (Chamax Plague/Horde) More about the bugs on Raschev and Striker units meeting them can be found in JTAS No. 17.
Hollis is from Imperial Lines #1.
The name for the subsector is Reidain at the full color map of the Spinward Marches that came with the Deluxe Edition. In Imperial Lines #1 it is called Reidan.The braillist/tactual materials specialist for children with visual impairments provides braille embossed materials as determined by the VI teacher and the classroom teacher.
library of braille (tactual) materials.
Order and maintain the supply of office products.
Locate and obtain brailled textbooks and workbooks for students.
Coordinate delivery of brailled (or other tactual) materials to the appropriate schools.
use of brailling equipment.
Attend workshops/seminars for continuous upgrading of services and equipment.
Carry out braille basic formatting for literary, foreign language, and Nemeth code rules, except when modifications are requested by VI teacher to accommodate braille reading ability of individual students.
Accurate and timely work to be evaluated by VI professional and special education administration in accordance with school board policy.
Complete job duties in a timely manner.
Assist students with visual impairments to achieve maximum independence through instruction in safe, efficient travel within the home, school, and community. Services also include instruction in compensatory skills including daily living skills, self advocacy, and recreation or leisure skills as related to orientation and mobility. Students may range in ages from birth through 21. Students may be functionally blind or have low vision. Community-based instruction is a critical component of the orientation and mobility program.
Recommend any modifications to program or specialized services needed based on the visual impairment.
Provide direct instructional services to students with visual impairment in accordance with the evaluation.
Performance on the job will be evaluated by supervisor. Evaluation should be completed by individual(s) knowledgeable in visual impairments.
Orientation and mobility is that part of the educational process that prepares the blind student to travel independently. The itinerant O&M specialist travels to the students' assigned schools and/or home to provide direct and/or consultative special education services relating to the vision loss. The O&M specialist is prepared to provide service to an array of students including infants, students with low vision and/or multiple impairments. These services enable the students to travel safely and independently in their home, school, and community environments. The students range in age from birth to 21