Wednesday, April 11, 2012

android remove a view from a dialog?

How would I remove a view from this dialog? I know I can remove a view from a LinearLayout.removeView(id)( LinearLayout.removeView(View) ), so if someone could tell me how to get (LinearLayout) R.layout.database_creation_form, that would be nice too. I am using Android-SDK V7



Java Code:



@Override
protected DialogInterface onCreateDialog(int id){
LayoutInflater factory = LayoutInflater.from(getBaseContext());
final View textEntryView = factory.inflate(R.layout.database_creation_form, null);
setDialogViewAttributes(textEntryView);
final EditText editText = (EditText)textEntryView.findViewById(R.id.create_form_db_name_et2);
final Spinner spinner = (Spinner)textEntryView.findViewById(R.id.create_form_type_sp);
return new AlertDialog.Builder(FileBase.this)
.setTitle(R.string.create_database_string)
.setView(textEntryView)
.show();
}


XML for database_creation_form:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:paddingTop="25px">


<TextView
android:id="@+id/create_form_db_name_tv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/create_form_db_name"
android:textAppearance="?android:attr/textAppearanceLarge" android:paddingBottom="25px"/>

<EditText
android:id="@+id/create_form_db_name_et2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:inputType="text">

<requestFocus />
</EditText>


<TextView
android:id="@+id/create_form_type_tv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/create_form_type"
android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center"/>

<Spinner
android:id="@+id/create_form_type_sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

</LinearLayout>




How does kAudioUnitSubType_NBandEQ work? Or equalizing using DSP formulas with Novocaine?

I'm trying to make a 10-band equalizer and the kAudioUnitSubType_NBandEQ audio unit seems the way to go, but Apple's documentation doesn't cover how to set/configure it.



I've already connected the nodes but it errors out when I try to connect the EQNode with the iONode (output): https://gist.github.com/2295463



How do I turn the effect into a working 10-band equalizer?



Update:
A working DSP formula with Novocaine is also a solution, any ideas! Those DSP formulas are quite complicated.



Update2:
I prefer a working DSP formula with Novocaine since that'd be much cleaner/smaller than programming Audio Nodes.



Update3:
"The Multitype EQ unit(of subtype kAudioUnitSubType_NBandEQ) provides an equalizer that can be configured as any one of the types described in "Mutitype EQ Unit Filter Types" (page 68)."
Source: http://developer.apple.com/library/ios/DOCUMENTATION/AudioUnit/Reference/AudioUnit_Framework/AudioUnit_Framework.pdf
But still no example.





Dynamic menu contribution with key bindings

I've a question. I have a dynamic menu contribution (class extending the ContributionItem). But I cannot find how to connect these items with key bindings.



The main problem is, that the plugin is actually quite easy. It loads menu from XML file. Practically it is a horror, because there is just few tutorials about dynamic menus. Almost every tutorial uses plugin.xml. But I cannot do it this way. I need to load items from a XML file depending on the workspace choosen. The file contains menu structure including key bindigs. That's my problem. I've never found how to bind keys with commands dynamically.





need help to rewrite url

Hi i am creating an API using JSON. I using a website with url "http://www.domain.com/api/". I have writtin all API with respect to their functions in a single handler file and accessing this handler file from an index file (for testing purpose from local server) such that the url is "http://www.domain.com/api/index.php" and i want this url to be "http://www.domain.com/api/".



My variable used for JSON is:



data = '{"appId":"'+appId+'", 
"m":"login",
"email":"abc@yahoo.com",
"pwd":"abcd",
"deviceToken": "111111111"}';


I am sending this using ajax from index file to fetch function defined in handler file.



I heard that we can do this using rewriting url. Can anyone tell me How to rewrite url for this and how to fetch these variables. "http://www.domain.com/api/". this function name is 'm' variable which is used to fetch respected function from handler file.



Can anyone help? I am new with JSON (though most of the work is complete, but i am unable to meet the url requirement)





Skip and copy Function assistance

New programmer here. I need some help. So basically what im trying to do here is to copy certain parts of 1 string stored in an array into 3 different arrays by ignoring the "," in the string. I'll show you the code to be more clear.



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

main()
{
char temp[50];
char temp1[50],temp2[50],temp3[50];
int i,m;
strcpy(temp,"abc,123,rio");
for(i=0;i<strlen(temp);i++)
{
//printf("%c\n",temp[i]);
if (temp[i]==',')
temp[i]=='';
else
temp1[i]=temp[i];
}
printf("%s\n",temp1);
return 0;
}


Now the problem comes in at the part where it says "temp[i]==''"
I know that line is wrong. But i need some help there. I want to be able to skip the "," and move on to copy 123 in temp2 and rio in temp 3. So far i was only able to copy abc into temp1. I don't know exactly how to "Skip and copy" the rest. Please help fast ! :]





MySQL select procedure

I have little weird issue here. So, I have these two tables. For example:



tbl1            tbl2

col1 col1 col2
---- ---- ----
BET BET 0
EMK EMK 1
BET EMK 3
EMK BET 4
BET BET 5
ANC


What I would like to do is to have a procedure (for now a select query will do) that selects data from tbl1 and compares it to tbl2 and return the following result:



col1  col2
---- ----
BET 0
EMK 1
BET null
EMK 3
BET 4
ANC 5


I have no idea how to even begin this... Is there any way to, maybe use an if..else within a select statement?... Please, help! Thank you in advance!



EDIT



I'm sorry for not being very clear.
I need it to to show null for an item in the first table that does not follow the order of the second table.
Here we have BET in both tbl1 and tbl2, therefore col2 should be 0,
next, EMK in both -> col2 - 1
next, BET is not in tbl2 (it does not go right after row 2 with value EMK) - set col2 to null.
next, EMK in tbl1, there is also EMK in tbl2, that goes after previous EMK, set col2 to 3
next, BET in tbl1 and tbl2, set col2 - 4
next, ANC in both tables, col2 - 5.



I apologize for this gibberish, but this the best I can do to explain this logic...





executing csv copy command from remote machine with jdbc

How to create stdin object to pass as a parameter to copy command for csv upload into db table and execute with jdbc api



Example that i tried



DataInputStream in = new DataInputStream(new BufferedInputStream(
new FileInputStream("C:/Documents and Settings/517037/Desktop/new.csv")));

copy temp123 from "+in.read()+" using delimiters '|'


But here i am getting error.



org.postgresql.util.PSQLException: ERROR: syntax error at or near "48"
Position: 19



can any one help me out in this