Search Results

Search found 627 results on 26 pages for 'aligned'.

Page 3/26 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Why are these divs not aligned and space between?

    - by acidzombie24
    Why isnt everything aligned? No yellow should be visible and no orange should be visible except for the right side and bottom left where theres space for another image. Basically my images are pretty much aligned to the center (i have other pics not in this example which is easier to see). However in this case when i have 150px height image the 150 width seems start lower. Also why are there spaces in between <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ldfk;sd</title> <style type="text/css"> div.ImgGallery { max-width: 630px; background: orange; } .ImgGallery div { display: inline; } /* http://www.brunildo.org/test/img_center.html */ .ImgGallery div div { display: table-cell; text-align: center; background: gray; width: 150px; height: 150px; } .ImgGallery div{ background: yellow; vertical-align: middle; } //.ImgGallery div div :nth-child(2n+1) { background: red; } .ImgGallery * { vertical-align: middle; } .ImgGallery a { display: block; } .ImgGallery a * { border-style: none; } </style> </head> <div class="smallGallery"> <div class="ImgGallery"> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="b.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="b.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> <div><div><a href="http://google.com"><img src="a.jpg" alt="a.jpg"></a></div></div> </div></div> </body></html>

    Read the article

  • Trying to zoom in on an arbitrary rect within a screen-aligned quad.

    - by mos
    I've got a screen-aligned quad, and I'd like to zoom into an arbitrary rectangle within that quad, but I'm not getting my math right. I think I've got the translate worked out, just not the scaling. Basically, my code is the following: // // render once zoomed in glPushMatrix(); glTranslatef(offX, offY, 0); glScalef(?wtf?, ?wtf?, 1.0f); RenderQuad(); glPopMatrix(); // // render PIP display glPushMatrix(); glTranslatef(0.7f, 0.7f, 0); glScalef(0.175f, 0.175f, 1.0f); RenderQuad(); glPopMatrix(); Anyone have any tips? The user selects a rect area, and then those values are passed to my rendering object as [x, y, w, h], where those values are percentages of the viewport's width and height.

    Read the article

  • Quick Hint: Formatting JSON for Debugging

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/06/25/quick-hint-formatting-json-for-debugging.aspxI needed a way to quickly format JSON that I copied from the Network view in Google Chrome Developer Tools. A co-worker pointed me to the Notepad++ (or use Chocolatey to install Notepad++) plugin JSMin. Now all I have to do is copy the JSON into Notepad++ and Alt + Ctrl + M and I can see it easily.

    Read the article

  • Data Compare is Finally Back in VS 2012

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/07/01/data-compare-is-finally-back-in-vs-2012.aspxI’ve been missing the data compare tool this since moving from VS 2010. I’ve install the VS 2013 v3 update and then the SQL Server Data Tools - June 2013 update. I don’t think v3 is required, but it’s a good upgrade to do anyways. http://blogs.msdn.com/b/ssdt/archive/2013/06/24/announcing-sql-server-data-tools-june-2013.aspx

    Read the article

  • Why are some of my view not aligned correctly at the bottom of my relative layout?

    - by Janusz
    I have problems getting some of my views aligned in a relative layout that I use inside a row of my listview. Here is a screenshot from the layout builder in Eclipse, this is what I think it should look like: The next image is from the emulator. Now the TestTestTest View is at the top and covers the name and distance Textviews. This is my layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="4dip"> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="centerInside" android:src="@drawable/icon" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:background="@color/green" /> <TextView android:id="@+id/distance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Distance" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:paddingRight="4dip" android:background="#000000" /> <TextView android:id="@+id/name" android:layout_width="fill_parent" style="@style/ListHeadText" android:layout_height="wrap_content" android:text="Name" android:layout_alignTop="@id/distance" android:layout_toRightOf="@id/logo" android:layout_toLeftOf="@id/distance" android:gravity="clip_horizontal" android:lines="1" android:paddingLeft="4dip" android:background="@color/red" /> <TextView android:id="@+id/number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Number" android:paddingRight="4dip" android:layout_alignRight="@id/distance" android:background="@color/darkred" android:layout_below="@id/distance" /> <TextView android:id="@+id/subcategory" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Subcategory" android:paddingLeft="4dip" android:layout_alignLeft="@id/name" android:lines="1" android:gravity="clip_horizontal" android:layout_below="@id/distance" android:background="@color/green" /> <TextView android:id="@+id/test" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestTestTest" android:paddingLeft="4dip" android:layout_alignParentBottom="true" android:gravity="bottom" android:background="@color/red" /> Shouldnt align_parent_bottom put the view at the bottom of the cell in the list?

    Read the article

  • How to make BoxLayout vertical but children flow top-aligned?

    - by user291701
    I'm trying to get get a vertical, top-aligned layout to work. This is what I have: JPanel pane = new JPanel(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); MyImagePanel panelImage = new MyImagePanel(); panelImage.setSize(400, 400); pane.add(new JComboBox()); pane.add(panelImage); pane.add(new JButton("1")); pane.add(new JButton("2")); pane.add(new JButton("3")); JFrame frame = new JFrame("Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(800, 600); frame.add(pane); frame.pack(); frame.setVisible(true); All the controls appear, but it looks like padding is being applied at run time between their tops and bottoms so they're somewhat vertically centered. This is what I'm going for: ----------------------------------------------------- | ComboBox | | ------------ | | | | | Image | | | | | ------------ | | Button 1 | Any additional space fills the right | ------------ | | Button 2 | | ------------ | | Button 3 | | ------------ | | | | Any additional space fills the bottom | | | ----------------------------------------------------- How do I get BoxLayout to do that? Thanks ------------------------- Update ------------------------- Was able to use this: Box vertical = Box.createVerticalBox(); frame.add(vertical, BorderLayout.NORTH); vertical.add(new JComboBox()); vertical.add(new JButton("1")); ... to get what I wanted.

    Read the article

  • How to create dynamic volume in stripe configuration, aligned to 1024?

    - by GregC
    I am trying to create a software stripe setup with two physical disks (underneath they are 128K stripe, RAID5 for each). I've read that one can use diskpart, but I am unable to come up with a command that works. This is on Server 2k3 SP2. I was trying create volume stripe disk=2,3 align=1024 Diskpart errors out: The arguments you specified for this command are not valid. P.S. Tried successfully with a basic disk and a primary partition. Please reply, -Greg

    Read the article

  • IE 11 Updates its Developers Tools

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/08/01/ie-11-updates-its-developers-tools.aspxI installed the IE 11 preview for Windows 7 (I’m getting upgraded to Windows 8 at work next week). I’ve never been a fan of the IE 8 – 10 developer tools so I’ve mostly been using Chrome or Firefox’s Firebug. This revamp looks great and seems to work well. I think I’ll be spending more time in IE with the developer tools, once IE 11 is released. “F12 Tools in Internet Explorer 11 Preview has been rebuilt from the ground up to give you: a new, cleaner user interface. new Responsiveness, Memory, and Emulation tools. new and improved functionality in familiar tools. an easier and faster workflow.” http://msdn.microsoft.com/en-us/library/ie/bg182632(v=vs.85).aspxhttp://ie.microsoft.com/testdrive/Browser/F12Adventure/ has a nice visual walk through of the new features.

    Read the article

  • KnockoutJS 2.3.0 - Uncaught Error: You cannot apply bindings multiple times to the same element.

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/07/25/knockoutjs-2.3.0---uncaught-error-you-cannot-apply-bindings-multiple.aspxI upgrade KnockoutJs through Nuget and started getting the error ‘Uncaught Error: You cannot apply bindings multiple times to the same element.’ when I used applyBindings after the main page load. I had some dynamically added DOM elements and re-applying bindings worked before. It always seemed like a workaround/hack, but now Knockout is telling me that I shouldn’t do it. The quick way to fix this is to use ko.cleanNode($(‘#id’) and this works. A different/possibly better way, as suggested by x0n might be to use templates and Knockout’s template binding (<script type=’text/html’>…</script>).   Thanks again to the StackOverflow community for quickly providing me with the solution. Check out my question for all the details.

    Read the article

  • What does the ".align" x86 Assembler directive do exactly? [migrated]

    - by Sinister Clock
    I will list exactly what I do not understand, and show you the parts I can not understand as well. First off, The .Align Directive .align integer, pad. The .align directive causes the next data generated to be aligned modulo integer bytes 1.~ ? : What is implied with "causes the next data generated to be aligned modulo integer bytes?" I can surmise that the next data generated is a memory-to-register transfer, no? Modulo would imply the remainder of a division. I do not understand "to be aligned modulo integer bytes"....... What would be a remainder of a simple data declaration, and how would the next data generated being aligned by a remainder be useful? If the next data is aligned modulo, that is saying the next generated data, whatever that means exactly, is the remainder of an integer? That makes absolutely no sense. What specifically would the .align, say, .align 8 directive issued in x86 for a data byte compiled from a C char, i.e., char CHARACTER = 0; be for? Or specifically coded directly with that directive, not preliminary Assembly code after compiling C? I have debugged in Assembly and noticed that any C/C++ data declarations, like chars, ints, floats, etc. will insert the directive .align 8 to each of them, and add other directives like .bss, .zero, .globl, .text, .Letext0, .Ltext0. What are all of these directives for, or at least my main asking? I have learned a lot of the main x86 Assembly instructions, but never was introduced or pointed at all of these strange directives. How do they affect the opcodes, and are all of them necessary?

    Read the article

  • New .Net Authentication in 4.5.1

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/11/05/new-.net-authentication-in-4.5.1.aspxThere has been a lot of traffic on my post about Simple Membership that came with the File new Project MVC 4 in 2012. I was reading the release notes for Visual Studio 2013 and .Net 4.5.1 and it mentioned a new/updated Authentication approach. “ASP.NET Identity is the new membership system for ASP.NET applications. ASP.NET Identity makes it easy to integrate user-specific profile data with application data. ASP.NET Identity also allows you to choose the persistence model for user profiles in your application. You can store the data in a SQL Server database or another data store, including NoSQL data stores such as Windows Azure Storage Tables” There’s a great page on the asp.net site that gives an introduction, overview, how to use it, and how to migrate to it. I won’t be doing a new project for awhile at work, but I’ll definitely be looking into this more when I get the time.

    Read the article

  • System.Device.Location.GeoLocation

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/06/26/system.device.location.geolocation.aspxA co-worker (Scott) sent out this email and it was so good I asked him if I could share it with all of you. I changed the latitude and longitude to random locations to protect the innocent. “Stumbled across this method this morning while coding all the math out by hand to calculate distances. This one is definitely worth filing away for future reference, saved me a ton of work. This was added in v4 of the framework, and is in the core framework install, so should work in services as well as client applications. var location1 = new GeoCoordinate(40.102, -94.788171); var location2 = new GeoCoordinate(50.0011, -96.699148); // distance shown is straight line meters. Console.WriteLine(location1.GetDistanceTo(location2)); Console.ReadKey();   http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinate.getdistanceto(v=vs.100).aspx http://en.wikipedia.org/wiki/Haversine_formula”

    Read the article

  • URGENT: IE 6/7/8 problem!- Right Column is not aligned and is pushed down.

    - by Kalpesh Vasta
    Hi Guys, I'm new to this but here goes. I have been developing this website http://www.panelmaster.co.uk and i have managed to solve the majority of design problems but one! If you take a look at the site in IE the right column seems to drop down and is not aligned with the right and centre column. This problem only occurs in IE as upon testing i found it was fine in firefox and safari. I have provided below the CSS for the website. I would appreciate if you guys can help me with the problem asap. Thanks in advance. :) ========================== body { margin: 0; padding: 0; line-height: 1.5em; font-family: Tahoma, Geneva, sans-serif; font-size: 12px; color: #666; background-image: url(images/templatemo_body_top.jpg); background-color: #90857c; background-repeat: repeat-x; background-position: top; text-align: left; } a:link, a:visited { color: #073475; text-decoration: none; font-weight: normal; } a:active, a:hover { color: #073475; text-decoration: underline; } h3 { color: #1e7da9; font-size: 16px; font-weight: bold; } h2 { color: #1e7da9; font-size: 16px; font-weight: bold; } h1 { color: #696969; font-size: 20px; font-weight: bold; } p { margin: 0px; padding: 0px; } img { margin: 0px; padding: 0px; border: none; } .cleaner { clear: both; width: 100%; height: 0px; font-size: 0px; } .cleaner_h30 { clear: both; width:100%; height: 30px; } .cleaner_h40 { clear: both; width:100%; height: 40px; } .float_l { float: left; } .float_r { float: right; } .margin_r20 { margin-right: 20px; } templatemo_body_wrapper { width: 100%; background: url(images/templatemo_body_bottom.png) repeat-x bottom center; } templatemo_wrapper { width: 970px; padding: 0 10px; margin: 0 auto; background: url(images/templatemo_wrapper_top.jpg) no-repeat top center; } /* header */ templatemo_header { clear: both; width: 890px; height: 60px; padding: 20px 40px } templatemo_header #site_title { float: left; padding-top: 15px; } site_title a { font-size: 24px; color: #FFFFFF; font-weight: bold; text-decoration: none; } site_title a:hover { font-weight: bold; text-decoration: none; } site_title a span { display: block; margin-top: 5px; font-size: 14px; color: #fff; font-weight: bold; letter-spacing: 2px; } /* end of header */ /* menu */ templatemo_menu { clear: both; width: 970px; height: 80px; background: url(images/templatemo_menubar.png) no-repeat; } search_box { width: 990px; height: 35px; text-align: right; } search_box form { margin: 0; padding: 5px 40px; } search_box #input_field { height: 20px; width: 300px; color: #000000; font-size: 12px; font-variant: normal; line-height: normal; border: 1px solid #CCCCCC; background: #FFFFFF; } search_box #submit_btn { height: 24px; width: 100px; cursor: pointer; font-size: 12px; text-align: center; vertical-align: bottom; white-space: pre; outline: none; color:#666666; border: 1px solid #CCCCCC; background: #FFFFFF; } templatemo_menu ul { width: 890px; height: 35px; margin: 0; padding: 7px 40px; list-style: none; } templatemo_menu ul li { padding: 0px; margin: 0px; display: inline; } templatemo_menu ul li a { float: left; display: block; margin-right: 40px; font-size: 13px; text-decoration: none; color: #fff; font-weight: normal; outline: none; } templatemo_menu ul li a:hover, #templatemo_menu ul .current { color: #162127; } /* end of menu */ /* contetnt */ templatemo_content_wrapper { clear: both; padding: 0px 0; } templatemo_content { float: left; margin-left: 10px; width: 550px; } banner { margin: 0 0 10px 0; } templatemo_content #content_top { width: 550px; height: 20px; background: url(images/templatemo_content_top.png) no-repeat; } templatemo_content #content_bottom { width: 550px; height: 20px; background: url(images/templatemo_content_bottom.png) no-repeat; } templatemo_content #content_middle { width: 510px; padding: 5px 20px 0px 20px; background: url(images/templatemo_content_middle.png) repeat-y; } content_middle p { text-align: justify; } .templatemo_sidebar_wrapper { width: 200px; } .templatemo_sidebar { width: 197px; padding-right: 3px; background: url(images/templatemo_sidebar_middle.png) repeat-y; } .templatemo_sidebar_top { width: 200px; height: 20px; background: url(images/templatemo_sidebar_top.png) no-repeat; } .templatemo_sidebar_bottom { width: 200px; height: 20px; background: url(images/templatemo_sidebar_bottom.png) no-repeat; } .templatemo_sidebar .sidebar_box { clear: both; padding-bottom: 20px; } .sidebar_box1 { padding: 15px; } .sidebar_box h2 { color: #2d84ad; font-size: 16px; padding-left: 25px; font-weight: bold; margin: 0 0 10px 10px; background: url(images/templatemo_sidebar_h1.jpg) left center no-repeat; } .sidebar_box .sidebar_box_content { padding: 15px; background: url(images/templatemo_sidebar_box_top.png) top repeat-x; } .sidebar_box img { border: 1px solid #999; margin-bottom: 5px; } .sidebar_box .discount { margin: 5px 0 0 0; font-weight: bold; } .sidebar_box .discount span { color: #C00; } .left_sidebar_box .discount a { font-weight: bold; color: #000; } .sidebar_box .categories_list { margin: 0; padding: 0; list-style: none; } .categories_list li { padding: 0; margin: 0; } .categories_list li a { display: block; color: #201f1c; padding: 5px 0 5px 20px; background: url(images/list.png) center left no-repeat; } .categories_list li a:hover { color: #439ac3; text-decoration: none; } .news_box { clear: both; margin-bottom: 5px; padding-bottom: 5px; border-bottom: 1px solid #999; } .news_box h4 { padding: 2px 0; margin: 0; } .news_box h4 a { font-size: 12px; font-weight: normal; color: #1893f2; } newsletter_box label { display: block; margin-bottom: 10px; } newsletter_box .input_field { height: 20px; width: 155px; padding: 0 5px; margin-bottom: 10px; color: #000000; font-size: 12px; font-variant: normal; line-height: normal; } newsletter_box .submit_btn { float: right; height: 30px; width: 80px; margin: 0px; padding: 3px 0 15px 0; cursor: pointer; font-size: 12px; text-align: center; vertical-align: bottom; white-space: pre; outline: none; } .product_box { float: left; width: 223px; padding: 10px; margin-bottom: 20px; border: 1px solid #CCC; text-align: center; } .product_box img { margin-bottom: 10px; } .product_box h3 { color: #2a2522; font-size: 12px; margin: 0 0 10px; } .product_box p { margin-bottom: 10px; } .product_box p span { color: #cf5902; font-size: 14px; font-weight: bold; } .product_box .detail { float: right; } .product_box .addtocard { float: left; font-weight: bold; padding-right: 20px; background: url(images/templatemo_shopping_cart.png) bottom right no-repeat; } /* end of content */ /* footer */ templatemo_footer_wrapper { background: url(images/templatemo_footer.png) repeat-x; } templatemo_footer { width: 910px; height: 85px; padding: 50px 40px 30px 40px; margin: 0 auto; text-align: center; color: #a9a098; } templatemo_footer a { color: #d7d1cc; font-weight: normal; } templatemo_footer a:hover { text-decoration: none; color: #FFFF33; } templatemo_footer .footer_menu { margin: 0 0 30px 0; padding: 0px; list-style: none; } .footer_menu li { margin: 0px; padding: 0 20px; display: inline; border-right: 1px solid #d7d1cc; } .footer_menu li a { color: #d7d1cc; } .footer_menu .last_menu { border: none; } /* end of footer */ /twitter/ twitter_div {border-top: 0px;} twitter_div a {color: #0000ff !important;} twitter_update_list {margin-left: -1em !important; margin-bottom: 0px !important;} twitter_update_list li {list-style-type: none; padding-right: 5px; } twitter_update_list li a {color: #0000ff; padding-right: 5px;} twitter_div {border-bottom: 0px; padding-bottom: 10px; padding-top:6px; padding-right: 5px;} twitter_div a, #twitter_update_list li a {text-decoration: none !important;} twitter_div a:hover, #twitter_update_list li a:hover {text-decoration:underline !important;}

    Read the article

  • MVC OnActionExecuting to Redirect

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2014/08/12/mvc-onactionexecuting-to-redirect.aspxI recently had the following requirements in an MVC application: Given a new user that still has the default password When they first login Then the user must change their password and optionally provide contact information I found that I can override the OnActionExecuting method in a BaseController class.public class BaseController : Controller { [Inject] public ISessionManager SessionManager { get; set; } protected override void OnActionExecuting(ActionExecutingContext filterContext) { // call the base method first base.OnActionExecuting(filterContext); // if the user hasn't changed their password yet, force them to the welcome page if (!filterContext.RouteData.Values.ContainsValue("WelcomeNewUser")) { var currentUser = this.SessionManager.GetCurrentUser(); if (currentUser.FusionUser.IsPasswordChangeRequired) { filterContext.Result = new RedirectResult("/welcome"); } } } } Better yet, you can use an ActionFilterAttribute (and here) and apply the attribute to the Base or individual controllers./// <summary> /// Redirect the user to the WelcomePage if the FusionUser.IsPasswordChangeRequired is true; /// </summary> public class WelcomePageRedirectActionFilterAttribute : ActionFilterAttribute { [Inject] public ISessionManager SessionManager { get; set; } public override void OnActionExecuting(ActionExecutingContext actionContext) { base.OnActionExecuting(actionContext); // if the user hasn't changed their password yet, force them to the welcome page if (actionContext.RouteData.Values.ContainsValue("WelcomeNewUser")) { return; } var currentUser = this.SessionManager.GetCurrentUser(); if (currentUser.FusionUser.IsPasswordChangeRequired) { actionContext.Result = new RedirectResult("/welcome"); } } }  [WelcomePageRedirectActionFilterAttribute] public class BaseController : Controller { ... } The requirement is now met.

    Read the article

  • Find an element in a JavaScript array

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2014/08/22/find-an-element-in-a-javascript-array.aspxI needed a C# Dictionary like data structure in JavaScript and then a way to find that object by a key. I had forgotten how to do this, so did some searching and talked to a colleague and came up with this JsFiddle. See the code in my jsFiddle or below: var processingProgressTimeoutIds = []; var file = { name: 'test', timeId: 1 }; var file2 = { name: 'test2', timeId: 2 }; var file3 = { name: 'test3', timeId: 3 }; processingProgressTimeoutIds.push({ name: file.name, timerId: file.id }); processingProgressTimeoutIds.push({ name: file2.name, timerId: file2.id }); processingProgressTimeoutIds.push({ name: file3.name, timerId: file3.id }); console.log(JSON.stringify(processingProgressTimeoutIds)); var keyName = 'test'; var match = processingProgressTimeoutIds.filter(function (item) { return item.name === keyName; })[0]; console.log(JSON.stringify(match)); // optimization var match2 = processingProgressTimeoutIds.some(function (element, index, array) { return element.name === keyName; }); console.log(JSON.stringify(match2)); // if you have the full object var match3 = processingProgressTimeoutIds.indexOf(file); console.log(JSON.stringify(match3)); // http://jsperf.com/array-find-equal – from Dave // indexOf is faster, but I need to find it by the key, so I can’t use it here //ES6 will rock though, array comprehension! – also from Dave // var ys = [x of xs if x == 3]; // var y = ys[0]; Here’s a good blog post on Array comprehension.

    Read the article

  • Mock the window.setTimeout in a Jasmine test to avoid waiting

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2014/08/21/mock-the-window.settimeout-in-a-jasmine-test-to-avoid-waiting.aspxJasmine has a clock mocking feature, but I was unable to make it work in a function that I’m calling and want to test. The example only shows using clock for a setTimeout in the spec tests and I couldn’t find a good example. Here is my current and slightly limited approach.   If we have a method we want to test: var test = function(){ var self = this; self.timeoutWasCalled = false; self.testWithTimeout = function(){ window.setTimeout(function(){ self.timeoutWasCalled = true; }, 6000); }; }; Here’s my testing code: var realWindowSetTimeout = window.setTimeout; describe('test a method that uses setTimeout', function(){ var testObject; beforeEach(function () { // force setTimeout to be called right away, no matter what time they specify jasmine.getGlobal().setTimeout = function (funcToCall, millis) { funcToCall(); }; testObject = new test(); }); afterEach(function() { jasmine.getGlobal().setTimeout = realWindowSetTimeout; }); it('should call the method right away', function(){ testObject.testWithTimeout(); expect(testObject.timeoutWasCalled).toBeTruthy(); }); }); I got a good pointer from Andreas in this StackOverflow question. This would also work for window.setInterval. Other possible approaches: create a wrapper module of setTimeout and setInterval methods that can be mocked. This can be mocked with RequireJS or passed into the constructor. pass the window.setTimeout function into the method (this could get messy)

    Read the article

  • Skip CodedUI Tests, use Selenium for Web Automation

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/10/31/skip-codedui-tests-use-selenium-for-web-automation.aspxI recently joined a team that was using Agile Methodologies to create a new product. They have a working beta product after 10 or so 2 week sprints and already had UI’s that had changed several times as they went through iterations of their UI. As a result, the QA team was falling behind with automated tests and I was tasked to help them catch up and expand their tests. The project is a website. I heard many complaints about how hard it is to work with CodedUI (writing our own code, not relying on the recorder as we wanted re-usable and more maintainable code) then it took me 4+ hours to fix one issue. It was hard to traverse the key and debugging the objects with breakpoints… I said out loud “there has to be a better way or a framework the uses jQuery to run through the tests.” Plus it seemed really slow (wait… finding the object … wait… start putting in text…). Plus some tests would randomly fail on the test agents (using the test settings and an automated build, they are run on VMs using Microsoft test agents). Enough complaining. Selenium to the rescue (mostly). The lead QA guy decided to try it out and we haven’t turned back. We are now running tests in Chrome and Firefox and they run a lot faster. We had IE running to, but some of the tests were running fine locally, but hanging on the test agents. I’ll add some hints and lessons learned in a later post.

    Read the article

  • Run Grunt task in Visual Studio Release Build with a bat file

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2014/08/19/run-grunt-task-in-visual-studio-release-build-with-a.aspx 1. Add a BeforeBuild in your csproj file. Edit the xml with a text editor. <Target Name="BeforeBuild"> <Exec Condition="'$(Configuration)' == 'Release'" Command="script-optimize.bat" /> </Target> 2. Create the script-optimize.batREM "%~dp0" maps to the directory where this file exists cd %~dp0\..\YourProjectFolder call npm uninstall grunt call npm uninstall grunt call npm install --cache-min 604800 -g grunt-cli call npm install --cache-min 604800 grunt typescript requirejs copy less:compile less:mincompileThis grunt command will compile typescript, run the requireJs optimizer, complie and minimize less.3. Make it use the minified code when the Web.config compilation debug is set to false <!-- These CustomCollectFiles actions are used so that the Scripts-Release folder/files are included        when publishing even though they are not project references -->  <Target Name="CustomCollectFiles">    <ItemGroup>      <_CustomFiles Include="Scripts-Release\**\*" />  </ItemGroup>  </Target> That should be all you need to get a Grunt task to minify and combine JS (plus other tasks) in Visual Studio Release build with debug = false. This is a great video of Steve Sanderson talking about SPAs, npm, Knockout, Grunt, Gulp, ect. I highly recommend it.

    Read the article

  • Android: How to make current layout with scrollable text view?

    - by Solata
    I tried multiple solution but none seem to work. Layout: -------------------- |btn1| txt1 |btn2| -------------------- | | | | | | | txtview1 | | | | | | | -------------------- btn1 - top left aligned - decrease txt1 btn2 - top right aligned - increase txt1 txt1 - top center aligned - text/number entered with code textview1 - client aligned with vertical scrollbar, if needed - text entered with code

    Read the article

  • trouble in using flalign (LaTeX)

    - by Jorge
    I am trying to put 3 equations with "=" signs aligned but also left aligned. I tried the following: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{flalign*} RPC &= A+B\tilde{f} +C x &\ A &= a+\eta &\ E &= cte & \end{flalign*} \end{document} With this I get the stuff in the left and the "=" signs aligned. However, I also need A (in the second equation) and E (in the third equation) to be aligned to the R (in the first one) Does anyone know how to get it? thanks

    Read the article

  • ASP.Net 4.5 Garbage Collection Improvement

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/06/24/asp.net-4.5-garbage-collection-improvement.aspxI just read Five Great .NET Framework 4.5 Features on CodeProject by Shivprasad koirala. Feature 5 in his article mentions the GC background cleanup and has a good explanation of the work the GC has to do for ASP.Net on the server. “Garbage collector is one real heavy task in a .NET application. And it becomes heavier when it is an ASP.NET application. ASP.NET applications run on the server and a lot of clients send requests to the server thus creating loads of objects, making the GC really work hard for cleaning up unwanted objects.” “To overcome the above problem, server GC was introduced. In server GC there is one more thread created which runs in the background. This thread works in the background and keeps cleaning…objects thus minimizing the load on the main GC thread. Due to double GC threads running, the main application threads are less suspended, thus increasing application throughput. To enable server GC, we need to use the gcServer XML tag and enable it to true.” <configuration> <runtime> <gcServer enabled="true"/> </runtime> </configuration> This is not done by default. The MSDN information page says “There are only two garbage collection options, workstation or server. For single-processor computers, the default workstation garbage collection should be the fastest option. Either workstation or server can be used for two-processor computers. Server garbage collection should be the fastest option for more than two processors. Use the GCSettingsIsServerGC property to determine if server garbage collection is enabled.” “In the .NET Framework 4 and earlier versions, concurrent garbage collection is not available when server garbage collection is enabled. Starting with the .NET Framework 4.5, server garbage collection is concurrent. To use non-concurrent server garbage collection, set the <gcServer> element to true and the <gcConcurrent> element to false. “ So if you’re using ASP.Net 4.5 and have a multi-core server, you should try turning on the Server Garbage Collection and do some profiling to see if it improves the performance of your site.

    Read the article

  • Mock RequireJS define dependencies with config.map

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2014/08/18/mock-requirejs-define-dependencies-with-config.map.aspxI had a module dependency, that I’m pulling down with RequireJS that I needed to use and write tests against. In this case, I don’t care about the actual implementation of the module (it’s simple enough that I’m just avoiding some AJAX calls). EDIT: make sure you look at the bottom example after the edit before using the config.map approach. I found that there is an easier way. I did not want to change the constructor of the consumer as I had a chain of changes that would have to be made and that would have been to invasive for this task. I found a question on StackOverflow with a short, but helpful answer from “Artem Oboturov”. We can use the config.map from RequireJs to achieve this. Here is some code: A module example (“usefulModule” in Common/Modules/usefulModule.js): define([], function() { "use strict"; var testMethod = function() { ... }; // add more functionality of the module return { testMethod; } }); A consumer of usefulModule example: define([ "Commmon/Modules/usefulModule" ], function(usefulModule) { "use strict"; var consumerModule = function(){ var self = this; // add functionality of the module } }); Using config.map in the html of the test runner page (and in your Karma config –> I’m still trying to figure this out): map: {'*': { // replace usefulModule with a mock 'Common/Modules/usefulModule': '/Tests/Specs/Common/usefulModuleMock.js' } } With the new mapping, Require will load usefulModuleMock.js from Tests/Specs/Common instead of the real implementation. Some of the answers on StackOverflow mentioned Squire.js, which looked interesting, but I wasn’t ready to introduce a new library at this time. That’s all you need to be able to mock a depency in RequireJS. However, there are many good cases when you should pass it in through the constructor instead of this approach.   EDIT: After all that, here’s another, probably better way: The consumer class, updated: define([ "Commmon/Modules/usefulModule" ], function(UsefulModule) { "use strict"; var consumerModule = function(){ var self = this; self.usefulModule = new UsefulModule(); // add functionality of the module } }); Jasmine test: define([ "consumerModule", "/UnitTests/Specs/Common/Mocks/usefulModuleMock.js" ], function(consumerModule, UsefulModuleMock){ describe("when mocking out the module", function(){ it("should probably just override the property", function(){ var consumer = new consumerModule(); consumer.usefulModule = new UsefulModuleMock(); }); }); });   Thanks for letting me think out loud :-).

    Read the article

  • How can I make multi-line, vertically and horizontally aligned labels for radio buttons in HTML Form

    - by Patrick Klingemann
    Assuming the following markup: <fieldset> <legend>Radio Buttons</legend> <ol> <li> <input type="radio" id="x"> <label for="x"><!-- Insert multi-line markup here --></label> </li> <li> <input type="radio" id="x"> <label for="x"><!-- Insert multi-line markup here --></label> </li> </ol> </fieldset> How do I style radio button labels so that they look like the following in most browsers (IE6+, FF, Safari, Chrome:

    Read the article

  • Why is the dropdown menu aligned to the left?

    - by fmz
    I am working on a dropdown navigation for a site and am having some trouble with the dropdown portion aligning with the parent category - it shifts all the way to the left. Here is the html: <ul class="dropdown"> <li><a href="#" id="home">Home</a></li> <li><a href="#" id="about">About Us</a> <ul class="sub-menu"> <li><a href="#">Our History</a></li> <li><a href="#">Our Process</a></li> <li><a href="#">Portfolio</a></li> <li><a href="#">Financing</a></li> <li><a href="#">Testimonials</a></li> <li><a href="#">Subcontractors</a></li> </ul> </li> <li><a href="#" id="personal">Personal Banking</a></li> <li><a href="#" id="commercial">Commercial Banking</a></li> <li><a href="#" id="service">Customer Service</a> <ul class="sub-menu"> <li><a href="#">Our History</a></li> <li><a href="#">Our Process</a></li> <li><a href="#">Portfolio</a></li> <li><a href="#">Financing</a></li> <li><a href="#">Testimonials</a></li> <li><a href="#">Subcontractors</a></li> </ul> </li> <li><a href="#" id="investors">Investor Relations</a></li> <li><a href="#" id="contact">Contact Us</a></li> </ul> Here is the CSS: ul.dropdown { position: relative; background: #4e8997; height: 40px; padding-left: 5px; } ul.dropdown li { float: left; zoom: 1; } ul.dropdown li a { display: block; margin-top: 5px; padding: .5em .6em; color: #fff; font: bold 14px "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; text-transform: uppercase; border: none; } ul.dropdown a:hover { background-color: #c29c5d; color: #fff; } ul.dropdown a:active { background-color: #c29c5d; color: #fff; } /* LEVEL TWO */ ul.dropdown ul { width: 200px; visibility: hidden; position: absolute; top:100%; left: 0; } ul.dropdown ul li { font: 13px "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; border-bottom: 1px solid #ccc; float: none; color: #fff; background-color: #c29c5d; height: 20px; } ul.dropdown ul li a { display: inline-block; } ul.dropdown ul li a:hover { background-color: #a2834d; color: #fff; height: 20px; } I tried changing the ul.dropdown ul to position relative, but that breaks the navigation. I would appreciate some help getting this corrected. Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >