Wednesday, April 18, 2012

Error: Failed to lookup view in Express

Note: my auto answer at end of the post



I'm trying to make a better experience of nodeJS and i don't really like to get all the script in one file.



so, following a post here i use this structure



./
config/
enviroment.js
routes.js
public/
css/
styles.css
images
views
index
index.jade
section
index.jade
layout.jade
app.js


My files are right now:



app.js



var express = require('express');
var app = module.exports = express.createServer();

require('./config/enviroment.js')(app, express);
require('./config/routes.js')(app);

app.listen(3000);


enviroment.js



module.exports = function(app, express) {
app.configure(function() {
app.use(express.logger());
app.use(express.static(__dirname + '/public'));
app.set('views', __dirname + '/views');
app.set('view engine', 'jade'); //extension of views

});

//development configuration
app.configure('development', function() {
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
});

//production configuration
app.configure('production', function() {
app.use(express.errorHandler());
});

};


routes.js



module.exports = function(app) {

app.get(['/','/index', '/inicio'], function(req, res) {
res.render('index/index');
});

app.get('/test', function(req, res) {
//res.render('index/index');
});

};


layout.jade



!!! 5
html
head
link(rel='stylesheet', href='/css/style.css')
title Express + Jade
body
#main
h1 Content goes here
#container!= body


index/index.jade



h1 algoa


The error i get is:




Error: Failed to lookup view "index/index"
at Function.render (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\application.js:495:17)
at render (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\response.js:614:9)
at ServerResponse.render (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\response.js:638:5)
at c:\xampp\htdocs\nodejs\buses\config\routes.js:4:7
at callbacks (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\router\index.js:177:11)
at param (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\router\index.js:151:11)
at pass (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\router\index.js:158:5)
at Router._dispatch (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\router\index.js:185:4)
at Object.router [as handle] (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\router\index.js:45:10)
at next (c:\xampp\htdocs\nodejs\buses\node_modules\express\node_modules\connect\lib\proto.js:191:15)




But i don't really know what is the problem...



I'm starting thinking is because the modules exports...



Answer:
Far away the unique solution i found is to change the place i defined app.set('views') and views engine



I moved it to the app.js and now is working well.



var express = require('express');
var app = module.exports = express.createServer();


require('./config/enviroment.js')(app, express);

app.set('views', __dirname + '/views');
app.set('view engine', 'jade');

require('./config/routes.js')(app);

app.listen(3000);


I don't really understand the logic behind this but i gonna supose it have one.





Asp.net: how to compare DataBinder.Eval with a member variable?

I am trying to do this in a repeater:



<%# Iif((int)DataBinder.Eval(Container.DataItem, "Id") == SelectedJobDefId, "blue", "red")%>


Problem is that the member property only evaluates if this syntax is used:



<%= SelectedJobDefId %>


DataBinder.Eval() only works if the hash symbol is used.



As a test, I tried this:



  <%= SelectedJobDefId %>
<%# DataBinder.Eval(Container.DataItem, "Id") + " " + SelectedJobDefId %>


The first SelectedJobDefId stays correct as I switch rows (LinkButton event).
The DataBinder part is correct for each row.
The 2nd output of SelectedJobDefId is always "1".



How can I compare these two values?





Automating C++ unit test runs for WinRT

Since running Metro apps headlessly is still a gray area: Running a metro app headlessly, I've recently decided to add a native unit test project to my Windows Metro app in hopes that I can find a way to run these unit tests in an automated fashion on the build server. Basically, I'm looking for something similar to MSTest.exe - a utility which is great for running tests from batch files and/or scripts.



In fact, I've tried using the new version of MSTest.exe that comes with VS11 on a generated test .dll, but it fails with the error:



"Unable to load the test container 'test.dll' or one of its dependencies... Error details: Could not load file or assembly file://test.dll' or one of its dependencies. The Module was expected to contain an assembly manifest."



Does MSTest.exe work with test containers that contain WinRT code? If not, is there a utility that will do what I want?





What's the best way to cast a custom Class in PHP

I know off the bat some of you will assume Interface or Abstract, but that only handles SOME of the situations. Here's an example where they break.



Assume we have classes that implement the same interface and extend the same base



  class car extends fourwheeler implements ipaygas{       

var tank1;

//interface
public function payGas($amount){}

}

class sportcar extends fourwheeler implements ipaygas{

var tank1;
var tank2;

//interface
public function payGas($amount){}

}

interface ipaygas{

function payGas($amount);
}


In some situations an interface is all you need as you may only want to execute 'payGas()'. But what do you do when you have conditions to be met.



Example, what if - before paying gas you need to (1) check the car type, (2) use premium gas for the sports car, and (3) fill the second tank of the sports car.



THIS IS WHAT I WANT TO DO BUT CANNOT



   function pumpAndPay((iPayGas) $car){
if(gettype($car) == "car"){
fillTank($car,(car) $car->tank1);
}else{
fillTank($car,(sportscar) $car->tank1);
fillTank($car,(sportscar) $car->tank2);
}
}


How can I do this with real type casting? Is it possible in PHP?





Play sound on internal speakers and possibility to use old xp api function?

After the release of windows vista the Windows Function Beep plays a beep on your connected speakers instead of the internal one.



Is there anyway to access the old function? Would it be possible by getting hold in an older windows api? Or is there any other way i can make this possible? If so i would like the ability to set both the frequency and duration.



I should mention that I´m actually targeting the windows xp platform.





How to disable an eventhandler when another is getting called

I have two event listeners on one input field. One gets called on change and one when you click on an autocomplete dropdown from google. My problem is when you click on such a autocompletion both handlers get called and make the request to the google api.



I tried to bind the onchange event and unbind it when the google autocomplete ajax call get fired, but the onchange event is executed first. So it will not get unbinded.
So, is there any possibility to detect if the user made the input manually or via autosugesstion? I want to execute the "requestlocation" function only when the user makes a manually input and doesn't use the autocomplete dropdown.
I tried it with some other eventhandler like "focus-out", but without success.



This line makes the bind:



autoCompleteInput.on "change", requestlocation


This is the function which get called:



requestlocation = () ->
address = autoCompleteInput.val()
geocoder = new google.maps.Geocoder()
geocoder.geocode
address: address, (results, status) ->
if status is google.maps.GeocoderStatus.OK

if results[0].address_components.length > 1
city = results[0].address_components[0].long_name
country = results[0].address_components[results[0].address_components.length-1].long_name
setHiddenFields results[0].geometry.location.lat(), results[0].geometry.location.lng(), city, country
autoCompleteInput.val(city+", "+country)
else
city = null
country = results[0].address_components[0].long_name
setHiddenFields results[0].geometry.location.lat(), results[0].geometry.location.lng(), city, country
autoCompleteInput.val(country)
setMarker new google.maps.LatLng(latInput.val(), lngInput.val())
else
console.log "Geocode was not successful for the following reason: " + status


This is the code where the autocomplete handler makes the request:



google.maps.event.addListener autocomplete, 'place_changed', ->
autoCompleteInput.off "change", requestlocation

place = autocomplete.getPlace()

if !!place.geometry
autoCompleteInput.attr "data-valid", "true"
setMarker place.geometry.location
address = place.address_components
if address.length > 1
setHiddenFields place.geometry.location.lat(), place.geometry.location.lng(), address[0].long_name, address[address.length-1].long_name
else
setHiddenFields place.geometry.location.lat(), place.geometry.location.lng(), null, address[0].long_name
else
autoCompleteInput.attr "data-valid", "false"

autoCompleteInput.on "change", requestlocation


Thanks for any answers!





Function/Library like preg_match_all(PHP) in iPhone programming

I' m searching function that will works like preg_match_all (or similar) from for example PHP.



I want give a pattern and my NSData object(with HTML content) then get all results that fits to pattern.



I' m programming iOS 5. Is there any library or function to do this ?





ruby Fakeweb error if a Mechanize agent's read_timeout= is called

I'm using Mechanize to spider some websites. While spidering I save pages to files that I use later with Fakeweb to do tests.



My Mechanize agent is created this way:



Mechanize.new do |a| 
a.read_timeout = 20 # doesn't work with Fakeweb?
a.max_history = 1
end


When I run my app enabling Fakeweb to fetch files instead of actual Internet access, my log throws these messages for every uri I try



W, [2011-08-20T18:49:45.764749 #14526]  WARN -- : undefined method `read_timeout=' for #<FakeWeb::StubSocket:0xb72c150c>


If I comment the second line in the above code (# a.read_timeout = 20 ...), it works perfectly. No problem at all. Any idea on how to enable read_timout and make Fakeweb work?



TIA





System i SQL WITH SELECT DISTINCT

I have the SQL below in place, and it has an unacceptable response time.



This is used with a DECLARE, PREPARE, OPEN and FETCH in an RPG Program where the selected fields are placed in host variables, populated in an array and then sorted [descending] for subfile display.



The 2 tables in use are not keyed at all (PFs), and they are joined below as shown in the WHERE clause.



Select DISTINCT B.Fld1, B.Fld2, B.Fld3, B.Fld4,
A.Fld1, A.Fld2, A.Fld3, A.Fld4, A.Fld5, A.Fld6, A.Fld7, A.Fld8, A.Fld9
From TableA A, TableB B
Where A.Fld2 = B.Fld5
And A.Fld1 = B.Fld6 || B.Fld7
And ((A.Fld7 BETWEEN <from-date> and <to-date>)
Or (A.Fld5 BETWEEN <from-date> and <to-date>))


I have rewritten this as a "true" left join, with no improvement.



I have also used 2 available LFs with A.Fld2 and A.Fld1 as keys, with minor improvement.



I feel a recursive SQL could do the trick, but I lack the experience to whip it out. I have the selects from each table created and functioning as desired by themselves. I just don't know how to put them together into one beautiful beast to get the result I desire.



This result set is roughly 10,000 rows for a week time period, and I need to see 2 weeks.



There are almost 6,000,000 records in TableA and about 160,000 in TableB.



Right now, the logic is




  1. Run a simple SQL before the one above.

  2. Cursor through the records and populate an array

  3. Run the SQL above.

  4. Cursor through the records and append to the same array

  5. Sort the array and use it to populate the subfile.



In debugging, I verified that the SQL above is the meat of the problem.



Truth is that I have 3 files that I believe can be joined into 1 result table to build the subfile.
If I can get past the query above, then 'I think I can' handle joining the other file.



My guess is there is someone out there that can "Whip this Out"! I once worked with him!



This is not an RPG, system i question. I have laid down some SQL like this in RPG before. Problem was that someone else wrote the SQL. : (





how can resolve the issue Conversion to Dalvik format failed with error 1?

i am working on inbuild email application in this application i am getting error logs in building time how can resolve issue



[2012-01-02 10:53:07 - AndroidMail] Dx 
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.ExceptionWithContext: bitIndex < 0: -1
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.util.ExceptionWithContext.withContext(ExceptionWithContext.java:46)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:344)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:483)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.run(Main.java:206)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:729)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:602)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project.build(Project.java:124)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.project.ProjectHelper.build(ProjectHelper.java:869)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:146)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-01-02 10:53:07 - AndroidMail] Dx Caused by: java.lang.IndexOutOfBoundsException: bitIndex < 0: -1
[2012-01-02 10:53:07 - AndroidMail] Dx at java.util.BitSet.set(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.ssa.SsaMethod.bitSetFromLabelList(SsaMethod.java:141)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.ssa.SsaBasicBlock.newFromRop(SsaBasicBlock.java:162)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.ssa.SsaMethod.convertRopToSsaBlocks(SsaMethod.java:174)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.ssa.SsaMethod.newFromRopMethod(SsaMethod.java:104)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:45)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:99)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
[2012-01-02 10:53:07 - AndroidMail] Dx ... 35 more
...while processing close ()V
...while processing android/media/AmrInputStream.class

[2012-01-02 10:53:07 - AndroidMail] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/android/server/ResettableTimeout$T;
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.run(Main.java:206)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:729)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:602)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project.build(Project.java:124)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.project.ProjectHelper.build(ProjectHelper.java:869)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:146)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-01-02 10:53:07 - AndroidMail] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/android/server/ResettableTimeout$T;
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.dx.command.dexer.Main.run(Main.java:206)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:729)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:602)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.resources.Project.build(Project.java:124)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.project.ProjectHelper.build(ProjectHelper.java:869)
[2012-01-02 10:53:07 - AndroidMail] Dx at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:146)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
[2012-01-02 10:53:07 - AndroidMail] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-01-02 10:53:07 - AndroidMail] Dx 3 errors; aborting
[2012-01-02 10:53:07 - AndroidMail] Conversion to Dalvik format failed with error 1


please forward some suggestion Thanks In Advance
Narasimha





Top-Left box alignment on a multi-line CheckBox with a large font

Working on a WinForms .Net 2.0 project, I need a checkbox to support multiple lines such that the box itself will be aligned to the top-left corner.

This is done using CheckAlign = System.Drawing.ContentAlignment.TopLeft, which different from the default (MiddleLeft).



When working with the default font this looks OK, but when the font becomes larger - what happens is that the gap above the text increases, yet the gap above the box itself remains constant.

The result is that the box appears above the text (see illustration below).



Any ideas?



I'd like to note that:




  1. I already tried a few option, such as using a custom designer, a TableLayoutPanel, etc., but didn't get far.

  2. .Net 2.0 is forced - upgrading is not an option.



Thanks in advance.



CheckBox Issues





Kinect for Windows gesture recognition

I have been looking at the Kinect for Windows release notes and features, since I want to incorporate gesture recognition in my project as well.



At the above page, the first line mentions that "The Kinect for Windows SDK enables developers to create applications that support gesture and voice recognition, ". Voice recognition API is available with the SDK and readily can be used. However, I don't think there are any gesture recognition APIs available in the SDK. The APIs of Skeleton Tracking are there to be used readily but then they have to be tailored with to get gesture recognition.



I have seen videos of Windows Media Center beng controlled by gestures etc. and other applications too. I wonder if all these applications are custom built and have to write their own gesture recognition code.



Currently, in my project I am using Kinect DTW Gesture Recognition from Codeplex. I am having two issues with this -> 1) Looks very performance hogging, and on enabling this with my app, my app throws OutofMemory exception after some time (PC specs are pretty high). 2) Can't say much about the robustness of the system. Works at times for some people and not for others.



I thought if the APIs would have been inbuilt, it would have been good to switch to these. Are these available or else what's the resolution?





List of other apps which can be terminated

I have an app where the requirement is to view all the user-initiated apps, which can be terminated. I tried searching, but didn't find a way to proceed. I am able to get all the processes, including system and user processes,b ut I need to filter only the apps which can be terminated. One way I found could be filtering based on pid, but I am not able to distinguish between pids of user and system processes.





New IOS5 UISwitch doesn't look disabled in a UITableViewCell

I'm placing a UISwitches in UITableViewCells and I try to disable it initially:



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
self.switch = [[UISwitch alloc] init];
self.switch.enabled = NO;
cell.accessoryView = self.switch;
...
}


In IOS versions prior to IOS5, the (old-looking) switch is disabled and also looks disabled (dimmed) when the view appears.



In IOS5 the (new-looking) switch is disabled alright, I can't flip it, but it does not look disabled at this stage. It has the same brightness as an enabled switch.



If I enable and re-disable it later in the code (NOT in the cellForRowAtIndexPath: callback), it does look disabled (dimmed).



Am I doing something wrong or is this a bug in IOS5?





MPMoviePlayerViewController can not play mp4 file

I'm working on a test application that will run an mp4 file from internet.
code is :



-(IBAction)playRemoteVideo
{

NSString *mp4File = @"http://archive.org/download/Pbtestfilemp4videotestmp4/video_test_512kb.mp4";

MPMoviePlayerViewController *playerController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:mp4File]];
[self presentMoviePlayerViewControllerAnimated:playerController];
playerController.moviePlayer.movieSourceType=MPMovieSourceTypeStreaming;

[playerController.moviePlayer play];
[playerController release];
playerController=nil;
}


When I run the application and played the video the player tries to load the video for a while but after I got this exception on console



2012-04-18 22:45:11.309 VideoPlayer[891:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An AVPlayerItem can occupy only one position in a player's queue at a time.'
*** First throw call stack:
(0x1df1052 0x1333d0a 0x27cfb31 0x27cbb2a 0x27e45cc 0x103b73 0xd4e6a 0x2ff2445 0x2ff44f0 0x1d28833 0x1d27db4 0x1d27ccb 0x16d8879 0x16d893e 0x24ea9b 0x1d12 0x1c85)
terminate called throwing an exception(gdb)


If I execute the same code with an m3u8 file , for instance;



http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8


I can get the video running but same does not work for mp4 file.



Do you have any idea why I got this exception and what's wrong with my code?



I run the application on Iphone simulator and I have XCode 4.2
Best Regards
Tugrul





Is there any way to save an ALAsset in a way that would work despite any changes to ALAssetLibrary?

I asked an earlier question similar to this (with no responses), but I know more about the problem, so I decided to rephrase it in a new one. I hope this is ok.



Essentially, I need to store some ALAssets in my app, specifically photos from the Camera Roll/Photo Library.



If the user switches out of the app, then takes some pictures or deletes some pictures, then the ALAssets that I have stored become invalid.



Is there any way around this? Is there any data from the ALAssets that I can store, such as a photo ID, a path, or anything, which will "survive" the ALAssetLibrary re-indexing itself?



Thank you!





Find ALL tweets from a user (not just the first 3,200)

With https://dev.twitter.com/docs/api/1/get/statuses/user_timeline I can get 3,200 most recent tweets. However, certain sites like http://www.mytweet16.com/ seems to bypass the limit, and my browse through the API documentation could not find anything.



How do they do it, or is there another API that doesn't have the limit?





Creating HTML pages from POJO data

If the task is to produce HTML document from some POJO bean, what is the simplest approach one can follow to get is done? Document is no more complicated then series of tables with headers and some merged elements here and there.



Solution we have today works, but is (concern) very highly coupled with the code engine that produces the bean and I'd like to either rewrite it or use an existing solution.



(concern) The main goal is too not worry about tags, html values, table structure etc and to keep these things as much out of .java as possible.



If at all possible, do provide examples. Thank you.





Facebook logout oAuth

I've had an annoying issue whereas the logout button provided was not working in the facebook api.



I searched for quite a while and eventually found my answer after going through several pages on google.



Strangely enough none of the top results were helping me.



So my question was "How do I properly logout(or simply destroy the facebook session)"





Can't upload to a specific folder getting 503 error

I am trying to upload a simple text file to a specific folder in google documents but with no luck.Here is the code:



          FileStream fileStream = new FileStream(@"c:\test.txt", System.IO.FileMode.Open);
DocumentEntry lastUploadEntry = globalData.service.UploadDocument("c:\\test.txt", null);


string feed = "https://docs.google.com/feeds/upload/create-session/default/private/full/folder%folder:0B2dzFB6YvN-kYTRlNmNhYjEtMTVmNC00ZThkLThiMjQtMzFhZmMzOGE2ZWU1/contents/";
var result = globalData.service.Insert(new Uri(feed), fileStream, "application/pdf", "test");


and i get an error saying {"The remote server returned an error: (503) Server Unavailable."}



I am suspecting that the destination folders uri is wrong but i can't figure out the correct one.





How to split the array values and store in a string in android?

I am getting the values from arraylist arr and storing those values in a string with comma separator. But for the last value also comma is adding. How can I remove that? Please help me...



My Code:



ArrayList<String> arr;  
String str;

for (int i = 0; i < arr.size(); i++) {

int kk = arr.size();
System.out.println("splitting test" + arr.get(i));
str += arr.get(i) + ",";

System.out.println("result" + str);


}




disable wordpress post type

I am using WP 3.3.1
need to disable post type selections (gallery, link) for users in wordpress





Windows form with list views, dragging and dropping, need source list view

Using VS 2008 I have a windows form with 2 ListViews (we will call them ListView1 and ListView2). ListView1 is populated with FileNames from a directory. When an item is dragged from ListView1 to ListView2 I have some code that is executed. When I dragDrop from ListView2 to ListView1 some code executes. What I want to do is NOT execute the code if you dragdrop from ListView2 onto itself



Here is the dragDrop Method which is invoked after a drop:



private void view_DragDrop(object dropTarget, DragEventArgs e)



I have tried a few items such as below:



ListView data = (ListView)e.Data.GetData("System.Windows.Forms.ListView")



This returns null what I wanted to do with the above is see if data = dropTarget, do not execute.





DefaultWorkItem does not allow group in Assigned To

I've created a new process template with TFS Power Tools. I added a group [project]\Developers. I changed the type definition of the Task-type so that "Assigned To" has 2 rules now:




  1. ALLOWEXISTINGVALUE

  2. ALLOWEDVALUES ([project]\Developers in list)



Now when I create a default work item and open the Assign To combo, it shows me "$$PROJECTNAME$$\Developers. If I select this, upload the template and try to create a team project the assistent comes up with the following error:




TF26214: Cannot save the work item. Fields with errors: Assigned To



TF237086: The work item cannot be saved because at least one field contains a value that is not allowed.




If I remove the default work item the team project is created successfully and I can add a new work item by hand using the Developers-group in Assinged To.





Large Ruby on Rails applications

Is there any large application written in Ruby, it would be interesting to know what is the aprox. number of code lines/classes?



How difficult is it to maintain an large Ruby on Rail application (especially would be interesting to know compared to c#, java)?





Automator/Applescript rename files if

I have a large list of images that have been misnamed by my artist. I was hoping to avoid giving him more work by using Automator but I'm new to it. Right now they're named in order what001a and what002a but that should be what001a and what001b. So basically odd numbered are A and even numbered at B. So i need a script that changes the even numbered to B images and renumbers them all to the proper sequential numbering. How would I go about writing that script?



images list





Properly freeing Protocol Buffer memory

I am using Google Protocol Buffers in the following way:



void myfunc() {
Buffers::MyBuffer buf;
buf.ParseFromArray(data, datalen);
...
return;
}


The documentation for Protocol Buffers says that to free memory for a buffer that the object should be deleted. I'm no C++ genius, but I thought delete should only be called for objects allocated with new. Is memory cleaned up on return here?





How to design a distributed system for "finding something within X miles"?

Question:




Design a distributed system to response the clients' query about "finding something within X miles".




If X is infinite, get all the "something" in the world (if they are all stored in your database)





Anyone using DynamoDB and Hive without using EMR?

I was reading the below integration of using Hive for querying data on DynamoDB.
http://aws.typepad.com/aws/2012/01/aws-howto-using-amazon-elastic-mapreduce-with-dynamodb.html



But as per that link, Hive needs to be setup on top of EMR. But I wanted to know if I can use this integration with the standalone Hadoop cluster I already have instead of using EMR. Has anyone done this? Will there be sync issues between data in DynamoDB and HDFS happen compared to using EMR?





WCF Client Proxies, Client/Channel Caching in ASP.Net - Code Review

long time ASP.Net interface developer being asked to learn WCF, looking for some education on more architecture related fronts - as its not my strong suit but I'm having to deal.



In our current ASMX world we adopted a model of creating ServiceManager static classes for our interaction with web services. We're starting to migrate to WCF, attempting to follow the same model. At first I was dealing with performance problems, but I've tweaked a bit and we're running smoothly now, but I'm questioning my tactics. Here's a simplified version (removed error handling, caching, object manipulation, etc.) of what we're doing:



public static class ContentManager
{
private static StoryManagerClient _clientProxy = null;
const string _contentServiceResourceCode = "StorySvc";

// FOR CACHING
const int _getStoriesTTL = 300;
private static Dictionary<string, GetStoriesCacheItem> _getStoriesCache = new Dictionary<string, GetStoriesCacheItem>();
private static ReaderWriterLockSlim _cacheLockStories = new ReaderWriterLockSlim();

public static Story[] GetStories(string categoryGuid)
{
// OMITTED - if category is cached and not expired, return from cache

// get endpoint address from FinderClient (ResourceManagement SVC)
UrlResource ur = FinderClient.GetUrlResource(_contentServiceResourceCode);

// Get proxy
StoryManagerClient svc = GetStoryServiceClient(ur.Url);

// create request params
GetStoriesRequest request = new GetStoriesRequest{}; // SIMPLIFIED
Manifest manifest = new Manifest{}; // SIMPLIFIED

// execute GetStories at WCF service
GetStoriesResponse response = svc.GetStories(manifest, request);

// OMITTED - do stuff with response, cache if needed
// return....
}

internal static StoryManagerClient GetStoryServiceClient(string endpointAddress)
{
if (_clientProxy == null)
_clientProxy = new StoryManagerClient(GetServiceBinding(_contentServiceResourceCode), new EndpointAddress(endpointAddress));

return _clientProxy;
}

public static Binding GetServiceBinding(string bindingSettingName)
{
// uses Finder service to load a binding object - our alternative to definition in web.config
}

public static void PreloadContentServiceClient()
{
// get finder location
UrlResource ur = FinderClient.GetUrlResource(_contentServiceResourceCode);

// preload proxy
GetStoryServiceClient(ur.Url);
}
}


We're running smoothly now with round-trip calls completing in the 100ms range. Creating the PreloadContentServiceClient() method and adding to our global.asax got that "first call" performance down to that same level. And you might want to know we're using the DataContractSerializer, and the "Add Service Reference" method.



I've done a lot of reading on static classes, singletons, shared data contract assemblies, how to use the ChannelFactory pattern and a whole bunch of other things that I could do to our usage model...admittedly, some of its gone over my head. And, like I said, we seem to be running smoothly. I know I'm not seeing the big picture, though. Can someone tell me what I've ended up here with regards to channel pooling, proxy failures, etc. and why I should head down the ChannelFactory path? My gut says to just do it, but my head can't comprehend why...



Thanks!