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 …
Monday, 30 September 2013
Evaluate $ \lim=?iso-8859-1?Q?=5F{x\rightarrow{\frac\pi2_}}_?=(\sec(x) \tan(x))^{\cos(x)}$ without L'Hôpital's rule math.stackexchange.com
Evaluate $ \lim_{x\rightarrow{\frac\pi2 }} (\sec(x) \tan(x))^{\cos(x)}$
without L'Hôpital's rule – math.stackexchange.com
I have tried changing limit to $\lim_{x\rightarrow0}$ and use some
trigonometry identity ($\sin^2(x)+\cos^2(x) = 1$ and $\sin (x+\pi/2) =
\cos(x)$) but doesn't work I have no idea on how to do this …
without L'Hôpital's rule – math.stackexchange.com
I have tried changing limit to $\lim_{x\rightarrow0}$ and use some
trigonometry identity ($\sin^2(x)+\cos^2(x) = 1$ and $\sin (x+\pi/2) =
\cos(x)$) but doesn't work I have no idea on how to do this …
How to show that $(\delta'f)(e)=\delta(\phi^* f)(e)$?
How to show that $(\delta'f)(e)=\delta(\phi^* f)(e)$?
I am reading linear algebraic groups.
I have a question in line 4 of the third paragraph of Page 66. How to show
that $(\delta'f)(e)=\delta(\phi^* f)(e)$ for all $f\in K[G]$? Here $G$ is
an algebraic group, $K$ is an algebraic closed field, $\delta' =
\operatorname{Ad} x(\delta) = d(\operatorname{Int} x(\delta))$,
$\phi=\operatorname{Int} x$, $\operatorname{Int} x(y) = xyx^{-1}$, $x, y
\in G$. Thank you very much.
I think that $\delta'f = d(\operatorname{Int} x(\delta))f$.
I am reading linear algebraic groups.
I have a question in line 4 of the third paragraph of Page 66. How to show
that $(\delta'f)(e)=\delta(\phi^* f)(e)$ for all $f\in K[G]$? Here $G$ is
an algebraic group, $K$ is an algebraic closed field, $\delta' =
\operatorname{Ad} x(\delta) = d(\operatorname{Int} x(\delta))$,
$\phi=\operatorname{Int} x$, $\operatorname{Int} x(y) = xyx^{-1}$, $x, y
\in G$. Thank you very much.
I think that $\delta'f = d(\operatorname{Int} x(\delta))f$.
Remove x amount of elements with .remove()
Remove x amount of elements with .remove()
I am not seeing any clear documentation on removing a certain amount of
elements without it being in a specific order, of course there are many
ways to remove a list of say 5 items, if they are in that order. What if
there is elements that you don't want removed in between? Let me show you
an example
FIDDLE: Below is just pieces from this fiddle, it would be easier just
taking a look at the fiddle.
HTML
<div class="item empty">Empty</div>
<div class="item empty">Empty</div>
<div class="item editable">Editable</div>
<div class="item empty">Empty</div>
</div>
<button class="demo">Demo</button>
jQuery
$('.demo').click(function() {
var length = $('.item').length,
columns = 12/6,
addColumn = columns - length
//Set this for subtracting elements if addColumn is a negitive
if(addColumn < 0) {
//Want to remove the amount of items which is -2 in this case
$('.item.empty').eq(/*Remove whatever amount of addColumn */ ).remove()
}
//Equals -2
alert(addColumn)
});
So just to be clear, I am trying to remove the amount of .empty items
based on whatever the amount is passed into the addColumn variable in this
case its static set at -2.
So I ask if addColumn < 0 is a negative number then we do subtraction
using .remove() and I need to remove the amount of .empty items equal to
the addColumn variable.
12/6 comes from a 12 column grid and the 6 is a two column layout span6
span6 and so if the layout is set at 4 columns we need to remove 2
columns, which is where the -2 comes from.
I am not seeing any clear documentation on removing a certain amount of
elements without it being in a specific order, of course there are many
ways to remove a list of say 5 items, if they are in that order. What if
there is elements that you don't want removed in between? Let me show you
an example
FIDDLE: Below is just pieces from this fiddle, it would be easier just
taking a look at the fiddle.
HTML
<div class="item empty">Empty</div>
<div class="item empty">Empty</div>
<div class="item editable">Editable</div>
<div class="item empty">Empty</div>
</div>
<button class="demo">Demo</button>
jQuery
$('.demo').click(function() {
var length = $('.item').length,
columns = 12/6,
addColumn = columns - length
//Set this for subtracting elements if addColumn is a negitive
if(addColumn < 0) {
//Want to remove the amount of items which is -2 in this case
$('.item.empty').eq(/*Remove whatever amount of addColumn */ ).remove()
}
//Equals -2
alert(addColumn)
});
So just to be clear, I am trying to remove the amount of .empty items
based on whatever the amount is passed into the addColumn variable in this
case its static set at -2.
So I ask if addColumn < 0 is a negative number then we do subtraction
using .remove() and I need to remove the amount of .empty items equal to
the addColumn variable.
12/6 comes from a 12 column grid and the 6 is a two column layout span6
span6 and so if the layout is set at 4 columns we need to remove 2
columns, which is where the -2 comes from.
Getting div id by GET in Javascript
Getting div id by GET in Javascript
Ciao
I need to create a dynamic form based on user selections.
I.e. in the first form field I select "John Smith", this will populate
(through an external php/mysql file ) the second select field "Artist,
Carpenter, Other", if I choose Artist I populate the third select field
with "Singer, Painter, Sculptor" and so on
Giving my incompetence on javascript, I spent the morning googling for
scripts and I found a cool tutorial here
It works, it's clean, but it updates only the div with id txtResult, which
is statically included in the js file (see lines 19 and 31 of
ajax_req.js). I thought I could pass the id name by GET, but I don't know
how to make the script recognize the variable.
This is the code:
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtResult").innerHTML=
xmlHttp.responseText;
}
}
I had in mind to pass by GET the id name and have something like this:
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("GET[idName]").innerHTML=
xmlHttp.responseText;
}
}
Can you please help me? I could change script too if you happen to know
something better
Ciao and thank you,
Ed
Ciao
I need to create a dynamic form based on user selections.
I.e. in the first form field I select "John Smith", this will populate
(through an external php/mysql file ) the second select field "Artist,
Carpenter, Other", if I choose Artist I populate the third select field
with "Singer, Painter, Sculptor" and so on
Giving my incompetence on javascript, I spent the morning googling for
scripts and I found a cool tutorial here
It works, it's clean, but it updates only the div with id txtResult, which
is statically included in the js file (see lines 19 and 31 of
ajax_req.js). I thought I could pass the id name by GET, but I don't know
how to make the script recognize the variable.
This is the code:
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtResult").innerHTML=
xmlHttp.responseText;
}
}
I had in mind to pass by GET the id name and have something like this:
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("GET[idName]").innerHTML=
xmlHttp.responseText;
}
}
Can you please help me? I could change script too if you happen to know
something better
Ciao and thank you,
Ed
Sunday, 29 September 2013
Visited every section of the FAQ (retired)
Visited every section of the FAQ (retired)
The way to earn the 'Analytical' badge is: Visited every section of the
FAQ (retired). What does (retired) mean? Does it mean that it is no longer
available?
The way to earn the 'Analytical' badge is: Visited every section of the
FAQ (retired). What does (retired) mean? Does it mean that it is no longer
available?
SQL- Getting maximum value along with all other columns?
SQL- Getting maximum value along with all other columns?
I have a table, which can be seen as a evaluation of two courses in
several classroom tests, like this:
student_ID Evaluation Course1 Course2
------------------------------------------------------
1 5 88 93
2 4 70 87
1 5 93 90
2 5 99 91
3 3 65 60
3 4 88 70
I need to get the result of the Evaluation=5 for each student, if any. If
that student has more than one Evaluation=5, the query only show any one
of them. So for the above example table, the query result will be
student_ID Evaluation Course1 Course2
------------------------------------------------------
1 5 88 93
2 5 99 91
Of course in my real table, the "Courses" number is more than 2.
Thanks for the help.
I have a table, which can be seen as a evaluation of two courses in
several classroom tests, like this:
student_ID Evaluation Course1 Course2
------------------------------------------------------
1 5 88 93
2 4 70 87
1 5 93 90
2 5 99 91
3 3 65 60
3 4 88 70
I need to get the result of the Evaluation=5 for each student, if any. If
that student has more than one Evaluation=5, the query only show any one
of them. So for the above example table, the query result will be
student_ID Evaluation Course1 Course2
------------------------------------------------------
1 5 88 93
2 5 99 91
Of course in my real table, the "Courses" number is more than 2.
Thanks for the help.
How to create FlexSlider with flipping content
How to create FlexSlider with flipping content
I'm starting to get in to web development. I'm keenly interested on
minimal designs and flat UIs.
I was googling around and found some interested sites. This particular
site caught my eye which has a unique slideshow. I did a bit of snooping
with dev tools and found that the site uses Flexslider.
I would really like to know how to achieve this kind of effect.
A sample on Fiddle with 2 image slides with flipping content would be
really appreciated if possible to be provided.
URL for the site: http://skincollective.net/
[ This is not an advertisement if it's against the rules ]
I'm starting to get in to web development. I'm keenly interested on
minimal designs and flat UIs.
I was googling around and found some interested sites. This particular
site caught my eye which has a unique slideshow. I did a bit of snooping
with dev tools and found that the site uses Flexslider.
I would really like to know how to achieve this kind of effect.
A sample on Fiddle with 2 image slides with flipping content would be
really appreciated if possible to be provided.
URL for the site: http://skincollective.net/
[ This is not an advertisement if it's against the rules ]
How to increment a single number in a text file with PHP
How to increment a single number in a text file with PHP
I am writing a VoteBox (like/dislike box) in html and I cannot find how to
do this anywhere.
Basically, there will be a like and a dislike button. When one of them
gets clicked, it will forward the user to a page. And in that, I want some
PHP code that will increase the number in upvotes.txt/downvotes.txt
I have tried doing it with a database but the problem is I want anyone to
be able to use this without any setup.
i also want the front page to display the number of upvotes and the number
of downvotes
so its kinda like this (most of this isn't real code BTW im new to PHP):
//this is the code for upvote.html
$upvotes = get_data_from_TXT_file
$changedupvotes = $upvotes + 1
set_data_in_txt_file_to_$changedupvotes
Sorry if i havent explained this very well
Any help appreciated
I am writing a VoteBox (like/dislike box) in html and I cannot find how to
do this anywhere.
Basically, there will be a like and a dislike button. When one of them
gets clicked, it will forward the user to a page. And in that, I want some
PHP code that will increase the number in upvotes.txt/downvotes.txt
I have tried doing it with a database but the problem is I want anyone to
be able to use this without any setup.
i also want the front page to display the number of upvotes and the number
of downvotes
so its kinda like this (most of this isn't real code BTW im new to PHP):
//this is the code for upvote.html
$upvotes = get_data_from_TXT_file
$changedupvotes = $upvotes + 1
set_data_in_txt_file_to_$changedupvotes
Sorry if i havent explained this very well
Any help appreciated
Saturday, 28 September 2013
Pretty new to Java, how to insert user-inputted string to direct a reference?
Pretty new to Java, how to insert user-inputted string to direct a reference?
(In java,) This may or may not be possible, I assume it is because it
seems to short-cutty/easy to not exist. Basically what I want to do is
have the user insert the name of a state, then it add one to that state's
counter, which is stored in a different class. I want to do this without
creating 50 if/else statements. Here's pseudocode which represents how I
would expect it to be done. (this code would be encapsuled in a while loop
in mainclass.java and the counters and state names are in a class named
state.java.)
Scanner userstate = new Scanner(System.in);
String statename = userstate.nextLine();
state.(statename).counter++;
in state.java:
public state(int counter){
}
public static state Alabama = new state(0);
For time's sake, I hope there is a shortcut similar to the above.
(In java,) This may or may not be possible, I assume it is because it
seems to short-cutty/easy to not exist. Basically what I want to do is
have the user insert the name of a state, then it add one to that state's
counter, which is stored in a different class. I want to do this without
creating 50 if/else statements. Here's pseudocode which represents how I
would expect it to be done. (this code would be encapsuled in a while loop
in mainclass.java and the counters and state names are in a class named
state.java.)
Scanner userstate = new Scanner(System.in);
String statename = userstate.nextLine();
state.(statename).counter++;
in state.java:
public state(int counter){
}
public static state Alabama = new state(0);
For time's sake, I hope there is a shortcut similar to the above.
Android change text in textview on swipe with animation
Android change text in textview on swipe with animation
I am developing an android application and i have set of messages to show
on a display page. At a given time only one message will be shown, but if
user swipes the screen i want to change the message on textview on swipe.
I want animation direction based on swipe direction meaning if user swipe
left to right then left-right textview animation, similarly right-left and
bottom-top animation. Please advise me how to achieve this.
I am developing an android application and i have set of messages to show
on a display page. At a given time only one message will be shown, but if
user swipes the screen i want to change the message on textview on swipe.
I want animation direction based on swipe direction meaning if user swipe
left to right then left-right textview animation, similarly right-left and
bottom-top animation. Please advise me how to achieve this.
ASP.NET MVC application that needs reading from SQL server not working on IIS but on visual studio, while ASP.NET Web Applicatopn worked for...
ASP.NET MVC application that needs reading from SQL server not working on
IIS but on visual studio, while ASP.NET Web Applicatopn worked for...
I followed an example of using SQL databse from an ASP.NET MVC application
and can get it work on Visual Studio, but when I tried to deploy it on the
local IIS and provide the values on the URL it was said "... The resource
cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure
that it is spelled correctly. ..."
I can access the same SQL database from APS.NET Web application but not MVC.
Can you tell me why this happens and how to solve the problem?
IIS but on visual studio, while ASP.NET Web Applicatopn worked for...
I followed an example of using SQL databse from an ASP.NET MVC application
and can get it work on Visual Studio, but when I tried to deploy it on the
local IIS and provide the values on the URL it was said "... The resource
cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure
that it is spelled correctly. ..."
I can access the same SQL database from APS.NET Web application but not MVC.
Can you tell me why this happens and how to solve the problem?
Subscribe to:
Posts (Atom)