how can i fix this program, the problem is when it print out the coordinate it give me a 7 for the start and finish, i would appreciated you help, thanks
start = (len(data))
finish = (len(data))
pos= []
for i in range(len(pos)):
for j in range(len(pos[i])):
if pos[i][j] == "S":
start=(i,j)
elif pos[i][j] == "F":
finish=(i,j)
print "S found in",start,
print "\nF found in",finish,"\n"
Lets say I have the following:
<table> <!-- I want a reference to this table -->
<tr>
<td>
<table>
<tr><td><span class="theSpanClass"></span></td></tr>
</table>
</td>
</tr>
</table>
Using jQuery, I'd like to be able to reference the outer-most table
Thanks
i've got a
"CHANNEL(SYSTEM.DEF.SVRCONN) CHLTYPE(SVRCONN)"
"id=3"
what i want to do is to retrieve the id after i do a search on the file and found the first line.
open (CHECKFILE8, "$file");
while (<CHECKFILE8>) #while loop to loop through each line in the file
{
chomp; #take out each line by line
$datavalue = $_; #store into var , $datavalue.
$datavalue =~ s/^\s+//; #Remove multiple spaces and change to 1 space from the front
$datavalue =~ s/\s+$//; #Remove multiple spaces and change to 1 space from the back
$datavalue =~ s/[ \t]+/ /g; #remove multiple "tabs" and replace with 1 space
if($datavalue eq "CHANNEL(SYSTEM.DEF.SVRCONN) CHLTYPE(SVRCONN)")
{
// HOW TO READ THE NEXT LINE?
}
}
}
close(CHECKFILE8);
}
Thanks
The following test fails:
(ns clojure_refactoring.rename-fn-test
(:use clojure.test))
(deftest test-fn-location
(in-ns 'refactoring-test-fn-rename)
(clojure.core/refer-clojure)
(defn a [b] (inc b))
(in-ns 'clojure_refactoring.rename-fn-test)
(is (not= (find-var 'refactoring-test-fn-rename/a)
nil))
(remove-ns 'refactoring-test-fn-rename))
That is, find-var (of a var I've just created, in a namespace I've just create) returns nil. This behaviour doesn't happen at the repl, where typing out the steps of the test works just fine.
Am I doing something wrong, or is this just something that doesn't work in clojure right now?
i need to find empty directories for given list of directories
some directories have directories inside it
if inside directories also empty
i can say main directory is empty otherwise it's not empty
how can i test this
for example
A>A1(file1),A2 this is not empty beacuse of file1
B>B1(no file) this is empty
C>C1,C2 this is empty
thanks
Hi,
The connection string in my app.config for my C# project looks like
Data Source=.\SQLEXPRESS;AttachDbFilename='|DataDirectory|\EIC.mdf';Integrated Security=True;User Instance=True"
I am writing unit tests for the project and have the set the test run configuration to copy the EIC.mdf, but I do am not able to reference the Deployed copy of EIC.mdf to be referenced by the app.config I created for the test project. If I set it to
Data Source=.\SQLEXPRESS;AttachDbFilename='EIC.mdf';Integrated Security=True;User Instance=True"
It still does not find the mdf file.
I want to read a bunch of text files, by loading them as resources using the context classloader.
URL url = Thread.currentThread()
.getContextClassloader()
.getResource("folder/foo.txt");
Is there some way to get a list of resources whose names match a given pattern? For eg:
URL[] matchingUrls = someLibrary.getMatchingResources("folder/*.txt");
Libraries like Spring can scan the classpath to find classes with a given annotation, so I am wondering if there something similar to load a bunch of resources.
I am working on a display screen for our office, and I can't seem to think of a good way to find the largest numerical value in a set of data in a two dimensional array. I've looked at using max() and also asort() but they don't seem to cope with a two dimensional array.
I'm returning my data through our mysql class, so the rows are returned in a two dimensional array.
Array(
[0] => Array(
[am] => 12,
[sales] => 981),
[1] => Array(
[am] => 43,
[sales] => 1012),
[2] => Array(
[am] => 17,
[sales] => 876)
)
I need to output a class when foreaching the data in my table for the AM with the highest sales value. Short of comparing them all in if statements. I have tried to get max() on the array, but it returns an array, as it's look within the dimension. When pointing it at a specific dimension it returns the key not the value.
I figured that I could asort() the array and pop the top value off, store it in a variable and then compare against that in my foreach() loop, but that seems to have trouble sorting across two dimensions.
Lastly, I figured that I could foreach() the values, comparing them against the previous one each time, untill I found the largest. This approach however means storing every value, luckily only three, but then comparing against them all again.
Surely there must be a simpler way to achieve this, short of converting it into a single dimension array, then doing an asort() on that?
Hi folks, I have a function that is being called more than a thousand times, slowing everything down. However, it is a low level function, and do not know which of my high level function is lopping and making these calls. How can i find out?
Hey guys,
i wonder how i can solve the following problem.
i have a horizontal scrollbar with floating divs side by side (.picture_holder). I wonder if i can find() this elements and animate a scroll event to the startpoint of every image. If i reach the last div i it to scroll to the first.
#
$('.next').click(function(){
#
$('html, body').animate({scrollTo:Position von .picture_holder2}, 'slow');
#
});
?? any ideas how i could solve this?
I have a game that one player X wants to pass a ball to player Y, but he can be playing with more than one player and the others players can pass the ball to Y.
I want to know how many different paths can the ball take from X to Y?
for example if he is playing with 3 players there are 5 different paths, 4 players 16 paths, if he is playing with 20 players there are 330665665962404000 paths, and 40 players 55447192200369381342665835466328897344361743780 that the ball can take.
the number max. of players that he can play with is 500.
I was thinking in using Catalan Numbers? do you think is a correct approach to solve this?
Can you give me some tips.
I sent someone a photo of me and they replied that this particular photo was all over the web. How do I find out where this photo is and is there any way that I can see if there are other photos of myself that someoe has shared without my knowledge? I am very worried about this and want to find out where these pictures are please help me!
i am using asp.net mvc for my project. i am using partial views for that i used ajax jaquery every thing is working fine but i am not getting image for loading when i upload an image. image get displyed at local host it has problem when i upload the project.
i have given image as:
$jq("#ajaxThrobber").html('<img src="/Images/ajax-loader.gif"> Loading.....');
please advice me thank you.
Just something I'd like to play with, I would like to create a "virtual" file/directory in the File System of Linux or Mac OS X (Not sure if I can share the same code - does POSIX help?), for example /foo and then perform custom code when something is read or written to it.
Similar how /dev/null allows for stuff like
echo "Hello!" > /dev/null
I don't care if it's in /dev, /proc or anywhere else, as said it's mainly something to play with...
What is the XPath to find only ONE node (whichever) having a certain attribute (actually I'm interested in the attribute, not the node). For example, in my XML, I have several tags having a lang attribute. I know all of them must have the same value. I just want to get any of them.
Right now, I do this : //*[1][@lang]/@lang, but it seems not to work properly, for an unknown reason.
My tries have led me to things ranging from concatenation of all the @lang values ('en en en en...') to nothing, with sometimes inbetween what I want but not on all XML.
EDIT :
Actually //@lang[1] can not work, because the function position() is called before the test on a lang attribute presence. So it always takes the very first element found in the XML. It worked best at the time because many many times, the lang attribute was on root element.
Hi
I have a list of points as shown below
points=[ [x0,y0,v0], [x1,y1,v1], [x2,y2,v2].......... [xn,yn,vn]]
Some of the points have duplicate x,y values. What I want to do is to extract the unique maximum value x,y points
For example, if I have points [1,2,5] [1,1,3] [1,2,7] [1,7,3]
I would like to obtain the list [1,1,3] [1,2,7] [1,7,3]
How can I do this in python
Thanks
I naively imagined that I could build a suffix trie where I keep a visit-count for each node, and then the deepest nodes with counts greater than one are the result set I'm looking for.
I have a really really long string (hundreds of megabytes). I have about 1 GB of RAM.
This is why building a suffix trie with counting data is too inefficient space-wise to work for me. To quote Wikipedia's Suffix tree:
storing a string's suffix tree typically requires significantly more space than storing the string itself.
The large amount of information in each edge and node makes the suffix tree very expensive, consuming about ten to twenty times the memory size of the source text in good implementations. The suffix array reduces this requirement to a factor of four, and researchers have continued to find smaller indexing structures.
And that was wikipedia's comments on the tree, not trie.
How can I find long repeated sequences in such a large amount of data, and in a reasonable amount of time (e.g. less than an hour on a modern desktop machine)?
(Some wikipedia links to avoid people posting them as the 'answer': Algorithms on strings and especially Longest repeated substring problem ;-) )
for example at first you have to find hwnd of skype
hwnd = win32gui.FindWindow(None, 'skype')
and than all his child windows and their titles
child = ???
any idea?
Let say i have some words AB, AAB, AA.
AB is not a prefix to AAB but AA is a prefix to AAB because if i just add B at the end of AA it will become AAB, which is not possible with AB.
So, is there any function in c++ (STL) so that i can determine of two words if one is prefix to the another ?
Thanks.
i am using mysql database
i have a table called sales
its primary key is sales_id
-------------------------------------
sales_id | invoice_id |
-------------------------------------
1 | 147
2 | 148
3 | 150
for sales-id 3 the invoice is supposed to be 149. i want to know which numbers are missing from invoice_id (i start invoice_id is 147 and end invoice_id is 4497). The invoice_id had no relation with sales_id
is it possible to know which numbers are missing from invoice_id, using some queries??
In which class the length variable is defined in java(one used for printing array length)?
Will I be able to see it defined say in Object class?
EDIT : Why was this field so designed(any thing related with security or memory efficiency)?
Are there any tools available that can scan multiple .php files and report back duplicated lines/chunks of code?
It doesn't have to be really smart but basically give me a starting point for manual scans to improve the codebase of some of my apps.
How do I get Eclipse to open files from the last directory I opened from, after re-starting Eclipse? It always reverts to my Windows profile directory.