Posts

android - different getPath for different images -

i need set different getpath() different images . below sample describing getpath 1 image . not able understand how use setting 2 images . public string getpath(uri uri) { string[] projection = { mediastore.images.media.data }; cursor cursor = managedquery(uri, projection, null, null, null); if (cursor != null) { // here nullpointer if cursor null // can be, if used oi file manager picking media int column_index = cursor .getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); return cursor.getstring(column_index); } else return null; } bitmap :- public void decodefile(string filepath) { // decode image size bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; bitmapfactory.decodefile(filepath, o); // new size want scale final int required_size = 70; ...

c - What is unhandled excpetion error mean? -

i writing in visual studio,a c programm , error: unhandled exception @ 0x77dd3e14 in scicomput.exe: 0xc0000005: access violation reading location 0xff630018. can explain quite absolute beginner mean? it means trying access segment of memory doesn't "belong" program, i.e. memory haven't allocated, reserved. usually, causes such errors attempting write read-only memory or dereferencing null-pointers . "unhandled exception" means haven't provided way program handle errors when occur, crashes. note : can handle exceptions via try...catch mechanism in c++. http://msdn.microsoft.com/en-us/library/6dekhbbc.aspx c, however, doesn't support this.

python - Creating a Function to sum the results of an equation. Please look, Not so simple? -

i'm new programming , started using website. can't find similar simple problem. i'm using phyton 3.3. i'm creating code measures solar intensity on solar panels. did initially, decided make equations more complex better reflect real world situations. i'm putting simplified equation similar problem encountered: total=0 def equation(): x=2+i total+=x print (total) in range(1,32): #represents no of days in january (31 days) equation() in range (32,61): #represents no.of days in february (28days) equation() etc....for months this problem("total+=x). cannot add results x. error says "total" referenced before assignment. reference within function give me results (x) each iteration, not sum of iterations. the real equation contains more 15 lines of formulas. want insert equation onto different ranges (all 12 months of year). don't want copy , paste huge formula under each range. messy. prefer more efficient ...

javascript - Refresh DIV by command from server -

i want have page uses mysql database information, let's 0 or 1 i want page auto refresh div value 0 or 1 database @ specific interval. but viewing page same information @ same time. server in charge of interval. how this? there several possibilities: 1) websockets latest of technologies. if want near realtime update of page , have infrastructure providing possibilities, way go 2) comet or long polling second alternative 3) primitive - working - startingpoint poll server. stackoverflow article

java - Modifying data from an Async task in an entirely different class -

i know out of curiosity if there convenient ways of pulling data out of async task created inside class, , modifying data in class (without extending classes) i have way it, involves making methods static along async task itself for example, here i'm making string "text" in async task public class main extends activity{ //context ctx; static class myasynctask extends asynctask<void,string,string>{ static string result; private static context context; public myasynctask(context m) { this.context = m; } @override protected string doinbackground(void... noargs) { result = "text"; return result; } protected void onpostexecute(string result) { super.onpostexecute(result); } public static string getstr() { return result; } }; @override protected vo...

oop - Factory design pattern location of switch statements -

i trying wrap head around usefulness of factory design pattern. like many implementations of design pattern (ie http://msdn.microsoft.com/en-us/library/ee817667.aspx ) there switch statement in main() probes string decide concretecomputerfactory create (which later sent computerassembler.assemble(computerfactory factory) method). the way see problem: 1. user of factory (main()) "knows" concrete factory implementations definition of design pattern supposed hidden from. 2. whenever new concretecomputerfactory introduced, abstraction doesn't hold grounds! have go client (main()) add if/case statement. proposition: move if/switch statement/s computerassembler. (this has slight problem computerassembler has 2 reasons change: a. overall stuff related creation b. adding new concretecomputerfactory. but: better in client (main)) i assume don't grasp idea yet. hear why problems specified incorrect, , why proposition isn't better idea thanks :) the b...

sqlite - go programming: sqlite_master returns EOF using sqlite3 package -

i trying check if table exists after table creation "select name sqlite_master type='table' , name='testtable';" returns nothing ( eof ). doing wrong? sqlite3 package taken http://code.google.com/p/go-sqlite/source/browse/#hg%2fgo1%2fsqlite3 go version: 1.2.1 got: hello, world fileexists(dbname) returned: false database ok creating testtable... success! inserting something... checking testtable... failed scan variable, error: eof expected: hello, world fileexists(dbname) returned: false database ok creating testtable... success! inserting something... checking testtable... table detected code: package main import "os" import "fmt" import "time" import "code.google.com/p/go-sqlite/go1/sqlite3" func main() { dbname := "sqlite.db" defer time.sleep(5000 * time.millisecond) fmt.printf("hello, world\n") os.remove(dbname) fe := fileexists(dbname) fmt.printf("fileexists(dbname) return...