Search Results

Search found 5636 results on 226 pages for 'facade pattern'.

Page 18/226 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Inauguration Of My Laptop

    - by Pawan_Mishra
    Today I received my new laptop which is an Intel Core i5-2450M @ 2.50GHz 4 GB RAM machine . The other laptop(office provided) which I have used for past two years for programming is an Intel Core2 Duo T6570 @ 2.10GHz machine. Reason why I am talking about the laptops that I own is because of my interest in writing multi-threaded/parallel code using the new TPL API provided in the .Net 4.0 framework. I have spent significant amount of time in past one year writing code using the Parallel API of .Net...(read more)

    Read the article

  • Join the Authors of SSIS Design Patterns at the PASS Summit 2012!

    - by andyleonard
    My fellow authors and I will be presenting a day-long pre-conference session titled SSIS Design Patterns at the PASS Summit 2012 in Seattle Monday 5 Nov 2012! Register to learn patterns for: Package execution Package logging Loading flat file sources Loading XML sources Loading the cloud Dynamic package generation SSIS Frameworks Data warehouse ETL Data flow performance   Presenting this session: Matt Masson Tim Mitchell Jessica Moss Michelle Ufford Andy Leonard I hope to see you in Seattle!...(read more)

    Read the article

  • Learn SSIS from the Authors of SSIS Design Patterns at the PASS Summit 2012!

    - by andyleonard
    Jessica Moss ( blog | @jessicammoss ), Michelle Ufford ( blog | @sqlfool ), Tim Mitchell ( blog | @tim_mitchell ), Matt Masson ( blog | @mattmasson ), and me – we are all presenting the SSIS Design Patterns pre-conference session at the PASS Summit 2012 ! We will be covering material from, and based upon, the book. We will describe and demonstrate patterns for package execution, package logging, loading flat file and XML sources, loading the cloud, dynamic package generation, SSIS Frameworks, data...(read more)

    Read the article

  • Presenting at SQL Saturday #70 - Columbia SC

    - by andyleonard
    Introduction I'm honored to be presenting at SQL Saturday #70 in Coumbia SC 19 Mar 2011! Its always good to travel to places where I don't have to suppress my accent (what accent? I talk normal. Everyone else sounds funny...) and repeat my order at Waffle House . It's always an honor to hang out with The Keeper of the Duck (K. Brian Kelley) ( Blog | @kbriankelley ) and the cool crew in Columbia. Presentations There are some stellar presentations from awesome speakers scheduled for the event... plus...(read more)

    Read the article

  • Book Review: SSIS Design Patterns

    - by andyleonard
    Samuel Vanga ( Blog | @SamuelVanga ) has posted a review of our new book SSIS Design Patterns at his blog . Several of Sam’s statements struck me, but none more than this: Within a few hours of reading SQL Server 2012 Integration Services Design Patterns , it stood out that none of the authors were trying to impress by showing what they all know in SSIS. Instead, they focused on describing solutions and patterns in a great detail (exactly why I paid for). Sam mentions he could not locate the source...(read more)

    Read the article

  • Presenting at Roanoke Code Camp Saturday!

    - by andyleonard
    Introduction I am honored to once again be selected to present at Roanoke Code Camp ! An Introductory Topic One of my presentations is titled "I See a Control Flow Tab. Now What?" It's a Level 100 talk for those wishing to learn how to build their very first SSIS package. This highly-interactive, demo-intense presentation is for beginners and developers just getting started with SSIS. Attend and learn how to build SSIS packages from the ground up . Designing an SSIS Framework I'm also presenting...(read more)

    Read the article

  • How to "translate" interdependent object states in code?

    - by Earl Grey
    I have the following problem. My UI interace contains several buttons, labels, and other visual information. I am able to describe every possible workflow scenario that should be be allowed on that UI. That means I can describe it like this - when button A is pressed, the following should follow - In the case of that A button, there are three independent factors that influence the possible result when pushing the A button. The state of the session (blank, single, multi, multi special), the actual work that is being done by the system at the moment of pressing the A button (nothing was happening, work was being done, work was paused) and a separate UI element that has two states (on , off)..This gives me a 3 dimensional cube with 24 possible outcomes. I could write code for this using if cycles, switch cycles etc....but the problem is, I have another 7 buttons on that ui, I can enter this UI from different states..some buttons change the state, some change parameters... To sum up, the combinations are mindbogling and I am not able come up with a methodology that scales and is systematically reliable. I am able to describe EVERY workflow with words, I am sure my description is complete and without logical errors. But I am not able to translate that into code. I was trying to draw flowcharts but it soon became visually too complicated due to too many if "emafors". Can you advice how to proceeed?

    Read the article

  • A first look at ConfORM - Part 1

    - by thangchung
    All source codes for this post can be found at here.Have you ever heard of ConfORM is not? I have read it three months ago when I wrote an post about NHibernate and Autofac. At that time, this project really has just started and still in beta version, so I still do not really care much. But recently when reading a book by Jason Dentler NHibernate 3.0 Cookbook, I started to pay attention to it. Author have mentioned quite a lot of OSS in his book. And now again I have reviewed ConfORM once again. I have been involved in ConfORM development group on google and read some articles about it. Fabio Maulo spent a lot of work for the OSS, and I hope it will adapt a great way for NHibernate (because he contributed to NHibernate that). So what is ConfORM? It is stand for Configuration ORM, and it was trying to use a lot of heuristic model for identifying entities from C# code. Today, it's mostly Model First Driven development, so the first thing is to build the entity model. This is really important and we can see it is the heart of business software. Then we have to tell DB about the entity of this model. We often will use Inversion Engineering here, Database Schema is will create based on recently Entity Model. From now we will absolutely not interested in the DB again, only focus on the Entity Model.Fluent NHibenate really good, I liked this OSS. Sharp Architecture and has done so well in Fluent NHibernate integration with applications. A Multiple Database technical in Sharp Architecture is truly awesome. It can receive configuration, a connection string and a dll containing entity model, which would then create a SessionFactory, finally caching inside the computer memory. As the number of SessionFactory can be very large and will full of the memory, it has also devised a way of caching SessionFactory in the file. This post I hope this will not completely explain about and building a model of multiple databases. I just tried to mount a number of posts from the community and apply some of my knowledge to build a management model Session for ConfORM.As well as Fluent NHibernate, ConfORM also supported on the interface mapping, see this to understand it. So the first thing we will build the Entity Model for it, and here is what I will use the model for this article. A simple model for managing news and polls, it will be too easy for a number of people, but I hope not to bring complexity to this post.I will then have some code to build super type for the Entity Model. public interface IEntity<TId>    {        TId Id { get; set; }    } public abstract class EntityBase<TId> : IEntity<TId>    {        public virtual TId Id { get; set; }         public override bool Equals(object obj)        {            return Equals(obj as EntityBase<TId>);        }         private static bool IsTransient(EntityBase<TId> obj)        {            return obj != null &&            Equals(obj.Id, default(TId));        }         private Type GetUnproxiedType()        {            return GetType();        }         public virtual bool Equals(EntityBase<TId> other)        {            if (other == null)                return false;            if (ReferenceEquals(this, other))                return true;            if (!IsTransient(this) &&            !IsTransient(other) &&            Equals(Id, other.Id))            {                var otherType = other.GetUnproxiedType();                var thisType = GetUnproxiedType();                return thisType.IsAssignableFrom(otherType) ||                otherType.IsAssignableFrom(thisType);            }            return false;        }         public override int GetHashCode()        {            if (Equals(Id, default(TId)))                return base.GetHashCode();            return Id.GetHashCode();        }    } Database schema will be created as:The next step is to build the ConORM builder to create a NHibernate Configuration. Patrick have a excellent article about it at here. Contract of it below: public interface IConfigBuilder    {        Configuration BuildConfiguration(string connectionString, string sessionFactoryName);    } The idea here is that I will pass in a connection string and a set of the DLL containing the Entity Model and it makes me a NHibernate Configuration (shame that I stole this ideas of Sharp Architecture). And here is its code: public abstract class ConfORMConfigBuilder : RootObject, IConfigBuilder    {        private static IConfigurator _configurator;         protected IEnumerable<Type> DomainTypes;         private readonly IEnumerable<string> _assemblies;         protected ConfORMConfigBuilder(IEnumerable<string> assemblies)            : this(new Configurator(), assemblies)        {            _assemblies = assemblies;        }         protected ConfORMConfigBuilder(IConfigurator configurator, IEnumerable<string> assemblies)        {            _configurator = configurator;            _assemblies = assemblies;        }         public abstract void GetDatabaseIntegration(IDbIntegrationConfigurationProperties dBIntegration, string connectionString);         protected abstract HbmMapping GetMapping();         public Configuration BuildConfiguration(string connectionString, string sessionFactoryName)        {            Contract.Requires(!string.IsNullOrEmpty(connectionString), "ConnectionString is null or empty");            Contract.Requires(!string.IsNullOrEmpty(sessionFactoryName), "SessionFactory name is null or empty");            Contract.Requires(_configurator != null, "Configurator is null");             return CatchExceptionHelper.TryCatchFunction(                () =>                {                    DomainTypes = GetTypeOfEntities(_assemblies);                     if (DomainTypes == null)                        throw new Exception("Type of domains is null");                     var configure = new Configuration();                    configure.SessionFactoryName(sessionFactoryName);                     configure.Proxy(p => p.ProxyFactoryFactory<ProxyFactoryFactory>());                    configure.DataBaseIntegration(db => GetDatabaseIntegration(db, connectionString));                     if (_configurator.GetAppSettingString("IsCreateNewDatabase").ConvertToBoolean())                    {                        configure.SetProperty("hbm2ddl.auto", "create-drop");                    }                     configure.Properties.Add("default_schema", _configurator.GetAppSettingString("DefaultSchema"));                    configure.AddDeserializedMapping(GetMapping(),                                                     _configurator.GetAppSettingString("DocumentFileName"));                     SchemaMetadataUpdater.QuoteTableAndColumns(configure);                     return configure;                }, Logger);        }         protected IEnumerable<Type> GetTypeOfEntities(IEnumerable<string> assemblies)        {            var type = typeof(EntityBase<Guid>);            var domainTypes = new List<Type>();             foreach (var assembly in assemblies)            {                var realAssembly = Assembly.LoadFrom(assembly);                 if (realAssembly == null)                    throw new NullReferenceException();                 domainTypes.AddRange(realAssembly.GetTypes().Where(                    t =>                    {                        if (t.BaseType != null)                            return string.Compare(t.BaseType.FullName,                                          type.FullName) == 0;                        return false;                    }));            }             return domainTypes;        }    } I do not want to dependency on any RDBMS, so I made a builder as an abstract class, and so I will create a concrete instance for SQL Server 2008 as follows: public class SqlServerConfORMConfigBuilder : ConfORMConfigBuilder    {        public SqlServerConfORMConfigBuilder(IEnumerable<string> assemblies)            : base(assemblies)        {        }         public override void GetDatabaseIntegration(IDbIntegrationConfigurationProperties dBIntegration, string connectionString)        {            dBIntegration.Dialect<MsSql2008Dialect>();            dBIntegration.Driver<SqlClientDriver>();            dBIntegration.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;            dBIntegration.IsolationLevel = IsolationLevel.ReadCommitted;            dBIntegration.ConnectionString = connectionString;            dBIntegration.LogSqlInConsole = true;            dBIntegration.Timeout = 10;            dBIntegration.LogFormatedSql = true;            dBIntegration.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y', no 'N'";        }         protected override HbmMapping GetMapping()        {            var orm = new ObjectRelationalMapper();             orm.Patterns.PoidStrategies.Add(new GuidPoidPattern());             var patternsAppliers = new CoolPatternsAppliersHolder(orm);            //patternsAppliers.Merge(new DatePropertyByNameApplier()).Merge(new MsSQL2008DateTimeApplier());            patternsAppliers.Merge(new ManyToOneColumnNamingApplier());            patternsAppliers.Merge(new OneToManyKeyColumnNamingApplier(orm));             var mapper = new Mapper(orm, patternsAppliers);             var entities = new List<Type>();             DomainDefinition(orm);            Customize(mapper);             entities.AddRange(DomainTypes);             return mapper.CompileMappingFor(entities);        }         private void DomainDefinition(IObjectRelationalMapper orm)        {            orm.TablePerClassHierarchy(new[] { typeof(EntityBase<Guid>) });            orm.TablePerClass(DomainTypes);             orm.OneToOne<News, Poll>();            orm.ManyToOne<Category, News>();             orm.Cascade<Category, News>(Cascade.All);            orm.Cascade<News, Poll>(Cascade.All);            orm.Cascade<User, Poll>(Cascade.All);        }         private static void Customize(Mapper mapper)        {            CustomizeRelations(mapper);            CustomizeTables(mapper);            CustomizeColumns(mapper);        }         private static void CustomizeRelations(Mapper mapper)        {        }         private static void CustomizeTables(Mapper mapper)        {        }         private static void CustomizeColumns(Mapper mapper)        {            mapper.Class<Category>(                cm =>                {                    cm.Property(x => x.Name, m => m.NotNullable(true));                    cm.Property(x => x.CreatedDate, m => m.NotNullable(true));                });             mapper.Class<News>(                cm =>                {                    cm.Property(x => x.Title, m => m.NotNullable(true));                    cm.Property(x => x.ShortDescription, m => m.NotNullable(true));                    cm.Property(x => x.Content, m => m.NotNullable(true));                });             mapper.Class<Poll>(                cm =>                {                    cm.Property(x => x.Value, m => m.NotNullable(true));                    cm.Property(x => x.VoteDate, m => m.NotNullable(true));                    cm.Property(x => x.WhoVote, m => m.NotNullable(true));                });             mapper.Class<User>(                cm =>                {                    cm.Property(x => x.UserName, m => m.NotNullable(true));                    cm.Property(x => x.Password, m => m.NotNullable(true));                });        }    } As you can see that we can do so many things in this class, such as custom entity relationships, custom binding on the columns, custom table name, ... Here I only made two so-Appliers for OneToMany and ManyToOne relationships, you can refer to it here public class ManyToOneColumnNamingApplier : IPatternApplier<PropertyPath, IManyToOneMapper>    {        #region IPatternApplier<PropertyPath,IManyToOneMapper> Members         public void Apply(PropertyPath subject, IManyToOneMapper applyTo)        {            applyTo.Column(subject.ToColumnName() + "Id");        }         #endregion         #region IPattern<PropertyPath> Members         public bool Match(PropertyPath subject)        {            return subject != null;        }         #endregion    } public class OneToManyKeyColumnNamingApplier : OneToManyPattern, IPatternApplier<PropertyPath, ICollectionPropertiesMapper>    {        public OneToManyKeyColumnNamingApplier(IDomainInspector domainInspector) : base(domainInspector) { }         #region Implementation of IPattern<PropertyPath>         public bool Match(PropertyPath subject)        {            return Match(subject.LocalMember);        }         #endregion Implementation of IPattern<PropertyPath>         #region Implementation of IPatternApplier<PropertyPath,ICollectionPropertiesMapper>         public void Apply(PropertyPath subject, ICollectionPropertiesMapper applyTo)        {            applyTo.Key(km => km.Column(GetKeyColumnName(subject)));        }         #endregion Implementation of IPatternApplier<PropertyPath,ICollectionPropertiesMapper>         protected virtual string GetKeyColumnName(PropertyPath subject)        {            Type propertyType = subject.LocalMember.GetPropertyOrFieldType();            Type childType = propertyType.DetermineCollectionElementType();            var entity = subject.GetContainerEntity(DomainInspector);            var parentPropertyInChild = childType.GetFirstPropertyOfType(entity);            var baseName = parentPropertyInChild == null ? subject.PreviousPath == null ? entity.Name : entity.Name + subject.PreviousPath : parentPropertyInChild.Name;            return GetKeyColumnName(baseName);        }         protected virtual string GetKeyColumnName(string baseName)        {            return string.Format("{0}Id", baseName);        }    } Everyone also can download the ConfORM source at google code and see example inside it. Next part I will write about multiple database factory. Hope you enjoy about it. happy coding and see you next part.

    Read the article

  • Presenting Loading Data Warehouse Partitions with SSIS 2012 at SQL Saturday DC!

    - by andyleonard
    Join Darryll Petrancuri and me as we present Loading Data Warehouse Partitions with SSIS 2012 Saturday 8 Dec 2012 at SQL Saturday 173 in DC ! SQL Server 2012 table partitions offer powerful Big Data solutions to the Data Warehouse ETL Developer. In this presentation, Darryll Petrancuri and Andy Leonard demonstrate one approach to loading partitioned tables and managing the partitions using SSIS 2012, and reporting partition metrics using SSRS 2012. Objectives A practical solution for loading Big...(read more)

    Read the article

  • Presenting Loading Data Warehouse Partitions with SSIS 2012 at SQL Saturday DC!

    - by andyleonard
    Join Darryll Petrancuri and me as we present Loading Data Warehouse Partitions with SSIS 2012 Saturday 8 Dec 2012 at SQL Saturday 173 in DC ! SQL Server 2012 table partitions offer powerful Big Data solutions to the Data Warehouse ETL Developer. In this presentation, Darryll Petrancuri and Andy Leonard demonstrate one approach to loading partitioned tables and managing the partitions using SSIS 2012, and reporting partition metrics using SSRS 2012. Objectives A practical solution for loading Big...(read more)

    Read the article

  • Access functions from user control without events?

    - by BornToCode
    I have an application made with usercontrols and a function on main form that removes the previous user controls and shows the desired usercontrol centered and tweaked: public void DisplayControl(UserControl uControl) I find it much easier to make this function static or access this function by reference from the user control, like this: MainForm mainform_functions = (MainForm)Parent; mainform_functions.DisplayControl(uc_a); You probably think it's a sin to access a function in mainform, from the usercontrol, however, raising an event seems much more complex in such case - I'll give a simple example - let's say I raise an event from usercontrol_A to show usercontrol_B on mainform, so I write this: uc_a.show_uc_b+= (s,e) => { usercontrol_B uc_b = new usercontrol_B(); DisplayControl(uc_b); }; Now what if I want usercontrol_B to also have an event to show usercontrol_C? now it would look like this: uc_a.show_uc_b+= (s,e) => { usercontrol_B uc_b = new usercontrol_B(); DisplayControl(uc_b); uc_b.show_uc_c += (s2,e2) => {usercontrol_C uc_c = new usercontrol_C(); DisplayControl(uc_c);} }; THIS LOOKS AWFUL! The code is much simpler and readable when you actually access the function from the usercontrol itself, therefore I came to the conclusion that in such case it's not so terrible if I break the rules and not use events for such general function, I also think that a readable usercontrol that you need to make small adjustments for another app is preferable than a 100% 'generic' one which makes my code look like a pile of mud. What is your opinion? Am I mistaken?

    Read the article

  • Speaking at Triangle SQL Server User Group 16 Mar 2010!

    - by andyleonard
    I'm excited to present Applied SSIS Design Patterns to the Triangle SQL Server User Group 16 Mar 2010! This is a reprise of my PASS Summit 2009 spotlight session. If you read this blog and make the meeting, introduce yourself! :{> Andy Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!...(read more)

    Read the article

  • PASS Summit 2010 Presentation Feedback

    - by andyleonard
    Introduction It's always an honor to present anywhere. Presenting at the PASS Summit is a special honor. I delivered three presentations last month: Database Design for Developers SSIS Design Patterns, Part 2 A Lightning Talk on SSIS Database Design for Developers First, a bit of explanation (defense): I submitted this abstract to the PASS Abstracts folks by mistake . I kid you not. Inspired by Adam Machanic ( Blog | @AdamMachanic ) I maintain a document of current presentations. I've recently published...(read more)

    Read the article

  • Speaking at SQL Saturday #39 in NYC!

    - by andyleonard
    I am honored to present Applied SSIS Design Patterns and Introduction to Incremental Loads at SQL Saturday #39 in New York City! If you're there and you read this blog, be sure to stop by and introduce yourself! :{> Andy Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!...(read more)

    Read the article

  • Presenting to the New England SQL Server Users Group 10 Jun 2010!

    - by andyleonard
    I am honored to present Applied SSIS Design Patterns to the New England SQL Server Users Group on 10 Jun 2010! This is a reprise of the spotlight session presented at the PASS Summit 2009. Abstract "Design Patterns" is more than a trendy buzz phrase; design patterns are a way of breaking down complex development projects into manageable tasks. They lend themselves to several development methodologies and apply to SSIS development. Chances are you're using your own design patterns now! In this spotlight...(read more)

    Read the article

  • Multilingual Publishing Pack (MLP): make a link to the corresponding page in the another language?

    - by lyle
    I am helping to build a bilingual website using MLP on TextPattern. It's trivial to put a link to the top level page of another language, but how to put a link to the current page in another language? Eg. /en/contact should link to /de/kontakt (the same article in another language). I'm sure there are some variables somewhere that I could put into the template that would be filled with the correct links.

    Read the article

  • Pending and Approval process

    - by zen
    So let's say I have a DB table with 8 columns, one is a unique auto-incrementing used as ID. So I have a page that pulls in the info for each row based on query string ID. I want to give my users the ability to propose changes. Kinda like a wiki setup. So I was thinking I should just have another duplicate table or maybe database altogether (without the auto-incrementing column and maybe with a date edited column) that keeps all proposed changes in queue and then when I approve them, the script can move the row from the proposed DB to the real DB. Does this sound good or is there a better process for this?

    Read the article

  • web.xml - Java Servlet Filters and WebSphere - URL Pattern issues

    - by Ed
    Hi, So we are running a web application that has been tested on Tomcat, Glassfish, WebLogic and WebSphere. All run correctly except WebSphere. The issue is that filters are not processed for files under a certain directory. For example I have a filter that checks the user's lanuage from browser cookies and another that get the user's username, in the web.xml there are configured like so: <!-- ****************************** --> <!-- * Security context filtering * --> <!-- ****************************** --> <filter> <filter-name>SetSecurityContextFilter</filter-name> <filter-class> com.test.security.SecurityContextServletFilter </filter-class> </filter> <!-- ****************************** --> <!-- ** Locale context filtering ** --> <!-- ****************************** --> <filter> <filter-name>SetLocaleFilter</filter-name> <filter-class> com.test.locale.LocaleServletFilter </filter-class> </filter> <filter-mapping> <filter-name>SetSecurityContextFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>SetLocaleFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> Both filters set a static threadlocal variable which can be accessed from a static getter, but when the same file 'test.jsp' invokes the getters, under 'contextroot/js' they return the default values (as if unset) while under 'contextroot/pages' they are correct. Any ideas? Thanks in advance.

    Read the article

  • Factory Method Pattern clarification

    - by nettguy
    My understanding of Factory Method Pattern is (Correct me if i am wrong) Factory Method Pattern "Factory Method allow the client to delegates the product creation (Instance Creation) to the subclass". There are two situation in which we can go for creating Factory Method pattern. (i) When the client is restricted to the product (Instance) creation. (ii) There are multiple products available.But a decision to be made which product instance need to be returned. If you want to create Abstract Method pattern You need to have abstract product Concrete Product Factory Method to return the appropriate product. Example : public enum ORMChoice { L2SQL, EFM, LS, Sonic } //Abstract Product public interface IProduct { void ProductTaken(); } //Concrete Product public class LinqtoSql : IProduct { public void ProductTaken() { Console.WriteLine("OR Mapping Taken:LinqtoSql"); } } //concrete product public class Subsonic : IProduct { public void ProductTaken() { Console.WriteLine("OR Mapping Taken:Subsonic"); } } //concrete product public class EntityFramework : IProduct { public void ProductTaken() { Console.WriteLine("OR Mapping Taken:EntityFramework"); } } //concrete product public class LightSpeed : IProduct { public void ProductTaken() { Console.WriteLine("OR Mapping Taken :LightSpeed"); } } public class Creator { //Factory Method public IProduct ReturnORTool(ORMChoice choice) { switch (choice) { case ORMChoice.EFM:return new EntityFramework(); break; case ORMChoice.L2SQL:return new LinqtoSql(); break; case ORMChoice.LS:return new LightSpeed(); break; case ORMChoice.Sonic:return new Subsonic(); break; default: return null; } } } **Client** Button_Click() { Creator c = new Creator(); IProduct p = c.ReturnORTool(ORMChoice.L2SQL); p.ProductTaken(); } Is my understanding of Factory Method is correct?

    Read the article

  • Extract a pattern from the output of curl

    - by allentown
    I would like to use curl, on the command line, to grab a url, pipe it to a pattern, and return a list of urls that match that pattern. I am running into problems with greedy aspects of the pattern, and can not seem to get past it. Any help on this would be apprecaited. curl http://www.reddit.com/r/pics/ | grep -ioE "http://imgur\.com/.+(jpg|jpeg|gif|png)" So, grab the data from the url, which returns a mess of html, which may need some linebreaks somehow replaced in, onless the regex can return more than one pattern in a single line. The patter is pretty simple, any string that matches... starts with http://imgur.com/ has A-Z a-z 0-9 (maybe some others) and is so far, 5 chars long, 8 should cover it forever if I wanted to limit that aspect of the patter, which I don't ends in a .grraphic_file_format_extention (jpg, jpeg, gif, png) Thats about it, at that url, with default settings, I should generally get back a good set of images. I would not be objectionable to using the RSS feel url for the same page, it may be easier to parse actually. Thanks everyone!

    Read the article

  • .net design pattern question

    - by user359562
    Hi. I am trying to understand design pattern problems. I am trying to modify the code like this in winforms and trying to see if any design pattern suits my requirement. Please suggest which is the best design pattern in this scenario. This is very basic code containing 2 tab pages which might have different controls can be added dynamically and read out different files on click of particular tab. To elaborate more... I have written this code to learn and understand design pattern. This is just a scenario where user click on a particular tab which will show dynamic controls generated. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedTab.Name.Equals("tabPage1")) { GeneratedynamicControlsForTab1(); } else if (tabControl1.SelectedTab.Name.Equals("tabPage2")) { GeneratedynamicControlsForTab2(); } } private void GeneratedynamicControlsForTab1() { Label label1 = new Label(); label1.Text = "Label1"; tabPage1.Controls.Add(label1); ReadCSVFile(); } private void GeneratedynamicControlsForTab2() { tabPage1.Controls.Clear(); Label label2 = new Label(); label2.Text = "Label2"; tabPage2.Controls.Add(label2); ReadTextFile(); } private void ReadCSVFile() { } private void ReadTextFile() { } }

    Read the article

  • NotApplicable marker with display pattern

    - by Jeff Barger
    Ok, so I'm pretty new to Cocoa, especially Bindings, but here's what I'm trying to do. I've got a Core Data model consisting of two entities: Category and Item. Category has a to-many relationship to Item called children, and Item has a relationship to Category called parent. Item has two attributes that Category does not have: quantity and desiredQuantity. What I'd like to do is display the tree in an NSOutlineView with two columns. One column is bound to the name of either the Category or the Item. I want to the second column to display something along the lines of 2 of 5 for the Item rows and nothing at all for the Category rows. When I use a display pattern, the Category rows end up showing of I noticed that if I don't use a display pattern for the second column, and instead just bind its Value to either the quantity or the desiredQuantity, the Category rows show nothing; its only if I try to use the display pattern. How can I make it display nothing for the Category rows and still use the display pattern? Or can I? Edit: I guess I didn't explain what the NotApplicable marker has to do with anything - Category does have properties for quantity and desiredQuantity, but they just return NSNotApplicableMarker.

    Read the article

  • Writing a factory for classes that have required arguments

    - by Kyle Adams
    I understand the concept of factory pattern such that you give it something it spits out something of the same template back so if I gave a factory class apple, I expect to get many apples back with out having to instantiate a new apple ever time. what if that apple has a required argument of seed, or multiple required arguments of seed, step and leaf? how do you use factory pattern here? that is how do I use factory pattern to instantiate this: $apple = new Apple($seed, $stem, $leaf);

    Read the article

  • Efficient mass string search problem.

    - by Monomer
    The Problem: A large static list of strings is provided. A pattern string comprised of data and wildcard elements (* and ?). The idea is to return all the strings that match the pattern - simple enough. Current Solution: I'm currently using a linear approach of scanning the large list and globbing each entry against the pattern. My Question: Are there any suitable data structures that I can store the large list into such that the search's complexity is less than O(n)? Perhaps something akin to a suffix-trie? I've also considered using bi- and tri-grams in a hashtable, but the logic required in evaluating a match based on a merge of the list of words returned and the pattern is a nightmare, and I'm not convinced its the correct approach.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >