Using xwarppointer, one can easily write a shell script that moves the mouse around the screen in a sequence.
Challenge:
Write a program to accompany xwarppointer. When run, it simply sends a left-button click to the pointer.
Printable View
Using xwarppointer, one can easily write a shell script that moves the mouse around the screen in a sequence.
Challenge:
Write a program to accompany xwarppointer. When run, it simply sends a left-button click to the pointer.
Well, I won't do this, because I have a few other things going on at the moment, but it shouldn't be too hard to do. You should only need the Xtst libraries, and the <X11/Xtest.h> includes. Then you can open the display, and inject an X button-press, button-release event combination into the event list.
It's how I make sure numlock is on every time I start X -- I run a program that's linked against the Xtst library, which sends a key-press, key-release event pair pointing at the numlock key.
/me picks up jaw off the floor:DQuote:
Originally posted by bwkaz
Maybe, but I don't think there's any way I'll ever be able to decipher this one:
http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
:p
Take the sentence:
"She sells sea shells by the sea shore"
Reorder the words alphabetically, and do it in your favorite language.
;)
I found this thread again, thought it was lost..........
here is a challenge I did a few years ago while taking a C/C++ class and figured I'd put it out and see how many different ways it could be done (perl, VB, Bash script??, etc.).........have fun
Quote:
Find a six digit number that gives its digits reversed when multiplied by an integer between 2 and 9 inclusive.
this is about as easy as it gets......I guess :)Quote:
Originally posted by Sepero
Take the sentence:
"She sells sea shells by the sea shore"
Reorder the words alphabetically, and do it in your favorite language.
;)
Code:#!/usr/bin/perl
@array = ("she", "sells", "sea", "shells", "by", "the", "sea", "shore");
@array2 = sort (@array);
print ("@array2\n");
Just a comment, if I might. Being new to Linux and all that, I am offering a perspective consistent with the burning desire to learn anything!
This stuff is incredible! I notice that the thread originally started almost two years ago, and yet I've just now seen it, only because someone chanced to resurrect it, and back it came to the front.
My humble wish...that this concept rates its' own stable in the barn. A unique category. It's beautiful stuff. It's like having a window and a seat next to a bunch of ace coders, and being able to look over their shoulders and get a sense of what coding can be. It's freewheeling, and raucus, and just one heck of an education.
Please...give this concept real status!
Are there more than two of these? Just checking to see if i'm close...Quote:
Originally posted by janet loves bill
I found this thread again, thought it was lost..........
here is a challenge I did a few years ago while taking a C/C++ class and figured I'd put it out and see how many different ways it could be done (perl, VB, Bash script??, etc.).........have fun
Oh, and can't we make this sticky? I'm sure it's one of everyone's favorites in this forum. :)
Quote:
Originally posted by Sepero
Take the sentence:
"She sells sea shells by the sea shore"
Reorder the words alphabetically, and do it in your favorite language.
;)
How about:
echo 'She sells sea shells by the sea shore' | sed -e 's/[[:space:]]/\n/g' | sort
:)
or:
Bearing in mind that it's a case-sensitive sort....Code:Python 2.3.5 (#2, May 4 2005, 08:51:39)
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> mystring = "She sells seas shells on the sea shore"
>>> list = mystring.split(' ')
>>> list
['She', 'sells', 'seas', 'shells', 'on', 'the', 'sea', 'shore']
>>> list.sort()
>>> print list
['She', 'on', 'sea', 'seas', 'sells', 'shells', 'shore', 'the']
>>>
Haha or ruby
irb(main):001:0> "She sells seas shells on the sea shore".split.sort
=> ["She", "on", "sea", "seas", "sells", "shells", "shore", "the"]
Quote:
Find a six digit number that gives its digits reversed when multiplied by an integer between 2 and 9 inclusive.
Output:Code:(100000..999999).each { | x |
(2..9).each { |y |
if x.to_s == (x*y).to_s.reverse then
print "#{x} * #{y} = #{x*y}\n"
end
}
}
109989 * 9 = 989901
219978 * 4 = 879912
This is fun :)
Now might be a good time to mention http://www.pythonchallenge.com
Actually, you chose a wonderful time to mention this link. Thank you much for doing so.Quote:
Perl6Quote:
Originally posted by Sepero
Take the sentence:
"She sells sea shells by the sea shore"
Reorder the words alphabetically, and do it in your favorite language.
;)
Code:"She sells sea shells by the sea shore".split.sort.say;
## disregard case
"She sells sea shells by the sea shore".split.map:{ lc $_ }.sort.say;
# or
"She sells sea shells by the sea shore".split.sort:{ lc $^a cmp lc $^b }.say;