Search Results

Search found 11 results on 1 pages for 'aherrick'.

Page 1/1 | 1 

  • C# Working with Locking and Threads

    - by aherrick
    Work on this small test application to learn threading/locking. I have the following code, I would think that the line should only write to console once. However it doesn't seem to be working as expected. Any thoughts on why? What I'm trying to do is add this Lot object to a List, then if any other threads try and hit that list, it would block. Am i completely misusing lock here? class Program { static void Main(string[] args) { int threadCount = 10; //spin up x number of test threads Thread[] threads = new Thread[threadCount]; Work w = new Work(); for (int i = 0; i < threadCount; i++) { threads[i] = new Thread(new ThreadStart(w.DoWork)); } for (int i = 0; i < threadCount; i++) { threads[i].Start(); } // don't let the console close Console.ReadLine(); } } public class Work { List<Lot> lots = new List<Lot>(); private static readonly object thisLock = new object(); public void DoWork() { Lot lot = new Lot() { LotID = 1, LotNumber = "100" }; LockLot(lot); } private void LockLot(Lot lot) { // i would think that "Lot has been added" should only print once? lock (thisLock) { if(!lots.Contains(lot)) { lots.Add(lot); Console.WriteLine("Lot has been added"); } } } }

    Read the article

  • .NET Working with Locking and Threads

    - by aherrick
    Work on this small test application to learn threading/locking. I have the following code, I would think that the line should only write to console once. However it doesn't seem to be working as expected. Any thoughts on why? What I'm trying to do is add this Lot object to a List, then if any other threads try and hit that list, it would block. Am i completely misusing lock here? class Program { static void Main(string[] args) { int threadCount = 10; //spin up x number of test threads Thread[] threads = new Thread[threadCount]; Work w = new Work(); for (int i = 0; i < threadCount; i++) { threads[i] = new Thread(new ThreadStart(w.DoWork)); } for (int i = 0; i < threadCount; i++) { threads[i].Start(); } // don't let the console close Console.ReadLine(); } } public class Work { List<Lot> lots = new List<Lot>(); private static readonly object thisLock = new object(); public void DoWork() { Lot lot = new Lot() { LotID = 1, LotNumber = "100" }; LockLot(lot); } private void LockLot(Lot lot) { // i would think that "Lot has been added" should only print once? lock (thisLock) { if(!lots.Contains(lot)) { lots.Add(lot); Console.WriteLine("Lot has been added"); } } } }

    Read the article

  • ASP.NET MVC Login ReturnUrl always NULL?

    - by aherrick
    Using Forms Authentication in ASP.NET MVC when trying to log back into a site, it puts a ReturnUrl parameter in the query string. My Logon action method accepts a "returnUrl" string. However it seems that returnUrl string is always null, even when it is clearly in the query string. Any thoughts on why this might be the case or a possible fix?

    Read the article

  • jQuery CSS Custom Flyout Menu Styling Issue

    - by aherrick
    I'm close to nailing this flyout menu I have been working on, just have a couple of current pain points. I'm trying to get left/right padding on my submenu items, as you can see I am not quite there. Also when the first submenu is displayed, I want to create a bit of a gap between the first row of list items and the child. Below is my current code and a screen shot displaying what I want. Based on my current CSS, any thoughts on how to get this done in a clean way? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> function mainmenu() { $("#nav ul").css({ display: "none" }); // Opera Fix $("#nav li").hover(function() { $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(400); }, function() { $(this).find('ul:first').css({ visibility: "hidden" }); }); } $(document).ready(function() { mainmenu(); }); </script> <style type="text/css"> * { padding: 0px; margin: 0px; } body { font-size: 0.85em; font-family: Verdana, Arial, Helvetica, sans-serif; } #nav, #nav ul { margin: 0; padding: 0; list-style-type: none; list-style-position: outside; position: relative; } #nav a { display: block; padding: 4px 0px 4px 0px; color: #dfca90; text-decoration: none; background-color: #ECE9D8; font-size: 9px; font-weight: bold; font: bold 15px Palatino, 'Palatino Linotype' , Georgia, serif; } #nav > li > a { font-size: 16px; font-variant: small-caps; border-right: 1px solid #dfca90; padding-right: 10px; padding-left: 10px; padding-bottom: 6px; padding-top: 6px; background-color: #fff; color: #dfca90; } #nav li ul li a:hover { color: #999; } #nav li { float: left; position: relative; } #nav ul { position: absolute; display: none; width: 170px; border: 2px solid #dfca90; } #nav ul li { } #nav li ul a { width: 170px; height: auto; float: left; } #nav ul ul { top: -2px; } #nav li ul ul { left: 170px; background-color: #ECE9D8; } #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul { display: none; } #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li li li:hover ul { display: block; } </style> </head> <body> <ul id="nav"> <li><a href="#">1 HTML</a></li> <li><a href="#">2 CSS</a></li> <li><a href="#">3 Javascript </a> <ul> <li><a href="#">3.1 jQuery</a> <ul> <li><a href="#">3.1.1 Download</a> </li> <li><a href="#">3.1.2 Tutorial</a> </li> </ul> </li> <li><a href="#">3.2 Mootools</a></li> <li><a href="#">3.3 Prototype</a></li> </ul> </li> </ul> </body> </html>

    Read the article

  • CSS / jQuery Vertically and Horizontally Center DIV

    - by aherrick
    I'm trying to vertically and horizontally center this div even when there is content to scroll and the user is scrolling down the page. The following test works fine in IE, but in Firefox I get a weird flickering affect when hovering over the thumbnail image. Any thoughts? <html> <head> <title>aj</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(function() { // img preview $('.img').hover(function() { if (!$('#overlay').length) { $('<div id="overlay"/>').css({ position: 'fixed', top: 0, left: 0, width: '100%', zIndex: 100, height: $(window).height() + 'px' }).appendTo('body'); $('<div id="item" />').css({ border: '7px solid #999', height: '500px', width: '500px', top: '50%', left: '50%', position: 'absolute', marginTop: '-250px', marginLeft: '-250px' }).append('<img src="' + $(this).attr('rel') + '" alt="img" />').appendTo('#overlay'); } }, function() { $('#overlay').remove(); }); }); </script> </head> <body> <img class="img" src="http://ajondeck.net/temp/paperboy_thumb.gif" rel="http://ajondeck.net/temp/paperboy.gif" alt="image" /> </body> </html>

    Read the article

  • Horizontally and Vertically Center Modal Div IE Issue

    - by aherrick
    I'm trying to horizontally and vertically center a modal window inside a div. I want it to be cross browser compatible. You can see from the picture below that when I resize IE8 then click, "show modal" button it displays not exactly horizontally centered. This does not seem to be an issue with Chrome. Any thoughts? How would you guys accomplish this? <html> <head> <title>test</title> <style type="text/css"> * { margin: 0px; padding: 0px; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(function() { $('#modal').click(function() { // overlay $('<div id="overlay" />').css({ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', backgroundColor: 'black', opacity: 0 }).appendTo('body'); $('<div id="datamodal" />').css({ backgroundColor: '#FFFFFF', border: '10px solid #999', height: '200px', width: '600px', position: 'absolute', top: '50%', left: '50%', marginTop: '-120px', marginLeft: '-320px', color: '#111111', fontWeight: 'bold', padding: '10px', display: 'none' }).append('<input type="text" />').appendTo('#overlay'); $('#overlay').fadeTo(300, 0.7); $('#datamodal').fadeIn(300); }); }); </script> </head> <body> <input id="modal" type="button" value="show modal" /> </body> </html>

    Read the article

  • SQL Server Full Text Search Leading Wildcard

    - by aherrick
    After taking a look at this SO question and doing my own research, it appears that you cannot have a leading wildcard while using full text search. So in the most simple example, if I have a Table with 1 column like below: TABLE1 coin coinage undercoin select COLUMN1 from TABLE1 where COLUMN1 LIKE '%coin%' Would get me the results I want. How can I get the exact same results with FULL TEXT SEARCH enabled on the column? The following two queries return the exact same data, which is not exactly what I want. SELECT COLUMN1 FROM TABLE1 WHERE CONTAINS(COLUMN1, '"coin*"') SELECT COLUMN1 FROM TABLE1 WHERE CONTAINS(COLUMN1, '"*coin*"')

    Read the article

  • Node.JS Server Cuts Off Frequently?

    - by aherrick
    I have a Node JS Server where I am using Socket.IO to stream content to the browser. It works great for about 45 minutes or so of streaming, then it will usually cut out. There are no "errors" reported in the terminal and the Node server acts like it is in, however the page I am serving clearly stops working. What are my options for trying to get to the bottom of this? Could this be a configuration issue with Node/Socket.IO? is there any basic error logging you would recommend I setup?

    Read the article

1