HD player in Ubuntu 13.04
I want to play the videos with HD content in Ubuntu 13.04. What should i
do? Kindly tell me the terminal commands to handle the problem.
Monday, 30 September 2013
Why is a vector space equal to its tangent space for any point?
Why is a vector space equal to its tangent space for any point?
I'm self-studying Guillemin and Pollack, but I'm stuck on Problem 3 of
section 2. It says that if $V$ is a vector subspace of $\mathbb{R}^N$,
then $T_x(V)=V$ if $x\in V$.
If $x\in V$, then since $V$ is a manifold, there is a local
parametrization $\phi: U\to V$ where $U$ is open in $\mathbb{R}^k$.
Without loss of generality, we can require $\phi(0)=x$. Then $T_x(V)$ is
defined to be the image of $d\phi_0$ on $\mathbb{R}^k$.
An arbitrary element of $T_x(V)$ looks like $$ d\phi_0(v)=\lim_{t\to
0}\frac{\phi(0+tv)-\phi(0)}{t}=\lim_{t\to 0}\frac{\phi(tv)-x}{t} $$
but this doesn't seem very useful to show $T_x(V)=V$. What is the right
approach?
I'm self-studying Guillemin and Pollack, but I'm stuck on Problem 3 of
section 2. It says that if $V$ is a vector subspace of $\mathbb{R}^N$,
then $T_x(V)=V$ if $x\in V$.
If $x\in V$, then since $V$ is a manifold, there is a local
parametrization $\phi: U\to V$ where $U$ is open in $\mathbb{R}^k$.
Without loss of generality, we can require $\phi(0)=x$. Then $T_x(V)$ is
defined to be the image of $d\phi_0$ on $\mathbb{R}^k$.
An arbitrary element of $T_x(V)$ looks like $$ d\phi_0(v)=\lim_{t\to
0}\frac{\phi(0+tv)-\phi(0)}{t}=\lim_{t\to 0}\frac{\phi(tv)-x}{t} $$
but this doesn't seem very useful to show $T_x(V)=V$. What is the right
approach?
Floated element must never get out of the div
Floated element must never get out of the div
Following my code:
HTML:
<div>aaaaaaaaaaaaaaa
<span>test</span>
</div>
CSS:
div{
width: 60px;
border-bottom: 1px solid red;
word-break:break-all;
}
span{
float: right
}
I would get this result: http://oi41.tinypic.com/2py25w1.jpg
I would like the text right-floated should not have to get out the div, so
it must go to a new line inside the div when needed, as in the code that I
posted. In this case, for example, there is no need to let go of the text
in a new line, because the text fits on the right of the text:
http://jsfiddle.net/3kRan/2/
Following my code:
HTML:
<div>aaaaaaaaaaaaaaa
<span>test</span>
</div>
CSS:
div{
width: 60px;
border-bottom: 1px solid red;
word-break:break-all;
}
span{
float: right
}
I would get this result: http://oi41.tinypic.com/2py25w1.jpg
I would like the text right-floated should not have to get out the div, so
it must go to a new line inside the div when needed, as in the code that I
posted. In this case, for example, there is no need to let go of the text
in a new line, because the text fits on the right of the text:
http://jsfiddle.net/3kRan/2/
Assigning event TextChanged to all textboxes in Form
Assigning event TextChanged to all textboxes in Form
Hello I was wondering how can I keep an eye on all textboxes in Form
whether in any of them was changed value. I saw some code here
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control ctrl in this.Controls)
{
if (ctrl is TextBox)
{
TextBox tb = (TextBox)ctrl;
tb.TextChanged += new EventHandler(tb_TextChanged);
}
}
}
void tb_TextChanged(object sender, EventArgs e)
{
TextBox tb = (TextBox)sender;
tb.Tag = "CHANGED"; // or whatever
}
And a guy who wrote this code says that it can`t be assigned to textboxes
in Panels and Grouboxes.
So my answer is as I have almost every textbox in groubox or panel, how
can I see whether change was made for textboxes in panels or groupbox?
Thank you for your time.
Hello I was wondering how can I keep an eye on all textboxes in Form
whether in any of them was changed value. I saw some code here
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control ctrl in this.Controls)
{
if (ctrl is TextBox)
{
TextBox tb = (TextBox)ctrl;
tb.TextChanged += new EventHandler(tb_TextChanged);
}
}
}
void tb_TextChanged(object sender, EventArgs e)
{
TextBox tb = (TextBox)sender;
tb.Tag = "CHANGED"; // or whatever
}
And a guy who wrote this code says that it can`t be assigned to textboxes
in Panels and Grouboxes.
So my answer is as I have almost every textbox in groubox or panel, how
can I see whether change was made for textboxes in panels or groupbox?
Thank you for your time.
Sunday, 29 September 2013
RegEx validation for numbers only with a minimum length
RegEx validation for numbers only with a minimum length
so i have this reg ex
0*[0-9]\d*
which accepts numbers only how would i, make it to accepts numbers only
but have a minimum input of 5 numbers?
so i have this reg ex
0*[0-9]\d*
which accepts numbers only how would i, make it to accepts numbers only
but have a minimum input of 5 numbers?
using variable to define json object name
using variable to define json object name
I'm having a problem that I think is very easy to solve, but I can't seem
to find an answer for it in my searches.
I have a bunch of json objects that I'm using. Right now I get at the info
like so for example:
for(image in data.everfi_commons.images) {
alert(data.everfi_commons.images[image]);
}
what I'd like to do instead is instead of having the name 'everfi_commons'
I'd like to just use a javascript variable that I've set up like so:
current_project = $(this).attr("id"); // this value is 'everfi_commons'
and then I thought you could just do data.current_project.images[image]
but this doesn't seem to work and I don't really understand why, any
insight would be helpful!
I'm having a problem that I think is very easy to solve, but I can't seem
to find an answer for it in my searches.
I have a bunch of json objects that I'm using. Right now I get at the info
like so for example:
for(image in data.everfi_commons.images) {
alert(data.everfi_commons.images[image]);
}
what I'd like to do instead is instead of having the name 'everfi_commons'
I'd like to just use a javascript variable that I've set up like so:
current_project = $(this).attr("id"); // this value is 'everfi_commons'
and then I thought you could just do data.current_project.images[image]
but this doesn't seem to work and I don't really understand why, any
insight would be helpful!
Python unserialize PHP session
Python unserialize PHP session
I have been trying to unserialize PHP session data in Python by using
phpserialize and a serek's modules(got it from Unserialize PHP data in
python), but it seems like impossible to me.
Both modules expect PHP session data to be like:
a:2:{s:3:"Usr";s:5:"AxL11";s:2:"Id";s:1:"2";}
But the data stored in the session file is:
Id|s:1:"2";Usr|s:5:"AxL11";
Any help would be very much appreciated.
I have been trying to unserialize PHP session data in Python by using
phpserialize and a serek's modules(got it from Unserialize PHP data in
python), but it seems like impossible to me.
Both modules expect PHP session data to be like:
a:2:{s:3:"Usr";s:5:"AxL11";s:2:"Id";s:1:"2";}
But the data stored in the session file is:
Id|s:1:"2";Usr|s:5:"AxL11";
Any help would be very much appreciated.
Get paths for all leaf nodes within an
Get paths for all leaf nodes within an
Below is a multimensional arra that I made for testing and I wish to make
a function called getPaths which returns something like the following:
(The function would be called like $path = getPaths($multi_array); )
<?php
$tree = array (
0 => array(
"text" => "Knock-knock.",
"replies" => array(
0 => array(
"text" => "Who is there?",
"replies" => array(
0 => array(
"text" => "Orange.",
"replies" => array()
)
)
),
1 => array(
"text" => "Please, stop knocking.,",
"replies" => array()
)
2 => array(
"text" => "Ring the doorbell.",
"replies" => array(
0 => array(
"text" => "OK, I will ring the
doorbell.",
"replies" => array()
)
1 => array(
"text" => "Where is the doorbell?"
)
)
)
)
)
);
?>
Below is a multimensional arra that I made for testing and I wish to make
a function called getPaths which returns something like the following:
(The function would be called like $path = getPaths($multi_array); )
<?php
$tree = array (
0 => array(
"text" => "Knock-knock.",
"replies" => array(
0 => array(
"text" => "Who is there?",
"replies" => array(
0 => array(
"text" => "Orange.",
"replies" => array()
)
)
),
1 => array(
"text" => "Please, stop knocking.,",
"replies" => array()
)
2 => array(
"text" => "Ring the doorbell.",
"replies" => array(
0 => array(
"text" => "OK, I will ring the
doorbell.",
"replies" => array()
)
1 => array(
"text" => "Where is the doorbell?"
)
)
)
)
)
);
?>
Saturday, 28 September 2013
concat two strings from keyboard input
concat two strings from keyboard input
I want to concat two strings from the user's keyboard input, and this is
the code I tried :
char a[50], b[50], aAndB[100];
printf("\na : ");
fgets(a, sizeof(a), stdin);
printf("\nb : ");
fgets(b, sizeof(b), stdin);
snprintf(aAndB, sizeof(aAndB), "%s/%s", a, b);
printf(aAndB);
The problem is that the two strings are concatenated with a "\n", to be
more clear, this is the output :
a : text1
b : text2
text1
/text2
but the output I'm expecting is :
a : text1
b : text2
text1/text2
How can I solve this problem ?
I want to concat two strings from the user's keyboard input, and this is
the code I tried :
char a[50], b[50], aAndB[100];
printf("\na : ");
fgets(a, sizeof(a), stdin);
printf("\nb : ");
fgets(b, sizeof(b), stdin);
snprintf(aAndB, sizeof(aAndB), "%s/%s", a, b);
printf(aAndB);
The problem is that the two strings are concatenated with a "\n", to be
more clear, this is the output :
a : text1
b : text2
text1
/text2
but the output I'm expecting is :
a : text1
b : text2
text1/text2
How can I solve this problem ?
R takes forever to compute a simple procedure
R takes forever to compute a simple procedure
allWords is a vector of 1.3 million words, with some repetition. What I
want to do, is to create two vectors:
A with the word
B with the occurance of the word
So that I can later join them in a Matrix and thus associate them, like:
"mom", 3 ; "pencil", 14 etc.
for(word in allWords){
#get a vector with indexes for all repetitions of a word
temp <- which(allWords==word)
#Make "allWords" smaller - remove duplicates
allWords= allWords[-which(allWords==word)]
#Calculate occurance
occ<-length(temp)
#store
A = c(A,word)
B = c(B,occ)
}
This for loop takes forever and I don't really know why or what I am doing
wrong. Reading the 1.3 million words from a file goes as fast as 5
seconds, but performing these basic operations never lets the algorithm
terminate.
allWords is a vector of 1.3 million words, with some repetition. What I
want to do, is to create two vectors:
A with the word
B with the occurance of the word
So that I can later join them in a Matrix and thus associate them, like:
"mom", 3 ; "pencil", 14 etc.
for(word in allWords){
#get a vector with indexes for all repetitions of a word
temp <- which(allWords==word)
#Make "allWords" smaller - remove duplicates
allWords= allWords[-which(allWords==word)]
#Calculate occurance
occ<-length(temp)
#store
A = c(A,word)
B = c(B,occ)
}
This for loop takes forever and I don't really know why or what I am doing
wrong. Reading the 1.3 million words from a file goes as fast as 5
seconds, but performing these basic operations never lets the algorithm
terminate.
SQLiteException: near "references": syntax error: CREATE TABLE references(_id INTEGER PRIMARY KEY AUTOINCREMENT,class TEXT,requestCode...
SQLiteException: near "references": syntax error: CREATE TABLE
references(_id INTEGER PRIMARY KEY AUTOINCREMENT,class TEXT,requestCode...
Please, I am really a novice of SQLite.
I do not understand why I this error.
This, I suppose, is the culprit, when the SQLiteOpenHelper tries to create
the table
public class PendingiIntentsDatabaseHandler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "pendingintents";
// Contacts table name
private static final String TABLE_REFERENCES = "references";
// Contacts Table Columns names
private static final String KEY_CLASS = "class";
private static final String KEY_REQUESTCODE = "requestCode";
public PendingiIntentsDatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_EVENTS_TABLE = "CREATE TABLE " + TABLE_REFERENCES + "("
+ "_id" + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ KEY_CLASS + " TEXT,"
+ KEY_REQUESTCODE + " TEXT"
+
")";
db.execSQL(CREATE_EVENTS_TABLE);
}
this is the LogCat:
09-28 18:25:27.703: E/AndroidRuntime(2213): FATAL EXCEPTION:
IntentService[ScheduledService]
09-28 18:25:27.703: E/AndroidRuntime(2213):
android.database.sqlite.SQLiteException: near "references": syntax error:
CREATE TABLE references(_id INTEGER PRIMARY KEY AUTOINCREMENT,class
TEXT,requestCode TEXT)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1763)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.scheduler.PendingiIntentsDatabaseHandler.onCreate(PendingiIntentsDatabaseHandler.java:44)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:126)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.scheduler.PendingiIntentsDatabaseHandler.addPendingIntentReference(PendingiIntentsDatabaseHandler.java:63)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.scheduler.Scheduler.schedule(Scheduler.java:50)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.crisismate2.OnBootService.onHandleIntent(OnBootService.java:43)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.os.Looper.loop(Looper.java:130)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.os.HandlerThread.run(HandlerThread.java:60)
Thank you very much fro your help!!!
LISA
references(_id INTEGER PRIMARY KEY AUTOINCREMENT,class TEXT,requestCode...
Please, I am really a novice of SQLite.
I do not understand why I this error.
This, I suppose, is the culprit, when the SQLiteOpenHelper tries to create
the table
public class PendingiIntentsDatabaseHandler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "pendingintents";
// Contacts table name
private static final String TABLE_REFERENCES = "references";
// Contacts Table Columns names
private static final String KEY_CLASS = "class";
private static final String KEY_REQUESTCODE = "requestCode";
public PendingiIntentsDatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_EVENTS_TABLE = "CREATE TABLE " + TABLE_REFERENCES + "("
+ "_id" + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ KEY_CLASS + " TEXT,"
+ KEY_REQUESTCODE + " TEXT"
+
")";
db.execSQL(CREATE_EVENTS_TABLE);
}
this is the LogCat:
09-28 18:25:27.703: E/AndroidRuntime(2213): FATAL EXCEPTION:
IntentService[ScheduledService]
09-28 18:25:27.703: E/AndroidRuntime(2213):
android.database.sqlite.SQLiteException: near "references": syntax error:
CREATE TABLE references(_id INTEGER PRIMARY KEY AUTOINCREMENT,class
TEXT,requestCode TEXT)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1763)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.scheduler.PendingiIntentsDatabaseHandler.onCreate(PendingiIntentsDatabaseHandler.java:44)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:126)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.scheduler.PendingiIntentsDatabaseHandler.addPendingIntentReference(PendingiIntentsDatabaseHandler.java:63)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.scheduler.Scheduler.schedule(Scheduler.java:50)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
com.examples.android.calendar.crisismate2.OnBootService.onHandleIntent(OnBootService.java:43)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.os.Looper.loop(Looper.java:130)
09-28 18:25:27.703: E/AndroidRuntime(2213): at
android.os.HandlerThread.run(HandlerThread.java:60)
Thank you very much fro your help!!!
LISA
What is really inside the browser that makes my system compatible with chrome, opera and safari but not on firefox?
What is really inside the browser that makes my system compatible with
chrome, opera and safari but not on firefox?
Sorry i am unable to provide you a fiddle or the url of my working system.
I wanted a comprehensive explanation why my system is not compatible(at
some functions like caret positioning) with firefox and compatible with
the other three? What's inside those system? Is it because the three
browsers are webkit-based?
This is a general question. Im not asking how to fix my system to be
cross-browser compatible. I wanted to understand why such thing happen,
dipper.
chrome, opera and safari but not on firefox?
Sorry i am unable to provide you a fiddle or the url of my working system.
I wanted a comprehensive explanation why my system is not compatible(at
some functions like caret positioning) with firefox and compatible with
the other three? What's inside those system? Is it because the three
browsers are webkit-based?
This is a general question. Im not asking how to fix my system to be
cross-browser compatible. I wanted to understand why such thing happen,
dipper.
Friday, 27 September 2013
How can an Android app folder be backed up and restored on an emulator
How can an Android app folder be backed up and restored on an emulator
Is there a way to back up an Android app folder from an emulator to a
computer, then restore it to another emulator?
For example, Android emulator A has an app called Foo, therefore it has
the following folder with many sub-folders and numerous files:
/data/data/com.my.foo
I would like to back up this folder, then restore it to emulator B.
Is his doable?
Is there a way to back up an Android app folder from an emulator to a
computer, then restore it to another emulator?
For example, Android emulator A has an app called Foo, therefore it has
the following folder with many sub-folders and numerous files:
/data/data/com.my.foo
I would like to back up this folder, then restore it to emulator B.
Is his doable?
Operation must use an updatable query
Operation must use an updatable query
I am having a problem with an update query that is used to update
personnel in a table.The people being updated are personnel which have
deployed however every time I run the update query I get the error
"Operation must use an updatable query". The following code SQL code is
what is in the query
UPDATE [427 Deployed Roster Import] LEFT JOIN Personnel ON ([427 Deployed
Roster Import].[LAST NAME] = Personnel.[Name-Last]) AND ([427 Deployed
Roster Import].[FIRST NAME] = Personnel.[Name-First]) SET [427 Deployed
Roster Import].[LAST NAME] = [Personnel]![Name-Last], [427 Deployed Roster
Import].[FIRST NAME] = [Personnel]![Name-First], [427 Deployed Roster
Import].RANK = [Personnel]![Rank], [427 Deployed Roster Import].[POSITION]
= [Personnel]![Crew Position], [427 Deployed Roster Import].Rotator =
[Personnel]![Rotator Date], [427 Deployed Roster Import].[Exp RETURN DATE]
= [Personnel]![RDD], [427 Deployed Roster Import].LOCATION =
[Personnel]![Gaining Unit];
I have also tried to convert this SQL query into VBA which not only fails
to work but also displays no errors at all. When I add a watch the actual
line of VBA i get a value . The following is the converted VBA:
Private Sub btn489Update_Click()
On Error GoTo btn489Update_Click_Err
strSql = "UPDATE [489 Deployed Roster Import] LEFT JOIN Personnel ON ([489
Deployed Roster Import].[LAST NAME] = Personnel.[Name-Last])" & vbCrLf & _
"AND ([489 Deployed Roster Import].[FIRST NAME] =
Personnel.[Name-First]) SET [489 Deployed Roster Import].[LAST NAME] =
[Personnel]![Name-Last]" & vbCrLf & _
", [489 Deployed Roster Import].[FIRST NAME] =
[Personnel]![Name-First], [489 Deployed Roster Import].RANK =
[Personnel]![Rank]" & vbCrLf & _
", [489 Deployed Roster Import].[POSITION] = [Personnel]![Crew
Position], [489 Deployed Roster Import].Rotator = [Personnel]![Rotator
Date]" & vbCrLf & _
", [489 Deployed Roster Import].[Exp RETURN DATE] = [Personnel]![RDD],
[489 Deployed Roster Import].LOCATION = [Personnel]![Gaining Unit] " &
vbCrLf & _
"WHERE ((([489 Deployed Roster Import].[LAST NAME])<>""""));"
btn489Update_Click_Exit:
Exit Sub
btn489Update_Click_Err:
MsgBox Error$
Resume btn489Update_Click_Exit
End Sub
Any suggestions would be greatly appreciated as I have been working on
this problem all day with no luck. I can provide more information if it is
needed.
I am having a problem with an update query that is used to update
personnel in a table.The people being updated are personnel which have
deployed however every time I run the update query I get the error
"Operation must use an updatable query". The following code SQL code is
what is in the query
UPDATE [427 Deployed Roster Import] LEFT JOIN Personnel ON ([427 Deployed
Roster Import].[LAST NAME] = Personnel.[Name-Last]) AND ([427 Deployed
Roster Import].[FIRST NAME] = Personnel.[Name-First]) SET [427 Deployed
Roster Import].[LAST NAME] = [Personnel]![Name-Last], [427 Deployed Roster
Import].[FIRST NAME] = [Personnel]![Name-First], [427 Deployed Roster
Import].RANK = [Personnel]![Rank], [427 Deployed Roster Import].[POSITION]
= [Personnel]![Crew Position], [427 Deployed Roster Import].Rotator =
[Personnel]![Rotator Date], [427 Deployed Roster Import].[Exp RETURN DATE]
= [Personnel]![RDD], [427 Deployed Roster Import].LOCATION =
[Personnel]![Gaining Unit];
I have also tried to convert this SQL query into VBA which not only fails
to work but also displays no errors at all. When I add a watch the actual
line of VBA i get a value . The following is the converted VBA:
Private Sub btn489Update_Click()
On Error GoTo btn489Update_Click_Err
strSql = "UPDATE [489 Deployed Roster Import] LEFT JOIN Personnel ON ([489
Deployed Roster Import].[LAST NAME] = Personnel.[Name-Last])" & vbCrLf & _
"AND ([489 Deployed Roster Import].[FIRST NAME] =
Personnel.[Name-First]) SET [489 Deployed Roster Import].[LAST NAME] =
[Personnel]![Name-Last]" & vbCrLf & _
", [489 Deployed Roster Import].[FIRST NAME] =
[Personnel]![Name-First], [489 Deployed Roster Import].RANK =
[Personnel]![Rank]" & vbCrLf & _
", [489 Deployed Roster Import].[POSITION] = [Personnel]![Crew
Position], [489 Deployed Roster Import].Rotator = [Personnel]![Rotator
Date]" & vbCrLf & _
", [489 Deployed Roster Import].[Exp RETURN DATE] = [Personnel]![RDD],
[489 Deployed Roster Import].LOCATION = [Personnel]![Gaining Unit] " &
vbCrLf & _
"WHERE ((([489 Deployed Roster Import].[LAST NAME])<>""""));"
btn489Update_Click_Exit:
Exit Sub
btn489Update_Click_Err:
MsgBox Error$
Resume btn489Update_Click_Exit
End Sub
Any suggestions would be greatly appreciated as I have been working on
this problem all day with no luck. I can provide more information if it is
needed.
Downgraded image in pin description
Downgraded image in pin description
[Hope I'm in the right forum. This question is regarding a problem in the
use of this API]
I encounter the following problem with the Google Maps API on my android
phone. I create a map in my pc, add a pin, and then add a high resolution
image in the description space for this pin. The image is displayed
excellently on my pc or netbook, but when I access the map with my phone,
through Google Maps API, I press on the pin's name to see the description,
and the image is shown severely downgraded in quality (although it
maintains it's original size in height and width). Any thoughts please?
[Hope I'm in the right forum. This question is regarding a problem in the
use of this API]
I encounter the following problem with the Google Maps API on my android
phone. I create a map in my pc, add a pin, and then add a high resolution
image in the description space for this pin. The image is displayed
excellently on my pc or netbook, but when I access the map with my phone,
through Google Maps API, I press on the pin's name to see the description,
and the image is shown severely downgraded in quality (although it
maintains it's original size in height and width). Any thoughts please?
will the account be locked if user tried to add account to yodlee using wrong credential
will the account be locked if user tried to add account to yodlee using
wrong credential
Will the account be locked if user tried to add account to YODLEE more
than 3 times using wrong credential?
If the account is locked before user tried to add it to yodlee, what will
be the error message when user tried to add it?
Thanks. Yu
wrong credential
Will the account be locked if user tried to add account to YODLEE more
than 3 times using wrong credential?
If the account is locked before user tried to add it to yodlee, what will
be the error message when user tried to add it?
Thanks. Yu
Adobe CQ5.6 Click image to enlarge
Adobe CQ5.6 Click image to enlarge
I'm new to CQ5.6 and am trying to do a basic effect.
I am trying to alter the general Image component in Adobe CQ5.6 to create
an effect similar to jQuery colorbox upon click. Currently, I have added a
checkbox to the Image component to enable the ability to click to enlarge,
but I am unsure of how to proceed.
I want to be able to pull a larger rendition of the selected image from
the DAM to display in the 'Colorbox'.
<%--
Copyright 1997-2008 Day Management AG
Barfuesserplatz 6, 4001 Basel, Switzerland
All Rights Reserved.
This software is the confidential and proprietary information of
Day Management AG, ("Confidential Information"). You shall not
disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement you entered into
with Day.
==============================================================================
Image component
Draws an image.
--%><%@ page import="com.day.cq.commons.Doctype,
com.day.cq.wcm.api.components.DropTarget,
com.day.cq.wcm.foundation.Image" %><%
%>
<%@include file="/libs/foundation/global.jsp"%>
<%
Image image = new Image(resource);
if (properties.get("enlargeEnabled", false)) {
//pull larger image rendition from DAM
%><a href="<%= image.getPath() %>" /><%
}
//drop target css class = dd prefix + name of the drop target in the
edit config
image.addCssClass(DropTarget.CSS_CLASS_PREFIX + "imageEnlarger");
image.loadStyleData(currentStyle);
image.setSelector(".img"); // use image script
image.setDoctype(Doctype.fromRequest(request));
// add design information if not default (i.e. for reference paras)
if (!currentDesign.equals(resourceDesign)) {
image.setSuffix(currentDesign.getId());
}
String divId = "cq-image-jsp-" + resource.getPath();
%><div id="<%= divId %>"><% image.draw(out); %></div><%
%><cq:text property="jcr:description" placeholder="" tagName="small"
escapeXml="true"/>
I'm new to CQ5.6 and am trying to do a basic effect.
I am trying to alter the general Image component in Adobe CQ5.6 to create
an effect similar to jQuery colorbox upon click. Currently, I have added a
checkbox to the Image component to enable the ability to click to enlarge,
but I am unsure of how to proceed.
I want to be able to pull a larger rendition of the selected image from
the DAM to display in the 'Colorbox'.
<%--
Copyright 1997-2008 Day Management AG
Barfuesserplatz 6, 4001 Basel, Switzerland
All Rights Reserved.
This software is the confidential and proprietary information of
Day Management AG, ("Confidential Information"). You shall not
disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement you entered into
with Day.
==============================================================================
Image component
Draws an image.
--%><%@ page import="com.day.cq.commons.Doctype,
com.day.cq.wcm.api.components.DropTarget,
com.day.cq.wcm.foundation.Image" %><%
%>
<%@include file="/libs/foundation/global.jsp"%>
<%
Image image = new Image(resource);
if (properties.get("enlargeEnabled", false)) {
//pull larger image rendition from DAM
%><a href="<%= image.getPath() %>" /><%
}
//drop target css class = dd prefix + name of the drop target in the
edit config
image.addCssClass(DropTarget.CSS_CLASS_PREFIX + "imageEnlarger");
image.loadStyleData(currentStyle);
image.setSelector(".img"); // use image script
image.setDoctype(Doctype.fromRequest(request));
// add design information if not default (i.e. for reference paras)
if (!currentDesign.equals(resourceDesign)) {
image.setSuffix(currentDesign.getId());
}
String divId = "cq-image-jsp-" + resource.getPath();
%><div id="<%= divId %>"><% image.draw(out); %></div><%
%><cq:text property="jcr:description" placeholder="" tagName="small"
escapeXml="true"/>
How to make roles of the realm appear in the dropdown in nexus oss?
How to make roles of the realm appear in the dropdown in nexus oss?
I saw in external role mapping in nexus that , the external realms roles
can be mapped to nexus roles . But I don't know how to populate the drop
down with the roles . I was searching the ldap plugin but could not find
it . Can someone help by pointing me to some sample code to populate the
drop down with my custom realm's roles ?
I saw in external role mapping in nexus that , the external realms roles
can be mapped to nexus roles . But I don't know how to populate the drop
down with the roles . I was searching the ldap plugin but could not find
it . Can someone help by pointing me to some sample code to populate the
drop down with my custom realm's roles ?
Thursday, 26 September 2013
How send file on javascript?
How send file on javascript?
Code:
var photo = 'http://cs323230.vk.me/u172317140/d_5828c26f.jpg';
var upload_url = 'http://cs9458.vk.com/upload.php?act=do_add&mid=62..';
var xmlhttp = getXmlHttp();
var params = 'photo=' + encodeURIComponent(photo);
xmlhttp.open("POST", upload_url, true);
xmlhttp.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
var answer2 = xmlhttp.responseText;
console.log(answer2);
alert(answer2);
}
}
};
xmlhttp.send(params);
Me need change url photo on the contents of the file which find on path
'./DirectoryImage/imagetest.jpg' and send contents of the file
'./DirectoryImage/imagetest.jpg' on upload_url.
But i not know how send the contents of the file on upload_url in
javascript...
It really?
Anyone know how make it?
Code:
var photo = 'http://cs323230.vk.me/u172317140/d_5828c26f.jpg';
var upload_url = 'http://cs9458.vk.com/upload.php?act=do_add&mid=62..';
var xmlhttp = getXmlHttp();
var params = 'photo=' + encodeURIComponent(photo);
xmlhttp.open("POST", upload_url, true);
xmlhttp.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
var answer2 = xmlhttp.responseText;
console.log(answer2);
alert(answer2);
}
}
};
xmlhttp.send(params);
Me need change url photo on the contents of the file which find on path
'./DirectoryImage/imagetest.jpg' and send contents of the file
'./DirectoryImage/imagetest.jpg' on upload_url.
But i not know how send the contents of the file on upload_url in
javascript...
It really?
Anyone know how make it?
Wednesday, 25 September 2013
How can I write this T-SQL cursor?
How can I write this T-SQL cursor?
I have multiple values in one cell in a table which are separated by an
space from each other. this is somehow how my table looks like, there is a
space in between each string in every cell:
column1 column2
abc fgt rty lkj
I want to create another table based on the first table in which "abc" and
"rty" are in one row because they both are located in the first place,
"fgt" and "lkj" are in another row for the same relational reason (they
are in the 2nd place and so on):
column1 column2
abc rty
fgt lkj
How can I do that?
I have multiple values in one cell in a table which are separated by an
space from each other. this is somehow how my table looks like, there is a
space in between each string in every cell:
column1 column2
abc fgt rty lkj
I want to create another table based on the first table in which "abc" and
"rty" are in one row because they both are located in the first place,
"fgt" and "lkj" are in another row for the same relational reason (they
are in the 2nd place and so on):
column1 column2
abc rty
fgt lkj
How can I do that?
Thursday, 19 September 2013
on click pass all information
on click pass all information
I have a submit button with an id of brands_by_category_change_name_btn
that when clicked runs the below JS. The issue is that I am getting the
same response Object {id: 2, cat_id: 1, state: "0"} no matter if my
checkboxes are checked or unchecked.
Checkbox Code
<input type="checkbox" name="product_category"
class="product_category_selector" id="product_category_<?php echo
$assoc_cat['id']; ?>" data-id="<?php echo $assoc_cat['id']; ?>" <?php echo
$checked_state; ?> /> <?php echo $assoc_cat['name']; ?><br />
Using javascript how can I add all of my checked checkbox options into my
cat_id variable for processing?
JS
$('body').on("click", "#brands_by_category_change_name_btn", function (e) {
e.preventDefault();
var self = $(this);
var id = $("#manID").data("id");
var cat_id = new Array();
var cat_id = $(".product_category_selector").data("id");
var url = $("#manufacturers_table").data("infourl");
var state = "0";
if(self.is(":checked"))
{
state = "1";
}
var data_array = {
id : id,
cat_id : cat_id,
state : state
};
console.log(data_array);
//ajaxCall(url, data_array, null,
"reload_selected_product_categories");
});
I have a submit button with an id of brands_by_category_change_name_btn
that when clicked runs the below JS. The issue is that I am getting the
same response Object {id: 2, cat_id: 1, state: "0"} no matter if my
checkboxes are checked or unchecked.
Checkbox Code
<input type="checkbox" name="product_category"
class="product_category_selector" id="product_category_<?php echo
$assoc_cat['id']; ?>" data-id="<?php echo $assoc_cat['id']; ?>" <?php echo
$checked_state; ?> /> <?php echo $assoc_cat['name']; ?><br />
Using javascript how can I add all of my checked checkbox options into my
cat_id variable for processing?
JS
$('body').on("click", "#brands_by_category_change_name_btn", function (e) {
e.preventDefault();
var self = $(this);
var id = $("#manID").data("id");
var cat_id = new Array();
var cat_id = $(".product_category_selector").data("id");
var url = $("#manufacturers_table").data("infourl");
var state = "0";
if(self.is(":checked"))
{
state = "1";
}
var data_array = {
id : id,
cat_id : cat_id,
state : state
};
console.log(data_array);
//ajaxCall(url, data_array, null,
"reload_selected_product_categories");
});
charts and graphs module in perl/bioperl
charts and graphs module in perl/bioperl
what are the best perl / bioperl modules for plotting statistical charts ?
I already tried GD::Graphs and it doesn't look so nice...any idea of other
modules ?
what are the best perl / bioperl modules for plotting statistical charts ?
I already tried GD::Graphs and it doesn't look so nice...any idea of other
modules ?
Is it true that fork() calls clone() internally?
Is it true that fork() calls clone() internally?
I read here that clone() system call is used to create a thread in Linux.
Now the syntax of clone() is such that a starting routine/function address
is needed to be passed to it.
But here on this page it is written that fork() calls clone() internally.
So my question is how do child process created by fork() starts running
the part of code which is after fork() call, i.e. how does it not require
a function as starting point?
If the links I provided have incorrect info, then please guide me to some
better links/resources.
Thanks
I read here that clone() system call is used to create a thread in Linux.
Now the syntax of clone() is such that a starting routine/function address
is needed to be passed to it.
But here on this page it is written that fork() calls clone() internally.
So my question is how do child process created by fork() starts running
the part of code which is after fork() call, i.e. how does it not require
a function as starting point?
If the links I provided have incorrect info, then please guide me to some
better links/resources.
Thanks
I can't get my random number generator to work.
I can't get my random number generator to work.
I have to have a random number generator that gets a number from the user
and then generates 10000 random numbers between 1 and the users number
then figures min, max, and mean. Here is what I have so far. I am stuck on
the actionPerformed method. I am a total noob so please try to explain
your answers. I am still learning ummm pretty much everything.
//MY ISSUE:
//I have the JApplet coded just can't figure out the action performed
method. I have searched Google high and low for help and the chapter
covered //in the book this week in appendix c and they don't explain how
to do what we are asked to do. I have completed every other assignment in
the //class on my own but can't seem to get this one and have spent 19
hours on it so far.
package randomNums;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static java.lang.Math.*;
import javax.swing.*;
import java.applet.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Random;
public class RandomNums extends Applet implements ActionListener {
/**
*
*/
// PAINT METHOD
public void paint(Graphics g)
{
Font font = new Font("Arial", Font.BOLD, 18);
g.setFont(font);
g.setColor(Color.WHITE);
g.drawString("Enter A Number", 70, 25);
resize(350, 350);
this.setBackground(Color.BLUE);
}
// CREATES OBJECTS
private static final long serialVersionUID = 1L;
TextField text1, text2, text3, text5;
Label label1, label2, label3, label4;
Button button;
Font font = new Font("Arial", Font.BOLD, 11);
private double all;
// INIT METHOD
public void init() {
setLayout(null);
repaint();
// YOUR NUMBER LABEL
label1 = new Label("Your Number ");
label1.setBounds(25, 35, 100, 20);
setFont(font);
add(label1);
// YOUR NUMBER ENTRY
text1 = new TextField(5);
text1.setBounds(150, 30, 100, 25);
add(text1);
// MAXIMUM
label2 = new Label("The Maximum Number Is: ");
label2.setBounds(25, 100, 150, 25);
setFont(font);
add(label2);
// MAXIMUM ANSWER
text2 = new TextField(5);
text2.setBounds(180, 100, 50, 25);
add(text2);
// MINIMUM
label3 = new Label("The Minimum Number Is: ");
label3.setBounds(25, 170, 150, 25);
setFont(font);
add(label3);
// MINIMUM ANSWER
text5 = new TextField(5);
text5.setBounds(180, 170, 50, 25);
add(text5);
// MEAN
label4 = new Label("The Mean is: ");
label4.setBounds(25, 135, 150, 25);
setFont(font);
add(label4);
// MEAN ANSWER
text3 = new TextField(5);
text3.setBounds(180, 135, 50, 25);
add(text3);
// BUTTON
button = new Button("Enter");
button.setBounds(90, 70, 100, 20);
add(button);
// ACTION LISTENER
button.addActionListener(this);
}
public void actionPerformed(ActionEvent ae) {
Random ran = new Random(10000);
try {
//NOT SURE HOW TO GET ALL OF THE NUMBERS ADDED TO THE ARRAY LIST
double[] arrList = ran();
//THIS IS NOT WORKING RIGHT ONLY STORING ONE VALUE
all = ran.nextDouble();
for (int i = 0; i < arrList.length; i++) {
System.out.println(arrList[i] + " ");
//THIS IS IN THERE FOR MY TESTING PURPOSES NEED TO TAKE OUT
BEFORE SUBMITTING
System.out.println(arrList);
final double TIMES = (double) 10000;
final String LIMIT = text1.getText();
Double.parseDouble(LIMIT);
//FOR LOOP
for (int x = 1; x < TIMES; ++x);
//SETS TEXT FOR MIN BOX (NOT SURE IF IT IS DOING THE CALCULATIONS
RIGHT)
text5.setText(ran.nextDouble() + "");
//my comment: another variable after for loop to get mean , fix numbers
being saved to an array so they can be added and divided to get mean,
}
}
catch (NumberFormatException m) {
if (getText(text1) == 0)
JOptionPane.showMessageDialog(this,
"Please enter a number between 1- 10,000");
}
}
private int getText(TextField text12) {
// TODO Auto-generated method stub
return 0;
}
}
I have to have a random number generator that gets a number from the user
and then generates 10000 random numbers between 1 and the users number
then figures min, max, and mean. Here is what I have so far. I am stuck on
the actionPerformed method. I am a total noob so please try to explain
your answers. I am still learning ummm pretty much everything.
//MY ISSUE:
//I have the JApplet coded just can't figure out the action performed
method. I have searched Google high and low for help and the chapter
covered //in the book this week in appendix c and they don't explain how
to do what we are asked to do. I have completed every other assignment in
the //class on my own but can't seem to get this one and have spent 19
hours on it so far.
package randomNums;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static java.lang.Math.*;
import javax.swing.*;
import java.applet.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Random;
public class RandomNums extends Applet implements ActionListener {
/**
*
*/
// PAINT METHOD
public void paint(Graphics g)
{
Font font = new Font("Arial", Font.BOLD, 18);
g.setFont(font);
g.setColor(Color.WHITE);
g.drawString("Enter A Number", 70, 25);
resize(350, 350);
this.setBackground(Color.BLUE);
}
// CREATES OBJECTS
private static final long serialVersionUID = 1L;
TextField text1, text2, text3, text5;
Label label1, label2, label3, label4;
Button button;
Font font = new Font("Arial", Font.BOLD, 11);
private double all;
// INIT METHOD
public void init() {
setLayout(null);
repaint();
// YOUR NUMBER LABEL
label1 = new Label("Your Number ");
label1.setBounds(25, 35, 100, 20);
setFont(font);
add(label1);
// YOUR NUMBER ENTRY
text1 = new TextField(5);
text1.setBounds(150, 30, 100, 25);
add(text1);
// MAXIMUM
label2 = new Label("The Maximum Number Is: ");
label2.setBounds(25, 100, 150, 25);
setFont(font);
add(label2);
// MAXIMUM ANSWER
text2 = new TextField(5);
text2.setBounds(180, 100, 50, 25);
add(text2);
// MINIMUM
label3 = new Label("The Minimum Number Is: ");
label3.setBounds(25, 170, 150, 25);
setFont(font);
add(label3);
// MINIMUM ANSWER
text5 = new TextField(5);
text5.setBounds(180, 170, 50, 25);
add(text5);
// MEAN
label4 = new Label("The Mean is: ");
label4.setBounds(25, 135, 150, 25);
setFont(font);
add(label4);
// MEAN ANSWER
text3 = new TextField(5);
text3.setBounds(180, 135, 50, 25);
add(text3);
// BUTTON
button = new Button("Enter");
button.setBounds(90, 70, 100, 20);
add(button);
// ACTION LISTENER
button.addActionListener(this);
}
public void actionPerformed(ActionEvent ae) {
Random ran = new Random(10000);
try {
//NOT SURE HOW TO GET ALL OF THE NUMBERS ADDED TO THE ARRAY LIST
double[] arrList = ran();
//THIS IS NOT WORKING RIGHT ONLY STORING ONE VALUE
all = ran.nextDouble();
for (int i = 0; i < arrList.length; i++) {
System.out.println(arrList[i] + " ");
//THIS IS IN THERE FOR MY TESTING PURPOSES NEED TO TAKE OUT
BEFORE SUBMITTING
System.out.println(arrList);
final double TIMES = (double) 10000;
final String LIMIT = text1.getText();
Double.parseDouble(LIMIT);
//FOR LOOP
for (int x = 1; x < TIMES; ++x);
//SETS TEXT FOR MIN BOX (NOT SURE IF IT IS DOING THE CALCULATIONS
RIGHT)
text5.setText(ran.nextDouble() + "");
//my comment: another variable after for loop to get mean , fix numbers
being saved to an array so they can be added and divided to get mean,
}
}
catch (NumberFormatException m) {
if (getText(text1) == 0)
JOptionPane.showMessageDialog(this,
"Please enter a number between 1- 10,000");
}
}
private int getText(TextField text12) {
// TODO Auto-generated method stub
return 0;
}
}
get the value of the current ID in an list item
get the value of the current ID in an list item
can any of you pls tell me how to get the value of the current ID out of
this list item. I have many list items which are generated by java
servlets so I need to get the current ID of the list (which is clicked):
so when i click:
$('li.doBlokkeer').hover(function(e) {
now I need the value of the id
<li class="doBlokkeer" id="${cell.id}"></li>
I think it is something like, but it doesnt work
var idblokkeer = document.getElementById('doBlokkeer');
var valueid = idblokkeer.getAttribute('id');
can any of you pls tell me how to get the value of the current ID out of
this list item. I have many list items which are generated by java
servlets so I need to get the current ID of the list (which is clicked):
so when i click:
$('li.doBlokkeer').hover(function(e) {
now I need the value of the id
<li class="doBlokkeer" id="${cell.id}"></li>
I think it is something like, but it doesnt work
var idblokkeer = document.getElementById('doBlokkeer');
var valueid = idblokkeer.getAttribute('id');
Changing servlet location on Init()
Changing servlet location on Init()
Is it possible to change the init parameters so that the servlet is
created at a different path? I need to create a servlet at a certain path.
Furthermore, would it be possible to artificially pass the path inside the
init parameters?
Is it possible to change the init parameters so that the servlet is
created at a different path? I need to create a servlet at a certain path.
Furthermore, would it be possible to artificially pass the path inside the
init parameters?
How to style the td in only one grid when my page have two grids?
How to style the td in only one grid when my page have two grids?
My page have two grids called grid1,grid2,I only want to style the
grid1,not grid2.I use the css style in the header like this,but it seems
that both grid changed.
.k-grid td {
color:red;
padding: 0px;
}
I try to write like this,but failed.
.GridTd {
color:red;
padding: 0px;
}
$("#grid1 td").addClass("GridTd "); //failed
$("#grid1 k-grid td").addClass("GridTd ");// faied
I debug with firebug and find that the td style is used by default
style(.k-grid td),not GridTd Style.
.k-grid td {
border-style: solid; border-width: 0 0 0 1px;
line-height: 1.6em; overflow: hidden;
padding: 0.4em 0.6em; text-overflow: ellipsis;
vertical-align: middle;
}.
.GridTd { color:red; padding: 0;}
My page have two grids called grid1,grid2,I only want to style the
grid1,not grid2.I use the css style in the header like this,but it seems
that both grid changed.
.k-grid td {
color:red;
padding: 0px;
}
I try to write like this,but failed.
.GridTd {
color:red;
padding: 0px;
}
$("#grid1 td").addClass("GridTd "); //failed
$("#grid1 k-grid td").addClass("GridTd ");// faied
I debug with firebug and find that the td style is used by default
style(.k-grid td),not GridTd Style.
.k-grid td {
border-style: solid; border-width: 0 0 0 1px;
line-height: 1.6em; overflow: hidden;
padding: 0.4em 0.6em; text-overflow: ellipsis;
vertical-align: middle;
}.
.GridTd { color:red; padding: 0;}
Wednesday, 18 September 2013
Xcode 5.0 is stuck "Attaching to [MyApp]"
Xcode 5.0 is stuck "Attaching to [MyApp]"
I can't run my app on the iPhone simulator. Xcode 5.0 shows that it is
currently "Attaching to [MyApp]" and will be stuck in this.
Previously in Xcode 4.2 I can change the debugger to GDB and it works, but
in Xcode 5.0 there is only LLDB.
Anyone managed to solve this problem?
I can't run my app on the iPhone simulator. Xcode 5.0 shows that it is
currently "Attaching to [MyApp]" and will be stuck in this.
Previously in Xcode 4.2 I can change the debugger to GDB and it works, but
in Xcode 5.0 there is only LLDB.
Anyone managed to solve this problem?
Obtaining generated ProductCode as a variable in Wix
Obtaining generated ProductCode as a variable in Wix
In our product we use
Is there a way for Wix to tell me what ProductCode it has generated so
that I can add it as a variable to a "RegistryValue" Wix element?
I'm guessing there isn't, so I tried using a "
Is there any pure Wix way to achieve what I want? I could generate the
ProductCode outside of Wix and have the Wix elements use this as an
environment variable, but this adds an extra level of complexity to the
build process - something else that could break. I would like it if I
could do this purely with Wix.
In our product we use
Is there a way for Wix to tell me what ProductCode it has generated so
that I can add it as a variable to a "RegistryValue" Wix element?
I'm guessing there isn't, so I tried using a "
Is there any pure Wix way to achieve what I want? I could generate the
ProductCode outside of Wix and have the Wix elements use this as an
environment variable, but this adds an extra level of complexity to the
build process - something else that could break. I would like it if I
could do this purely with Wix.
Can the lsqcurvefit matlab function be used in a cuda kernel?
Can the lsqcurvefit matlab function be used in a cuda kernel?
The lsqcurvefit matlab function is used to fit the paramaters of a model
curve to a real curve (adquired data from experiment or observation) so
that de square differences are minimized. enter link description here
The function is time consuming, and maybe prohibitive if used on large set
of curves.
Can it be straightforwardly used inside a cuda kernel, being then all the
program coded in matlab?
Thanks
The lsqcurvefit matlab function is used to fit the paramaters of a model
curve to a real curve (adquired data from experiment or observation) so
that de square differences are minimized. enter link description here
The function is time consuming, and maybe prohibitive if used on large set
of curves.
Can it be straightforwardly used inside a cuda kernel, being then all the
program coded in matlab?
Thanks
Case within Case when combining multiple columns into one
Case within Case when combining multiple columns into one
I'm trying to create a query that will take multiple columns in a View and
bring it into one column in the query. The values from each column needs
to be separated by '|' (pipe).
I've tried:
1) (expression1 + '|' + expression2) AS xxxx, but if one expression has a
null value, it makes the results 'null'.
2) CAST (expression1 as varchar (10)) + '|' + CAST (expression2 as varchar
(10)) AS xxxx, but get the same results.
3) CASE (expression1 is null) then (' ') else (expression1) +'|' + CASE
(expression2 is null) then (' ') else (expression2) END AS xxxx, but I get
a syntax error near the keyword 'AS'.
Here's the full query using CASE.
SELECT DISTINCT dbo.REG.BUILDING, dbo.REG.CURRENT_STATUS,
dbo.REG_CONTACT.LOGIN_ID, dbo.REG.LAST_NAME
, CASE WHEN dbo.View_MYAccess_Period1.CRSGRP1 is null then ' ' else
dbo.View_MYAccess_Period1.CRSGRP1 + ' |' +
CASE WHEN dbo.View_MYAccess_Period2.CRSGRP2 is null then ' ' else
dbo.View_MYAccess_Period2.CRSGRP2
END AS CRSGRP
FROM dbo.REG_CONTACT RIGHT OUTER JOIN
dbo.REG_STU_CONTACT ON dbo.REG_CONTACT.CONTACT_ID =
dbo.REG_STU_CONTACT.CONTACT_ID RIGHT OUTER JOIN
dbo.REG ON dbo.REG_STU_CONTACT.STUDENT_ID = dbo.REG.STUDENT_ID LEFT OUTER
JOIN
dbo.View_MYAccess_Period1 ON dbo.REG.STUDENT_ID =
dbo.View_MYAccess_Period1.STUDENT_ID LEFT OUTER JOIN
dbo.View_MYAccess_Period2 ON dbo.REG.STUDENT_ID =
dbo.View_MYAccess_Period2.STUDENT_ID
Any help for this newbie would be greatly appreciated!
I'm trying to create a query that will take multiple columns in a View and
bring it into one column in the query. The values from each column needs
to be separated by '|' (pipe).
I've tried:
1) (expression1 + '|' + expression2) AS xxxx, but if one expression has a
null value, it makes the results 'null'.
2) CAST (expression1 as varchar (10)) + '|' + CAST (expression2 as varchar
(10)) AS xxxx, but get the same results.
3) CASE (expression1 is null) then (' ') else (expression1) +'|' + CASE
(expression2 is null) then (' ') else (expression2) END AS xxxx, but I get
a syntax error near the keyword 'AS'.
Here's the full query using CASE.
SELECT DISTINCT dbo.REG.BUILDING, dbo.REG.CURRENT_STATUS,
dbo.REG_CONTACT.LOGIN_ID, dbo.REG.LAST_NAME
, CASE WHEN dbo.View_MYAccess_Period1.CRSGRP1 is null then ' ' else
dbo.View_MYAccess_Period1.CRSGRP1 + ' |' +
CASE WHEN dbo.View_MYAccess_Period2.CRSGRP2 is null then ' ' else
dbo.View_MYAccess_Period2.CRSGRP2
END AS CRSGRP
FROM dbo.REG_CONTACT RIGHT OUTER JOIN
dbo.REG_STU_CONTACT ON dbo.REG_CONTACT.CONTACT_ID =
dbo.REG_STU_CONTACT.CONTACT_ID RIGHT OUTER JOIN
dbo.REG ON dbo.REG_STU_CONTACT.STUDENT_ID = dbo.REG.STUDENT_ID LEFT OUTER
JOIN
dbo.View_MYAccess_Period1 ON dbo.REG.STUDENT_ID =
dbo.View_MYAccess_Period1.STUDENT_ID LEFT OUTER JOIN
dbo.View_MYAccess_Period2 ON dbo.REG.STUDENT_ID =
dbo.View_MYAccess_Period2.STUDENT_ID
Any help for this newbie would be greatly appreciated!
Select Users who have made the most positive contributions
Select Users who have made the most positive contributions
I thought I had this, but it's clear I don't. From the table below, I'm
trying to display users who have made the most positive contributions
(articles) on top, followed by the ones who didn't. The table is simple,
artc_id is the article Id, artc_status is the status which shows if an
article was approved or not. 0 is approved, 1 is not, then comes the user
who wrote the article.
The results I'm trying to achieve are as follows:
Total Contributions Positive Contributing User
4 4 2
3 2 1
1 1 4
3 0 3
Table
"id" "artc_id" "artc_status" "artc_user" "artc_country"
"1" "1" "0" "1" "US"
"2" "2" "0" "1" "US"
"3" "3" "1" "1" "US"
"4" "4" "0" "2" "US"
"5" "5" "0" "2" "US"
"6" "6" "0" "2" "US"
"7" "7" "0" "2" "US"
"8" "8" "1" "3" "US"
"9" "9" "1" "3" "US"
"10" "10" "1" "3" "US"
"11" "11" "0" "4" "US"
The Sql I came up with
select count(artc_status) as stats , artc_user from contributions where
artc_status = 0 group by artc_user order by stats desc;
I'm not having much luck getting results like I posted above. Can you
please assist? This is completely beyond me.
I thought I had this, but it's clear I don't. From the table below, I'm
trying to display users who have made the most positive contributions
(articles) on top, followed by the ones who didn't. The table is simple,
artc_id is the article Id, artc_status is the status which shows if an
article was approved or not. 0 is approved, 1 is not, then comes the user
who wrote the article.
The results I'm trying to achieve are as follows:
Total Contributions Positive Contributing User
4 4 2
3 2 1
1 1 4
3 0 3
Table
"id" "artc_id" "artc_status" "artc_user" "artc_country"
"1" "1" "0" "1" "US"
"2" "2" "0" "1" "US"
"3" "3" "1" "1" "US"
"4" "4" "0" "2" "US"
"5" "5" "0" "2" "US"
"6" "6" "0" "2" "US"
"7" "7" "0" "2" "US"
"8" "8" "1" "3" "US"
"9" "9" "1" "3" "US"
"10" "10" "1" "3" "US"
"11" "11" "0" "4" "US"
The Sql I came up with
select count(artc_status) as stats , artc_user from contributions where
artc_status = 0 group by artc_user order by stats desc;
I'm not having much luck getting results like I posted above. Can you
please assist? This is completely beyond me.
Using gunicorn raises KeyError wsgi.websocket
Using gunicorn raises KeyError wsgi.websocket
I am not familiar with gunicorn and system administration and trying to
deploy it on server.
Running of process is very easy and I did it using command
gunicorn -c gunicorn_config.py --bind 127.0.0.1:8000 -k gevent_wsgi
--daemon wsgi:app
gunicorn_config.py
workers = 2
worker_class = 'socketio.sgunicorn.GeventSocketIOWorker'
transports = ['websockets', 'xhr-polling']
bind = '127.0.0.1:8000'
pidfile = '/tmp/gunicorn.pid'
debug = False
loglevel = 'info'
errorlog = '/tmp/gunicorn.log'
resource = "socket.io"
wsgi.py
import os.path as op
import werkzeug.serving
import gevent.monkey
gevent.monkey.patch_all()
from bakery import create_app, init_app
app = create_app(app_name='bakery')
app.config.from_object('config')
app.config.from_pyfile(op.join(op.realpath(op.dirname(__name__)),
'local.cfg'))
init_app(app)
from socketio.server import SocketIOServer
SocketIOServer(('0.0.0.0', 5000), app,
resource="socket.io", policy_server=True,
transports=['websocket', 'xhr-polling'],
).serve_forever()
nginx is set up to use in location
proxy_pass http://localhost:8000
gunicorn successfully runs but after several manipulation on app it
crashes with KeyError 'wsgi.websocket'. Seems that transport websocket is
not enough for that, but I am not sure.
I am not familiar with gunicorn and system administration and trying to
deploy it on server.
Running of process is very easy and I did it using command
gunicorn -c gunicorn_config.py --bind 127.0.0.1:8000 -k gevent_wsgi
--daemon wsgi:app
gunicorn_config.py
workers = 2
worker_class = 'socketio.sgunicorn.GeventSocketIOWorker'
transports = ['websockets', 'xhr-polling']
bind = '127.0.0.1:8000'
pidfile = '/tmp/gunicorn.pid'
debug = False
loglevel = 'info'
errorlog = '/tmp/gunicorn.log'
resource = "socket.io"
wsgi.py
import os.path as op
import werkzeug.serving
import gevent.monkey
gevent.monkey.patch_all()
from bakery import create_app, init_app
app = create_app(app_name='bakery')
app.config.from_object('config')
app.config.from_pyfile(op.join(op.realpath(op.dirname(__name__)),
'local.cfg'))
init_app(app)
from socketio.server import SocketIOServer
SocketIOServer(('0.0.0.0', 5000), app,
resource="socket.io", policy_server=True,
transports=['websocket', 'xhr-polling'],
).serve_forever()
nginx is set up to use in location
proxy_pass http://localhost:8000
gunicorn successfully runs but after several manipulation on app it
crashes with KeyError 'wsgi.websocket'. Seems that transport websocket is
not enough for that, but I am not sure.
how to implement templates in Android
how to implement templates in Android
I need to implement a templates in the Eclipse IDE. In the Wizard
->Android -> Android Activity After to appears in New Activity -> Create
Activity.
how will do that?
To use in my own projects.
I need to implement a templates in the Eclipse IDE. In the Wizard
->Android -> Android Activity After to appears in New Activity -> Create
Activity.
how will do that?
To use in my own projects.
Tuesday, 17 September 2013
Remove 'disabled' of an element which is present in a redirected page
Remove 'disabled' of an element which is present in a redirected page
I'm redirecting users from a.html to b.html page after login. There is a
file select button "Select Images" with "disabled" attribute on b.html
page, which I want to be enabled only after FB login. Below is my code for
this.
function fblogin(){
FB.login(function(response) {
if (response.status == 'connected') {
login();
} else {
//window.location.reload();
}
}, {scope:'email,publish_stream'});
return false;
}
function login() {
window.location = "b.html";
document.getElementById('uploadbtn').removeAttribute('disabled');
document.getElementById("genPNG").attr('disabled','enabled');
document.getElementById("genJPG").removeAttribute('disabled');
}
No luck with the above code, so I putted
document.getElementById('uploadbtn').removeAttribute('disabled');
document.getElementById("genPNG").attr('disabled','enabled');
document.getElementById("genJPG").removeAttribute('disabled');
on b.html page. How can I make it work as the way I want? Any help is much
appreciated. Thanks in advance.
I'm redirecting users from a.html to b.html page after login. There is a
file select button "Select Images" with "disabled" attribute on b.html
page, which I want to be enabled only after FB login. Below is my code for
this.
function fblogin(){
FB.login(function(response) {
if (response.status == 'connected') {
login();
} else {
//window.location.reload();
}
}, {scope:'email,publish_stream'});
return false;
}
function login() {
window.location = "b.html";
document.getElementById('uploadbtn').removeAttribute('disabled');
document.getElementById("genPNG").attr('disabled','enabled');
document.getElementById("genJPG").removeAttribute('disabled');
}
No luck with the above code, so I putted
document.getElementById('uploadbtn').removeAttribute('disabled');
document.getElementById("genPNG").attr('disabled','enabled');
document.getElementById("genJPG").removeAttribute('disabled');
on b.html page. How can I make it work as the way I want? Any help is much
appreciated. Thanks in advance.
Refresh google map markers from mysql
Refresh google map markers from mysql
I can pull this information from my MySQL table and display what I need to
but I would like some help on how to refresh this data every 5 sec or so
with the current code that I have. There isn't much data to show just like
5 or 8 markers at any given time. I have included my current code that I
use to pull the data. I am sorta ok with php/MySQL but very new to Google
Maps.
Thank you for your time
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=true" /></script>
<script type='text/javascript'>
//This javascript will load when the page loads.
jQuery(document).ready( function($){
//Initialize the Google Maps
var geocoder;
var map;
var markersArray = [];
var infos = [];
geocoder = new google.maps.Geocoder();
var myOptions = {
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
//Load the Map into the map_canvas div
var map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
//Initialize a variable that the auto-size the map to whatever you
are plotting
var bounds = new google.maps.LatLngBounds();
//Initialize the encoded string
var encodedString;
//Initialize the array that will hold the contents of the split
string
var stringArray = [];
//Get the value of the encoded string from the hidden input
encodedString = document.getElementById("encodedString").value;
//Split the encoded string into an array the separates each location
stringArray = encodedString.split("****");
var x;
for (x = 0; x < stringArray.length; x = x + 1)
{
var addressDetails = [];
var marker;
//Separate each field
addressDetails = stringArray[x].split("&&&");
//Load the lat, long data
var lat = new google.maps.LatLng(addressDetails[1],
addressDetails[2]);
var image = new google.maps.MarkerImage(addressDetails[3]);
//Create a new marker and info window
var marker = new google.maps.Marker({
map: map,
icon: image,
position: lat,
content: addressDetails[0]
});
//Pushing the markers into an array so that it's easier to
manage them
markersArray.push(marker);
google.maps.event.addListener( marker, 'click', function () {
closeInfos();
var info = new google.maps.InfoWindow({content:
this.content});
//On click the map will load the info window
info.open(map,this);
infos[0]=info;
});
//Extends the boundaries of the map to include this new location
bounds.extend(lat);
}
//Takes all the lat, longs in the bounds variable and autosizes
the map
map.fitBounds(bounds);
//Manages the info windows
function closeInfos(){
if(infos.length > 0){
infos[0].set("marker",null);
infos[0].close();
infos.length = 0;
}
}
});
</script>
</head>
<body>
<div id='input'>
<?php
//Initialize your first couple variables
$encodedString = ""; //This is the string that will hold all your
location data
$x = 0; //This is a trigger to keep the string tidy
//Now we do a simple query to the database
// DB INFO CONNECTION IS HERE AND WORKS
$result = mysql_query("SELECT * FROM `ulocation` WHERE `ul_lat`!=''
AND `ul_long`!='' AND `ul_onduty`='1'",$db1);
//Multiple rows are returned
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
//This is to keep an empty first or last line from forming, when
the string is split
if ( $x == 0 )
{
$separator = "";
}
else
{
//Each row in the database is separated in the string by four
*'s
$separator = "****";
}
$status='0';
$cadd = sql::getval('cal_address', 'call', "WHERE
`cal_id`='$row[14]'");
$num = sql::getval('cal_num', 'call', "WHERE `cal_id`='$row[14]'");
$pcond = sql::getval('cal_pcond', 'call', "WHERE
`cal_id`='$row[14]'");
$list="$num $cadd";
//Saving to the String, each variable is separated by three &'s
$encodedString = $encodedString.$separator.
"<table border=0 width='350' height='20' class='maincolm'
cellpadding=0 cellspacing=0><td align=left
valign=top><h2></h2></td><tr><td width=100%><font size=3
face=arial><p><b>".$row[2].
"</b>".
"<br>Address: $list".
"<br>Call Type: $pcond".
"<br><br>Lat: ".$row[5].
"<br>Long: ".$row[6].
"</td></table>".
"</p>&&&".$row[5]."&&&".$row[6]."&&&".$row[8]."&&&".$row[14];
$x = $x + 1;
}
?>
<input type="hidden" id="encodedString" name="encodedString"
value="<?php echo $encodedString; ?>" />
<? echo "<body oncontextmenu=\"return false\" style=\"overflow: hidden;
\" topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>";
<div id=\"map_canvas\"></div>
</body>
</html>";
?>
I can pull this information from my MySQL table and display what I need to
but I would like some help on how to refresh this data every 5 sec or so
with the current code that I have. There isn't much data to show just like
5 or 8 markers at any given time. I have included my current code that I
use to pull the data. I am sorta ok with php/MySQL but very new to Google
Maps.
Thank you for your time
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=true" /></script>
<script type='text/javascript'>
//This javascript will load when the page loads.
jQuery(document).ready( function($){
//Initialize the Google Maps
var geocoder;
var map;
var markersArray = [];
var infos = [];
geocoder = new google.maps.Geocoder();
var myOptions = {
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
//Load the Map into the map_canvas div
var map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
//Initialize a variable that the auto-size the map to whatever you
are plotting
var bounds = new google.maps.LatLngBounds();
//Initialize the encoded string
var encodedString;
//Initialize the array that will hold the contents of the split
string
var stringArray = [];
//Get the value of the encoded string from the hidden input
encodedString = document.getElementById("encodedString").value;
//Split the encoded string into an array the separates each location
stringArray = encodedString.split("****");
var x;
for (x = 0; x < stringArray.length; x = x + 1)
{
var addressDetails = [];
var marker;
//Separate each field
addressDetails = stringArray[x].split("&&&");
//Load the lat, long data
var lat = new google.maps.LatLng(addressDetails[1],
addressDetails[2]);
var image = new google.maps.MarkerImage(addressDetails[3]);
//Create a new marker and info window
var marker = new google.maps.Marker({
map: map,
icon: image,
position: lat,
content: addressDetails[0]
});
//Pushing the markers into an array so that it's easier to
manage them
markersArray.push(marker);
google.maps.event.addListener( marker, 'click', function () {
closeInfos();
var info = new google.maps.InfoWindow({content:
this.content});
//On click the map will load the info window
info.open(map,this);
infos[0]=info;
});
//Extends the boundaries of the map to include this new location
bounds.extend(lat);
}
//Takes all the lat, longs in the bounds variable and autosizes
the map
map.fitBounds(bounds);
//Manages the info windows
function closeInfos(){
if(infos.length > 0){
infos[0].set("marker",null);
infos[0].close();
infos.length = 0;
}
}
});
</script>
</head>
<body>
<div id='input'>
<?php
//Initialize your first couple variables
$encodedString = ""; //This is the string that will hold all your
location data
$x = 0; //This is a trigger to keep the string tidy
//Now we do a simple query to the database
// DB INFO CONNECTION IS HERE AND WORKS
$result = mysql_query("SELECT * FROM `ulocation` WHERE `ul_lat`!=''
AND `ul_long`!='' AND `ul_onduty`='1'",$db1);
//Multiple rows are returned
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
//This is to keep an empty first or last line from forming, when
the string is split
if ( $x == 0 )
{
$separator = "";
}
else
{
//Each row in the database is separated in the string by four
*'s
$separator = "****";
}
$status='0';
$cadd = sql::getval('cal_address', 'call', "WHERE
`cal_id`='$row[14]'");
$num = sql::getval('cal_num', 'call', "WHERE `cal_id`='$row[14]'");
$pcond = sql::getval('cal_pcond', 'call', "WHERE
`cal_id`='$row[14]'");
$list="$num $cadd";
//Saving to the String, each variable is separated by three &'s
$encodedString = $encodedString.$separator.
"<table border=0 width='350' height='20' class='maincolm'
cellpadding=0 cellspacing=0><td align=left
valign=top><h2></h2></td><tr><td width=100%><font size=3
face=arial><p><b>".$row[2].
"</b>".
"<br>Address: $list".
"<br>Call Type: $pcond".
"<br><br>Lat: ".$row[5].
"<br>Long: ".$row[6].
"</td></table>".
"</p>&&&".$row[5]."&&&".$row[6]."&&&".$row[8]."&&&".$row[14];
$x = $x + 1;
}
?>
<input type="hidden" id="encodedString" name="encodedString"
value="<?php echo $encodedString; ?>" />
<? echo "<body oncontextmenu=\"return false\" style=\"overflow: hidden;
\" topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>";
<div id=\"map_canvas\"></div>
</body>
</html>";
?>
Stop program from opening after running App
Stop program from opening after running App
I found a code to control iTunes online. Whenever I debug my project
iTunes will open at the same time. How can I stop it? please help.
// iTunes Control
private void itunescontrol()
{
app.OnPlayerPlayEvent += new
_IiTunesEvents_OnPlayerPlayEventEventHandler(delegate(object o)
{
this.Invoke(new Router(app_OnPlayerPlayEvent), o);
});
}
delegate void Router(object arg);
iTunesApp app = new iTunesApp();
I found a code to control iTunes online. Whenever I debug my project
iTunes will open at the same time. How can I stop it? please help.
// iTunes Control
private void itunescontrol()
{
app.OnPlayerPlayEvent += new
_IiTunesEvents_OnPlayerPlayEventEventHandler(delegate(object o)
{
this.Invoke(new Router(app_OnPlayerPlayEvent), o);
});
}
delegate void Router(object arg);
iTunesApp app = new iTunesApp();
Dry run - temporary repository
Dry run - temporary repository
Working on an MVC app, for process automation, using Event-Consumer
pattern with StructureMap.
Due to the critical nature of some process, we would like to "dry run"
them say 30 minutes before scheduled time.
I'm still exploring options, so please feel free to suggest if you've done
it before.
This specific question is to ask whether it's recommended to mock the
process by
Copying data from the database into a mock IRepository
Which then will be passed on to the consumers, so that all changes etc.
will be saved in the mock repository
Use the same mock repository for all consumers down the pipeline of the
process
At the end display the result of the dry-run, no production information is
altered
Many thanks
Working on an MVC app, for process automation, using Event-Consumer
pattern with StructureMap.
Due to the critical nature of some process, we would like to "dry run"
them say 30 minutes before scheduled time.
I'm still exploring options, so please feel free to suggest if you've done
it before.
This specific question is to ask whether it's recommended to mock the
process by
Copying data from the database into a mock IRepository
Which then will be passed on to the consumers, so that all changes etc.
will be saved in the mock repository
Use the same mock repository for all consumers down the pipeline of the
process
At the end display the result of the dry-run, no production information is
altered
Many thanks
trigger.('click') ill not triggering the native click event on IE8
trigger.('click') ill not triggering the native click event on IE8
i have done the following code on an hidden fiel on IE8 :
jQuery('#myfield').trigger('click')
But it's not working. On safari, i had the same problem, so i used :
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);
document.getElementById('myfield').dispatchEvent(evt);
But this code is not working too on IE8.
Do you know what i coul used on IE8?
Thanks in advance
i have done the following code on an hidden fiel on IE8 :
jQuery('#myfield').trigger('click')
But it's not working. On safari, i had the same problem, so i used :
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);
document.getElementById('myfield').dispatchEvent(evt);
But this code is not working too on IE8.
Do you know what i coul used on IE8?
Thanks in advance
Sunday, 15 September 2013
Hi friends, In this program how this line work "flag[str[i]-'a']++;" can anyone explain?
Hi friends, In this program how this line work "flag[str[i]-'a']++;" can
anyone explain?
I have doubt in this line "flag[str[i]-'a']++;" how this line work. For
full program visit
"http://www.programmingsimplified.com/c/source-code/c-anagram-program"
char str[44];
int flag[26],i=0;
gets(str);
while(str[i]!='\0')
{
flag[str[i]-'a']++; // How this line work
i++;
}
i=0;
while(str[i]!='\0')
{
printf("\n%d, %d ",str[i]-'a');
i++;
}
anyone explain?
I have doubt in this line "flag[str[i]-'a']++;" how this line work. For
full program visit
"http://www.programmingsimplified.com/c/source-code/c-anagram-program"
char str[44];
int flag[26],i=0;
gets(str);
while(str[i]!='\0')
{
flag[str[i]-'a']++; // How this line work
i++;
}
i=0;
while(str[i]!='\0')
{
printf("\n%d, %d ",str[i]-'a');
i++;
}
screen output questions of Python
screen output questions of Python
I got a question of displaying my output data. Here is my code:
coordinate = []
z=0
while z <= 10:
y = 0
while y < 10:
x = 0
while x < 10:
coordinate.append((x,y,z))
x += 1
coordinate.append((x,y,z))
y += 1
coordinate.append((x,y,z))
z += 1
for point in coordinate:
print(point)
My output data contains the comma and parenthesis which are supposed to
get rid of. I want my output looks like:0 0 0\n 1 0 0\n 2 0 0\n etc. No
comma and parenthesis, just the values.
I got a question of displaying my output data. Here is my code:
coordinate = []
z=0
while z <= 10:
y = 0
while y < 10:
x = 0
while x < 10:
coordinate.append((x,y,z))
x += 1
coordinate.append((x,y,z))
y += 1
coordinate.append((x,y,z))
z += 1
for point in coordinate:
print(point)
My output data contains the comma and parenthesis which are supposed to
get rid of. I want my output looks like:0 0 0\n 1 0 0\n 2 0 0\n etc. No
comma and parenthesis, just the values.
use g_thread_new with a struct
use g_thread_new with a struct
I want to start a struct method in an own thread:
g_thread_new( "NewThread", mymethod , NULL)
The problem is, the program only compiles if I set the method to "static":
static gpointer mymethod(gpointer nrp) { puts(this->mystring) ; ... }
But if I set the method to "static" I cannot access the struct instance
variables like this->mystring.
Is there a way to use g_thread_new with class methods AND access instance
variables?
I want to start a struct method in an own thread:
g_thread_new( "NewThread", mymethod , NULL)
The problem is, the program only compiles if I set the method to "static":
static gpointer mymethod(gpointer nrp) { puts(this->mystring) ; ... }
But if I set the method to "static" I cannot access the struct instance
variables like this->mystring.
Is there a way to use g_thread_new with class methods AND access instance
variables?
how to get list of objects involving many to many relation in django
how to get list of objects involving many to many relation in django
I have the following models:
class Committee(models.Model):
customer = models.ForeignKey(Customer, related_name="committees")
name = models.CharField(max_length=255)
members = models.ManyToManyField(member, through=CommitteeMember,
related_name="committees")
items = models.ManyToManyField(Item, related_name="committees",
blank=True)
class CommitteeRole(models.Model):
committee = models.ForeignKey('Committee')
member = models.ForeignKey(member)
#user is the members user/user number
user = models.ForeignKey(User)
role = models.IntegerField(choices=ROLES, default=0)
class Member(models.Model):
customer = models.ForeignKey(Customer, related_name='members')
name = models.CharField(max_length=255)
class Item(models.Model):
customer = models.ForeignKey(Customer, related_name="items")
name = models.CharField(max_length=255)
class Customer(models.Model):
user = models.OneToOneField(User, related_name="customer")
name = models.CharField(max_length=255)
I need to get all of the Items that belong to all of the commitees in
which a user is connected through the CommitteeRole.
Something like this:
committee_relations = CommitteeRole.objects.filter(user=request.user)
item_list = Item.objects.filter(committees=committee_relations__committee)
How can I accomplish this?
I have the following models:
class Committee(models.Model):
customer = models.ForeignKey(Customer, related_name="committees")
name = models.CharField(max_length=255)
members = models.ManyToManyField(member, through=CommitteeMember,
related_name="committees")
items = models.ManyToManyField(Item, related_name="committees",
blank=True)
class CommitteeRole(models.Model):
committee = models.ForeignKey('Committee')
member = models.ForeignKey(member)
#user is the members user/user number
user = models.ForeignKey(User)
role = models.IntegerField(choices=ROLES, default=0)
class Member(models.Model):
customer = models.ForeignKey(Customer, related_name='members')
name = models.CharField(max_length=255)
class Item(models.Model):
customer = models.ForeignKey(Customer, related_name="items")
name = models.CharField(max_length=255)
class Customer(models.Model):
user = models.OneToOneField(User, related_name="customer")
name = models.CharField(max_length=255)
I need to get all of the Items that belong to all of the commitees in
which a user is connected through the CommitteeRole.
Something like this:
committee_relations = CommitteeRole.objects.filter(user=request.user)
item_list = Item.objects.filter(committees=committee_relations__committee)
How can I accomplish this?
Retreiving values from DropDownList on Postback in asp.net
Retreiving values from DropDownList on Postback in asp.net
I have a weired problem with the DropDownList postback.
I have a DropDownList in asp.net master page, which contains some state
names like :
Text [NewYork] - Value [0]
Text [New Jersey] - Value [1]
drpTowns.DataSource = objTown.GetAllTowns();
drpTowns.DataTextField = "Name";
drpTowns.DataValueField = "Id";
drpTowns.DataBind();
In the code behind of the master page, i have a
DropDownList_SelectedIndexChanged event, where i am setting the
SelectedValue of the dropdownlist in a variable which is holding session.
like below
protected void drpTowns_SelectedIndexChanged(object sender, EventArgs e)
{
Globals.DefaultTown = Convert.ToInt32(drpTowns.SelectedValue);
}
Definition for Globals.DefaultTown is written in App_Code Globals.cs Class
like below:
private static int _defaultTown =
Convert.ToInt32(ConfigurationManager.AppSettings["DefaultTown"]);
public static int DefaultTown
{
get
{
return _defaultTown;
}
set
{
_defaultTown = value;
}
}
Now i want to retrieve the value of the Globals.DefaultTown in Content
Page (Default.aspx). I am doing that like below:
Response.Write("Default Town Is: " + Globals.DefaultTown + "<br />");
Now whenever i selects the state from the dropdownlist, the
Globals.DefaultTown does not updates immediately, like by default the
Selected State is setted for DefaultTown, but when i selects second state
from the list, it still gives the id of first state, now when i select
third state from the list, it gives the id of the second, and when i
select first state from the list, it gives the id of the third state, i.e
it does not updates the DefaultTown variable on the spot.
Can anyone tell me what would be going wrong for this
I have a weired problem with the DropDownList postback.
I have a DropDownList in asp.net master page, which contains some state
names like :
Text [NewYork] - Value [0]
Text [New Jersey] - Value [1]
drpTowns.DataSource = objTown.GetAllTowns();
drpTowns.DataTextField = "Name";
drpTowns.DataValueField = "Id";
drpTowns.DataBind();
In the code behind of the master page, i have a
DropDownList_SelectedIndexChanged event, where i am setting the
SelectedValue of the dropdownlist in a variable which is holding session.
like below
protected void drpTowns_SelectedIndexChanged(object sender, EventArgs e)
{
Globals.DefaultTown = Convert.ToInt32(drpTowns.SelectedValue);
}
Definition for Globals.DefaultTown is written in App_Code Globals.cs Class
like below:
private static int _defaultTown =
Convert.ToInt32(ConfigurationManager.AppSettings["DefaultTown"]);
public static int DefaultTown
{
get
{
return _defaultTown;
}
set
{
_defaultTown = value;
}
}
Now i want to retrieve the value of the Globals.DefaultTown in Content
Page (Default.aspx). I am doing that like below:
Response.Write("Default Town Is: " + Globals.DefaultTown + "<br />");
Now whenever i selects the state from the dropdownlist, the
Globals.DefaultTown does not updates immediately, like by default the
Selected State is setted for DefaultTown, but when i selects second state
from the list, it still gives the id of first state, now when i select
third state from the list, it gives the id of the second, and when i
select first state from the list, it gives the id of the third state, i.e
it does not updates the DefaultTown variable on the spot.
Can anyone tell me what would be going wrong for this
Intercept Android App's Downloading and Installation Process
Intercept Android App's Downloading and Installation Process
Is there any notification sent after an app is downloaded and before it is
installed? I want to create a service in android that activates on
receiving such notification. That is, my service must perform some check
before it is installed , but after it is downloaded. The below link gives
the soln for notification after installation. Get referrer after
installing app from Android Market
Is there any notification sent after an app is downloaded and before it is
installed? I want to create a service in android that activates on
receiving such notification. That is, my service must perform some check
before it is installed , but after it is downloaded. The below link gives
the soln for notification after installation. Get referrer after
installing app from Android Market
ajax post javascript varible to php in same page
ajax post javascript varible to php in same page
i write sample code to ajax post javaxcript varible to php in 2 page,
test.php and validate.php.
test.php :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="jquery.min.js" ></script>
</head>
<body>
<form>
<input type="text" id="name" placeholder="enter Your name...." /><br/>
<input type="text" id="age" placeholder="enter Your age...." /><br/>
<input type="button" value="submit" onclick="post();">
</form>
<div id="result" ></div>
<script type="text/javascript">
function post()
{
var name=$('#name').val();
var age=$('#age').val();
$.post('validate.php',{postname:name,postage:age},
function(data)
{
if (data=="1")
{
$('#result').html('you are over 18 !');
}
if (data=="0")
{
$('#result').html('you are under 18 !');
}
});
}
</script>
</body>
</html>
validate.php
<?php
$name=$_POST['postname'];
$age=$_POST['postage'];
if ($age>=18)
{
echo "1";
}
else
{
echo "0";
}
?>
how can i write/change above code in same page ?? and validate.php insert
in test.php ??
i write sample code to ajax post javaxcript varible to php in 2 page,
test.php and validate.php.
test.php :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="jquery.min.js" ></script>
</head>
<body>
<form>
<input type="text" id="name" placeholder="enter Your name...." /><br/>
<input type="text" id="age" placeholder="enter Your age...." /><br/>
<input type="button" value="submit" onclick="post();">
</form>
<div id="result" ></div>
<script type="text/javascript">
function post()
{
var name=$('#name').val();
var age=$('#age').val();
$.post('validate.php',{postname:name,postage:age},
function(data)
{
if (data=="1")
{
$('#result').html('you are over 18 !');
}
if (data=="0")
{
$('#result').html('you are under 18 !');
}
});
}
</script>
</body>
</html>
validate.php
<?php
$name=$_POST['postname'];
$age=$_POST['postage'];
if ($age>=18)
{
echo "1";
}
else
{
echo "0";
}
?>
how can i write/change above code in same page ?? and validate.php insert
in test.php ??
Saturday, 14 September 2013
In XMonad, how can I always give a certain window a specific floating position?
In XMonad, how can I always give a certain window a specific floating
position?
The title is pretty self-explanatory I think.
In XMonad, how can I always give a certain window a specific floating
position?
james@computron ~ $ xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x32dcf3b "Tabs Outliner"
Absolute upper-left X: 1280
Absolute upper-left Y: 25
Relative upper-left X: 1280
Relative upper-left Y: 25
Width: 1278
Height: 997
Depth: 24
Visual: 0x21
Visual Class: TrueColor
Border width: 1
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +1280+25 -0+25 -0-0 +1280-0
-geometry 1278x997-0-0
position?
The title is pretty self-explanatory I think.
In XMonad, how can I always give a certain window a specific floating
position?
james@computron ~ $ xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x32dcf3b "Tabs Outliner"
Absolute upper-left X: 1280
Absolute upper-left Y: 25
Relative upper-left X: 1280
Relative upper-left Y: 25
Width: 1278
Height: 997
Depth: 24
Visual: 0x21
Visual Class: TrueColor
Border width: 1
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +1280+25 -0+25 -0-0 +1280-0
-geometry 1278x997-0-0
Ruby - Why aren't they equal?
Ruby - Why aren't they equal?
I was trying to create this program (link): http://geograph.co/mastermind.txt
The place that reads puts "#{code[0]}hi#{code[0]==guess[0]}" in the
compare_code function always reads false. Does anyone know why is the
result always false?
def assign_numbers(arr)
flag = false;
while !flag
random = (rand()*8).round()
flag2 = false
arr.size.times do
|x|
if (arr[x]==random)
flag2 = true
break
end
end
if (flag2==false)
flag = true
end
end
return random
end
def compare_code(guess, code)
in_place=0
out_place=0
4.times do
|x|
guess[x-1] = guess[x-1].to_i
code[x-1]=code[x-1].to_i
end
4.times do
|x|
puts "#{code[0]}hi#{code[0]==guess[0]}"
end
if in_place == 4
puts "You won! Thanks for playing the game!"
else
puts "You got #{out_place} right numbers but in the wrong
places,\nand you got #{in_place} numbers in the right place."
end
end
code = Array.new(4)
puts "Welcome to Mastermind!"
puts "I have a code that contains four of the following eight numbers:
1,2,3,4,5,6,7,8."
4.times do
|x|
code[x-1] = assign_numbers(code)
end
i=1
flag = false
while (!flag)
print "Enter guess #{i}: "
guess = gets().chomp()
if guess.to_i>1110 && guess.to_i<8889
guess = guess.split()
flag = compare_code(guess, code)
if i!=12
i+=1
else
puts "Game Over! The code was #{code.join}"
flag=true
end
else
puts "Please try again. Please enter a four digit number."
end
end
I was trying to create this program (link): http://geograph.co/mastermind.txt
The place that reads puts "#{code[0]}hi#{code[0]==guess[0]}" in the
compare_code function always reads false. Does anyone know why is the
result always false?
def assign_numbers(arr)
flag = false;
while !flag
random = (rand()*8).round()
flag2 = false
arr.size.times do
|x|
if (arr[x]==random)
flag2 = true
break
end
end
if (flag2==false)
flag = true
end
end
return random
end
def compare_code(guess, code)
in_place=0
out_place=0
4.times do
|x|
guess[x-1] = guess[x-1].to_i
code[x-1]=code[x-1].to_i
end
4.times do
|x|
puts "#{code[0]}hi#{code[0]==guess[0]}"
end
if in_place == 4
puts "You won! Thanks for playing the game!"
else
puts "You got #{out_place} right numbers but in the wrong
places,\nand you got #{in_place} numbers in the right place."
end
end
code = Array.new(4)
puts "Welcome to Mastermind!"
puts "I have a code that contains four of the following eight numbers:
1,2,3,4,5,6,7,8."
4.times do
|x|
code[x-1] = assign_numbers(code)
end
i=1
flag = false
while (!flag)
print "Enter guess #{i}: "
guess = gets().chomp()
if guess.to_i>1110 && guess.to_i<8889
guess = guess.split()
flag = compare_code(guess, code)
if i!=12
i+=1
else
puts "Game Over! The code was #{code.join}"
flag=true
end
else
puts "Please try again. Please enter a four digit number."
end
end
Best way to detect when shipments are out-of-range - relevant to canada
Best way to detect when shipments are out-of-range - relevant to canada
I've built a simple ecommerce shopping cart. The client wants to only
allow deliveries within Toronto and certain surrounding areas (etobicoke
region, scarborough region, and north york region, but NOT thornhill
region or vaughn region).
My question is what is the proper way to detect whether deliveries are or
are not within these regions? I am using Google Maps to geocode the
shipping address, then using haversine formula to detect the linear
distance between shipping source and shipping destination, but this isn't
doesn't actually help me with detecting "regions".
In canada we have postal codes. Do I basically need to have a postal code
dictionary and do a look up? Is there a better way to do this
programmatically?
I've built a simple ecommerce shopping cart. The client wants to only
allow deliveries within Toronto and certain surrounding areas (etobicoke
region, scarborough region, and north york region, but NOT thornhill
region or vaughn region).
My question is what is the proper way to detect whether deliveries are or
are not within these regions? I am using Google Maps to geocode the
shipping address, then using haversine formula to detect the linear
distance between shipping source and shipping destination, but this isn't
doesn't actually help me with detecting "regions".
In canada we have postal codes. Do I basically need to have a postal code
dictionary and do a look up? Is there a better way to do this
programmatically?
Scala Type Parameter and Case Classes
Scala Type Parameter and Case Classes
I have a function like this:
private def fixBrand[T]( item:T ) = item.copy(brand = item.brand.toLowerCase)
This isn't compiling---complains T doesn't have function copy. Now I know
that every item I'll pass in is a case class. How can I tell the compiler?
Each of these case classes also have a 'brand' field, but are unrelated,
in terms of object hierarchy.
I thought I read that Scala 2.10 had a feature that allowed me to use T as
"a thing" that had function x, y, ...? Forgot what that feature was
called, though!
Thanks for any hints!
Greg
I have a function like this:
private def fixBrand[T]( item:T ) = item.copy(brand = item.brand.toLowerCase)
This isn't compiling---complains T doesn't have function copy. Now I know
that every item I'll pass in is a case class. How can I tell the compiler?
Each of these case classes also have a 'brand' field, but are unrelated,
in terms of object hierarchy.
I thought I read that Scala 2.10 had a feature that allowed me to use T as
"a thing" that had function x, y, ...? Forgot what that feature was
called, though!
Thanks for any hints!
Greg
PHP/MySQL Login form
PHP/MySQL Login form
i have 3 tables in a database:
customer
contacts
reseller
my url has index.php?rid=5 (rid=5 is a row from the reseller table with a
sequence of 5)
my customer table has a resellerid column so there are many rows there
with a resellerid of 5
my contacts table has a company_sequence column that links to the sequence
column of the customer table.
the contacts table has an email and password column
im trying to make a login form for rows form the contacts table to login
using the email and password.
ive tried this code:
$sql="SELECT * from customer where resellerid = '".$ResellerID."' ";
$rs=mysql_query($sql,$conn);
while($result=mysql_fetch_array($rs))
{
$sql2="select * from contacts where company_sequence =
'".$result["sequence"]."' and email='".$email."' and
password='".md5($password)."'";
$rs2=mysql_query($sql2,$conn);
$result2=mysql_fetch_array($rs2);
but when i run if(mysql_num_rows($rs2) > 0) it will only check the last
row even if there is a valid row in the contacts table.
how can i get this working?
i have 3 tables in a database:
customer
contacts
reseller
my url has index.php?rid=5 (rid=5 is a row from the reseller table with a
sequence of 5)
my customer table has a resellerid column so there are many rows there
with a resellerid of 5
my contacts table has a company_sequence column that links to the sequence
column of the customer table.
the contacts table has an email and password column
im trying to make a login form for rows form the contacts table to login
using the email and password.
ive tried this code:
$sql="SELECT * from customer where resellerid = '".$ResellerID."' ";
$rs=mysql_query($sql,$conn);
while($result=mysql_fetch_array($rs))
{
$sql2="select * from contacts where company_sequence =
'".$result["sequence"]."' and email='".$email."' and
password='".md5($password)."'";
$rs2=mysql_query($sql2,$conn);
$result2=mysql_fetch_array($rs2);
but when i run if(mysql_num_rows($rs2) > 0) it will only check the last
row even if there is a valid row in the contacts table.
how can i get this working?
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING while using intval
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING while using intval
Hello im using php and getting this error on my code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING
The error was pointing on this line of code:
$dislikesNew = $dislikes + intval($_POST['dislikes']);
The whole code:
$stmt = $mysqli->prepare($sql) or trigger_error($mysqli->error."[$sql]");
$stmt->bind_param('s', $id);
$id = $_POST['id'];
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($likes, $dislikes);
` $stmt->fetch();
$dislikesNew = $dislikes + intval($_POST['dislikes']);
$likesNew = $likes + intval($_POST['likes']);
I google my error code but i couldnt find anything the helped me.
Thank for helping.
T_STRING or T_VARIABLE or T_NUM_STRING while using intval
Hello im using php and getting this error on my code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING
The error was pointing on this line of code:
$dislikesNew = $dislikes + intval($_POST['dislikes']);
The whole code:
$stmt = $mysqli->prepare($sql) or trigger_error($mysqli->error."[$sql]");
$stmt->bind_param('s', $id);
$id = $_POST['id'];
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($likes, $dislikes);
` $stmt->fetch();
$dislikesNew = $dislikes + intval($_POST['dislikes']);
$likesNew = $likes + intval($_POST['likes']);
I google my error code but i couldnt find anything the helped me.
Thank for helping.
How to drag element in specific location using jquery?
How to drag element in specific location using jquery?
jquery code
$("#products li").draggable({
appendTo: "body",
helper: "clone"
});
$(".shoppingCart ol").droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
drop: function(event, ui) {
var self = $(this);
self.find(".placeholder").remove();
var productid = ui.draggable.attr("data-id");
if (self.find("[data-id=" + productid + "]").length) return;
$("<li></li>", {
"text": ui.draggable.text(),
"data-id": productid
}).appendTo(this);
// To remove item from other shopping chart do this
var cartid = self.closest('.shoppingCart').attr('id');
$(".shoppingCart:not(#"+cartid+") [data-id="+productid+"]").remove();
}
}).sortable({
items: "li:not(.placeholder)",
sort: function() {
$(this).removeClass("ui-state-default");
}
});
and this is html code
<div id="products">
<h1 class="ui-widget-header">Blocks</h1>
<div class="ui-widget-content">
<ul>
<li data-id="1"> 10000$ </li>
<li data-id="2"> -10000$ </li>
<li data-id="3"> 10000$ </li>
<li data-id="4"> -10000$ </li>
<li data-id="5"> Bank </li>
<li data-id="6"> Loan </li>
</ul>
</div>
</div>
<div id="shoppingCart1" class="shoppingCart">
<h1 class="ui-widget-header">Cresit Side</h1>
<div class="ui-widget-content">
<ol>
<li class="placeholder">Add your items here</li>
</ol>
</div>
</div>
<div id="shoppingCart2" class="shoppingCart">
<h1 class="ui-widget-header">Debit side</h1>
<div class="ui-widget-content">
<ol>
<li class="placeholder">Add your items here</li>
</ol>
</div>
</div>
Now i want to know how can i drop any element in specific container like
in credit side and debit side.
my demo is here http://jsfiddle.net/Sanjayrathod/S4QgX/541/
now i want to drag and drop first three element is in credit side only and
remaining elements in debit side.
So how can i do this. Please help.
jquery code
$("#products li").draggable({
appendTo: "body",
helper: "clone"
});
$(".shoppingCart ol").droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
drop: function(event, ui) {
var self = $(this);
self.find(".placeholder").remove();
var productid = ui.draggable.attr("data-id");
if (self.find("[data-id=" + productid + "]").length) return;
$("<li></li>", {
"text": ui.draggable.text(),
"data-id": productid
}).appendTo(this);
// To remove item from other shopping chart do this
var cartid = self.closest('.shoppingCart').attr('id');
$(".shoppingCart:not(#"+cartid+") [data-id="+productid+"]").remove();
}
}).sortable({
items: "li:not(.placeholder)",
sort: function() {
$(this).removeClass("ui-state-default");
}
});
and this is html code
<div id="products">
<h1 class="ui-widget-header">Blocks</h1>
<div class="ui-widget-content">
<ul>
<li data-id="1"> 10000$ </li>
<li data-id="2"> -10000$ </li>
<li data-id="3"> 10000$ </li>
<li data-id="4"> -10000$ </li>
<li data-id="5"> Bank </li>
<li data-id="6"> Loan </li>
</ul>
</div>
</div>
<div id="shoppingCart1" class="shoppingCart">
<h1 class="ui-widget-header">Cresit Side</h1>
<div class="ui-widget-content">
<ol>
<li class="placeholder">Add your items here</li>
</ol>
</div>
</div>
<div id="shoppingCart2" class="shoppingCart">
<h1 class="ui-widget-header">Debit side</h1>
<div class="ui-widget-content">
<ol>
<li class="placeholder">Add your items here</li>
</ol>
</div>
</div>
Now i want to know how can i drop any element in specific container like
in credit side and debit side.
my demo is here http://jsfiddle.net/Sanjayrathod/S4QgX/541/
now i want to drag and drop first three element is in credit side only and
remaining elements in debit side.
So how can i do this. Please help.
unable to select one radio button at a time
unable to select one radio button at a time
I am unable to select one radio button at a time. Multiple buttons are
getting selected. I am newbie to html. This is my code. Please help.
<form name="ans_a" onsubmit="return answer_a()">
<table align="center" border="1">
<br>
<br>
<tr>
<td width="500px"> ABC
<br>
<input type="radio" name="A" value="a" id="radio1"> A   Option A <br>
<input type="radio" name="B" value="b" id="radio2"> B   Option B <br>
<input type="radio" name="C" value="c" id="radio3"> C   Option C <br>
<input type="radio" name="D" value="d" id="radio4"> D   Option D <br>
<br>
                 
<input type="button" name="ans1" value="Next" onclick="answer_a()">
</td>
</tr>
</table>
</form>
I am unable to select one radio button at a time. Multiple buttons are
getting selected. I am newbie to html. This is my code. Please help.
<form name="ans_a" onsubmit="return answer_a()">
<table align="center" border="1">
<br>
<br>
<tr>
<td width="500px"> ABC
<br>
<input type="radio" name="A" value="a" id="radio1"> A   Option A <br>
<input type="radio" name="B" value="b" id="radio2"> B   Option B <br>
<input type="radio" name="C" value="c" id="radio3"> C   Option C <br>
<input type="radio" name="D" value="d" id="radio4"> D   Option D <br>
<br>
                 
<input type="button" name="ans1" value="Next" onclick="answer_a()">
</td>
</tr>
</table>
</form>
Friday, 13 September 2013
What I am looking at? Duplicate symbols?
What I am looking at? Duplicate symbols?
I have these messages on Xcode
duplicate symbol _OBJC_IVAR_$_Cars._color in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._brand in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._place in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._state in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_CLASS_$_Cars in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_METACLASS_$_Cars in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
ld: 6 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
The duplicate symbols it mentions are not duplicate. These are four
properties declared in my Cars class like this:
@property (nonatomic, copy) void (^color)();
@property (nonatomic, copy) void (^brand)(Cars *oneCar, NSSet *touches);
@property (nonatomic, strong) NSString *place;
@property (nonatomic, assign) NSString *state;
How do I discover the problem. Can Xcode give more detailed messages? Thanks
I have these messages on Xcode
duplicate symbol _OBJC_IVAR_$_Cars._color in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._brand in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._place in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._state in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_CLASS_$_Cars in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_METACLASS_$_Cars in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
ld: 6 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
The duplicate symbols it mentions are not duplicate. These are four
properties declared in my Cars class like this:
@property (nonatomic, copy) void (^color)();
@property (nonatomic, copy) void (^brand)(Cars *oneCar, NSSet *touches);
@property (nonatomic, strong) NSString *place;
@property (nonatomic, assign) NSString *state;
How do I discover the problem. Can Xcode give more detailed messages? Thanks
C++ overloading assignment operator change base class type to child
C++ overloading assignment operator change base class type to child
I'm coming from java so please bare with me. I've read several other
articles and can't seem to find an answer.
I've got a base class (Obj) header file shown below.
class Obj {
public:
Obj();
Obj(int);
int testInt;
bool worked();
virtual Obj & operator = (const Obj & other) {
if(this != &other) {
//other.testInt = this->testInt;
return *this;
}
}
};
Base class
Obj::Obj() {
}
Obj::Obj(int test) {
this->testInt = test;
}
bool Obj::worked() {
return false;
}
Here's the child class header
class Obj1 : public Obj {
public:
Obj1();
Obj1(int);
bool worked();
};
Child class
#include "Obj1.h"
Obj1::Obj1() {
}
Obj1::Obj1(int a) {
this->testInt = a / 2;
}
bool Obj1::worked() {
return true;
}
Here's my main class
int main() {
Obj obj = Obj(99);
Obj1 obj1 = Obj1(45);
obj = obj1;
if(obj.worked())
cout << "good" << obj.testInt << endl;
else cout << "bad " << obj.testInt << endl;
if(obj1.worked()) {
cout << "1good " << obj1.testInt << endl;
} else
cout << "1bad " << obj1.testInt << endl;
return 0;
}
Here's the output when it's ran
bad 99
1good 22
How do I get it so obj = obj1; (found in main above) changes the type of
obj to obj1 so that obj.worked() will return true? Essentially how do I
get it to behave like it would in java? I don't need a deep copy, I just
want to toss out what obj used to reference and have it point to obj1 (I
think thats how it works in java).
I'm coming from java so please bare with me. I've read several other
articles and can't seem to find an answer.
I've got a base class (Obj) header file shown below.
class Obj {
public:
Obj();
Obj(int);
int testInt;
bool worked();
virtual Obj & operator = (const Obj & other) {
if(this != &other) {
//other.testInt = this->testInt;
return *this;
}
}
};
Base class
Obj::Obj() {
}
Obj::Obj(int test) {
this->testInt = test;
}
bool Obj::worked() {
return false;
}
Here's the child class header
class Obj1 : public Obj {
public:
Obj1();
Obj1(int);
bool worked();
};
Child class
#include "Obj1.h"
Obj1::Obj1() {
}
Obj1::Obj1(int a) {
this->testInt = a / 2;
}
bool Obj1::worked() {
return true;
}
Here's my main class
int main() {
Obj obj = Obj(99);
Obj1 obj1 = Obj1(45);
obj = obj1;
if(obj.worked())
cout << "good" << obj.testInt << endl;
else cout << "bad " << obj.testInt << endl;
if(obj1.worked()) {
cout << "1good " << obj1.testInt << endl;
} else
cout << "1bad " << obj1.testInt << endl;
return 0;
}
Here's the output when it's ran
bad 99
1good 22
How do I get it so obj = obj1; (found in main above) changes the type of
obj to obj1 so that obj.worked() will return true? Essentially how do I
get it to behave like it would in java? I don't need a deep copy, I just
want to toss out what obj used to reference and have it point to obj1 (I
think thats how it works in java).
how to associate a resource to an other using Jena API
how to associate a resource to an other using Jena API
i have created an ontology containing tow classes, the first one is named
"father" and the second is it's subclass named "son".I would like to set
the following conditions to the class father using jena API: Has only son.
Has some son. then i would do the same for class "son": has exactly some
father.
My second issue is that i don't know how to associate the instance of
class "son" to the class "father" using also Jena API.I know it's possible
to manipulate my classes using "protegé" but i want to explore Jena API
instead.
As i'm a beginner, i would be thankful for any help or suggestions :)
i have created an ontology containing tow classes, the first one is named
"father" and the second is it's subclass named "son".I would like to set
the following conditions to the class father using jena API: Has only son.
Has some son. then i would do the same for class "son": has exactly some
father.
My second issue is that i don't know how to associate the instance of
class "son" to the class "father" using also Jena API.I know it's possible
to manipulate my classes using "protegé" but i want to explore Jena API
instead.
As i'm a beginner, i would be thankful for any help or suggestions :)
WPF Indent Multiple Groupings in DataGrid
WPF Indent Multiple Groupings in DataGrid
I have a DataGrid with multiple groupings embedded within each other. I
want to do 2 things:
Indent each embedded grouping
Have an expander for the initial grouping, but not for any embedded ones
Is this possible with wpf?
I have a DataGrid with multiple groupings embedded within each other. I
want to do 2 things:
Indent each embedded grouping
Have an expander for the initial grouping, but not for any embedded ones
Is this possible with wpf?
Responsive web design - How to implement JavaScript part?
Responsive web design - How to implement JavaScript part?
I'm preparing to make the web page responsive from a old existing complex
one. https://www.lendingclub.com/browse/browse.action
I use media query for the CSS part, making different CSS work for
different width of the browser. I want to ask that:
How do you deal with the JavaScript in your project, if some functions
only exist in the mobile version (and narrow width browser on PC)?
How to implement that? Do you also get the current window width, if it's
less than 720px then execute it, or something else?
We use YUI in old PC pages, do not include any mobile framework.
I'm preparing to make the web page responsive from a old existing complex
one. https://www.lendingclub.com/browse/browse.action
I use media query for the CSS part, making different CSS work for
different width of the browser. I want to ask that:
How do you deal with the JavaScript in your project, if some functions
only exist in the mobile version (and narrow width browser on PC)?
How to implement that? Do you also get the current window width, if it's
less than 720px then execute it, or something else?
We use YUI in old PC pages, do not include any mobile framework.
Thursday, 12 September 2013
unable to parse json data and keep it in grid using dojo
unable to parse json data and keep it in grid using dojo
got the json object data from servlet as....this
{"persondetails":[{"salary":"20000","sname":"XXX","sno":"1"},{"salary":"50000","sname":"yyy","sno":"2"},{"salary":"20300","sname":"bbb","sno":"3"},{"salary":"20100","sname":"chan","sno":"4"},{"salary":"40100","sname":"lorn","sno":"5"},{"salary":"10100","sname":"san","sno":"6"},{"salary":"60100","sname":"sun","sno":"7"},{"salary":"20200","sname":"chan","sno":"8"},{"salary":"10200","sname":"san","sno":"9"},{"salary":"40200","sname":"lorn","sno":"10"}]}
now i hav to put this in datagrid using dojo......i tried gettin a blanc
page plzzzz check this and sugggest me where i went wrong
my code
require(["dojo/request/xhr","dojo/dom", "dojo/dom-construct", "dojo/json",
"dojo/on","dojo/store/Memory", "dojox/grid/DataGrid", "dojo/domReady!"],
function(xhr,dom, domConst, JSON, on,Memory,DataGrid){
xhr("myaddressserver/GridExample/login", { handleAs : "json"
}).then(function(data){
//domConst.place("<p>response: <code>" + JSON.stringify(data) +
"</code></p>", "output");
}, function(err){
alert("error page");
}, function(evt){
});
var grid = new DataGrid({ id: 'grid', store: store, structure: layout,
rowSelector: '20px'
});
grid.placeAt("gridDiv");
grid.startup();
});
got the json object data from servlet as....this
{"persondetails":[{"salary":"20000","sname":"XXX","sno":"1"},{"salary":"50000","sname":"yyy","sno":"2"},{"salary":"20300","sname":"bbb","sno":"3"},{"salary":"20100","sname":"chan","sno":"4"},{"salary":"40100","sname":"lorn","sno":"5"},{"salary":"10100","sname":"san","sno":"6"},{"salary":"60100","sname":"sun","sno":"7"},{"salary":"20200","sname":"chan","sno":"8"},{"salary":"10200","sname":"san","sno":"9"},{"salary":"40200","sname":"lorn","sno":"10"}]}
now i hav to put this in datagrid using dojo......i tried gettin a blanc
page plzzzz check this and sugggest me where i went wrong
my code
require(["dojo/request/xhr","dojo/dom", "dojo/dom-construct", "dojo/json",
"dojo/on","dojo/store/Memory", "dojox/grid/DataGrid", "dojo/domReady!"],
function(xhr,dom, domConst, JSON, on,Memory,DataGrid){
xhr("myaddressserver/GridExample/login", { handleAs : "json"
}).then(function(data){
//domConst.place("<p>response: <code>" + JSON.stringify(data) +
"</code></p>", "output");
}, function(err){
alert("error page");
}, function(evt){
});
var grid = new DataGrid({ id: 'grid', store: store, structure: layout,
rowSelector: '20px'
});
grid.placeAt("gridDiv");
grid.startup();
});
How to use same instance name with multiple classes
How to use same instance name with multiple classes
I'm new to c# and I think I want to do this but maybe I don't and don't
know it!
I have a class called SyncJob. I want to be able to create an instance to
backup files from My Documents (just an example). Then I'd like to create
another instance of SyncJob to backup files in another folder. So, in
other words, I could have multiple instances of the same class in memory.
I'm declaring the object var first in my code so it is accessible to all
the methods below it.
My question is: while using the same instance name will create a new
instance in memory for the object, how can I manage these objects?
Meaning, if I want to set one of the properties how do I tell the compiler
which instance to apply the change to?
As I said in the beginning, maybe this is the wrong scheme for managing
multiple instances of the same class...maybe there is a better way.
Here is my prototype code:
Form1.cs
namespace Class_Demo
{
public partial class Form1 : Form
{
BMI patient; // public declarition
public Form1()
{
InitializeComponent();
}
private void btnCreateInstance1_Click(object sender, EventArgs e)
{
patient = new BMI("Instance 1 Created", 11); // call
overloaded with 2 arguments
displayInstanceName(patient);
}
private void displayInstanceName(BMI patient)
{
MessageBox.Show("Instance:"+patient.getName()+"\nwith
Age:"+patient.getAge());
}
private void btnCreateInstance2_Click(object sender, EventArgs e)
{
patient = new BMI("Instance 2 Created", 22); // call
overloaded with 2 arguments
displayInstanceName(patient);
}
private void btnSetNameToJohn_Click(object sender, EventArgs e)
{
// this is the issue: which instance is being set and how can
I control that?
// which instance of patient is being set?
patient.setName("John");
}
private void btnDisplayNameJohn_Click(object sender, EventArgs e)
{
// this is another issue: which instance is being displayed
and how can I control that?
// which instance of patient is being displayed?
displayInstanceName(patient);
}
}
}
Class file: namespace Class_Demo { class BMI { // Member variables public
string _newName { get; set; } public int _newAge { get; set; }
// Default Constructor
public BMI() // default constructor name must be same as class
name -- no void
{
_newName = "";
_newAge = 0;
}
// Overload constructor
public BMI(string name, int age)
{
_newName = name;
_newAge = age;
}
//Accessor methods/functions
public string getName()
{
return _newName;
}
public int getAge()
{
return _newAge;
}
public void setName(string name)
{
_newName = name;
}
}
}
I'm new to c# and I think I want to do this but maybe I don't and don't
know it!
I have a class called SyncJob. I want to be able to create an instance to
backup files from My Documents (just an example). Then I'd like to create
another instance of SyncJob to backup files in another folder. So, in
other words, I could have multiple instances of the same class in memory.
I'm declaring the object var first in my code so it is accessible to all
the methods below it.
My question is: while using the same instance name will create a new
instance in memory for the object, how can I manage these objects?
Meaning, if I want to set one of the properties how do I tell the compiler
which instance to apply the change to?
As I said in the beginning, maybe this is the wrong scheme for managing
multiple instances of the same class...maybe there is a better way.
Here is my prototype code:
Form1.cs
namespace Class_Demo
{
public partial class Form1 : Form
{
BMI patient; // public declarition
public Form1()
{
InitializeComponent();
}
private void btnCreateInstance1_Click(object sender, EventArgs e)
{
patient = new BMI("Instance 1 Created", 11); // call
overloaded with 2 arguments
displayInstanceName(patient);
}
private void displayInstanceName(BMI patient)
{
MessageBox.Show("Instance:"+patient.getName()+"\nwith
Age:"+patient.getAge());
}
private void btnCreateInstance2_Click(object sender, EventArgs e)
{
patient = new BMI("Instance 2 Created", 22); // call
overloaded with 2 arguments
displayInstanceName(patient);
}
private void btnSetNameToJohn_Click(object sender, EventArgs e)
{
// this is the issue: which instance is being set and how can
I control that?
// which instance of patient is being set?
patient.setName("John");
}
private void btnDisplayNameJohn_Click(object sender, EventArgs e)
{
// this is another issue: which instance is being displayed
and how can I control that?
// which instance of patient is being displayed?
displayInstanceName(patient);
}
}
}
Class file: namespace Class_Demo { class BMI { // Member variables public
string _newName { get; set; } public int _newAge { get; set; }
// Default Constructor
public BMI() // default constructor name must be same as class
name -- no void
{
_newName = "";
_newAge = 0;
}
// Overload constructor
public BMI(string name, int age)
{
_newName = name;
_newAge = age;
}
//Accessor methods/functions
public string getName()
{
return _newName;
}
public int getAge()
{
return _newAge;
}
public void setName(string name)
{
_newName = name;
}
}
}
How does the onDraw(Canvas) function of the View class work?
How does the onDraw(Canvas) function of the View class work?
I need to implement an interactive graph in Android
For a start I am trying to see how this code works
There, in a class called LineChartView Which extends the user generated
class ChartView which extends the View class, there is an @overrideed
function called onDraw(Canvas canvas). How and when does this function get
called? the output of that code is a bunch of graphs on full screen, but
my interactive graph should only take up a part of the screen. Does the
onDraw() function get called automatically? If so, when? And what is the
size of the canvas? Is it always the full screen occupied by the current
activity's window?
I need to implement an interactive graph in Android
For a start I am trying to see how this code works
There, in a class called LineChartView Which extends the user generated
class ChartView which extends the View class, there is an @overrideed
function called onDraw(Canvas canvas). How and when does this function get
called? the output of that code is a bunch of graphs on full screen, but
my interactive graph should only take up a part of the screen. Does the
onDraw() function get called automatically? If so, when? And what is the
size of the canvas? Is it always the full screen occupied by the current
activity's window?
ASP.NET REST service without escape characters in JSON results
ASP.NET REST service without escape characters in JSON results
I'm calling a REST service searchFavoriteCompany that in turn calls
another service A. Service A already returns JSON. But since my return
type of searchFavoriteCompany my search results are then returned with
escape characters:
"{\"responseHeader\":{\"status\":0,\"QTime\":2,\"params\":{\"facet\":\"false\",\"fl\":\"id,title,friendlyurl,avatar,locpath,objectid,objecttype\",\"indent\":\"off\",\"start\":\"0\",\"q\":\"title_search:*castle*\",\"wt\":\"json\",\"fq\":\"userid:\\\"C325D42C-A777-4275-BDD2-D7810A8AB9AB\\\"\",\"rows\":\"10\",\"defType\":\"lucene\"}},\"response\":{\"numFound\":2,\"start\":0,\"docs\":[{\"title\":\"Castle
A\",\"objecttype\":1,\"friendlyurl\":\"castle-a\",\"avatar\":\"6_887_castle-a.JPG\",\"objectid\":6},{\"title\":\"Castle
B\",\"objecttype\":1,\"friendlyurl\":\"castle-b\",\"avatar\":\"794_360_13j-Castle-by-night.jpg\",\"objectid\":794}]}}\u000a"
I don't know how to make sure my JSON results are returned without these
escape characters.
Imyservice.vb
Namespace RestService
<ServiceContract()>
Public Interface Imyservice
<OperationContract()> _
_ Function searchFavoriteCompany(ByVal q As String, ByVal uuid As String)
As String
End Interface
End Namespace
iservice.svc.vb
Namespace RestService
Public Class iservice
Implements Imyservice
Public Function searchFavoriteCompany(ByVal q As String, ByVal uuid As
String) As String Implements Imyservice.searchFavoriteCompany
Dim req As HttpWebRequest =
HttpWebRequest.Create("http://localhost/getjson") <---- this
service already returns JSON data
Dim Resp As HttpWebResponse = req.GetResponse()
Dim reader As StreamReader = New StreamReader(Resp.GetResponseStream)
Dim responseString As String = reader.ReadToEnd()
Return responseString
End Function
End Class
End Namespace
I'm calling a REST service searchFavoriteCompany that in turn calls
another service A. Service A already returns JSON. But since my return
type of searchFavoriteCompany my search results are then returned with
escape characters:
"{\"responseHeader\":{\"status\":0,\"QTime\":2,\"params\":{\"facet\":\"false\",\"fl\":\"id,title,friendlyurl,avatar,locpath,objectid,objecttype\",\"indent\":\"off\",\"start\":\"0\",\"q\":\"title_search:*castle*\",\"wt\":\"json\",\"fq\":\"userid:\\\"C325D42C-A777-4275-BDD2-D7810A8AB9AB\\\"\",\"rows\":\"10\",\"defType\":\"lucene\"}},\"response\":{\"numFound\":2,\"start\":0,\"docs\":[{\"title\":\"Castle
A\",\"objecttype\":1,\"friendlyurl\":\"castle-a\",\"avatar\":\"6_887_castle-a.JPG\",\"objectid\":6},{\"title\":\"Castle
B\",\"objecttype\":1,\"friendlyurl\":\"castle-b\",\"avatar\":\"794_360_13j-Castle-by-night.jpg\",\"objectid\":794}]}}\u000a"
I don't know how to make sure my JSON results are returned without these
escape characters.
Imyservice.vb
Namespace RestService
<ServiceContract()>
Public Interface Imyservice
<OperationContract()> _
_ Function searchFavoriteCompany(ByVal q As String, ByVal uuid As String)
As String
End Interface
End Namespace
iservice.svc.vb
Namespace RestService
Public Class iservice
Implements Imyservice
Public Function searchFavoriteCompany(ByVal q As String, ByVal uuid As
String) As String Implements Imyservice.searchFavoriteCompany
Dim req As HttpWebRequest =
HttpWebRequest.Create("http://localhost/getjson") <---- this
service already returns JSON data
Dim Resp As HttpWebResponse = req.GetResponse()
Dim reader As StreamReader = New StreamReader(Resp.GetResponseStream)
Dim responseString As String = reader.ReadToEnd()
Return responseString
End Function
End Class
End Namespace
Keep UI updated while script is running
Keep UI updated while script is running
I'm using a google map via Google's maps api v3. I need to add an overlay
for each menu-item. Everytime, the item is clicked, a new overlay/heatmap
is loaded. This works, but the loading of the markers/heatmap-points
freezes the UI.
Is there any positility to prevent this like updating in a
background-thread? I know that JavaScript doesn't really support
threading, but do you know some hacks?
I'm using a google map via Google's maps api v3. I need to add an overlay
for each menu-item. Everytime, the item is clicked, a new overlay/heatmap
is loaded. This works, but the loading of the markers/heatmap-points
freezes the UI.
Is there any positility to prevent this like updating in a
background-thread? I know that JavaScript doesn't really support
threading, but do you know some hacks?
TextBlock1 is not declared. It may be inaccessible due to its protection level
TextBlock1 is not declared. It may be inaccessible due to its protection
level
As silly as this sounds im a little stomped at this one. Heres my XAML in
a Win Phone 8 App:
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource
PhoneTextNormalStyle}"/>
<TextBlock Text="Page" Margin="9,-7,0,0" Style="{StaticResource
PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:LongListSelector x:Name="MainLongListSelector"
Margin="0,0,-12,0" ItemsSource="{Binding Items}"
SelectionChanged="MainLongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock x:Name="TextBlock1"
HorizontalAlignment="Left" TextWrapping="Wrap"
VerticalAlignment="Top"/>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</Grid>
Ive searched around but i dont know why i cant write code against the
TextBlock1 control in code behind. When i type TextBlock1.Text= .... i get
the error TextBlock1 is not declared. It may be inaccessible due to its
protection level. but i cant see how its private?
All im trying to do is add a textblock assign some content to it and then
that selected value is then passed across another page to perform relevant
action.
In addition as soon as i remove it outside of the PhoneListSelector i can
access it!!
level
As silly as this sounds im a little stomped at this one. Heres my XAML in
a Win Phone 8 App:
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource
PhoneTextNormalStyle}"/>
<TextBlock Text="Page" Margin="9,-7,0,0" Style="{StaticResource
PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:LongListSelector x:Name="MainLongListSelector"
Margin="0,0,-12,0" ItemsSource="{Binding Items}"
SelectionChanged="MainLongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17">
<TextBlock x:Name="TextBlock1"
HorizontalAlignment="Left" TextWrapping="Wrap"
VerticalAlignment="Top"/>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</Grid>
Ive searched around but i dont know why i cant write code against the
TextBlock1 control in code behind. When i type TextBlock1.Text= .... i get
the error TextBlock1 is not declared. It may be inaccessible due to its
protection level. but i cant see how its private?
All im trying to do is add a textblock assign some content to it and then
that selected value is then passed across another page to perform relevant
action.
In addition as soon as i remove it outside of the PhoneListSelector i can
access it!!
d3: need different behaviour on click depending on node's class attribute
d3: need different behaviour on click depending on node's class attribute
I have a feeling this is a pretty basic misunderstanding on my part.
I'm working from this tree visualisation: http://bl.ocks.org/mbostock/4339083
The original version has the nodes opening and collapsing when the user
clicks on a node that has children. I want to make it so that clicking on
a node that has no children has some other effect (specifically, I want it
to open an image in another window).
So, here's where the on click function is assigned:
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.attr("class", function(n) {
if (n.children) {
return "inner node"
} else {
return "leaf node"
}
})
.attr("transform", function(d) { return "translate(" + source.y0 + ","
+ source.x0 + ")"; })
.on("click", click);
I have added the second class assignment to differentiate between nodes
with and without children.
This is my modified click function:
function click(d) {
if (d.attr("class") == "inner node") {
if (d.children) {
d._children = d.children;
d.children = null;
} else {
d.children = d._children;
d._children = null;
}
} else if (d.attr("class") == "leaf node") {
// open image
}
update(d);
}
I added the outer if statement to differentiate between the two kinds of
node.
So, currently nothing works when I click. I assume that my
'd.attr("class") == "inner node"' is turning up false, either because the
assignment of that class attribute didn't work, or because what I've
written is gibberish. It doesn't work when I change it to "node" either,
though.
It also occurred to me that the assignment might be scuppered by the fact
that all the nodes start off collapsed - so "n.children" might return
false, even if there are children. Does collapsing the children affect
this?
Any help much appreciated.
------------------------------** EDIT **------------------------------
From playing around a bit, I think I've ascertained that I should have
used "d.class", rather than "d.attr('class')". However, this still doesn't
make it work. I assume that I have misunderstood what d represents here -
is that right?
I have a feeling this is a pretty basic misunderstanding on my part.
I'm working from this tree visualisation: http://bl.ocks.org/mbostock/4339083
The original version has the nodes opening and collapsing when the user
clicks on a node that has children. I want to make it so that clicking on
a node that has no children has some other effect (specifically, I want it
to open an image in another window).
So, here's where the on click function is assigned:
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.attr("class", function(n) {
if (n.children) {
return "inner node"
} else {
return "leaf node"
}
})
.attr("transform", function(d) { return "translate(" + source.y0 + ","
+ source.x0 + ")"; })
.on("click", click);
I have added the second class assignment to differentiate between nodes
with and without children.
This is my modified click function:
function click(d) {
if (d.attr("class") == "inner node") {
if (d.children) {
d._children = d.children;
d.children = null;
} else {
d.children = d._children;
d._children = null;
}
} else if (d.attr("class") == "leaf node") {
// open image
}
update(d);
}
I added the outer if statement to differentiate between the two kinds of
node.
So, currently nothing works when I click. I assume that my
'd.attr("class") == "inner node"' is turning up false, either because the
assignment of that class attribute didn't work, or because what I've
written is gibberish. It doesn't work when I change it to "node" either,
though.
It also occurred to me that the assignment might be scuppered by the fact
that all the nodes start off collapsed - so "n.children" might return
false, even if there are children. Does collapsing the children affect
this?
Any help much appreciated.
------------------------------** EDIT **------------------------------
From playing around a bit, I think I've ascertained that I should have
used "d.class", rather than "d.attr('class')". However, this still doesn't
make it work. I assume that I have misunderstood what d represents here -
is that right?
C# Named Pipes, how to detect a client disconnecting
C# Named Pipes, how to detect a client disconnecting
my current named pipe implementation reads like this:
while (true)
{
byte[] data = new byte[256];
int amount = pipe.Read(data, 0, data.Length);
if (amount <= 0)
{
// i was expecting it to go here when a client
disconnects but it doesnt
break;
}
// do relevant stuff with the data
}
how can I correctly detect when a client disconnects?
my current named pipe implementation reads like this:
while (true)
{
byte[] data = new byte[256];
int amount = pipe.Read(data, 0, data.Length);
if (amount <= 0)
{
// i was expecting it to go here when a client
disconnects but it doesnt
break;
}
// do relevant stuff with the data
}
how can I correctly detect when a client disconnects?
Wednesday, 11 September 2013
Set style for Checkbutton or Labelframe in python tkinter
Set style for Checkbutton or Labelframe in python tkinter
I have designed a GUI using python tkinter. And now I want to set style
for Checkbutton and Labelframe, such as the font, the color .etc I have
read some answers on the topics of tkinter style, and I have used the
following method to set style for both Checkbutton and Labelframe. But
they don't actually work.
Root = tkinter.Tk()
ttk.Style().configure('Font.TLabelframe', font="15", foreground = "red")
LabelFrame = ttk.Labelframe(Root, text = "Test", style = "Font.TLabelframe")
LabelFrame .pack( anchor = "w", ipadx = 10, ipady = 5, padx = 10, pady =
0, side = "top")
Can you tell me the reasons, or do you have some other valid methods?
Thank you very much!
I have designed a GUI using python tkinter. And now I want to set style
for Checkbutton and Labelframe, such as the font, the color .etc I have
read some answers on the topics of tkinter style, and I have used the
following method to set style for both Checkbutton and Labelframe. But
they don't actually work.
Root = tkinter.Tk()
ttk.Style().configure('Font.TLabelframe', font="15", foreground = "red")
LabelFrame = ttk.Labelframe(Root, text = "Test", style = "Font.TLabelframe")
LabelFrame .pack( anchor = "w", ipadx = 10, ipady = 5, padx = 10, pady =
0, side = "top")
Can you tell me the reasons, or do you have some other valid methods?
Thank you very much!
Creating a complex UID thats not a GUID/UUID in the normal sense
Creating a complex UID thats not a GUID/UUID in the normal sense
I am looking for suggestions to create a incremented ID (much like a
license plate number). Instead of the usual 0-9 int32 type counter I am
looking for something can go 0-9 then A-Z for each character in the
sequence.
So I would have the potential to have a 6 char ID that would be '2A3DC3'
This has the potential to give a much greater depth to the available
values.
I am looking for suggestions to create a incremented ID (much like a
license plate number). Instead of the usual 0-9 int32 type counter I am
looking for something can go 0-9 then A-Z for each character in the
sequence.
So I would have the potential to have a 6 char ID that would be '2A3DC3'
This has the potential to give a much greater depth to the available
values.
AngularJS .bootstrap() and Modules
AngularJS .bootstrap() and Modules
I'm having a problem, I need to load a module in the angular.boostrap and
not before it but angular keeps loading it before I tell to load it.
Here I call the angular.boostrap method, this function is called as a
callback of GMaps api so I know this is working because of the console.log
function onGoogleReady() {
console.log("GMaps api initialized.");
angular.bootstrap(document.getElementById('map', ['app.ui.map']));
}
and this is my module:
angular.module('myAppModule', ['ui.map'])
.controller('CtrlGMap', ['$scope', function($scope) {
$scope.mapOptions = {
center: new google.maps.LatLng(35.500, -78.500),
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
}]);
and finally my app HTML
<html ng-app="myAppModule">
<section id="map">
<div ui-map="myMap" ui-options="mapOptions" class="map-canvas"></div>
</section>
I'm having a problem, I need to load a module in the angular.boostrap and
not before it but angular keeps loading it before I tell to load it.
Here I call the angular.boostrap method, this function is called as a
callback of GMaps api so I know this is working because of the console.log
function onGoogleReady() {
console.log("GMaps api initialized.");
angular.bootstrap(document.getElementById('map', ['app.ui.map']));
}
and this is my module:
angular.module('myAppModule', ['ui.map'])
.controller('CtrlGMap', ['$scope', function($scope) {
$scope.mapOptions = {
center: new google.maps.LatLng(35.500, -78.500),
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
}]);
and finally my app HTML
<html ng-app="myAppModule">
<section id="map">
<div ui-map="myMap" ui-options="mapOptions" class="map-canvas"></div>
</section>
How do you get the current Java version available using c#?
How do you get the current Java version available using c#?
How do you get the current Java version available using c#? I have been
able to find a way to get the java version on my PC suing C# but I need to
be able to compare the installed version with the most current version
available. At the moment I am unable to find an API or web service to get
this information. Hopefully someone here knows the answer to this.
How do you get the current Java version available using c#? I have been
able to find a way to get the java version on my PC suing C# but I need to
be able to compare the installed version with the most current version
available. At the moment I am unable to find an API or web service to get
this information. Hopefully someone here knows the answer to this.
How to make this work?
How to make this work?
I'm pretty sure I know why this isn't working but how do I make this work?
Ok so I have a parent class that has a bunch of virtual functions and 1
non virtual function
Ex:
class Parent
{
private:
int variable;
public:
virtual void firstfunction();
virtual void secondfunction();
void nonvirtualfunction();
};
Parent::nonvirtualfunction()
{
variable = 5;
}
I have a child class that inherits from the parent class
class Child : public Parent
{
void firstfunction();
void secondfunction();
}
Child::secondfunction()
{
Parent::nonvirtualfunction();
}
When I call nonvirtualfunction inside my child class it doesn't change the
value inside the parent class. How do I make it so that I can change the
parent class' variables inside the child class?
I'm pretty sure I know why this isn't working but how do I make this work?
Ok so I have a parent class that has a bunch of virtual functions and 1
non virtual function
Ex:
class Parent
{
private:
int variable;
public:
virtual void firstfunction();
virtual void secondfunction();
void nonvirtualfunction();
};
Parent::nonvirtualfunction()
{
variable = 5;
}
I have a child class that inherits from the parent class
class Child : public Parent
{
void firstfunction();
void secondfunction();
}
Child::secondfunction()
{
Parent::nonvirtualfunction();
}
When I call nonvirtualfunction inside my child class it doesn't change the
value inside the parent class. How do I make it so that I can change the
parent class' variables inside the child class?
how to get countryname in datagrid by providing ip address
how to get countryname in datagrid by providing ip address
for asp.net c# I want to display country name of visitor to admin page I
have ip-address of visitor now how to use it to know country name using
api? or any other way? without download any new database for ipaddress or
use of jquery/js
for asp.net c# I want to display country name of visitor to admin page I
have ip-address of visitor now how to use it to know country name using
api? or any other way? without download any new database for ipaddress or
use of jquery/js
Tuesday, 10 September 2013
ld: library not found for -lboost_program_options-mt
ld: library not found for -lboost_program_options-mt
When I install gearmand on mac10.8.3. Everything seems fine when I install
libevent boost and so on . But at last I got and error return 1 when I run
command make.
Error infomation is :
`make -j5 all-am
CXXLD bin/gearadmin
ld: library not found for -lboost_program_options-mt
collect2: ld returned 1 exit status
make[1]: * [bin/gearadmin] Error 1
make: * [all] Error 2`
When I install gearmand on mac10.8.3. Everything seems fine when I install
libevent boost and so on . But at last I got and error return 1 when I run
command make.
Error infomation is :
`make -j5 all-am
CXXLD bin/gearadmin
ld: library not found for -lboost_program_options-mt
collect2: ld returned 1 exit status
make[1]: * [bin/gearadmin] Error 1
make: * [all] Error 2`
background processes and outputting to file
background processes and outputting to file
I have a bash script that does the following.
spinner()
{
local pid=$1
local delay=0.75
local spinstr='\|/-'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
}
printf "Testing for timestamps,please wait..." | tee test_report.txt
(process_1 -f $FILENAME test_1 >> test_report.txt 2>&1)&
spinner $!
printf "\n"
printf "Testing for accurate seq numbers,please wait..." | tee
test_report.txt
(process_2 -f $FILENAME sequence >> test_report.txt 2>&1) &
spinner $!
printf "\n";
However when I open the test_report.txt I see only the output of
'process_2' and can't see the output of 'process_1'
I guess the question really is what happens to a the output file that
contains the stdout of a background process.?
I have a bash script that does the following.
spinner()
{
local pid=$1
local delay=0.75
local spinstr='\|/-'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
}
printf "Testing for timestamps,please wait..." | tee test_report.txt
(process_1 -f $FILENAME test_1 >> test_report.txt 2>&1)&
spinner $!
printf "\n"
printf "Testing for accurate seq numbers,please wait..." | tee
test_report.txt
(process_2 -f $FILENAME sequence >> test_report.txt 2>&1) &
spinner $!
printf "\n";
However when I open the test_report.txt I see only the output of
'process_2' and can't see the output of 'process_1'
I guess the question really is what happens to a the output file that
contains the stdout of a background process.?
Converting two lists into a matrix
Converting two lists into a matrix
I'll try to be as clear as possible. First and foremost I will explain why
I want to transform two arrays into a matrix
To plot a portfolio vs an index I need a data structure like this
[[portfolio_value1, index_value1]
[portfolio_value2, index_value2]]
But I have the the data as two separate 1-D arrays:
portfolio = [portfolio_value1, portfolio_value2, ...]
index = [index_value1, index_value2, ...]
So how do I transform the second scenario into the first. I've tried
np.insert to add the second array to a test matrix I had in a python
shell, my problem was to transpose the first array into a single column
matrix.
I hope the question is clear enough, please let me know if it's now.
Thanks in advance.
I'll try to be as clear as possible. First and foremost I will explain why
I want to transform two arrays into a matrix
To plot a portfolio vs an index I need a data structure like this
[[portfolio_value1, index_value1]
[portfolio_value2, index_value2]]
But I have the the data as two separate 1-D arrays:
portfolio = [portfolio_value1, portfolio_value2, ...]
index = [index_value1, index_value2, ...]
So how do I transform the second scenario into the first. I've tried
np.insert to add the second array to a test matrix I had in a python
shell, my problem was to transpose the first array into a single column
matrix.
I hope the question is clear enough, please let me know if it's now.
Thanks in advance.
SQL: Check if value is available in tbl1 or tbl2
SQL: Check if value is available in tbl1 or tbl2
I want to create a sub-account system (PHP & MYSQL).
I have a user table (users) and a sub users table (sub_users).
How can check if the user is available in the user table, or in the sub
users table?
My code:
SELECT DISTINCT *
FROM users
WHERE userid = "steven"
OR WHERE EXISTS (SELECT *
FROM sub_users
WHERE sub_users.userid = "steven");
ERROR: Check your syntax near "steven"
Also tried:
SELECT *
FROM users
LEFT JOIN sub_users
ON sub_users.user_userid = users.userid
WHERE users.userid = 'steven'
OR sub_users.userid = 'steven'
Same error.
I want to create a sub-account system (PHP & MYSQL).
I have a user table (users) and a sub users table (sub_users).
How can check if the user is available in the user table, or in the sub
users table?
My code:
SELECT DISTINCT *
FROM users
WHERE userid = "steven"
OR WHERE EXISTS (SELECT *
FROM sub_users
WHERE sub_users.userid = "steven");
ERROR: Check your syntax near "steven"
Also tried:
SELECT *
FROM users
LEFT JOIN sub_users
ON sub_users.user_userid = users.userid
WHERE users.userid = 'steven'
OR sub_users.userid = 'steven'
Same error.
JQueryui menu will not position properly
JQueryui menu will not position properly
I am attempting to create menus dynamically using JQueryUI menu widgets.
Plunker Example -- Dynamic Menu Creation with issues
The problem is that the menu is not positioning itself faithfully. It (the
menu) seems determined to always appear near the bottom of my html body on
the first click of my menu button click handler, and only on the second
click of the menu button handler will it appear in the appropriate
position, nestled to the bottom of my menu button. So, how do keep my menu
faithful to the menu button which I intended?
$(document).ready(function(){
$("#myTabs").tabs();
var $replaceMenu=$("<ul style='position:absolute;z-index:9999;'>" +
"<li><a href='#'>Replace Current</li>" +
"<li><a href='#'>Replace All</li>" +
"</ul>").menu();
var replaceMenuHandler=function(event){
$replaceMenu.position({
my: "left top",
at: "left bottom",
of: this
})
.on( "menuselect", function( event, ui ) {
var selectedReplaceOption=ui.item.text();
console.log(selectedReplaceOption);
$replaceMenu.hide();
}).show();
event.stopPropagation();
};
$replaceMenu.appendTo("#testMenu").hide();
$("#testMenu").on("click",replaceMenuHandler);
});
I am attempting to create menus dynamically using JQueryUI menu widgets.
Plunker Example -- Dynamic Menu Creation with issues
The problem is that the menu is not positioning itself faithfully. It (the
menu) seems determined to always appear near the bottom of my html body on
the first click of my menu button click handler, and only on the second
click of the menu button handler will it appear in the appropriate
position, nestled to the bottom of my menu button. So, how do keep my menu
faithful to the menu button which I intended?
$(document).ready(function(){
$("#myTabs").tabs();
var $replaceMenu=$("<ul style='position:absolute;z-index:9999;'>" +
"<li><a href='#'>Replace Current</li>" +
"<li><a href='#'>Replace All</li>" +
"</ul>").menu();
var replaceMenuHandler=function(event){
$replaceMenu.position({
my: "left top",
at: "left bottom",
of: this
})
.on( "menuselect", function( event, ui ) {
var selectedReplaceOption=ui.item.text();
console.log(selectedReplaceOption);
$replaceMenu.hide();
}).show();
event.stopPropagation();
};
$replaceMenu.appendTo("#testMenu").hide();
$("#testMenu").on("click",replaceMenuHandler);
});
WCF Service Base Address vs endpoint address
WCF Service Base Address vs endpoint address
What's the difference between the following two cases:
Configuration 1:
<service name="WcfService1.Service1"
behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:808/" />
</baseAddresses>
</host>
<endpoint address="service"
binding="netTcpBinding"
bindingConfiguration="MainBinding"
bindingName="MainBinding"
name="DefaultEndpoint"
contract="WcfService1.IService1" />
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
Configuration 2:
<service name="WcfService1.Service1"
behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:808/service" />
</baseAddresses>
</host>
<endpoint address="net.tcp://127.0.0.1:808/service"
binding="netTcpBinding"
bindingConfiguration="MainBinding"
bindingName="MainBinding"
name="DefaultEndpoint"
contract="WcfService1.IService1" />
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
What I understand is In either case base address + endpoint address
resolves to same absolute address
But why I get the error on Configuration 2 : "No end point is listening at
net.tcp://127.0.0.1:808/
but Configuration 1 runs the service without any errors!!!
What's the difference between the following two cases:
Configuration 1:
<service name="WcfService1.Service1"
behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:808/" />
</baseAddresses>
</host>
<endpoint address="service"
binding="netTcpBinding"
bindingConfiguration="MainBinding"
bindingName="MainBinding"
name="DefaultEndpoint"
contract="WcfService1.IService1" />
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
Configuration 2:
<service name="WcfService1.Service1"
behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:808/service" />
</baseAddresses>
</host>
<endpoint address="net.tcp://127.0.0.1:808/service"
binding="netTcpBinding"
bindingConfiguration="MainBinding"
bindingName="MainBinding"
name="DefaultEndpoint"
contract="WcfService1.IService1" />
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
What I understand is In either case base address + endpoint address
resolves to same absolute address
But why I get the error on Configuration 2 : "No end point is listening at
net.tcp://127.0.0.1:808/
but Configuration 1 runs the service without any errors!!!
Subscribe to:
Comments (Atom)