Sunday, 1 September 2013

show listview in synctask class android

show listview in synctask class android

i'm a beginner. I want to show a listview in asyncTask so I have this code
but I don't know how this wrong in the line below:
ListAdapter adapter =new SimpleAdapter(this,
result,android.R.layout.simple_list_item_1, new String[] {"planet"}, new
int[] {android.R.id.text1});
can you have me fix it?
My code:
public class MainActivity extends Activity {
List<Map<String, String>> planetsList;
ListAdapter simpleAdpt;
ListView lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lv=(ListView) this.findViewById(R.id.listView1);
planetsList = new ArrayList<Map<String,String>>();
initList();
simpleAdpt = new SimpleAdapter(this, planetsList,
android.R.layout.simple_list_item_1, new String[] {"planet"}, new
int[] {android.R.id.text1});
lv.setAdapter(simpleAdpt);
}
private void initList() {
// We populate the planets into planetslist
planetsList.add(createPlanet("planet", "Mercury"));
planetsList.add(createPlanet("planet", "Venus"));
planetsList.add(createPlanet("planet", "Mars"));
planetsList.add(createPlanet("planet", "Jupiter"));
planetsList.add(createPlanet("planet", "Saturn"));
planetsList.add(createPlanet("planet", "Uranus"));
planetsList.add(createPlanet("planet", "Neptune"));
}
private HashMap<String, String> createPlanet(String key, String name) {
HashMap<String, String> planet = new HashMap<String, String>();
planet.put(key, name);
return planet;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}

Mono on OSX: Absolute URIs are not supported

Mono on OSX: Absolute URIs are not supported

I am trying to run DocX with Mono under OSX. I'm using a recent build,
version 3.2.1. Building with xbuild is successful but the Hello World
example fails at runtime.
Basically, the create document function:
public static DocX Create(string filename) {
// Store this document in memory
MemoryStream ms = new MemoryStream();
// Create the docx package
Package package = Package.Open(ms, FileMode.Create, FileAccess.ReadWrite);
PostCreation(ref package);
DocX document = DocX.Load(ms);
document.filename = filename;
return document;
}
fails with:
Unhandled Exception:
System.ArgumentException: partUri
Parameter name: Absolute URIs are not supported
at System.IO.Packaging.Check.PartUri (System.Uri partUri) [0x00000] in
<filename unknown>:0
at System.IO.Packaging.Package.GetPart (System.Uri partUri) [0x00000] in
<filename unknown>:0
at Novacode.DocX.PopulateDocument (Novacode.DocX document,
System.IO.Packaging.Package package) [0x00000] in <filename unknown>:0
at Novacode.DocX.PostLoad (System.IO.Packaging.Package& package) [0x00000]
in <filename unknown>:0
at Novacode.DocX.Load (System.IO.Stream stream) [0x00000] in <filename
unknown>:0
at Novacode.DocX.Create (System.String filename) [0x00000] in <filename
unknown>:0
where Novacode is the namespace, filename is a relative path with
windows-like backslash, hence @"docs\hello.docx".
Being a beginner in CS/Mono, I don't get why the problem arises and why
the output doesn't detail a more precise location (it's a debug build by
default).

Delphi XE4 E2010 Incompatible types: 'Cardinal' and 'Pointer'

Delphi XE4 E2010 Incompatible types: 'Cardinal' and 'Pointer'

Hello i was trying to compile the firedac dll development sample under
delphi xe4 and it came up with the following error
[dcc32 Error] Unit1.pas(61): E2010 Incompatible types: 'Cardinal' and
'Pointer'
I have marked where the error is in the code.
Unit 1 is the executable.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uADStanIntf, uADStanOption, uADStanDef, uADPhysIntf,
uADDatSManager, uADStanParam, uADDAptIntf, StdCtrls, Grids, DBGrids,
DB, uADPhysManager, uADPhysMSAcc, uADGUIxFormsWait, uADCompGUIx,
uADCompDataSet,
uADCompClient, uADStanError, uADGUIxIntf, uADStanPool, uADStanAsync,
uADDAptManager, uADPhysODBCBase;
type
TShowDataProc = procedure (ACliHandle: LongWord); stdcall;
TShutdownProc = procedure; stdcall;
TForm1 = class(TForm)
ADConnection1: TADConnection;
ADQuery1: TADQuery;
ADGUIxWaitCursor1: TADGUIxWaitCursor;
ADPhysMSAccessDriverLink1: TADPhysMSAccessDriverLink;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
FhDll: THandle;
FpShowData: TShowDataProc;
FpShutdown: TShutdownProc;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
uADStanUtil;
procedure TForm1.Button1Click(Sender: TObject);
begin
FhDll := LoadLibrary(PChar('Project2.dll'));
if FhDll = 0 then
raise Exception.Create(ADLastSystemErrorMsg);
@FpShowData := GetProcAddress(FhDll, PChar('ShowData'));
if not Assigned(FpShowData) then
raise Exception.Create(ADLastSystemErrorMsg);
@FpShutdown := GetProcAddress(FhDll, PChar('Shutdown'));
if not Assigned(FpShutdown) then
raise Exception.Create(ADLastSystemErrorMsg);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
FpShowData(ADConnection1.CliHandle); << Error is here
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
FpShutdown();
FreeLibrary(FhDll);
FhDll := 0;
@FpShowData := nil;
@FpShutdown := nil;
end;
end.
Unit2 which is the dll
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uADStanIntf, uADStanOption, uADStanDef, uADPhysIntf,
uADDatSManager, uADStanParam, uADDAptIntf, Grids, DBGrids, DB,
uADPhysManager, uADPhysMSAcc, uADGUIxFormsWait, uADCompGUIx,
uADCompDataSet,
uADCompClient, uADStanError, uADGUIxIntf, uADStanPool, uADStanAsync,
uADDAptManager, uADPhysODBCBase;
type
TForm2 = class(TForm)
ADConnection1: TADConnection;
ADQuery1: TADQuery;
ADGUIxWaitCursor1: TADGUIxWaitCursor;
ADPhysMSAccessDriverLink1: TADPhysMSAccessDriverLink;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
public
class procedure ShowData(ACliHandle: LongWord);
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
{ TForm2 }
class procedure TForm2.ShowData(ACliHandle: LongWord);
var
oForm: TForm2;
begin
oForm := TForm2.Create(Application);
oForm.ADConnection1.SharedCliHandle := ACliHandle; <<<<<<<<<Error Here
oForm.ADConnection1.Connected := True;
oForm.ADQuery1.Active := True;
oForm.Show;
end;
end.

Saturday, 31 August 2013

Mention 2 modifications that can be done to a linked list data structure so that it is converted into a binary tree data structure?

Mention 2 modifications that can be done to a linked list data structure
so that it is converted into a binary tree data structure?

It's an A level question. I looked it out on google but only programs are
found. I need theory explanation.

In which ways do app developers cover costs of cloud services?

In which ways do app developers cover costs of cloud services?

I have a few ideas for mobile applications, some of which could benefit
from some cloud functionality.
For example, an application might allow a user to take photographs with
their phone which would generate a list of thumbnails, imagine a to-do
list which comprises photographs rather than the traditional text entries.
With the help of the cloud, the user could sync the thumbnails on multiple
devices, or perhaps give access to the list to another person using a push
notification to their phone, allowing them to then download the
thumbnails. There may also be a cloud-based database being used.
It's a simple scenario but it raises some questions for me.
Most mobile apps are currently either free (maybe monetised with ads) or
have an initial one-off cost, yet ongoing cloud services cost money. If I
developed an app that had 1,000,000 users all storing photos in the cloud
and they use the app for the next ten years then the cloud costs could be
substantial yet income from app sales may be low after the initial influx
of users.
So how do other developers manage ongoing cloud costs?
Are most apps that make use of the cloud subscription based?
Can someone who has already done this type of thing share their experience
regarding cloud costs and app monetisation?

Image div + text on hover

Image div + text on hover

Hey guys Im just wondering how to do a hover on image and fade the image a
colour with opacity 0.5. also with centered text. I know a bit how to do
it I'm just not sure if its purely css possible or jquery is required?
Thanks guys for help on this.

Error when creating table with mysqldb module

Error when creating table with mysqldb module

I'm trying to create a table with 2 columns using python's mysqldb module,
but I get an error, what might be wrong here?
cur.execute("CREATE TABLE foreign_crew(id VARCHAR() PRIMARY_KEY, surname
VARCHAR(45))")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 202, in
execute
self.errorhandler(self, exc, value)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in
defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near ') PRIMARY_KEY, surname VARCHAR(45))' at line 1")