php mailer email something other than option value
I have built a form on my site that acts as a quote calculator, a user
selects options, each option has a value and those values are added up and
displayed as the final quote. I now need to be able to email that form
which I'm doing using a php mailer.
The issue I'm having is that as far as I can tell, the mailer just sends
the value of the selected options, and not the name. Below is a snippet of
code from my form:
<form action="quote_mailer.php" method="POST">
// Some more select options... //
<select class="select" id="singerName" name="singerName">
<option value="0" name="first"></option>
<option value="195" name="jack">Jack</option>
<option value="195" name="james">James</option>
<option value="195" name="toni">Toni</option>
<option value="195" name="yvonne">Yvonne</option>
</select>
<input type="submit" value="Send"><input type="reset" value="Clear">
</form>
And for my php:
<?php
$name = $_POST['quote_name'];
$email = $_POST['quote_email'];
$number = $_POST['quote_number'];
$singerName = $_POST['singerName'];
$formcontent="From: $name \n Number: $number \n Email: $email \n Event
Type: $eventType \n Singer Name: $singerName \n Instruments:
$instruments";
$recipient = "sam.skirrow@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $quote_email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
As you can see from the above code, in my email this returns "Singer Name:
195" as that is the option value, but I need it to return the option NAME
- is this possible?
Thursday, 3 October 2013
Wednesday, 2 October 2013
Django cannot save postgresql instance on heroku
Django cannot save postgresql instance on heroku
I am new to Django and Heroku. I just deployed my project following the
heroku documents. Part of settings.py is:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dfuldndi54p56q',
'HOST': 'ec2-54-227-251-13.compute-1.amazonaws.com',
'PORT': 5432,
'USER': 'pmotmgcaijwixy',
'PASSWORD': 'Wp0Gjf66JEC4mRKkvKrF22ptnj'
}
}
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.config()
part of models.py
class userInfo(models.Model):
"""The member information
"""
email = models.EmailField()
password = models.TextField()
account = models.CharField()
gender = models.CharField()
iconID = models.IntegerField()
gymID = models.IntegerField()
friendsNumber = models.IntegerField()
signature = models.CharField()
weibo = models.BooleanField()
in process.py:
try:
userInfo.objects.exists()
except DatabaseError:
user = userInfo()
else:
user = userInfo.objects.filter(email = email)
if user:
# check if the account is fully registered
if user.gymID:
return HttpResponse(content = 'user exist', status = 503)
user.email = email
pwmd5 = hashlib.md5(password)
user.password = pwmd5.hexdigest()
user.save()
after I push to heroku & syncdb, the following error occurred:
2013-10-03T01:40:49.936828+00:00 app[web.1]: Internal Server Error:
/ios/registerBasicInfo/json
2013-10-03T01:40:49.936828+00:00 app[web.1]: Traceback (most recent call
last):
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py",
line 115, in get_response
2013-10-03T01:40:49.936828+00:00 app[web.1]: response =
callback(request, *callback_args, **callback_kwargs)
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/server/ios/registerBasicInfo.py", line 50, in post
2013-10-03T01:40:49.936828+00:00 app[web.1]: user.save()
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py",
line 546, in save
2013-10-03T01:40:49.936828+00:00 app[web.1]:
force_update=force_update, update_fields=update_fields)
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py",
line 650, in save_base
2013-10-03T01:40:49.936828+00:00 app[web.1]: result =
manager._insert([self], fields=fields, return_id=update_pk, using=using,
raw=raw)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/manager.py",
line 215, in _insert
2013-10-03T01:40:49.937035+00:00 app[web.1]: return
insert_query(self.model, objs, fields, **kwargs)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py",
line 1675, in insert_query
2013-10-03T01:40:49.937035+00:00 app[web.1]: return
query.get_compiler(using=using).execute_sql(return_id)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
line 937, in execute_sql
2013-10-03T01:40:49.937035+00:00 app[web.1]: cursor.execute(sql, params)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/util.py",
line 41, in execute
2013-10-03T01:40:49.937035+00:00 app[web.1]: return
self.cursor.execute(sql, params)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
line 58, in execute
2013-10-03T01:40:49.937035+00:00 app[web.1]:
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)),
sys.exc_info()[2])
2013-10-03T01:40:49.937192+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
line 54, in execute
2013-10-03T01:40:49.937192+00:00 app[web.1]: return
self.cursor.execute(query, args)
2013-10-03T01:40:49.937192+00:00 app[web.1]: DatabaseError: current
transaction is aborted, commands ignored until end of transaction block
Any idea to solve it? I suffered it for days, appreciate your help!
I am new to Django and Heroku. I just deployed my project following the
heroku documents. Part of settings.py is:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dfuldndi54p56q',
'HOST': 'ec2-54-227-251-13.compute-1.amazonaws.com',
'PORT': 5432,
'USER': 'pmotmgcaijwixy',
'PASSWORD': 'Wp0Gjf66JEC4mRKkvKrF22ptnj'
}
}
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.config()
part of models.py
class userInfo(models.Model):
"""The member information
"""
email = models.EmailField()
password = models.TextField()
account = models.CharField()
gender = models.CharField()
iconID = models.IntegerField()
gymID = models.IntegerField()
friendsNumber = models.IntegerField()
signature = models.CharField()
weibo = models.BooleanField()
in process.py:
try:
userInfo.objects.exists()
except DatabaseError:
user = userInfo()
else:
user = userInfo.objects.filter(email = email)
if user:
# check if the account is fully registered
if user.gymID:
return HttpResponse(content = 'user exist', status = 503)
user.email = email
pwmd5 = hashlib.md5(password)
user.password = pwmd5.hexdigest()
user.save()
after I push to heroku & syncdb, the following error occurred:
2013-10-03T01:40:49.936828+00:00 app[web.1]: Internal Server Error:
/ios/registerBasicInfo/json
2013-10-03T01:40:49.936828+00:00 app[web.1]: Traceback (most recent call
last):
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py",
line 115, in get_response
2013-10-03T01:40:49.936828+00:00 app[web.1]: response =
callback(request, *callback_args, **callback_kwargs)
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/server/ios/registerBasicInfo.py", line 50, in post
2013-10-03T01:40:49.936828+00:00 app[web.1]: user.save()
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py",
line 546, in save
2013-10-03T01:40:49.936828+00:00 app[web.1]:
force_update=force_update, update_fields=update_fields)
2013-10-03T01:40:49.936828+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py",
line 650, in save_base
2013-10-03T01:40:49.936828+00:00 app[web.1]: result =
manager._insert([self], fields=fields, return_id=update_pk, using=using,
raw=raw)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/manager.py",
line 215, in _insert
2013-10-03T01:40:49.937035+00:00 app[web.1]: return
insert_query(self.model, objs, fields, **kwargs)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py",
line 1675, in insert_query
2013-10-03T01:40:49.937035+00:00 app[web.1]: return
query.get_compiler(using=using).execute_sql(return_id)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
line 937, in execute_sql
2013-10-03T01:40:49.937035+00:00 app[web.1]: cursor.execute(sql, params)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/util.py",
line 41, in execute
2013-10-03T01:40:49.937035+00:00 app[web.1]: return
self.cursor.execute(sql, params)
2013-10-03T01:40:49.937035+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
line 58, in execute
2013-10-03T01:40:49.937035+00:00 app[web.1]:
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)),
sys.exc_info()[2])
2013-10-03T01:40:49.937192+00:00 app[web.1]: File
"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
line 54, in execute
2013-10-03T01:40:49.937192+00:00 app[web.1]: return
self.cursor.execute(query, args)
2013-10-03T01:40:49.937192+00:00 app[web.1]: DatabaseError: current
transaction is aborted, commands ignored until end of transaction block
Any idea to solve it? I suffered it for days, appreciate your help!
Android Listview -How to set listview in getview() override. Listview taking parent layout instead of listview
Android Listview -How to set listview in getview() override. Listview
taking parent layout instead of listview
I have posted this earlier in forums but i guess i am not clear . I have a
sidebar Listview and a main panel which contains my controls. I want to
highlight the active item in listview in oncreate() as a new activity is
launched for each click in sidebar.Here is my listview layout for
reference-
But i am writing my GetView() override wrong ,so my layout is ending up
like this.
This is my Activity Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?android:attr/activatedBackgroundIndicator">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="4">
<TextView
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="@+id/textViewMenuA2"
android:text="Menu"
android:background="@android:color/background_dark"
android:textSize="20dp"
>
</TextView>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_gravity="center"
android:background="@android:color/holo_green_light"
android:minHeight="50dp"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
android:layout_marginTop="40dp"
android:layout_marginLeft="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time To Gather Knapsacks
"
android:id="@+id/textView4"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
android:layout_marginTop="0dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Number of KnapSacks"
android:id="@+id/textView5"
android:layout_marginLeft="28dp"
android:layout_marginTop="10dp"
android:textSize="15dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/numberKnapSack"
android:layout_marginLeft="200dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start Time"
android:id="@+id/A2Stbutton"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/textView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:id="@+id/A2textView2"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/numberKnapSack"
android:textSize="20dp"
android:layout_marginLeft="15dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="End Time"
android:id="@+id/A2Stopbutton2"
android:layout_marginLeft="25dp"
android:onClick="SetEndTime"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:id="@+id/A2textView3"
android:layout_marginLeft="212dp"
android:textSize="20dp"
android:layout_toLeftOf="@+id/A2button3"
android:layout_alignParentTop="true"
android:layout_alignBottom="@+id/A2button3"
android:layout_marginTop="45dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="2"
android:layout_alignBottom="@+id/A2button3"
android:layout_alignParentLeft="true"
android:layout_marginBottom="42dp"
android:layout_gravity="left|center_vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Next"
android:id="@+id/A2button3"
android:layout_marginTop="0dp"
android:onClick="NextActivity"
android:layout_marginRight="65dp"
android:layout_below="@+id/A2Stopbutton2"
android:layout_alignParentRight="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Take Picture"
android:id="@+id/button"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:id="@+id/imageView"
android:layout_below="@+id/button"
android:layout_toLeftOf="@+id/A2button3"
android:layout_marginTop="20dp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
This is my CustomAdapter
package com.example.listviewandroid;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* Created by polak_000 on 10/2/13.
*/
public class CustomAdapter extends BaseAdapter{
Context mycontext;
ArrayList<String> contactsList;
LayoutInflater minflater;
public CustomAdapter(Context context, ArrayList<String> list)
{
this.mycontext=context;
contactsList=list;
minflater =LayoutInflater.from(context);
}
@Override
public int getCount()
{
return contactsList.size();
}
@Override
public Object getItem(int position)
{
return contactsList.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position,View convertView,ViewGroup parent)
{
LayoutInflater inflater=(LayoutInflater)
mycontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view =inflater.inflate(R.layout.layout2,parent,false);
if (convertView !=null)
{
if (position ==1)
{
view.setBackgroundColor(Color.BLUE);
}
}
return view;
}
}
This is my Activity Code
package com.example.listviewandroid;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.text.format.Time;
import com.ball.sgxconnection.*;
import java.util.ArrayList;
/**
* Created by polak_000 on 9/26/13.
*/
public class Activity2 extends Activity {
ListView listView ;
static final String A2STE="";
static final String A2STM="";
static final String Knapsacks="";
private NBConnection sgxConnection;
@Override
protected void onCreate(Bundle savedInstanceState) {
sgxConnection = new NBConnection(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.layout2);
listView = (ListView) findViewById(R.id.listView);
ArrayList<String > list = new ArrayList<String>();
list.add("Test");
list.add("Test");list.add("Test");list.add("Test");list.add("Test");list.add("Test");
CustomAdapter adapter=new CustomAdapter(this,list);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new
AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
switch( position )
{
case 0: Intent newActivity = new
Intent(Activity2.this,MainActivity.class);
startActivity(newActivity);
break;
case 2: Intent newActivity1 = new
Intent(Activity2.this,Activity3.class);
startActivity(newActivity1);
break;
case 3: Intent newActivity2 = new
Intent(Activity2.this,Activity4.class);
startActivity(newActivity2);
break;
case 4: Intent newActivity3 = new
Intent(Activity2.this,Activity5.class);
startActivity(newActivity3);
break;
case 5: Intent newActivity4 = new
Intent(Activity2.this,Activity6.class);
startActivity(newActivity4);
break;
}
/* Toast.makeText(getApplicationContext(),
"Position :" + itemPosition + " ListItem : " +
itemValue, Toast.LENGTH_LONG)
.show();
*/
}
});
Time now = new Time();
now.setToNow();
TextView textview2= (TextView)findViewById(R.id.A2textView2);
textview2.setText(now.hour+" : "+now.minute);
if (savedInstanceState !=null)
{
restoreState(savedInstanceState);
}
this.listView.setSelector(R.drawable.selector_resource);
}
private void restoreState(Bundle savedInstanceState) {
EditText editText=(EditText)findViewById(R.id.numberKnapSack);
editText.setText(savedInstanceState.getString(Knapsacks));
TextView startime=(TextView)findViewById(R.id.A2textView2);
startime.setText(savedInstanceState.getString(A2STE));
TextView endtime=(TextView)findViewById(R.id.A2textView3);
endtime.setText(savedInstanceState.getString(A2STM));
}
public void SetEndTime(View view) {
Time now = new Time();
now.setToNow();
TextView textview3= (TextView)findViewById(R.id.A2textView3);
textview3.setText(now.hour+" : "+now.minute);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
EditText editText=(EditText)findViewById(R.id.numberKnapSack);
outState.putString(Knapsacks,editText.getText().toString());
TextView startime=(TextView)findViewById(R.id.A2textView2);
outState.putString(A2STE,startime.getText().toString());
TextView endtime=(TextView)findViewById(R.id.A2textView3);
outState.putString(A2STM,endtime.getText().toString());
}
public void NextActivity(View view) {
Intent newActivity1 = new Intent(Activity2.this,Activity3.class);
startActivity(newActivity1);
this.overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
}
}
Where am i going wrong ?
taking parent layout instead of listview
I have posted this earlier in forums but i guess i am not clear . I have a
sidebar Listview and a main panel which contains my controls. I want to
highlight the active item in listview in oncreate() as a new activity is
launched for each click in sidebar.Here is my listview layout for
reference-
But i am writing my GetView() override wrong ,so my layout is ending up
like this.
This is my Activity Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?android:attr/activatedBackgroundIndicator">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="4">
<TextView
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="@+id/textViewMenuA2"
android:text="Menu"
android:background="@android:color/background_dark"
android:textSize="20dp"
>
</TextView>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_gravity="center"
android:background="@android:color/holo_green_light"
android:minHeight="50dp"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
android:layout_marginTop="40dp"
android:layout_marginLeft="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time To Gather Knapsacks
"
android:id="@+id/textView4"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
android:layout_marginTop="0dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Number of KnapSacks"
android:id="@+id/textView5"
android:layout_marginLeft="28dp"
android:layout_marginTop="10dp"
android:textSize="15dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/numberKnapSack"
android:layout_marginLeft="200dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start Time"
android:id="@+id/A2Stbutton"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/textView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:id="@+id/A2textView2"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/numberKnapSack"
android:textSize="20dp"
android:layout_marginLeft="15dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="End Time"
android:id="@+id/A2Stopbutton2"
android:layout_marginLeft="25dp"
android:onClick="SetEndTime"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:id="@+id/A2textView3"
android:layout_marginLeft="212dp"
android:textSize="20dp"
android:layout_toLeftOf="@+id/A2button3"
android:layout_alignParentTop="true"
android:layout_alignBottom="@+id/A2button3"
android:layout_marginTop="45dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="2"
android:layout_alignBottom="@+id/A2button3"
android:layout_alignParentLeft="true"
android:layout_marginBottom="42dp"
android:layout_gravity="left|center_vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Next"
android:id="@+id/A2button3"
android:layout_marginTop="0dp"
android:onClick="NextActivity"
android:layout_marginRight="65dp"
android:layout_below="@+id/A2Stopbutton2"
android:layout_alignParentRight="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Take Picture"
android:id="@+id/button"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:id="@+id/imageView"
android:layout_below="@+id/button"
android:layout_toLeftOf="@+id/A2button3"
android:layout_marginTop="20dp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
This is my CustomAdapter
package com.example.listviewandroid;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* Created by polak_000 on 10/2/13.
*/
public class CustomAdapter extends BaseAdapter{
Context mycontext;
ArrayList<String> contactsList;
LayoutInflater minflater;
public CustomAdapter(Context context, ArrayList<String> list)
{
this.mycontext=context;
contactsList=list;
minflater =LayoutInflater.from(context);
}
@Override
public int getCount()
{
return contactsList.size();
}
@Override
public Object getItem(int position)
{
return contactsList.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position,View convertView,ViewGroup parent)
{
LayoutInflater inflater=(LayoutInflater)
mycontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view =inflater.inflate(R.layout.layout2,parent,false);
if (convertView !=null)
{
if (position ==1)
{
view.setBackgroundColor(Color.BLUE);
}
}
return view;
}
}
This is my Activity Code
package com.example.listviewandroid;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.text.format.Time;
import com.ball.sgxconnection.*;
import java.util.ArrayList;
/**
* Created by polak_000 on 9/26/13.
*/
public class Activity2 extends Activity {
ListView listView ;
static final String A2STE="";
static final String A2STM="";
static final String Knapsacks="";
private NBConnection sgxConnection;
@Override
protected void onCreate(Bundle savedInstanceState) {
sgxConnection = new NBConnection(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.layout2);
listView = (ListView) findViewById(R.id.listView);
ArrayList<String > list = new ArrayList<String>();
list.add("Test");
list.add("Test");list.add("Test");list.add("Test");list.add("Test");list.add("Test");
CustomAdapter adapter=new CustomAdapter(this,list);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new
AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
switch( position )
{
case 0: Intent newActivity = new
Intent(Activity2.this,MainActivity.class);
startActivity(newActivity);
break;
case 2: Intent newActivity1 = new
Intent(Activity2.this,Activity3.class);
startActivity(newActivity1);
break;
case 3: Intent newActivity2 = new
Intent(Activity2.this,Activity4.class);
startActivity(newActivity2);
break;
case 4: Intent newActivity3 = new
Intent(Activity2.this,Activity5.class);
startActivity(newActivity3);
break;
case 5: Intent newActivity4 = new
Intent(Activity2.this,Activity6.class);
startActivity(newActivity4);
break;
}
/* Toast.makeText(getApplicationContext(),
"Position :" + itemPosition + " ListItem : " +
itemValue, Toast.LENGTH_LONG)
.show();
*/
}
});
Time now = new Time();
now.setToNow();
TextView textview2= (TextView)findViewById(R.id.A2textView2);
textview2.setText(now.hour+" : "+now.minute);
if (savedInstanceState !=null)
{
restoreState(savedInstanceState);
}
this.listView.setSelector(R.drawable.selector_resource);
}
private void restoreState(Bundle savedInstanceState) {
EditText editText=(EditText)findViewById(R.id.numberKnapSack);
editText.setText(savedInstanceState.getString(Knapsacks));
TextView startime=(TextView)findViewById(R.id.A2textView2);
startime.setText(savedInstanceState.getString(A2STE));
TextView endtime=(TextView)findViewById(R.id.A2textView3);
endtime.setText(savedInstanceState.getString(A2STM));
}
public void SetEndTime(View view) {
Time now = new Time();
now.setToNow();
TextView textview3= (TextView)findViewById(R.id.A2textView3);
textview3.setText(now.hour+" : "+now.minute);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
EditText editText=(EditText)findViewById(R.id.numberKnapSack);
outState.putString(Knapsacks,editText.getText().toString());
TextView startime=(TextView)findViewById(R.id.A2textView2);
outState.putString(A2STE,startime.getText().toString());
TextView endtime=(TextView)findViewById(R.id.A2textView3);
outState.putString(A2STM,endtime.getText().toString());
}
public void NextActivity(View view) {
Intent newActivity1 = new Intent(Activity2.this,Activity3.class);
startActivity(newActivity1);
this.overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
}
}
Where am i going wrong ?
How to send an email via outlook with .asp
How to send an email via outlook with .asp
I'm not to familiar with this but i have done similar in the past.
Basically i want to have an html, or .asp page with a simple form for the
user to input data. I've accomplished this in VB.net with the following:
Imports Outlook = Microsoft.Office.Interop.Outlook
Private Sub cmdFax_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)Handles cmdFax.Click
Dim oApp As Outlook._Application
oApp = New Outlook.Application()
Dim oMsg As Outlook._MailItem
oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oMsg.Subject = ""
oMsg.Body = "" & vbCr & vbCr
If Len(txtEmail.Text) > 0 Then
oMsg.To = Me.txtEmail.Text
Else
oMsg.To = "[Fax:" & Me.txtAttn.Text & " @ " &
Me.txtFaxNum.Text & "]"
End If
Dim sSource As String = "C:\ValidPath.txt"
Dim sDisplayName As String = "Hello.txt"
Dim sBodyLen As String = oMsg.Body.Length
Dim oAttachs As Outlook.Attachments = oMsg.Attachments
Dim oAttach As Outlook.Attachment
If Len(Me.TextBox1.Text) > 0 Then
oAttach = oAttachs.Add(Me.TextBox1.Text)
Else
End If
oAttachs.Add(Me.cboForm.SelectedValue)
oMsg.Send()
oApp = Nothing
oMsg = Nothing
oAttach = Nothing
oAttachs = Nothing
'MsgBox("Your Fax Has Been Sent Successfully")
lblStatus.Text = "Fax Sent"
'lblStatus.Text = "Ready"
End If
End Sub
Is there anyway to accomplish the same thing using .asp? or is there an
easier way to do this using a contact form and .asp page? I'm just trying
to avoid using an external mail server and have the form send from the
actual user.
Open to any suggestions!
I'm not to familiar with this but i have done similar in the past.
Basically i want to have an html, or .asp page with a simple form for the
user to input data. I've accomplished this in VB.net with the following:
Imports Outlook = Microsoft.Office.Interop.Outlook
Private Sub cmdFax_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)Handles cmdFax.Click
Dim oApp As Outlook._Application
oApp = New Outlook.Application()
Dim oMsg As Outlook._MailItem
oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oMsg.Subject = ""
oMsg.Body = "" & vbCr & vbCr
If Len(txtEmail.Text) > 0 Then
oMsg.To = Me.txtEmail.Text
Else
oMsg.To = "[Fax:" & Me.txtAttn.Text & " @ " &
Me.txtFaxNum.Text & "]"
End If
Dim sSource As String = "C:\ValidPath.txt"
Dim sDisplayName As String = "Hello.txt"
Dim sBodyLen As String = oMsg.Body.Length
Dim oAttachs As Outlook.Attachments = oMsg.Attachments
Dim oAttach As Outlook.Attachment
If Len(Me.TextBox1.Text) > 0 Then
oAttach = oAttachs.Add(Me.TextBox1.Text)
Else
End If
oAttachs.Add(Me.cboForm.SelectedValue)
oMsg.Send()
oApp = Nothing
oMsg = Nothing
oAttach = Nothing
oAttachs = Nothing
'MsgBox("Your Fax Has Been Sent Successfully")
lblStatus.Text = "Fax Sent"
'lblStatus.Text = "Ready"
End If
End Sub
Is there anyway to accomplish the same thing using .asp? or is there an
easier way to do this using a contact form and .asp page? I'm just trying
to avoid using an external mail server and have the form send from the
actual user.
Open to any suggestions!
Python: connect to VPN server
Python: connect to VPN server
Is it possible to connect to VPN server using python? Different types:
PPTP, L2TP, OpenVPN, Cisco.
My goal is check if server is alive (and then disconnect).
Is it possible to connect to VPN server using python? Different types:
PPTP, L2TP, OpenVPN, Cisco.
My goal is check if server is alive (and then disconnect).
Tuesday, 1 October 2013
Message Length Zero and packet repeating
Message Length Zero and packet repeating
I am using an TinyOS application to send packets from Radio To Serial. I
am broadcasting messages. When I read motes using Java Listen class,
sometimes I receive packet length as zero and packet counter repeating
itself. What could be the problem? I get data something like this:
00 FF FF FF 01 12 3F 06 00 00 F7 54 00 00 F6 30 02 E0 00 18 27 6C 00 18 27 75
00 FF FF FF 01 12 3F 06 00 00 F7 55 00 00 F6 31 02 E0 00 18 27 82 00 18 27 8F
00 00 FF FF 01 00 3F 06 00 00 F7 57 00 00 F6 32 02 E0 00 18 27 98 00 18 27 AA
00 FF FF FF 01 12 3F 06 00 00 F7 57 00 00 F6 33 02 E0 00 18 27 B8 00 18 27 BD
00 FF FF FF 01 12 3F 06 00 00 F7 58 00 00 F6 34 02 E0 00 18 27 CE 00 18 27 D5
Here 00 00 F7 54, 00 00 F7 55 ... are my packet counters. So, if you see
this data, I have received packet length as '00' in third row and packet
counter repeating itself in 4th row. This happens sometimes only. If you
need I can post code too. Please help.
I am using an TinyOS application to send packets from Radio To Serial. I
am broadcasting messages. When I read motes using Java Listen class,
sometimes I receive packet length as zero and packet counter repeating
itself. What could be the problem? I get data something like this:
00 FF FF FF 01 12 3F 06 00 00 F7 54 00 00 F6 30 02 E0 00 18 27 6C 00 18 27 75
00 FF FF FF 01 12 3F 06 00 00 F7 55 00 00 F6 31 02 E0 00 18 27 82 00 18 27 8F
00 00 FF FF 01 00 3F 06 00 00 F7 57 00 00 F6 32 02 E0 00 18 27 98 00 18 27 AA
00 FF FF FF 01 12 3F 06 00 00 F7 57 00 00 F6 33 02 E0 00 18 27 B8 00 18 27 BD
00 FF FF FF 01 12 3F 06 00 00 F7 58 00 00 F6 34 02 E0 00 18 27 CE 00 18 27 D5
Here 00 00 F7 54, 00 00 F7 55 ... are my packet counters. So, if you see
this data, I have received packet length as '00' in third row and packet
counter repeating itself in 4th row. This happens sometimes only. If you
need I can post code too. Please help.
therubyracer installation on windows with libv8 installed --with-system-v8
therubyracer installation on windows with libv8 installed --with-system-v8
I finally got libv8 installed on my windows with gem install libv8 --
--with-system-v8
now when I am trying to install therubyracer I get
gem install therubyracer
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --with-system-v8
checking for main() in -lpthread... no
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby193/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
C:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in
`configure': You hav
e chosen to use the version of V8 found on your system
(Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
What I want to know is what this error message really means? Also I looked
this up https://github.com/cowboyd/libv8#bring-your-own-v8 How do I
install headers for v8?
I finally got libv8 installed on my windows with gem install libv8 --
--with-system-v8
now when I am trying to install therubyracer I get
gem install therubyracer
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --with-system-v8
checking for main() in -lpthread... no
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby193/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
C:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in
`configure': You hav
e chosen to use the version of V8 found on your system
(Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
What I want to know is what this error message really means? Also I looked
this up https://github.com/cowboyd/libv8#bring-your-own-v8 How do I
install headers for v8?
why query giving 0 rows
why query giving 0 rows
Query1
SELECT SessionInfo.IVRSessionInfoID
FROM SessionInfo
WHERE SessionCallTime BETWEEN UNIX_TIMESTAMP('2013-08-01 00:00:00')
AND UNIX_TIMESTAMP('2013-08-01 23:59:59')
ORDER BY SessionInfo.SessionCallTime DESC;
Query2
SELECT SessionInfo.IVRSessionInfoID
FROM SessionInfo
WHERE (SessionInfo.SessionCallTime BETWEEN '2013-08-01 00:00:00'
AND '2013-08-01 23:59:59')
ORDER BY SessionInfo.SessionCallTime DESC;
what is the diffrence why first query gives 0 rows second query gives records
in this tables 20000 rows betwqeen this two dates
table schema
CREATE TABLE `SessionInfo` (
`IVRSessionInfoID` bigint(8) unsigned NOT NULL AUTO_INCREMENT,
`SessionCallTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MGServerIP` varchar(15) NOT NULL,
`MGServerPort` smallint(2) unsigned NOT NULL DEFAULT '5060',
`SessionUniqueID` varchar(64) NOT NULL,
`ANI` varchar(20) NOT NULL,
`CountryID` int(4) unsigned DEFAULT NULL,
`CountryStateAreaID` int(4) unsigned DEFAULT NULL,
`AccessNumberProviderLogID` int(4) unsigned DEFAULT NULL,
`AccessNumberLogID` int(4) unsigned DEFAULT NULL,
`AccessRestrictionLogID` int(4) unsigned DEFAULT NULL,
`SubscriberCardID` bigint(8) unsigned DEFAULT NULL,
`SessionDuration` int(4) unsigned NOT NULL,
`SessionRNDDuration` int(4) unsigned NOT NULL,
`TotalCharge` decimal(15,6) unsigned NOT NULL,
`RuleSetLogID` int(4) unsigned DEFAULT NULL,
`RuleSetChargeInfoLogID` int(4) unsigned DEFAULT NULL,
`RuleSetRNDDuration` int(4) unsigned NOT NULL,
`RuleSetTotalCharge` decimal(15,6) unsigned NOT NULL,
PRIMARY KEY (`IVRSessionInfoID`),
UNIQUE KEY `UNIQUE` (`SessionUniqueID`),
KEY `SessionCallTime` (`SessionCallTime`),
KEY `ANI` (`ANI`),
KEY `CountryID` (`CountryID`),
KEY `CountryStateAreaID` (`CountryStateAreaID`),
KEY `AccessNumberProviderLogID` (`AccessNumberProviderLogID`),
KEY `AccessNumberLogID` (`AccessNumberLogID`),
KEY `AccessRestrictionLogID` (`AccessRestrictionLogID`),
KEY `SubscriberCardID` (`SubscriberCardID`),
) ENGINE=InnoDB AUTO_INCREMENT=22199955 DEFAULT CHARSET=latin1
ROW_FORMAT=COMPACT;
Query1
SELECT SessionInfo.IVRSessionInfoID
FROM SessionInfo
WHERE SessionCallTime BETWEEN UNIX_TIMESTAMP('2013-08-01 00:00:00')
AND UNIX_TIMESTAMP('2013-08-01 23:59:59')
ORDER BY SessionInfo.SessionCallTime DESC;
Query2
SELECT SessionInfo.IVRSessionInfoID
FROM SessionInfo
WHERE (SessionInfo.SessionCallTime BETWEEN '2013-08-01 00:00:00'
AND '2013-08-01 23:59:59')
ORDER BY SessionInfo.SessionCallTime DESC;
what is the diffrence why first query gives 0 rows second query gives records
in this tables 20000 rows betwqeen this two dates
table schema
CREATE TABLE `SessionInfo` (
`IVRSessionInfoID` bigint(8) unsigned NOT NULL AUTO_INCREMENT,
`SessionCallTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MGServerIP` varchar(15) NOT NULL,
`MGServerPort` smallint(2) unsigned NOT NULL DEFAULT '5060',
`SessionUniqueID` varchar(64) NOT NULL,
`ANI` varchar(20) NOT NULL,
`CountryID` int(4) unsigned DEFAULT NULL,
`CountryStateAreaID` int(4) unsigned DEFAULT NULL,
`AccessNumberProviderLogID` int(4) unsigned DEFAULT NULL,
`AccessNumberLogID` int(4) unsigned DEFAULT NULL,
`AccessRestrictionLogID` int(4) unsigned DEFAULT NULL,
`SubscriberCardID` bigint(8) unsigned DEFAULT NULL,
`SessionDuration` int(4) unsigned NOT NULL,
`SessionRNDDuration` int(4) unsigned NOT NULL,
`TotalCharge` decimal(15,6) unsigned NOT NULL,
`RuleSetLogID` int(4) unsigned DEFAULT NULL,
`RuleSetChargeInfoLogID` int(4) unsigned DEFAULT NULL,
`RuleSetRNDDuration` int(4) unsigned NOT NULL,
`RuleSetTotalCharge` decimal(15,6) unsigned NOT NULL,
PRIMARY KEY (`IVRSessionInfoID`),
UNIQUE KEY `UNIQUE` (`SessionUniqueID`),
KEY `SessionCallTime` (`SessionCallTime`),
KEY `ANI` (`ANI`),
KEY `CountryID` (`CountryID`),
KEY `CountryStateAreaID` (`CountryStateAreaID`),
KEY `AccessNumberProviderLogID` (`AccessNumberProviderLogID`),
KEY `AccessNumberLogID` (`AccessNumberLogID`),
KEY `AccessRestrictionLogID` (`AccessRestrictionLogID`),
KEY `SubscriberCardID` (`SubscriberCardID`),
) ENGINE=InnoDB AUTO_INCREMENT=22199955 DEFAULT CHARSET=latin1
ROW_FORMAT=COMPACT;
Why is headhunting uncommon for academic positions=?iso-8859-1?Q?=3F_=96_academia.stackexchange.com?=
Why is headhunting uncommon for academic positions? –
academia.stackexchange.com
In scientific conferences, there are usually many headhunters who come to
offer newly graduated scholars jobs in the industry sector. As a matter of
fact, the recruitment in industry mostly works with …
academia.stackexchange.com
In scientific conferences, there are usually many headhunters who come to
offer newly graduated scholars jobs in the industry sector. As a matter of
fact, the recruitment in industry mostly works with …
Subscribe to:
Comments (Atom)