I was able to extract href value of anchors in an html string. Now, what I want to achieve is extract the href value and replace this value with a new GUID. I need to return both the replaced html string and list of extracted href value and it's corresponding GUID.
Thanks in advance.
My existing code is like:
Dim sPattern As String = "<a[^>]*href\s*=\s*((\""(?<URL>[^\""]*)\"")|(\'(?<URL>[^\']*)\')|(?<URL>[^\s]* ))"
Dim matches As MatchCollection = Regex.Matches(html, sPattern, RegexOptions.IgnoreCase Or RegexOptions.IgnorePatternWhitespace)
If Not IsNothing(matches) AndAlso matches.Count > 0 Then
Dim urls As List(Of String) = New List(Of String)
For Each m As Match In matches
urls.Add(m.Groups("URL").Value)
Next
End If
Sample HTML string:
<html><body><a title="http://www.google.com" href="http://www.google.com">http://www.google.com</a><br /><a href="http://www.yahoo.com">http://www.yahoo.com</a><br /><a title="http://www.apple.com" href="http://www.apple.com">Apple</a></body></html>
Hi,
I have an interface named IHarvester.
There are 3 implementations of that interface, each under their own namespace:
Google
Yahoo
Bing
A HarvesterManager uses the given harvester. It knows the interface and all 3 implementations.
I want some way of letting the class user say in which harvester it wants to use. And in the code select that implementation, without a switch-case implementation.
Can reflection save my day?
Here is the code bits:
// repeat for each harvester
namespace Harvester.Google
{
public abstract class Fetcher : BaseHarvester, IInfoHarvester {...}
}
public enum HarvestingSource
{
Google,
Yahoo,
Bing,
}
class HarvesterManager {
public HarvestingSource PreferedSource {get;set;}
public HarvestSomthing()
{
switch (PreferedSource) .... // awful...
}
}
Thanks.
I will give my 2 cents of why I want to change this. There several people writing harvesters, I want them to focus only on building more harvesters, without ever needing to update the enum, or at worst, update only the enum.
Hi,
I have an interface named IHarvester.
There are 3 implementations of that interface, each under their own namespace:
Google
Yahoo
Bing
A HarvesterManager uses the given harvester. It knows the interface and all 3 implementations.
I want some way of letting the class user say in which harvester it wants to use. And in the code select that implementation, without a switch-case implementation.
Can reflection save my day?
Here is the code bits:
// repeat for each harvester
namespace Harvester.Google
{
public abstract class Fetcher : BaseHarvester, IInfoHarvester {...}
}
public enum HarvestingSource
{
Google,
Yahoo,
Bing,
}
class HarvesterManager {
public HarvestingSource PreferedSource {get;set;}
public HarvestSomthing()
{
switch (PreferedSource) .... // awful...
}
}
Thanks.
I am having some trouble getting the right usage of Machinist and Shoulda in my testing.
Here is my test:
context "on POST method rating" do
p = Product.make
u = nil
setup do
u = login_as
post :vote, :rating => 3, :id => p
end
should "set rating for product to 3" do
assert_equal p.get_user_vote(u), 3
end
And here's my blueprints:
Sham.login { Faker::Internet.user_name }
Sham.name { Faker::Lorem.words}
Sham.email { Faker::Internet.email}
Sham.body { Faker::Lorem.paragraphs(2)}
User.blueprint do
login
password "testpass"
password_confirmation { password }
email
end
Product.blueprint do
name {Sham.name}
user {User.make}
end
And my authentication test helper:
def login_as(u = nil)
u ||= User.make()
@controller.stubs(:current_user).returns(u)
u
end
The error I get is:
/home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/validations.rb:1090:in `save_without_dirty!': Validation failed: Login has already been taken, Email has already been taken (ActiveRecord::RecordInvalid)
from /home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/dirty.rb:87:in `save_without_transactions!'
from /home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
from /home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
from /home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
from /home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
from /home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
from /home/jason/moderndarwin/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
from /usr/lib/ruby/gems/1.8/gems/machinist-1.0.6/lib/machinist/active_record.rb:55:in `make'
from /home/jason/moderndarwin/test/blueprints.rb:37
from /usr/lib/ruby/gems/1.8/gems/machinist-1.0.6/lib/machinist.rb:77:in `generate_attribute_value'
from /usr/lib/ruby/gems/1.8/gems/machinist-1.0.6/lib/machinist.rb:46:in `method_missing'
from /home/jason/moderndarwin/test/blueprints.rb:37
from /usr/lib/ruby/gems/1.8/gems/machinist-1.0.6/lib/machinist.rb:20:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/machinist-1.0.6/lib/machinist.rb:20:in `run'
from /usr/lib/ruby/gems/1.8/gems/machinist-1.0.6/lib/machinist/active_record.rb:53:in `make'
from ./test/functional/products_controller_test.rb:25:in `__bind_1269805681_945912'
from /home/jason/moderndarwin/vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:293:in `call'
from /home/jason/moderndarwin/vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:293:in `merge_block'
from /home/jason/moderndarwin/vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:288:in `initialize'
from /home/jason/moderndarwin/vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:169:in `new'
from /home/jason/moderndarwin/vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:169:in `context'
from ./test/functional/products_controller_test.rb:24
I can't figure out what it is I'm doing wrong... I have tested the login_as with my auth (Authlogic) in my user_controller testing.
Any pointers in the right direction would be much appreciated!
Is there an active/solid cross browser css framework on par with blueprint/yui/960 that supports percent based liquid layouts?
I've seen Emtastic, but it doesn't look like it's been active for about a year.
I'm starting a side project and want to build it with html5/css3. Is not a concern backward compatibility.
I wonder if exist a framework similar to BluePrint/960 grid system. Mainly, I'm looking for the grid system & typografy.
The best (and only I found that play nice with html5 new tags) is http://lessframework.com/, is a good start but wonder if exist something better?
a lot of people are contributing to open source libraries/frameworks.
i wonder how these people learn the structure so that they can contribute?
lets take doctrine and symfony as an example.
is there a blueprint over these frameworks to give the developers an insight of the structure? or do they just download it and study the code?
how does it work?
please you contributors, share your learning strategies!
thanks
Ok, a friend of mine go back and forth on what "interface" means in programming.
What is the best description of an "interface".
To me an interface is a blueprint of a class, is this the best definition?
You need to make sure your marketing methods rank high in the Google and Yahoo search engines; to do this you're going to need to understand search engine optimization. Here are 3 SEO tips.
In this Issue: Alan Mendelevich, Siyamand Ayubi, Rudi Grobler(-2-), Josh Smith, VinitYadav, and Dave Campbell.
Shoutouts:
Jordan Knight has a demo up of a project he did for DigiGirlz: DigiGirlz, Deep Zoom and Azure, hopefully we'll get source later :)
Jeremy Likness has a must-read post on his Ten Reasons to use the Managed Extensibility Framework
I put this on another post earlier, but if you want some desktop bling for WP7, Ozymandias has some: I Love Windows Phone Wallpaper
If you're not going to be in 'Vegas next week, Tim Heuer reminds us there's an alternative: Watch the Silverlight 4 Launch event and LIVE QA with ScottGu and others
From SilverlightCream.com:
Ghost Lines in Silverlight
Alan Mendelevich reports an issue when drawing lines with odd coordinate values. He originated it in Silverlight 3, but it is there in SL4RC as well... check it out and leave him a comment.
A Framework to Animate WPF and Silverlight Pages Similar to the PowerPoint Slides
Siyamand Ayubi has an interesting post up on animating WPF or Silverlight pages to make them progress in the manner of a PPT slideshow.
And it can also make phone calls…
Rudi Grobler has a list of 'tasks' you can do with WP7 such as PhoneCallTask or EmailComposeTask ... looks like this should be plasticized :)
Using the GPS, Accelerometer & Vibration Controller
Rudi Grobler is also investigating how to use the GPS, Accelerometer, and Vibration in WP7 with a bunch of external links to back it up.
Assembly-level initialization at design time
Josh Smith has a solution to the problem of initializing design-time data in Blend (did you know that was an issue?) ... the solution is great and so is the running commentary between Josh and Karl Shifflett in the comments!
ySurf : A Yahoo Messenger Clone built in Silverlight
VinitYadav built a Yahoo Messenger app in Silverlight and has detailed out all the ugly bits for us on the post, plus made everything available.
Your First Silverlight Application
Dave Campbell's first post at DZone cracking open a beginner's series on Silverlight. If you're expecting something heavy-duty, skip this. If you're wanting to learn Silverlight and haven't jumped in yet, give it a try.
Stay in the 'Light!
Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream
Join me @ SilverlightCream | Phoenix Silverlight User Group
Technorati Tags: Silverlight Silverlight 3 Silverlight 4 Windows Phone MIX10
Learning Search Engine Optimization techniques (SEO) along with keyword research is key to marketing yourself, your business, your website or your blog on the internet. Ardan Michael Blum is a Yahoo SEO expert out of Switzerland. He has over 9 years experience as a SEO expert and guarantees his clients first page rankings in the search engines. For a business, first page rankings can mean success! But, outsourcing to someone like Ardan Michael Blum is going to be costly.
I uninstalled "Unity" and use "Gnome Shell" instead, but the new "online accounts" was still in the "system settings" menu. How can I completely remove it?
I tried the command below but it doesn't work:
sudo apt-get -y remove unity-lens-shopping account-plugin-aim account-plugin-facebook account-plugin-flickr account-plugin-google account-plugin-icons account-plugin-identica account-plugin-jabber account-plugin-salut account-plugin-twitter account-plugin-windows-live account-plugin-yahoo gnome-online-accounts
In yesterday’s blog post we learned the importance of the HIVE in Big Data Story. In this article we will understand what is PIG and PIG Latin in Big Data Story.
Yahoo started working on Pig for their application deployment on Hadoop. The goal of Yahoo to manage their unstructured data.
What is Pig and What is Pig Latin?
Pig is a high level platform for creating MapReduce programs used with Hadoop and the language we use for this platform is called PIG Latin. The pig was designed to make Hadoop more user-friendly and approachable by power-users and nondevelopers. PIG is an interactive execution environment supporting Pig Latin language. The language Pig Latin has supported loading and processing of input data with series of transforming to produce desired results. PIG has two different execution environments 1) Local Mode – In this case all the scripts run on a single machine. 2) Hadoop – In this case all the scripts run on Hadoop Cluster.
Pig Latin vs SQL
Pig essentially creates set of map and reduce jobs under the hoods. Due to same users does not have to now write, compile and build solution for Big Data. The pig is very similar to SQL in many ways. The Ping Latin language provide an abstraction layer over the data. It focuses on the data and not the structure under the hood. Pig Latin is a very powerful language and it can do various operations like loading and storing data, streaming data, filtering data as well various data operations related to strings. The major difference between SQL and Pig Latin is that PIG is procedural and SQL is declarative. In simpler words, Pig Latin is very similar to SQ Lexecution plan and that makes it much easier for programmers to build various processes. Whereas SQL handles trees naturally, Pig Latin follows directed acyclic graph (DAG). DAGs is used to model several different kinds of structures in mathematics and computer science.
DAG
Tomorrow
In tomorrow’s blog post we will discuss about very important components of the Big Data Ecosystem – Zookeeper.
Reference: Pinal Dave (http://blog.sqlauthority.com)
Filed under: Big Data, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL
Keyword analysis is a process by which you can discover what search phases are used at search engines by users for find information. Keywords are nothing but search words or phrases entered by users at search engines like Google, Yahoo and Bing. For article, blog and web content writers, keyword research is the most important part of the process.
Want your WEBPAGE to land in the 1st PAGES of Google and Yahoo search engines? Then, make use of this powerful META TAG in your webpage/s, and you will have the result you have been aching for ages.
hi im wondering how to put/ install chrome os n hard drive with dual boot with Ubuntu and windows 8.1 please i need help with this. i had follow some guides from here
https://sites.google.com/site/installationubuntu/chrome-os/make-your-own-chromium-os-notebook
and
http://unix.stackexchange.com/questions/29283/install-chromium-os-without-usb-disk
please contact me at Facebook aniel arias or my email [email protected] thank you
Online business people dreams are fulfilled when they succeed in search engine keyword optimization. It is always a pleasure when out of 79,000,000 advertisers competing for a certain keyword; you find your website or article appearing on the first page of Google. Apart from Google, the other places to concentrate on in order to generate organic traffic are MSN, Yahoo and Bing.
Nothing in the world of search engine marketing has the ability to give your website the staying power that is required to stay in the top search engine rankings in Google, Yahoo, Bing and other search engines. To begin with, your site must be something others would want to link too.
Whenever one has a new website that offers various services to users over the internet, it's usually a tormenting task to generate a lot of traffic to the site since it's new, and most people have no clue what it's about or even the slightest idea that it exists. When it comes to finding anything on the internet, the most commonly used search engines are either Yahoo or Google.
The secret to search engine optimization is proper use of common keywords. The first thing to consider is the title of your blog or website. Google And Yahoo put more emphasis on the initial words in your blog heading. Therefore, let your website main topic be rich in keywords at...
It is every internet marketer's dream to dominate the first few pages of various search engines, such as Google, Yahoo and Bing, with their sites. Attempting to garner and generate a lot of traffic to your sites can be very difficult, even in relatively "easy" niches.
This question already has an answer here:
When, if ever, and how, would Google, Yahoo, Bing, etc will add the new gTLD to their search results?
3 answers
With a whole slew of new TLDs becoming available how will they affect SEO?
While I realize some of these domains are fairly general, such as .ninja others are very specific such as .dental and this leaves me curious as to how this new TLDs will ultimately affect SEO?
We have this site which is named Vialogues (Video+Discussion web based application).
https://vialogues.com
It has been around for sometime on the internet and we have also submitted sitemap.xml to search engines. However when we search on google or bing or yahoo using the keyword Vialogues, We are given results of the keyword dialogues and this message “showing results for dialogues, search instead for vialogues”.
I am wondering if it's possible to list the site without the search engine suggesting “showing results for dialogues, search instead for vialogues”?