Search Results

Search found 1114 results on 45 pages for 'robert gould'.

Page 24/45 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • How to make a grid in a DataTemplate for a ItemTemplate auto-size to ListBox width?

    - by Robert Iagar
    So I have the following DataTemplate for a ListBox.ItemTemplate: <DataTemplate x:Key="Tweet"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="50"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="{Binding ProfileImageURL}" Width="50" Height="50"/> <Grid Grid.Column="1"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <TextBlock Grid.Row="0" FontSize="15" FontWeight="Bold" Text="{Binding User}"/> <TextBlock Grid.Row="1" TextWrapping="Wrap" Text="{Binding Status}"/> <DockPanel Grid.Row="2"> <TextBlock DockPanel.Dock="Left" FontSize="10" TextWrapping="WrapWithOverflow" Text="{Binding TimeAgo}" TextAlignment="Justify"/> <TextBlock DockPanel.Dock="Left" FontSize="10" TextWrapping="Wrap" Text="{Binding Source}"/> </DockPanel> </Grid> </Grid> </DataTemplate> The problem is that it doesn't auto-size to the ListBox. The text gets clipped: TwitBy preview How to fix it? Here's the listBox XAML definition: <ListBox x:Name="tweetsListBox" Margin="3,0" Grid.Row="1" Background="{x:Null}" Grid.IsSharedSizeScope="True" ItemsSource="{Binding}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemTemplate="{DynamicResource Tweet}"/> Any help would be appreciated. Thanks

    Read the article

  • What's the use of Ant's extension-point if/unless attributes?

    - by Robert Menteer
    When you define an extension-point in an Ant build file you can have it conditional by using the if or unless attribute. On a target the if/unless prevent it's tasks from being run. But an extension-point doesn't have any tasks to conditionally run, so what does the condition do? My thought (which proved to be incorrect in Ant 1.8.0) is it would prevent any tasks that extend the extension-point from being run. Here is an example build script showing the problem: <project name = "ext-test" default = "main"> <property name = "do.it" value = "false" /> <extension-point name = "init"/> <extension-point name = "doit" depends = "init" if = "${do.it}" /> <target name = "extend-init" extensionOf = "init"> <echo message = "Doing extend-init." /> </target> <target name = "extend-doit" extensionOf = "doit"> <echo message = "Do It! (${do.it})" /> </target> <target name = "main" depends = "doit"> <echo message = "Doing main." /> </target> </project> Using the command: ant -v Relults in: Apache Ant version 1.8.0 compiled on February 1 2010 Trying the default build file: build.xml Buildfile: /Users/bob/build.xml Detected Java version: 1.6 in: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home Detected OS: Mac OS X parsing buildfile /Users/bob/build.xml with URI = file:/Users/bob/build.xml Project base dir set to: /Users/bob parsing buildfile jar:file:/Users/bob/Documents/Development/3P-Tools/apache-ant-1.8.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/Users/bob/Documents/Development/3P-Tools/apache-ant-1.8.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file Build sequence for target(s) `main' is [extend-init, init, extend-doit, doit, main] Complete build sequence is [extend-init, init, extend-doit, doit, main, ] extend-init: [echo] Doing extend-init. init: extend-doit: [echo] Do It! (false) doit: Skipped because property 'false' not set. main: [echo] Doing main. BUILD SUCCESSFUL Total time: 0 seconds You will notice the target extend-doit is executed but the extention-point itself is skipped. Since an extention-point doesn't have any tasks exactly what has been skipped? Any targets that depend on the extention-point still get executed since a skipped target is a successful target. What is the value of the if/unless attributes on an extention-point?

    Read the article

  • WPF Data virtualizing ListView

    - by Robert Jeppesen
    In our current WinForms app, we are displaying millions of records in ListView, using virtualization. Rows are loaded from DB as they are requested. This works well, with good performance. This is a showstopper for migrating to WPF for us. We need data virtualization in a ListView, like WinForms 2.0 has. Do you know a decent third-party control, or a relatively easy way of doing it with built-in controls? It doesn't need to be a DataGrid, a simple ListView will suffice. Note, I'm note talking about UI virtualization, it's data virtualization.

    Read the article

  • Custom WPF TreeView

    - by Robert
    I have a custom class that I would like to bind a WPF TreeView that has three tiers. Each tier needs to be bound like this: Monitor --> LCD --> Samsung 1445 LCD --> CRT --> Sony 125 CRT Here is the example code: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); SystemInventory sysInventory = new SystemInventory(); //Possibly do something like this. _myTreeView.DataContext = sysInventory.DeviceGroupInstances; } public class SystemInventory { public ObservableCollection<DeviceGroup> DeviceGroupInstances { get; set; } public SystemInventory() { DeviceGroupInstances = new ObservableCollection<DeviceGroup>(); DeviceGroupInstances.Add(new DeviceGroup("Monitor")); } } public class DeviceGroup { public string DeviceGroupName { get; set; } public ObservableCollection<DeviceType> DeviceTypeInstances { get; set; } public DeviceGroup(string deviceGroupName) { DeviceTypeInstances = new ObservableCollection<DeviceType>(); DeviceGroupName = deviceGroupName; if (deviceGroupName == "Monitor") { DeviceTypeInstances.Add(new DeviceType("LCD")); DeviceTypeInstances.Add(new DeviceType("CRT")); } } } public class DeviceType { public string DeviceTypeName { get; set; } public ObservableCollection<DeviceInstance> DeviceInstances { get; set; } public DeviceType(string deviceGroupName) { DeviceInstances = new ObservableCollection<DeviceInstance>(); DeviceTypeName = deviceGroupName; if (deviceGroupName == "Monitor") { DeviceInstances.Add(new DeviceInstance("Samsung 1445 LCD")); } else { DeviceInstances.Add(new DeviceInstance("Sony 125 CRT")); } } } public class DeviceInstance { public string DeviceInstanceName { get; set; } public DeviceInstance(string instanceName) { DeviceInstanceName = instanceName; } } }

    Read the article

  • How do you create a unit-testing stub for an interface containing a read-only member?

    - by Robert Harvey
    I am writing some unit tests for an extension method I have written on IPrincipal. To assist, I have created a couple of helper classes (some code for not-implemented members of the interfaces has been omitted for brevity): public class IPrincipalStub : IPrincipal { private IIdentity identityStub = new IIdentityStub(); public IIdentity Identity { get { return identityStub } set { identityStub = value } } } public class IIdentityStub : IIdentity { public string Name { get; set; } } However, the Name property in the IIdentity interface is read-only (the IIDentity interface specifies a getter but not a setter for the Name property). How can I set the Name property in my stub object for testing purposes if the interface has defined it as a read-only property?

    Read the article

  • Perl When is using AUTOLOAD OK?

    - by Robert S. Barnes
    In "Perl Best Practices" the very first line in the section on AUTOLOAD is: Don't use AUTOLOAD However all the cases he describes are dealing with OO or Modules. I have a stand alone script in which some command line switches control which versions of particular functions get defined. Now I know I could just take the conditionals and the evals and stick them naked at the top of my file before everything else, but I find it convenient and cleaner to put them in AUTOLOAD at the end of the file. Is this bad practice / style? If you think so why, and is there a another way to do it?

    Read the article

  • Is there a Perl module or technique that makes using long namespaces easier?

    - by Robert P
    Some namespaces are long and annoying. Lets say that i downloaded hypothetical package called FooFoo-BarBar-BazBaz.tar.gz, and it has the following modules: FooFoo::BarBar::BazBaz::Bill FooFoo::BarBar::BazBaz::Bob FooFoo::BarBar::BazBaz::Ben FooFoo::BarBar::BazBaz::Bozo FooFoo::BarBar::BazBaz::Brown FooFoo::BarBar::BazBaz::Berkly FooFoo::BarBar::BazBaz::Berkly::First FooFoo::BarBar::BazBaz::Berkly::Second Is there a module or technique I can use that's similar to the C++ 'using' statement, i.e., is there a way I can do using FooFoo::BarBar::BazBaz; which would then let me do my $obj = Brown->new(); ok $obj->isa('FooFoo::BarBar::BazBaz::Brown') ; # true # or... ok $obj->isa('Brown'); # also true

    Read the article

  • Linq to Entities and LEFT OUTER JOIN issue with MANY:1 relations

    - by Robert Koritnik
    Can somebody tell me, why does Linq to Entities translate many to 1 relationships to left outer join instead of inner join? Because there's referential constraint on DB itself that ensures there's a record in the right table, so inner join should be used instead (and it would work much faster) If relation was many to 0..1 left outer join would be correct. Question Is it possible to write LINQ in a way so it will translate to inner join rather than left outer join. It would speed query execution a lot... I haven't used eSQL before, but would it be wise to use it in instead of LINQ? Edit I updated my tags to include technology I'm using in the background: Entity Framework V1 Devart dotConnect for Mysql MySql database If someone could test if the same is true on Microsoft SQL server it would also give me some insight if this is Devart's issue or it's a general L2EF functionality... But I suspect EF is the culprit here.

    Read the article

  • Calling a running C# application from VBA

    - by Robert
    I have some VBA code that needs to talk to a running c# application. For what it's worth, the c# application runs as a service, and exposes an interface via .net remoting. I posted a question regarding a specific problem I'm having already (http://stackoverflow.com/questions/2556163/from-vb6-to-net-via-com-and-remoting-what-a-mess) but I think I may have my structure all wrong... So I'm taking a step back - what's the best way to go about doing this? One thing that's worth taking into account is that I want to call into the running application - not just call a precompiled DLL...

    Read the article

  • [Perl] Testing for EAGAIN / EWOULDBLOCK on a recv

    - by Robert S. Barnes
    I'm testing a socket to see if it's still open: my $dummy = ''; my $ret = recv($sock, $dummy, 1, MSG_DONTWAIT | MSG_PEEK); if (!defined $ret || (length($dummy) == 0 && $! != EAGAIN && $! != EWOULDBLOCK )) { logerr("Broken pipe? ".__LINE__." $!"); } else { # socket still connected, reuse logerr(__LINE__.": $!"); return $sock; } I'm passing this code a socket I know for certain is open and it's always going through the first branch and logging "Broken pipe? 149 Resource temporarily unavailable". I don't understand how this is happening since "Resource temporarily unavailable" is supposed to correspond to EAGAIN as far as I know. I'm sure there must be something simple I'm missing. And yes, I know this is not a full proof way to test and I account for that.

    Read the article

  • Error in {% markdown %} filter in Django Nonrel

    - by Robert Smith
    I'm having trouble using Markdown in Django Nonrel. I followed this instructions (added 'django.contrib.markup' to INSTALLED_APPS, include {% load markup %} in the template and use |markdown filter after installing python-markdown) but I get the following error: Error in {% markdown %} filter: The Python markdown library isn't installed. In this line: /path/to/project/django/contrib/markup/templatetags/markup.py in markdown they will be silently ignored. """ try: import markdown except ImportError: if settings.DEBUG: raise template.TemplateSyntaxError("Error in {% markdown %} filter: The Python markdown library isn't installed.") ... return force_unicode(value) else: # markdown.version was first added in 1.6b. The only version of markdown # to fully support extensions before 1.6b was the shortlived 1.6a. if hasattr(markdown, 'version'): extensions = [e for e in arg.split(",") if e] It seems obvious that import markdown is causing the problem but when I run: $ python manage.py shell >>> import elementtree >>> import markdown everthing works alright. Running Markdown 2.0.3, Django 1.3.1, Python 2.7. UPDATE: I thought maybe this was an issue related to permissions, so I changed my project via chmod 777 -R, but it didn't work. Ideas? Thanks!

    Read the article

  • Thread safety in Singleton

    - by Robert
    I understand that double locking in Java is broken, so what are the best ways to make Singletons Thread Safe in Java? The first thing that springs to my mind is: class Singleton{ private static Singleton instance; private Singleton(){} public static synchronized Singleton getInstance(){ if(instance == null) instance = new Singleton(); return instance; } } Does this work? if so, is it the best way (I guess that depends on circumstances, so stating when a particular technique is best, would be useful)

    Read the article

  • Generating a reasonable ctags database for Boost

    - by Robert S. Barnes
    I'm running Ubuntu 8.04 and I ran the command: $ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/stdlibcpp /usr/include/c++/4.2.4/ to generate a ctags database for the standard C++ library and STL ( libstdc++ ) on my system for use with the OmniCppComplete vim script. This gave me a very reasonable 4MB tags file which seems to work fairly well. However, when I ran the same command against the installed Boost headers: $ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/boost /usr/include/boost/ I ended up with a 1.4 GB tags file! I haven't tried it yet, but that seems likes it's going to be too large to be useful. Is there a way to get a slimmer, more usable tags file for my installed Boost headers? Edit Just as a note, libstdc++ includes TR1, which has allot of Boost libs in it. So there must be something weird going on for libstdc++ to come out with a 4 MB tags file and Boost to end up with a 1.4 GB tags file.

    Read the article

  • Help me choose between Go and Io

    - by Robert Smith
    During the following months I'll have some spare time so I thought of picking up a new programming language.I've been reading some articles about Go and Io and both of them look interesting and very promising so I'm stuck making a decision about which one to pick up next. I'm mainly interested in distributed systems and concurrency. Any help is greatly appreciated. Thanks.

    Read the article

  • Is writing eSQL database independent or not?

    - by Robert Koritnik
    Using EF we can use LINQ to read data which is rather simple (especially using fluent calls), but we have less control unless we write eSQL on our own. Is writing eSQL actually data store independent code? So if we decide to change data store, can the same statements still be used? Does writing eSQL strings in your code pose any serious security threats similar to writing TSQL statements as plain strings in C# code? That's why SPs are recommended. Could we still move eSQL scripts outside of code and use some other technique to make them a bit more secure?

    Read the article

  • Is there any legitimate use for bare strings in PHP?

    - by Robert
    This question got me thinking about bare strings. When PHP sees a string that's not enclosed in quotes, it first checks to see if it's a constant. If not, it just assumes it's a string and goes on anyway. So for example if I have echo $foo[bar]; If there's a constant called bar it uses that for the array key, but if not then it treats bar as a bare string, so it behaves just like echo $foo["bar"]; This can cause all kinds of problems if at some future date a constant is added with the same name. My question is, is there any situation in which it actually makes sense to use a bare string?

    Read the article

  • Which management tools would you recommend for software development?

    - by Robert Schneider
    What would you generally recommend for software developement? Which combination do you use or would you recommend? I assume that tools are needed for Version control, issues/bugs/task, Release management, Requirement management. Tools for Test management and Project management should be accounted for as well, I guess. Did I forget anything? Maybe tools for Continous Integration. I'm not interested in a halfway combination of one ore two tools like a Subversion + Bugzilla (I know they are good but for a company they might not be sufficient). And also tools like make/ant shouldn't be taken into account. I'd like to know a combination that covers all what is important for professional software development. However, it could be a single tool of course if it covers all the management issues. What do you think would be a good combination? I assume a combination should be regardes as good if the tools itself are good but also if they have good integrations. Udate: Something like Ant is just a script not a management tool. Okay: we do already have Perforce. But this is somehow generic. We have different projects that uses C-, VS/.NET-, Python-, PHP and we will be starting new projects in Java. Plenty of languages and frameworks, though some are going to be legacy. So the tools should be generic. Obviously we don't want to use Bugzilla for one project and Jira for another. The management tools have to be generic. Further thoughts: Think of sourceforge: For each project they offer a version control system, an issue tracker, a wiki, ... totally independent of what the project is about. Those are some management tools that a project usually needs. I would say that most companies need such a set of tools. But I could imagine, if a company has several projects, they need further tools too: for Project management, Quality management, ... And I could imagine there are some recommendable combinations of tools. A not really apropiate comparison to this could be LAMP (Linux, Apache, MySQL, PHP). A combination of software that has evolved since they work very well together, and are pretty useful for a lot of applications (or rather web sites). So maybe there are some recommendable management tool combinations that also fit toghether like LAMP. The integration is important. Thank you for the incredibly fast and helpful responses!!!

    Read the article

  • When is it safe to remote import entires from feature.xml?

    - by Robert Munteanu
    I've recently learned that the import section from feature.xml is legacy, and the actual dependency work is delegated to the p2 engine, which uses the information from the plugin manifest. I am not sure though if p2 is available for all recent versions of Eclipse, or in all Eclipse-based products, so I'm not sure if it is safe to remove the import section from feature.xml. Under what circumstances is it safe to remove the import section from feature.xml? Assume that we are taking into consideration Eclipse 3.4 or newer.

    Read the article

  • How to Create MySQL Query to Find Related Posts from Multiple Tables?

    - by Robert Samuel White
    This is a complicated situation (for me) that I'm hopeful someone on here can help me with. I've done plenty of searching for a solution and have not been able to locate one. This is essentially my situation... (I've trimmed it down because if someone can help me to create this query I can take it from there.) TABLE articles (article_id, article_title) TABLE articles_tags (row_id, article_id, tag_id) TABLE article_categories (row_id, article_id, category_id) All of the tables have article_id in common. I know what all of the tag_id and category_id rows are. What I want to do is return a list of all the articles that article_tags and article_categories MAY have in common, ordered by the number of common entries. For example: article1 - tags: tag1, tag2, tag3 - categories: cat1, cat2 article2 - tags: tag2 - categories: cat1, cat2 article3 - tags: tag1, tag3 - categories: cat1 So if my article had "tag1" and "cat1 and cat2" it should return the articles in this order: article1 (tag1, cat1 and cat2 in common) article3 (tag1, cat1 in common) article2 (cat1 in common) Any help would genuinely be appreciated! Thank you!

    Read the article

  • Java Loop every minute.

    - by Robert
    I want to write a loop in Java that firs starts up and goes like this: while (!x){ //wait one minute or two //execute code } I want to do this so that it does not use up system resources. What is actually going on in the code is that it goes to a website and checks to see if something is done, if it is not done, it should wait another minute until it checks again, and when its done it just moves on. Is their anyway to do this in java? I googled it but didnt find anything. Thanks

    Read the article

  • Create an anonymous type object from an arbitrary text file

    - by Robert Harvey
    I need a sensible way to draw arbitrary text files into a C# program, and produce an arbitrary anonymous type object, or perhaps a composite dictionary of some sort. I have a representative text file that looks like this: adapter 1: LPe11002 Factory IEEE: 10000000 C97A83FC Non-Volatile WWPN: 10000000 C93D6A8A , WWNN: 20000000 C93D6A8A adapter 2: LPe11002 Factory IEEE: 10000000 C97A83FD Non-Volatile WWPN: 10000000 C93D6A8B , WWNN: 20000000 C93D6A8B Is there a way to get this information into an anonymous type object or some similar structure? The final anonymous type might look something like this, if it were composed in C# by hand: new { adapter1 = new { FactoryIEEE = "10000000 C97A83FC", Non-VolatileWWPN = "10000000 C93D6A8A", WWNN = "20000000 C93D6A8A" } adapter2 = new { FactoryIEEE = "10000000 C97A83FD", Non-VolatileWWPN = "10000000 C93D6A8B", WWNN = "20000000 C93D6A8B" } } Note that, as the text file's content is arbitrary (i.e. the keys could be anything), a specialized solution (e.g. that looks for names like "FactoryIEEE") won't work. However, the structure of the file will always be the same (i.e. indentation for groups, colons and commas as delimiters, etc). Or maybe I'm going about this the wrong way, and you have a better idea?

    Read the article

  • The type of field isn't supported by declared persistence strategy "OneToMany"

    - by Robert
    We are new to JPA and trying to setup a very simple one to many relationship where a pojo called Message can have a list of integer group id's defined by a join table called GROUP_ASSOC. Here is the DDL: CREATE TABLE "APP"."MESSAGE" ( "MESSAGE_ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) ); ALTER TABLE "APP"."MESSAGE" ADD CONSTRAINT "MESSAGE_PK" PRIMARY KEY ("MESSAGE_ID"); CREATE TABLE "APP"."GROUP_ASSOC" ( "GROUP_ID" INTEGER NOT NULL, "MESSAGE_ID" INTEGER NOT NULL ); ALTER TABLE "APP"."GROUP_ASSOC" ADD CONSTRAINT "GROUP_ASSOC_PK" PRIMARY KEY ("MESSAGE_ID", "GROUP_ID"); ALTER TABLE "APP"."GROUP_ASSOC" ADD CONSTRAINT "GROUP_ASSOC_FK" FOREIGN KEY ("MESSAGE_ID") REFERENCES "APP"."MESSAGE" ("MESSAGE_ID"); Here is the pojo: @Entity @Table(name = "MESSAGE") public class Message { @Id @Column(name = "MESSAGE_ID") @GeneratedValue(strategy = GenerationType.IDENTITY) private int messageId; @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.PERSIST) private List groupIds; public int getMessageId() { return messageId; } public void setMessageId(int messageId) { this.messageId = messageId; } public List getGroupIds() { return groupIds; } public void setGroupIds(List groupIds) { this.groupIds = groupIds; } } When we try to execute the following test code we get <openjpa-1.2.3-SNAPSHOT-r422266:907835 fatal user error> org.apache.openjpa.util.MetaDataException: The type of field "pojo.Message.groupIds" isn't supported by declared persistence strategy "OneToMany". Please choose a different strategy. Message msg = new Message(); List groups = new ArrayList(); groups.add(101); groups.add(102); EntityManager em = Persistence.createEntityManagerFactory("TestDBWeb").createEntityManager(); em.getTransaction().begin(); em.persist(msg); em.getTransaction().commit(); Help!

    Read the article

  • Unable to cast object of type MyObject to type MyObject

    - by Robert W
    I have this scenario where a webservice method I'm consuming in C# returns a Business object, when calling the webservice method with the following code I get the exception "Unable to cast object of type ContactInfo to type ContactInfo" in the reference.cs class of the web reference Code: ContactInfo contactInfo = new ContactInfo(); Contact contact = new Contact(); contactInfo = contact.Load(this.ContactID.Value); Any help would be much appreciated.

    Read the article

  • Sharepoint Foundation 2010 development environment installation problems

    - by Robert Koritnik
    I'm having problems installing development machine for Sharepoint (Foundation) 2010. This is what I did so far on the same machine: Installed a clean Windows 7 x64 with 4GB of RAM without being part of any domain. Just a simple standalone machine. Enabled IIS related features as described here except IIS6 related ones (two of them) Installed SQL Server 2008 R2 Development Edition (DB Engine and Writer being enabled but not SQL Agent) Installed Visual Studio 2010 Premium Started installing Sharepoint Foundation 2010 with first extracting files, changing config to enable Windows 7 installation and then installed it as Server Farm (then Complete) to avoid installing SQL Express. Created a separate SPF_CONFIG local user with Logon on as a service right. Opened SPF Management Shell and run New-SPConfigurationDatabase so I am able to use a non-domain username (SPF_CONFIG that I created in the previous step) But all I get is this: The outcome after this error is: Database Sharepoint2010Config is created User SPF_CONFIG is added to SQL Server and attached to this newly created database as dbowner Checking SQL server security logins this user has following rights: dbcreator securityadmin public

    Read the article

  • Smart auto detect and replace URLs with anchor tags

    - by Robert Koritnik
    I've written a regular expression that automatically detects URLs in free text that users enter. This is not such a simple task as it may seem at first. Jeff Atwood writes about it in his post. His regular expression works, but needs extra code after detection is done. I've managed to write a regular expression that does everything in a single go. This is how it looks like (I've broken it down into separate lines to make it more understandable what it does): 1 (?<outer>\()? 2 (?<scheme>http(?<secure>s)?://)? 3 (?<url> 4 (?(scheme) 5 (?:www\.)? 6 | 7 www\. 8 ) 9 [a-z0-9] 10 (?(outer) 11 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\)) 12 | 13 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+ 14 ) 15 ) 16 (?<ending>(?(outer)\))) As you may see, I'm using named capture groups (used later in Regex.Replace()) and I've also included some local characters (cšžcd), that allow our localised URL to be parsed as well. You can easily omit them if you'd like. Anyway. Here's what it does (referring to line numbers): 1 - detects if URL starts with open braces (is contained inside braces) and stores it in "outer" named capture group 2 - checks if it starts with URL scheme also detecting whether scheme is SSL or not 3 - starts parsing URL itself (will store it in "url" named capture group) 4-8 - if statement that says: if "sheme" was present then www. part is optional, otherwise mandatory for a string to be a link (so this regular expression detects all strings that start with either http or www) 9 - first character after http:// or www. should be either a letter or a number (this can be extended if you would like to cover even more links, but I've decided to omit other characters because I can't remember a link that would start with some other character 10-14 - if statement that says: if "outer" (braces) was present capture everything up to the last closing braces otherwise capture all 15 - closes the named capture group for URL 16 - if open braces was present, capture closing braces as well and store it in "ending" named capture group First and last line used to have \s* in them as well, so user could also write open braces and put a space inside before pasting link. Anyway. My code that does link replacement with actual anchor HTML elements looks exactly like this: value = Regex.Replace( value, @"(?<outer>\()?(?<scheme>http(?<secure>s)?://)?(?<url>(?(scheme)(?:www\.)?|www\.)[a-z0-9](?(outer)[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\))|[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+))(?<ending>(?(outer)\)))", "${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending}", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); As you can see I'm using named capture groups to replace link with an Anchor tag: ${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending} I could as well omit the http(s) part in anchor display to make links look friendlier, but for now I decided not to. Question I would like for my links to be replaced with shortenings as well. So when user copies a very long links (for instance if they would copy a link from google maps that usually generates long links I would like to shorten the visible part of the anchor tag. Link would work, but visible part of an anchor tag would be shortened to some number of characters. Does the replace string support notations like that so I can stil use a singe Regex.Replace() call?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >