Sunday, 22 July 2012

ARMAssembler generated scanline__

I normolly get the message
generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x388750:0x38880c] in 712163 ns in logcat view, android.

While searching for ARMAssembler generated scanline__ on google I got the following results referring to scanline.cpp.
http://source-android.frandroid.com/system/core/libpixelflinger/scanline.cpp
or
http://gitorious.org/android-enablement/system-core/blobs/6090dacd1894429baaf13f7b30b2f6e9e2c1617f/libpixelflinger/scanline.cpp

The part of the code is like this


/* libs/pixelflinger/scanline.cpp
**
** Copyright 2006-2011, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License"); 
** you may not use this file except in compliance with the License. 
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/


#define LOG_TAG "pixelflinger"

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <cutils/memory.h>
#include <cutils/log.h>

#include "buffer.h"
#include "scanline.h"

#include "codeflinger/CodeCache.h"
#include "codeflinger/GGLAssembler.h"
#include "codeflinger/ARMAssembler.h"
//#include "codeflinger/ARMAssemblerOptimizer.h"

// ----------------------------------------------------------------------------

#define ANDROID_CODEGEN_GENERIC     0   // force generic pixel pipeline
#define ANDROID_CODEGEN_C           1   // hand-written C, fallback generic 
#define ANDROID_CODEGEN_ASM         2   // hand-written asm, fallback generic
#define ANDROID_CODEGEN_GENERATED   3   // hand-written asm, fallback codegen

#ifdef NDEBUG
#   define ANDROID_RELEASE
#   define ANDROID_CODEGEN      ANDROID_CODEGEN_GENERATED
#else
#   define ANDROID_DEBUG
#   define ANDROID_CODEGEN      ANDROID_CODEGEN_GENERATED
#endif

#if defined(__arm__)
#   define ANDROID_ARM_CODEGEN  1
#else
#   define ANDROID_ARM_CODEGEN  0
#endif

#define DEBUG__CODEGEN_ONLY     0

/* Set to 1 to dump to the log the states that need a new
 * code-generated scanline callback, i.e. those that don't
 * have a corresponding shortcut function.
 */
#define DEBUG_NEEDS  0

#define ASSEMBLY_SCRATCH_SIZE   2048

// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------

static void init_y(context_t*, int32_t);
static void init_y_noop(context_t*, int32_t);
static void init_y_packed(context_t*, int32_t);
static void init_y_error(context_t*, int32_t);

static void step_y__generic(context_t* c);
static void step_y__nop(context_t*);
static void step_y__smooth(context_t* c);
static void step_y__tmu(context_t* c);
static void step_y__w(context_t* c);

static void scanline(context_t* c);
static void scanline_perspective(context_t* c);
static void scanline_perspective_single(context_t* c);
static void scanline_t32cb16blend(context_t* c);
static void scanline_t32cb16blend_dither(context_t* c);
static void scanline_t32cb16blend_srca(context_t* c);
static void scanline_t32cb16blend_clamp(context_t* c);
static void scanline_t32cb16blend_clamp_dither(context_t* c);
static void scanline_t32cb16blend_clamp_mod(context_t* c);
static void scanline_x32cb16blend_clamp_mod(context_t* c);
static void scanline_t32cb16blend_clamp_mod_dither(context_t* c);
static void scanline_x32cb16blend_clamp_mod_dither(context_t* c);
static void scanline_t32cb16(context_t* c);
static void scanline_t32cb16_dither(context_t* c);
static void scanline_t32cb16_clamp(context_t* c);
static void scanline_t32cb16_clamp_dither(context_t* c);
static void scanline_col32cb16blend(context_t* c);
static void scanline_t16cb16_clamp(context_t* c);
static void scanline_t16cb16blend_clamp_mod(context_t* c);
static void scanline_memcpy(context_t* c);
static void scanline_memset8(context_t* c);
static void scanline_memset16(context_t* c);
static void scanline_memset32(context_t* c);
static void scanline_noop(context_t* c);
static void scanline_set(context_t* c);
static void scanline_clear(context_t* c);

static void rect_generic(context_t* c, size_t yc);
static void rect_memcpy(context_t* c, size_t yc);

extern "C" void scanline_t32cb16blend_arm(uint16_t*, uint32_t*, size_t);
extern "C" void scanline_t32cb16_arm(uint16_t *dst, uint32_t *src, size_t ct);
extern "C" void scanline_col32cb16blend_neon(uint16_t *dst, uint32_t *col, size_t ct);
extern "C" void scanline_col32cb16blend_arm(uint16_t *dst, uint32_t col, size_t ct);

// ----------------------------------------------------------------------------

static inline uint16_t  convertAbgr8888ToRgb565(uint32_t  pix)
{
    return uint16_t( ((pix << 8) & 0xf800) |
                      ((pix >> 5) & 0x07e0) |
                      ((pix >> 19) & 0x001f) );
}

struct shortcut_t {
    needs_filter_t  filter;
    const char*     desc;
    void            (*scanline)(context_t*);
    void            (*init_y)(context_t*, int32_t);
};

...........................

}

What actually is ARM?

ARM (formerly Advanced RISC Machine and Acorn RISC Machine) is a reduced instruction set computer (RISC) instruction set architecture (ISA) developed by ARM Holdings. The ARM architecture is the most widely used 32-bit instruction set architecture in numbers produced.


AutoCompleteTextView with SimpleAdapter


public class StopSimpleAdapter extends SimpleAdapter implements Filterable  {

 private ArrayList‹HashMap‹String, String›› mAllStops;
 private ArrayList‹HashMap‹String, String›› mStopsShown;
public StopSimpleAdapter(Context context, List stops, int resource, String[] from, int[] to) { super(context, stops, resource, from, to); mStopsShown = (ArrayList‹HashMap‹String, String››) stops; mAllStops = (ArrayList‹HashMap‹String, String››) mStopsShown.clone(); } @Override public Filter getFilter() { Filter nameFilter = new Filter(){ @Override public String convertResultToString(Object resultValue) { return ((HashMap‹String, String›)(resultValue)).get(Stop.NAME); } @Override protected FilterResults performFiltering(CharSequence constraint) { if(constraint != null) { ArrayList‹HashMap‹String, String›› tmpAllStops = mAllStops; ArrayList‹HashMap‹String, String›› tmpStopsShown = mStopsShown; tmpStopsShown.clear(); for(int i = 0; i ‹ tmpAllStops.size(); i++) { if(tmpAllStops.get(i).get(Stop.NAME).toLowerCase().startsWith(constraint.toString().toLowerCase())) { tmpStopsShown.add(tmpAllStops.get(i)); } } FilterResults filterResults = new FilterResults(); filterResults.values = tmpStopsShown; filterResults.count = tmpStopsShown.size(); return filterResults; } else { return new FilterResults(); } } @Override protected void publishResults(CharSequence constraint, FilterResults results) { if(results != null && results.count › 0) { notifyDataSetChanged(); } }}; return nameFilter; } }

Thursday, 12 July 2012

com.google.gwt.core.client.JavaScriptException: (TypeError): Object [object Window] has no method 'removeAttribute'


I got following error in my gwt project. The error sounds cool.


10:29:17.381 [ERROR] [projectname] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): Object [object Window] has no method 'removeAttribute'
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.google.gwt.dom.client.Element$.removeAttribute$(Element.java)
    at com.google.gwt.user.cellview.client.AbstractHasData.setFocusable(AbstractHasData.java:887)
    at com.google.gwt.user.cellview.client.AbstractCellTable.setKeyboardSelected(AbstractCellTable.java:1366)
    at com.google.gwt.user.cellview.client.AbstractHasData$View.setKeyboardSelected(AbstractHasData.java:125)
    at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1417)
    at com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1130)
    at com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:1055)
    at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
    at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228)
    at com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:327)
    at com.google.gwt.core.client.impl.Impl.exit(Impl.java:237)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:228)
    at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Thread.java:722)


As posted at Issue 7348: http://code.google.com/p/google-web-toolkit/issues/detail?id=7348 which mentions Without ui:field attribute, everything is fine.




SOLUTION
Here is what JavaScript removeAttribute does http://www.w3schools.com/jsref/met_element_removeattribute.asp

Monday, 9 July 2012

Access is denied (user is anonymous) spring error

I am getting the following error after successfully running the server but while logging in. The main page is shown partially and error is thrown.

PROBLEM
12:21:29.792 ["http-bio-8080"-exec-2] DEBUG o.s.s.w.a.ExceptionTranslationFilter - Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Access is denied
at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:71) ~[spring-security-core-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:204) ~[spring-security-core-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:114) ~[spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) ~[spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:95) ~[spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:79) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:119) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:340) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:175) [spring-security-web-3.1.0.RC2.jar:3.1.0.RC2]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.12]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.12]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) [catalina.jar:7.0.12]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) [catalina.jar:7.0.12]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) [catalina.jar:7.0.12]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) [catalina.jar:7.0.12]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) [catalina.jar:7.0.12]
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562) [catalina.jar:7.0.12]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.12]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395) [catalina.jar:7.0.12]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250) [tomcat-coyote.jar:7.0.12]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188) [tomcat-coyote.jar:7.0.12]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166) [tomcat-coyote.jar:7.0.12]
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) [tomcat-coyote.jar:7.0.12]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_04]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_04]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_04]
12:21:29.803 ["http-bio-8080"-exec-2] DEBUG o.s.s.w.s.HttpSessionRequestCache - DefaultSavedRequest added to Session: DefaultSavedRequest[http://localhost:8080/main?gwt.codesvr=127.0.0.1:9997]




REFERENCES


Sunday, 8 July 2012

...but no explicit binding was found.

PROBLEM
The following +GWT error was giving me pain.
"Binding requested for constant key Key[type=java.lang.String, annotation=[none]] but no explicit binding was found."

SOLUTION
I searched through Google, but worthless. After 24 hours, what i found was, in the constructor for View which was being @injected had an argument of type java.lang.String causing the error.


@Inject
public MyDetailsView(String fname) {
widget = (uiBinder.createAndBindUi(this));
}

Just after removing the argument of type java.lang.String, it worked brilliant.

MORE...
Similar error occurs when Constructor is @Injected on GWT Presenter with a argument but not supplying the arguement.
eg. 

@Inject
public SearchTransactionPresenter(boolean autoBind, EventBus eventBus, ISearchTransactionView view, ISearchTransactionProxyPlace proxy) {
super(autoBind, eventBus, view, proxy);
getView().setUiHandlers(this);
}

Primitive type boolean autoBind must be explicitly bound in GinModule.


REFERENCES

Same sort of error are posted here : how to diagnose "but no explicit binding was found" compiler error?