Sunday, January 31, 2010

Re: [android-developers] Re: Problem finding a contact when ID is known

You don't need to create it.  It is column on the Contacts table. There is also a conenience method on Contacts that will retrieve it for you.

On Jan 31, 2010 3:43 PM, "andrew android" <andygoldman3@gmail.com> wrote:

Please tell me, though, how do you create a lookup key?  Can you give
or point me to a good example?

On Jan 31, 12:47 pm, Dmitri Plotnikov (▯▯▯▯)  <dplotni...@google.com>
wrote:

> Contact IDs are volatile, they often change as a result of aggregation.  You
> need to store the l...

> On Jan 31, 2010 9:42 AM, "andrew android" <andygoldm...@gmail.com> wrote:
>
> I am having a proble...

> android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en

--

You received this message because you are subscribed to the Google
Groups "Android Developers" group...

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

3akarat.com - شقة مفروشة بالعجوزة بين الدقى والمهندسين

إعلان جديد من عقارات دوت كوم تفاصيل الأعلان : تفاصيل الإعلان . . .

عقارات دوت كوم
----------------------------------------------------------------------------------------

Re: Struts2 GWT and classpath

Thank you. I am farther along now. I learned much from -help as you
suggested.

I also think I understand that one runs two servers; 1 is run for GWT
(such as using a debug configuration) and the other server for the
struts 2 web server (via eclipse project right click - Run As - Run on
Server).

I was pretty excited to see eclipse offer: http://localhost:8888/s2?gwt.codesvr=10.0.0.2:9997
as a url to use when running in Debug mode for GWT. That's progress.

The web browser redirects from http://localhost:8888/s2?gwt.codesvr=10.0.0.2:9997
to http://localhost:8888/s2/ That's different than the hello-world GWT
app URL which has ".html" in it; See Sgwt.html -->
http://localhost:53650/Sgwt.html?gwt.codesvr=10.0.0.2:9997

I wanted the host page to come up with the typical hello world GWT app
of "Please enter your name: " that a new GWT project via eclipse
plugin gives you. However I get a blank web browser page. I am not
sure why the browser redirects to the module root like that.

Help? :)


On Jan 31, 12:30 am, Henry <q8e...@gmail.com> wrote:
> Hi Finney,
>
> You can specify args to DevMode
>
> Run->Debug Configurations...->g(oogle) Web Application->New
> in the Arguments tab, you can add the name of your module(s)
> If in doubt, add the
> -help
> arguments in the Arguments tab
>
> Cheers,
> Henry
> p.s. checkouthttp://code.google.com/p/struts2gwtplugin
> and let me know what you think of that plugin
>
> On Jan 30, 7:34 pm, finneycanhelp <lovefin...@gmail.com> wrote:> Quick follow up / add on:
>
> >  I see the post about Maven and GWT athttp://groups.google.com/group/google-web-toolkit/browse_thread/threa...
>
> > However, my real concern is with a struts2 project (s2project) that
> > has:
> >   - /s2project/WebContent folder which contains index.jsp, WEB-
> > INF, ...
>
> >   - /s2project/WebContent/WEB-INF/classes is the output folder
>
> >   - /s2project/src folder which contains java source and struts.xml
>
> >   - /s2project/ivy.xml file
>
> > Thanks again for any help.
>
> > On Jan 30, 9:16 pm, finneycanhelp <lovefin...@gmail.com> wrote:
>
> > > Hi,
>
> > > My goal is to GWT-ize a struts2 (S2) project.  I read the archives of
> > > this list. Although email threads were quite informative, I do not see
> > > the answer to this situation regarding the Java classpath and GWT.
>
> > > Tools:
> > >   I am using eclipse Java EE IDE for Web Developers (3.5.1) and the
> > > GWT eclipse plugin (1.2.0) with GWT 2.0.
>
> > >   I created a GWT hello world application to compare to the small
> > > struts 2 application I am trying to enhance.
>
> > > Project layout:
> > >   - In the struts2 project, the S2 web application has its WEB-INF in /
> > > s2/src/main/webapp/WEB-INF and its output (.class files) go into "s2/
> > > target/classes"  It's a standard maven project.
>
> > >   - I see GWT has its WEB-INF located in /sgwt/war/WEB-INF and the
> > > output of the project is "sgwt/war/WEB-INF/classes"
>
> > > What I did:
>
> > >   - I changed the S2 project properties in the Google Web Toolkit
> > > dialog box to Use Google Web Toolkit.
>
> > >   - I also did the following:
>
> > >   + read the document at:
> > >    http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjec...
>
> > >   + copied/modified over components from the brand new GWT web
> > > application
>
> > > My current obstacle / challenge is knowing how to add s2.gwt.xml,
> > > s2.html, s2.css so they are visible to the Jetty development mode of
> > > GWT.
>
> > > By hand, I copied over the s2.gwt.xml file into /s2/src/main/
> > > resources   However things did not work quite right. Trying a url
> > > like:http://localhost:8888/Sgwt.html?gwt.codesvr=10.0.0.2:9997 but
> > > for the s2 project did not work.
>
> > > How do I change the development mode of GWT in eclipse to use the s2
> > > resources ( \s2\target\classes ) ?
>
> > > I will have a similar issue with another struts2 project but it is not
> > > in a standard maven project setup. It has a WebContent folder which
> > > contains a WEB-INF folder and so on.
>
> > > Thank you for your help.
>
> > > Sincerely,
> > > Mike

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

[android-developers] Why 'system' user cannot access /sdcard ?


Anybody know the reason for this issue? How to resolve it?  Workaround is OK, too.


I have a  Java-JNI-App which must run in 'system' user mode, but once switch to that, my App then cannot access /sdcard. Confused.


Any hint is appreciated. Thanks.



david

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

linux.kernel - 26 new messages in 6 topics - digest

linux.kernel
http://groups.google.com/group/linux.kernel?hl=en

linux.kernel@googlegroups.com

Today's topics:

* Blank screen with KMS enabled (on clevo M5xN laptop) - 21 messages, 3
authors
http://groups.google.com/group/linux.kernel/t/42f60222e13dd142?hl=en
* virtio_blk: add block topology support - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/fbe22dc2c98a3b32?hl=en
* Lock dependency based tree report in perf lock - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/29cdb25f32184fc0?hl=en
* RO/NX protection for loadable kernel modules - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/ea25305616bf8f3f?hl=en
* mm/readahead.c: update the LRU positions of in-core pages, too - 1 messages,
1 author
http://groups.google.com/group/linux.kernel/t/c3e8affbeb80ebe0?hl=en
* HDA Intel Audio hang on boot - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/c19fa05ad577d5d3?hl=en

==============================================================================
TOPIC: Blank screen with KMS enabled (on clevo M5xN laptop)
http://groups.google.com/group/linux.kernel/t/42f60222e13dd142?hl=en
==============================================================================

== 1 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15108
Subject : Blank screen with KMS enabled (on clevo M5xN laptop)
Submitter : Jérémy Lal <kapouer@melix.org>
Date : 2010-01-22 20:30 (10 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 2 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15158
Subject : oops related to i915_gem_object_save_bit_17_swizzle
Submitter : Werner Lemberg <wl@gnu.org>
Date : 2010-01-28 08:26 (4 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 3 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14997
Subject : Closing and re-opening the lid does not reactivate the backlight
Submitter : o. meijer <meijer.o@gmail.com>
Date : 2010-01-06 15:38 (26 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 4 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14657
Subject : perf subsystem breakage in 2.6.32-rc7
Submitter : Arjan van de Ven <arjan@infradead.org>
Date : 2009-11-19 19:50 (74 days old)
References : http://marc.info/?l=linux-kernel&m=125866013419738&w=4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 5 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15197
Subject : padlock_sha1 and hmac broken?
Submitter : Wolfgang Walter <wolfgang.walter@stwm.de>
Date : 2010-01-29 23:44 (3 days old)
References : http://marc.info/?l=linux-kernel&m=126480912924283&w=4
Handled-By
: Herbert Xu <herbert@gondor.apana.org.au>
Patch : http://patchwork.kernel.org/patch/75959/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 6 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15004
Subject : i915: *ERROR* Execbuf while wedged
Submitter : tomas m <tmezzadra@gmail.com>
Date : 2010-01-07 18:53 (25 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 7 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14695
Subject : regression in karmic thermal control
Submitter : Bugie <public@bugie.de>
Date : 2009-11-26 08:45 (67 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 8 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15042
Subject : socket(PF_INET6 hangs when ipv6 not yet initialized
Submitter : Marc Haber <mh+linux-kernel@zugschlus.de>
Date : 2010-01-10 14:28 (22 days old)
References : http://marc.info/?l=linux-kernel&m=126313553029280&w=4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 9 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14922
Subject : 2.6.32 seemed to have broken nVidia MCP7A sata controller
Submitter : Mike Cui <cuicui@gmail.com>
Date : 2009-12-19 6:13 (44 days old)
References : http://marc.info/?l=linux-ide&m=126120323407742&w=4
Handled-By
: Jeff Garzik <jeff@garzik.org>
Robert Hancock <hancockrwd@gmail.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 10 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15021
Subject : agpgart sometimes fails to initialize sometimes
Submitter : Maciej Piechotka <uzytkownik2@gmail.com>
Date : 2010-01-09 23:31 (23 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 11 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15193
Subject : kswapd continuously active
Submitter : Jan Engelhardt <jengelh@medozas.de>
Date : 2010-01-22 23 (10 days old)
References : http://marc.info/?l=linux-kernel&m=126420434519039&w=4
Handled-By
: Jens Axboe <jens.axboe@oracle.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 12 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15040
Subject : High cpu temperature with 2.6.32 - bisected to cpuidle menu update
Submitter : Dimitrios Apostolou <jimis@gmx.net>
Date : 2010-01-06 17:39 (26 days old)
References : http://marc.info/?l=linux-kernel&m=126279952723036&w=4
Handled-By
: Arjan van de Ven <arjan@infradead.org>
Patch : http://patchwork.kernel.org/patch/71962/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 13 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14748
Subject : e1000e NIC not working after reboot
Submitter : Maciek Sitarz <macieks@freesco.pl>
Date : 2009-12-06 13:04 (57 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 14 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14656
Subject : Oops at __rmqueue+0x98 with 2.6.32-rc6
Submitter : Lucas C. Villa Real <lucasvr@gobolinux.org>
Date : 2009-11-19 3:48 (74 days old)
References : http://marc.info/?l=linux-kernel&m=125860255229092&w=4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 15 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15156
Subject : 2.6.32.6 hang at boot with ati x1600
Submitter : Alexey Kuznetsov <ak@axet.ru>
Date : 2010-01-28 05:02 (4 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 16 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14895
Subject : BUG in kernel 2.6.32 when using luks encrypted root and RAID0..
Submitter : r4 <mk_4@centrum.cz>
Date : 2009-12-03 18:24 (60 days old)
References : http://marc.info/?l=linux-kernel&m=125986664904751&w=4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 17 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15071
Subject : IBM/Lenovo Trackpoint speed, sensitivity reset after suspend
Submitter : Marten Vance <kernel@mv.so36.net>
Date : 2010-01-16 16:19 (16 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 18 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15015
Subject : blank screen at random times in laptop when sitting idle
Submitter : Jithin Emmanuel <jithin1987@gmail.com>
Date : 2010-01-09 16:48 (23 days old)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 19 of 21 ==
Date: Sun, Jan 31 2010 5:10 pm
From: "Rafael J. Wysocki"


This message has been generated automatically as a part of a report
of regressions introduced between 2.6.31 and 2.6.32.

The following bug entry is on the current list of known regressions
introduced between 2.6.31 and 2.6.32. Please verify if it still should
be listed and let me know (either way).


Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15134
Subject : gobi_loader hangs after commit 8e8dce065088
Submitter : Matthew Garrett <mjg59@srcf.ucam.org>
Date : 2010-01-17 2:55 (15 days old)
References : http://marc.info/?l=linux-kernel&m=126369696509502&w=4
Handled-By
: Oliver Neukum <oliver@neukum.org>
Alan Cox <alan@lxorguk.ukuu.org.uk>
Patch : http://patchwork.kernel.org/patch/73878/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 20 of 21 ==
Date: Sun, Jan 31 2010 5:20 pm
From: Robert Hancock


On Sun, Jan 31, 2010 at 6:43 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> This message has been generated automatically as a part of a report
> of regressions introduced between 2.6.31 and 2.6.32.
>
> The following bug entry is on the current list of known regressions
> introduced between 2.6.31 and 2.6.32. �Please verify if it still should
> be listed and let me know (either way).
>
>
> Bug-Entry � � � : http://bugzilla.kernel.org/show_bug.cgi?id=14922
> Subject � � � � : 2.6.32 seemed to have broken nVidia MCP7A sata controller
> Submitter � � � : Mike Cui <cuicui@gmail.com>
> Date � � � � � �: 2009-12-19 6:13 (44 days old)
> References � � �: http://marc.info/?l=linux-ide&m=126120323407742&w=4
> Handled-By � � �: Jeff Garzik <jeff@garzik.org>
> � � � � � � � � �Robert Hancock <hancockrwd@gmail.com>

Still outstanding. I posted a patch that should fix the problem,
waiting for feedback from the reporter.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 21 of 21 ==
Date: Sun, Jan 31 2010 5:50 pm
From: "Justin P. Mattock"


On 01/31/10 16:43, Rafael J. Wysocki wrote:
> This message has been generated automatically as a part of a report
> of regressions introduced between 2.6.31 and 2.6.32.
>
> The following bug entry is on the current list of known regressions
> introduced between 2.6.31 and 2.6.32. Please verify if it still should
> be listed and let me know (either way).
>
>
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=14487
> Subject : PANIC: early exception 08 rip 246:10 error ffffffff810251b5 cr2 0
> Submitter : Justin P. Mattock<justinmattock@gmail.com>
> Date : 2009-10-23 16:45 (101 days old)
> References : http://lkml.org/lkml/2009/10/23/252
>
>
>


yeah still hitting this.
looking at the issue if I change:

@@ 260

if ((class == 0xffffffff))
continue;
to

if ((class == 0xffffffff || 0xffffffffffffffff))
continue;

I'm able to boot, but don't have enough knowledge to know
what is really happening(or how to execute this).
will continue looking at this
(hopefully I get somewhere on this);

Justin P. Mattock
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: virtio_blk: add block topology support
http://groups.google.com/group/linux.kernel/t/fbe22dc2c98a3b32?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 5:20 pm
From: Rusty Russell


On Sun, 31 Jan 2010 06:49:10 am Christoph Hellwig wrote:
> On Sat, Jan 30, 2010 at 03:29:49PM +1030, Rusty Russell wrote:
> > I bow to your expertise on that. My only query is the __u16 for min_io_size; is that likely to restrict us?
>
> Looks like you caught me there - I wrote the above odd format about the
> physical_block exponent, but scsi actually does the min_io and opt_io
> size in logical blocks, too. With that in account the u16 as in scsi
> is perfectly fine.

Thanks, applied.

Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: Lock dependency based tree report in perf lock
http://groups.google.com/group/linux.kernel/t/29cdb25f32184fc0?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 5:30 pm
From: Frederic Weisbecker


On Sat, Jan 30, 2010 at 09:46:28AM +0100, Peter Zijlstra wrote:
> On Sat, 2010-01-30 at 00:17 +0100, Frederic Weisbecker wrote:
> >
> >
> > Anyway, that's just an idea, not trivial I must admit.
>
> lockdep actually collects all this information, so writing it out isn't
> too hard.


Hmm, I'm discovering the /proc/lock_stat file this evening, did not
know it exist :)

Still, a tree representation can bring another dimension.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: RO/NX protection for loadable kernel modules
http://groups.google.com/group/linux.kernel/t/ea25305616bf8f3f?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 5:40 pm
From: Rusty Russell


On Mon, 1 Feb 2010 09:52:35 am Siarhei Liakh wrote:
> +/*
> + * Given BASE and SIZE this macro calculates the number of pages the
> + * memory regions occupies
> + */
> +#define NUMBER_OF_PAGES(BASE, SIZE) ((SIZE > 0) ? \
> + (PFN_DOWN((unsigned long)BASE + SIZE - 1) - \
> + PFN_DOWN((unsigned long)BASE) + 1) \
> + : (0UL))

Needs more brackets around arguments, otherwise someone calling it with
a complex expression will get very upset.

Or just replace with a static inline function?

> + if ((mod->module_core) && (mod->core_text_size > 0)) {

The core_text_size test should be enough here.

> + begin_pfn = PFN_DOWN((unsigned long)mod->module_core);
> + end_pfn = PFN_DOWN((unsigned long)mod->module_core +
> + mod->core_text_size);
> + if (end_pfn > begin_pfn)
> + set_memory_rw(begin_pfn << PAGE_SHIFT,
> + end_pfn - begin_pfn);

Much of this code might be neater if you created a helper:

void set_page_attributes(void *start, void *end,
void (*set)(unsigned long start, unsigned long num_pages))
{
unsigned long begin_pfn = PFN_DOWN((unsigned long)start);
unsigned long end_pfn = PFN_DOWN((unsigned long)end);
if (end_pfn > begin_pfn)
set(begin_pfn << PAGE_SHIFT, end_pfn - begin_pfn);
}

But these are minor: patch looks good!

Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: mm/readahead.c: update the LRU positions of in-core pages, too
http://groups.google.com/group/linux.kernel/t/c3e8affbeb80ebe0?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 6:10 pm
From: Chris Frost


On Sun, Jan 31, 2010 at 10:31:42PM +0800, Wu Fengguang wrote:
> On Tue, Jan 26, 2010 at 09:32:17PM +0800, Wu Fengguang wrote:
> > On Mon, Jan 25, 2010 at 03:36:35PM -0700, Chris Frost wrote:
> > > I changed Wu's patch to add a PageLRU() guard that I believe is required
> > > and optimized zone lock acquisition to only unlock and lock at zone changes.
> > > This optimization seems to provide a 10-20% system time improvement for
> > > some of my GIMP benchmarks and no improvement for other benchmarks.
>
> I feel very uncomfortable about this put_page() inside zone->lru_lock.
> (might deadlock: put_page() conditionally takes zone->lru_lock again)
>
> If you really want the optimization, can we do it like this?

Sorry that I was slow to respond. (I was out of town.)

Thanks for catching __page_cache_release() locking the zone.
I think staying simple for now sounds good. The below locks
and unlocks the zone for each page. Look good?

---
readahead: retain inactive lru pages to be accessed soon
From: Chris Frost <frost@cs.ucla.edu>

Ensure that cached pages in the inactive list are not prematurely evicted;
move such pages to lru head when they are covered by
- in-kernel heuristic readahead
- an posix_fadvise(POSIX_FADV_WILLNEED) hint from an application

Before this patch, pages already in core may be evicted before the
pages covered by the same prefetch scan but that were not yet in core.
Many small read requests may be forced on the disk because of this
behavior.

In particular, posix_fadvise(... POSIX_FADV_WILLNEED) on an in-core page
has no effect on the page's location in the LRU list, even if it is the
next victim on the inactive list.

This change helps address the performance problems we encountered
while modifying SQLite and the GIMP to use large file prefetching.
Overall these prefetching techniques improved the runtime of large
benchmarks by 10-17x for these applications. More in the publication
_Reducing Seek Overhead with Application-Directed Prefetching_ in
USENIX ATC 2009 and at http://libprefetch.cs.ucla.edu/.

Signed-off-by: Chris Frost <frost@cs.ucla.edu>
Signed-off-by: Steve VanDeBogart <vandebo@cs.ucla.edu>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
readahead.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

diff --git a/mm/readahead.c b/mm/readahead.c
index aa1aa23..c615f96 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -9,7 +9,9 @@

#include <linux/kernel.h>
#include <linux/fs.h>
+#include <linux/memcontrol.h>
#include <linux/mm.h>
+#include <linux/mm_inline.h>
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
@@ -133,6 +135,40 @@ out:
}

/*
+ * The file range is expected to be accessed in near future. Move pages
+ * (possibly in inactive lru tail) to lru head, so that they are retained
+ * in memory for some reasonable time.
+ */
+static void retain_inactive_pages(struct address_space *mapping,
+ pgoff_t index, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++) {
+ struct page *page;
+ struct zone *zone;
+
+ page = find_get_page(mapping, index + i);
+ if (!page)
+ continue;
+ zone = page_zone(page);
+ spin_lock_irq(&zone->lru_lock);
+
+ if (PageLRU(page) &&
+ !PageActive(page) &&
+ !PageUnevictable(page)) {
+ int lru = page_lru_base_type(page);
+
+ del_page_from_lru_list(zone, page, lru);
+ add_page_to_lru_list(zone, page, lru);
+ }
+
+ spin_unlock_irq(&zone->lru_lock);
+ put_page(page);
+ }
+}
+
+/*
* __do_page_cache_readahead() actually reads a chunk of disk. It allocates all
* the pages first, then submits them all for I/O. This avoids the very bad
* behaviour which would occur if page allocations are causing VM writeback.
@@ -184,6 +220,14 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp,
}

/*
+ * Normally readahead will auto stop on cached segments, so we won't
+ * hit many cached pages. If it does happen, bring the inactive pages
+ * adjecent to the newly prefetched ones(if any).
+ */
+ if (ret < nr_to_read)
+ retain_inactive_pages(mapping, offset, page_idx);
+
+ /*
* Now start the IO. We ignore I/O errors - if the page is not
* uptodate then the caller will launch readpage again, and
* will then handle the error.

--
Chris Frost
http://www.frostnet.net/chris/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: HDA Intel Audio hang on boot
http://groups.google.com/group/linux.kernel/t/c19fa05ad577d5d3?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 6:10 pm
From: Sid Boyce


On 01/02/10 00:22, Rafael J. Wysocki wrote:
> This message has been generated automatically as a part of a report
> of recent regressions.
>
> The following bug entry is on the current list of known regressions
> from 2.6.32. Please verify if it still should be listed and let me know
> (either way).
>
>
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15144
> Subject : HDA Intel Audio hang on boot
> Submitter : Sid Boyce <sboyce@blueyonder.co.uk>
> Date : 2010-01-15 1:24 (17 days old)
> References : http://marc.info/?l=linux-kernel&m=126351866722507&w=4
>
>
>

Still not fixed in 2.6.33-rc6. Takashi wrote that the fix was scheduled
for 2.6.33-rc6, but it did not appear. I have gone back to using the
workaround with 2.6.33-rc6.
Regards
Sid.
--
Sid Boyce ... Hamradio License G3VBV, Licensed Private Pilot
Emeritus IBM/Amdahl Mainframes and Sun/Fujitsu Servers Tech Support
Specialist, Cricket Coach
Microsoft Windows Free Zone - Linux used for all Computing Tasks

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


==============================================================================

You received this message because you are subscribed to the Google Groups "linux.kernel"
group.

To post to this group, visit http://groups.google.com/group/linux.kernel?hl=en

To unsubscribe from this group, send email to linux.kernel+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/linux.kernel/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

[android-developers] Re: How can I enable assert statement on Android?

Thank you very much. It is what I need!!

On Jan 28, 10:43 am, fadden <fad...@android.com> wrote:
>
> Did you stop/start the app framework after making the property
> change?  (There are some general instructions at the top of that
> document -- the property change doesn't affect anything until the
> runtime is restarted.)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

3akarat.com - شقة بمصطفي كامل بالأسكندرية

إعلان جديد من عقارات دوت كوم تفاصيل الأعلان : تفاصيل الإعلان . . .

عقارات دوت كوم
----------------------------------------------------------------------------------------

Re: [android-developers] Re: Multi-threaded http requests cause exception

> Petroleam is right about AsyncTask using a thread-pool of only one
> thread on 1.5. Higher versions of Android use a pool of more than one
> thread.
>
> You can do something similar with ExecutorService and FutureTask
> classes (java.util.concurrent; i believe that AsyncTask is based upon
> these classes) and tell the ExecutorService to use Thread-pools of any
> size.

I have a version of AsyncTask for Android 1.5 that eliminates the
one-thread limitation:

http://github.com/commonsguy/cwac-task

--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[jQuery] Browser / AJAX help

I have a "star" click to bookmark type feature. It works in FF, IE but not Opera or Chrome.
 
Filled star = page book marked
Empty star  = not bookmarked
 
In FF and IE first click changes the star from empty to filled, click filled star turns back to empty (info saved in db successfully).
 
In Opera and Chrome clicking the stars fills them and 2nd click will return it back to empty but it never saves to the db. If i bookmark 20 pages in FF, go to Chrome or Opera and un-select the bookmarked selections it saves (deletes the bookmark) but it never saves any new bookmarks.
 
My js looks like this:
 
$("a.bookmarked").live('click', function(){
   var url_id = $(this).attr('id').split('_');
   var status = $(this).attr('class');
   
   $(this).toggleClass("not");
 

     
   $.ajax({
     type: "POST",
     cache:false,
     url: '/bookmark/'+url_id[1],
     });
   return false;
   });
 
Any ideas?
 
Dave

Re: [Rails] Re: jQuery & Rails installation

On Sun, Jan 31, 2010 at 7:35 PM, Kristian <kmandrup@gmail.com> wrote:
There are several blog posts on how to use jQuery unobtrusively with
Rails. Yeah, don't use the js helpers and RJS if you can avoid it!
I'm currently in the process of creating a jQuery application template
to install/configure jQuery widgets, jQuery UI and unobtrusive jQuery
in a Rails app.
Check my github rails3-templates at kristianmandrup.

Have fun!

BTW: If you want to learn jQuery, get the "jQuery in Action" book!


"jQuery in Action" is a very good book but make sure that you get
the 2nd edition which covers jQuery 1.4.

Cheers,

-Conrad
 
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

[android-developers] webview selection

Hi, is it possible to handle selections on a WebView?

Any suggestion on how to do this without having to touch WebKit api?

Thanks

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Multi-threaded http requests cause exception

Petroleam is right about AsyncTask using a thread-pool of only one
thread on 1.5. Higher versions of Android use a pool of more than one
thread.

You can do something similar with ExecutorService and FutureTask
classes (java.util.concurrent; i believe that AsyncTask is based upon
these classes) and tell the ExecutorService to use Thread-pools of any
size.


On Jan 28, 11:36 am, Biosopher <biosop...@gmail.com> wrote:
> Hi Frank,
>
> Thanks for pointing me back to AsyncTask.  I had seen AsyncTask but
> hadn't updated my code to it.  Instead I had relied on Threads and
> Handlers as they had worked without a problem before.  I'm still
> unsure why the Thread and Handler setup wasn't working, but now that
> I've updated to AsyncTask everything is working great.
>
> Thanks!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Bluetooth connect socket timeout

I don't understand this message. Anyway, I have a Motorola Droid
running 2.0.1.

On Jan 31, 10:47 am, avin gupta <businessguyrahuls...@gmail.com>
wrote:
> Hi ron the g1 made by connect only handsets.its not working with others like
> pc and mobiles.
>
> NIRMAL
>
> On Jan 28, 2010 7:26 AM, "Ron" <ronbruck...@comcast.net> wrote:
>
> I'm getting a connect timeout using Android as a bluetooth client
> connecting to a server device.  I'm pretty sure the UUID is correct as
> I no longer get the immediate service discovery errors that I got when
> using any other UUID string.  So I have two questions:
>
> 1) Is it possible to lengthen the (about) 12 second timeout for the
> socket connect?
> 2) Are there any other settings I need to be looking at to make this
> work?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubscribe@googlegroups.com>
> For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

comp.lang.python - 25 new messages in 10 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Can't get sys.stdin.readlines() to work - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/6fb92ef62afc438a?hl=en
* Python and Ruby - 12 messages, 6 authors
http://groups.google.com/group/comp.lang.python/t/dfe4f6c60032755e?hl=en
* PEP 3147 - new .pyc format - 2 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/7a0d8230a5907885?hl=en
* Keyboard input - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/9f18e65916b8c115?hl=en
* Slow down while creating a big list and iterating over it - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/327544bd08947046?hl=en
* create a string of variable lenght - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/ea070cfc61ccfd9c?hl=en
* ftp.storlines error - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/f67e054132789d17?hl=en
* gmtime - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/ffc89a42b4e893f6?hl=en
* recv_into(bytearray) complains about a "pinned buffer" - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/33a3eaafe2948d0c?hl=en
* iglob performance no better than glob - 2 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/d9a8617ec85e926d?hl=en

==============================================================================
TOPIC: Can't get sys.stdin.readlines() to work
http://groups.google.com/group/comp.lang.python/t/6fb92ef62afc438a?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 2:24 pm
From: tinnews@isbd.co.uk


Richard Thomas <chardster@gmail.com> wrote:
> On Jan 31, 6:15 pm, tinn...@isbd.co.uk wrote:
> > I'm trying to read some data from standard input, what I'm actually
> > trying to do is process some date pasted in using the mouse cut and
> > paste on a Linux box (xubuntu 9.10) in a terminal window.
> >
> > First attempts failed so I'm now trying the trivial:-
> >
> >     import sys
> >     data = sys.stdin.readlines()
> >     print "Counted", len(data), "lines."
> >
> > When I run this and try to paste something into the terminal window I
> > get the following errors:-
> >
> >     /home/chris/bin/m2r.py: line 2: syntax error near unexpected token `('
> >     /home/chris/bin/m2r.py: line 2: `data = sys.stdin.readlines()'
> >
> > It does exactly the same if I try:-
> >
> >     cat | m2r.py
> >
> > and then paste something into the window.
> >
> > So - what on earth am I doing wrong?
> >
> > --
> > Chris Green
>
> You haven't put a shebang line at the top.
>
> #!/usr/bin/env python
> import sys
> data = sys.stdin.readlines()
> ...

Urk!!! Silly me. That catches me out every few months! :-)

--
Chris Green


==============================================================================
TOPIC: Python and Ruby
http://groups.google.com/group/comp.lang.python/t/dfe4f6c60032755e?hl=en
==============================================================================

== 1 of 12 ==
Date: Sun, Jan 31 2010 2:36 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote:

> In most functional languages you just name a function to access it and
> you do it ALL the time.
>
> for example, in if you have a function 'f' which takes two parameters to
> call the function and get the result you use:
>
> f 2 3
>
> If you want the function itself you use:
>
> f

How do you call a function of no arguments?

--
Steven


== 2 of 12 ==
Date: Sun, Jan 31 2010 2:37 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 14:47:08 -0600, John Bokma wrote:

> An editor can correct the indenting of the braces example but can't with
> this one.
>
> if x:
> if y:
> foo()
> else:
> bar()
>
> While braces might be considered redundant they are not when for one
> reason or another formatting is lost or done incorrectly.

I've heard this argument before, and I don't buy it. Why should we expect
the editor to correct malformed code?

Would you expect your editor to correct this malformed code?

result = sin(x+)y

Why should broken indentation be held to a higher standard than any other
breakage in code?

--
Steven


== 3 of 12 ==
Date: Sun, Jan 31 2010 3:40 pm
From: Chris Rebert


On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano
<steve@remove-this-cybersource.com.au> wrote:
> On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote:
>> In most functional languages you just name a function to access it and
>> you do it ALL the time.
>>
>> for example, in if you have a function 'f' which takes two parameters to
>> call the function and get the result you use:
>>
>>  f 2 3
>>
>> If you want the function itself you use:
>>
>>    f
>
> How do you call a function of no arguments?

It's not really a function in that case, it's just a named constant.
(Recall that functions don't/can't have side-effects.)

Cheers,
Chris
--
http://blog.rebertia.com


== 4 of 12 ==
Date: Sun, Jan 31 2010 4:14 pm
From: Arnaud Delobelle


Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au> writes:

> On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote:
>
>> In most functional languages you just name a function to access it and
>> you do it ALL the time.
>>
>> for example, in if you have a function 'f' which takes two parameters to
>> call the function and get the result you use:
>>
>> f 2 3
>>
>> If you want the function itself you use:
>>
>> f
>
> How do you call a function of no arguments?

In a functional language, a function of no arguments will always return
the same value. So, from a non-functional point of vue, f is both the
function and its value.

--
Arnaud


== 5 of 12 ==
Date: Sun, Jan 31 2010 4:25 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 15:40:36 -0800, Chris Rebert wrote:

> On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano
> <steve@remove-this-cybersource.com.au> wrote:
>> On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote:
>>> In most functional languages you just name a function to access it and
>>> you do it ALL the time.
>>>
>>> for example, in if you have a function 'f' which takes two parameters
>>> to call the function and get the result you use:
>>>
>>>  f 2 3
>>>
>>> If you want the function itself you use:
>>>
>>>    f
>>
>> How do you call a function of no arguments?
>
> It's not really a function in that case, it's just a named constant.
> (Recall that functions don't/can't have side-effects.)


>>> time.time(), random.random()
(1264983502.7505889, 0.29974255140479633)
>>> time.time(), random.random()
(1264983505.9283719, 0.74207867411026329)


They don't look terribly constant to me.


There is a difference between a function that does "give me whatever
value is specified by a fixed description" and a function that does "give
me a fixed value".

--
Steven


== 6 of 12 ==
Date: Sun, Jan 31 2010 4:27 pm
From: Ed Keith


--- On Sun, 1/31/10, Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au> wrote:

> From: Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au>
> Subject: Re: Python and Ruby
> To: python-list@python.org
> Date: Sunday, January 31, 2010, 5:36 PM
> On Sun, 31 Jan 2010 04:28:41 -0800,
> Ed Keith wrote:
>
> > In most functional languages you just name a function
> to access it and
> > you do it ALL the time.
> >
> > for example, in if you have a function 'f' which takes
> two parameters to
> > call the function and get the result you use:
> >
> >  f 2 3
> >
> > If you want the function itself you use:
> >
> >    f
>
> How do you call a function of no arguments?
>
>

In a 'pure' functional language a function with no arguments is, by definition, a constant. This is because a 'pure' function will always return the same result whenever given the same arguments. so if it has no argument it always returns a constant value.

-EdK

Ed Keith
e_d_k@yahoo.com

Blog: edkeith.blogspot.com


== 7 of 12 ==
Date: Sun, Jan 31 2010 4:47 pm
From: John Bokma


Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au> writes:

> On Sun, 31 Jan 2010 14:47:08 -0600, John Bokma wrote:
>
>> An editor can correct the indenting of the braces example but can't with
>> this one.
>>
>> if x:
>> if y:
>> foo()
>> else:
>> bar()
>>
>> While braces might be considered redundant they are not when for one
>> reason or another formatting is lost or done incorrectly.
>
> I've heard this argument before, and I don't buy it. Why should we expect
> the editor to correct malformed code?

Or a prettyfier. It doesn't matter. The point is that with braces there
*is* redundancy that be used to fix the code.

> Would you expect your editor to correct this malformed code?
>
> result = sin(x+)y

Nice straw man.

Let me repeat again: I am ok with how Python works. To be honest I think
it's cleaner compared to using {}. But in there are real life examples
in which Python code will break where code with braces will survive.

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


== 8 of 12 ==
Date: Sun, Jan 31 2010 4:50 pm
From: Chris Rebert


On Sun, Jan 31, 2010 at 4:25 PM, Steven D'Aprano
<steven@remove.this.cybersource.com.au> wrote:
> On Sun, 31 Jan 2010 15:40:36 -0800, Chris Rebert wrote:
>> On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano
>> <steve@remove-this-cybersource.com.au> wrote:
>>> On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote:
>>>> In most functional languages you just name a function to access it and
>>>> you do it ALL the time.
>>>>
>>>> for example, in if you have a function 'f' which takes two parameters
>>>> to call the function and get the result you use:
>>>>
>>>>  f 2 3
>>>>
>>>> If you want the function itself you use:
>>>>
>>>>    f
>>>
>>> How do you call a function of no arguments?
>>
>> It's not really a function in that case, it's just a named constant.
>> (Recall that functions don't/can't have side-effects.)
>
>
>>>> time.time(), random.random()
> (1264983502.7505889, 0.29974255140479633)
>>>> time.time(), random.random()
> (1264983505.9283719, 0.74207867411026329)
>
>
> They don't look terribly constant to me.

Those aren't functions in the pure functional programming sense; which
is unsurprising since Python isn't a [pure] functional language.
They both involve side-effects. time() does I/O to the clock chip to
see what time it is, and random() uses and changes a global seed value
variable (which, in a double-whammy, takes its initial value from
time()).

Pure functions must be referentially transparent
[http://en.wikipedia.org/wiki/Referential_transparency_(computer_science)],
and as you've demonstrated, neither of those Python functions qualify.

Cheers,
Chris
--
http://blog.rebertia.com


== 9 of 12 ==
Date: Sun, Jan 31 2010 4:53 pm
From: John Bokma


Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au> writes:

> On Sun, 31 Jan 2010 14:47:08 -0600, John Bokma wrote:
>
>> An editor can correct the indenting of the braces example but can't with
>> this one.
>>
>> if x:
>> if y:
>> foo()
>> else:
>> bar()
>>
>> While braces might be considered redundant they are not when for one
>> reason or another formatting is lost or done incorrectly.
>
> I've heard this argument before, and I don't buy it. Why should we expect
> the editor to correct malformed code?

I do expect my editor to assist me in coding. In Emacs I have to do some
effort to enter the broken C code in the earlier post, and when I
reformat the code, it will be lined out correctly. I can't do that with
the above example, because it's correctly formatted.

You don't have to buy my argument, I am not selling it.

While in the past I wrote that an editor can't make you that more
productive I want to take that back, on the record. Since I've switched
to Emacs the editor has saved me several times from minor issues. Either
because it refused to indent correctly thanks to a missing closing }, ), ]
or other error. With the correct mode in Emacs one gets, in my
experience, immediate feedback when making mistakes one otherwise find
during the run/compiling phase.

Note that I am also not selling Emacs. It's free after all.

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


== 10 of 12 ==
Date: Sun, Jan 31 2010 5:22 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 16:50:50 -0800, Chris Rebert wrote:

>>>> How do you call a function of no arguments?
>>>
>>> It's not really a function in that case, it's just a named constant.
>>> (Recall that functions don't/can't have side-effects.)
>>
>>
>>>>> time.time(), random.random()
>> (1264983502.7505889, 0.29974255140479633)
>>>>> time.time(), random.random()
>> (1264983505.9283719, 0.74207867411026329)
>>
>>
>> They don't look terribly constant to me.
>
> Those aren't functions in the pure functional programming sense; which
> is unsurprising since Python isn't a [pure] functional language. They
> both involve side-effects. time() does I/O to the clock chip to see what
> time it is, and random() uses and changes a global seed value variable
> (which, in a double-whammy, takes its initial value from time()).

Yes, but these tasks -- get the time, get a (pseudo) random number -- are
not unique to Python. Surely even Lisp and Haskell code will sometimes
need to know the time. Whether they are "pure functions" (functions in
the mathematical sense) or impure, they're still functions in some sense.
How do you deal with such impure functions?

--
Steven


== 11 of 12 ==
Date: Sun, Jan 31 2010 5:31 pm
From: Ed Keith


--- On Sun, 1/31/10, Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> wrote:

> From: Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au>
> Subject: Re: Python and Ruby
> To: python-list@python.org
> Date: Sunday, January 31, 2010, 8:22 PM
> On Sun, 31 Jan 2010 16:50:50 -0800,
> Chris Rebert wrote:
>
> >>>> How do you call a function of no
> arguments?
> >>>
> >>> It's not really a function in that case, it's
> just a named constant.
> >>> (Recall that functions don't/can't have
> side-effects.)
> >>
> >>
> >>>>> time.time(), random.random()
> >> (1264983502.7505889, 0.29974255140479633)
> >>>>> time.time(), random.random()
> >> (1264983505.9283719, 0.74207867411026329)
> >>
> >>
> >> They don't look terribly constant to me.
> >
> > Those aren't functions in the pure functional
> programming sense; which
> > is unsurprising since Python isn't a [pure] functional
> language. They
> > both involve side-effects. time() does I/O to the
> clock chip to see what
> > time it is, and random() uses and changes a global
> seed value variable
> > (which, in a double-whammy, takes its initial value
> from time()).
>
> Yes, but these tasks -- get the time, get a (pseudo) random
> number -- are
> not unique to Python. Surely even Lisp and Haskell code
> will sometimes
> need to know the time. Whether they are "pure functions"
> (functions in
> the mathematical sense) or impure, they're still functions
> in some sense.
> How do you deal with such impure functions?
>
>
>

You pass it a monad (http://en.wikipedia.org/wiki/Monad_(functional_programming)).

-EdK

Ed Keith
e_d_k@yahoo.com

Blog: edkeith.blogspot.com


== 12 of 12 ==
Date: Sun, Jan 31 2010 5:33 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 18:47:42 -0600, John Bokma wrote:

> Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au> writes:
>
>> On Sun, 31 Jan 2010 14:47:08 -0600, John Bokma wrote:
>>
>>> An editor can correct the indenting of the braces example but can't
>>> with this one.
>>>
>>> if x:
>>> if y:
>>> foo()
>>> else:
>>> bar()
>>>
>>> While braces might be considered redundant they are not when for one
>>> reason or another formatting is lost or done incorrectly.
>>
>> I've heard this argument before, and I don't buy it. Why should we
>> expect the editor to correct malformed code?
>
> Or a prettyfier. It doesn't matter. The point is that with braces there
> *is* redundancy that be used to fix the code.

Prettyfiers are significant in languages that allow braces (or begin/end
tokens) and indentation to go out of sync. Since that can't happen with
Python, it's not a problem that needs solving. Prettyfiers exist to work
around a limitation of languages where indentation is not significant.

Arguing that an advantage of braces is that prettyfiers can work with
them easily is a silly argument. That's like saying an advantage of horse-
drawn buggies over cars is that it will go faster when you hit the horse
with a whip. That's true, but you only need the whip because of the lack
of accelerator pedal.

A much better argument would be that an advantage of significant
indentation is that you no longer need a prettyfier, and a second
advantage is a major reduction in flame wars over coding styles.

>> Would you expect your editor to correct this malformed code?
>>
>> result = sin(x+)y
>
> Nice straw man.


It's not a straw man. It's a serious argument. There is an infinite
number of problems with malformed code that your editor can't fix, and
your prettifier can't deal with. Why should we care if indentation is one
more?

There are tools out there (such as some web forum software) that corrupt
whitespace. Those tools are broken, and if you (generic you), as a
developer, are relying on those tools to code with, then shame on you.
And if you're the creator of such broken tools, then shame on you more.
You wouldn't arbitrarily decide to remove leading "E"s from the user's
text, or trailing full stops, so why do you arbitrarily remove whitespace?

> Let me repeat again: I am ok with how Python works. To be honest I think
> it's cleaner compared to using {}. But in there are real life examples
> in which Python code will break where code with braces will survive.

Yes. So what? They are rare and insignificant in practice. For every line
of code that you get via a webforum that mangles indentation, you get ten
thousand lines of code from some place that doesn't.

So long as code is written by and for human beings, the benefit of
significant indentation is 100% practical, and the practical benefit of
braces will remain insignificant.

--
Steven

==============================================================================
TOPIC: PEP 3147 - new .pyc format
http://groups.google.com/group/comp.lang.python/t/7a0d8230a5907885?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Jan 31 2010 2:37 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 09:06:18 -0600, John Bokma wrote:

> Based on the magic numbers I've seen so far it looks like that not an
> option. They increment with every minor change.

They increment with every *incompatible* change to the marshal format,
not every change to the compiler.

> So to me, at this moment
> (and maybe it's my ignorance) it looks like a made up example to justify
> what to me still looks like a bad decision.

Of course it's a made-up example. But with Python now entering a period
where there is a moratorium on changes to the language, is it really so
difficult to imagine that the marshal format will settle down for a while
even as the standard library goes through upgrades?

--
Steven


== 2 of 2 ==
Date: Sun, Jan 31 2010 2:40 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 14:10:34 -0800, Dennis Lee Bieber wrote:

> Ugh... That would mean that for an application using, say 20
> files,
> one now has 20 subdirectories for what, in a lot of cases, will contain
> just one file each (and since I doubt older Python's will be modified to
> support this scheme, it will only be applicable to 3.x, and maybe a
> 2.7?)

If you only use one version of Python, then don't run it with the -R
switch.

Have you read the PEP? It is quite explicit that the default behaviour
of .pyc files will remain unchanged, that to get the proposed behaviour
you have to specifically ask for it.

--
Steven

==============================================================================
TOPIC: Keyboard input
http://groups.google.com/group/comp.lang.python/t/9f18e65916b8c115?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 2:40 pm
From: Steven D'Aprano


On Sun, 31 Jan 2010 14:10:34 -0800, Dennis Lee Bieber wrote:

> On Sun, 31 Jan 2010 11:51:46 +0000, "Mr.SpOOn" <mr.spoon21@gmail.com>
> declaimed the following in gmane.comp.python.general:
>
>> 2010/1/29 Gabriel Genellina <gagsl-py2@yahoo.com.ar>:
>> >
>> > That's strange. If you're using Linux, make sure you have the
>> > readline package installed.
>>
>> I'm using Linux. Ubuntu. I checked on synaptic and I have
>> readline-common. Do you mean something else?
>>
> But was your Python /built/ using readline?


How do you ensure that it is?

--
Steven

==============================================================================
TOPIC: Slow down while creating a big list and iterating over it
http://groups.google.com/group/comp.lang.python/t/327544bd08947046?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 2:42 pm
From: MRAB


marc magrans de abril wrote:
> Hi!
>
> ...I have found a good enough solution, although it only works if the
> number of patterns (clusters) is not very big:
> def classify(f):
> THERESHOLD=0.1
>
> patterns={}
> for l in enumerate(f):
> found = False
> for p,c in patterns.items():
> if dist(l,p) < THERESHOLD:
> found=True
> patterns[p] = c +1
>
> if not found:
> patterns[l] = 1
>
> return patterns
>
> This algorithm is O(n*np*m^2). Where n is the number of logs, np the
> number of patterns, and m is the log length (i.e. m^2 is the distance
> cost). So it's way better O(n^2*m^2) and I can run it for some hours
> to get back the results.
>
> I wonder if there is a single threaded/process clustering algorithm
> than runs in O(n)?
>
Your original code used the first entry in the remaining logs for each
pattern, but your new code stores the patterns in a dict, which is
unordered, so you might get different results.

But that doesn't matter, because your new code increments the count when
it has found a match, and then continues looking, so it might match and
increment more than once.

Finally, your original code treated it as a match if distance <=
threshold but your new code treats it as a match if distance <
threshold.

patterns = []
for x in logs:
for index, (pat, count) in enumerate(patterns):
if dist(pat, x) <= THRESHOLD:
patterns[index] = pat, count + 1
break
else:
# Didn't break out of the loop, therefore no match.
patterns.append((x, 1))

==============================================================================
TOPIC: create a string of variable lenght
http://groups.google.com/group/comp.lang.python/t/ea070cfc61ccfd9c?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Jan 31 2010 2:49 pm
From: MRAB


Tracubik wrote:
> Il Sun, 31 Jan 2010 13:46:16 +0100, Günther Dietrich ha
> scritto:
>
>> Maybe you might solve this if you decode your string to unicode.
>> Example:
>>
>> |>>> euro = "€"
>> |>>> len(euro)
>> |3
>> |>>> u_euro = euro.decode('utf_8')
>> |>>> len(u_euro)
>> |1
>>
>> Adapt the encoding ('utf_8' in my example) to whatever you use.
>>
>> Or create the unicode string directly:
>>
>> |>>> u_euro = u'€'
>> |>>> len(u_euro)
>> |1
>>
>>
>>
>> Best regards,
>>
>> Günther
>
> thank you, your two solution is really interesting.
> is there a possible to set unicode encoding by default for my python
> scripts?
> i've tried inserting
> # -*- coding: utf-8 -*-
>
> at the beginning of my script but doesn't solve the problem

That tells Python which encoding the file is using, but you still need
to save the file in that encoding.


== 2 of 2 ==
Date: Sun, Jan 31 2010 4:54 pm
From: Benjamin Kaplan


On Sun, Jan 31, 2010 at 5:12 PM, Tracubik <affdfsdfdsfsd@b.com> wrote:
> Il Sun, 31 Jan 2010 13:46:16 +0100, Günther Dietrich ha
> scritto:
>
>> Maybe you might solve this if you decode your string to unicode.
>> Example:
>>
>> |>>> euro = "€"
>> |>>> len(euro)
>> |3
>> |>>> u_euro = euro.decode('utf_8')
>> |>>> len(u_euro)
>> |1
>>
>> Adapt the encoding ('utf_8' in my example) to whatever you use.
>>
>> Or create the unicode string directly:
>>
>> |>>> u_euro = u'€'
>> |>>> len(u_euro)
>> |1
>>
>>
>>
>> Best regards,
>>
>> Günther
>
> thank you, your two solution is really interesting.
> is there a possible to set unicode encoding by default for my python
> scripts?
> i've tried inserting
> # -*- coding: utf-8 -*-
>
> at the beginning of my script but doesn't solve the problem


First of all, if you haven't read this before, please do. It will make
this much clearer.
http://www.joelonsoftware.com/articles/Unicode.html

To reiterate: UTF-8 IS NOT UNICODE!!!!

In Python 2, '*' signifies a byte string. It is read as a sequence of
bytes and interpreted as a sequence of bytes When Python encounters
the sequence 0x27 0xe2 0x82 0xac 0x27 in the code (the UTF-8 bytes for
'€') it interprets it as 3 bytes between the two quotes. It doesn't
care about characters or anything like that. u'*' signifies a Unicode
string. Python will attempt to convert the sequence of bytes into a
sequence of characters. It can use any encoding for that: cp1252,
utf-8, MacRoman, ISO-8859-15. UTF-8 isn't special, it's just one of
the few encodings capable of storing all of the possible Unicode
characters.

What the line at the top says is that the file should be read using
UTF-8. Byte strings are still just sequences of bytes- this doesn't
affect them. But any Unicode string will be decoded using UTF-8. IF
python looks at the above sequence of bytes as a Unicode string, it
views the 3 bytes as a single character. When you ask for it's length,
it returns the number of characters.

Solution to your problem: in addition to keeping the #-*- coding ...
line, go with Günther's advice and use Unicode strings.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

==============================================================================
TOPIC: ftp.storlines error
http://groups.google.com/group/comp.lang.python/t/f67e054132789d17?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 3:06 pm
From: Mik0b0


On Feb 1, 12:19 am, Chris Rebert <c...@rebertia.com> wrote:
> On Sun, Jan 31, 2010 at 2:07 PM, Mik0b0 <new...@gmail.com> wrote:
> > Good day/night/etc.
> > I am rather a newb in Python (learning Python 3). I am trying to
> > create a small script for FTP file uploads  on my home network. The
> > script looks like this:
>
> > from ftplib import FTP
> > ftp=FTP('10.0.0.1')
> > ftp.login('mike','*****')
> > directory='/var/www/blabla/'
> > ftp.cwd(directory)
> > ftp.retrlines('LIST')
> > print('<- - - - - - - - - >')
> > file_to_change='test'
> > file=1
> > file=open(file_to_change,'w')
>
> Here you open the file in (w)rite mode. Also, don't call it `file` as
> that shadows the name of the built-in type.
>
> > text='test'
> > file.write(text)
>
> And indeed, here you've written something to it.
>
> > ftp.storlines('STOR ' + file_to_change,file)
>
> storlines() needs a file opened in (r)ead mode however, hence the
> error. Obviously, it needs to read the contents of the file in order
> to send it over the network.
> Either do the writing separately, close the file, and then open it
> again in read mode, or open it in one of the modes that allows for
> both reading and writing [see help(open) for details].
>
> Cheers,
> Chris
> --http://blog.rebertia.com
>
> > ftp.retrlines('LIST')
> > file.close()
>
> > The output is like this:
> > Traceback (most recent call last):
> >  File "ftp.py", line 13, in <module>
> >    ftp.storlines('STOR ' + file_to_change,i)
> >  File "/usr/lib/python3.1/ftplib.py", line 474, in storlines
> >    buf = fp.readline()
> > IOError: not readable
>
> > What is wrong?

Thanks Chris,
the final version looks like this and it works:

from ftplib import FTP
ftp=FTP('10.0.0.1')
ftp.login('mike','******')
directory='/var/www/blabla/'
ftp.cwd(directory)
ftp.retrlines('LIST')
print('<- - - - - - - - - >')
file_to_change='test.php'
i=1
i=open(file_to_change,'w')
text='test'
i.write(text)
i.close()
i=open(file_to_change,'rb')
ftp.storbinary('STOR ' + file_to_change,i)
ftp.retrlines('LIST')
i.close()

==============================================================================
TOPIC: gmtime
http://groups.google.com/group/comp.lang.python/t/ffc89a42b4e893f6?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Jan 31 2010 4:01 pm
From: gazza


On Jan 31, 3:27 pm, gazza <burslem2...@yahoo.com> wrote:
> Hi,
>
> I am trying to discover how to obtain the correct time of say CST/
> America and EST/America in python?
>
> Any help on this would be appreciated.
>
> Thanks,
> Garyc

I found some information. Someone suggested I use the pytz library?

Cheers,
Garyc


== 2 of 2 ==
Date: Sun, Jan 31 2010 5:19 pm
From: pograph


On Jan 31, 4:01 pm, gazza <burslem2...@yahoo.com> wrote:
> On Jan 31, 3:27 pm, gazza <burslem2...@yahoo.com> wrote:
>
> > Hi,
>
> > I am trying to discover how to obtain the correct time of say CST/
> > America and EST/America in python?
>
> > Any help on this would be appreciated.
>
> > Thanks,
> > Garyc
>
> I found some information. Someone suggested I use the pytz library?
>
> Cheers,
> Garyc

tz = pytz.timezone('US/Pacific')
t = datetime.datetime.now(tz)

==============================================================================
TOPIC: recv_into(bytearray) complains about a "pinned buffer"
http://groups.google.com/group/comp.lang.python/t/33a3eaafe2948d0c?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Jan 31 2010 4:04 pm
From: Antoine Pitrou

Hello Andrew,

> I don't even know what a "pinned buffer" means, and searching python.org
> isn't helpful.
>
> Using a bytearray in Python 3.1.1 *does* work:
> [...]

Agreed, the error message is cryptic.
The problem is that socket.recv_into() in 2.6 doesn't recognize the new
buffer API which is needed to accept bytearray objects.
(it does in 3.1, because the old buffer API doesn't exist anymore there)

You could open an issue on the bug tracker for this.

Thank you

Antoine.


==============================================================================
TOPIC: iglob performance no better than glob
http://groups.google.com/group/comp.lang.python/t/d9a8617ec85e926d?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Jan 31 2010 4:22 pm
From: Kyp


On Jan 31, 1:06 pm, John Bokma <j...@castleamber.com> wrote:
> Kyp <k...@stsci.edu> writes:
> > Is there a way to get the first X # of files from a dir with lots of
> > files, that does not take a long time to run?
>
> Assuming Linux: what does time
>
>  ls thedir | head
>
> give?
>
> with thedir the name of the actual dir
about 3 seconds.

3.086u 0.201s 0:03.32 98.7% 0+0k 0+0io 0pf+0w

>
> Also how many is many files?
over 100K (I know I should not do that, but it's a temp dir holding
files to be transferred)
thanx, mark

== 2 of 2 ==
Date: Sun, Jan 31 2010 4:23 pm
From: Kyp


On Jan 31, 2:44 pm, Peter Otten <__pete...@web.de> wrote:
> Kyp wrote:
> > I have a dir with a large # of files that I need to perform operations
> > on, but only needing to access a subset of the files, i.e. the first
> > 100 files.
>
> > Using glob is very slow, so I ran across iglob, which returns an
> > iterator, which seemed just like what I wanted. I could iterate over
> > the files that I wanted, not having to read the entire dir.
>
> > So the iglob was faster, but accessing the first file took about the
> > same time as glob.glob.
>
> > Here's some code to compare glob vs. iglob performance,  it outputs
> > the time before/after a glob.iglob('*.*') files.next() sequence and a
> > glob.glob('*.*') sequence.
>
> > #!/usr/bin/env python
>
> > import glob,time
> > print '\nTest of glob.iglob'
> > print 'before       iglob:', time.asctime()
> > files = glob.iglob('*.*')
> > print 'after        iglob:',time.asctime()
> > print files.next()
> > print 'after files.next():', time.asctime()
>
> > print '\nTest of glob.glob'
> > print 'before        glob:', time.asctime()
> > files = glob.glob('*.*')
> > print 'after         glob:',time.asctime()
>
> > Here are the results:
>
> > Test of glob.iglob
> > before       iglob: Sun Jan 31 11:09:08 2010
> > after        iglob: Sun Jan 31 11:09:08 2010
> > foo.bar
> > after files.next(): Sun Jan 31 11:09:59 2010
>
> > Test of glob.glob
> > before        glob: Sun Jan 31 11:09:59 2010
> > after         glob: Sun Jan 31 11:10:51 2010
>
> > The results are about the same for the 2 approaches, both took about
> > 51 seconds. Am I doing something wrong with iglob?
>
> No, but iglob() being lazy is pointless in your case because it uses
> os.listdir() and fnmatch.filter() underneath which both read the whole
> directory before returning anything.
>
> > Is there a way to get the first X # of files from a dir with lots of
> > files, that does not take a long time to run?
>
> Here's my attempt. It turned out to be more work than expected, so I cut a
> few corners. It's Linux-only "works on my machine" code, but may give you
> some hints on how to proceed.
>
> from ctypes import *
> import fnmatch
> import glob
> import os
> import re
> from itertools import ifilter, imap
>
> class dirent(Structure):
>     "works on my machine ;)"
>     _fields_ = [
>         ("d_ino", c_long),
>         ("d_off", c_long),
>         ("d_reclen", c_ushort),
>         ("d_type", c_ubyte),
>         ("d_name", c_char*256)]
>
> direntp = POINTER(dirent)
>
> LIBC = "libc.so.6"
> cdll.LoadLibrary(LIBC)
> libc = CDLL(LIBC)
> libc.readdir.restype = direntp
>
> def diriter(dir):
>     "lazy partial replacement for os.listdir()"
>     # errors? what errors?
>     dirp = libc.opendir(dir)
>     if not dirp:
>         return
>     try:
>         while True:
>             ep = libc.readdir(dirp)
>             if not ep:
>                 break
>             yield ep.contents.d_name
>     finally:
>         libc.closedir(dirp)
>
> def filter(names, pattern):
>     "lazy partial replacement for fnmatch.filter()"
>     import posixpath
>
>     pattern = os.path.normcase(pattern)
>     r = fnmatch.translate(pattern)
>     r = re.compile(r)
>
>     if os.path is not posixpath:
>         names = imap(os.path.normcase, names)
>
>     return ifilter(r.match, names)
>
> def globiter(path):
>     "lazy partial replacement for glob.glob()"
>     dir, filename = os.path.split(path)
>     if glob.has_magic(dir):
>         raise ValueError("wildcards in directory not supported")
>     return filter(diriter(dir), filename)
>
> if __name__ == "__main__":
>     import sys
>     [pattern] = sys.argv[1:]
>     for name in globiter(pattern):
>         print name
>
> Peter

I'll give it a try, thanx for the reply.
mark


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en


Real Estate