-
02-20-2005, 01:08 AM
#196
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.
-
02-20-2005, 03:36 PM
#197
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.
-
02-20-2005, 06:16 PM
#198
/me picks up jaw off the floor
-
02-20-2005, 06:37 PM
#199
Take the sentence:
"She sells sea shells by the sea shore"
Reorder the words alphabetically, and do it in your favorite language.
-
05-24-2005, 10:17 PM
#200
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
Find a six digit number that gives its digits reversed when multiplied by an integer between 2 and 9 inclusive.
-
05-25-2005, 12:01 AM
#201
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.
this is about as easy as it gets......I guess
Code:
#!/usr/bin/perl
@array = ("she", "sells", "sea", "shells", "by", "the", "sea", "shore");
@array2 = sort (@array);
print ("@array2\n");
-
05-25-2005, 12:28 AM
#202
This stuff needs a home...
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!
Success isn't measured by how high you fly: Success is measured by how high you bounce!
-
05-25-2005, 01:19 PM
#203
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
Are there more than two of these? Just checking to see if i'm close...
Oh, and can't we make this sticky? I'm sure it's one of everyone's favorites in this forum.
Last edited by tecknophreak; 05-25-2005 at 01:22 PM.
if (i_forgot && this_is_about_code)
language = c++;
-
05-26-2005, 09:21 AM
#204
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
registered linux user #355125
gentoo (with gentoo-dev-sources 2.6.5-r1) on Desktop
debian 2.6.5-1-686 on laptop
-
05-26-2005, 09:25 AM
#205
or:
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']
>>>
Bearing in mind that it's a case-sensitive sort....
mrBen "Carpe Aptenodytes"
Linux User #216794
My blog page
3rd year running - get yourself to LugRadio Live 7th-8th July 2007, Wolverhampton, UK. The premier FLOSS community event.
-
05-26-2005, 10:21 AM
#206
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"]
Last edited by tony_yum; 05-26-2005 at 10:38 AM.
registered linux user #355125
gentoo (with gentoo-dev-sources 2.6.5-r1) on Desktop
debian 2.6.5-1-686 on laptop
-
05-26-2005, 10:30 AM
#207
Find a six digit number that gives its digits reversed when multiplied by an integer between 2 and 9 inclusive.
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
}
}
Output:
109989 * 9 = 989901
219978 * 4 = 879912
This is fun
Last edited by tony_yum; 05-26-2005 at 01:09 PM.
registered linux user #355125
gentoo (with gentoo-dev-sources 2.6.5-r1) on Desktop
debian 2.6.5-1-686 on laptop
-
05-26-2005, 11:29 AM
#208
Now might be a good time to mention http://www.pythonchallenge.com
mrBen "Carpe Aptenodytes"
Linux User #216794
My blog page
3rd year running - get yourself to LugRadio Live 7th-8th July 2007, Wolverhampton, UK. The premier FLOSS community event.
-
05-26-2005, 05:13 PM
#209
Why, thank you...
Actually, you chose a wonderful time to mention this link. Thank you much for doing so.
Success isn't measured by how high you fly: Success is measured by how high you bounce!
-
05-28-2005, 05:26 PM
#210
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.
Perl6
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;
Last edited by bryan.6; 05-29-2005 at 11:59 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|