How activate and deactivate android virtuak keyboard in asp.net webview page?
I have a webview which shows aspx page (asp.net). And that webpage include
ajax rating bar and txtbox &buttons. My issue is that the virtual keyboard
pops up when I touch the textbox and it doesnt disapear after I touch the
background panel in the webview. Plus the virtual keyboard pops up not
only when I touch the textbox but also all other components ex) rating
bar&buttons Any help?
Saturday, 31 August 2013
Visual Basic Pause Code
Visual Basic Pause Code
I am currently trying to make a simple slot machine app. I am trying to
make it like a traditional slot machine with the spinner where it goes
through and shows the different pictures. I have been trying to use a
Sleep comand found in many similar posts on here but it keeps crashing my
program. The last coe I tested is below:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
End Sub
Can anyone make a recommendation of what I need to change? I want it to
pop up a few different numbers and switch between them each second. Thanks
for any help you can provide
I am currently trying to make a simple slot machine app. I am trying to
make it like a traditional slot machine with the spinner where it goes
through and shows the different pictures. I have been trying to use a
Sleep comand found in many similar posts on here but it keeps crashing my
program. The last coe I tested is below:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
Label1.Text = CStr(Int(Rnd() * 10)) 'pick numbers
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
Threading.Thread.Sleep(1000)
End Sub
Can anyone make a recommendation of what I need to change? I want it to
pop up a few different numbers and switch between them each second. Thanks
for any help you can provide
Static reference to non-static method
Static reference to non-static method
We were given this specification for the PercolationStats class:
public class PercolationStats {
public PercolationStats(int N, int T) // perform T independent
computational experiments on an N-by-N grid
public double mean() // sample mean of percolation
threshold
public double stddev() // sample standard deviation
of percolation threshold
public double confidenceLo() // returns lower bound of the
95% confidence interval
public double confidenceHi() // returns upper bound of the
95% confidence interval
public static void main(String[] args) // test client, described below
}
and to implement mean() and stddev(), we had to use a special library that
has a class called StdStats:
public final class StdStats {
private StdStats() { }
/* All methods declared static. */
}
I tried to write something like
public mean() {
return StdStats.mean();
}
but I get the following error:
Cannot make a static reference to the non-static method mean() from the
type PercolationStats
Is there a way to get rid of this error without changing the
specification? I believe we're supposed to be able to make
PercolationStats objects. Thanks for any help!
We were given this specification for the PercolationStats class:
public class PercolationStats {
public PercolationStats(int N, int T) // perform T independent
computational experiments on an N-by-N grid
public double mean() // sample mean of percolation
threshold
public double stddev() // sample standard deviation
of percolation threshold
public double confidenceLo() // returns lower bound of the
95% confidence interval
public double confidenceHi() // returns upper bound of the
95% confidence interval
public static void main(String[] args) // test client, described below
}
and to implement mean() and stddev(), we had to use a special library that
has a class called StdStats:
public final class StdStats {
private StdStats() { }
/* All methods declared static. */
}
I tried to write something like
public mean() {
return StdStats.mean();
}
but I get the following error:
Cannot make a static reference to the non-static method mean() from the
type PercolationStats
Is there a way to get rid of this error without changing the
specification? I believe we're supposed to be able to make
PercolationStats objects. Thanks for any help!
Error when creating table with mysqldb module
Error when creating table with mysqldb module
I'm trying to create a table with 2 columns using python's mysqldb module,
but I get an error, what might be wrong here?
cur.execute("CREATE TABLE foreign_crew(id VARCHAR() PRIMARY_KEY, surname
VARCHAR(45))")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 202, in
execute
self.errorhandler(self, exc, value)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in
defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near ') PRIMARY_KEY, surname VARCHAR(45))' at line 1")
I'm trying to create a table with 2 columns using python's mysqldb module,
but I get an error, what might be wrong here?
cur.execute("CREATE TABLE foreign_crew(id VARCHAR() PRIMARY_KEY, surname
VARCHAR(45))")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 202, in
execute
self.errorhandler(self, exc, value)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in
defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near ') PRIMARY_KEY, surname VARCHAR(45))' at line 1")
django-social-auth with custom user model and overridden save() method
django-social-auth with custom user model and overridden save() method
I'm using django-social-auth, and I'm really impressed by its simplicity,
however I use a custom user model and I overrided the save() method in
order to set a default computed value for a field I need, the problem is
that save() is not called by socialauth! How can this be possible? Is
there another way of setting a computed field value at creation-time?
I'm using django-social-auth, and I'm really impressed by its simplicity,
however I use a custom user model and I overrided the save() method in
order to set a default computed value for a field I need, the problem is
that save() is not called by socialauth! How can this be possible? Is
there another way of setting a computed field value at creation-time?
Using header(), does the header get sent instantly, or after the full script has run?
Using header(), does the header get sent instantly, or after the full
script has run?
I'm working with an external service that polls data from my app. A
requirement of this external service is that I have to let it know that
its request was successful after a maximum of 10 seconds. The problem is
that the script this service connects to might take more than 10 seconds
to execute.
My question is: When I sent the headers via header('HTTP/1.0 200 OK',
true, 200);, will the external service receive this response immediately,
or only after my script has executed completely? Example:
header('HTTP/1.0 200 OK', true, 200);
some_function_that_takes_20_seconds()
Will the response header be sent immediately or only after 20 seconds?
script has run?
I'm working with an external service that polls data from my app. A
requirement of this external service is that I have to let it know that
its request was successful after a maximum of 10 seconds. The problem is
that the script this service connects to might take more than 10 seconds
to execute.
My question is: When I sent the headers via header('HTTP/1.0 200 OK',
true, 200);, will the external service receive this response immediately,
or only after my script has executed completely? Example:
header('HTTP/1.0 200 OK', true, 200);
some_function_that_takes_20_seconds()
Will the response header be sent immediately or only after 20 seconds?
Syntax error in My sqlite when i add a new table
Syntax error in My sqlite when i add a new table
Now,i'm add a new table to sqlitedatabase and change a databae_version
from 1 to version 2 (my new table is category) this is my code in
BooksDBHelper
package com.example.mutitablesql.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class BooksDBHelper extends SQLiteOpenHelper {
//databse_name
public static String DATABSE_NAME = "bookguk";
// database_version
public static int DATABASE_VERSION = 2;
//table name
public static String TABLE_BOOK = "books";
public static String TABLE_IMAGE = "images";
public static String TABLE_INGREDIENT = "ingredients";
public static String TABLE_CATEGORY = "category";
//column_name
public static String KEY_ID = "id";
public static String KEY_TITLE = "title";
public static String KEY_SOLUTION = "solution";
public static String KEY_BOK_ID = "bookID";
public static String KEY_fILEPATH = "filepath";
public static String KEY_VALUE = "value" ;
public static String KEY_UNIT = "unit";
public static String KEY_NAME = "name";
public static String KEY_CAT_ID = "cat_id";
public static String BOOK_CREATE_SQL = "CREATE TABLE " + TABLE_BOOK + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_TITLE+" TEXT(50) not null," +
""+KEY_SOLUTION+" TEXT(255) not null," +
""+KEY_CAT_ID+" INTEGER(11)," +
" FOREIGN KEY("+KEY_CAT_ID+") REFERENCE
"+TABLE_CATEGORY+" ("+KEY_ID+"))";
public static String IMAGE_CREATE_SQL = "CREATE TABLE " + TABLE_IMAGE + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_fILEPATH+" VACHAR(255)," +
""+KEY_BOK_ID+" INTEGER(11)," +
" FOREIGN KEY("+KEY_BOK_ID+") REFERENCES
"+TABLE_BOOK+" ("+KEY_ID+"))";
public static String INGREDIENT_CREATE_SQL = "CREATE TABLE " +
TABLE_INGREDIENT + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_VALUE+" DOUBLE(11)," +
""+KEY_UNIT+" VACHAR(50)," +
""+KEY_fILEPATH+" VACHAR(255)," +
""+KEY_BOK_ID+" INTEGER(11)," +
" FOREIGN KEY("+KEY_BOK_ID+")REFERENCES
"+TABLE_BOOK+" ("+KEY_ID+"))";
public static String CATEGORY_CREATE_SQL = "CREATE TABLE " +
TABLE_CATEGORY + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_NAME+" VACHAR(50) " +
")";
//constructor
public BooksDBHelper(Context context) {
super(context, DATABSE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
//create
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(BOOK_CREATE_SQL);
db.execSQL(IMAGE_CREATE_SQL);
db.execSQL(INGREDIENT_CREATE_SQL);
db.execSQL(CATEGORY_CREATE_SQL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
db.execSQL("DROP TABLE " + TABLE_BOOK);
db.execSQL("DROP TABLE " + TABLE_IMAGE);
db.execSQL("DROP TABLE " + TABLE_INGREDIENT);
db.execSQL("DROP TABLE " + TABLE_CATEGORY);
onCreate(db);
}
}
And this is my logcat error edit
08-31 08:04:06.957: E/SQLiteLog(1683): (1) no such table: category
08-31 08:04:06.978: D/AndroidRuntime(1683): Shutting down VM
08-31 08:04:06.978: W/dalvikvm(1683): threadid=1: thread exiting with
uncaught exception (group=0x40a71930)
08-31 08:04:07.007: E/AndroidRuntime(1683): FATAL EXCEPTION: main
08-31 08:04:07.007: E/AndroidRuntime(1683): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.example.mutitablesql/com.example.mutitablesql.MainActivity}:
android.database.sqlite.SQLiteException: no such table: category (code 1):
, while compiling: DROP TABLE category
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.os.Looper.loop(Looper.java:137)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.main(ActivityThread.java:5041)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
java.lang.reflect.Method.invokeNative(Native Method)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
java.lang.reflect.Method.invoke(Method.java:511)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
dalvik.system.NativeStart.main(Native Method)
08-31 08:04:07.007: E/AndroidRuntime(1683): Caused by:
android.database.sqlite.SQLiteException: no such table: category (code 1):
, while compiling: DROP TABLE category
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native
Method)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1663)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.example.mutitablesql.db.BooksDBHelper.onUpgrade(BooksDBHelper.java:80)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:257)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.example.mutitablesql.db.BooksDB.<init>(BooksDB.java:23)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.example.mutitablesql.MainActivity.onCreate(MainActivity.java:21)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.Activity.performCreate(Activity.java:5104)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
08-31 08:04:07.007: E/AndroidRuntime(1683): ... 11 more
before i add a new table from sqlite .It's not have syntax error in my
BooksDBHelper Please check it.and tell me which line is syntax error .
Thank you
Now,i'm add a new table to sqlitedatabase and change a databae_version
from 1 to version 2 (my new table is category) this is my code in
BooksDBHelper
package com.example.mutitablesql.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class BooksDBHelper extends SQLiteOpenHelper {
//databse_name
public static String DATABSE_NAME = "bookguk";
// database_version
public static int DATABASE_VERSION = 2;
//table name
public static String TABLE_BOOK = "books";
public static String TABLE_IMAGE = "images";
public static String TABLE_INGREDIENT = "ingredients";
public static String TABLE_CATEGORY = "category";
//column_name
public static String KEY_ID = "id";
public static String KEY_TITLE = "title";
public static String KEY_SOLUTION = "solution";
public static String KEY_BOK_ID = "bookID";
public static String KEY_fILEPATH = "filepath";
public static String KEY_VALUE = "value" ;
public static String KEY_UNIT = "unit";
public static String KEY_NAME = "name";
public static String KEY_CAT_ID = "cat_id";
public static String BOOK_CREATE_SQL = "CREATE TABLE " + TABLE_BOOK + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_TITLE+" TEXT(50) not null," +
""+KEY_SOLUTION+" TEXT(255) not null," +
""+KEY_CAT_ID+" INTEGER(11)," +
" FOREIGN KEY("+KEY_CAT_ID+") REFERENCE
"+TABLE_CATEGORY+" ("+KEY_ID+"))";
public static String IMAGE_CREATE_SQL = "CREATE TABLE " + TABLE_IMAGE + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_fILEPATH+" VACHAR(255)," +
""+KEY_BOK_ID+" INTEGER(11)," +
" FOREIGN KEY("+KEY_BOK_ID+") REFERENCES
"+TABLE_BOOK+" ("+KEY_ID+"))";
public static String INGREDIENT_CREATE_SQL = "CREATE TABLE " +
TABLE_INGREDIENT + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_VALUE+" DOUBLE(11)," +
""+KEY_UNIT+" VACHAR(50)," +
""+KEY_fILEPATH+" VACHAR(255)," +
""+KEY_BOK_ID+" INTEGER(11)," +
" FOREIGN KEY("+KEY_BOK_ID+")REFERENCES
"+TABLE_BOOK+" ("+KEY_ID+"))";
public static String CATEGORY_CREATE_SQL = "CREATE TABLE " +
TABLE_CATEGORY + "(" +
""+KEY_ID+" INTEGER PRIMARY KEY
AUTOINCREMENT," +
""+KEY_NAME+" VACHAR(50) " +
")";
//constructor
public BooksDBHelper(Context context) {
super(context, DATABSE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
//create
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(BOOK_CREATE_SQL);
db.execSQL(IMAGE_CREATE_SQL);
db.execSQL(INGREDIENT_CREATE_SQL);
db.execSQL(CATEGORY_CREATE_SQL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
db.execSQL("DROP TABLE " + TABLE_BOOK);
db.execSQL("DROP TABLE " + TABLE_IMAGE);
db.execSQL("DROP TABLE " + TABLE_INGREDIENT);
db.execSQL("DROP TABLE " + TABLE_CATEGORY);
onCreate(db);
}
}
And this is my logcat error edit
08-31 08:04:06.957: E/SQLiteLog(1683): (1) no such table: category
08-31 08:04:06.978: D/AndroidRuntime(1683): Shutting down VM
08-31 08:04:06.978: W/dalvikvm(1683): threadid=1: thread exiting with
uncaught exception (group=0x40a71930)
08-31 08:04:07.007: E/AndroidRuntime(1683): FATAL EXCEPTION: main
08-31 08:04:07.007: E/AndroidRuntime(1683): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.example.mutitablesql/com.example.mutitablesql.MainActivity}:
android.database.sqlite.SQLiteException: no such table: category (code 1):
, while compiling: DROP TABLE category
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.os.Looper.loop(Looper.java:137)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.main(ActivityThread.java:5041)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
java.lang.reflect.Method.invokeNative(Native Method)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
java.lang.reflect.Method.invoke(Method.java:511)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
dalvik.system.NativeStart.main(Native Method)
08-31 08:04:07.007: E/AndroidRuntime(1683): Caused by:
android.database.sqlite.SQLiteException: no such table: category (code 1):
, while compiling: DROP TABLE category
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native
Method)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1663)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.example.mutitablesql.db.BooksDBHelper.onUpgrade(BooksDBHelper.java:80)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:257)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.example.mutitablesql.db.BooksDB.<init>(BooksDB.java:23)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
com.example.mutitablesql.MainActivity.onCreate(MainActivity.java:21)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.Activity.performCreate(Activity.java:5104)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-31 08:04:07.007: E/AndroidRuntime(1683): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
08-31 08:04:07.007: E/AndroidRuntime(1683): ... 11 more
before i add a new table from sqlite .It's not have syntax error in my
BooksDBHelper Please check it.and tell me which line is syntax error .
Thank you
Friday, 30 August 2013
Notice: Undefined offset: 1 (fopen)
Notice: Undefined offset: 1 (fopen)
What is wrong?
<?php
$url = "http://www.adress.com/lorem-ipsum-dolor";
$page = fopen($url, 'r');
$content = "";
while (!feof($page)) {
$buffer = trim(fgets($page, 4096));
$content .= $buffer;
}
$start = 'first":"';
$end = '","second"';
preg_match("/$start(.*)$end/s", $content, $match);
$mytext = $match[1];
echo "$mytext";
?>
I get this error:
Notice: Undefined offset: 1 in C:\Program Files\EasyPHP-12.1\www\da.php on
line 14
What is wrong?
<?php
$url = "http://www.adress.com/lorem-ipsum-dolor";
$page = fopen($url, 'r');
$content = "";
while (!feof($page)) {
$buffer = trim(fgets($page, 4096));
$content .= $buffer;
}
$start = 'first":"';
$end = '","second"';
preg_match("/$start(.*)$end/s", $content, $match);
$mytext = $match[1];
echo "$mytext";
?>
I get this error:
Notice: Undefined offset: 1 in C:\Program Files\EasyPHP-12.1\www\da.php on
line 14
Thursday, 29 August 2013
How Can I Avoid view State In my asp page
How Can I Avoid view State In my asp page
I am using asp.net and i am new developer. i want to avoid using viewstate
in my page. i have two content Place holder like this:
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent"
runat="server">
</asp:Content >
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent"
runat="server">
</asp:Content >
Can i do something with the Contentplaceholder how can i do this. Please
help me. I have tried a lot to avoid but i cant.
With Regard.
I am using asp.net and i am new developer. i want to avoid using viewstate
in my page. i have two content Place holder like this:
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent"
runat="server">
</asp:Content >
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent"
runat="server">
</asp:Content >
Can i do something with the Contentplaceholder how can i do this. Please
help me. I have tried a lot to avoid but i cant.
With Regard.
Wednesday, 28 August 2013
Laravel breaks entire app on PHP notices
Laravel breaks entire app on PHP notices
How can I make Laravel 4 ignore PHP notices (like undefined variable
notices) and don't break the whole app only because of a simple 'undefined
index or variable' PHP notice?
I could to that on L3 seting an 'ignore' array in config/error.php. But I
cant find how to do that in L4.
Thanks
How can I make Laravel 4 ignore PHP notices (like undefined variable
notices) and don't break the whole app only because of a simple 'undefined
index or variable' PHP notice?
I could to that on L3 seting an 'ignore' array in config/error.php. But I
cant find how to do that in L4.
Thanks
Why do I get extra commas in my python slqlite SELECT results?
Why do I get extra commas in my python slqlite SELECT results?
I can't figure out what I am doing wrong. Can someone please help? When I
run the following statement:
cur.execute("SELECT created FROM datafiles where path = '%s'" %
self.srchfilepath.displayText() list = cur.fetchall()
(self.srchfilepath.displayText() is just a field on a GUI)
The results I get is:
[('testing',), ('testing',)]
The actual data is correct, it is just in a format I don't understand.
I can't figure out where the extra commas within the parens are coming
from. I am trying to put this data in back into a listbox field for
display and selection, but I need a list that the field will accept.
Clearly this is not what it wants. Can anyone tell me what I am doing
wrong and how I can make the result into something the Listbox will
accept?
Please help, Thanks
I can't figure out what I am doing wrong. Can someone please help? When I
run the following statement:
cur.execute("SELECT created FROM datafiles where path = '%s'" %
self.srchfilepath.displayText() list = cur.fetchall()
(self.srchfilepath.displayText() is just a field on a GUI)
The results I get is:
[('testing',), ('testing',)]
The actual data is correct, it is just in a format I don't understand.
I can't figure out where the extra commas within the parens are coming
from. I am trying to put this data in back into a listbox field for
display and selection, but I need a list that the field will accept.
Clearly this is not what it wants. Can anyone tell me what I am doing
wrong and how I can make the result into something the Listbox will
accept?
Please help, Thanks
how to re initialise jquery.mentionsInput on the edit view after its been created
how to re initialise jquery.mentionsInput on the edit view after its been
created
I am using the jquery.mentionsInput to recreate the feature that Facebook
and Twitter have for mentioning people in posts. My initial function that
I call on the new page is:
$('textarea.mention').mentionsInput({
onDataRequest:function (mode, query, callback) {
$.getJSON('api/users/user_mentions?q=' + query, function(responseData) {
responseData = _.filter(responseData, function(item) { return
item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
callback.call(this, responseData);
});
}
});
That works fine and whats stored in the database is:
@[Jake McAllister](content:5) How are you doing?
and then when I get to the edit page I can't get the textarea to
reinitialise itself as before. Does anybody know how to get this to
reinitialise and work like its meant to?
(see the demo on the github page to get how it's meant to work)
created
I am using the jquery.mentionsInput to recreate the feature that Facebook
and Twitter have for mentioning people in posts. My initial function that
I call on the new page is:
$('textarea.mention').mentionsInput({
onDataRequest:function (mode, query, callback) {
$.getJSON('api/users/user_mentions?q=' + query, function(responseData) {
responseData = _.filter(responseData, function(item) { return
item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
callback.call(this, responseData);
});
}
});
That works fine and whats stored in the database is:
@[Jake McAllister](content:5) How are you doing?
and then when I get to the edit page I can't get the textarea to
reinitialise itself as before. Does anybody know how to get this to
reinitialise and work like its meant to?
(see the demo on the github page to get how it's meant to work)
Android develop app that shares content with other app users
Android develop app that shares content with other app users
How do i upload text files from my app to the web and let other users
download it? (Kind of like the 9gag app or something, the user takes takes
a picture, uploads it and other users can view the picture) I probably
need a server or website where I can upload the text files to, but I don't
have any idea where to start. Does anyone maybe have a good tutorial for
my problem?
How do i upload text files from my app to the web and let other users
download it? (Kind of like the 9gag app or something, the user takes takes
a picture, uploads it and other users can view the picture) I probably
need a server or website where I can upload the text files to, but I don't
have any idea where to start. Does anyone maybe have a good tutorial for
my problem?
Golang requirements.txt equivalent
Golang requirements.txt equivalent
Coming from a python/django world, it'd be great to have something like a
requirements.txt equivalent for go/revel. How can I do this? I know I can
just write a requirements.txt file and then do something like
cat reqiurements.txt | xargs go get
But what if my requirements ALSO have requirements? The above command
would attempt to "go get" them, and then they'd fail to build, since I
don't have those requirements installed.
Is there something I'm missing?
Thanks a bunch!
Coming from a python/django world, it'd be great to have something like a
requirements.txt equivalent for go/revel. How can I do this? I know I can
just write a requirements.txt file and then do something like
cat reqiurements.txt | xargs go get
But what if my requirements ALSO have requirements? The above command
would attempt to "go get" them, and then they'd fail to build, since I
don't have those requirements installed.
Is there something I'm missing?
Thanks a bunch!
Tuesday, 27 August 2013
Usind for and while loops better
Usind for and while loops better
Trying to design an application which reads an integer and prints the sum
of all even integers between 2 and the input value. Can anybody help me
with the last bit?!
import java.util.Scanner;
public class IntergerValue {
// main method
public static void main(String[] args) {
// Data fields
int a;
// end
Scanner sc = new Scanner(System.in);
System.out.println("Enter an interger greater than 1");
a = sc.nextInt();
if (a <= 1) {
System.out.println("Input Value must not be less than 2");
}
while (a > 1) {
int sum = 0;
if (a % 2 == 0) {
sum += a;
a = a - 1;
}
System.out.println(sum);
}
}
}
Trying to design an application which reads an integer and prints the sum
of all even integers between 2 and the input value. Can anybody help me
with the last bit?!
import java.util.Scanner;
public class IntergerValue {
// main method
public static void main(String[] args) {
// Data fields
int a;
// end
Scanner sc = new Scanner(System.in);
System.out.println("Enter an interger greater than 1");
a = sc.nextInt();
if (a <= 1) {
System.out.println("Input Value must not be less than 2");
}
while (a > 1) {
int sum = 0;
if (a % 2 == 0) {
sum += a;
a = a - 1;
}
System.out.println(sum);
}
}
}
Socket Connecting and Sending but no Data Received Android ASP.net
Socket Connecting and Sending but no Data Received Android ASP.net
Hi i'm having an issue with sending a tcp socket from my android device to
my Asp.net application on my PC
The problem seems to be with that ASP.net code as i get 5 bytes received
but not managing to read them.
Hi i'm having an issue with sending a tcp socket from my android device to
my Asp.net application on my PC
The problem seems to be with that ASP.net code as i get 5 bytes received
but not managing to read them.
Sitecore Publishing behaviour when there's an error
Sitecore Publishing behaviour when there's an error
What happens when there's an error during the sitecore publishing process?
Let's say the connection to the target server gets lost.
Remain the already published items published or does Sitecore roll back
the whole publish job?
What happens when there's an error during the sitecore publishing process?
Let's say the connection to the target server gets lost.
Remain the already published items published or does Sitecore roll back
the whole publish job?
Bash script compare values from 2 files and print output values from one file
Bash script compare values from 2 files and print output values from one file
I have two files like this;
File1
114.4.21.198,cl_id=1J3W7P7H0S3L6g85900g736h6_101ps
114.4.21.205,cl_id=1O3M7A7Q0S3C6h85902g7b3h7_101pf
114.4.21.205,cl_id=1W3C7Z7W0U3J6795197g177j9_117p1
114.4.21.213,cl_id=1I3A7J7N0M3W6e950i7g2g2i0_1020h
File2
cl_id=1B3O7M6C8T4O1b559i2g930m0_1165d
cl_id=1X3J7M6J0W5S9535180h90302_101p5
cl_id=1G3D7X6V6A7R81356e3g527m9_101nl
cl_id=1L3J7R7O0F0L74954h2g495h8_117qk
cl_id=1L3J7R7O0F0L74954h2g495h8_117qk
cl_id=1J3W7P7H0S3L6g85900g736h6_101ps
cl_id=1W3C7Z7W0U3J6795197g177j9_117p1
cl_id=1I3A7J7N0M3W6e950i7g2g2i0_1020h
cl_id=1Q3Y7Q7J0M3E62953e5g3g5k0_117p6
I want to compare cl_id values that exist on file1 but not exist on file2
and print out the first values from file1 (IP Address).
it should be like this
114.4.21.198
114.4.21.205
114.4.21.205
114.4.21.213
114.4.23.70
114.4.21.201
114.4.21.211 120.172.168.36
I have tried awk,grep diff, comm. but nothing come close. Please tell the
correct command to do this.
thanks
I have two files like this;
File1
114.4.21.198,cl_id=1J3W7P7H0S3L6g85900g736h6_101ps
114.4.21.205,cl_id=1O3M7A7Q0S3C6h85902g7b3h7_101pf
114.4.21.205,cl_id=1W3C7Z7W0U3J6795197g177j9_117p1
114.4.21.213,cl_id=1I3A7J7N0M3W6e950i7g2g2i0_1020h
File2
cl_id=1B3O7M6C8T4O1b559i2g930m0_1165d
cl_id=1X3J7M6J0W5S9535180h90302_101p5
cl_id=1G3D7X6V6A7R81356e3g527m9_101nl
cl_id=1L3J7R7O0F0L74954h2g495h8_117qk
cl_id=1L3J7R7O0F0L74954h2g495h8_117qk
cl_id=1J3W7P7H0S3L6g85900g736h6_101ps
cl_id=1W3C7Z7W0U3J6795197g177j9_117p1
cl_id=1I3A7J7N0M3W6e950i7g2g2i0_1020h
cl_id=1Q3Y7Q7J0M3E62953e5g3g5k0_117p6
I want to compare cl_id values that exist on file1 but not exist on file2
and print out the first values from file1 (IP Address).
it should be like this
114.4.21.198
114.4.21.205
114.4.21.205
114.4.21.213
114.4.23.70
114.4.21.201
114.4.21.211 120.172.168.36
I have tried awk,grep diff, comm. but nothing come close. Please tell the
correct command to do this.
thanks
Monday, 26 August 2013
XPages selected value work in XPiNC but not web browser
XPages selected value work in XPiNC but not web browser
I'm doing the quick XAgent style view export to excel. But first I need to
get a the UNID of the documents that match the criteria that I selected on
my XPage. I have a button that will get the number of document found. I've
confirmed and verified that I have the documents based on the value that I
select but it always return zero document in the alert when in web
browser. For now the code in the button is as following:
uifrom = getComponent("from_dtpicker").getValue(); // a date-time picker
uito = getComponent("to_dtpicker").getValue(); // a date-time picker
uitag = getComponent("tag_combox").getValue(); // a combobox
var from:NotesDateTime = session.createDateTime(uifrom);
from.setAnyTime();
var to:NotesDateTime = session.createDateTime(uito);
to.setAnyTime();
var vw:NotesView = database.getView("(Document View by Tag)");
var docUNIDarray:Array = []; // for the quick XAgent excel export later on
if (uitag == "All") {
var vec:NotesViewEntryCollection = vw.getAllEntries();
} else {
var vec:NotesViewEntryCollection = vw.getAllEntriesByKey(uitag, true);
}
var total:Number = 0;
var ve:NotesViewEntry = vec.getFirstEntry();
while (ve != null) {
// document must have StartDate and EndDate
if (ve.getDocument().hasItem("StartDate") &&
ve.getDocument().hasItem("EndDate")) {
var vefrom:NotesDateTime =
ve.getDocument().getItemValue("StartDate").elementAt(0);
vefrom.setAnyTime();
// as long as the StartDate is between the selected from and to
if (vefrom >= from && vefrom <= to) {
if (ve.getDocument().getItemValueString("StaffName") !=
"Company") {
docUNIDarray.push(ve.getDocument().getUniversalID());
total += 1;
}
}
}
ve = vec.getNextEntry(ve);
}
view.postScript('alert("total:'+total+', from:'+from+', to:'+to+',
tag:'+uitag+'")');
Also, the only full refresh that I did is when clicking the button.
There's also no scoped variable in this page. Only 2 date-time picker, a
combobox, and the button itself. Any explanation for this? I'm confirmed
the code is correct because it work in XPiNC.
The total number of documents that I got is supposed to be 18. If I append
.toJavaDate() to from, to, and vefrom, then I get 10 documents which is
wrong. I've checked the underlying value of "StartDate" and "EndDate" for
each document and each value is of Time/Date like 08/12/2013 12:00:00 PM
ZE8. I assume that converting and any date value in my code to
NotesDateTime will ensure that all have the same type and can be compared
to but for this one I'm totally don't know what I did wrong.
I'm doing the quick XAgent style view export to excel. But first I need to
get a the UNID of the documents that match the criteria that I selected on
my XPage. I have a button that will get the number of document found. I've
confirmed and verified that I have the documents based on the value that I
select but it always return zero document in the alert when in web
browser. For now the code in the button is as following:
uifrom = getComponent("from_dtpicker").getValue(); // a date-time picker
uito = getComponent("to_dtpicker").getValue(); // a date-time picker
uitag = getComponent("tag_combox").getValue(); // a combobox
var from:NotesDateTime = session.createDateTime(uifrom);
from.setAnyTime();
var to:NotesDateTime = session.createDateTime(uito);
to.setAnyTime();
var vw:NotesView = database.getView("(Document View by Tag)");
var docUNIDarray:Array = []; // for the quick XAgent excel export later on
if (uitag == "All") {
var vec:NotesViewEntryCollection = vw.getAllEntries();
} else {
var vec:NotesViewEntryCollection = vw.getAllEntriesByKey(uitag, true);
}
var total:Number = 0;
var ve:NotesViewEntry = vec.getFirstEntry();
while (ve != null) {
// document must have StartDate and EndDate
if (ve.getDocument().hasItem("StartDate") &&
ve.getDocument().hasItem("EndDate")) {
var vefrom:NotesDateTime =
ve.getDocument().getItemValue("StartDate").elementAt(0);
vefrom.setAnyTime();
// as long as the StartDate is between the selected from and to
if (vefrom >= from && vefrom <= to) {
if (ve.getDocument().getItemValueString("StaffName") !=
"Company") {
docUNIDarray.push(ve.getDocument().getUniversalID());
total += 1;
}
}
}
ve = vec.getNextEntry(ve);
}
view.postScript('alert("total:'+total+', from:'+from+', to:'+to+',
tag:'+uitag+'")');
Also, the only full refresh that I did is when clicking the button.
There's also no scoped variable in this page. Only 2 date-time picker, a
combobox, and the button itself. Any explanation for this? I'm confirmed
the code is correct because it work in XPiNC.
The total number of documents that I got is supposed to be 18. If I append
.toJavaDate() to from, to, and vefrom, then I get 10 documents which is
wrong. I've checked the underlying value of "StartDate" and "EndDate" for
each document and each value is of Time/Date like 08/12/2013 12:00:00 PM
ZE8. I assume that converting and any date value in my code to
NotesDateTime will ensure that all have the same type and can be compared
to but for this one I'm totally don't know what I did wrong.
Facebook iOS SDK sometimes returns null for email
Facebook iOS SDK sometimes returns null for email
I'm trying to get the users name, facebook id and their email by logging
in through my app. The following is in my app delegate:
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI
:(FBSessionStateHandler)handler{
NSArray *permissions = [NSArray arrayWithObjects:@"basic_info",
@"email", nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI completionHandler:handler];
}
and my completionHandler code and all is here:
void (^fbCompletionHandler)(FBSession *session, FBSessionState state,
NSError *error) = ^(FBSession *session, FBSessionState state, NSError
*error) {
switch (state) {
case FBSessionStateOpen:
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
if (error && [FBErrorUtility shouldNotifyUserForError:error]) {
NSLog(@"%@", error.localizedDescription);
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Oops" message:[FBErrorUtility
userMessageForError:error] delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
if (session.isOpen) {
[[FBRequest requestForMe]
startWithCompletionHandler:^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {
[self performLoginOperation:user];
}
}];
}
};
and I'm accessing the users email like so: [user objectForKey:@"email"].
Most of the time it works, but every now and then I get a nil value. I'm
not sure why since I set it so in the permissions? Is there any other
reason for this?
I'm trying to get the users name, facebook id and their email by logging
in through my app. The following is in my app delegate:
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI
:(FBSessionStateHandler)handler{
NSArray *permissions = [NSArray arrayWithObjects:@"basic_info",
@"email", nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI completionHandler:handler];
}
and my completionHandler code and all is here:
void (^fbCompletionHandler)(FBSession *session, FBSessionState state,
NSError *error) = ^(FBSession *session, FBSessionState state, NSError
*error) {
switch (state) {
case FBSessionStateOpen:
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
if (error && [FBErrorUtility shouldNotifyUserForError:error]) {
NSLog(@"%@", error.localizedDescription);
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Oops" message:[FBErrorUtility
userMessageForError:error] delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
if (session.isOpen) {
[[FBRequest requestForMe]
startWithCompletionHandler:^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {
[self performLoginOperation:user];
}
}];
}
};
and I'm accessing the users email like so: [user objectForKey:@"email"].
Most of the time it works, but every now and then I get a nil value. I'm
not sure why since I set it so in the permissions? Is there any other
reason for this?
How do I create an Approval Workflow that updates the List Item that started the Workflow?
How do I create an Approval Workflow that updates the List Item that
started the Workflow?
I'm using SharePoint 2010 and I'm trying to create a workflow for a Help
Desk List that will track tickets.
Here is the (intended) business process:
User generates a new Help Desk List Item (contains description of issue) ->
A new Approval Task is created for the User's Manager (which is tracked
through another List, called Help Desk Tasks) ->
When the Manager Approves or Rejects it, the Task is updated to Complete ->
If the Manager Approves it, the original Help Desk List item should have
its Status set to In Development. If the Manager Rejects it, the original
Help Desk List item should have its Status set to Cancelled.
Right now, this doesn't work. I can either set it up as an Approval
Workflow but it won't update the fields for the Current Item, or I can set
it up as a List Workflow and I can update the fields, but the Approval
Task never starts.
Am I doing something wrong or am I missing something? Any help is
appreciated.
started the Workflow?
I'm using SharePoint 2010 and I'm trying to create a workflow for a Help
Desk List that will track tickets.
Here is the (intended) business process:
User generates a new Help Desk List Item (contains description of issue) ->
A new Approval Task is created for the User's Manager (which is tracked
through another List, called Help Desk Tasks) ->
When the Manager Approves or Rejects it, the Task is updated to Complete ->
If the Manager Approves it, the original Help Desk List item should have
its Status set to In Development. If the Manager Rejects it, the original
Help Desk List item should have its Status set to Cancelled.
Right now, this doesn't work. I can either set it up as an Approval
Workflow but it won't update the fields for the Current Item, or I can set
it up as a List Workflow and I can update the fields, but the Approval
Task never starts.
Am I doing something wrong or am I missing something? Any help is
appreciated.
Sidebar to the bottom of the page
Sidebar to the bottom of the page
I'm wondering how to get my sidebar to the bottom of the page. There's a
background image of a map but I'd like it to stay where it is and just
extend the color to the bottom of the page.
Here's the link to my web page And here's part of my CSS:
/* Sidebar */
#sidebar {
height: 100%;
width: 318px;
float: left;
position: absolute;
padding: 20px 0 0 0;
background-color: #e7d9c9;
background-repeat: no-repeat;
background-image: url('/imgs/map.png');
}
#sidebar h1 {
padding: 0 0 20px 0;
margin: 0 20px 20px 20px;
border-bottom: 1px solid #62879e;
}
.sidetext {
padding: 5px 20px;
font-size: 22px;
color: #62879e;
font-family: Helvetica Neue;
padding-bottom: 110px;
}
.sidelink ul {
margin: 0 20px 0 20px;
padding: 0;
}
.sidelink li {
display: block;
list-style: none;
}
.sidelink li a {
display:block;
font-family: Helvetica Neue;
font-size:16px;
color: #62879e;
text-decoration:none;
border-bottom: 1px solid #62879e;
padding: 10px 0 10px 0;
}
.sidelink li a:hover {
border-left:14px solid #1e416f;
color: #1e416f;
padding: 10px 10px 10px 10px;
}
HTML:
<!-- SIDEBAR -->
<div id="sidebar">
<h1>Caul / Cbua</h1>
<div class="sidetext">
Duis aute irure dolor in rep-rehenderit in voluptate velit esse cillum
dolor eu fugiat nulla pariatur. fugiat nulla pariatur.
</div>
<h1>Commit</h1>
<div class="sidelink">
<ul>
<li><a href="#">Lorem Ipsum</a></li>
<li><a href="#">Lorem Ipsum</a></li>
<li><a href="#">Lorem Ipsum</a></li>
<li><a href="#">Lorem Ipsum</a></li>
</ul>
</div>
</div>
I'm wondering how to get my sidebar to the bottom of the page. There's a
background image of a map but I'd like it to stay where it is and just
extend the color to the bottom of the page.
Here's the link to my web page And here's part of my CSS:
/* Sidebar */
#sidebar {
height: 100%;
width: 318px;
float: left;
position: absolute;
padding: 20px 0 0 0;
background-color: #e7d9c9;
background-repeat: no-repeat;
background-image: url('/imgs/map.png');
}
#sidebar h1 {
padding: 0 0 20px 0;
margin: 0 20px 20px 20px;
border-bottom: 1px solid #62879e;
}
.sidetext {
padding: 5px 20px;
font-size: 22px;
color: #62879e;
font-family: Helvetica Neue;
padding-bottom: 110px;
}
.sidelink ul {
margin: 0 20px 0 20px;
padding: 0;
}
.sidelink li {
display: block;
list-style: none;
}
.sidelink li a {
display:block;
font-family: Helvetica Neue;
font-size:16px;
color: #62879e;
text-decoration:none;
border-bottom: 1px solid #62879e;
padding: 10px 0 10px 0;
}
.sidelink li a:hover {
border-left:14px solid #1e416f;
color: #1e416f;
padding: 10px 10px 10px 10px;
}
HTML:
<!-- SIDEBAR -->
<div id="sidebar">
<h1>Caul / Cbua</h1>
<div class="sidetext">
Duis aute irure dolor in rep-rehenderit in voluptate velit esse cillum
dolor eu fugiat nulla pariatur. fugiat nulla pariatur.
</div>
<h1>Commit</h1>
<div class="sidelink">
<ul>
<li><a href="#">Lorem Ipsum</a></li>
<li><a href="#">Lorem Ipsum</a></li>
<li><a href="#">Lorem Ipsum</a></li>
<li><a href="#">Lorem Ipsum</a></li>
</ul>
</div>
</div>
preg_replace to delete something in a special string
preg_replace to delete something in a special string
Hi I tried to delete something in a string. But I don't know ho to make it.
My string:
@trash='test1',value1='test2',@trash='test3',value2='test4'
I want to delete all with @trash for example = @trash='test1',.
Perhaps important is, that of course the value in the example above
"test1" is allways changing.
Hi I tried to delete something in a string. But I don't know ho to make it.
My string:
@trash='test1',value1='test2',@trash='test3',value2='test4'
I want to delete all with @trash for example = @trash='test1',.
Perhaps important is, that of course the value in the example above
"test1" is allways changing.
twitter bootstrap accordion IE 9 troubles with selectbox
twitter bootstrap accordion IE 9 troubles with selectbox
I'm using angularJS with twitter bootstrap. in my html page i'm using
accordion and in the content of the accordion I have a select box. it
works fine with firfox, ie10, chrome ... but in IE9 it cuts off the text
in the select box. it only shows the first letter of the text of the
preselected value. if i click in the select box, i can see the whole text.
can anybody tell me, how to fix this problem? it seems to be a problem
with the accordion, because if i put the selectbox outside of the
accordion, the selectbox also works in IE9.
I'm using angularJS with twitter bootstrap. in my html page i'm using
accordion and in the content of the accordion I have a select box. it
works fine with firfox, ie10, chrome ... but in IE9 it cuts off the text
in the select box. it only shows the first letter of the text of the
preselected value. if i click in the select box, i can see the whole text.
can anybody tell me, how to fix this problem? it seems to be a problem
with the accordion, because if i put the selectbox outside of the
accordion, the selectbox also works in IE9.
JSF EL Resolver h:outputText value format
JSF EL Resolver h:outputText value format
following situation ... we have an own class, let's say MyType and we have
a MyTypeConverter (=FacesConverter).
MyType { String s; getS();}
@FacesConverter(forClass=MyType.class)
MyTypeConverter {
public String getAsString() { return ((MyType)o).getS().toUpperCase();}
}
MyBean {
getMyType() { return new MyType("hallo");}
}
<h:outputText value="#{myBean.myType}"/>
works fine
HALLO
Now:
<h:outputText value="(#{myBean.myType})"/>
Expectation:
(HALLO)
Result:
(org.playground.model.MyType@cb4a479)
Is there any EL Resolver, which can handle this?
We're running on a JBoss AS 7.1.1.Final.
Cheers and thx for any advice.
following situation ... we have an own class, let's say MyType and we have
a MyTypeConverter (=FacesConverter).
MyType { String s; getS();}
@FacesConverter(forClass=MyType.class)
MyTypeConverter {
public String getAsString() { return ((MyType)o).getS().toUpperCase();}
}
MyBean {
getMyType() { return new MyType("hallo");}
}
<h:outputText value="#{myBean.myType}"/>
works fine
HALLO
Now:
<h:outputText value="(#{myBean.myType})"/>
Expectation:
(HALLO)
Result:
(org.playground.model.MyType@cb4a479)
Is there any EL Resolver, which can handle this?
We're running on a JBoss AS 7.1.1.Final.
Cheers and thx for any advice.
Sunday, 25 August 2013
How to start the dictionary application after installation?
How to start the dictionary application after installation?
I installed a dictionary application using this site: -
http://www.noobslab.com/2011/07/install-offline-ubuntu-dictionary.html but
after installation when I searched for it on / , I didn't see any
application file that was to be launched (like I do for other
applications). Could anyone help me open this application please? If not,
is there any good dictionary app that I can install instead?
I installed a dictionary application using this site: -
http://www.noobslab.com/2011/07/install-offline-ubuntu-dictionary.html but
after installation when I searched for it on / , I didn't see any
application file that was to be launched (like I do for other
applications). Could anyone help me open this application please? If not,
is there any good dictionary app that I can install instead?
Python win32com constants
Python win32com constants
I'm currently wondering how to list the constants in win32com in python,
for example using excel win32com.client.Dispatch('Excel.Application')
Is there a way to display all constants using win32com.client.Constants ?
Or does someone know where i could find win32com's documentation ? Because
all the links I found are dead ...
I'm currently wondering how to list the constants in win32com in python,
for example using excel win32com.client.Dispatch('Excel.Application')
Is there a way to display all constants using win32com.client.Constants ?
Or does someone know where i could find win32com's documentation ? Because
all the links I found are dead ...
Mutagen : Replacement of cover in MP4 file
Mutagen : Replacement of cover in MP4 file
I'm trying to reduce the image (cover) of multiple audio files. I have
troubles to set the newer image in metadata.
from mutagen.mp4 import MP4
from mutagen.mp4 import MP4Cover
from PIL import Image
from StringIO import StringIO
def main():
# Open mp4 file for reading
my_mp4 = MP4("1.m4a")
# Retrieves all covers in list
covers = my_mp4.tags['covr']
if not covers:
exit()
tmp = StringIO(covers[0])
# Reduce the image
img = Image.open(tmp)
img.thumbnail((128, 128), Image.ANTIALIAS)
img.save(tmp, 'JPEG')
# Set the image in metadata
my_mp4.tags['covr'] = MP4Cover(tmp.getvalue())
tmp.close()
my_mp4.pprint()
# Save metadata
my_mp4.save()
The code crash when I'm calling the pprint function. Without it, the
result isn't as expected.
File "convert.py", line 41, in <module>
main()
File "convert.py", line 36, in main
my_mp4.pprint()
File "/[…]/python2.7/site-packages/mutagen/__init__.py", line 138, in
pprint
try: tags = self.tags.pprint()
File "/[…]/python2.7/site-packages/mutagen/mp4.py", line 611, in pprint
values.append("%s=%s" % (key, " / ".join(map(unicode, value))))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 22:
ordinal not in range(128)
I already tried to call some decode and encode functions. I think the
problem is because my jpeg image is of type str and metadata of type
unicode str.
I'm trying to reduce the image (cover) of multiple audio files. I have
troubles to set the newer image in metadata.
from mutagen.mp4 import MP4
from mutagen.mp4 import MP4Cover
from PIL import Image
from StringIO import StringIO
def main():
# Open mp4 file for reading
my_mp4 = MP4("1.m4a")
# Retrieves all covers in list
covers = my_mp4.tags['covr']
if not covers:
exit()
tmp = StringIO(covers[0])
# Reduce the image
img = Image.open(tmp)
img.thumbnail((128, 128), Image.ANTIALIAS)
img.save(tmp, 'JPEG')
# Set the image in metadata
my_mp4.tags['covr'] = MP4Cover(tmp.getvalue())
tmp.close()
my_mp4.pprint()
# Save metadata
my_mp4.save()
The code crash when I'm calling the pprint function. Without it, the
result isn't as expected.
File "convert.py", line 41, in <module>
main()
File "convert.py", line 36, in main
my_mp4.pprint()
File "/[…]/python2.7/site-packages/mutagen/__init__.py", line 138, in
pprint
try: tags = self.tags.pprint()
File "/[…]/python2.7/site-packages/mutagen/mp4.py", line 611, in pprint
values.append("%s=%s" % (key, " / ".join(map(unicode, value))))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 22:
ordinal not in range(128)
I already tried to call some decode and encode functions. I think the
problem is because my jpeg image is of type str and metadata of type
unicode str.
[ Cats ] Open Question : Why are cats scared of water?
[ Cats ] Open Question : Why are cats scared of water?
Java NIO server how to read variable-len packets w/out any header
Java NIO server how to read variable-len packets w/out any header
I'm learning to make Minecraft servers similar to Bukkit for fun. I've
dealt with NIO before but not very much and not in a practical way. I'm
encountering an issue right now where Minecraft has many variable-length
packets and since there's not any sort of consistent "header" for these
packets of data, NIO is doing this weird thing where it fragments packets
because the data isn't always sent immediately in full.
I learned recently that this is a thing from this thread: Java: reading
variable-size packets using NIO I'd rather not use Netty/MINA/etc. because
I'd like to learn this all myself as I'm doing this for the education and
not with the intention of making it some huge project.
So my question is, how exactly do I go about preventing this sort of
fragmenting of packets? I tried using Nagle's algorithm in
java.net.Socket#setTcpNoDelay(boolean on) but oddly enough, all this does
is make it so that every single time the packet is sent, it's fragmented,
whereas when I don't have it enabled, the first packet always comes
through OK, and then the following packets become fragmented.
I followed the Rox Java NIO Tutorial pretty closely so I know this code
should work, but that tutorial only went as far as echoing a string
message back to peers, not complicated bytestreams.
Here's my code. For some context, I'm using Executor#execute(Runnable) to
create the two threads. Since I'm still learning about threads and
concurrency and trying to piece them together with networking, any
feedback on that would be very appreciated as well!!
ServerSocketManager ServerDataManager
Thanks a lot, I know this is quite a bit of stuff to take in, so I can't
thank you enough for taking the time to read & respond!!
I'm learning to make Minecraft servers similar to Bukkit for fun. I've
dealt with NIO before but not very much and not in a practical way. I'm
encountering an issue right now where Minecraft has many variable-length
packets and since there's not any sort of consistent "header" for these
packets of data, NIO is doing this weird thing where it fragments packets
because the data isn't always sent immediately in full.
I learned recently that this is a thing from this thread: Java: reading
variable-size packets using NIO I'd rather not use Netty/MINA/etc. because
I'd like to learn this all myself as I'm doing this for the education and
not with the intention of making it some huge project.
So my question is, how exactly do I go about preventing this sort of
fragmenting of packets? I tried using Nagle's algorithm in
java.net.Socket#setTcpNoDelay(boolean on) but oddly enough, all this does
is make it so that every single time the packet is sent, it's fragmented,
whereas when I don't have it enabled, the first packet always comes
through OK, and then the following packets become fragmented.
I followed the Rox Java NIO Tutorial pretty closely so I know this code
should work, but that tutorial only went as far as echoing a string
message back to peers, not complicated bytestreams.
Here's my code. For some context, I'm using Executor#execute(Runnable) to
create the two threads. Since I'm still learning about threads and
concurrency and trying to piece them together with networking, any
feedback on that would be very appreciated as well!!
ServerSocketManager ServerDataManager
Thanks a lot, I know this is quite a bit of stuff to take in, so I can't
thank you enough for taking the time to read & respond!!
Saturday, 24 August 2013
GLSL - Declaring global variables outside of the main loop
GLSL - Declaring global variables outside of the main loop
Does it help to declare variables outside of your main loop in GLSL? Do
these variables actually get reused and is it more efficient?
Here is the code in question:
varying vec2 vposition;
uniform float seed;
uniform float top;
uniform float bottom;
uniform float phi;
uniform float theta;
uniform float scaledPI;
uniform float yn;
uniform float ym;
uniform float rx;
uniform float ry;
uniform float radius;
const float PI = 3.141592653589793238462643383;
float left;
float right;
float mscaled;
float xn;
float xm;
void main() {
float t = vposition.y * yn + ym;
if(t <= 0.0 || t >= PI){
left = phi - PI;
right = phi + PI;
}else{
mscaled = scaledPI / (1 - abs(Math.cos(theta)));
mscaled = mscaled < PI ? mscaled : PI;
left = phi - mscaled;
right = phi + mscaled;
}
xn = (left - right) / ((-rx / 2.0) - (rx / 2.0));
xm = left - ((-rx/2.0) * xn);
float p = vposition.x * xn + xm;
vec3 coords = vec3( sin(p) * sin(t), cos(t), cos(p) * sin(t) );
float nv = surface( vec4( coords, seed ) );
gl_FragColor = vec4( vec3( nv, nv, nv ), 1.0 );
}
Does it help to declare variables outside of your main loop in GLSL? Do
these variables actually get reused and is it more efficient?
Here is the code in question:
varying vec2 vposition;
uniform float seed;
uniform float top;
uniform float bottom;
uniform float phi;
uniform float theta;
uniform float scaledPI;
uniform float yn;
uniform float ym;
uniform float rx;
uniform float ry;
uniform float radius;
const float PI = 3.141592653589793238462643383;
float left;
float right;
float mscaled;
float xn;
float xm;
void main() {
float t = vposition.y * yn + ym;
if(t <= 0.0 || t >= PI){
left = phi - PI;
right = phi + PI;
}else{
mscaled = scaledPI / (1 - abs(Math.cos(theta)));
mscaled = mscaled < PI ? mscaled : PI;
left = phi - mscaled;
right = phi + mscaled;
}
xn = (left - right) / ((-rx / 2.0) - (rx / 2.0));
xm = left - ((-rx/2.0) * xn);
float p = vposition.x * xn + xm;
vec3 coords = vec3( sin(p) * sin(t), cos(t), cos(p) * sin(t) );
float nv = surface( vec4( coords, seed ) );
gl_FragColor = vec4( vec3( nv, nv, nv ), 1.0 );
}
each time my client gets mails sent from his form on his website by clients
each time my client gets mails sent from his form on his website by clients
the two first characters from the subject field and from the textarea are
been deleted/missing. what could be the reason?
the two first characters from the subject field and from the textarea are
been deleted/missing. what could be the reason?
My tabs are not working as they should
My tabs are not working as they should
I just finished writing my code for my navigation tabs using HTML5 and
CSS3, but I'm having an issue! The tabs work perfectly in notepad, but
when I put it in my website, it just doesn't work.
This is my CSS code: nav ul ul { display: none; }
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -moz-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -webkit-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
box-shadow: 0px 0px 9px 0px rgba(0,0,0,0.15);
padding: 0px 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 10px 40px;
color: #757575; text-decoration: none;
font-family:arial;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0px;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 10px 40px;
color: #fff;
font-family:arial; font-weight:900;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
The following is the HTML code I use to place them in the website:
<center><nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="">Arcade</a>
<ul>
<li><a href="/arcade/action">Action</a></li>
<li><a href="/arcade/arcade">Arcade</a></li>
<li><a href="/arcade/puzzle">Puzzle</a></li>
<li><a href="/arcade/vehicle">Vehicle</a></li>
<li><a href="/arcade/violence">Violence</a></li>
<li><a href="/arcade/defense">Defense</a></li>
<li><a href="/arcade/pointnclick">Point N Click</a></li>
<li><a href="/arcade/rpg">RPG</a></li>
</ul>
</li>
<li><a href="">Watch</a>
<ul>
<li><a href="/watch/tv">TV Shows</a></li>
<li><a href="/watch/movies">Movies</a></li>
</ul>
</li>
<li><a href="">Extras</a>
<ul>
<li><a href="/news">News</a></li>
<li><a href="/updates">Updates</a></li>
</ul>
</li>
<li><a href="/support">Support</a></li>
</ul>
</nav></center>
If I delete the Home tab, the Arcade tab takes its place and looks the
same way. Any ideas?
My website that this is happening on is: http://gameshank.com/8-20-13/
Thanks ahead!
I just finished writing my code for my navigation tabs using HTML5 and
CSS3, but I'm having an issue! The tabs work perfectly in notepad, but
when I put it in my website, it just doesn't work.
This is my CSS code: nav ul ul { display: none; }
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -moz-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -webkit-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
box-shadow: 0px 0px 9px 0px rgba(0,0,0,0.15);
padding: 0px 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 10px 40px;
color: #757575; text-decoration: none;
font-family:arial;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0px;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 10px 40px;
color: #fff;
font-family:arial; font-weight:900;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
The following is the HTML code I use to place them in the website:
<center><nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="">Arcade</a>
<ul>
<li><a href="/arcade/action">Action</a></li>
<li><a href="/arcade/arcade">Arcade</a></li>
<li><a href="/arcade/puzzle">Puzzle</a></li>
<li><a href="/arcade/vehicle">Vehicle</a></li>
<li><a href="/arcade/violence">Violence</a></li>
<li><a href="/arcade/defense">Defense</a></li>
<li><a href="/arcade/pointnclick">Point N Click</a></li>
<li><a href="/arcade/rpg">RPG</a></li>
</ul>
</li>
<li><a href="">Watch</a>
<ul>
<li><a href="/watch/tv">TV Shows</a></li>
<li><a href="/watch/movies">Movies</a></li>
</ul>
</li>
<li><a href="">Extras</a>
<ul>
<li><a href="/news">News</a></li>
<li><a href="/updates">Updates</a></li>
</ul>
</li>
<li><a href="/support">Support</a></li>
</ul>
</nav></center>
If I delete the Home tab, the Arcade tab takes its place and looks the
same way. Any ideas?
My website that this is happening on is: http://gameshank.com/8-20-13/
Thanks ahead!
Oracle XML functions with large datasets
Oracle XML functions with large datasets
I have problems to use the Oracle XML functions like
xmlelement, xmlagg, xmlattributes
For instance:
select
XMLELEMENT(
"OrdrList",
XMLAGG(
XMLELEMENT(
"IDs",
XMLATTRIBUTES(
USERCODE AS "usrCode",
VALDATE AS "validityDate"
)
)
)
) from TMP
/
The code seems to be correct as it does work when returning a small number
of messages
And yes, I did try to set "long", "pagesize", "linesize" etc... but have
never been able to retrieve the full set of approx. 500.000 XML-messages
(i.e. table rows).
Reading some background literature (e.g. "Oracle SQL" by Jürgen Sieben) it
seems that the functions are not designed for large data sets. Mr. Sieben
explains that he uses these only for small queries (max. 1 MB output
size), above that he recommends to use "object-oriented functions" but
does not explain which.
Does somebody have experience with this and has the above XML-functions
working or knows alternatives?
I have problems to use the Oracle XML functions like
xmlelement, xmlagg, xmlattributes
For instance:
select
XMLELEMENT(
"OrdrList",
XMLAGG(
XMLELEMENT(
"IDs",
XMLATTRIBUTES(
USERCODE AS "usrCode",
VALDATE AS "validityDate"
)
)
)
) from TMP
/
The code seems to be correct as it does work when returning a small number
of messages
And yes, I did try to set "long", "pagesize", "linesize" etc... but have
never been able to retrieve the full set of approx. 500.000 XML-messages
(i.e. table rows).
Reading some background literature (e.g. "Oracle SQL" by Jürgen Sieben) it
seems that the functions are not designed for large data sets. Mr. Sieben
explains that he uses these only for small queries (max. 1 MB output
size), above that he recommends to use "object-oriented functions" but
does not explain which.
Does somebody have experience with this and has the above XML-functions
working or knows alternatives?
Theme.AppCompat not found using v7-appcompat APKLIB
Theme.AppCompat not found using v7-appcompat APKLIB
I've added the v4 and v7-appcompat support dependecies into my pom.xml file:
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>18</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>18</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4</artifactId>
<version>18</version>
</dependency>
And now I want to add the AppCompat style to my activities, but it's not
found. It seems the AppCompat resources have not been loaded from the
APKLIB.
Does anyone know why that's happening?
Thanks!
I've added the v4 and v7-appcompat support dependecies into my pom.xml file:
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>18</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>18</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4</artifactId>
<version>18</version>
</dependency>
And now I want to add the AppCompat style to my activities, but it's not
found. It seems the AppCompat resources have not been loaded from the
APKLIB.
Does anyone know why that's happening?
Thanks!
Multiple lattice plots with gridExtra
Multiple lattice plots with gridExtra
There is very convenient way of plotting multiple graphs and that's with
gridExtra - grid.arrange:
grid.arrange(plot1,plot2,plot3,plot4,plot5,plot6,plot7,plot8,plot9, ncol=3)
The above command draws 3x3 graphs in one window.
Now, I'm using my own lattice setup to draw unique lines etc. via
trellis.par.set(my.setup)
However using the grid.arrange command for plotting multiple plots won't
pass on the setup as the output plots are in default colours.
So the question is how to pass on the my.setup onto grid.arrange or
alternatively how to plot easily multiple graphs in one go for lattice.
There is very convenient way of plotting multiple graphs and that's with
gridExtra - grid.arrange:
grid.arrange(plot1,plot2,plot3,plot4,plot5,plot6,plot7,plot8,plot9, ncol=3)
The above command draws 3x3 graphs in one window.
Now, I'm using my own lattice setup to draw unique lines etc. via
trellis.par.set(my.setup)
However using the grid.arrange command for plotting multiple plots won't
pass on the setup as the output plots are in default colours.
So the question is how to pass on the my.setup onto grid.arrange or
alternatively how to plot easily multiple graphs in one go for lattice.
How to Install Ubuntu on my Laptop
How to Install Ubuntu on my Laptop
After downloading the Ubuntu ISO file, how do I install it in my laptop. I
have Hp probook, Windows 8 pro x64.Please Help.
After downloading the Ubuntu ISO file, how do I install it in my laptop. I
have Hp probook, Windows 8 pro x64.Please Help.
Convert Array formatted as a string - Python
Convert Array formatted as a string - Python
I am receving a string through a socket like so
"['[0,0,0]','[0,0,0]']"
I would like to convert it back to a string. I have tried using
received.split(",")
however it splits up the arrays inside the array.
How would I go about converting the string to an array?
I am receving a string through a socket like so
"['[0,0,0]','[0,0,0]']"
I would like to convert it back to a string. I have tried using
received.split(",")
however it splits up the arrays inside the array.
How would I go about converting the string to an array?
Friday, 23 August 2013
Why FB.login doesn't ask me for permissions
Why FB.login doesn't ask me for permissions
When I try to publish something with the following code:
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me/feed','post',{
name: "Nombre",
link: "http://radio/player/bbc_world_service",
description: "This is test",
message : "xxxxxxxx"
},function(response) {
//
});
}else {
//
}
},{scope: 'publish_actions','user_likes'});
It doesn't ask me for any permissions, just publishes in my timelime
directly. As far as i know theoretically it must ask me for permissions.
But i try to do the same thing through facebook explorer, it does ask for.
When I try to publish something with the following code:
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me/feed','post',{
name: "Nombre",
link: "http://radio/player/bbc_world_service",
description: "This is test",
message : "xxxxxxxx"
},function(response) {
//
});
}else {
//
}
},{scope: 'publish_actions','user_likes'});
It doesn't ask me for any permissions, just publishes in my timelime
directly. As far as i know theoretically it must ask me for permissions.
But i try to do the same thing through facebook explorer, it does ask for.
Custom toolbar location XP
Custom toolbar location XP
A few years ago Umber Ferrule wrote that the toolbars in the taskbar are
defined in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams.
This looks very plausible but cannot be the entire story. Deleting this
key will in no way affect the taskbar and on rebooting the system the key
magically reappears.
Why do I want to know? Simple. I would like to export the key to a reg.
file as a convenient backup.
A few years ago Umber Ferrule wrote that the toolbars in the taskbar are
defined in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams.
This looks very plausible but cannot be the entire story. Deleting this
key will in no way affect the taskbar and on rebooting the system the key
magically reappears.
Why do I want to know? Simple. I would like to export the key to a reg.
file as a convenient backup.
PHP MySQL search using WHERE IN
PHP MySQL search using WHERE IN
I have my following PHP code which finds the servers which have and tags
assigned to them. In my example its bending, economy. The script gets a
server that has both but displays it twice. What is the best way to stop
this?
Please note that the tags are stored in a seperate table and are obtained
by searching via the server id.
$sql = "SELECT s.id, s.name, s.ip, s.port, ss.id, ss.votes, ss.added, (1.6
* ss.votes + .053) * GREATEST(1, DATEDIFF(NOW(), ss.added)) AS score,
GREATEST(1, DATEDIFF(NOW(), ss.added)) AS days
FROM servers AS s
LEFT JOIN server_score AS ss
ON s.id = ss.id
ORDER BY score DESC
LIMIT $start, $limit";
I have my following PHP code which finds the servers which have and tags
assigned to them. In my example its bending, economy. The script gets a
server that has both but displays it twice. What is the best way to stop
this?
Please note that the tags are stored in a seperate table and are obtained
by searching via the server id.
$sql = "SELECT s.id, s.name, s.ip, s.port, ss.id, ss.votes, ss.added, (1.6
* ss.votes + .053) * GREATEST(1, DATEDIFF(NOW(), ss.added)) AS score,
GREATEST(1, DATEDIFF(NOW(), ss.added)) AS days
FROM servers AS s
LEFT JOIN server_score AS ss
ON s.id = ss.id
ORDER BY score DESC
LIMIT $start, $limit";
Will animals spawn less likely in offline mode?
Will animals spawn less likely in offline mode?
In Minecraft I usually play by myself in the single player game mode. Now
I had to disable the internet access on my laptop because of an overload
on internet usage. When playing Minecraft I searched for some pigs and
horses to bring back to my city. after 1 hour of looking all I found were
chickens that I happily murdered. Do animals spawn less frequently in
offline mode or is this just sheer coincidence?
In Minecraft I usually play by myself in the single player game mode. Now
I had to disable the internet access on my laptop because of an overload
on internet usage. When playing Minecraft I searched for some pigs and
horses to bring back to my city. after 1 hour of looking all I found were
chickens that I happily murdered. Do animals spawn less frequently in
offline mode or is this just sheer coincidence?
Can not start server using rails s
Can not start server using rails s
I created a new project using command: rails new [project_name] then I use
rails to start server but it created a new project again instead of
starting server. Thanks in advanced.
I created a new project using command: rails new [project_name] then I use
rails to start server but it created a new project again instead of
starting server. Thanks in advanced.
Thursday, 22 August 2013
Facebook invite friend on only mobile
Facebook invite friend on only mobile
pI have some problems with friend invitation. First, I create my app on
Facebook and/p pmy app is only on mobile. That's mean I have no canvas app
on web. When I send invite within/p pmy mobile. The user that I pick
doesn't get any notification. Do I have to create some canvas/p pon
facebook web? Is that possible to send invite with no app on facebook?
Thanks/p
pI have some problems with friend invitation. First, I create my app on
Facebook and/p pmy app is only on mobile. That's mean I have no canvas app
on web. When I send invite within/p pmy mobile. The user that I pick
doesn't get any notification. Do I have to create some canvas/p pon
facebook web? Is that possible to send invite with no app on facebook?
Thanks/p
PHP Form to redirect with form results.
PHP Form to redirect with form results.
I have a form that when they submit it, it stores the info in the
database. I need to be able to get the form data to come up on redirect
page. It does not need to fetch the database as I would love to do this
PHP style. So lets say they enter there name and city. When they click
submit it redirects them to a thank-you page with the results from the
form on that page...
Any help would be appreciated...Thanks
I have a form that when they submit it, it stores the info in the
database. I need to be able to get the form data to come up on redirect
page. It does not need to fetch the database as I would love to do this
PHP style. So lets say they enter there name and city. When they click
submit it redirects them to a thank-you page with the results from the
form on that page...
Any help would be appreciated...Thanks
Echo each record of a query result
Echo each record of a query result
I'm attempting to extract some data from a database and echo each result.
The code below is code that I took from a textbook and then tried to
modify to fit my own website that is hosted locally. I cannot see where
I'm going wrong, no error messages are shown, just a blank screen when I
run the scrip.
<?php #script 9.4 view top 5 recipients
// This script exctracts data from db and then displays each record in a
table
DEFINE('SYSPATH','FOO');
require '../application/config/database.php';
require 'mysqli_connect.php';
$q = "SELECT alert_recipient as NAME
FROM alert
LIMIT 5;
";
$r = mysqli_query($dbc,$q);
// $dbc database connection comes from required mysqli_connect.php
if($r)
{
while($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
echo $row['name'];
}
}
else {
echo "<p>ERROR</p>".mysqli_error($dbc);
}
?>
I'm attempting to extract some data from a database and echo each result.
The code below is code that I took from a textbook and then tried to
modify to fit my own website that is hosted locally. I cannot see where
I'm going wrong, no error messages are shown, just a blank screen when I
run the scrip.
<?php #script 9.4 view top 5 recipients
// This script exctracts data from db and then displays each record in a
table
DEFINE('SYSPATH','FOO');
require '../application/config/database.php';
require 'mysqli_connect.php';
$q = "SELECT alert_recipient as NAME
FROM alert
LIMIT 5;
";
$r = mysqli_query($dbc,$q);
// $dbc database connection comes from required mysqli_connect.php
if($r)
{
while($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
echo $row['name'];
}
}
else {
echo "<p>ERROR</p>".mysqli_error($dbc);
}
?>
Concrete5 admin site - no input file specified
Concrete5 admin site - no input file specified
My working Conrete5 site recently developed a "no input file specified"
problem on ALL admin pages. The root of the problem appears to be that
admin pages have an unnecessary /index.php in the URL. I.E.
www.www.www.example.com/index.php/login/do_login......
If the /index.php part is removed from the URL the page will load (though
all referenced files will still have /index.php hence fail to load).
I have concrete running in a sub directory but the page urls are from root
e.g.
www.www.example.com/concrete-page-title...
This is the .htaccess file in my root directory relaying concrete requests
to the concrete sub-directory.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.example.co.uk/$1/ [R=301,L]
RewriteCond %{HTTP_HOST} ^example.co.uk$
RewriteRule ^/?(.*)$ http://www.example.co.uk/$1 [R=301,L]
# redirect concrete
RewriteCond %{REQUEST_URI} !^/concrete
# permit normal access to wordpress installation
RewriteCond %{REQUEST_URI} !^/news
RewriteRule ^(.*)$ concrete/$1 [L]
</IfModule>
I have pretty urls turned on, here is the .htaccess file in my concrete
sub-directory (/concrete).
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
Sidenote: cgi.fix_pathinfo=1 (have changed to 0, no change)
And the site is not hosted with GoDaddy.
The sites been for a fair while now with no updates, despite my fiddling I
have had no success so any suggestions greatly welcome.
My working Conrete5 site recently developed a "no input file specified"
problem on ALL admin pages. The root of the problem appears to be that
admin pages have an unnecessary /index.php in the URL. I.E.
www.www.www.example.com/index.php/login/do_login......
If the /index.php part is removed from the URL the page will load (though
all referenced files will still have /index.php hence fail to load).
I have concrete running in a sub directory but the page urls are from root
e.g.
www.www.example.com/concrete-page-title...
This is the .htaccess file in my root directory relaying concrete requests
to the concrete sub-directory.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.example.co.uk/$1/ [R=301,L]
RewriteCond %{HTTP_HOST} ^example.co.uk$
RewriteRule ^/?(.*)$ http://www.example.co.uk/$1 [R=301,L]
# redirect concrete
RewriteCond %{REQUEST_URI} !^/concrete
# permit normal access to wordpress installation
RewriteCond %{REQUEST_URI} !^/news
RewriteRule ^(.*)$ concrete/$1 [L]
</IfModule>
I have pretty urls turned on, here is the .htaccess file in my concrete
sub-directory (/concrete).
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
Sidenote: cgi.fix_pathinfo=1 (have changed to 0, no change)
And the site is not hosted with GoDaddy.
The sites been for a fair while now with no updates, despite my fiddling I
have had no success so any suggestions greatly welcome.
Invalid parameter number error
Invalid parameter number error
<?php
require_once 'database.php';
class Authorization extends Database {
public $vk_id;
public $eu_name;
public $eu_society;
public $eu_notes;
public $eu_want_team;
public function __construct() {
parent::__construct('144.76.6.45','5432','eu','eu','eu123');
$this->vk_id = $_POST['vk_id'];
$this->eu_name = $_POST['eu_name'];
$this->eu_society = $_POST['eu_society'];
$this->eu_notes = $_POST['eu_notes'];
$this->eu_want_team = $_POST['eu_want_team'];
}
function querySelect($query) {
$this->query = $query;
$this->STH = $this->DBH->prepare($this->query);
$this->STH->execute();
$this->STH->setFetchMode(PDO::FETCH_ASSOC);
}
function queryInsert($query) {
$this->query = $query;
$this->STH = $this->DBH->prepare($this->query);
$this->STH->bindParam(':vk_id', $this->vk_id);
$this->STH->bindParam(':eu_name', $this->eu_name);
$this->STH->bindParam(':eu_data', $this->eu_data);
$this->STH->bindParam(':eu_society', $this->eu_society);
$this->STH->bindParam(':eu_notes', $this->eu_notes);
$this->STH->bindParam(':eu_want_team', $this->eu_want_team);
$this->STH->execute();
}
}
try {
$auth = new Authorization();
$auth->queryInsert("INSERT INTO users (vk_id, eu_name, eu_data,
eu_society, eu_notes, eu_want_team) VALUES
(':vk_id',':eu_name',':eu_data',':eu_society',':eu_notes',':eu_want_team')");
echo "Ñîõðàíåíî";
} catch (PDOException $e) {
echo 'Ïîäêëþ÷åíèå íå óäàëîñü: ' . $e->getMessage();
}
Hey, I'm trying to do prepared statements query. but it tells:
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :vk_id in /home/marker/entropia/components/authorization.php on
line 31
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_name in /home/marker/entropia/components/authorization.php on
line 32
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_society in /home/marker/entropia/components/authorization.php
on line 33
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_notes in /home/marker/entropia/components/authorization.php on
line 34
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_want_team in
/home/marker/entropia/components/authorization.php on line 35
Whats the problem?
<?php
require_once 'database.php';
class Authorization extends Database {
public $vk_id;
public $eu_name;
public $eu_society;
public $eu_notes;
public $eu_want_team;
public function __construct() {
parent::__construct('144.76.6.45','5432','eu','eu','eu123');
$this->vk_id = $_POST['vk_id'];
$this->eu_name = $_POST['eu_name'];
$this->eu_society = $_POST['eu_society'];
$this->eu_notes = $_POST['eu_notes'];
$this->eu_want_team = $_POST['eu_want_team'];
}
function querySelect($query) {
$this->query = $query;
$this->STH = $this->DBH->prepare($this->query);
$this->STH->execute();
$this->STH->setFetchMode(PDO::FETCH_ASSOC);
}
function queryInsert($query) {
$this->query = $query;
$this->STH = $this->DBH->prepare($this->query);
$this->STH->bindParam(':vk_id', $this->vk_id);
$this->STH->bindParam(':eu_name', $this->eu_name);
$this->STH->bindParam(':eu_data', $this->eu_data);
$this->STH->bindParam(':eu_society', $this->eu_society);
$this->STH->bindParam(':eu_notes', $this->eu_notes);
$this->STH->bindParam(':eu_want_team', $this->eu_want_team);
$this->STH->execute();
}
}
try {
$auth = new Authorization();
$auth->queryInsert("INSERT INTO users (vk_id, eu_name, eu_data,
eu_society, eu_notes, eu_want_team) VALUES
(':vk_id',':eu_name',':eu_data',':eu_society',':eu_notes',':eu_want_team')");
echo "Ñîõðàíåíî";
} catch (PDOException $e) {
echo 'Ïîäêëþ÷åíèå íå óäàëîñü: ' . $e->getMessage();
}
Hey, I'm trying to do prepared statements query. but it tells:
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :vk_id in /home/marker/entropia/components/authorization.php on
line 31
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_name in /home/marker/entropia/components/authorization.php on
line 32
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_society in /home/marker/entropia/components/authorization.php
on line 33
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_notes in /home/marker/entropia/components/authorization.php on
line 34
Warning: PDOStatement::bindParam(): SQLSTATE[HY093]: Invalid parameter
number: :eu_want_team in
/home/marker/entropia/components/authorization.php on line 35
Whats the problem?
Wednesday, 21 August 2013
if statement that brings a new window
if statement that brings a new window
I'm trying to create a button that triggers an if statement which takes
the content of a text field (which must be a number) and compares it with
some numbers.
IN THE .h FILE I WROTE THIS...
@property (strong, nonatomic) IBOutlet UITextField *textoo;
-(IBAction)Botonn:(id)sender;
IN THE .m FILE I WROTE THIS...
-(IBAction)Botonn
{
if ((_textoo.text>=3)&&(_textoo.text<=5)) {
FirstViewController*first=[[FirstViewController alloc]
initWithNibName:nil bundle:nil];
[self presentViewController:first animated:YES completion:NULL];
}
else {
SecondViewController*second=[[SecondViewController alloc]
initWithNibName:nil bundle:nil];
[self presentViewController:second animated:YES completion:NULL];
}
}
I'm trying to create a button that triggers an if statement which takes
the content of a text field (which must be a number) and compares it with
some numbers.
IN THE .h FILE I WROTE THIS...
@property (strong, nonatomic) IBOutlet UITextField *textoo;
-(IBAction)Botonn:(id)sender;
IN THE .m FILE I WROTE THIS...
-(IBAction)Botonn
{
if ((_textoo.text>=3)&&(_textoo.text<=5)) {
FirstViewController*first=[[FirstViewController alloc]
initWithNibName:nil bundle:nil];
[self presentViewController:first animated:YES completion:NULL];
}
else {
SecondViewController*second=[[SecondViewController alloc]
initWithNibName:nil bundle:nil];
[self presentViewController:second animated:YES completion:NULL];
}
}
Youtube API Ruby_on_rails code behaving very strangely
Youtube API Ruby_on_rails code behaving very strangely
I coded something in ruby which connects to Youtube API. I coded this at
the workplace.
Very strangely, if I run this code at my home, only those inputs that I
used at the workplace works!
Nothing's different between the inputs used at workplace and at my home.
For example, if at workplace I tested with Justin Bieber, then input of
Justin Bieber works at my home, too, but other inputs that haven't been
run at workplace don't work at my home!
I tested this in many ways in many types of inputs. But this issue seems
to be beyond my ability to understand.
Can you suggest some possible causes of this puzzling thing?
I coded something in ruby which connects to Youtube API. I coded this at
the workplace.
Very strangely, if I run this code at my home, only those inputs that I
used at the workplace works!
Nothing's different between the inputs used at workplace and at my home.
For example, if at workplace I tested with Justin Bieber, then input of
Justin Bieber works at my home, too, but other inputs that haven't been
run at workplace don't work at my home!
I tested this in many ways in many types of inputs. But this issue seems
to be beyond my ability to understand.
Can you suggest some possible causes of this puzzling thing?
How to create a scatter plot in R
How to create a scatter plot in R
DataHex <- data.frame(x$codes)
DataHexStd <- data.frame(scale(DataHex))
DataHexStd$x <- rep(1:4, 6)
DataHexStd$y <- rep(1:6, rep(4, 6))
ggplot(DataHexStd, aes(x, y, col = DataHexStd[, 24])) +
scale_colour_gradientn(colours = rainbow(9))+
geom_point(size =20, shape =20) +
theme(legend.position = "none")
x$codes is a SOM output . I used the ggplot to categorized the codes by 9
kinds of colors.
x$codes have 24 rows.each rows correspond to a color.
A matrix
11 12 22
3 5 7
12 2 1
the numbers corresponded to the 24 blocks's colors. in this case , the
pixels of scatter plot is 3*3 and how to put the corresponding colors to
this scatter plot.
DataHex <- data.frame(x$codes)
DataHexStd <- data.frame(scale(DataHex))
DataHexStd$x <- rep(1:4, 6)
DataHexStd$y <- rep(1:6, rep(4, 6))
ggplot(DataHexStd, aes(x, y, col = DataHexStd[, 24])) +
scale_colour_gradientn(colours = rainbow(9))+
geom_point(size =20, shape =20) +
theme(legend.position = "none")
x$codes is a SOM output . I used the ggplot to categorized the codes by 9
kinds of colors.
x$codes have 24 rows.each rows correspond to a color.
A matrix
11 12 22
3 5 7
12 2 1
the numbers corresponded to the 24 blocks's colors. in this case , the
pixels of scatter plot is 3*3 and how to put the corresponding colors to
this scatter plot.
Javascript declared variable is undefine
Javascript declared variable is undefine
So here is the script that I have, basically what it does is toggles some
checkbox images (I'm replacing checkbox with much larger images for easier
clicking) on a page load.
I'm getting the error: [13:26:12.076] TypeError: can't convert undefined
to object @ http://example.com/manage_account_js_snippet.js:17
Why is this? I'd clearly declared checkboxArray already as an object. So
I'm not sure why it keeps throwing this error. My appologies as i'm not
very good with javascript so the answer might be obvious. The page this
error is from is behind a login page so I can't link to it directly sadly.
EDIT: I'm an idiot - knew I forgot something - the line that screws it up
is line #17
$(document).ready(checkthemboxes());
var checkboxArray = {};
function togglecheckbox(checkboxid, forcestate)
{
if(forcestate == "checked")
{
document.getElementById("checkbox_" + checkboxid).checked = true;
document.getElementById("checked" + checkboxid).style.display = "inline";
document.getElementById("unchecked" + checkboxid).style.display = "none";
checkboxArray[checkboxid] = true;
} else if (forcestate == "unchecked") {
document.getElementById("checkbox_" + checkboxid).checked = false;
document.getElementById("checked" + checkboxid).style.display = "none";
document.getElementById("unchecked" + checkboxid).style.display =
"inline";
checkboxArray[checkboxid] = false;
} else {
if(checkboxArray[checkboxid] == 'undefined')
{
checkboxArray[checkboxid] = false;
}
if(!checkboxArray[checkboxid])
{
document.getElementById("checkbox_" + checkboxid).checked = true;
document.getElementById("checked" + checkboxid).style.display =
"inline";
document.getElementById("unchecked" + checkboxid).style.display =
"none";
checkboxArray[checkboxid] = true;
} else {
document.getElementById("checkbox_" + checkboxid).checked = false;
document.getElementById("checked" + checkboxid).style.display = "none";
document.getElementById("unchecked" + checkboxid).style.display =
"inline";
checkboxArray[checkboxid] = false;
}
}
}
function checkthemboxes()
{
var cbs = document.getElementsByClassName('uncheckedcheckbox');
var idname;
for(var i = 0; i < cbs.length; i++) {
if(cbs[i].type == 'checkbox') {
idname = cbs[i].id.replace("checkbox_","");
if(cbs[i].checked == true)
{
togglecheckbox(idname, "checked");
} else {
togglecheckbox(idname, "unchecked");
}
}
}
}
So here is the script that I have, basically what it does is toggles some
checkbox images (I'm replacing checkbox with much larger images for easier
clicking) on a page load.
I'm getting the error: [13:26:12.076] TypeError: can't convert undefined
to object @ http://example.com/manage_account_js_snippet.js:17
Why is this? I'd clearly declared checkboxArray already as an object. So
I'm not sure why it keeps throwing this error. My appologies as i'm not
very good with javascript so the answer might be obvious. The page this
error is from is behind a login page so I can't link to it directly sadly.
EDIT: I'm an idiot - knew I forgot something - the line that screws it up
is line #17
$(document).ready(checkthemboxes());
var checkboxArray = {};
function togglecheckbox(checkboxid, forcestate)
{
if(forcestate == "checked")
{
document.getElementById("checkbox_" + checkboxid).checked = true;
document.getElementById("checked" + checkboxid).style.display = "inline";
document.getElementById("unchecked" + checkboxid).style.display = "none";
checkboxArray[checkboxid] = true;
} else if (forcestate == "unchecked") {
document.getElementById("checkbox_" + checkboxid).checked = false;
document.getElementById("checked" + checkboxid).style.display = "none";
document.getElementById("unchecked" + checkboxid).style.display =
"inline";
checkboxArray[checkboxid] = false;
} else {
if(checkboxArray[checkboxid] == 'undefined')
{
checkboxArray[checkboxid] = false;
}
if(!checkboxArray[checkboxid])
{
document.getElementById("checkbox_" + checkboxid).checked = true;
document.getElementById("checked" + checkboxid).style.display =
"inline";
document.getElementById("unchecked" + checkboxid).style.display =
"none";
checkboxArray[checkboxid] = true;
} else {
document.getElementById("checkbox_" + checkboxid).checked = false;
document.getElementById("checked" + checkboxid).style.display = "none";
document.getElementById("unchecked" + checkboxid).style.display =
"inline";
checkboxArray[checkboxid] = false;
}
}
}
function checkthemboxes()
{
var cbs = document.getElementsByClassName('uncheckedcheckbox');
var idname;
for(var i = 0; i < cbs.length; i++) {
if(cbs[i].type == 'checkbox') {
idname = cbs[i].id.replace("checkbox_","");
if(cbs[i].checked == true)
{
togglecheckbox(idname, "checked");
} else {
togglecheckbox(idname, "unchecked");
}
}
}
}
Whats wrong with my AJAX PHP request?
Whats wrong with my AJAX PHP request?
I'm trying to pass 3 variables to another script in my scripts folder to
query the db.
function resetPassword() {
var user = document.getElementById('username').value;
var password = document.getElementById('password').value;
var conf = document.getElementById('confirm').value;
var code = document.getElementById('code').value;
if(code.length == 0 || password.length == 0 || user.length == 0 ||
conf.length == 0) {
alert("Entries empty");
} else if(password != conf) {
alert("Passwords don't match");
} else {
$.ajax({
type: "POST",
url: "scripts/changepassword.php",
data: {Username: user, Password: password, Code: code},
dataType: "json",
success: function(data) {
alert("success");
}
});
<form>
<input id="username" placeholder="Username" name="username" type="text" />
<input id="password" placeholder="Password" name="password"
type="password" />
<input id="confirm" placeholder="Confirm Password" name="confirm"
type="password" />
<input id="code" placeholder="Code" name="code" type="text" />
<div class="registrationFormAlert" id="incorrectEntry"></div>
<p> </p>
<input class="btn" id="signinbut" onclick="resetPassword()" value="Reset"
type="submit" style="width:28%;" />
</form></div>
In my scripts/changepassword.php
if (isset($_POST['Username']) && isset($_POST['Password'])&&
isset($_POST['Code'])) {
}
it just refreshes the current page doesn't process the request.
I'm trying to pass 3 variables to another script in my scripts folder to
query the db.
function resetPassword() {
var user = document.getElementById('username').value;
var password = document.getElementById('password').value;
var conf = document.getElementById('confirm').value;
var code = document.getElementById('code').value;
if(code.length == 0 || password.length == 0 || user.length == 0 ||
conf.length == 0) {
alert("Entries empty");
} else if(password != conf) {
alert("Passwords don't match");
} else {
$.ajax({
type: "POST",
url: "scripts/changepassword.php",
data: {Username: user, Password: password, Code: code},
dataType: "json",
success: function(data) {
alert("success");
}
});
<form>
<input id="username" placeholder="Username" name="username" type="text" />
<input id="password" placeholder="Password" name="password"
type="password" />
<input id="confirm" placeholder="Confirm Password" name="confirm"
type="password" />
<input id="code" placeholder="Code" name="code" type="text" />
<div class="registrationFormAlert" id="incorrectEntry"></div>
<p> </p>
<input class="btn" id="signinbut" onclick="resetPassword()" value="Reset"
type="submit" style="width:28%;" />
</form></div>
In my scripts/changepassword.php
if (isset($_POST['Username']) && isset($_POST['Password'])&&
isset($_POST['Code'])) {
}
it just refreshes the current page doesn't process the request.
CSS3 : how to show one part of div while re-size window
CSS3 : how to show one part of div while re-size window
Is there any option in responsive to show fixed part of div. for example
<strong> content should should show in all window size.
Demo http://jsfiddle.net/sweetmaanu/DXBRM/
Is there any option in responsive to show fixed part of div. for example
<strong> content should should show in all window size.
Demo http://jsfiddle.net/sweetmaanu/DXBRM/
WCF 3.5, AsyncBridge. Wrap in async-await
WCF 3.5, AsyncBridge. Wrap in async-await
At work I'm currently stuck in 3.5, but we are using the asyncbridge for
async-await. We're using alot of old WCF async calls, and I want to wrap
this into the new async-await pattern.
I'm wrapping this as follows:
// async is wrong
public /*async*/ Task<ScannedDocumentResult>
GetScannedDocumentsTask(String assignmentId)
{
TaskCompletionSource<ScannedDocumentResult> tcs = new
TaskCompletionSource<ScannedDocumentResult>();
EventHandler<GetScannedDocumentsCompletedEventArgs> handler = null;
handler = (o, e) =>
{
if (e.UserState != tcs)
return;
if (e.Error != null)
tcs.SetException(e.Error);
else if (e.Cancelled)
tcs.SetCanceled();
else
tcs.SetResult(e.Result);
GetScannedDocumentsCompleted -= handler;
};
GetScannedDocumentsCompleted += handler;
GetScannedDocumentsAsync(assignmentId, tcs);
return tcs.Task;
}
The following are genereted in the 3.5 WCF proxy:
GetScannedDocumentsAsync GetScannedDocumentsCompleted
GetScannedDocumentsEventArgs
Something tells me that this can be done alot cleaner, have I missed
something cruical?
Also, will this method execute async at all? Compiling with the async
operator just generates an error.
Cheers, Stian
At work I'm currently stuck in 3.5, but we are using the asyncbridge for
async-await. We're using alot of old WCF async calls, and I want to wrap
this into the new async-await pattern.
I'm wrapping this as follows:
// async is wrong
public /*async*/ Task<ScannedDocumentResult>
GetScannedDocumentsTask(String assignmentId)
{
TaskCompletionSource<ScannedDocumentResult> tcs = new
TaskCompletionSource<ScannedDocumentResult>();
EventHandler<GetScannedDocumentsCompletedEventArgs> handler = null;
handler = (o, e) =>
{
if (e.UserState != tcs)
return;
if (e.Error != null)
tcs.SetException(e.Error);
else if (e.Cancelled)
tcs.SetCanceled();
else
tcs.SetResult(e.Result);
GetScannedDocumentsCompleted -= handler;
};
GetScannedDocumentsCompleted += handler;
GetScannedDocumentsAsync(assignmentId, tcs);
return tcs.Task;
}
The following are genereted in the 3.5 WCF proxy:
GetScannedDocumentsAsync GetScannedDocumentsCompleted
GetScannedDocumentsEventArgs
Something tells me that this can be done alot cleaner, have I missed
something cruical?
Also, will this method execute async at all? Compiling with the async
operator just generates an error.
Cheers, Stian
Tuesday, 20 August 2013
Redirecting an active port
Redirecting an active port
Environment: Web server that requests pages on a specific port from an
application server.
Problem: If a page request comes into the application server during the
restart of a certain web application running on the application server,
the start up gets corrupted.
Question: Is it possible to include some kind of block on the specific
port (or redirect) in the beginning of the shell script that starts the
web application? This would have to work "on the fly" and of course be
reversed at the end of the shell script so that once the application was
up and running, the requests would flow normally.
Environment: Web server that requests pages on a specific port from an
application server.
Problem: If a page request comes into the application server during the
restart of a certain web application running on the application server,
the start up gets corrupted.
Question: Is it possible to include some kind of block on the specific
port (or redirect) in the beginning of the shell script that starts the
web application? This would have to work "on the fly" and of course be
reversed at the end of the shell script so that once the application was
up and running, the requests would flow normally.
How can I prevent close session/shutdown/reboot when certain console program is executing?
How can I prevent close session/shutdown/reboot when certain console
program is executing?
I want to disable close session/shutdown/reboot from Gnome (Unity/Lightdm)
when lftp program is executing.
Is there any way? Perhaps with polkit?
program is executing?
I want to disable close session/shutdown/reboot from Gnome (Unity/Lightdm)
when lftp program is executing.
Is there any way? Perhaps with polkit?
ChannelHandlerContext setAttachment Method
ChannelHandlerContext setAttachment Method
So in the Netty 3.x libraries, the class ChannelHandlerContext has a
method named setAttachment. Unfortunately, it doesn't seem to exist in the
new 4.0 libraries. I was wondering if there is a way to put attachment
like on the older libraries.
So in the Netty 3.x libraries, the class ChannelHandlerContext has a
method named setAttachment. Unfortunately, it doesn't seem to exist in the
new 4.0 libraries. I was wondering if there is a way to put attachment
like on the older libraries.
Is there a CKEditor change event that covers toolbar usage?
Is there a CKEditor change event that covers toolbar usage?
Is there a CKEditor event that I can hook up to that fires whenever the
content changes? Ideally I'm looking for an event that fires when anything
at all changes, so for example it could be the user typed something into
the editor, or a toolbar item was used (e.g. changed the font color).
Currently I'm just hooking up to the key event which unsurprisingly only
fires when a key is pressed, and not when for example the font color is
changed via the toolbar.
CKEDITOR.instances['myEditor'].on('key', function () {
console.log("changed");
});
I've also tried using jQuery to delegate a click event on the CKEditor's
parent like below. This partly works, for example it fires if you click
the Bolt/Italic buttons, but not if you change the font color:
$(document).on('click', '#myEditor_DISPLAY', function(){
console.log("changed");
});
I've looked at the documentation here but haven't found this event. If
there's only an event for the toolbar usage then I could make do with that
because I can just hookup to both that and the key event.
Is there a CKEditor event that I can hook up to that fires whenever the
content changes? Ideally I'm looking for an event that fires when anything
at all changes, so for example it could be the user typed something into
the editor, or a toolbar item was used (e.g. changed the font color).
Currently I'm just hooking up to the key event which unsurprisingly only
fires when a key is pressed, and not when for example the font color is
changed via the toolbar.
CKEDITOR.instances['myEditor'].on('key', function () {
console.log("changed");
});
I've also tried using jQuery to delegate a click event on the CKEditor's
parent like below. This partly works, for example it fires if you click
the Bolt/Italic buttons, but not if you change the font color:
$(document).on('click', '#myEditor_DISPLAY', function(){
console.log("changed");
});
I've looked at the documentation here but haven't found this event. If
there's only an event for the toolbar usage then I could make do with that
because I can just hookup to both that and the key event.
Unable to get Twitter.Bootstrap.Mvc4.sample working in empty MVC4 project
Unable to get Twitter.Bootstrap.Mvc4.sample working in empty MVC4 project
I've installed Twitter.Bootstrap.MVC4 into an Asp.Net MVC Empty project
template and when I start the application there are issues with the style
sheets. It looks to me like they aren't linked in. Screen grab below.
And the head section is below
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link
href="/content/css?v=o7EqNjjD8FotmTy6On6adamUxH559LswOFRclfNrDPM1"
rel="stylesheet"/>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="/scripts/html5shiv.js"></script>
<![endif]-->
</head>
I've installed Twitter.Bootstrap.MVC4 into an Asp.Net MVC Empty project
template and when I start the application there are issues with the style
sheets. It looks to me like they aren't linked in. Screen grab below.
And the head section is below
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link
href="/content/css?v=o7EqNjjD8FotmTy6On6adamUxH559LswOFRclfNrDPM1"
rel="stylesheet"/>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="/scripts/html5shiv.js"></script>
<![endif]-->
</head>
php mysql if row is empty and if isn't empty
php mysql if row is empty and if isn't empty
Code:
$Username = $_SESSION['VALID_USER_ID'];
$q = mysql_query("SELECT * FROM `article_table` WHERE `Username` =
'$Username' ORDER BY `id` DESC");
while($db = mysql_fetch_array($q)) { ?>
<?php if(!isset($db['article'] && $db['subject'])) { echo "Your articles";
} else { echo "You have no articles added!"; } ?>
<? } ?>
So I want the rows for example(db['article'] and $db['subject']) from a
specific username (see: $Username = $_SESSION['VALID_USER_ID'];) to echo
the information if is not empty else if is empty to echo for example "You
have no articles added!"
If is some information in the rows the code works, echo the information
BUT if the rows is empty don't echo nothing, the code should echo "You
have no articles added!" but this line don't appear, where is the mistake?
I tried for if !isset, !empty, !is_null but don't work.
Code:
$Username = $_SESSION['VALID_USER_ID'];
$q = mysql_query("SELECT * FROM `article_table` WHERE `Username` =
'$Username' ORDER BY `id` DESC");
while($db = mysql_fetch_array($q)) { ?>
<?php if(!isset($db['article'] && $db['subject'])) { echo "Your articles";
} else { echo "You have no articles added!"; } ?>
<? } ?>
So I want the rows for example(db['article'] and $db['subject']) from a
specific username (see: $Username = $_SESSION['VALID_USER_ID'];) to echo
the information if is not empty else if is empty to echo for example "You
have no articles added!"
If is some information in the rows the code works, echo the information
BUT if the rows is empty don't echo nothing, the code should echo "You
have no articles added!" but this line don't appear, where is the mistake?
I tried for if !isset, !empty, !is_null but don't work.
Monday, 19 August 2013
How to post to Google Measurement protocol using Pyhton?
How to post to Google Measurement protocol using Pyhton?
Measurement protocol guide
I need an example of how a POST would look using Python.
Something like this, but working.
import httplib, urllib
conn = httplib.HTTPConnection("www.google-analytics.com")
conn.request("POST",
"v=1&tid=UA-XXXXXX-Y&cid=666&t=event&ec=game&ea=start&ev=0")
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()
Measurement protocol guide
I need an example of how a POST would look using Python.
Something like this, but working.
import httplib, urllib
conn = httplib.HTTPConnection("www.google-analytics.com")
conn.request("POST",
"v=1&tid=UA-XXXXXX-Y&cid=666&t=event&ec=game&ea=start&ev=0")
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()
What Triggers the Spawning of a Stalker?
What Triggers the Spawning of a Stalker?
On Warframe, what triggers to ability to have a Stalker to spawn stalking
you. Do you have to get the killing blow against a boss? Or just be in the
game.
On Warframe, what triggers to ability to have a Stalker to spawn stalking
you. Do you have to get the killing blow against a boss? Or just be in the
game.
How to stop a sed script if finding two start patterns before an end pattern?
How to stop a sed script if finding two start patterns before an end pattern?
I need to find all revisions in a subversion dump that have changes to
pom.xml.
I'm using svndumptool to successfully print the revisions, and then sed to
filter those findings.
I'm able to match the revision number as the start, but I need to be able
to throw this away if I find a second matching start before I find a stop.
Here is the command I'm using:
svnDumpTool =~/path/to/svndumptool.py
target=specificSvn.dump
# use svndumptool to read the svnlog from target to stdin |
# sed then matches start -r[0-9], such as -r103, ends on pom.xml
# then redirects stdout > to a log file for this target
$svnDumpTool log $target -v | sed -n '/r[0-9]/,/pom.xml/p' > $target.log
Considering a log of something like this:
-r0 | ... | ...
Changed paths:
none; initialization of the repo - not my match
-r1 | ... | ...
Changed paths:
... not my matches here
--------
-r2 | ... | ...
Changed paths:
... nor here
--------
-r3 | ... | ...
Changed paths:
Pom.xml
--------
-r4 | ... | ...
Changed paths:
Pom.xml
--------
-r5 | ... | ...
Changed paths:
... changes may or may not be here
--------
Here are the results.
On the first pass, I get more than I want:
I'll get a match on start of -r0,
A match on end of pom.xml from -r3,
Which prints all from start to stop, including -r0, -r1 & -r2:
-r0 | ... | ...
Changed paths:
none; initialization of the repo - not my match
-r1 | ... | ...
Changed paths:
... not my matches here
--------
-r2 | ... | ...
Changed paths:
... nor here
--------
-r3 | ... | ...
Changed paths:
Pom.xml
On the second pass, I get exactly what I want:
I'll get a match on start of -r4,
A match on end of pom.xml from -r4:
-r4 | ... | ...
Changed paths:
Pom.xml
So, what I think I need to do is:
If I find a start,
And I find another expression matching start before finding an expression
matching end,
Then throw away the first start; otherwise print.
I think this post might have my answer, but any attempt I have tried has
failed.
I need to find all revisions in a subversion dump that have changes to
pom.xml.
I'm using svndumptool to successfully print the revisions, and then sed to
filter those findings.
I'm able to match the revision number as the start, but I need to be able
to throw this away if I find a second matching start before I find a stop.
Here is the command I'm using:
svnDumpTool =~/path/to/svndumptool.py
target=specificSvn.dump
# use svndumptool to read the svnlog from target to stdin |
# sed then matches start -r[0-9], such as -r103, ends on pom.xml
# then redirects stdout > to a log file for this target
$svnDumpTool log $target -v | sed -n '/r[0-9]/,/pom.xml/p' > $target.log
Considering a log of something like this:
-r0 | ... | ...
Changed paths:
none; initialization of the repo - not my match
-r1 | ... | ...
Changed paths:
... not my matches here
--------
-r2 | ... | ...
Changed paths:
... nor here
--------
-r3 | ... | ...
Changed paths:
Pom.xml
--------
-r4 | ... | ...
Changed paths:
Pom.xml
--------
-r5 | ... | ...
Changed paths:
... changes may or may not be here
--------
Here are the results.
On the first pass, I get more than I want:
I'll get a match on start of -r0,
A match on end of pom.xml from -r3,
Which prints all from start to stop, including -r0, -r1 & -r2:
-r0 | ... | ...
Changed paths:
none; initialization of the repo - not my match
-r1 | ... | ...
Changed paths:
... not my matches here
--------
-r2 | ... | ...
Changed paths:
... nor here
--------
-r3 | ... | ...
Changed paths:
Pom.xml
On the second pass, I get exactly what I want:
I'll get a match on start of -r4,
A match on end of pom.xml from -r4:
-r4 | ... | ...
Changed paths:
Pom.xml
So, what I think I need to do is:
If I find a start,
And I find another expression matching start before finding an expression
matching end,
Then throw away the first start; otherwise print.
I think this post might have my answer, but any attempt I have tried has
failed.
Responsive CSS with Twitter Bootstrap
Responsive CSS with Twitter Bootstrap
In my Rails app, I'm using Twitter Bootstrap. My footer is properly
displayed on screens with landscape mode with width required enough.
Here is how it looks:
But, on a browser on my Android Galaxy Note, it appears broken. The footer
appears correct if I use the browser in landscape mode, but in the
portrait mode it breaks. It looks like:
Here is my code:
<div id="footer">
<div class="container">
<p class="muted credit" style="text-align: center" >
© 2013 <a href="http://www.example.com">WebsiteName.com</a>
All Rights Reserved. |
<a href="" title="Privacy Policy">Privacy Policy</a> |
<%= link_to 'Terms of Service', terms_of_service_path %>
</p>
</div>
</div>
The CSS for the above is borrowed from Example - sticky-footer :
html,
body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
}
/* Wrapper for page content to push down footer */
#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
width: 100%;
/* Negative indent footer by it's height */
margin: 0 auto -60px;
position: fixed;
left:0;
top:0;
}
/* Set the fixed height of the footer here */
#push,
#footer {
height: 60px;
}
#footer {
background-color: #f5f5f5;
}
/* Lastly, apply responsive CSS fixes as necessary */
@media (max-width: 767px) {
#footer {
margin-left: -20px;
margin-right: -20px;
padding-left: 20px;
padding-right: 20px;
}
}
.container .credit {
margin: 20px 0;
}
I don't know why does it not render it correctly. I am new to the
Responsive CSS and I am learning. Please let me know what's wrong.
In my Rails app, I'm using Twitter Bootstrap. My footer is properly
displayed on screens with landscape mode with width required enough.
Here is how it looks:
But, on a browser on my Android Galaxy Note, it appears broken. The footer
appears correct if I use the browser in landscape mode, but in the
portrait mode it breaks. It looks like:
Here is my code:
<div id="footer">
<div class="container">
<p class="muted credit" style="text-align: center" >
© 2013 <a href="http://www.example.com">WebsiteName.com</a>
All Rights Reserved. |
<a href="" title="Privacy Policy">Privacy Policy</a> |
<%= link_to 'Terms of Service', terms_of_service_path %>
</p>
</div>
</div>
The CSS for the above is borrowed from Example - sticky-footer :
html,
body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
}
/* Wrapper for page content to push down footer */
#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
width: 100%;
/* Negative indent footer by it's height */
margin: 0 auto -60px;
position: fixed;
left:0;
top:0;
}
/* Set the fixed height of the footer here */
#push,
#footer {
height: 60px;
}
#footer {
background-color: #f5f5f5;
}
/* Lastly, apply responsive CSS fixes as necessary */
@media (max-width: 767px) {
#footer {
margin-left: -20px;
margin-right: -20px;
padding-left: 20px;
padding-right: 20px;
}
}
.container .credit {
margin: 20px 0;
}
I don't know why does it not render it correctly. I am new to the
Responsive CSS and I am learning. Please let me know what's wrong.
how to make this footer stay at bottom of page even window is small
how to make this footer stay at bottom of page even window is small
I am pretty much stuck in this html problem.
I have a page. i want its footer to stay at the bottom and have certian
distance to element above it. here the Twitter + G+ div.
please see the css inside @media (min-width:481).
i tried this:
html, body{
height: 100%;
}
.fuss{
position: absolute;
bottom: 0;
}
this works for big screens, but if i resize the window to small 15' screen
laptop, footer is going over my Twitter and G+ elements. why is this?
this is the page: http://www.bibago.de/test.html footer works fine in big
screens, but in small screens the footer goes over other elements and
doesnot stay at bottom.
please help.
thanks.
I am pretty much stuck in this html problem.
I have a page. i want its footer to stay at the bottom and have certian
distance to element above it. here the Twitter + G+ div.
please see the css inside @media (min-width:481).
i tried this:
html, body{
height: 100%;
}
.fuss{
position: absolute;
bottom: 0;
}
this works for big screens, but if i resize the window to small 15' screen
laptop, footer is going over my Twitter and G+ elements. why is this?
this is the page: http://www.bibago.de/test.html footer works fine in big
screens, but in small screens the footer goes over other elements and
doesnot stay at bottom.
please help.
thanks.
Universal (simulator, ios 5, ios 6 ) Static Library Template for xcode 4.6
Universal (simulator, ios 5, ios 6 ) Static Library Template for xcode 4.6
where can i found the above (i am new to framework development)
Thanks in advance
where can i found the above (i am new to framework development)
Thanks in advance
Sunday, 18 August 2013
Center Google Maps InfoWindow On Load
Center Google Maps InfoWindow On Load
I'm having a problem centering my InfoWindow on page load. On load, the
map is centering on the marker, which puts the InfoWindow off screen (I'm
working with a short height for my map container).
Now clicking the marker does re-center the map on the InfoWindow so that
it looks exactly like I want. That being the case, I've even tried firing
the marker.click trigger to achieve a solution on load, but had no luck.
What am I missing?
JSFIDDLE: http://jsfiddle.net/q9NTS/7/
<script
src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript">
var geocoder = new google.maps.Geocoder();
var marker;
var infoWindow;
var map;
function initialize() {
var mapOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
setLocation();
}
function setLocation() {
var address = '@(Model.Event.Address)' + ', ' +
'@(Model.Event.City)' + ', ' + '@(Model.Event.State)' + ' ' +
'@(Model.Event.Zip)';
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var position = results[0].geometry.location;
marker = new google.maps.Marker({
map: map,
position: position,
title: '@(Model.Event.Venue)'
});
map.setCenter(marker.getPosition());
var content = 'blah';
infoWindow = new google.maps.InfoWindow({
content: content
});
google.maps.event.addListener(marker, 'click', function () {
infoWindow.open(map, marker);
});
//infoWindow.open(map, marker); doesn't work
google.maps.event.trigger(marker, 'click'); //still
doesn't work
}
else {
//
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
I'm having a problem centering my InfoWindow on page load. On load, the
map is centering on the marker, which puts the InfoWindow off screen (I'm
working with a short height for my map container).
Now clicking the marker does re-center the map on the InfoWindow so that
it looks exactly like I want. That being the case, I've even tried firing
the marker.click trigger to achieve a solution on load, but had no luck.
What am I missing?
JSFIDDLE: http://jsfiddle.net/q9NTS/7/
<script
src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript">
var geocoder = new google.maps.Geocoder();
var marker;
var infoWindow;
var map;
function initialize() {
var mapOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
setLocation();
}
function setLocation() {
var address = '@(Model.Event.Address)' + ', ' +
'@(Model.Event.City)' + ', ' + '@(Model.Event.State)' + ' ' +
'@(Model.Event.Zip)';
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var position = results[0].geometry.location;
marker = new google.maps.Marker({
map: map,
position: position,
title: '@(Model.Event.Venue)'
});
map.setCenter(marker.getPosition());
var content = 'blah';
infoWindow = new google.maps.InfoWindow({
content: content
});
google.maps.event.addListener(marker, 'click', function () {
infoWindow.open(map, marker);
});
//infoWindow.open(map, marker); doesn't work
google.maps.event.trigger(marker, 'click'); //still
doesn't work
}
else {
//
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
How to restore files that are there (hard drive size proves it) but not visible?
How to restore files that are there (hard drive size proves it) but not
visible?
I hope I'm in the right forum. There were some viruses on my laptop which
got into my 500GB drive. All viruses cleaned but now the files are not
visible. When I check the hard drive size it hasn't gone down but is the
same as before.
Does this mean my files are still there? If so, how can they be retrieved.
Thanks.
visible?
I hope I'm in the right forum. There were some viruses on my laptop which
got into my 500GB drive. All viruses cleaned but now the files are not
visible. When I check the hard drive size it hasn't gone down but is the
same as before.
Does this mean my files are still there? If so, how can they be retrieved.
Thanks.
controller not recognized - angularJS
controller not recognized - angularJS
I have a angular controller I have
@MyAngular = ($scope) ->
$scope.my = [...]
@MyAngular.$inject = ["$scope"]
I get this message error : Argument 'MyAngular' is not a function, got
undefined. In my view, I have %div{"ng-controller" => "MyAngular"}
I found some SO posts and but nothing did the trick
I have a angular controller I have
@MyAngular = ($scope) ->
$scope.my = [...]
@MyAngular.$inject = ["$scope"]
I get this message error : Argument 'MyAngular' is not a function, got
undefined. In my view, I have %div{"ng-controller" => "MyAngular"}
I found some SO posts and but nothing did the trick
How access the files from a Samsung S3 with DOS commands?
How access the files from a Samsung S3 with DOS commands?
After enabling the "Developer options" in the Settings of a Samsung Galaxy
GT-I8190N, and connecting it to the PC via the USB cable I was able to
backup its files using the file explorer from Windows XP Professionnal.
I'm trying doing the same in DOS, in order to preserve timestamps.
I plan using this DOS command: XCOPY source destination /H /R /K /O
However, the phone is not listed together with a drive letter, but as
"Computer" (Poste de travail) and I cannot figure out how to navigate to
it with DOS commands.
Using the "Computer management" tools, I could see that the smartphone is
not listed as a drive but as a "Portable device".
Any way to access such device in DOS ?
(I encounter similar problem to access the files using Linux. fdisk
doesn't list the phone sd card as a drive, but the phone is listed by
lsusb.)
Thanks for your help.
After enabling the "Developer options" in the Settings of a Samsung Galaxy
GT-I8190N, and connecting it to the PC via the USB cable I was able to
backup its files using the file explorer from Windows XP Professionnal.
I'm trying doing the same in DOS, in order to preserve timestamps.
I plan using this DOS command: XCOPY source destination /H /R /K /O
However, the phone is not listed together with a drive letter, but as
"Computer" (Poste de travail) and I cannot figure out how to navigate to
it with DOS commands.
Using the "Computer management" tools, I could see that the smartphone is
not listed as a drive but as a "Portable device".
Any way to access such device in DOS ?
(I encounter similar problem to access the files using Linux. fdisk
doesn't list the phone sd card as a drive, but the phone is listed by
lsusb.)
Thanks for your help.
How to use :not selector with :nth-of-type
How to use :not selector with :nth-of-type
Im about styling a table. I want each odd row to have a specific
background except the first row which contains headers.
I have used the following code which does not work:
.new-items-table tr:nth-of-type(odd):not(.new-items-table tr):nth-of-type(1)
{
background-color: red;
}
Im about styling a table. I want each odd row to have a specific
background except the first row which contains headers.
I have used the following code which does not work:
.new-items-table tr:nth-of-type(odd):not(.new-items-table tr):nth-of-type(1)
{
background-color: red;
}
Creating Kernel that Runs the JVM
Creating Kernel that Runs the JVM
I have been writing Assembly code for quite some time now and I wish to
finally dive into an OS written in Java. Of course Java has its serious
limitations, such as it is unable to access hardware directly. So I wish
to build a kernel in Assembly that can run and support the JVM so Java
applications can be run.
How would I go about doing this? Can someone point me in the right direction.
I have been writing Assembly code for quite some time now and I wish to
finally dive into an OS written in Java. Of course Java has its serious
limitations, such as it is unable to access hardware directly. So I wish
to build a kernel in Assembly that can run and support the JVM so Java
applications can be run.
How would I go about doing this? Can someone point me in the right direction.
Saturday, 17 August 2013
when i send email with php i can not get it
when i send email with php i can not get it
my code is here , it is very simple code :
<form method="post" action="index.php">
<input type="text" name="to" /><br />
<input type="text" name="subject" /><br />
<textarea name="message"></textarea><br />
<input type="submit" name="send" value="send mail"/>
</form>
and php code here :
<?php
if(isset($_POST['send']))
{
try
{
$to=$_POST['to'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$headers = "From: info@azhinehps.com";
//ini_set('smtp_port','25');
//ini_set('SMTP','smtp.azhinehps.com');
$t=mail($to,$subject,$message,$headers);
echo 'Send Successfully';
}
catch (Exception $e)
{
echo "con not send Email";
echo $e;
}
}
?>
ok ... i send a email to my hotmail ID i have not any error after click on
send button and i get "send successfully" Message . but when checking my
mail in my mail server yahoo and hotmail and other... i have not any email
..
my code is here , it is very simple code :
<form method="post" action="index.php">
<input type="text" name="to" /><br />
<input type="text" name="subject" /><br />
<textarea name="message"></textarea><br />
<input type="submit" name="send" value="send mail"/>
</form>
and php code here :
<?php
if(isset($_POST['send']))
{
try
{
$to=$_POST['to'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$headers = "From: info@azhinehps.com";
//ini_set('smtp_port','25');
//ini_set('SMTP','smtp.azhinehps.com');
$t=mail($to,$subject,$message,$headers);
echo 'Send Successfully';
}
catch (Exception $e)
{
echo "con not send Email";
echo $e;
}
}
?>
ok ... i send a email to my hotmail ID i have not any error after click on
send button and i get "send successfully" Message . but when checking my
mail in my mail server yahoo and hotmail and other... i have not any email
..
Missing asymptote in gnuplot
Missing asymptote in gnuplot
When plotting (x-1)/(x*x-1) in gnuplot the asymptote at x=-1 is obvious,
but at x=1 the curve looks smooth, see figure below. What settings should
I use to show the discontinuity at x=1?
When plotting (x-1)/(x*x-1) in gnuplot the asymptote at x=-1 is obvious,
but at x=1 the curve looks smooth, see figure below. What settings should
I use to show the discontinuity at x=1?
Data flow in the classic Hadoop word count example in Python
Data flow in the classic Hadoop word count example in Python
I am trying the understand the Hadoop word count example in Python
http://www.michael-noll.com/tutorials/writing-an-hadoop-mapreduce-program-in-python/
The author starts with naive versions of the mapper and the reducer. Here
is the reducer (I removed some comments for brevity)
#!/usr/bin/env python
from operator import itemgetter
import sys
current_word = None
current_count = 0
word = None
# input comes from STDIN
for line in sys.stdin:
line = line.strip()
word, count = line.split('\t', 1)
try:
count = int(count)
except ValueError:
continue
if current_word == word:
current_count += count
else:
if current_word:
# write result to STDOUT
print '%s\t%s' % (current_word, current_count)
current_count = count
current_word = word
# do not forget to output the last word if needed!
if current_word == word:
print '%s\t%s' % (current_word, current_count)
The author tests the program with:
echo "foo foo quux labs foo bar quux" | /home/hduser/mapper.py | sort
-k1,1 | /home/hduser/reducer.py
So the reducer is written as if a reducer job's input data was like:
aa 1
aa 1
bb 1
cc 1
cc 1
cc 1
My initial understand of a reducer was that the input data for a given
reducer would contain one unique key. So in the previous examples, 3
reducers jobs would be needed. Is my understand incorrect?
Then the author presents improved versions of the mapper and the reducer.
Here is the reducer:
#!/usr/bin/env python
"""A more advanced Reducer, using Python iterators and generators."""
from itertools import groupby
from operator import itemgetter
import sys
def read_mapper_output(file, separator='\t'):
for line in file:
yield line.rstrip().split(separator, 1)
def main(separator='\t'):
# input comes from STDIN (standard input)
data = read_mapper_output(sys.stdin, separator=separator)
for current_word, group in groupby(data, itemgetter(0)):
try:
total_count = sum(int(count) for current_word, count in group)
print "%s%s%d" % (current_word, separator, total_count)
except ValueError:
# count was not a number, so silently discard this item
pass
if __name__ == "__main__":
main()
The author adds the following warning:
Note: The following Map and Reduce scripts will only work "correctly" when
being run in the Hadoop context, i.e. as Mapper and Reducer in a MapReduce
job. This means that running the naive test command "cat DATA |
./mapper.py | sort -k1,1 | ./reducer.py" will not work correctly anymore
because some functionality is intentionally outsourced to Hadoop.
I don't understand why the naive test command doesn't work with the new
version. I thought the use of sort -k1,1 would produce the same input for
both versions of the reducer. What am I missing?
I am trying the understand the Hadoop word count example in Python
http://www.michael-noll.com/tutorials/writing-an-hadoop-mapreduce-program-in-python/
The author starts with naive versions of the mapper and the reducer. Here
is the reducer (I removed some comments for brevity)
#!/usr/bin/env python
from operator import itemgetter
import sys
current_word = None
current_count = 0
word = None
# input comes from STDIN
for line in sys.stdin:
line = line.strip()
word, count = line.split('\t', 1)
try:
count = int(count)
except ValueError:
continue
if current_word == word:
current_count += count
else:
if current_word:
# write result to STDOUT
print '%s\t%s' % (current_word, current_count)
current_count = count
current_word = word
# do not forget to output the last word if needed!
if current_word == word:
print '%s\t%s' % (current_word, current_count)
The author tests the program with:
echo "foo foo quux labs foo bar quux" | /home/hduser/mapper.py | sort
-k1,1 | /home/hduser/reducer.py
So the reducer is written as if a reducer job's input data was like:
aa 1
aa 1
bb 1
cc 1
cc 1
cc 1
My initial understand of a reducer was that the input data for a given
reducer would contain one unique key. So in the previous examples, 3
reducers jobs would be needed. Is my understand incorrect?
Then the author presents improved versions of the mapper and the reducer.
Here is the reducer:
#!/usr/bin/env python
"""A more advanced Reducer, using Python iterators and generators."""
from itertools import groupby
from operator import itemgetter
import sys
def read_mapper_output(file, separator='\t'):
for line in file:
yield line.rstrip().split(separator, 1)
def main(separator='\t'):
# input comes from STDIN (standard input)
data = read_mapper_output(sys.stdin, separator=separator)
for current_word, group in groupby(data, itemgetter(0)):
try:
total_count = sum(int(count) for current_word, count in group)
print "%s%s%d" % (current_word, separator, total_count)
except ValueError:
# count was not a number, so silently discard this item
pass
if __name__ == "__main__":
main()
The author adds the following warning:
Note: The following Map and Reduce scripts will only work "correctly" when
being run in the Hadoop context, i.e. as Mapper and Reducer in a MapReduce
job. This means that running the naive test command "cat DATA |
./mapper.py | sort -k1,1 | ./reducer.py" will not work correctly anymore
because some functionality is intentionally outsourced to Hadoop.
I don't understand why the naive test command doesn't work with the new
version. I thought the use of sort -k1,1 would produce the same input for
both versions of the reducer. What am I missing?
Hosting with Amazon advice
Hosting with Amazon advice
I was looking into .NET hosting and came across the Amazon Windows
Hosting. I'm looking for a solution with IIS, ASP.NET & MSSQL.
The website will be accessed mostly for 2 particular months in a year so
there's no need to stay with the same specs for the whole year - I still
need it to be online for the whole year. For this I was thinking to
upgrade/downgrade accordingly from micro to small/medium when needed.
Guess I only need an EC2 instance only with everything on it? Or should I
opt for an RDS too?
Also, something else that I wanted to be sure of. When Amazon say that you
have to pay $0.09/hour, if for example:
Server is used 5 minutes between 07:00-08:00
Server is used 25 minutes between 08:00-09:00
Does that costs $0.18cents (2hrs) or just $0.0045cents (30 minutes)?
I was looking into .NET hosting and came across the Amazon Windows
Hosting. I'm looking for a solution with IIS, ASP.NET & MSSQL.
The website will be accessed mostly for 2 particular months in a year so
there's no need to stay with the same specs for the whole year - I still
need it to be online for the whole year. For this I was thinking to
upgrade/downgrade accordingly from micro to small/medium when needed.
Guess I only need an EC2 instance only with everything on it? Or should I
opt for an RDS too?
Also, something else that I wanted to be sure of. When Amazon say that you
have to pay $0.09/hour, if for example:
Server is used 5 minutes between 07:00-08:00
Server is used 25 minutes between 08:00-09:00
Does that costs $0.18cents (2hrs) or just $0.0045cents (30 minutes)?
Sliding Menu with ViewPagerIndicator
Sliding Menu with ViewPagerIndicator
i my activity i'm extending Sliding Menu library and ViewPagerIndicator.
However my application works like this:
SlidingMenu launches a fragment that extends viewpager that also have 5
tabs in it.
Each tab extends a listadapter class.
Now this is how my activity works, but i'm experiencing a highly lagging
performance! how can i combine the sliding menu with view pager indicator
without experiencing any lag performance?!
if you want me to show your codes, just say in the description.
Thanks for your help!
i my activity i'm extending Sliding Menu library and ViewPagerIndicator.
However my application works like this:
SlidingMenu launches a fragment that extends viewpager that also have 5
tabs in it.
Each tab extends a listadapter class.
Now this is how my activity works, but i'm experiencing a highly lagging
performance! how can i combine the sliding menu with view pager indicator
without experiencing any lag performance?!
if you want me to show your codes, just say in the description.
Thanks for your help!
how to display start from image using sprite animation in android
how to display start from image using sprite animation in android
I will develop one project ,In my project i had one sprite .
and want to display animation like
how to solve my problem .
I will develop one project ,In my project i had one sprite .
and want to display animation like
how to solve my problem .
Proving $\sum_{k=0}^{n}k{n\choose k} = n{2n-1 \choose n-1} $
Proving $\sum_{k=0}^{n}k{n\choose k} = n{2n-1 \choose n-1} $
I'm struggling at proving the following combinatorical identity:
$$\sum_{k=0}^{n}k{n\choose k} = n{2n-1 \choose n-1} $$ I would like to see
a combinatorical (logical) solution, or an algebraic solution.
I'm struggling at proving the following combinatorical identity:
$$\sum_{k=0}^{n}k{n\choose k} = n{2n-1 \choose n-1} $$ I would like to see
a combinatorical (logical) solution, or an algebraic solution.
Friday, 16 August 2013
Qt Signals and slots - No matching function for call
Qt Signals and slots - No matching function for call
I am learning QT and am trying to get my signals and slots working. I am
having no luck. Here is my Main
int main(int argc, char** argv) {
QApplication app(argc, argv);
FilmInput fi;
FilmWriter fw;
QObject::connect (&fi->okButton, SIGNAL( clicked() ), &fi, SLOT(
okButtonClicked() )
); //Error received Base operand of '->' has non-pointer type 'FilmInput'
QObject::connect(&fi,SIGNAL(obtainFilmData(QVariant*)),&fw,SLOT(saveFilmData(QVariant*)));
//Error received No matching function for call to
'QObject::connect(Filminput*, const char*, FilmWriter*, const char*)
fi.show();
return app.exec();
}
and here is my sad attempt at signals and slots:
FilmInput.h
public:
FilmInput();
void okButtonClicked();
QPushButton* okButton;
signals:
void obtainFilmData(Film *film);
Here is FilmWriter.h
public slots:
int saveFilm(Film &f);
Here is Film Input.cpp
void FilmInput::okButtonClicked(){
Film *aFilm=new Film();
aFilm->setDirector(this->edtDirector->text());
emit obtainFilmData(aFilm);
}
Here is FilmWriter.cpp
void FilmInput::okButtonClicked(){
Film *aFilm=new Film();
aFilm->setDirector(this->edtDirector->text());
emit obtainFilmData(aFilm);
}
Please assist me in getting the signals and slots to work, I have spent
hours but am no closer to getting it working. I have added the errors
received in my comments above.
Regards
I am learning QT and am trying to get my signals and slots working. I am
having no luck. Here is my Main
int main(int argc, char** argv) {
QApplication app(argc, argv);
FilmInput fi;
FilmWriter fw;
QObject::connect (&fi->okButton, SIGNAL( clicked() ), &fi, SLOT(
okButtonClicked() )
); //Error received Base operand of '->' has non-pointer type 'FilmInput'
QObject::connect(&fi,SIGNAL(obtainFilmData(QVariant*)),&fw,SLOT(saveFilmData(QVariant*)));
//Error received No matching function for call to
'QObject::connect(Filminput*, const char*, FilmWriter*, const char*)
fi.show();
return app.exec();
}
and here is my sad attempt at signals and slots:
FilmInput.h
public:
FilmInput();
void okButtonClicked();
QPushButton* okButton;
signals:
void obtainFilmData(Film *film);
Here is FilmWriter.h
public slots:
int saveFilm(Film &f);
Here is Film Input.cpp
void FilmInput::okButtonClicked(){
Film *aFilm=new Film();
aFilm->setDirector(this->edtDirector->text());
emit obtainFilmData(aFilm);
}
Here is FilmWriter.cpp
void FilmInput::okButtonClicked(){
Film *aFilm=new Film();
aFilm->setDirector(this->edtDirector->text());
emit obtainFilmData(aFilm);
}
Please assist me in getting the signals and slots to work, I have spent
hours but am no closer to getting it working. I have added the errors
received in my comments above.
Regards
Saturday, 10 August 2013
How can i search records in a large table efficiently?
How can i search records in a large table efficiently?
I have a table(product) with 5.4 million recods. If i'm using below query
to get result but it's working very slow. Is there a more efficient
approach?
SELECT sd.imageid, sd.licencetype, sd.imgcollection, sd.orientation,
sd.pname, sd.pcaption, sd.ptype
FROM (SELECT imageid
FROM product
WHERE productkeyword IN (SELECT primary_kwd
FROM searchkwdmgmt
WHERE allkwd IN ( 'IPhone' ))
GROUP BY imageid
HAVING Count(*) = 1
LIMIT 0, 31) q
JOIN searchdetails sd
ON sd.imageid = q.imageid
I have a table(product) with 5.4 million recods. If i'm using below query
to get result but it's working very slow. Is there a more efficient
approach?
SELECT sd.imageid, sd.licencetype, sd.imgcollection, sd.orientation,
sd.pname, sd.pcaption, sd.ptype
FROM (SELECT imageid
FROM product
WHERE productkeyword IN (SELECT primary_kwd
FROM searchkwdmgmt
WHERE allkwd IN ( 'IPhone' ))
GROUP BY imageid
HAVING Count(*) = 1
LIMIT 0, 31) q
JOIN searchdetails sd
ON sd.imageid = q.imageid
How to add an extra URL mapping for an servlet that already mapped in Eclipse IDE 4.2?
How to add an extra URL mapping for an servlet that already mapped in
Eclipse IDE 4.2?
I want to add an extra URL mapping to my we application in Eclipse. Since
the eclipse IDE not using web.xml as deployment descriptor , I don't know
how to do this.
That is , the servlet LogServlet was already mapped as /LogServlet , but I
have need to add an extra mapping as /tamil/LogServlet .
Since web.xml not used as deployment descriptor in Eclipse , I don't know
how to do this .
Please help me in this issue.
(Project created in Dynamic Web Module 3.0 in Java EE 6[jdk 7] )
2) Please guide me how to create the web.xml file which contains all
deployment info on it.( that "Generate deployment descriptor stub" not
generating servlet mappings , only welcome pages tags )
Eclipse IDE 4.2?
I want to add an extra URL mapping to my we application in Eclipse. Since
the eclipse IDE not using web.xml as deployment descriptor , I don't know
how to do this.
That is , the servlet LogServlet was already mapped as /LogServlet , but I
have need to add an extra mapping as /tamil/LogServlet .
Since web.xml not used as deployment descriptor in Eclipse , I don't know
how to do this .
Please help me in this issue.
(Project created in Dynamic Web Module 3.0 in Java EE 6[jdk 7] )
2) Please guide me how to create the web.xml file which contains all
deployment info on it.( that "Generate deployment descriptor stub" not
generating servlet mappings , only welcome pages tags )
proving an isomorphism of two open sets (Hartshorne Corollary I 4.5)
proving an isomorphism of two open sets (Hartshorne Corollary I 4.5)
Let $X,Y$ be birational varieties and $\phi: X \rightarrow Y, \psi: Y
\rightarrow X$ mutually inverse rational dominant maps. Let $\phi$ be
represented by $(U,\phi_U)$ and $\psi$ by $(V,\psi_V)$. Then Hartshorne in
Corollary I 4.5 says that the open sets $\phi_U^{-1}(\psi_V^{-1}(U))
\subset U$ and $\psi_V^{-1}(\phi_U^{-1}(V)) \subset V$ are isomorphic via
$\phi$ and $\psi$ respectively.
I am wondering if he means that they are isomorphic as topological spaces
or as varieties. Moreover, how can we actually see this isomorphism? It
seems to me a little bit confusing. Here is the closest i got:
$\phi_U(\phi_U^{-1}(\psi_V^{-1}(U)) \subset \psi_V^{-1}(U) =
\psi_V^{-1}(\phi_U^{-1}(Y)) = \psi_V^{-1}(\phi_U^{-1}(V))^c$, where $^c$
denotes closure.
Let $X,Y$ be birational varieties and $\phi: X \rightarrow Y, \psi: Y
\rightarrow X$ mutually inverse rational dominant maps. Let $\phi$ be
represented by $(U,\phi_U)$ and $\psi$ by $(V,\psi_V)$. Then Hartshorne in
Corollary I 4.5 says that the open sets $\phi_U^{-1}(\psi_V^{-1}(U))
\subset U$ and $\psi_V^{-1}(\phi_U^{-1}(V)) \subset V$ are isomorphic via
$\phi$ and $\psi$ respectively.
I am wondering if he means that they are isomorphic as topological spaces
or as varieties. Moreover, how can we actually see this isomorphism? It
seems to me a little bit confusing. Here is the closest i got:
$\phi_U(\phi_U^{-1}(\psi_V^{-1}(U)) \subset \psi_V^{-1}(U) =
\psi_V^{-1}(\phi_U^{-1}(Y)) = \psi_V^{-1}(\phi_U^{-1}(V))^c$, where $^c$
denotes closure.
Friday, 9 August 2013
Blocking request in Chrome
Blocking request in Chrome
I'm trying to block some requests in a Chrome app.
I created a JavaScript listener that does this validation:
chrome.webRequest.onBeforeRequest.addListener(
{
urls: ["*://site.com/test/*"]
},
["blocking"]
);
But the requests are not blocking. Did I miss something in this code?
My manifest:
"background": {
"scripts": ["listener.js"],
"persistent": true
},
"permissions": ["tabs", "http://*/*"],
"manifest_version": 2,
I'm trying to block some requests in a Chrome app.
I created a JavaScript listener that does this validation:
chrome.webRequest.onBeforeRequest.addListener(
{
urls: ["*://site.com/test/*"]
},
["blocking"]
);
But the requests are not blocking. Did I miss something in this code?
My manifest:
"background": {
"scripts": ["listener.js"],
"persistent": true
},
"permissions": ["tabs", "http://*/*"],
"manifest_version": 2,
Java Mail with Attachment-Attachment file location not found
Java Mail with Attachment-Attachment file location not found
My code for sending email without attachment works fine. But when I try to
send an email wth attachment, I am getting an error message
'C:\Temp\test.txt (The system cannot find the file specified)' The code is
below: '
package com.ceridian.test;
import java.util.Properties;
import javax.mail.*;
import javax.activation.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
public class TestJavaMail {
/**
* @param args
*/
public static void main(String[] args) {
final String username = "from@gmail.com";
final String password = "xxxx";
Properties props = new Properties();
props.put("mail.smtp.auth", true);
props.put("mail.smtp.starttls.enable", true);
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication
getPasswordAuthentication() {
return new PasswordAuthentication(username,
password);
}
});
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("manojvtp@gmail.com"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("mvarghese@speech-soft.com"));
message.setSubject("Testing Subject 1");
message.setText("PFA");
//
Transport.send("manojvtp@gmail.com","mvarghese@speech-soft.com",
"Hi Kamran, how is going?" , ")");
MimeBodyPart messageBodyPart = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
messageBodyPart = new MimeBodyPart();
String file = "C:/Temp/test.txt";
// String fileName = "test.txt";
DataSource source = new FileDataSource(file);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(fileName);
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
System.out.println("Sending");
Transport.send(message);
System.out.println("Done");
} catch (MessagingException e) {
e.printStackTrace();
}
}
}
Do I need to set any ClassPATH or anything else to get the file attachment
working?
Thanks
My code for sending email without attachment works fine. But when I try to
send an email wth attachment, I am getting an error message
'C:\Temp\test.txt (The system cannot find the file specified)' The code is
below: '
package com.ceridian.test;
import java.util.Properties;
import javax.mail.*;
import javax.activation.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
public class TestJavaMail {
/**
* @param args
*/
public static void main(String[] args) {
final String username = "from@gmail.com";
final String password = "xxxx";
Properties props = new Properties();
props.put("mail.smtp.auth", true);
props.put("mail.smtp.starttls.enable", true);
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication
getPasswordAuthentication() {
return new PasswordAuthentication(username,
password);
}
});
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("manojvtp@gmail.com"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("mvarghese@speech-soft.com"));
message.setSubject("Testing Subject 1");
message.setText("PFA");
//
Transport.send("manojvtp@gmail.com","mvarghese@speech-soft.com",
"Hi Kamran, how is going?" , ")");
MimeBodyPart messageBodyPart = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
messageBodyPart = new MimeBodyPart();
String file = "C:/Temp/test.txt";
// String fileName = "test.txt";
DataSource source = new FileDataSource(file);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(fileName);
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
System.out.println("Sending");
Transport.send(message);
System.out.println("Done");
} catch (MessagingException e) {
e.printStackTrace();
}
}
}
Do I need to set any ClassPATH or anything else to get the file attachment
working?
Thanks
Split List into Sublist using Linq based on content of list
Split List into Sublist using Linq based on content of list
This is similar, but not quite what is being asked in this question
I have a list that I want to break into sublists, but the break occurs
based on the content of an entry and not a fixed size.
Original List = [ split,1,split,2,2,split,3,3,3 ]
becomes [split,1], [split,2,2], [split,3,3,3] or [1], [2,2], [3,3,3]
This is similar, but not quite what is being asked in this question
I have a list that I want to break into sublists, but the break occurs
based on the content of an entry and not a fixed size.
Original List = [ split,1,split,2,2,split,3,3,3 ]
becomes [split,1], [split,2,2], [split,3,3,3] or [1], [2,2], [3,3,3]
Bootstrap controls inline alignment?
Bootstrap controls inline alignment?
Other than hacking margins how can I get the following button to display
inline with same height as the select in the following code (instead it's
dropped down on top margin)?
BootPly -> http://www.bootply.com/73169#
<div>
<h4 class="ilLabel">Select:</h4>
<select class="form-control" placeholder=".input-medium" height>
<option value="all">Default</option>
<option value="s1">Select1</option>
<option value="s2">Select2</option>
<option value="s2">Select3</option>
</select>
<button type="submit" class="btn btn-primary
btn-small">Submit</button>
Other than hacking margins how can I get the following button to display
inline with same height as the select in the following code (instead it's
dropped down on top margin)?
BootPly -> http://www.bootply.com/73169#
<div>
<h4 class="ilLabel">Select:</h4>
<select class="form-control" placeholder=".input-medium" height>
<option value="all">Default</option>
<option value="s1">Select1</option>
<option value="s2">Select2</option>
<option value="s2">Select3</option>
</select>
<button type="submit" class="btn btn-primary
btn-small">Submit</button>
Subscribe to:
Comments (Atom)