Search:

Type: Posts; User: mo.reina; Keyword(s):

Page 1 of 10 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    5
    Views
    470

    Re: Bash newbie help -

    I think
    grep returns true if it finds what it's looking for no?

    If that's the case you can do something like:


    if grep <header>
    do something
    else
    ...
  2. Re: What is your favorite programming language to use?

    Common Lisp, previously I used to code in Python and learned C at school. The CL community is incredibly helpful and approachable, as well as being great hackers.
  3. Replies
    0
    Views
    297

    Code Reading by Diomidis Spinellis

    Has anyone used Code Reading to learn how to read code in non C-like languages?

    I'm considering buying the book but as I code mainly in Common Lisp I'm not quite sure if it will apply, I know the...
  4. Re: Advanced programming exercise: All permutations

    Super late to the party but...

    Common Lisp:

    (defun list-switch (a b lst)
    "Switch elements at position a & b with each other"
    (let ((newlst (copy-list lst)))
    (psetf (nth a newlst)...
  5. Re: for the functional programmers, please critique my article

    Tony Flury, I updated it to include a smaller example under the Data and Pipelines heading.

    Please let me know if it explains the concept in a clearer manner.
  6. for the functional programmers, please critique my article

    Looking for criticisms and suggestions for this piece I wrote.

    mozartreina.com
  7. Replies
    0
    Views
    144

    Lisp webservers

    Does anyone have any experience with either/both hunchentoot and allegroserver? I've started dabbling into allegroserver but have just recenty heard of hunchentoot and would like to have some...
  8. /sys/devices/system/cpu/cpu*/cpufreq missing

    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/351159

    was this issue ever resolved? i have a box running chakra linux and i've come across the same problem, was it a kernel (running 3.1)...
  9. [ubuntu] performance issues with 11.10 guest on mac host, virtualbox 4.1.4

    rig: macbook air 4,2
    4 gb RAM
    1.7 ghz i5 dual-core intel core
    mac os lion

    guest: ubuntu 11.10
    2 gb RAM
    guest additions
    SATA hd
  10. Replies
    36
    Views
    3,554

    Re: Beginners Programming Challenge #20

    all done.
  11. Replies
    36
    Views
    3,554

    Re: Beginners Programming Challenge #20

    common lisp has remove-if-not,

    my own implementation


    (defun filter (fn lst)
    (cond ((null (car lst)) nil)
    (t (cons (if (funcall fn (car lst))
    (car lst))
    ...
  12. Replies
    19
    Views
    2,865

    Re: Beginner's Programming Challenge 17

    put up the revised edition


    >>> main()
    input task title and date:foo due tomorrow
    foo due 2010-12-08
    >>> main()
    input task title and date:fue due day after tomorrow
    fue due 2010-12-09
    >>>...
  13. Re: Script To Rename Multiple Files In A Directory

    in python:


    import glob
    import os

    filelist = glob.glob('*')
    for f in filelist:
    newname = f[:3] + f[8:]
    os.rename(f, newname)
  14. Replies
    4
    Views
    383

    Re: Python: Reading From Resource

    what are you trying to do? extract whatever is between the tags?
  15. Replies
    12
    Views
    998

    [SOLVED] Re: Grepping multiple lines at once?

    ok this is a bit of a hack, it's not pretty and i'm not proud of it...


    print len(re.findall(r'(\n1\n2\n3\n|^1\n2\n3\n)', a))

    so there are two patterns being matched, either there's a new...
  16. Replies
    12
    Views
    998

    [SOLVED] Re: Grepping multiple lines at once?

    i'm no regex expert, but try changing the last line to this:


    print len(re.findall(r'(?<!1)(1\n2\n3\n)', a))

    that's a negative look behind assertion, so it should match as long as the letter...
  17. Replies
    12
    Views
    998

    [SOLVED] Re: Grepping multiple lines at once?

    in python

    import re

    def run():
    with open('file.txt') as f:
    a = f.read()
    print len(re.findall(r'.*(1\n2\n3\n).*', a))
  18. Replies
    7
    Views
    385

    Re: Python 3.1 question..

    you have to replace string with whatever variable you're using for your text. in your case, since you've assigned the html page to text, it should be:

    import urllib.request
    import re

    page =...
  19. Replies
    5
    Views
    615

    [SOLVED] Re: Python 3 Problem

    input did replace raw_input in python3.x

    if you want to have a float as output, you can just change the last line to this


    print((lower + upper) / 2.0)

    this will print out a float. you...
  20. Replies
    7
    Views
    385

    Re: Python 3.1 question..

    regex isn't the best tool for the job. i also wrote a quick parser for my own project using regex and it wasn't a good idea.

    what you can use is the string.partition method



    before, tag,...
  21. Replies
    2
    Views
    241

    Re: Python Twisted

    i suggest going over to the #twisted channel at freenode and asking them. they're quite helpful.
  22. Replies
    8
    Views
    467

    Re: Does this look right? (Python)

    it seems to work, at least on my system.

    i would re-write your script like this, to make it a bit shorter, thus easier to maintain in the future:


    import os

    with open('test.txt') as f:
    ...
  23. Replies
    19
    Views
    2,865

    Re: Beginner's Programming Challenge 17

    thanks, that makes it much easier to read.
  24. Replies
    19
    Views
    2,865

    Re: Beginner's Programming Challenge 17

    revised edition..

    '''convert received date from stdin to datetime object with the following format, DD-month_abbreviation-YYYY
    ex. 2000 12 november -> 12 Nov 2000'''

    import datetime
    import re...
  25. Re: String variable under Python : Unicode problem

    >>> s = 'hello byte string'
    >>> u = unicode(s)
    >>> u
    u'hello byte string'
    >>> u.encode()
    'hello byte string'
    >>>
Results 1 to 25 of 250
Page 1 of 10 1 2 3 4