Hi,
Is it possible to configure Solr so that the document similarity score would be in the range for example from 0 (no match) to 1 (complete document and query match).
Thanks!
Hello,
I have this string that may contain some urls that I need to grab. For instance, if the user does:
www.youtube ...
or
www.vimeo ...
or
http://www.youtube ...
or
HttP://WwW.viMeo
I need to grab it (until he finds a space perhaps). and store it on a already created array.
The need is to separate the vimeo links from the youtube ones and place each of those on the appropriate video object.
I'm not sure if this is possible, I mean, if the URL coming from the browser could be used to be placed on a predefined video object. If it is, then this is the way to go (so I believe).
If all this is feasible, can I have your help in order to build such a rule?
Thanks in advance
Hi,
I need to find out how many even values are contained in a binary tree.
this is my code.
private int countEven(BSTNode root){
if ((root == null)|| (root.value%2==1))
return 0;
return 1+ countEven(root.left) + countEven(root.right);
}
this i just coded as i do not have a way to test this out. I'm not able to test it out at the moment but need an answer so badly.
any help is deeply appreciated.
I am implementing a snippet-based content management system into my current project. Snippets can be associated with a page either by exact match of the full url falling back to a wildcard match on a partial url or finally a default snippet.
To implement this I have a created table of page associations with a wildcard flag, the system first checks the current url against the non-wildcard associations and if it doesn't find a match it checks against the partial url's where the wildcard flag is set.
In order to achieve this I am getting all the partial url's from the database and putting them into an array then walking the array to check for a match against the current url:
protected function _check_wildcard($url = NULL)
{
if($url)
{
$q = $this->db->where('wildcard' ,'Y')
->from('content')
->get();
$wildcards = $q->result_array();
foreach($wildcards AS $wildcard)
{
if(strpos($url,$wildcard['url']) > 0)
{
return $wildcard['snipppet_id'];
}
}
}
else
{
return NULL;
}
}
Can anyone suggest a better way to do this - preferably one that doesn't involve having to constantly download the full list of all the wildcards each time I load a page as I am afraid that this will have a negative effect on the scalability of the system down the line?
Hello,
I would like to check if there is a preferred design pattern for implementing search functionality with multiple optional parameters against database table where the access to the database should be only via stored procedures.
The targeted platform is .Net with SQL 2005, 2008 backend, but I think this is pretty generic problem.
For example, we have customer table and we want to provide search functionality to the UI for different parameters, like customer Type, customer State, customer Zip, etc., and all of them are optional and can be selected in any combinations. In other words, the user can search by customerType only or by customerType, customerZIp or any other possible combinations.
There are several available design approaches, but all of them have some disadvantages and I would like to ask if there is a preferred design among them or if there is another approach.
Generate sql where clause sql statement dynamically in the business tier, based on the search request from the UI, and pass it to a stored procedure as parameter. Something like @Where = ‘where CustomerZip = 111111’
Inside the stored procedure generate dynamic sql statement and execute it with sp_executesql.
Disadvantage: dynamic sql, sql injection
Implement a stored procedure with multiple input parameters, representing the search fields from the UI, and use the following construction for selecting the records only for the requested fields in the where statement.
WHERE
(CustomerType = @CustomerType OR @CustomerType is null )
AND (CustomerZip = @CustomerZip OR @CustomerZip is null )
AND …………………………………………
Disadvantage: possible performance issue for the sql.
3.Implement separate stored procedure for each search parameter combinations.
Disadvantage: The number of stored procedures will increase rapidly with the increase of the search parameters, repeated code.
We have a images folder which has about a million images in it.
We need to write a program which would fetch the image based upon a keyword that is entered by the user.
We need to match the file names while searching to find the right image.
Looking for any suggestions.
Thanks
N
public static IQueryable<Institution> WithFunds(this IQueryable<Institution> query, IEnumerable<Fund> allowedFunds)
{
return query.
}
I want to get the query to return all Institutions having any of the Fund given in 'allowedFunds' list in Institution.Funds. Please help.
My class hierarchy goes like this.
public partial class Institution
{
public int Id { get; set; }
public virtual ICollection<Fund> Funds { get; set; }
}
public partial class Fund
{
public int Id { get; set; }
public virtual Institution Institution { get; set; }
}
I want to implement a code that loops inside an array that its size is set by the user that means that the size isn't constant.
for example:
A=[1,2,3,4,5]
then I want the output to be like this:
[1],[2],[3],[4],[5]
[1,2],[1,3],[1,4],[1,5]
[2,3],[2,4],[2,5]
[3,4],[3,5]
[4,5]
[1,2,3],[1,2,4],[1,2,5]
[1,3,4],[1,3,5]
and so on
[1,2,3,4],[1,2,3,5]
[2,3,4,5]
[1,2,3,4,5]
Can you help me implement this code?
I am implementing a FakeDataSet class by implementing IDbSet interface. As part of implementing this interface, I have to implement Find method. All my entity classes has an Guid type Id column. I am trying to implement Find method for this FakeDbSet class but having hard time to write it in a generic way. Below is my attempts for writing this method but since it does not know about Id been Guid type, I am getting compilation error on m.Id call. Any ideas on how this could be accomplished?
public class FakeDataSet<T> : IDbSet<T> where T: class, new()
{
// Other methods for implementing IDbSet interface
public T Find(params object[] keyValues)
{
var keyValue = (Guid)keyValues.FirstOrDefault();
return this.SingleOrDefault(m => m.Id == keyValue); // How can I write this
}
}
I have a largish array of string that I want to use as a lookup.
I a using in_array(), but I suspect its doing a simple loop through - does anyone know whether the in_array() algo uses a bsearch algo?
Hi,
i have two models:
class Category
has many :jobs
end
class Job
belongs_to :category
end
So for sure i'm able to do
c = Category.first
c.jobs
My question is: how can i find just categories that has at least one job?
On pageload i want to show all fields in repeater control and on typing licenseid in the textbox i want to show that specific licenceid details
IF I place below code in the datasource of repeater,First one is not working.In the second one i placed a textbox and put its value to 0 on pageload.it is working.But i want both to be working.
SELECT * FROM License WHERE (0 = @selectAll OR LicenseID=@LicenseID) -> Not working
SELECT * FROM License WHERE (0 = @selectAll ) ->working
SELECT * FROM License WHERE (LicenseID=@LicenseID)-> working
Thanks in advance for the help
ASP.NET is changing id, name values according to control's parent control name. That's why i am searching id with JQUERY as below.
// $ is looking to the end of "id" attribute of input elements
$("input[id$='cbAddToNews']")
Only one element is returning by jQuery. But when i want to change the attribute, I'm using this syntax:
$($("input[id$='cbAddToNews']")[0]).show()
Is there any way to do this without wrapping it with $(...[0]) ?
The internet today is a very competitive place for internet marketers. Google and many other search engines need to be able to trust your website, and that is where page rank comes into play.
If you want to get more visitors to your site and make more money from the search engines you are going to have to make sure you can get rankings right away in your niche market. In this article I want to show you the fastest way to make this happen so you can get started right away.
When it comes to getting more traffic to your site from the search engines you have to realize that it is not just about getting more rankings! You have to be able to keep the ones that you get so you can increase them and get even more visitors to your site. In this article I want to show you exactly how you can get and keep top rankings in your niche market.
When it comes to getting more traffic to your site from the search engines you have to make sure you get more one way backlinks to your site from other related sites in your niche market. In this article I want to show you exactly how you can do this on total autopilot the easy way.
One of the biggest problems that a lot of people have is the fact that they can't get rankings for their new site that they have just created. In this article I want to show you exactly how you can easily get your new site ranked in the search engines so you can start getting more visitors to your site & make more money in the process.
If you are trying to get traffic to your site from the search engines you have to realize that you can make a lot of money from a small amount of rankings if you know how to do it the right way. In this article I want to show you exactly how you can do this so you can start making more money from your SEO efforts.
One of the biggest problems that a lot of people have is the fact that they rank their site for keywords in their market and then realize that there is no traffic for those search terms! If you do this you will end up wasting a lot of time and money. In this article I want to show you exactly how you can test your keywords to see if there actually is traffic.
If you know what you are doing you can literally get traffic to your site from the search engines in less than 30 days. In this article I want to show you exactly how to make this happen and how to determine if it can happen in your niche market.