Search Results

Search found 15 results on 1 pages for 'gruber'.

Page 1/1 | 1 

  • Gruber URL Regex tweak to capture "domain.com"

    - by mootymoots
    I found an updated version of John Gruber's regex for url matching in this post by user GianPac, which states it's been adapted to recognize url without protocol or the www part: (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}/?)(?:[^\s()<]+|(([^\s()<]+|(([^\s()<]+)))))(?:(([^\s()<]+|(([^\s()<]+))))|[^\s`!()[]{};:'\".,<?«»“”‘’])) Whilst this works in most cases, I found it does not match "google.com". It does match "google.comm" and "google.co.uk", so this must be a small oversight. The trouble is, I literally hate regex. It's the bane of my life. I just want to try and tweak this one more time to allow for "google.com" - can anyone throw me a pointer? I (think) it's something to do with this part of the code: +[.][a-z]{2,4}/?) ?

    Read the article

  • How do I install Sublime Text 2?

    - by Michael Gruber
    I installed Sublime Text 2 on 12.04 as per this tutorial. However I don't have adequate permissions when launching the program from the Unity launcher. For example I cannot install packages, or if I add a folder to the sidebar when I close Sublime and reopen, the folder is no longer listed. If I run sudo sublime in the terminal all changes remain after closing. I've tried chown-ing the Sublime Text 2 folder in usr/lib sudo chown -R mylogin:mylogin /usr/lib/"Sublime Text 2" but this seemed to have no effect.

    Read the article

  • What types of programming require practical category theory?

    - by Alexander Gruber
    Category theory has applications in theoretical computer science and obviously is central to abstract mathematics. I have heard that it also has direct practical applications in programming and software development. What type of programming is practical category theory necessary for? What do programmers use category theory to accomplish? Please note my use of "necessary" and "require" in this post. I realize that in some sense most programmers will benefit from having experience in different types of theories, but I am looking for direct applications where the usage of category theory is essential, i.e. if you didn't know category theory, you probably couldn't do it. Also, I'd like to clarify that by "what type of programming," I am hoping less for a broad answer like "functional programming," and more for specific applications like "writing bank software" or "making operating systems."

    Read the article

  • VMware Infrastructure Web Access 2.0.0 stuck at "Loading"

    - by Gruber
    We have a Ubuntu 11 server running VMware virtual machines. We manage it using VMware Infrastructure Web Access 2.0.0. My colleague is able to use it successfully with Internet Explorer 9. However, I am stuck with an empty login page that says "Loading" in the title when trying to connect. It happens in all browsers (IE9, Firefox, Chrome, Opera). My colleague also gets stuck at "Loading" if he tries another browser. How can I resolve this problem?

    Read the article

  • UpdatePanel + ToolkitScriptManager work in FF but blows up in IE 6+

    - by Hans Gruber
    I just upgraded my ASP.NET application from AjaxToolkit version 1.0 to version 3.5. The only code that I had to change as a result of the upgrade was to replace instances of ScriptManager with ToolKitScriptManager. UpdatePanels that used to work flawlessly in both FF and IE6+ now only work in FF. The specific problem in IE is twofold: PostBackTriggers don't perform any PostBack at all (i.e button clicks do nothing) AsyncPostBackTriggers do perform an async PostBack, but outside of a single hidden field (created by the ToolKitScriptManager itself) no ViewState is being sent back to the server for any controls. Needless to say, controls tend to fail in rather spectacular fashion when they can't access their ViewState during a PostBack. :) The only thing I can think of that would account for this only failing in IE6+, is that there is some malformed JavaScript getting piped down that FF is able to work around/ignore but that causes IE to self-destruct Downgrading to the 1.0 version of AjaxToolkit would probably fix this issue, but there are several key features in the 3.5 I need to leverage so this would be painful. Thanks for reading!

    Read the article

  • ASP.NET- forcing child/container events to fire before parent onload?

    - by Hans Gruber
    I'm working on a questionnaire type application in which questions are stored in a database. Therefore, I create my controls dynamically on every Page.OnLoad. This works like a charm and ViewState is persisted between postbacks because I ensure that my dynamic controls always have the same generated Control.ID. In addition to the user control that dynamically populates the questions, my questionnaire page also contains a 'Status' section (also encapsulated by a user control) which represents the status of the questionnaire (choices are 'Complete', 'Started' or 'In Progress'). If the user changes the status of questionnaire (i.e. from 'In Progress' to 'Complete'), I need to postback to the server because the contents of the dynamic portion of the questionnaire depend on the selected status. Some questions are always present regardless of status, and yet others may not be present at all for the selected status. The point is, when the status changes, I have to postback to the page and render the right set of questions. Additionally, I need to preserve any user entered values for those questions which are 'always available'. However, due to the page life cycle in ASP.NET, the 'Status' user control's OnLoad, which contains the correct status needed to load the right questions from the DB, doesn't get executed until after the 'dynamic questions' user control has already been populated (with the wrong/stale values). To get around this, I raise an event from my 'Status' user control to the main page to indicate that the Status has changed. The main page then raises an event on the 'dynamic questions' user control. Since by the time this event bubbles up, the 'dynamic questions' user control has already loaded the 'wrong' questions from the DB, it first calls Controls.Clear. It then happily uses the new status to query the database for the 'correct' questions and does a Control.Add() on each. FYI, Control.IDs are consistent across postbacks. This solution works...sorta. The correct set of questions for the selected status do get rendered; however ViewState is getting lost for those 'always available' questions. I'm guessing this is because the 'dynamic questions' user control calls Controls.Clear when responding to the status changed event. This must somehow kill the association between ViewState and my dynamic controls, even though the Control.ID are consistent. This seems like such a common requirement, I'm virtually certain there is a better, cleaner and less error prone approach to accomplish this. In case its not plain obvious, I haven't been able to grok the ASP.NET page life-cycle despite working with it for the last year. Any help is much appreciated!

    Read the article

  • wrapping user controls in a transaction

    - by Hans Gruber
    I'm working on heavily dynamic and configurable CMS system. Therefore, many pages are composed of a dynamically loaded set of user controls. To enable loose coupling between containers (pages) and children (user controls), all user controls are responsible for their own persistence. Each User Control is wired up to its data/service layer dependencies via IoC. They also implement an IPersistable interface, which allows the container .aspx page to issue a Save command to its children without knowledge of the number or exact nature of these user controls. Note: what follows is only pseudo-code: public class MyUserControl : IPersistable, IValidatable { public void Save() { throw new NotImplementedException(); } public bool IsValid() { throw new NotImplementedException(); } } public partial class MyPage { public void btnSave_Click(object sender, EventArgs e) { foreach (IValidatable control in Controls) { if (!control.IsValid) { throw new Exception("error"); } } foreach (IPersistable control in Controls) { if (!control.Save) { throw new Exception("error"); } } } } I'm thinking of using declarative transactions from the System.EnterpriseService namespace to wrap the btnSave_Click in a transaction in case of an exception, but I'm not sure how this might be achieved or any pitfalls to such an approach.

    Read the article

  • split all text inside dom element into <span>

    - by gruber
    I would like to split all elements inside html DOM node into spans with ids, for example: lets say I have element: <div> <h1>Header</h1> <h2>header2</h2> <p class="test">this is test p</p> </div> and the result should be: <div> <h1><span id="1">Header</span></h1> <h2><span id="2">header2</span></h2> <p class="test"><span id="3">this</span><span id="4">is</span><span id="5">test</span> <span id="6">p</span></p> </div> thanks for any help it shoul also work if there are nested images for example: <div> <h1>Header</h1> <h2>header2</h2> <p class="test"><img alt="test alt" />this is test p</p> </div> and the result: <div> <h1><span id="1">Header</span></h1> <h2><span id="2">header2</span></h2> <p class="test"><img alt="test alt" /><span id="3">this</span><span id="4">is</span><span id="5">test</span> <span id="6">p</span></p> </div>

    Read the article

  • wrapping aspx user controls commands in a transaction

    - by Hans Gruber
    I'm working on heavily dynamic and configurable CMS system. Therefore, many pages are composed of a dynamically loaded set of user controls. To enable loose coupling between containers (pages) and children (user controls), all user controls are responsible for their own persistence. Each User Control is wired up to its data/service layer dependencies via IoC. They also implement an IPersistable interface, which allows the container .aspx page to issue a Save command to its children without knowledge of the number or exact nature of these user controls. Note: what follows is only pseudo-code: public class MyUserControl : IPersistable, IValidatable { public void Save() { throw new NotImplementedException(); } public bool IsValid() { throw new NotImplementedException(); } } public partial class MyPage { public void btnSave_Click(object sender, EventArgs e) { foreach (IValidatable control in Controls) { if (!control.IsValid) { throw new Exception("error"); } } foreach (IPersistable control in Controls) { if (!control.Save) { throw new Exception("error"); } } } } I'm thinking of using declarative transactions from the System.EnterpriseService namespace to wrap the btnSave_Click in a transaction in case of an exception, but I'm not sure how this might be achieved or any pitfalls to such an approach.

    Read the article

  • Query results with no reverse

    - by gruber
    Hi, Ive got table: UserA, UserB, numberOfConnections I would like to write query which returns me only rows that has no reverse I mean or example : for data : 1 2 10 1 3 10 1 5 10 1 6 10 2 6 10 2 5 10 5 1 10 5 2 10 3 1 10 it should return 1 2 10 1 3 10 1 5 10 1 6 10 2 6 10 2 5 10 rows: 5 1 10 5 2 10 3 1 10 arent valid because there are already corresponding 1 5 10 2 5 10 3 1 10 thanks for help bye

    Read the article

  • using a Singleton to pass credentials in a multi-tenant application a code smell?

    - by Hans Gruber
    Currently working on a multi-tenant application that employs Shared DB/Shared Schema approach. IOW, we enforce tenant data segregation by defining a TenantID column on all tables. By convention, all SQL reads/writes must include a Where TenantID = '?' clause. Not an ideal solution, but hindsight is 20/20. Anyway, since virtually every page/workflow in our app must display tenant specific data, I made the (poor) decision at the project's outset to employ a Singleton to encapsulate the current user credentials (i.e. TenantID and UserID). My thinking at the time was that I didn't want to add a TenantID parameter to each and every method signature in my Data layer. Here's what the basic pseudo-code looks like: public class UserIdentity { public UserIdentity(int tenantID, int userID) { TenantID = tenantID; UserID = userID; } public int TenantID { get; private set; } public int UserID { get; private set; } } public class AuthenticationModule : IHttpModule { public void Init(HttpApplication context) { context.AuthenticateRequest += new EventHandler(context_AuthenticateRequest); } private void context_AuthenticateRequest(object sender, EventArgs e) { var userIdentity = _authenticationService.AuthenticateUser(sender); if (userIdentity == null) { //authentication failed, so redirect to login page, etc } else { //put the userIdentity into the HttpContext object so that //its only valid for the lifetime of a single request HttpContext.Current.Items["UserIdentity"] = userIdentity; } } } public static class CurrentUser { public static UserIdentity Instance { get { return HttpContext.Current.Items["UserIdentity"]; } } } public class WidgetRepository: IWidgetRepository{ public IEnumerable<Widget> ListWidgets(){ var tenantId = CurrentUser.Instance.TenantID; //call sproc with tenantId parameter } } As you can see, there are several code smells here. This is a singleton, so it's already not unit test friendly. On top of that you have a very tight-coupling between CurrentUser and the HttpContext object. By extension, this also means that I have a reference to System.Web in my Data layer (shudder). I want to pay down some technical debt this sprint by getting rid of this singleton for the reasons mentioned above. I have a few thoughts on what an better implementation might be, but if anyone has any guidance or lessons learned they could share, I would be much obliged.

    Read the article

  • Custom business object comparer

    - by gruber
    Hello, I need to implement mechanism that compares two business objects and return the list of differences (past value, new value, isDifferenceBetter). Because not all fields of class has to be compared and one fields need to be compared with different function then the other (sometimes < is better sometimes is better ... ) I figured out that I need to implelemnt custom attribute and give it to each field that has to be compared in this object. This attribute must have: - name - delegate or sth to point to the function which would be applied for comparision (dont know how to do it so far) So could anyone suggest me if its a good idea? Maybe any other ideas. Using attributes I would be able to use refflection to iterate through each field with attribute and invoke needed delegate. thanks for help bye

    Read the article

  • assembling an object graph without an ORM -- in the service layer or data layer?

    - by Hans Gruber
    At my current gig, our persistence layer uses IBatis going against SQL Server stored procedures (puke). IMHO, this approach has many disadvantages over the use of a "true" ORM such NHibernate or EF, but the one I'm trying to address here revolves around all the boilerplate code needed to map data from a result set into an object graph. Say I have the following DTO object graph I want to return to my presentation layer: IEnumerable<CustomerDTO> |--> IEnumerable<AddressDTO> |--> LatestOrderDTO The way I've implemented this is to have a discrete method in my DAO class to return each IEnumerable<*DTO>, and then have my service class be responsible for orchestrating the calls to the DAO. It then returns the fully assembled object graph to the client: public class SomeService(){ public SomeService(IDao someDao){ this._someDao = someDao; } public IEnumerable<CustomerDTO> ListCustomersForHistory(int brokerId){ var customers = _someDao.ListCustomersForBroker(brokerId); foreach (customer in customers){ customer.Addresses = someDao.ListCustomersAddresses(brokerId); customer.LatestOrder = someDao.GetCustomerLatestOrder(brokerId); } } return customers; } My question is should this logic belong in the service layer or the should I make my DAO such that it instead returns the assembled object graph. If I was using NHibernate, I assume that this kind of relationship association between objects comes for "free"?

    Read the article

  • A pixel is not a pixel is not a pixel

    Yesterday John Gruber wrote about the upped pixel density in the upcoming iPhone (960x480 instead of 480x320), and why Apple did this. He also wondered what the consequences for web developers would be.Now I happen to be deeply engaged in cross-browser research of widths and heights on mobile phones, and can state with reasonable certainty that in 99% of the cases these changes will not impact web developers at all.The remaining 1% could be much more tricky, but I expect Apple to cater to this problem...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

1