[31932] in Perl-Users-Digest
Perl-Users Digest, Issue: 3195 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 2 14:09:26 2010
Date: Tue, 2 Nov 2010 11:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 2 Nov 2010 Volume: 11 Number: 3195
Today's topics:
Counting blocks of text <laredotornado@zipmail.com>
Re: Counting blocks of text <glex_no-spam@qwest-spam-no.invalid>
Foreach <bandar.coal@gmail.com>
Re: Foreach <jurgenex@hotmail.com>
Re: Foreach <sherm.pendley@gmail.com>
Re: Foreach <peter@makholm.net>
Re: Foreach <sherm.pendley@gmail.com>
Re: Foreach <hhr-m@web.de>
Re: Foreach <uri@StemSystems.com>
Solution to use of "delete" for hash keys <ela@yantai.org>
Re: use of "delete" for hash keys <tadmc@seesig.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 2 Nov 2010 06:50:40 -0700 (PDT)
From: laredotornado <laredotornado@zipmail.com>
Subject: Counting blocks of text
Message-Id: <0bcb26f5-71b4-4e2f-a4bc-c2d4bade1ed7@p1g2000yqm.googlegroups.com>
Hi,
I'm using Perl 5.8.9 for Mac 10.6.3. I am trying to parse log files
(log4j v1.2.4) and count identical blocks of text in my file. So
below is an example of the kinds of things I see in my log file
(notice that some blocks of text span several lines). I would like to
get identify the similar blocks of text and get a count of how many
times each occurs in the file. Any ideas how I can do this?
Thanks, - Dave
=====================example contents of a file =====================
ERROR com.myco.servlet.summer.SummerServlet - db gave null for
galleryId: 4
ERROR com.myco.servlet.common.SimpleLeadTrackerServlet - LEAD
INSERTION FAILED: Laughlin null null
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in campaignQueries.xml.
--- The error occurred while preparing the mapped statement for
execution.
--- Check the Campaign.getXmlBannerForSrcId.
--- Cause: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
201)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:
139)
at
com.ibatis.sqlmap.engine.mapping.statement.CachingStatement.executeQueryForList(CachingStatement.java:
97)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
567)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
541)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:
118)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:
94)
at com.myco.database.DataInterface.doOperation(DataInterface.java:
180)
at com.myco.database.DataInterface.doFullOperation(DataInterface.java:
158)
at com.myco.database.DataInterface.getResults(DataInterface.java:132)
at com.myco.database.DataInterface.getResults(DataInterface.java:357)
at com.myco.database.DataInterface.getResults(DataInterface.java:349)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.processRequest(SimpleLeadTrackerServlet.java:
129)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.doPost(SimpleLeadTrackerServlet.java:
250)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPageFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:
88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:344)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:
110)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:
84)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:
98)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:
95)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:
79)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:
55)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:
36)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:
188)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:
106)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:
80)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:
150)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:
237)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:
167)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
698)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.validateParameter(MappedStatement.java:
245)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
167)
... 62 more
ERROR com.myco.servlet.common.SimpleLeadTrackerServlet - LEAD
INSERTION FAILED: Laughlin null null
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in campaignQueries.xml.
--- The error occurred while preparing the mapped statement for
execution.
--- Check the Campaign.getXmlBannerForSrcId.
--- Cause: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
201)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:
139)
at
com.ibatis.sqlmap.engine.mapping.statement.CachingStatement.executeQueryForList(CachingStatement.java:
97)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
567)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
541)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:
118)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:
94)
at com.myco.database.DataInterface.doOperation(DataInterface.java:
180)
at com.myco.database.DataInterface.doFullOperation(DataInterface.java:
158)
at com.myco.database.DataInterface.getResults(DataInterface.java:132)
at com.myco.database.DataInterface.getResults(DataInterface.java:357)
at com.myco.database.DataInterface.getResults(DataInterface.java:349)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.processRequest(SimpleLeadTrackerServlet.java:
129)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.doPost(SimpleLeadTrackerServlet.java:
250)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPageFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:
88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:344)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:
110)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:
84)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:
98)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:
95)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:
79)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:
55)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:
36)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:
188)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:
106)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:
80)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:
150)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:
237)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:
167)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
698)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.validateParameter(MappedStatement.java:
245)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
167)
... 62 more
ERROR com.myco.servlet.search.GoogleMiniSearchProxy - search(String
searchParams): Exception Thrown.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:
860)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:
801)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:
726)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
1049)
at
com.myco.servlet.search.GoogleMiniSearchProxy.search(GoogleMiniSearchProxy.java:
88)
at
com.myco.servlet.search.GoogleMiniSearchProxy.search(GoogleMiniSearchProxy.java:
70)
at
com.myco.servlet.search.GoogleProxyServlet.doPost(GoogleProxyServlet.java:
40)
at
com.myco.servlet.search.GoogleProxyServlet.doGet(GoogleProxyServlet.java:
33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPageFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
698)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
ERROR com.myco.servlet.search.GoogleMiniSearchProxy -
search(HttpServletRequest request): Exception Thrown.
java.lang.Exception: Site search not available. Please try again
later.
at
com.myco.servlet.search.GoogleMiniSearchProxy.search(GoogleMiniSearchProxy.java:
100)
at
com.myco.servlet.search.GoogleMiniSearchProxy.search(GoogleMiniSearchProxy.java:
70)
at
com.myco.servlet.search.GoogleProxyServlet.doPost(GoogleProxyServlet.java:
40)
at
com.myco.servlet.search.GoogleProxyServlet.doGet(GoogleProxyServlet.java:
33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPageFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
698)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
ERROR com.myco.servlet.search.GoogleProxyServlet -
post(request,response)
java.lang.Exception: Site search not available. Please try again
later.
at
com.myco.servlet.search.GoogleMiniSearchProxy.search(GoogleMiniSearchProxy.java:
74)
at
com.myco.servlet.search.GoogleProxyServlet.doPost(GoogleProxyServlet.java:
40)
at
com.myco.servlet.search.GoogleProxyServlet.doGet(GoogleProxyServlet.java:
33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPageFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
698)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
ERROR com.myco.servlet.common.LeadTrackerServlet2 - [processRequest]
[sourceURL: not set]
ERROR com.myco.servlet.common.LeadTrackerServlet2 - [processRequest]
[LEAD INSERTION FAILED: ]
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in campaignQueries.xml.
--- The error occurred while preparing the mapped statement for
execution.
--- Check the Campaign.getXmlBannerForSrcId.
--- Cause: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
201)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:
139)
at
com.ibatis.sqlmap.engine.mapping.statement.CachingStatement.executeQueryForList(CachingStatement.java:
97)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
567)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
541)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:
118)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:
94)
at com.myco.database.DataInterface.doOperation(DataInterface.java:
180)
at com.myco.database.DataInterface.doFullOperation(DataInterface.java:
158)
at com.myco.database.DataInterface.getResults(DataInterface.java:132)
at com.myco.database.DataInterface.getResults(DataInterface.java:357)
at com.myco.database.DataInterface.getResults(DataInterface.java:349)
at
com.myco.servlet.common.LeadTrackerServlet2.processRequest(LeadTrackerServlet2.java:
105)
at
com.myco.servlet.common.LeadTrackerServlet2.doPost(LeadTrackerServlet2.java:
254)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPageFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
698)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.validateParameter(MappedStatement.java:
245)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
167)
... 33 more
====================end example contents of a file ===================
------------------------------
Date: Tue, 02 Nov 2010 10:32:40 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Counting blocks of text
Message-Id: <4cd02f18$0$89387$815e3792@news.qwest.net>
laredotornado wrote:
> Hi,
>
> I'm using Perl 5.8.9 for Mac 10.6.3. I am trying to parse log files
> (log4j v1.2.4) and count identical blocks of text in my file. So
> below is an example of the kinds of things I see in my log file
> (notice that some blocks of text span several lines). I would like to
> get identify the similar blocks of text and get a count of how many
> times each occurs in the file. Any ideas how I can do this?
>
> =====================example contents of a file =====================
> ERROR com.myco.servlet.summer.SummerServlet - db gave null for
> galleryId: 4
> ERROR com.myco.servlet.common.SimpleLeadTrackerServlet - LEAD
> INSERTION FAILED: Laughlin null null
> com.ibatis.common.jdbc.exception.NestedSQLException:
[... removed hundreds of useless errors... ]
> at
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
> 167)
> ... 33 more
You post hundreds of lines of errors, and don't include the last 33..
Very thoughtful. Next time, there's no need to post that many lines,
just post a few, showing different errors.
You don't say what you have already tried, but before you start
to write the code, first you need to define what you want to look
for in the file, that would constitute an error. e.g. does every
error start with 'ERROR '??, Does it start with a capital
letter?, etc.
Then you have to open the file and look for when that happens,
and keep track of the error and how many times it happened.
There are different ways to do it, but in general you'd:
open the file.
while you read the file, possibly line by line....
if the line contains the indicator of a new error.
if there was already a previous error that was found, then
store that previous, error.. maybe in a hash, and
increment the count.. e.g. $hash{ $error }++;
store the line as an error. $error = $_
else append the line to the previous error e.g. $error .= $_
close the file.
Be sure to capture the last error.. $hash{ $error }++;
Iterate through the keys in %hash, which are really the text of the
error, to find the error and how many times it occurred.
perldoc perlopentut
perldoc perlretut
perldoc -q 'How do I process an entire hash'
------------------------------
Date: Tue, 2 Nov 2010 07:13:56 -0700 (PDT)
From: perler wannabe <bandar.coal@gmail.com>
Subject: Foreach
Message-Id: <10f2ce75-26ed-488c-ad47-a61b02cca8c8@g25g2000yqn.googlegroups.com>
Hi,
I read from a book that "for" is actually "foreach". And foreach is
preferable in Perl. I can understand foreach is better if the counting
is from 1 to n. But what if the count start from 2 or 3 or more, how
can we use foreach in this case?
Thanks
------------------------------
Date: Tue, 02 Nov 2010 07:44:26 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Foreach
Message-Id: <kn80d6hmmdvfbdc2f32msbjc4idvdqv9js@4ax.com>
perler wannabe <bandar.coal@gmail.com> wrote:
>I read from a book that "for" is actually "foreach".
Yes, they are synonyms.
>And foreach is preferable in Perl.
Preferable to what? To for? How so if they are synonyms?
>I can understand foreach is better
Better than what?
>if the counting
>is from 1 to n. But what if the count start from 2 or 3 or more, how
>can we use foreach in this case?
for my $i (3..n) {
.....
}
jue
------------------------------
Date: Tue, 02 Nov 2010 11:09:42 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Foreach
Message-Id: <m2tyjz92yx.fsf@sherm.shermpendley.com>
perler wannabe <bandar.coal@gmail.com> writes:
> I read from a book that "for" is actually "foreach".
They're equivalent, yes.
> And foreach is preferable in Perl.
I think it's more accurate to say that Perl-style looping over lists
is preferable over C-style loops with three arguments. Iterating over
the items in a list is a very common operation in Perl, and Perl-style
loops provide a more elegant way of doing that.
> I can understand foreach is better if the counting
> is from 1 to n. But what if the count start from 2 or 3 or more, how
> can we use foreach in this case?
One way would be to use the range operator:
foreach my $i (30..300) {
# Do stuff with $i
}
sherm--
--
Sherm Pendley
<http://camelbones.sourceforge.net>
Cocoa Developer
------------------------------
Date: Tue, 02 Nov 2010 16:15:31 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: Foreach
Message-Id: <87r5f3rc30.fsf@vps1.hacking.dk>
Jürgen Exner <jurgenex@hotmail.com> writes:
> perler wannabe <bandar.coal@gmail.com> wrote:
>>I read from a book that "for" is actually "foreach".
>
> Yes, they are synonyms.
>
>>And foreach is preferable in Perl.
>
> Preferable to what? To for? How so if they are synonyms?
The perlsyn manual page have a scetion called 'For Loops' describing
C-style for loops and a section called 'Foreach loops' describing the
'iteration over a list value' functionality.
It also says that the"foreach" _keyword_ is actually a synonym for the
"for" _keyword_ and that Perl executes a "foreach" statement more
rapidly then i would the equivalent "for" loop.
So based on the official documentation the terminologi is murky at
best and it is not quite unacceptable to talk about 'foreach being
prefeaable to for'
//Makholm
------------------------------
Date: Tue, 02 Nov 2010 11:31:09 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Foreach
Message-Id: <m2pqun91z6.fsf@sherm.shermpendley.com>
Peter Makholm <peter@makholm.net> writes:
> The perlsyn manual page have a scetion called 'For Loops' describing
> C-style for loops and a section called 'Foreach loops' describing the
> 'iteration over a list value' functionality.
>
> It also says that the"foreach" _keyword_ is actually a synonym for the
> "for" _keyword_ and that Perl executes a "foreach" statement more
> rapidly then i would the equivalent "for" loop.
It's more accurate to say that 'iteration over a list' executes more
rapidly than a C-style loop, regardless of which keyword one happens
to use for either one.
> So based on the official documentation the terminologi is murky at
> best and it is not quite unacceptable to talk about 'foreach being
> prefeaable to for'
I agree. Since it's very common to write foreach() for list iteration
and for() for C-style loops - as you point out above, even perlsyn is
written that way - it's not *quite* wrong to say that foreach() is
preferable. It's not 100% accurate, though, since it isn't the keyword
choice that makes the performance difference.
sherm--
--
Sherm Pendley
<http://camelbones.sourceforge.net>
Cocoa Developer
------------------------------
Date: Tue, 2 Nov 2010 17:59:32 +0100
From: Helmut Richter <hhr-m@web.de>
Subject: Re: Foreach
Message-Id: <Pine.LNX.4.64.1011021740030.4290@lxhri01.ws.lrz.de>
On Tue, 2 Nov 2010, Sherm Pendley wrote:
> It's more accurate to say that 'iteration over a list' executes more
> rapidly than a C-style loop, regardless of which keyword one happens
> to use for either one.
That is, if I write "for my $i (1..1000000000)" I can be sure that perl
will not start by building a list of a billion entries?
--
Helmut Richter
------------------------------
Date: Tue, 02 Nov 2010 13:03:16 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Foreach
Message-Id: <87hbfzvesr.fsf@quad.sysarch.com>
>>>>> "HR" == Helmut Richter <hhr-m@web.de> writes:
HR> On Tue, 2 Nov 2010, Sherm Pendley wrote:
>> It's more accurate to say that 'iteration over a list' executes more
>> rapidly than a C-style loop, regardless of which keyword one happens
>> to use for either one.
HR> That is, if I write "for my $i (1..1000000000)" I can be sure that perl
HR> will not start by building a list of a billion entries?
that used to be the case in much older perls but today (i dunno when the
change was made but it was a good while ago) it will do an internal
iteration of large ranges.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Tue, 2 Nov 2010 15:14:04 +0800
From: "ela" <ela@yantai.org>
Subject: Solution to use of "delete" for hash keys
Message-Id: <iaodnv$to0$1@ijustice.itsc.cuhk.edu.hk>
"ela" <ela@yantai.org> wrote in message
news:ianjj7$kcn$1@ijustice.itsc.cuhk.edu.hk...
>I guess I do not create the data structure correctly because previously you
>taught me by this example script:
>
> my @ids = qw/2 1 4/;
> my %countries = qw(
> 3 Japan
> 1 USA
> 4 England
> 2 China
> 5 Australia
> );
>
> my %absent = map {$_ => 1} keys %countries;
> foreach $key (sort(keys %absent)) {print $key, '=', $absent{$key}, "\n";}
> print "\n";
> foreach $key (keys %absent) {print $key, '=', $absent{$key}, "\n";} delete
> $absent{$_} for @ids;
>
> print "missing countries:\n"; print "$_\n" for @countries{keys %absent};
>
>
> The above does work, when I adopted the concept to my data, which is like:
>
>>3
> Japan
>>4
> England
>>1
> USA
>>2
> China
>>5
> Australia
>
> by the following codes:
>
> $fline =<FFP>; #FFP is the file pointer for the above file
> %Priseq;
> while ($fline ne "") {
> chomp $fline;
> if ($fline =~ />/) {
> @fcells = split />/, $fline;
> $fline =<FFP>;
> $Priseq{ $fcells[1] } = $fline;
> }
> $fline =<FFP>;
> }
>
> and then another tab-delimited file contains data like:
>
> 1 North America
> 3 Asia
> 4 Europe
>
> is read by the following codes:
>
> $line =<TFP>; #TFP is the file pointer for the above file
> while ($line ne "") {
> if ($line eq "\n") {
> $line = <TFP>;
> next;
> }
> @cells = split /\t/, $line;
> $pattern = $cells[0]; #print "$pattern"; <STDIN>;
>
> if ($mode eq "p") { # $mode is the variable to make this program
> flexible, so I can choose to print present and absent values
> print OFP ">$pattern\n$Priseq{ $pattern }";
> } else {
> push @ids, $pattern;#print "$pattern"; <STDIN>;
> }
> $line = <TFP>;
> }
>
> Then the followings are the codes that I posted previously.
>
> if ($mode ne "p") {
> my %absent = map {$_ => 1} keys %Priseq;
> delete $absent{$_} for @ids;
> print ">$key\n$_\n" for @Priseq{keys %absent};
> }
>
>
> What data structures should I use then? Is that I shouldn't use "@" for
> Priseq? But I was taught previously to print the content, I have to use
> "@"......
The solution is as follows, why I include the commented lines is to show
that I did try debugging myself in order to understand the complex data
structures used in Perl.
my %absent = map {$_ => 1} keys %Priseq;
#foreach $key (sort(keys %absent)) {print $key, '=', $absent{$key},
"\n"; <STDIN>;}
delete $absent{$_} for @ids;
# foreach $key (keys %absent) {print $key, '=', $absent{$key}, "\n";
<STDIN>;}
#foreach $key (@ids) {delete $absent{$key};}
#foreach $key (@ids) {print $key, "\n"; <STDIN>;}
#foreach $key (keys %absent) {print $key, '=', $absent{$key}, "\n";
<STDIN>;}
foreach $key (keys %absent) { print OFP ">$key\n$Priseq{$key}"; }
#print ">$key\n$_\n" for @Priseq{keys %absent};
# if exists key
------------------------------
Date: Tue, 02 Nov 2010 08:22:10 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: use of "delete" for hash keys
Message-Id: <slrnid04g0.mai.tadmc@tadbox.sbcglobal.net>
ela <ela@yantai.org> wrote:
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
>> The above message is a Usenet post.
>> I don't recall having given anyone permission to use it on a Web site.
The Posting Guidelines say that you should not quote .sigs,
yet here you are, quoting sigs.
What are we supposed to think?
> I just posted the exercpt instead of
> dumping the whole codes and the big data files.
Nobody asked you to dump the whole code or big data files!
You were asked to post a short and complete program that illustrates
the problem you are having.
(Note how I made a short and complete program for you to run, you
should be able to do that for us too.
)
You were not asked for the actual program that you are working on.
You should make a new program that contains just the parts needed
to illustrate the problem that you are having.
If you are reading the file contents OK, then you should not show
code that reads the file contents for example.
If your code reads a file into an array, and that part is working OK,
then just post code that initializes the array to the same values it
would have gotten if you read them from a file.
> Another problem that I
> frequently encounter is that I just don't know what keywords I should use in
> order to Google/study documentation (In this example, hash array reference
> doesn't work at all).
That is because there ARE NO REFERENCES in the code in this thread.
I can't even remember what your question was anymore...
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 3195
***************************************