Im writing a php script to compare the similarity of 2 strings. This works pretty good at the moment, but what I would like to do is match words when one is a synonym of the first.
Any thoughts?
I'm trying to use python to determine if one (small) image is within another (large) image.
Any suggestions before I take myself completely down the wrong path?
This is happening in python files.
For example, I want to do type "fC" in normal mode, and instead of finding the first "C" character, it is just doing code fold toggling.
I have a class Foo which has_many Bars. Foo has an attribute, some_id. I want to Retrieve all Bar instances where the Foo has some_id = N. In SQL this translates into something like:
select * from bar inner join foo on foo.id = bar.foo_id WHERE foo.some_id = N
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APP, namely django_evolution, saying it's an undefined module. This is despite the fact that I've added the path to django_evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path?
Starting from an Html input like this:
<p>
<a href="http://www.foo.com">this if foo</a>
<a href="http://www.bar.com">this if bar</a>
</p>
using BeautifulSoup, i would like to change this Html in:
<p>
<a href="http://www.foo.com">this if foo[1]</a>
<a href="http://www.bar.com">this if bar[2]</a>
</p>
saving parsed links in a dictionary with a result like this:
links_dict = {"1":"http://www.foo.com","2":"http://www.bar.com"}
Is it possible to do this using BeautifulSoup? Any valid alternative?
I am generating reports in HTML formats, and want to print them automatically using Qt (qt has a webkit based browser, and one can render its contents to a PDF file).
I want to position the elements of the report depending on the target page size.
For that i need to access the size of the paper (preferably in pixels).
Since i am using webkit, it has all the latest html5 and css3 features.
is there some api available to access printed page properties inside javascript. for example, would be nice to write:
window.print_paper.width or window.print_paper.height
Thank you in advance
I have a list of strings displayed by a Silverlight ItemsControl. The DataTemplate is a Border control with a TextBlock as its child. How can I access the border control corresponding to an item? For example, I might want to do this to change the background color.
I have series of files like this:
foo1.txt.gz
foo2.txt.gz
bar1.txt.gz
..etc..
and a tabular format file that describe those files:
foo1 - Explain foo1
foo2 - Explain foo2
bar1 - Explain bar1
..etc..
What I want to do is to have a website with a simple search bar and allow people to type
foo1 or just foo and finally return the gzipped file(s) and the related explanation of the file(s).
What's the best way to implement this and what kind of tools should I use.
Sorry I am totally new in this area.
Well since it seems relatively difficult to send the object of a WebControl over JSON using jquery.ajax() I've decided to send the name of the control as a string because I know how to do that. Then I promptly realized that, from a web service, I don't actually know how to search for a control by ID name. Since its a service I can't seem to get Control.FindControl() to work so does anyone have ideas or suggestions? All I'm trying to do is call a databind() on my radcombobox.
Thanks in advance!
For any of you that knows anything about asp.net/rad controls - I'm basically updating a database and want the radcombobox to be in sync with that database again after adding something, before I autoselect what was just added. Other than databind do i have to call anything to refresh that list?
Thanks again!
Hi guys, I recently confronted with a weird yet interesting question. The questions is as follows:
Need to write a program which can give the gender as output based on the name.
Example: INPUT -- John
Michael
Britney
OUTPUT-- male
male
female
So this is the output I expect. I tried a lot to solve, but I really was not able to crack it.
I will be really thankful to this site for giving me an opportunity to share this question.
Actually this is asked in a programming contest as a flyer problem, so I thought this can be programmed.
I am generating a table dynamically using Django.
The same table template is used to generate a variety of tables depending on the data supplied. In one scenario a particular column contains image tags.
Since my table is editable (using jquery) the image cell also becomes editable and removes my content.
I want some special behavior on double click of such cells like say upload an image. How do I accomplish this with a jquery?
My script for making the table editable is given below.
$(function() {
$("td").dblclick(function() {
var OriginalContent = $(this).text();
$(this).addClass("cellEditing");
$(this).html("<input type='text' value='" + OriginalContent + "' />");
$(this).children().first().focus();
$(this).children().first().keypress(function(e) {
if (e.which == 13) {
var newContent = $(this).val();
$(this).parent().text(newContent);
$(this).parent().removeClass("cellEditing");
}
});
$(this).children().first().blur(function() {
$(this).parent().text(OriginalContent);
$(this).parent().removeClass("cellEditing");
});
});
});
I need a model for finding all of the regular expressions that would match a particular string. Basically, I need an algorithm for doing what I do to generate a regex search string from some pattern.
My purpose for this to create a list of potential regular expressions from a selection of text and order that list from least specific (i.e. string of characters with abitrary length) to most specific (i.e. the string itself) to be used in text editor.
Suppose I have the following class.
public class gen<T> {
public gen(){
}
Class<T> class(){
//something that figures out what T is.
}
}
How can I implement the class() function without pass any additional information?
What I did is here, but I have to pass a object of T into the object gen.
public class gen<T> {
public gen(){
}
Class<T> class(T var){
return (Class<T>) var.getClass();
}
}
2 colors are mixed together. If i have the RGB for the resultant color and RGB for one of the colors mixed, then somehow i could calculate the 2nd color?
I will try to explain visually what i am trying to say. Here is a flickr link
http://www.flickr.com/photos/48150615@N08/4407414157
I know that the circle in the middle has an opacity of 20%
Is there any way to know the color value of the circle so that i can deduct that to get the same color value as the background color.
I'm drawing a 3D pie chart that is rendered with in 3D vectors, projected to 2D vectors and then drawn on a Graphics object. I want to calculate the most left and right point of the circle The method to create a vector, draw and project to a 2d vector are below. Anyone knows the answer?
public class Vector3d
{
public var x:Number;
public var y:Number;
public var z:Number;
//the angle that the 3D is viewed in tele or wide angle.
public static var viewDist:Number = 700;
function Vector3d(x:Number, y:Number, z:Number){
this.x = x;
this.y = y;
this.z = z;
}
public function project2DNew():Vector
{
var p:Number = getPerspective();
return new Vector(p * x, p * y);
}
public function getPerspective():Number{
return viewDist / (this.z + viewDist);
}
}
I have a program that crashes (attempting to read a bad memory address) while running the "release" version but does not report any problems while running the "debug" version in the visual studio debugger.
When the program crashes the OS asks if I'd like to open up the debugger, and if I say yes then I see an arrow pointing to where I am in a listing of some assembler which I am not skilled enough to read properly (I learned 6502 assembler 30 years ago). Is there any way for my to determine where in my sourcecode the offending memory read was located?
Given the following fragment of html:
<fieldset>
<legend>My Legend</legend>
<p>Some text</p>
Text to capture
</fieldset>
Is there an xpath expression that will return only the 'Text to capture' text node?
Trying /fieldset/text() yields three nodes, not just the one I need.
I need to count the similar elements in an array. For example, if i have an array,
array[0,0,0,1,2,3,3].The number of 0's are 3 , no. of 1's are 1 , no. of 2's are 1 , no. of 3's are 2 in this array . I am sorry if this message has been posted before. Help is appreciated. Thanks in advance.
I am using asp.net 3.5
I have a license class containing 10 properties and not marked as serializable. I have to log property changes to the database. License is an entity class,and it is not in my scope to modify it. So I cannot mark it as serializabel neither i can use IpropertyChanged Interface.
Now i cannot store it in viewstate as it is not serializable. I wanted to store it so that i can compare it with new values and see which value has changed.
How to proceed with this.
Hi,
I want to keep tabs on the number of concurrent users of my application. I therefore log a time_start and a time_stop. If I now want to query the database for the maximum number of logged on users and return the start date, how would I do that.
The table looks like this:
id | time_start | time_stop
----+---------------------+---------------------
1 | 2010-03-07 05:40:59 | 2010-03-07 05:41:33
2 | 2010-03-07 06:50:51 | 2010-03-07 10:50:51
3 | 2010-02-21 05:20:00 | 2010-03-07 12:23:44
4 | 2010-02-19 08:21:12 | 2010-03-07 12:37:28
5 | 2010-02-13 05:52:13 |
Where time_stop is empty the user is still logged on. In this case I would expect to see 2010-03-07 returned, since all users (5) were logged on at that moment. However if I would run the query with 'where time_start BETWEEN '2010-02-17' AND '2010-02-23' I would expect to see 2010-02-21 with a maximum of 2.
Is this possible direct in SQL (using postgres) or do I need to parse the results in PHP?
Thanks,
lleto
Hi, I am developing a simple Windows Application in C# and Visual Studio 2005.
I need a search result control - just like visual studio integrated by itself. After I double click each line to trigger the individual event. I tried multi-line textBox Control, but whole the box can only support one click event. thank you.