As i described in title, i have a local db in sqlite. I want to create ImageButton parametrically. How many times is local database loop executing? Please see code below :
RelativeLayout outerRelativeLayout = (RelativeLayout)findViewById(R.id.relativeLayout2_making_dynamically);
db.open();
Cursor c = db.getAllLocal_Job_Data();
if(c!=null){
if(c.moveToFirst()){
do {
RelativeLayout innerRelativeLayout = new RelativeLayout(CalendarActivity.this);
innerRelativeLayout.setGravity(Gravity.CENTER);
ImageButton imgBtn = new ImageButton(CalendarActivity.this);
imgBtn.setBackgroundResource(R.drawable.color_001);
RelativeLayout.LayoutParams imageViewParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
imgBtn.setLayoutParams(imageViewParams);
// Adding the textView to the inner RelativeLayout as a child
innerRelativeLayout.addView(imgBtn, new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
outerRelativeLayout.addView(innerRelativeLayout, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
} while (c.moveToNext());
}
}
db.close();
But when i run the project, i can see only one button created there. I think there are many buttons but here image button is creating on last created image button. I think i should use android:layout_toRightOf with previous created button but i cant find how to place it here. I have tried some ideas but it did not change any thing. So please anybody has any idea to solve my problem then please share it with me.
Say I have my class
@interface Person : NSObject { NSString *name; }
I need to get the name of NSString's within my class
Person *person = [[Person alloc] init];
NSLog(@"Name of variable %s\n", NameofVariable(person.name));
I try to declare a variable in a code like this, but it's doesn't work. Can you tell me what's the problem?
ERROR: syntax error at or near "VARCHAR"
LINE 2: p_country VARCHAR;
DECLARE
p_country VARCHAR;
p_country : = '';
SELECT p_country;
I have a stored procedure that will return xml. I have delared a variable of type xml and trying to execute the following code
declare @v xml
set @v = execute get_xml @id, 33
whereas id is returned by another query. now it keeps compalinng about the following error
Incorrect syntax near the keyword 'execute'.
hi
function liveUpdate(fld,value,id) {
$.ajax({
type: 'POST',
url: 'myurl.html',
data: { fld:value, 'id': id },
success: function(data){//console.log(data);
}
});
}
i want fld to be posted as fld's value not the variable name fld? i've tried to wrap around with eval but no luck
any ideas?
thanks
Hi,
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 my @array = qw[a b c];
6 foreach my($a,$b,$c) (@array) {
7 print "$a , $b , $c\n";
8 }
I receive following error: Missing $ on loop variable
What is wrong?
I am using: perl v5.10.1 (*) built for x86_64-linux-thread-multi
INFORMIX-SQL or any other SQL-based DB:
Suppose I have an app where depending on the value of some columns, example:
company.code char(3) {abc}
company.brach char(2) {01}
Can I construct table name "abc01" for inclusion in SELECT * FROM abc01; ?
In other words, a variable table name.. same question applies for column names.
Hi
I need to do periodical background task fetching data from a weather site.
How in rails can I fetch json from a remote url and store it on the server? Also, there doesn't seem to be any point in storing this in a db so how in rails can I store a variable available to all users?
i can't read the variable in the function, i want to use it outside the function, here is my code.
var contentLoader:URLLoader = new URLLoader();
contentLoader.load(new URLRequest("http://localhost/data.php"));
function onComplete(event:Event):void
{
var txtu:String = event.target.data;
}
contentLoader.addEventListener(Event.COMPLETE, onComplete);
trace(txtu);
thanks.
hello java guys,
im thinking of a simple java app (command line) that connects to the internet to download xml file, the problem is that my ubuntu is using a proxy to connect to internet with username and password (tru http_proxy ="http://:@:" ). So My question is, could it be possible to write a java app to use http_proxy variable? instead of programmatically setting http proxy and host in every app i will write.
Hi
In my mode I am selecting a field as
$query1 = $this->db->query("SELECT dPassword
FROM tbl_login
WHERE dEmailID='[email protected]'");
How to return dpassword as a variable to my controller
I tried this way return dpassword;
I have a string of a variable length and at the end of the string are some digits. What would be the best / efficient way, to parse the string and get the number from the end as an Integer?
The String and the digits at the end can can be of any length. For example:
abcd123 -- 123
abc12345 -- 12345
ab4cd1 -- 1
I tryed to email me debug_backtrace() but it just prints out the array.
I need to assign it to a variable so that var_export can work with it.
How can i do that?
Say I have the following code:
public class ClassToTest
{
AnotherClass anotherClass;
public void methodToTest( int x, int y )
{
int z = x + y
anotherClass.receiveSomething( z );
}
}
public class AnotherClass
{
public void receiveSomething( int z ) {.. do something.. }
}
I want to make assertion on the value of the variable z. How do I do this? Variables x, y, and z could be some other Java class types, and I just used "int" for simplicity.
I would like to have direct access to the text inside a textbox on another form, so I added a public variable _txt to a form and added an event like so:
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
_txt = richTextBox1.Text;
}
But the form is loaded like this:
public FrmTextChild(string text)
{
InitializeComponent();
_txt = text;
richTextBox1.Text = _txt;
Text = "Untitled.txt";
}
Is there a better way to directly link the two?
How to create a function with variable number of arguments in visual basic?
ex.
x = Sum(1,2,3)
y = Sum(1,2)
Function Sum('how to declare argument here')
'Is there any special argument manipulation inside function before it is usable?
End Function
I want to display a certain in the template only if a certain GET variable is set....I thought using {% if request.get.my_var %} would work, but it's not giving me the results.
I'm trying to connect to a remote mysql server using PDO. However, regardless of the hostname or ip address i supply in the dsn, when the script is run it always reverts the address to the hostname of the local server where the webserver is running.
Google suggests this could be something to do with SELinux and apaches ability to connect to remote databases, however i have SELinux disabled.
Distro: Ubuntu 11.04 x64
Apache version: 2.2.17
PHP Version: PHP 5.3.5-1ubuntu7.11 with Suhosin-Patch (cli)
Edit:
Added code as requested. Though i dont believe this is an issue with my coding as it works fine on the local server, but doesnt allow remote connection.
public function db_connect($driver, $dbhost, $dbname, $user, $pass) {
$dsn = $driver . ':host=' . $dbhost . ';dbname=' . $dbname;
try {
$this->DB = new PDO($dsn, $user, $pass);
}
catch (PDOException $err) {
print 'Database Connection Failed: ' . $err->getMessage();
die();
}
}
$remote_db = new DB('mysql', 'remote_server.domain.tld', 'database_name', 'user_name', 'password');
This is the error message i am receiving.
Database Connection Failed: SQLSTATE[28000] [1045] Access denied for user 'user_name'@'local_server.domain.tld' (using password: YES)
Can I do this in C++ (if yes, what is the syntax?):
void func(string* strs) {
// do something
}
func({"abc", "cde"});
I want to pass an array to function, without instantiating it as a variable. Thanks for suggestions.
public struct Items
{
public string Id;
public string Name;
}
public Items[] _items = null;
if (_items.Contains("Table"))
{
// i need to check the structure and need to return correponding id
}
and am having a list of variables in my structure variable...
i need to search a Name in the structure(_items) and i want to return the Corresponding Id.
how to do this,
In JavaScript, there is no such thing as a "private" variable. In order to achieve encapsulation and information hiding in JavaScript, I can wrap a variable inside a function closure, like so:
var counter = (function() {
var i = 0;
var fn = {};
fn.increment = function() { i++; };
fn.get = function() { return i; };
return fn;
{)();
counter.increment();
counter.increment();
alert(counter.get()); // alerts '2'
Since I don't call i a private variable in JavaScript, what do I call it?
The standard method of implementing get and set accessors in C# and VB.NET is to use a public property to set and retrieve the value of a corresponding private variable. Am I right in saying that this has no effect of different instances of a variable? By this I mean, if there are different instantiations of an object, then those instances and their properties are completely independent right? So I think my understanding is correct that setting a private variable is just a construct to be able to implement the get and set pattern? Never been 100% sure about this.