Thursday, April 12, 2012

Mouse drag in Alternativa3d 8?

So I see a couple good working examples of using the mouse to drag an object in Alternativa3d:



http://wonderfl.net/c/hrsq/read

http://www.thetechlabs.com/3d/dragging-3d-objects-in-flex-3-using-alternativa3d-and-actionscript-3/



but they are for previous versions of the engine, and they contain code that is now deprecated, with no straightforward forward-translation, if you will. Please help!





Facebook API re-showing user profile

Suppose a user gives my site permission to access their profile data.



Is it ok then if my site stores this data and then re-show it for view to other users on my site?



Note, my site would be explicit to the original user that this will occur.





App prints "ljava.lang.string;@40585b18" rather than array value

I have this printed "ljava.lang.string;@40585b18" instead of a vlaue from the string array called answers.



At the moment i am not picky really as to what is pritned out. Just get the app to display something meaningfull from the array will be a good place to start right now.



The following two lines of code is what currently prints:



TextView quesAns4 = (TextView) findViewById(R.id.answer3);



quesAns4.setText("4) " + answers) ;



package ks3.mathsapp.project;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class MathsMultiplicationActivity extends Activity {

TextView quesnum;
TextView ques;
TextView ans1;
TextView ans2;
TextView ans3;
TextView ans4;


int qno = 0;
int right_answers = 0;
int wrong_answers = 0;
int rnd1;
int rnd2;

String [] questions = {"How much mph does the F-Duct add to the car?",
"What car part is considered the biggest performance variable?",
"What car part is designed to speed up air flow at the car rear?",
"In seconds, how long does it take for a F1 car to stop when travelling at 300km/h?",
"How many litres of air does an F1 car consume per second?",
"What car part can heavily influence oversteer and understeer?",
"A third of the cars downforce can come from what?",
"Around how much race fuel would be consumed per 100km?","The first high nose cone was introduced when?",
"An increase in what, has led to the length of exhaust pipes being shortened drastically?"};

String [] [] answers = {{"3","5","8","9"},
{"Tyres","Front Wing","F-Duct","Engine"},
{"Diffuser","Suspension","Tyres","Exhaust"},
{"4","6","8","10"},
{"650","10","75","450"},
{"Suspension","Tyres","Cockpit","Chassis"},
{"Rear Wing","Nose Cone","Chassis","Engine"},
{"75 Litres","100 Litres","50 Litres","25 Litres"},
{"1990","1989","1993","1992"},
{"Engine RPM","Nose Cone Lengths","Tyre Size","Number of Races"}};

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.multiplechoice);

// Importing all assets like buttons, text fields
quesnum = (TextView) findViewById(R.id.questionNum);
ques = (TextView) findViewById(R.id.question);
ans1 = (TextView) findViewById(R.id.answer1);
ans2 = (TextView) findViewById(R.id.answer2);
ans3 = (TextView) findViewById(R.id.answer3);
ans4 = (TextView) findViewById(R.id.answer4);

TextView quesAns1 = (TextView) findViewById(R.id.answer1);
quesAns1.setText("1) " + answers) ;
TextView quesAns2 = (TextView) findViewById(R.id.answer2);
quesAns2.setText("2) " + answers) ;
TextView quesAns3 = (TextView) findViewById(R.id.answer3);
quesAns3.setText("3) " + answers) ;
TextView quesAns4 = (TextView) findViewById(R.id.answer3);
quesAns4.setText("4) " + answers) ;
}
}




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)