How to inject jQuery or JavaScript to an iFrame?
I am trying to build a HTML,CSS, jQuery/JavaScript editor... How can I
inject JavaScript or jQuery into an iFrame? I tried searching all related
answers here, but none of the solutions is helping...
here's what I am talking about...#css, #js are textareas, while #iframe_id
is an iframe used to preview the changes.
css_code = $('#css').val();
js_code = $('#js').val();
css_content = "<style>" + css_code + "</style>"; // working
js_content = "<script>" + js_code + "</script>"; // does not work
$('#iframe_id').contents().find('head').append(css_content); // working
$('#iframe_id').contents().find('body').append(js_content); // does not work
The following works but only if I use core JavaScript, not sure
why...frame[0] basically is the same iframe (#iframe_id)...
var js_content = jsEditor.getValue();
frames[0].window.eval(js_content); // works only when JavaScript is
entered (not jQuery)
It may be something to do with the 'script' tags, maybe jQuery has a
problem with it...not sure why.
Saturday, 31 August 2013
Generating unique token on the fly with Rails
Generating unique token on the fly with Rails
I want to generate a token in my controller for a user in the
"user_info_token" column. However, I want to check that no user currently
has that token. Would this code suffice?
begin
@new_token = SecureRandom.urlsafe_base64
user = User.find_by_user_info_token(@new_token)
end while user != nil
@seller.user_info_token = @new_token
Or is there a much cleaner way to do this?
I want to generate a token in my controller for a user in the
"user_info_token" column. However, I want to check that no user currently
has that token. Would this code suffice?
begin
@new_token = SecureRandom.urlsafe_base64
user = User.find_by_user_info_token(@new_token)
end while user != nil
@seller.user_info_token = @new_token
Or is there a much cleaner way to do this?
php - storing value returned by a prepared statement
php - storing value returned by a prepared statement
$query= "SELECT pass FROM USER WHERE email= ?;";
if($stmt= $this->con->prepare($query))
{ $stmt->bind_param('s', $un);
$stmt->execute();
$stmt->bind_result($db_hash);
}
the query would return 'pass'. How can i Store pass into a variable?
Like $abc = 'pass';
$query= "SELECT pass FROM USER WHERE email= ?;";
if($stmt= $this->con->prepare($query))
{ $stmt->bind_param('s', $un);
$stmt->execute();
$stmt->bind_result($db_hash);
}
the query would return 'pass'. How can i Store pass into a variable?
Like $abc = 'pass';
How to make a JSON object serializable
How to make a JSON object serializable
Is there a way to serialize a python class without using a custom encoder?
I've tried the following approach but I get the error: TypeError: hello is
not JSON serializable which is strange since "hello" is a string.
class MyObj(object):
def __init__(self, address):
self.address = address
def __repr__(self):
return self.address
x = MyObj("hello")
print json.dumps(x)
Is there a way to serialize a python class without using a custom encoder?
I've tried the following approach but I get the error: TypeError: hello is
not JSON serializable which is strange since "hello" is a string.
class MyObj(object):
def __init__(self, address):
self.address = address
def __repr__(self):
return self.address
x = MyObj("hello")
print json.dumps(x)
onGetViewFactory not called
onGetViewFactory not called
I am developing a Widget for my app and I have a problem :
the onGetViewFactory method of my android.widget.RemoteViewsService class
are not called !
My code :
IntentService
this.views = new RemoteViews(this.ctx.getPackageName(), i);
Intent localIntent = new Intent(this.ctx, MyWidgetService.class);
localIntent.putExtra("WidgetId", param);
localIntent.setData(Uri.parse(localIntent.toUri(Intent.URI_INTENT_SCHEME)));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
this.views.setRemoteAdapter(R.id.weather_list, localIntent);
else
this.views.setRemoteAdapter(param, R.id.weather_list, localIntent);
ComponentName localComponentName = new ComponentName(this.ctx,
MyWidgetProvider.class);
AppWidgetManager localAppWidgetManager =
AppWidgetManager.getInstance(this.ctx);
localAppWidgetManager.notifyAppWidgetViewDataChanged(param,
R.id.weather_list);
localAppWidgetManager.updateAppWidget(param, this.views);
MyWidgetService
My class extends RemoteViewsService and have this code
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
// TODO Auto-generated method stub
System.out.println("test");
return null;
}
MyWidgetProvider My class extends AppWidgetProvider
Can anybody help me? What's wrong in my code?
Thank you :-)
I am developing a Widget for my app and I have a problem :
the onGetViewFactory method of my android.widget.RemoteViewsService class
are not called !
My code :
IntentService
this.views = new RemoteViews(this.ctx.getPackageName(), i);
Intent localIntent = new Intent(this.ctx, MyWidgetService.class);
localIntent.putExtra("WidgetId", param);
localIntent.setData(Uri.parse(localIntent.toUri(Intent.URI_INTENT_SCHEME)));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
this.views.setRemoteAdapter(R.id.weather_list, localIntent);
else
this.views.setRemoteAdapter(param, R.id.weather_list, localIntent);
ComponentName localComponentName = new ComponentName(this.ctx,
MyWidgetProvider.class);
AppWidgetManager localAppWidgetManager =
AppWidgetManager.getInstance(this.ctx);
localAppWidgetManager.notifyAppWidgetViewDataChanged(param,
R.id.weather_list);
localAppWidgetManager.updateAppWidget(param, this.views);
MyWidgetService
My class extends RemoteViewsService and have this code
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
// TODO Auto-generated method stub
System.out.println("test");
return null;
}
MyWidgetProvider My class extends AppWidgetProvider
Can anybody help me? What's wrong in my code?
Thank you :-)
jQuery UI Drag n Drop failed to lock
jQuery UI Drag n Drop failed to lock
Basically I have an image (droppable) and text (draggable). They are
matched by the data-pair attribute I've set on them. However, when I try
to console.log($(this).data('pair')) inside the drop callback, it gives
undefined. This is my code.
function handleDrop(event, ui, cb) {
console.log( $(this).data('pair') );
console.log( $(this).attr('data-pair') );
console.log( ui.draggable.data('pair') );
var dropped = $(this).data('pair');
var dragged = ui.draggable.data('pair');
var match = false;
if(dragged === dropped) {
//Match - Lock in place and increment found
match = true;
$(this).droppable( 'disable' );
ui.draggable.addClass( 'correct' );
ui.draggable.draggable( 'disable' );
ui.draggable.draggable( 'option', 'revert', false );
ui.draggable.position({
of: $(this),
my: 'left top',
at: 'left top'
});
} else {
ui.draggable.draggable( 'option', 'revert', true );
}
cb(match);
}
//Create Droppables (image + droppable div)
//imgContainer = #imgWrapper
var tempImgContainer = $('<div id="imgContainer' + i + '"></div>');
$('<img id="img' + i + '" src="' + key + '">').appendTo(tempImgContainer);
$('<div id="textForImg' + i + '" data-pair="' + i + '"></div>').droppable({
accept: '#textWrapper div',
hoverClass: 'hovered',
drop: function(event, ui) {
handleDrop(event, ui, callback);
}
}).appendTo(tempImgContainer);
$(imgContainer).append(tempImgContainer);
//Create Draggable
//textContainer = #textWrapper
var tempTextContainer = $('<div id="textContainer' + i + '" data-pair="' +
i + '">' + val + '</div>').draggable({
//quizContainer is a wrapper for both imgWrapper and textWrapper.
Example #quizContainer1
containment: quizContainer,
stack: '#textWrapper div',
cursor: 'move',
revert: true,
snap: true
});
$(textContainer).append(tempTextContainer);
i += 1;
Basically I have an image (droppable) and text (draggable). They are
matched by the data-pair attribute I've set on them. However, when I try
to console.log($(this).data('pair')) inside the drop callback, it gives
undefined. This is my code.
function handleDrop(event, ui, cb) {
console.log( $(this).data('pair') );
console.log( $(this).attr('data-pair') );
console.log( ui.draggable.data('pair') );
var dropped = $(this).data('pair');
var dragged = ui.draggable.data('pair');
var match = false;
if(dragged === dropped) {
//Match - Lock in place and increment found
match = true;
$(this).droppable( 'disable' );
ui.draggable.addClass( 'correct' );
ui.draggable.draggable( 'disable' );
ui.draggable.draggable( 'option', 'revert', false );
ui.draggable.position({
of: $(this),
my: 'left top',
at: 'left top'
});
} else {
ui.draggable.draggable( 'option', 'revert', true );
}
cb(match);
}
//Create Droppables (image + droppable div)
//imgContainer = #imgWrapper
var tempImgContainer = $('<div id="imgContainer' + i + '"></div>');
$('<img id="img' + i + '" src="' + key + '">').appendTo(tempImgContainer);
$('<div id="textForImg' + i + '" data-pair="' + i + '"></div>').droppable({
accept: '#textWrapper div',
hoverClass: 'hovered',
drop: function(event, ui) {
handleDrop(event, ui, callback);
}
}).appendTo(tempImgContainer);
$(imgContainer).append(tempImgContainer);
//Create Draggable
//textContainer = #textWrapper
var tempTextContainer = $('<div id="textContainer' + i + '" data-pair="' +
i + '">' + val + '</div>').draggable({
//quizContainer is a wrapper for both imgWrapper and textWrapper.
Example #quizContainer1
containment: quizContainer,
stack: '#textWrapper div',
cursor: 'move',
revert: true,
snap: true
});
$(textContainer).append(tempTextContainer);
i += 1;
cursor visibility false not working on hardware back press in android
cursor visibility false not working on hardware back press in android
I have 1 edit text in my activity in that when i press a button soft
keyboard opens and on hardware backbutton the softkeyboard is closed and
cursor should be visible gone..i have implemented as below..Please help me
for it..
public void onBackPressed()
{
brand.setCursorVisible(false);
brand.clearFocus();
finish();
}
}
I have 1 edit text in my activity in that when i press a button soft
keyboard opens and on hardware backbutton the softkeyboard is closed and
cursor should be visible gone..i have implemented as below..Please help me
for it..
public void onBackPressed()
{
brand.setCursorVisible(false);
brand.clearFocus();
finish();
}
}
MongoDB - Select multiple sub-dicuments from array using $elemMatch
MongoDB - Select multiple sub-dicuments from array using $elemMatch
I have a collection like the following:-
{
_id: 5,
"org_name": "abc",
"items": [
{
"item_id": "10",
"data": [
// Values goes here
]
},
{
"item_id": "11",
"data": [
// Values goes here
]
}
]
},
// Another sub document
{
_id: 6,
"org_name": "sony",
"items": [
{
"item_id": "10",
"data": [
// Values goes here
]
},
{
"item_id": "11",
"data": [
// Values goes here
]
}
]
}
Each sub document corresponds to individual organizations and each
organization has an array of items in them.
What I need is to get the select individual elements from the items array,
by providing item_id.
I already tried this:-
db.organizations.find({"_id": 5}, {items: {$elemMatch: {"item_id": {$in:
["10", "11"]}}}})
But it is returning either the item list with *item_id* "10" OR the item
list with *item_id* "11".
What I need is is the get values for both item_id 10 and 11 for the
organization "abc". Please help.
I have a collection like the following:-
{
_id: 5,
"org_name": "abc",
"items": [
{
"item_id": "10",
"data": [
// Values goes here
]
},
{
"item_id": "11",
"data": [
// Values goes here
]
}
]
},
// Another sub document
{
_id: 6,
"org_name": "sony",
"items": [
{
"item_id": "10",
"data": [
// Values goes here
]
},
{
"item_id": "11",
"data": [
// Values goes here
]
}
]
}
Each sub document corresponds to individual organizations and each
organization has an array of items in them.
What I need is to get the select individual elements from the items array,
by providing item_id.
I already tried this:-
db.organizations.find({"_id": 5}, {items: {$elemMatch: {"item_id": {$in:
["10", "11"]}}}})
But it is returning either the item list with *item_id* "10" OR the item
list with *item_id* "11".
What I need is is the get values for both item_id 10 and 11 for the
organization "abc". Please help.
Friday, 30 August 2013
Any alternatives or ways to make this script faster?
Any alternatives or ways to make this script faster?
I have this script which displays the terminal type being used. So for
instance if you were running konsole it would display konsole. The script
needs to go into another program that runs when a terminal is opened so it
has to be very fast. Here's what I have so far
#!/bin/bash
shopt -s extglob
SHELLTTY=$(exec ps -p "$$" -o tty=)
P=$$
while read P < <(exec ps -p "$P" -o ppid=) && [[ $P == +([[:digit:]]) ]]; do
if read T < <(exec ps -p "$P" -o tty=) && [[ $T != "$SHELLTTY" ]]; then
ps -p "$P" -o comm=
break
fi
done
When the script is saved into a file it takes this long for it to run.
[~]$ time ./termgrab
konsole
real 0m0.063s
user 0m0.017s
sys 0m0.040s
The whole program itself takes .04 seconds so this slows it down
considerably. Does anyone have any suggestions to make the script any
faster or any alternative ways to achieve the same thing?
I have this script which displays the terminal type being used. So for
instance if you were running konsole it would display konsole. The script
needs to go into another program that runs when a terminal is opened so it
has to be very fast. Here's what I have so far
#!/bin/bash
shopt -s extglob
SHELLTTY=$(exec ps -p "$$" -o tty=)
P=$$
while read P < <(exec ps -p "$P" -o ppid=) && [[ $P == +([[:digit:]]) ]]; do
if read T < <(exec ps -p "$P" -o tty=) && [[ $T != "$SHELLTTY" ]]; then
ps -p "$P" -o comm=
break
fi
done
When the script is saved into a file it takes this long for it to run.
[~]$ time ./termgrab
konsole
real 0m0.063s
user 0m0.017s
sys 0m0.040s
The whole program itself takes .04 seconds so this slows it down
considerably. Does anyone have any suggestions to make the script any
faster or any alternative ways to achieve the same thing?
Thursday, 29 August 2013
Use ddply within a function and include variable of interest as an argument
Use ddply within a function and include variable of interest as an argument
I am relatively new to R, and trying to use ddply & summarise from the
plyr package. This post almost, but not quite, answers my question. I
could use some additional explanation/clarification.
My problem:
I want to create a simple function to summarize descriptive statistics, by
group, for a given variable. Unlike the linked post, I would like to
include the variable of interest as an argument to the function. As has
already been discussed on this site, this works:
require(plyr)
ddply(mtcars, ~ cyl, summarise,
mean = mean(hp),
sd = sd(hp),
min = min(hp),
max = max(hp)
)
But this doesn't:
descriptives_by_group <- function(dataset, group, x)
{
ddply(dataset, ~ group, summarise,
mean = mean(x),
sd = sd(x),
min = min(x),
max = max(x)
)
}
descriptives_by_group(mtcars, cyl, hp)
Because of the volume of data with which I am working, I would like to be
able to have a function that allows me to specify the variable of interest
to me as well as the dataset and grouping variable.
I have tried to edit the various solutions found here to address my
problem, but I don't understand the code well enough to do it
successfully.
The original poster used the following example dataset:
a = c(1,2,3,4)
b = c(0,0,1,1)
c = c(5,6,7,8)
df = data.frame(a,b,c)
sv = c("b")
With the desired output:
b Ave
1 0 1.5
2 1 3.5
And the solution endorsed by Hadley was:
myFunction <- function(x, y){
NewColName <- "a"
z <- ddply(x, y, .fun = function(xx,col){
c(Ave = mean(xx[,col],na.rm=TRUE))},
NewColName)
return(z)
}
Where myFunction(df, sv) returns the desired output.
I tried to break down the code piece-by-piece to see if, by getting a
better understanding of the underlying mechanics, I could modify the code
to include an argument to the function that would pass to what, in this
example, is "NewColName" (the variable you want to get information about).
But I am not having any success. My difficulty is that I do not understand
what is happening with (xx[,col]). I know that mean(xx[,col]) should be
taking the mean of the column with index col for the data frame xx. But I
don't understand where the anonymous function is reading those values
from.
Could someone please help me parse this? I've wasted hours on a trivial
task I could accomplish easily with very repetitive code and/or with
subsetting, but I got hung up on trying to make my script more simple and
elegant, and on understanding the "whys" of this problem and its
solution(s).
PS I have looked into the describeBy function from the psych package, but
as far as I can tell, it does not let you specify the variable(s) you want
to return values for, and consequently does not solve my problem.
I am relatively new to R, and trying to use ddply & summarise from the
plyr package. This post almost, but not quite, answers my question. I
could use some additional explanation/clarification.
My problem:
I want to create a simple function to summarize descriptive statistics, by
group, for a given variable. Unlike the linked post, I would like to
include the variable of interest as an argument to the function. As has
already been discussed on this site, this works:
require(plyr)
ddply(mtcars, ~ cyl, summarise,
mean = mean(hp),
sd = sd(hp),
min = min(hp),
max = max(hp)
)
But this doesn't:
descriptives_by_group <- function(dataset, group, x)
{
ddply(dataset, ~ group, summarise,
mean = mean(x),
sd = sd(x),
min = min(x),
max = max(x)
)
}
descriptives_by_group(mtcars, cyl, hp)
Because of the volume of data with which I am working, I would like to be
able to have a function that allows me to specify the variable of interest
to me as well as the dataset and grouping variable.
I have tried to edit the various solutions found here to address my
problem, but I don't understand the code well enough to do it
successfully.
The original poster used the following example dataset:
a = c(1,2,3,4)
b = c(0,0,1,1)
c = c(5,6,7,8)
df = data.frame(a,b,c)
sv = c("b")
With the desired output:
b Ave
1 0 1.5
2 1 3.5
And the solution endorsed by Hadley was:
myFunction <- function(x, y){
NewColName <- "a"
z <- ddply(x, y, .fun = function(xx,col){
c(Ave = mean(xx[,col],na.rm=TRUE))},
NewColName)
return(z)
}
Where myFunction(df, sv) returns the desired output.
I tried to break down the code piece-by-piece to see if, by getting a
better understanding of the underlying mechanics, I could modify the code
to include an argument to the function that would pass to what, in this
example, is "NewColName" (the variable you want to get information about).
But I am not having any success. My difficulty is that I do not understand
what is happening with (xx[,col]). I know that mean(xx[,col]) should be
taking the mean of the column with index col for the data frame xx. But I
don't understand where the anonymous function is reading those values
from.
Could someone please help me parse this? I've wasted hours on a trivial
task I could accomplish easily with very repetitive code and/or with
subsetting, but I got hung up on trying to make my script more simple and
elegant, and on understanding the "whys" of this problem and its
solution(s).
PS I have looked into the describeBy function from the psych package, but
as far as I can tell, it does not let you specify the variable(s) you want
to return values for, and consequently does not solve my problem.
Questions about MVC in Javascript and in general
Questions about MVC in Javascript and in general
First, I would like to ask some very basic questions about MVC in general.
Simple questions, but can't find any good answer for them.
Is MVC useful for a one man project, or is it only needed, when more
people work on a project to make it easier to co-op?
How big a project needs to be, to make good use of MVC. I hear everywere
that I should always use MVC, but even for big projects it looks like an
overkill. I can't imagine how big something would need to be, for all this
overcomplicating to pay off.
I have made a single player rpg that is pretty short, and I am trying to
turn it into massive multiplayer. It is all for educational purpose only.
So I was thinking to redo it with MVC, but even though it has a lot of
functions and data to process it still looks way to simple and clear, to
bother with MVC. Maybe if I am making so small projects that I can't see
the benefits of using it, I just shouldn't use it?
Will using all the MVC additional code slow down my app in visible way?
Now about Javascript, there are some solutions for MVC avaliable. Are they
worth using?
Thanks
First, I would like to ask some very basic questions about MVC in general.
Simple questions, but can't find any good answer for them.
Is MVC useful for a one man project, or is it only needed, when more
people work on a project to make it easier to co-op?
How big a project needs to be, to make good use of MVC. I hear everywere
that I should always use MVC, but even for big projects it looks like an
overkill. I can't imagine how big something would need to be, for all this
overcomplicating to pay off.
I have made a single player rpg that is pretty short, and I am trying to
turn it into massive multiplayer. It is all for educational purpose only.
So I was thinking to redo it with MVC, but even though it has a lot of
functions and data to process it still looks way to simple and clear, to
bother with MVC. Maybe if I am making so small projects that I can't see
the benefits of using it, I just shouldn't use it?
Will using all the MVC additional code slow down my app in visible way?
Now about Javascript, there are some solutions for MVC avaliable. Are they
worth using?
Thanks
Wednesday, 28 August 2013
Can not activate the log-bin
Can not activate the log-bin
I have a database that uses the InnoDB engine on all his tables, running
on a Windows Server 2008 r2 64bit in a VM farm. The policies of my
organization promotes that every server has to have a replication that can
run in the case of disaster in the primary (a DRP). So, in order to
achieve that, I tried to activate the log-bin, (to deploy a slave server),
I checked the CPU and Memory usage and everything seemed to be normal, but
the log file wasn't created, also the DB started reject lots of
connections and the app started to act odd. As soon as I deactivated the
log-bin everything went back to normal (immediately).
The next time I try to activate the log;
What can I do to ensure the log-bin is activated, besides uncomment the
Log-bin= line? What parameters from the Data Base can be monitored to see
what is wrong or need tuning?
I have a database that uses the InnoDB engine on all his tables, running
on a Windows Server 2008 r2 64bit in a VM farm. The policies of my
organization promotes that every server has to have a replication that can
run in the case of disaster in the primary (a DRP). So, in order to
achieve that, I tried to activate the log-bin, (to deploy a slave server),
I checked the CPU and Memory usage and everything seemed to be normal, but
the log file wasn't created, also the DB started reject lots of
connections and the app started to act odd. As soon as I deactivated the
log-bin everything went back to normal (immediately).
The next time I try to activate the log;
What can I do to ensure the log-bin is activated, besides uncomment the
Log-bin= line? What parameters from the Data Base can be monitored to see
what is wrong or need tuning?
Network share mapping not working correctly Win8/2012
Network share mapping not working correctly Win8/2012
We have a straight forward domain logon script with a line along the lines of
net use s: \\server\share However, this isn't working correctly with
Windows 8 / 2012 machines.
The strange thing is that if you attempt to do this manually on one of the
affected machines it will complain that the drive is already mapped - you
can see the mapping from the command line however it does not show in
Windows Explorer.
We have a straight forward domain logon script with a line along the lines of
net use s: \\server\share However, this isn't working correctly with
Windows 8 / 2012 machines.
The strange thing is that if you attempt to do this manually on one of the
affected machines it will complain that the drive is already mapped - you
can see the mapping from the command line however it does not show in
Windows Explorer.
3rd Normalization Form --
3rd Normalization Form --
There are two tables in my database one is named as folder and second is
User. Now user has few rights to these folders that which folder will be
visible to user and which will not visible to him. By using 3rd
Normalization form i normalize my table. My Question to you is that i want
your suggestion that have i normalized table correctly or not, Secondly
can i normalize it more or not? My this attached image below will help you
to know normalization that i did. Thank you!
There are two tables in my database one is named as folder and second is
User. Now user has few rights to these folders that which folder will be
visible to user and which will not visible to him. By using 3rd
Normalization form i normalize my table. My Question to you is that i want
your suggestion that have i normalized table correctly or not, Secondly
can i normalize it more or not? My this attached image below will help you
to know normalization that i did. Thank you!
Tuesday, 27 August 2013
Is there a command to undo git flow init?
Is there a command to undo git flow init?
After git flow init, how to remove git flow model?
Even, I removed related config from .git/config file.
$ git flow init
# force reset
$ git flow init -f
Already remove below content from .git/config file.
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag =
Thanks.
After git flow init, how to remove git flow model?
Even, I removed related config from .git/config file.
$ git flow init
# force reset
$ git flow init -f
Already remove below content from .git/config file.
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag =
Thanks.
Bug with IE local storage implementation
Bug with IE local storage implementation
Within internet explorer 9 & 10, the local storage implementation is
busted (great thread here: Bug with Chrome's localStorage implementation?)
Does anybody know of a way to stop the local storage listener from firing
on tabs that initiated the change within internet explorer?
(function(){
if (window.addEventListener) {
window.addEventListener('storage', someListener, false);
} else {
window.attachEvent('onstorage', someListener)
}
}());
Within internet explorer 9 & 10, the local storage implementation is
busted (great thread here: Bug with Chrome's localStorage implementation?)
Does anybody know of a way to stop the local storage listener from firing
on tabs that initiated the change within internet explorer?
(function(){
if (window.addEventListener) {
window.addEventListener('storage', someListener, false);
} else {
window.attachEvent('onstorage', someListener)
}
}());
Preprocess to define '#define'
Preprocess to define '#define'
I've been looking through code golf and got an idea to try this code:
#define D #define after adding this line, everything worked fine, however
I expanded it into this:
#define D #define
D VALUE
And here I got 5 compilation error. If I change D into #define everything
is fine, can someone explain, why this code is illegal?
NOTE: I used VS2008 compiler.
EDIT: After some answers I see that I needed to give compilations error list:
error C2121: '#' : invalid character : possibly the result of a macro
expansion
error C2146: syntax error : missing ';' before identifier 'VALUE'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
error C2144: syntax error : 'void' should be preceded by ';'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
First error shows that D is not just define but also includes #.
I've been looking through code golf and got an idea to try this code:
#define D #define after adding this line, everything worked fine, however
I expanded it into this:
#define D #define
D VALUE
And here I got 5 compilation error. If I change D into #define everything
is fine, can someone explain, why this code is illegal?
NOTE: I used VS2008 compiler.
EDIT: After some answers I see that I needed to give compilations error list:
error C2121: '#' : invalid character : possibly the result of a macro
expansion
error C2146: syntax error : missing ';' before identifier 'VALUE'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
error C2144: syntax error : 'void' should be preceded by ';'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
First error shows that D is not just define but also includes #.
putting the right setTimeout function on jquery
putting the right setTimeout function on jquery
There seems to be a problem with setTimeout function. The colors don't
change. Please check fiddle below. Thanks.
http://jsfiddle.net/qU6t6/6/
var delay = 0;
for(var i = 0; i<=5; i++){
setTimeout(function(){
$('#productimage').addClass('step' + (i+1));
},delay);
delay += 2500;
}
There seems to be a problem with setTimeout function. The colors don't
change. Please check fiddle below. Thanks.
http://jsfiddle.net/qU6t6/6/
var delay = 0;
for(var i = 0; i<=5; i++){
setTimeout(function(){
$('#productimage').addClass('step' + (i+1));
},delay);
delay += 2500;
}
Can't parse XMLHttpRequest.response to Object or Array
Can't parse XMLHttpRequest.response to Object or Array
I'm trying to refresh the content of my cells of an table. Therefore, I
have a JavaScript which contains an AJAX request to a .php file, which
creates my content that I want to insert into my table via JavaScript. The
.php files last command is something like echo json_encode($result);.
Back in the JavaScript it says:
var testarray = xmlhttp.response;
alert(testarray);
But the outut from the alert looks like:
{"1":{"1":"3","2":"0","3":"2","4":"0"}}{"1":{"1":"3","2":"0","3":"2","4":"0"},"2":{"1":"2","2":"1","3":"1","4":"1"}}...
So it seems the variable testarray isn't handled as an array but as a
string. I already tried var testarray = JSON.parse(xmlhttp.response), but
this doesn't work. Neither does eval() works.
I don't know what to do, so the response of my request becomes an object.
I'm trying to refresh the content of my cells of an table. Therefore, I
have a JavaScript which contains an AJAX request to a .php file, which
creates my content that I want to insert into my table via JavaScript. The
.php files last command is something like echo json_encode($result);.
Back in the JavaScript it says:
var testarray = xmlhttp.response;
alert(testarray);
But the outut from the alert looks like:
{"1":{"1":"3","2":"0","3":"2","4":"0"}}{"1":{"1":"3","2":"0","3":"2","4":"0"},"2":{"1":"2","2":"1","3":"1","4":"1"}}...
So it seems the variable testarray isn't handled as an array but as a
string. I already tried var testarray = JSON.parse(xmlhttp.response), but
this doesn't work. Neither does eval() works.
I don't know what to do, so the response of my request becomes an object.
how to handle data when designing UI wizard of forms
how to handle data when designing UI wizard of forms
I am designing a Ui wizard kind of stuff which will contain forms in each
step. Now I am thinking of how to store data get by all the forms.
Should I store data of each form in a session ( send it to servlet ) each
time clicking on next button.
Should I store all the data in cache or cookie and submit on final submit.
Also I want to add that flipkart type of notification of steps when you
checkout and proceed to payment. Which shows the users how many steps are
in wizard and currently you are on which step of wizard...
Please help
I am designing a Ui wizard kind of stuff which will contain forms in each
step. Now I am thinking of how to store data get by all the forms.
Should I store data of each form in a session ( send it to servlet ) each
time clicking on next button.
Should I store all the data in cache or cookie and submit on final submit.
Also I want to add that flipkart type of notification of steps when you
checkout and proceed to payment. Which shows the users how many steps are
in wizard and currently you are on which step of wizard...
Please help
Monday, 26 August 2013
Is it possible to not repeat Rails ActiveRecord where conditions?
Dynamic PL/SQL date parameter with time value retained
Dynamic PL/SQL date parameter with time value retained
It might be a silly problem but I cant find a solution with "DATE" type
passed in a PL/SQL proc which is called dynamically. What I need is to
pass both date and time parts in the called proc:
create or replace
PROCEDURE DATE_TIME_TEST ( dte_Date_IN IN DATE
) IS
vch_SQL_Stmnt VARCHAR2(2000);
BEGIN
DBMS_OUTPUT.PUT_LINE('Date is :'||TO_CHAR(dte_Date_IN, 'DD-Mon-YYYY
HH24:MI:SS'));
END;
/
declare
v_sql varchar2(2000);
begin
v_sql := 'begin DATE_TIME_TEST( dte_Date_IN => '''||
sysdate || ''''|| '); end;';
execute immediate v_sql;
end;
/
The output here is - Date is :27-Aug-2013 00:00:00.
I want it to be - Date is :27-Aug-2013 13:01:09
It might be a silly problem but I cant find a solution with "DATE" type
passed in a PL/SQL proc which is called dynamically. What I need is to
pass both date and time parts in the called proc:
create or replace
PROCEDURE DATE_TIME_TEST ( dte_Date_IN IN DATE
) IS
vch_SQL_Stmnt VARCHAR2(2000);
BEGIN
DBMS_OUTPUT.PUT_LINE('Date is :'||TO_CHAR(dte_Date_IN, 'DD-Mon-YYYY
HH24:MI:SS'));
END;
/
declare
v_sql varchar2(2000);
begin
v_sql := 'begin DATE_TIME_TEST( dte_Date_IN => '''||
sysdate || ''''|| '); end;';
execute immediate v_sql;
end;
/
The output here is - Date is :27-Aug-2013 00:00:00.
I want it to be - Date is :27-Aug-2013 13:01:09
paste into ngGrid from excel
paste into ngGrid from excel
Folks,
Does anyone know how to make the ng-grid work with excel i.e provide the
ability to copy-paste from excel into the grid ?
I know of the
enableCellEdit: true
attribute but that don't make the grid work with excel.
Folks,
Does anyone know how to make the ng-grid work with excel i.e provide the
ability to copy-paste from excel into the grid ?
I know of the
enableCellEdit: true
attribute but that don't make the grid work with excel.
Can I initialize Foundation 4 Tooltips in scope?
Can I initialize Foundation 4 Tooltips in scope?
I am trying to initialize Foundation 4.3.1 tooltips in scope, on a DIV
class $(".some-class").foundation('tooltips'), instead of on document
$(document).foundation('tooltips'). When I do this, the tooltip on a touch
device (iPad), opens on tap but does not close on tap. Am I doing
something wrong? How do I get the tooltip to work properly. The reason I
need to do this is because Foundation tooltips conflict with ckeditor.
Thanks.
I am trying to initialize Foundation 4.3.1 tooltips in scope, on a DIV
class $(".some-class").foundation('tooltips'), instead of on document
$(document).foundation('tooltips'). When I do this, the tooltip on a touch
device (iPad), opens on tap but does not close on tap. Am I doing
something wrong? How do I get the tooltip to work properly. The reason I
need to do this is because Foundation tooltips conflict with ckeditor.
Thanks.
OS X Mountain Lion - See unread notification badge in menu bar or Notification Center icon
OS X Mountain Lion - See unread notification badge in menu bar or
Notification Center icon
Is there a way to show a badge or to highlight the notification center
icon where there are unread notifications? A program, an app, anything
that do this! A badge on the Notification Center icon or make the icon
color change, something like this. Thank you
Notification Center icon
Is there a way to show a badge or to highlight the notification center
icon where there are unread notifications? A program, an app, anything
that do this! A badge on the Notification Center icon or make the icon
color change, something like this. Thank you
HTML5 Tooltip via css and data- field works on link but not on image
HTML5 Tooltip via css and data- field works on link but not on image
following the tutorial http://ejohn.org/blog/html-5-data-attributes/ I
wanted to adapt the process of creating a tooltip for images (not links).
So I adjusted the "tooltip" class rules to be generic and not a tag
specific.
I reproduced my efforts in the js-fiddle http://jsfiddle.net/AqPN8/
As you can see in the fiddle it does work for links but not for images. Do
you have any idea why not?
Technically I think that :hover and alikes should also for for <img> and
not only <a>.
following the tutorial http://ejohn.org/blog/html-5-data-attributes/ I
wanted to adapt the process of creating a tooltip for images (not links).
So I adjusted the "tooltip" class rules to be generic and not a tag
specific.
I reproduced my efforts in the js-fiddle http://jsfiddle.net/AqPN8/
As you can see in the fiddle it does work for links but not for images. Do
you have any idea why not?
Technically I think that :hover and alikes should also for for <img> and
not only <a>.
How to Persist Application State in cocoa
How to Persist Application State in cocoa
I need to store the state of application at application termination time,
so that when user re-run app, App run from the state in which it was
closed last time. It is some kind of restoring app but restore methods
called when app close unexpectedly. But i need to restore app each time
when it close unexpectedly of user close it manually. I just need to store
the App UI not the data of application. Any idea would be helpful for me.
Thanks
I need to store the state of application at application termination time,
so that when user re-run app, App run from the state in which it was
closed last time. It is some kind of restoring app but restore methods
called when app close unexpectedly. But i need to restore app each time
when it close unexpectedly of user close it manually. I just need to store
the App UI not the data of application. Any idea would be helpful for me.
Thanks
Sunday, 25 August 2013
"More" menu doesn't appear in Ubuntu One browser interface, then how can I access the dropdown menu?
"More" menu doesn't appear in Ubuntu One browser interface, then how can I
access the dropdown menu?
I'm trying to remove a folder from my U1 storage. I've read that I should
go to U1 in my browser, click "more" next to the folder, and a relevant
dropdown will appear. It doesn't.
With files, yes, there is a More dropdown, it gives options to delete or
download the file. But with folders, there is no dropdown. All that
happens when I click "more" next to a folder is that a blank line appears
under the folder, and if I click "more" again the blank line disappears.
I assume that's a bug ...? Or is it meant to be like that and I'm missing
something? Whatever, the result is that I can't do what I want, which is
to completely remove a folder from U1.
access the dropdown menu?
I'm trying to remove a folder from my U1 storage. I've read that I should
go to U1 in my browser, click "more" next to the folder, and a relevant
dropdown will appear. It doesn't.
With files, yes, there is a More dropdown, it gives options to delete or
download the file. But with folders, there is no dropdown. All that
happens when I click "more" next to a folder is that a blank line appears
under the folder, and if I click "more" again the blank line disappears.
I assume that's a bug ...? Or is it meant to be like that and I'm missing
something? Whatever, the result is that I can't do what I want, which is
to completely remove a folder from U1.
loading csv in qtablewidget (Why my code is not working?)
loading csv in qtablewidget (Why my code is not working?)
I am self-learner and new to qt(I just want to learn to write program).
Trying to load the csv file to qtablewidget but it overriding all columns
and row with same data. I tried to follow How to import a CSV file to a
QTableWidget but i did not get it correctly.
Code:
QFile file("testData.txt");
QTextStream in(&file);
QStringList setDataInrow;
QStringList rowNumbers;
QString allLine;
if(file.open(QIODevice::ReadOnly)){
allLine=in.readAll();
rowNumbers=allLine.split("\n");
file.close();
}
QTableWidget *myTable=new QTableWidget();
myTable->setRowCount(rowNumbers.size());
for(int row=0;row<rowNumbers.count();row++)
{
setDataInrow=allLine.split(";");
for(int column=0;column<setDataInrow.count();column++){
myTable->setColumnCount(setDataInrow.size());
//myTable->item(row,column)->setText(setDataInrow[column]);
QTableWidgetItem *item=new QTableWidgetItem(setDataInrow[column]);
myTable->setItem(row,column,item);
}
}
qDebug()<<"Numbers of row needed:"<<"\n"<<rowNumbers<<"\n";
qDebug()<<"Set following data to each column as per
row:"<<"\n"<<setDataInrow<<setDataInrow.size();
window->setCentralWidget(myTable);
window->show();
return app.exec();
}
i am trying to load :
John Kl;34;1335532;CA;0444344
Kuma jo;54;44432;NY;0322355
Lebal ho;24;44022;NY;0110004
It should be loaded within 3 rows and 5 columns but it is setting 13
columns . Perhaps i am not able think this correctly. I need your help
with some code example so that i can study about it more.
Since my English is not good(Sucks like my codes :)) I have taken an
screenshot of the current program which is not working as expected:
http://imageshack.us/a/img801/1601/le59.png
I am self-learner and new to qt(I just want to learn to write program).
Trying to load the csv file to qtablewidget but it overriding all columns
and row with same data. I tried to follow How to import a CSV file to a
QTableWidget but i did not get it correctly.
Code:
QFile file("testData.txt");
QTextStream in(&file);
QStringList setDataInrow;
QStringList rowNumbers;
QString allLine;
if(file.open(QIODevice::ReadOnly)){
allLine=in.readAll();
rowNumbers=allLine.split("\n");
file.close();
}
QTableWidget *myTable=new QTableWidget();
myTable->setRowCount(rowNumbers.size());
for(int row=0;row<rowNumbers.count();row++)
{
setDataInrow=allLine.split(";");
for(int column=0;column<setDataInrow.count();column++){
myTable->setColumnCount(setDataInrow.size());
//myTable->item(row,column)->setText(setDataInrow[column]);
QTableWidgetItem *item=new QTableWidgetItem(setDataInrow[column]);
myTable->setItem(row,column,item);
}
}
qDebug()<<"Numbers of row needed:"<<"\n"<<rowNumbers<<"\n";
qDebug()<<"Set following data to each column as per
row:"<<"\n"<<setDataInrow<<setDataInrow.size();
window->setCentralWidget(myTable);
window->show();
return app.exec();
}
i am trying to load :
John Kl;34;1335532;CA;0444344
Kuma jo;54;44432;NY;0322355
Lebal ho;24;44022;NY;0110004
It should be loaded within 3 rows and 5 columns but it is setting 13
columns . Perhaps i am not able think this correctly. I need your help
with some code example so that i can study about it more.
Since my English is not good(Sucks like my codes :)) I have taken an
screenshot of the current program which is not working as expected:
http://imageshack.us/a/img801/1601/le59.png
can't understand how redis works with rails
can't understand how redis works with rails
I'm new on redis and i find that learning redis basics is very easy, but
when i try to understand how i can use it with rails, it become flow and i
can't find any good tutoriel which explains steps from scratch , for
example i find code like this :
class User < ActiveRecord::Base
# follow a user
def follow!(user)
$redis.multi do
$redis.sadd(self.redis_key(:following), user.id)
$redis.sadd(user.redis_key(:followers), self.id)
end
end
# unfollow a user
def unfollow!(user)
$redis.multi do
$redis.srem(self.redis_key(:following), user.id)
$redis.srem(user.redis_key(:followers), self.id)
end
end
but with this example, no other example show how to use follow method,
what is the object i need pass to this method (is this object from a
relational database ? or what ) etc ...
all examples i find in my search are incomplete, and this rend redis not
easy at all when we decide to use it with rails !
I also find that the use of redis is at the model that inherits from
ActiveRecord, I can not understand: if redis is used in the majority of
cases with a relational database or alone, and what is the way most used,
and how exactly ?
i know that my question is vast but what i search is how use redis and
rails together, also if you have a good resource for me, i will very
appreciate that. thank you
I'm new on redis and i find that learning redis basics is very easy, but
when i try to understand how i can use it with rails, it become flow and i
can't find any good tutoriel which explains steps from scratch , for
example i find code like this :
class User < ActiveRecord::Base
# follow a user
def follow!(user)
$redis.multi do
$redis.sadd(self.redis_key(:following), user.id)
$redis.sadd(user.redis_key(:followers), self.id)
end
end
# unfollow a user
def unfollow!(user)
$redis.multi do
$redis.srem(self.redis_key(:following), user.id)
$redis.srem(user.redis_key(:followers), self.id)
end
end
but with this example, no other example show how to use follow method,
what is the object i need pass to this method (is this object from a
relational database ? or what ) etc ...
all examples i find in my search are incomplete, and this rend redis not
easy at all when we decide to use it with rails !
I also find that the use of redis is at the model that inherits from
ActiveRecord, I can not understand: if redis is used in the majority of
cases with a relational database or alone, and what is the way most used,
and how exactly ?
i know that my question is vast but what i search is how use redis and
rails together, also if you have a good resource for me, i will very
appreciate that. thank you
Mysql to nosql. Best solution?
Mysql to nosql. Best solution?
We are working on our new vehicle tracking system. We have been making use
of mySQL for the past two years. However we have been discussing moving to
a noSQL database.
We have a high number of reads and writes. For reads we have been told
that mongodb will take up to much of our available ram on our servers. So
which noSQL will best suit our needs, without causing us any furthur
problems? Or is it better to hang on to mySQL?
Thanks in advance!
We are working on our new vehicle tracking system. We have been making use
of mySQL for the past two years. However we have been discussing moving to
a noSQL database.
We have a high number of reads and writes. For reads we have been told
that mongodb will take up to much of our available ram on our servers. So
which noSQL will best suit our needs, without causing us any furthur
problems? Or is it better to hang on to mySQL?
Thanks in advance!
Saturday, 24 August 2013
Unable to access HTML element from external js in Chrome Extention
Unable to access HTML element from external js in Chrome Extention
Hi I am learning to build Chrome Extensions and am very new to this field.
I am working on a very basic extension here and even before I have started
on the main task, I am stuck in my demo code. I simply wish to print
"hello" or any message in my paragraph tag when I click my extension.
Here is the HTML code:
<!DOCTYPE html>
<html>
<head>
<title>hi</title>
<style>
p
{
color:red;
font-size:20px;
}
</style>
<script src="getMSG.js"></script>
</head>
<body>
<p id='content'></p>
</body>
</html>
And here is the code for getMSG.js:
document.getElementById('content').innerHTML = 'Hello';
My extentsion was working just fine when I simply wrote "Hello World" in
my HTML code. But now when I do this I get no output at all. Please can
someone help with this? Thanks in advance :)
Hi I am learning to build Chrome Extensions and am very new to this field.
I am working on a very basic extension here and even before I have started
on the main task, I am stuck in my demo code. I simply wish to print
"hello" or any message in my paragraph tag when I click my extension.
Here is the HTML code:
<!DOCTYPE html>
<html>
<head>
<title>hi</title>
<style>
p
{
color:red;
font-size:20px;
}
</style>
<script src="getMSG.js"></script>
</head>
<body>
<p id='content'></p>
</body>
</html>
And here is the code for getMSG.js:
document.getElementById('content').innerHTML = 'Hello';
My extentsion was working just fine when I simply wrote "Hello World" in
my HTML code. But now when I do this I get no output at all. Please can
someone help with this? Thanks in advance :)
What are some of the most common uses of Exception handling?
What are some of the most common uses of Exception handling?
Im trying to get a better understanding of when it's best to use exception
handling. I cant't fully get a grasp on it, so figured if I can get some
common examples, it will help me to understand the whens/whys.
If people could give examples of the most common uses for THEM, it would
be much appreciated.
Im trying to get a better understanding of when it's best to use exception
handling. I cant't fully get a grasp on it, so figured if I can get some
common examples, it will help me to understand the whens/whys.
If people could give examples of the most common uses for THEM, it would
be much appreciated.
What does the ? operator do in Ruby
What does the ? operator do in Ruby
I have a function here that checks to see if the last element of an input
array is a hash table. If so, it'll remove the last element in the Hash
Table. This is from the solution in Ruby Monk section 6.2.
def remove_last(*arguments)
options = arguments[-1].is_a?(Hash) ? arguments.pop : {}
end
Whats does the '?' operator do between ...(Hash) ? arguments.pop ...
Why is there a ' : {} ' after arguments.pop as well.
I have a function here that checks to see if the last element of an input
array is a hash table. If so, it'll remove the last element in the Hash
Table. This is from the solution in Ruby Monk section 6.2.
def remove_last(*arguments)
options = arguments[-1].is_a?(Hash) ? arguments.pop : {}
end
Whats does the '?' operator do between ...(Hash) ? arguments.pop ...
Why is there a ' : {} ' after arguments.pop as well.
COM: excelApplication.Application.Quit() preserves the process
COM: excelApplication.Application.Quit() preserves the process
I'm using COM integration to drive MS Excel from Python 2.7. I noticed a
peculiar thing: when I run the following bit of code:
import win32com.client
excelApp = win32com.client.dynamic.Dispatch('Excel.Application')
an EXCEL.EXE process appears on the processes list (which view using the
Windows Task Manager or subprocess.Popen('tasklist')) as expected. I then
do all the stuff I need to do no problem. However, when I close Excel:
excelApp.Application.Quit()
The process persists, even if I close the Python interpreter which started
it (this kind of makes sense as Excel runs in a different process but just
to be sure). The only way I've found to terminate this process is either
by hand, using the Task Manager, or by calling:
subprocess.Popen("taskkill /F /im EXCEL.EXE",shell=True)
the forceful /F flag is necessary, otherwise the process doesn't terminate.
This isn't really a problem (I hope) but I wanted to ask whether this
could cause issues when I first edit the documents "normally", then when
calling Excel from python and then "normally" again? Potentially many
(couple dozens) times in a row? What I'm worried about is creating
conflicting versions of documents etc. Or should I just terminate the
EXCEL.EXE process each time just to be safe?
Also I noticed that subprocess.Popen("taskkill") doesn't return any
exceptions that I can catch and anylse (or am I doing something worng
here?). I'm particularly interested in distinguishing between the
"non-existent process" kill attempt and a failed attempt to terminate the
process.
I'm using COM integration to drive MS Excel from Python 2.7. I noticed a
peculiar thing: when I run the following bit of code:
import win32com.client
excelApp = win32com.client.dynamic.Dispatch('Excel.Application')
an EXCEL.EXE process appears on the processes list (which view using the
Windows Task Manager or subprocess.Popen('tasklist')) as expected. I then
do all the stuff I need to do no problem. However, when I close Excel:
excelApp.Application.Quit()
The process persists, even if I close the Python interpreter which started
it (this kind of makes sense as Excel runs in a different process but just
to be sure). The only way I've found to terminate this process is either
by hand, using the Task Manager, or by calling:
subprocess.Popen("taskkill /F /im EXCEL.EXE",shell=True)
the forceful /F flag is necessary, otherwise the process doesn't terminate.
This isn't really a problem (I hope) but I wanted to ask whether this
could cause issues when I first edit the documents "normally", then when
calling Excel from python and then "normally" again? Potentially many
(couple dozens) times in a row? What I'm worried about is creating
conflicting versions of documents etc. Or should I just terminate the
EXCEL.EXE process each time just to be safe?
Also I noticed that subprocess.Popen("taskkill") doesn't return any
exceptions that I can catch and anylse (or am I doing something worng
here?). I'm particularly interested in distinguishing between the
"non-existent process" kill attempt and a failed attempt to terminate the
process.
reload view after adding a new item
reload view after adding a new item
I have 2 outlets: first contains a form. After submit this form - create a
new item -, in the other outlet listing that item.
My problem is, when the submit button is fired, the new item is showed in
the second outlet, but without title and other parameters
the structure is something like that:
---------------------------
// form
--------------------------
{{Outlet}} //content, it shows the item list too
What is the problem?!
I have 2 outlets: first contains a form. After submit this form - create a
new item -, in the other outlet listing that item.
My problem is, when the submit button is fired, the new item is showed in
the second outlet, but without title and other parameters
the structure is something like that:
---------------------------
// form
--------------------------
{{Outlet}} //content, it shows the item list too
What is the problem?!
How to create a bootable pen drive in Windows to install OS X from an ISO [on hold]
How to create a bootable pen drive in Windows to install OS X from an ISO
[on hold]
Hi i have installed Windows 8 on my system, now I want to install OS X
Snow Leopard and remove Windows 8. The problem that i am facing is,
I dunno how to make a bootable pen drive for OS X Snow Leopard from an ISO
file.
How to install OS X from that
Can anyone provide the steps to do the above.
[on hold]
Hi i have installed Windows 8 on my system, now I want to install OS X
Snow Leopard and remove Windows 8. The problem that i am facing is,
I dunno how to make a bootable pen drive for OS X Snow Leopard from an ISO
file.
How to install OS X from that
Can anyone provide the steps to do the above.
WolframAlpha won't recognize my second derivative
WolframAlpha won't recognize my second derivative
I have been trying to calculate my derivative in WolframAlpha by inputing
this:
A=0.921/10^(9),
a=1*10^(-9),
h=1.055*10^(-34),
m=9.109*10^(-31)
int_((-pi)/(2*a))^((pi)/(2*a)) A
cos^2(x/a)*(-h^2/(2*m))*d^2/dx^2(A*cos^2(x/a))dx
Well what I got was a wrong interpretation and therefore a weird result. I
have noticed that if I only remove the second derivative like this:
A=0.921/10^(9),
a=1*10^(-9),
h=1.055*10^(-34),
m=9.109*10^(-31)
int_((-pi)/(2*a))^((pi)/(2*a)) A cos^2(x/a)*(-h^2/(2*m))dx
The interpretation looks fine but is missing a second derivative. Why
isn't the second derivative recognized? How can I fix this? If it can't be
fixed could anyone please calculate this in Mathematica?
I have been trying to calculate my derivative in WolframAlpha by inputing
this:
A=0.921/10^(9),
a=1*10^(-9),
h=1.055*10^(-34),
m=9.109*10^(-31)
int_((-pi)/(2*a))^((pi)/(2*a)) A
cos^2(x/a)*(-h^2/(2*m))*d^2/dx^2(A*cos^2(x/a))dx
Well what I got was a wrong interpretation and therefore a weird result. I
have noticed that if I only remove the second derivative like this:
A=0.921/10^(9),
a=1*10^(-9),
h=1.055*10^(-34),
m=9.109*10^(-31)
int_((-pi)/(2*a))^((pi)/(2*a)) A cos^2(x/a)*(-h^2/(2*m))dx
The interpretation looks fine but is missing a second derivative. Why
isn't the second derivative recognized? How can I fix this? If it can't be
fixed could anyone please calculate this in Mathematica?
Yo : Migrate from 1.0 RC to 1.0
Yo : Migrate from 1.0 RC to 1.0
I had created a angular app using yo 1.0 RC
so is there any improvements in the workflow(grunt files,etc) in yo 1.0 ?
Is there anything like i can update my app(build with 1.0rc) to 1.0 ?
I had created a angular app using yo 1.0 RC
so is there any improvements in the workflow(grunt files,etc) in yo 1.0 ?
Is there anything like i can update my app(build with 1.0rc) to 1.0 ?
Friday, 23 August 2013
Mongoose and Query Injection when using Javascript?
Mongoose and Query Injection when using Javascript?
How does MongoDB address SQL or Query injection? explains how to handle
query injection with BSON when using javascript on the server. I haven't
been able to track down how/whether Mongoose handles query injection
though.
At this point I have two questions:
Does Mongoose protect against query injection (using BSON or some other
method)
If it does, are there any quirks with it's implementation that a developer
need to be aware of?
How does MongoDB address SQL or Query injection? explains how to handle
query injection with BSON when using javascript on the server. I haven't
been able to track down how/whether Mongoose handles query injection
though.
At this point I have two questions:
Does Mongoose protect against query injection (using BSON or some other
method)
If it does, are there any quirks with it's implementation that a developer
need to be aware of?
Where can I find the latest /jsbin/www-widgetapi file?
Where can I find the latest /jsbin/www-widgetapi file?
I'm currently loading the YouTube API like so:
$(function () {
// This code will trigger onYouTubePlayerAPIReady
$('<script>', {
src: 'https://s.ytimg.com/yts/jsbin/www-widgetapi-vflwt8QCF.js',
async: true
}).insertBefore($('script:first'));
});
I was looking at the YouTube demo page,
https://developers.google.com/youtube/youtube_player_demo, and I noticed
in their source that they were using a different URL to load their widget
API:
<script src="https://s.ytimg.com/yts/jsbin/www-widgetapi-vfl4qCmf3.js"
async></script>
I thought that this might be a more up-to-date version of their API. So, I
swapped it out, but I receive an error message:
Uncaught ReferenceError: YTConfig is not defined
I'm left wondering which of these is the correct location, if either, to
be loading the most up to date widgetapi data from. Is there a location
for this info?
I'm currently loading the YouTube API like so:
$(function () {
// This code will trigger onYouTubePlayerAPIReady
$('<script>', {
src: 'https://s.ytimg.com/yts/jsbin/www-widgetapi-vflwt8QCF.js',
async: true
}).insertBefore($('script:first'));
});
I was looking at the YouTube demo page,
https://developers.google.com/youtube/youtube_player_demo, and I noticed
in their source that they were using a different URL to load their widget
API:
<script src="https://s.ytimg.com/yts/jsbin/www-widgetapi-vfl4qCmf3.js"
async></script>
I thought that this might be a more up-to-date version of their API. So, I
swapped it out, but I receive an error message:
Uncaught ReferenceError: YTConfig is not defined
I'm left wondering which of these is the correct location, if either, to
be loading the most up to date widgetapi data from. Is there a location
for this info?
_____________ R.EAD _____ B.EFORE ___ D.ELETED ___ B.Y ___ MO.DS ___ ____________
_____________ R.EAD _____ B.EFORE ___ D.ELETED ___ B.Y ___ MO.DS ___
____________
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1 : you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool key ctrl+v
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest.
____________
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1 : you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool key ctrl+v
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest.
Contact Form Fields not being sent
Contact Form Fields not being sent
The project and phone fields in my contact form script arent working. Any
ideas what I'm doing wrong as every other field works great:
<? php
include('contact-config.php');
$contact_form_version = strtolower($contact_form_version);
if (empty($to) || empty($contact_form_version) || ($contact_form_version
!= 'php' && $contact_form_version != 'html')) {
die('Error: The contact form has not been setup correctly.');
} else {
if ($contact_form_version == 'php') {
$formLocation = 'contact.php';
} else if ($contact_form_version == 'html') {
$formLocation = 'contact.html';
}
}
if (!empty($_POST['isAjax']) && $_POST['isAjax'] == '1') {
$ajax = true;
} else {
$ajax = false;
}
if (empty($_POST['name']) || empty($_POST['project']) ||
empty($_POST['email']) || empty($_POST['phone']) ||
empty($_POST['message'])) {
if ($ajax || $contact_form_version == 'html') {
die('Error: Missing variables');
} else {
header("Location: $formLocation?msg=missing-variables");
exit;
}
}
if
(!preg_match("/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,8})$/",
$_POST['email'])) {
if ($ajax || $contact_form_version == 'html') {
die('Error: Invalid email address');
} else {
header("Location: $formLocation?msg=invalid-email-address");
exit;
}
}
$name = $_POST['name'];
$project = $_POST['project'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$code = $_POST['captcha'];
$eip = $_POST['eip'];
$to = $to;
$headers = 'From: '.$name.' <'.$email.'>'." \r\n";
$headers. = 'Reply-To: '.$email."\r\n";
if (isset($cc) && $cc != '') {
$headers. = 'Cc: '.$cc."\r\n";
}
if (isset($bcc) && $bcc != '') {
$headers. = 'Bcc: '.$bcc."\r\n";
}
$headers. = 'X-Mailer: PHP/'.phpversion();
$subject = 'Contact Form Enquiry';
$message = wordwrap($message, 70);
if (mail($to, $subject, $message, $headers)) {
if ($ajax || $contact_form_version == 'html') {
die('Mail sent');
} else {
header("Location: $formLocation?msg=mail-sent");
exit;
}
} else {
if ($ajax || $contact_form_version == 'html') {
die('Error: Mail failed');
} else {
header("Location: $formLocation?msg=mail-failed");
exit;
}
} ?>
Any help with this would be hugely appreciated guys.
Thanks a bunch
The project and phone fields in my contact form script arent working. Any
ideas what I'm doing wrong as every other field works great:
<? php
include('contact-config.php');
$contact_form_version = strtolower($contact_form_version);
if (empty($to) || empty($contact_form_version) || ($contact_form_version
!= 'php' && $contact_form_version != 'html')) {
die('Error: The contact form has not been setup correctly.');
} else {
if ($contact_form_version == 'php') {
$formLocation = 'contact.php';
} else if ($contact_form_version == 'html') {
$formLocation = 'contact.html';
}
}
if (!empty($_POST['isAjax']) && $_POST['isAjax'] == '1') {
$ajax = true;
} else {
$ajax = false;
}
if (empty($_POST['name']) || empty($_POST['project']) ||
empty($_POST['email']) || empty($_POST['phone']) ||
empty($_POST['message'])) {
if ($ajax || $contact_form_version == 'html') {
die('Error: Missing variables');
} else {
header("Location: $formLocation?msg=missing-variables");
exit;
}
}
if
(!preg_match("/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,8})$/",
$_POST['email'])) {
if ($ajax || $contact_form_version == 'html') {
die('Error: Invalid email address');
} else {
header("Location: $formLocation?msg=invalid-email-address");
exit;
}
}
$name = $_POST['name'];
$project = $_POST['project'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$code = $_POST['captcha'];
$eip = $_POST['eip'];
$to = $to;
$headers = 'From: '.$name.' <'.$email.'>'." \r\n";
$headers. = 'Reply-To: '.$email."\r\n";
if (isset($cc) && $cc != '') {
$headers. = 'Cc: '.$cc."\r\n";
}
if (isset($bcc) && $bcc != '') {
$headers. = 'Bcc: '.$bcc."\r\n";
}
$headers. = 'X-Mailer: PHP/'.phpversion();
$subject = 'Contact Form Enquiry';
$message = wordwrap($message, 70);
if (mail($to, $subject, $message, $headers)) {
if ($ajax || $contact_form_version == 'html') {
die('Mail sent');
} else {
header("Location: $formLocation?msg=mail-sent");
exit;
}
} else {
if ($ajax || $contact_form_version == 'html') {
die('Error: Mail failed');
} else {
header("Location: $formLocation?msg=mail-failed");
exit;
}
} ?>
Any help with this would be hugely appreciated guys.
Thanks a bunch
Remove space in between mandatory * and label in SAPUI5
Remove space in between mandatory * and label in SAPUI5
We have space between the * and title Payment Method.
I am using following code
new sap.ui.commons.form.FormElement({
label: "Payment Method",
fields: [new
sap.ui.commons.ComboBox("PaymentMethod",
{ items : [
new
sap.ui.core.ListItem("PaymentMethod1",
{text:"Wire"}),
new
sap.ui.core.ListItem("PaymentMethod2",
{text:"ACH"})],
required:true,
})
],
layoutData: new
sap.ui.commons.layout.ResponsiveFlowLayoutData({linebreak:
true, margin: true})
}),
Thanks in advance.
We have space between the * and title Payment Method.
I am using following code
new sap.ui.commons.form.FormElement({
label: "Payment Method",
fields: [new
sap.ui.commons.ComboBox("PaymentMethod",
{ items : [
new
sap.ui.core.ListItem("PaymentMethod1",
{text:"Wire"}),
new
sap.ui.core.ListItem("PaymentMethod2",
{text:"ACH"})],
required:true,
})
],
layoutData: new
sap.ui.commons.layout.ResponsiveFlowLayoutData({linebreak:
true, margin: true})
}),
Thanks in advance.
Android test if haptic feedback is available
Android test if haptic feedback is available
I have seen this question : check phone settings for haptic feedback but I
don't understand the solution (for me it does not work).
Is there another solution ? I did not find anything on the javadoc.. ?
Thanks
I have seen this question : check phone settings for haptic feedback but I
don't understand the solution (for me it does not work).
Is there another solution ? I did not find anything on the javadoc.. ?
Thanks
Thursday, 22 August 2013
While recording desktop video is very bright
While recording desktop video is very bright
I have problem which I can't solve. Whenever I record my desktop with some
screencasting software, video which I recorded is very bright, while my
screen brightness is normal. This happens with all screencasting
applications, so there is something wrong with my settings. Can you help
me to fix this?
I have problem which I can't solve. Whenever I record my desktop with some
screencasting software, video which I recorded is very bright, while my
screen brightness is normal. This happens with all screencasting
applications, so there is something wrong with my settings. Can you help
me to fix this?
Spotify not playing local files
Spotify not playing local files
Spotify when ran using wine will not play local files (mp3's, wma's). When
i open the Containing folder the files are present but when selected from
the wine explorer it gives the error message: "there is no windows program
configured to open this type of file"
Spotify when ran using wine will not play local files (mp3's, wma's). When
i open the Containing folder the files are present but when selected from
the wine explorer it gives the error message: "there is no windows program
configured to open this type of file"
FusionTables Insert works in OAuth2 Playground, but not as HTTPS Post in other systems
FusionTables Insert works in OAuth2 Playground, but not as HTTPS Post in
other systems
Hello kind people of the internet,
We can successfully use the Google Oauth 2.0 Playground to make a simple
sql POST insert to a FusionTable, but when attempt the same basic HTTPS
POST operation in anything else (from back end system, another browser
session, Postman chrome tool, hurl.it, etc, etc), we always get a 403
error:
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use
requires signup.",
I'm puzzled why the error is returned when doing an HTTPS post from other
systems (other than OAuth playground)?...as at the time I'm supplying an
active Access token (cut-n-pasted Access token from OAuth playground).
The successful-working-good Request block in OAuth 2.0 Playground is below
(but the Access token is of course now expired):
POST /fusiontables/v1/query?sql=INSERT INTO
1CqwRGEEn4L0gN66JwGvCR5yOI8miNMVijcp4XlE (Name, Age) VALUES ('Forrest',
57) HTTP/1.1
Host: www.googleapis.com
Content-type: application/json
Authorization: Bearer
ya29.AHES6ZRr9CkHptvLaYlba_u6wceIh29urI8FjFp8xMP08AcBm2qpHg
Here's the direct URL that is generated by several different REST based
tools I'm attempting to use to simulate the HTTPS request to do a POST sql
insert to FusionTables (which again: always generates a 403 error even
with an active Access token):
https://www.googleapis.com/fusiontables/v1/query?sql=INSERT%20INTO%201CqwRGEEn4L0gN66JwGvCR5yOI8miNMVijcp4XlE%20(Name,%20Age)%20VALUES%20('Jim',%2057)=&Content-length:=0&Content-type:%20=application/json&Authorization:=%20Bearer%20ya29.AHES6ZRr9CkHptvLaYlba_u6wceIh29urI8FjFp8xMP08AcBm2qpHg
Some other notes: -In my Google APIs Console, I'm using the "Client ID for
web applications".
-I updated the FusionTable properties with the Api console email-address
to allow edit capability on the fusiont table used in the above sql
(1CqwRGEEn4L0gN66JwGvCR5yOI8miNMVijcp4XlE) Adding the email for edit
capability to the FusionTable properties was kindly suggested by Odi for
Service accounts on another related post on FusionTables).
Any help in explaining why HTTPS Post works in the OAuth playground for a
sql insert to FusionTables, but not anywhere else would surely be
appreciated...there must be something I'm missing, as supposedly the OAuth
playground was to help illuminate how OAuth works at a detailed level so
we could handle in other systems that don't necessarily have a developed
OAuth library.
other systems
Hello kind people of the internet,
We can successfully use the Google Oauth 2.0 Playground to make a simple
sql POST insert to a FusionTable, but when attempt the same basic HTTPS
POST operation in anything else (from back end system, another browser
session, Postman chrome tool, hurl.it, etc, etc), we always get a 403
error:
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use
requires signup.",
I'm puzzled why the error is returned when doing an HTTPS post from other
systems (other than OAuth playground)?...as at the time I'm supplying an
active Access token (cut-n-pasted Access token from OAuth playground).
The successful-working-good Request block in OAuth 2.0 Playground is below
(but the Access token is of course now expired):
POST /fusiontables/v1/query?sql=INSERT INTO
1CqwRGEEn4L0gN66JwGvCR5yOI8miNMVijcp4XlE (Name, Age) VALUES ('Forrest',
57) HTTP/1.1
Host: www.googleapis.com
Content-type: application/json
Authorization: Bearer
ya29.AHES6ZRr9CkHptvLaYlba_u6wceIh29urI8FjFp8xMP08AcBm2qpHg
Here's the direct URL that is generated by several different REST based
tools I'm attempting to use to simulate the HTTPS request to do a POST sql
insert to FusionTables (which again: always generates a 403 error even
with an active Access token):
https://www.googleapis.com/fusiontables/v1/query?sql=INSERT%20INTO%201CqwRGEEn4L0gN66JwGvCR5yOI8miNMVijcp4XlE%20(Name,%20Age)%20VALUES%20('Jim',%2057)=&Content-length:=0&Content-type:%20=application/json&Authorization:=%20Bearer%20ya29.AHES6ZRr9CkHptvLaYlba_u6wceIh29urI8FjFp8xMP08AcBm2qpHg
Some other notes: -In my Google APIs Console, I'm using the "Client ID for
web applications".
-I updated the FusionTable properties with the Api console email-address
to allow edit capability on the fusiont table used in the above sql
(1CqwRGEEn4L0gN66JwGvCR5yOI8miNMVijcp4XlE) Adding the email for edit
capability to the FusionTable properties was kindly suggested by Odi for
Service accounts on another related post on FusionTables).
Any help in explaining why HTTPS Post works in the OAuth playground for a
sql insert to FusionTables, but not anywhere else would surely be
appreciated...there must be something I'm missing, as supposedly the OAuth
playground was to help illuminate how OAuth works at a detailed level so
we could handle in other systems that don't necessarily have a developed
OAuth library.
Series index on $\mathbb Z^n$..
Series index on $\mathbb Z^n$..
does anyone know if there is a book that deal with series of the kind,
$$\displaystyle \sum_{\xi\in\mathbb Z^n}a_\xi,$$ that is, when the indices
are in the space $\mathbb Z^n$. I'm looking for the theory of convergence
of these series.. Thanks
does anyone know if there is a book that deal with series of the kind,
$$\displaystyle \sum_{\xi\in\mathbb Z^n}a_\xi,$$ that is, when the indices
are in the space $\mathbb Z^n$. I'm looking for the theory of convergence
of these series.. Thanks
Filters in Laravel 4
Filters in Laravel 4
I'm trying to use a pattern based filter in my routes file.
I want to stop anything without crsf and only allow ajax calls.
So far I have:
Route::when('/gateway/*', 'crsf');
I'm not sure where im going wrong and how i could add in the ajax
verification.
I'm trying to use a pattern based filter in my routes file.
I want to stop anything without crsf and only allow ajax calls.
So far I have:
Route::when('/gateway/*', 'crsf');
I'm not sure where im going wrong and how i could add in the ajax
verification.
c# Session does't exist in current content
c# Session does't exist in current content
I want to save the userid in the session to use in the application. I gave
the following code.
But getting compilation error saying The name Session doesn't exist in the
current context. is there any library that i need to use?. Please advise.
private void button1_Click(object sender, EventArgs e)
{
Session["Username"] = user.Text;
}
I want to save the userid in the session to use in the application. I gave
the following code.
But getting compilation error saying The name Session doesn't exist in the
current context. is there any library that i need to use?. Please advise.
private void button1_Click(object sender, EventArgs e)
{
Session["Username"] = user.Text;
}
Stripe Payment: Save token and customer and make payment later from token
Stripe Payment: Save token and customer and make payment later from token
Is it possible in stripe payment,
First we will validate credit card using stripe, then we generate token
and create customers. we will save token instead of credit card
information in database and later we will make payments from customers on
basis of token or customer instead of credit card information.
In javscript file how we handle stripeResponseHandler and function
stripeResponseHandler(status, response).
because we have already generate token using
Stripe.createToken({ number: cardNumber, cvc: cardCVC, exp_month:
$('#expiration-month').val(), exp_year: $('#expiration-year').val() },
stripeResponseHandler);
in payment step how we call stripeResponseHandler?
Is it possible in stripe payment,
First we will validate credit card using stripe, then we generate token
and create customers. we will save token instead of credit card
information in database and later we will make payments from customers on
basis of token or customer instead of credit card information.
In javscript file how we handle stripeResponseHandler and function
stripeResponseHandler(status, response).
because we have already generate token using
Stripe.createToken({ number: cardNumber, cvc: cardCVC, exp_month:
$('#expiration-month').val(), exp_year: $('#expiration-year').val() },
stripeResponseHandler);
in payment step how we call stripeResponseHandler?
Wednesday, 21 August 2013
Selecting :target on document.ready()
Selecting :target on document.ready()
The following is a simple test case to demonstrate what I'm trying to do:
<html>
<head>
<title>Test</title>
</head>
<body>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(":target").css('color', 'red');
});
</script>
<ul>
<li id="one">One</li>
<li id="two">Two</li>
<li id="three">Three</li>
</ul>
</body>
</html>
The idea is to do something through jQuery/Javascript to the targetted
item, when something is targetted (for example, test.html#two).
This works as I expect it to in Firefox and IE 10, but not in Chrome,
Opera or Safari, which leaves me wondering if this is a bug in some
browsers, if what I'm trying to do is somehow wrong, or if I've run afoul
of an inadequately precise part of some specification or other.
If I change the jQuery code to do
alert($(":target").length);
it becomes apparent that Chrome, Opera and Safari can't find the :target
element during document.ready(), but calling the same code later (via
console or function attached to a click event) does find the elements.
When should :target become accessible to JS?
The following is a simple test case to demonstrate what I'm trying to do:
<html>
<head>
<title>Test</title>
</head>
<body>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(":target").css('color', 'red');
});
</script>
<ul>
<li id="one">One</li>
<li id="two">Two</li>
<li id="three">Three</li>
</ul>
</body>
</html>
The idea is to do something through jQuery/Javascript to the targetted
item, when something is targetted (for example, test.html#two).
This works as I expect it to in Firefox and IE 10, but not in Chrome,
Opera or Safari, which leaves me wondering if this is a bug in some
browsers, if what I'm trying to do is somehow wrong, or if I've run afoul
of an inadequately precise part of some specification or other.
If I change the jQuery code to do
alert($(":target").length);
it becomes apparent that Chrome, Opera and Safari can't find the :target
element during document.ready(), but calling the same code later (via
console or function attached to a click event) does find the elements.
When should :target become accessible to JS?
pass parameter from bash to mysql script
pass parameter from bash to mysql script
I'm trying to pass parameter from bash script to mysql script. The bash
script is
#!/bin/bash
for file in `ls *.symbol`
do
path=/home/qz/$file
script='/home/qz/sqls/load_eval.sql'
mysql -u qz -h compute-0-10 -pabc -e "set @pred = '$path'; source $script;"
done
The load_eval.sql is
use biogrid;
load data local infile @pred into table lasp
fields terminated by ','
lines terminated by '\n'
(score, symbols);
When running the bash script, I got error the message:
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '@pred
into table lasp ..
It seems the value of the parameter @pred is not passed into mysql script.
I'm trying to pass parameter from bash script to mysql script. The bash
script is
#!/bin/bash
for file in `ls *.symbol`
do
path=/home/qz/$file
script='/home/qz/sqls/load_eval.sql'
mysql -u qz -h compute-0-10 -pabc -e "set @pred = '$path'; source $script;"
done
The load_eval.sql is
use biogrid;
load data local infile @pred into table lasp
fields terminated by ','
lines terminated by '\n'
(score, symbols);
When running the bash script, I got error the message:
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '@pred
into table lasp ..
It seems the value of the parameter @pred is not passed into mysql script.
Create subdirectory in Finder tree view
Create subdirectory in Finder tree view
Currently, I am only able to create a subdirectory in Finder by
double-clicking the parent dir so that it becomes the top level selected
in the main panel and creating it there by right-clicking and then
selecting New Folder. However, I like to always view my directory
structure from a very high level in the hierarchy, most often my home
directory and would like to be able to create a subdirectory of a
subdirectory without being in it, i.e. from the tree view. When I right
click it, I do not get an option to create a new folder, like I do when I
actually have it selected in the main panel. Is there any way to enable
this feature without installing any plugins?
Currently, I am only able to create a subdirectory in Finder by
double-clicking the parent dir so that it becomes the top level selected
in the main panel and creating it there by right-clicking and then
selecting New Folder. However, I like to always view my directory
structure from a very high level in the hierarchy, most often my home
directory and would like to be able to create a subdirectory of a
subdirectory without being in it, i.e. from the tree view. When I right
click it, I do not get an option to create a new folder, like I do when I
actually have it selected in the main panel. Is there any way to enable
this feature without installing any plugins?
How to use javascript/other method in order to print the date in a format, when requesting an image generated by a php script?
How to use javascript/other method in order to print the date in a format,
when requesting an image generated by a php script?
I am creating a site using bootstrap to give weather updates at the beach.
MY SITE
The following php script requests the correct image.
http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from=20130821
the last set of numbers is the date backwards.
Basically I want this image to update in the page and be the correct date.
I tried using javascript but i couldn't get it to work
var var d = new Date();
var n = d.getDate();
here is the source code for the website:
<div class="col-lg-6">
<h3>Tides</h3>
<p>Tides over the next 2 days</p>
<img
src="http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from=20130821"
class="img-responsive" alt="Responsive image">
</a>
</div>
when requesting an image generated by a php script?
I am creating a site using bootstrap to give weather updates at the beach.
MY SITE
The following php script requests the correct image.
http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from=20130821
the last set of numbers is the date backwards.
Basically I want this image to update in the page and be the correct date.
I tried using javascript but i couldn't get it to work
var var d = new Date();
var n = d.getDate();
here is the source code for the website:
<div class="col-lg-6">
<h3>Tides</h3>
<p>Tides over the next 2 days</p>
<img
src="http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from=20130821"
class="img-responsive" alt="Responsive image">
</a>
</div>
Pull data from google docs
Pull data from google docs
I'm working towards designing an Android app that can just notify its
users anything I want. I just want that app to pull over all the posts
from somewhere I can update. I was hoping if I could maintain a online
document on Google Docs and somehow I could pull it from there on my app.
Is this possible with google drive api?
I'm working towards designing an Android app that can just notify its
users anything I want. I just want that app to pull over all the posts
from somewhere I can update. I was hoping if I could maintain a online
document on Google Docs and somehow I could pull it from there on my app.
Is this possible with google drive api?
PHP loop through array with name
PHP loop through array with name
How can i loop through an array like this and retrieve the id and echo it
to the screen? Also how can i do a loop and find the one with the highest
id?
Im not a beginner i just have never really used arrays.
Array
(
[articles] => Array
(
[0] => Array
(
[id] => 650
)
[1] => Array
(
[id] => 649
)
[2] => Array
(
[id] => 645
)
[3] => Array
(
[id] => 399
)
);
Thanks in advanced.
How can i loop through an array like this and retrieve the id and echo it
to the screen? Also how can i do a loop and find the one with the highest
id?
Im not a beginner i just have never really used arrays.
Array
(
[articles] => Array
(
[0] => Array
(
[id] => 650
)
[1] => Array
(
[id] => 649
)
[2] => Array
(
[id] => 645
)
[3] => Array
(
[id] => 399
)
);
Thanks in advanced.
Tuesday, 20 August 2013
Can't call a the third page via the 2nd Page
Can't call a the third page via the 2nd Page
I'd like to create a software that has three pages: The "Home Page"
(That's drawn on a JFrame "frame"), "Page 2" and "Page 3".
Pages 2 and 3 are drawn on "frame".
One uses a navigation pane that sits on the left side of the page and the
main content is held on the right.
I'm currently only able to navigate to the 2nd page. The class called to
draw page 2 on the JFrame can't seem to call Page three.
My code is as follows:
// The Home Page
package Try;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class HomePage {
JPanel panelHomeWrapper = new JPanel();
JPanel panelNavigation = new JPanel();
JPanel panelDisplay = new JPanel();
JButton buttonNavigation = new JButton("Button Home = Menu Items");
JButton buttonBody = new JButton("Button body Page Home = Home body
Items");
public static void main (String[] args) {
HomePage home = new HomePage();
home.homePanel();
}
public void homePanel () {
JFrame frame = new JFrame("Home");
JButton button = new JButton("Button");
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
System.out.println("Panel 2 was called.");
Page2 panel2 = new Page2();
panelNavigation.remove(buttonNavigation);
panelDisplay.remove(buttonBody);
panelNavigation.add(panel2.buttonNavigation);
panelDisplay.add(panel2.buttonBody);
panelNavigation.validate();
panelNavigation.repaint();
panelDisplay.validate();
panelDisplay.repaint();
}
};
button.addActionListener(actionListener);
buttonNavigation.addActionListener(actionListener);
panelNavigation.add(buttonNavigation);
panelDisplay.add(buttonBody);
panelHomeWrapper.add(panelNavigation);
panelHomeWrapper.add(panelDisplay);
frame.add(panelHomeWrapper);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(455, 355);
frame.setVisible(true);
}
} // End of Home Page
Page 2
// Page 2
package Try;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
public class Page2 {
JButton buttonNavigation = new JButton("Button 2 = Menu Items");
JButton buttonBody = new JButton("Button body Page 2 = Page 2 body
Items");
ActionListener actionListenerCallAnotherPage = new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
System.out.println("Button Body 3 was called.");
HomePage home = new HomePage();
Page3 panel3 = new Page3();
home.panelDisplay.remove(buttonBody);
home.panelDisplay.add(panel3.buttonBody3);
home.panelDisplay.validate();
home.panelDisplay.repaint();
}
};
public void addAction () {
buttonNavigation.addActionListener(actionListenerCallAnotherPage);
}
}
Page 3
// Page 3
package Try;
import javax.swing.JButton;
public class Page3 {
JButton buttonBody3 = new JButton("Page 3");
} // End of Page 3
Please help me figure out how to make the 2nd class(page 2) call the 3rd
Class(page). Thank you all in advance.
I'd like to create a software that has three pages: The "Home Page"
(That's drawn on a JFrame "frame"), "Page 2" and "Page 3".
Pages 2 and 3 are drawn on "frame".
One uses a navigation pane that sits on the left side of the page and the
main content is held on the right.
I'm currently only able to navigate to the 2nd page. The class called to
draw page 2 on the JFrame can't seem to call Page three.
My code is as follows:
// The Home Page
package Try;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class HomePage {
JPanel panelHomeWrapper = new JPanel();
JPanel panelNavigation = new JPanel();
JPanel panelDisplay = new JPanel();
JButton buttonNavigation = new JButton("Button Home = Menu Items");
JButton buttonBody = new JButton("Button body Page Home = Home body
Items");
public static void main (String[] args) {
HomePage home = new HomePage();
home.homePanel();
}
public void homePanel () {
JFrame frame = new JFrame("Home");
JButton button = new JButton("Button");
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
System.out.println("Panel 2 was called.");
Page2 panel2 = new Page2();
panelNavigation.remove(buttonNavigation);
panelDisplay.remove(buttonBody);
panelNavigation.add(panel2.buttonNavigation);
panelDisplay.add(panel2.buttonBody);
panelNavigation.validate();
panelNavigation.repaint();
panelDisplay.validate();
panelDisplay.repaint();
}
};
button.addActionListener(actionListener);
buttonNavigation.addActionListener(actionListener);
panelNavigation.add(buttonNavigation);
panelDisplay.add(buttonBody);
panelHomeWrapper.add(panelNavigation);
panelHomeWrapper.add(panelDisplay);
frame.add(panelHomeWrapper);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(455, 355);
frame.setVisible(true);
}
} // End of Home Page
Page 2
// Page 2
package Try;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
public class Page2 {
JButton buttonNavigation = new JButton("Button 2 = Menu Items");
JButton buttonBody = new JButton("Button body Page 2 = Page 2 body
Items");
ActionListener actionListenerCallAnotherPage = new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
System.out.println("Button Body 3 was called.");
HomePage home = new HomePage();
Page3 panel3 = new Page3();
home.panelDisplay.remove(buttonBody);
home.panelDisplay.add(panel3.buttonBody3);
home.panelDisplay.validate();
home.panelDisplay.repaint();
}
};
public void addAction () {
buttonNavigation.addActionListener(actionListenerCallAnotherPage);
}
}
Page 3
// Page 3
package Try;
import javax.swing.JButton;
public class Page3 {
JButton buttonBody3 = new JButton("Page 3");
} // End of Page 3
Please help me figure out how to make the 2nd class(page 2) call the 3rd
Class(page). Thank you all in advance.
FQL - can't get link info from user - 'Request Failed' error
FQL - can't get link info from user - 'Request Failed' error
This should be an easy one. All I want it the user's profile url.
I've tried the following FQL:
SELECT profile_url FROM standard_user_info WHERE uid = me()
but get the 'Request Failed' error. I'm using the Graph API Explorer / FQL
Query and have the latest Access Token.
Basically I'm looking for the FQL equivalent to this Graph API call:
https://graph.facebook.com/me?fields=link
Thanks for the help
This should be an easy one. All I want it the user's profile url.
I've tried the following FQL:
SELECT profile_url FROM standard_user_info WHERE uid = me()
but get the 'Request Failed' error. I'm using the Graph API Explorer / FQL
Query and have the latest Access Token.
Basically I'm looking for the FQL equivalent to this Graph API call:
https://graph.facebook.com/me?fields=link
Thanks for the help
backgroundColor does not animate, but width does in jQuery
backgroundColor does not animate, but width does in jQuery
I want the color of my div.navBtn elements to change through an animation
effect. It isn't working out and I don't know why.
$(document).ready(function()
{
$("button").click(function()
{
$("div.navBtn").animate(
{
width:'+=10px',
backgroundColor: "#aa0000"
});
});
});
backgroundColor is what does the actual color changing but it does not
work. Width +=10 works perfectly, backgroundColor does absolutely nothing.
Is the syntax wrong or something??? I copied "backgroundColor: "#aa0000""
from another help posting here. Does anyone know what the problem is?
I want the color of my div.navBtn elements to change through an animation
effect. It isn't working out and I don't know why.
$(document).ready(function()
{
$("button").click(function()
{
$("div.navBtn").animate(
{
width:'+=10px',
backgroundColor: "#aa0000"
});
});
});
backgroundColor is what does the actual color changing but it does not
work. Width +=10 works perfectly, backgroundColor does absolutely nothing.
Is the syntax wrong or something??? I copied "backgroundColor: "#aa0000""
from another help posting here. Does anyone know what the problem is?
Is it possible to disable WinRT app close gesture (Pull app from top to bottom)
Is it possible to disable WinRT app close gesture (Pull app from top to
bottom)
I want to disable the app closing gesture, pulling app from top to bottom,
in my Dell Latitude 10. See the below given image which shows which thing
I want to disable.
bottom)
I want to disable the app closing gesture, pulling app from top to bottom,
in my Dell Latitude 10. See the below given image which shows which thing
I want to disable.
JSON like syntax vs switch statement javascript
JSON like syntax vs switch statement javascript
I saw a post on
http://www.jquery4u.com/javascript/shorthand-javascript-techniques/ where
he talks about an alternative way to using switch statements.
I have created a snippet below, but I'm not sure why the alternate is 99%
slow.
http://jsperf.com/alternateswitch
Any idea?
Arun
I saw a post on
http://www.jquery4u.com/javascript/shorthand-javascript-techniques/ where
he talks about an alternative way to using switch statements.
I have created a snippet below, but I'm not sure why the alternate is 99%
slow.
http://jsperf.com/alternateswitch
Any idea?
Arun
Python Dictionary Update and Append
Python Dictionary Update and Append
i have a dictionary looking like this.
{"TIM" : [[xx,yy],[aa,bb]] , "SAM" : [[yy,cc]] }
I want to add a value [tt,uu] to "SAM" if not present yet in the set.
Also i want to add "KIM" with [ii,pp].
How can i do these things?
Thank you,
i have a solution with 2 if's , but is there a better one?
i have a dictionary looking like this.
{"TIM" : [[xx,yy],[aa,bb]] , "SAM" : [[yy,cc]] }
I want to add a value [tt,uu] to "SAM" if not present yet in the set.
Also i want to add "KIM" with [ii,pp].
How can i do these things?
Thank you,
i have a solution with 2 if's , but is there a better one?
Monday, 19 August 2013
Getting data from particular number of rows
Getting data from particular number of rows
Please have a look at the following code
public List getWordList(int listNumber) {
// TODO Auto-generated method stub
List<String> list_a = new ArrayList<String>();
List<String> wordList = new ArrayList<String>();
int counter = 0;
try
{
String selectQuery = "select * from WordList";
Cursor cursor = database.rawQuery(selectQuery, null);
if(cursor.moveToFirst())
{
do
{
String englishWord =
cursor.getString(cursor.getColumnIndex("EnglishWord"));
String portugueseWord =
cursor.getString(cursor.getColumnIndex("PortugueseWord"));
String englishHint =
cursor.getString(cursor.getColumnIndex("EnglishHint"));
String portuguestHint =
cursor.getString(cursor.getColumnIndex("PortugueseHint"));
list_a.add(englishWord);
list_a.add(portugueseWord);
list_a.add(englishHint);
list_a.add(portuguestHint);
}
while(cursor.moveToNext());
//Toast.makeText(context, "Data Retrieved:
"+branches.get(1), Toast.LENGTH_LONG).show();
}
cursor.close();
return list_a;
}
catch(Exception e)
{
Toast.makeText(context, "Exception: "+e.getLocalizedMessage(),
Toast.LENGTH_LONG).show();
return null;
}
}
Here, I am getting the data from the first row to last row. But, this is
not what I need. If the 'number', the parameter is 1, I need data from row
0-9, if the 'number' is 2, I need data from row 10-19 if the 'number' is
3, I need data from row 20-29 like wise.
I am not familiar with SQLite, so how can I do this?
Please help.
Please have a look at the following code
public List getWordList(int listNumber) {
// TODO Auto-generated method stub
List<String> list_a = new ArrayList<String>();
List<String> wordList = new ArrayList<String>();
int counter = 0;
try
{
String selectQuery = "select * from WordList";
Cursor cursor = database.rawQuery(selectQuery, null);
if(cursor.moveToFirst())
{
do
{
String englishWord =
cursor.getString(cursor.getColumnIndex("EnglishWord"));
String portugueseWord =
cursor.getString(cursor.getColumnIndex("PortugueseWord"));
String englishHint =
cursor.getString(cursor.getColumnIndex("EnglishHint"));
String portuguestHint =
cursor.getString(cursor.getColumnIndex("PortugueseHint"));
list_a.add(englishWord);
list_a.add(portugueseWord);
list_a.add(englishHint);
list_a.add(portuguestHint);
}
while(cursor.moveToNext());
//Toast.makeText(context, "Data Retrieved:
"+branches.get(1), Toast.LENGTH_LONG).show();
}
cursor.close();
return list_a;
}
catch(Exception e)
{
Toast.makeText(context, "Exception: "+e.getLocalizedMessage(),
Toast.LENGTH_LONG).show();
return null;
}
}
Here, I am getting the data from the first row to last row. But, this is
not what I need. If the 'number', the parameter is 1, I need data from row
0-9, if the 'number' is 2, I need data from row 10-19 if the 'number' is
3, I need data from row 20-29 like wise.
I am not familiar with SQLite, so how can I do this?
Please help.
Spell checker or search for best fit for a word/phrase?
Spell checker or search for best fit for a word/phrase?
Can anyone help me figure out a way to replace something like "credits
card" with the correct spelling of "credit card". Or "hame imprvment" with
"home improvement". I have a custom word/phrase list that I would like to
find the closest match for a misspelled word or phrase. I do not want to
include a master dictionary, rather have my own master word list only. I
tried to use aspell but could not figure out how to use just my own
dictionary without the master english dictionary.
Thanks for any help, John
Can anyone help me figure out a way to replace something like "credits
card" with the correct spelling of "credit card". Or "hame imprvment" with
"home improvement". I have a custom word/phrase list that I would like to
find the closest match for a misspelled word or phrase. I do not want to
include a master dictionary, rather have my own master word list only. I
tried to use aspell but could not figure out how to use just my own
dictionary without the master english dictionary.
Thanks for any help, John
User unable to change password - Active Directory Group Policy
User unable to change password - Active Directory Group Policy
I've seen this issue come up, but no answers seem to be applicable. When a
user tries to change their password using control-alt-delete -> change
password, they're getting a "Unable to update the password. The value
provided for the new password does not meet the length, complexity, or
history requirements of the domain." We've even tried extremely long
complex strings as tests, which also generates the error message. In AD
U&C, I can force the account password to be changed on next logon, which
works successfully.
The applicable security setting is applied at the domain level in the
Default Domain Policy GPO. When I run a gpupdate /force and then view the
RSOP on one of the workstations, I can see the settings below (which are
consistent with the GPO):
Enforce Password History: 2 passwords remembered
Maximum Age: 120 days
Minimum password age: 0 days (this is enabled and set to 0 days in the GPO)
Minimum Length: 6 characters
Password must meet complexity requirements: disabled
Store passwords using reversible encryption: disabled
I've run a dcdiag against our DC's. They pass all tests. Any suggestions
on why this problem might be occurring, or how to rememdy it? Thanks!
I've seen this issue come up, but no answers seem to be applicable. When a
user tries to change their password using control-alt-delete -> change
password, they're getting a "Unable to update the password. The value
provided for the new password does not meet the length, complexity, or
history requirements of the domain." We've even tried extremely long
complex strings as tests, which also generates the error message. In AD
U&C, I can force the account password to be changed on next logon, which
works successfully.
The applicable security setting is applied at the domain level in the
Default Domain Policy GPO. When I run a gpupdate /force and then view the
RSOP on one of the workstations, I can see the settings below (which are
consistent with the GPO):
Enforce Password History: 2 passwords remembered
Maximum Age: 120 days
Minimum password age: 0 days (this is enabled and set to 0 days in the GPO)
Minimum Length: 6 characters
Password must meet complexity requirements: disabled
Store passwords using reversible encryption: disabled
I've run a dcdiag against our DC's. They pass all tests. Any suggestions
on why this problem might be occurring, or how to rememdy it? Thanks!
minimal socket server written in python for openshift
minimal socket server written in python for openshift
I would like to create a minimal socket server written in python that I
can run with my OpenShift account. I searched more than a day, found lots
of libraries(tornado, django, twisted, flask, autobahn, gevent) that could
be used for this, but I could not manage to implement it for me. (Actually
I do not really know the differences between these.) I looked for lots of
tutorials as well, I found an implementation using Tornado:
import tornado.ioloop
import tornado.web
import tornado.websocket
import tornado.template
class MainHandler(tornado.web.RequestHandler):
def get(self):
loader = tornado.template.Loader(".")
self.write('hello world')
class WSHandler(tornado.websocket.WebSocketHandler):
def open(self):
print 'connection opened...'
self.write_message("The server says: 'Hello'. Connection was accepted.")
def on_message(self, message):
self.write_message("The server says: " + message + " back at you")
print 'received:', message
def on_close(self):
print 'connection closed...'
application = tornado.web.Application([
(r'/ws', WSHandler),
(r'/', MainHandler),
(r"/(.*)", tornado.web.StaticFileHandler, {"path": "./resources"}),
])
if __name__ == "__main__":
application.listen(8000)
tornado.ioloop.IOLoop.instance().start()
However I cannot connect to it from a simple html5 websocket client,
furthermore I get 503 Service Temporarily Unavailable when I enter my
domain.
Could you please either give me a minimal implementation (if possible
using tornado, or maybe django) that works if upload it to OpenShift or
link me a trustworthy and 100% reliable tutorial? I would be really
pleased I can't get my head around this.
I would like to create a minimal socket server written in python that I
can run with my OpenShift account. I searched more than a day, found lots
of libraries(tornado, django, twisted, flask, autobahn, gevent) that could
be used for this, but I could not manage to implement it for me. (Actually
I do not really know the differences between these.) I looked for lots of
tutorials as well, I found an implementation using Tornado:
import tornado.ioloop
import tornado.web
import tornado.websocket
import tornado.template
class MainHandler(tornado.web.RequestHandler):
def get(self):
loader = tornado.template.Loader(".")
self.write('hello world')
class WSHandler(tornado.websocket.WebSocketHandler):
def open(self):
print 'connection opened...'
self.write_message("The server says: 'Hello'. Connection was accepted.")
def on_message(self, message):
self.write_message("The server says: " + message + " back at you")
print 'received:', message
def on_close(self):
print 'connection closed...'
application = tornado.web.Application([
(r'/ws', WSHandler),
(r'/', MainHandler),
(r"/(.*)", tornado.web.StaticFileHandler, {"path": "./resources"}),
])
if __name__ == "__main__":
application.listen(8000)
tornado.ioloop.IOLoop.instance().start()
However I cannot connect to it from a simple html5 websocket client,
furthermore I get 503 Service Temporarily Unavailable when I enter my
domain.
Could you please either give me a minimal implementation (if possible
using tornado, or maybe django) that works if upload it to OpenShift or
link me a trustworthy and 100% reliable tutorial? I would be really
pleased I can't get my head around this.
MySQL Limit not setting to a specific range
MySQL Limit not setting to a specific range
I have a query as follows.
$tests = DB::select('devices.id')
->select(array('devices.description', 'dev_desc'))
->select(array('device_types.description', 'devtype_init'))
->select(array('actions.description', 'test_desc'))
->select(array('history.dt_logged', 'last_test'))
->select(array(DB::expr('history.dt_logged + (devices.frequency * 7 * 24
* 60 * 60)'), 'next_test'))
->from('history')
->join('actions')->on('history.action_id', '=', 'actions.id')
->join('devices')->on('history.device_id', '=', 'devices.id')
->join('device_types')->on('devices.device_type_id', '=',
'cal_device_types.id')
->and_where(DB::expr('history.dt_logged + (devices.frequency * 7 * 24 *
60 * 60)'), '>=', $start)
->and_where(DB::expr('history.dt_logged + (devices.frequency * 7 * 24 *
60 * 60)'), '<=', $end)
->where('device_types.description', '=', 'Calibration')
->order_by('history.dt_logged', 'desc')->limit(1)
->execute();
I want to pull back one record hence the " limit(1) " , but it pulls back
multiple records. The code looks perfect to me. Any help would be greatly
appreciated.
Cheers.
Would a correlated subquery work ?!
I have a query as follows.
$tests = DB::select('devices.id')
->select(array('devices.description', 'dev_desc'))
->select(array('device_types.description', 'devtype_init'))
->select(array('actions.description', 'test_desc'))
->select(array('history.dt_logged', 'last_test'))
->select(array(DB::expr('history.dt_logged + (devices.frequency * 7 * 24
* 60 * 60)'), 'next_test'))
->from('history')
->join('actions')->on('history.action_id', '=', 'actions.id')
->join('devices')->on('history.device_id', '=', 'devices.id')
->join('device_types')->on('devices.device_type_id', '=',
'cal_device_types.id')
->and_where(DB::expr('history.dt_logged + (devices.frequency * 7 * 24 *
60 * 60)'), '>=', $start)
->and_where(DB::expr('history.dt_logged + (devices.frequency * 7 * 24 *
60 * 60)'), '<=', $end)
->where('device_types.description', '=', 'Calibration')
->order_by('history.dt_logged', 'desc')->limit(1)
->execute();
I want to pull back one record hence the " limit(1) " , but it pulls back
multiple records. The code looks perfect to me. Any help would be greatly
appreciated.
Cheers.
Would a correlated subquery work ?!
Sunday, 18 August 2013
Flyout not being displayed
Flyout not being displayed
I have two buttons placed side by side with the left button expanding to
fill the space
.left {
overflow: hidden;
display: block;
width: auto;
}
.right {
float: right;
width: 34px;
}
<div class="right" />
<div class="left" />
It took a long time to get even that working. Finally I figured out the
left side needed overflow: hidden to correctly fill the space.
Now, the left button requires a flyout form on hover. The problem is I
cannot get it to display while the container has the overflow: hidden
style associated. How can I resolve this?
Also, and this is the bain of my CSS experience, is there any reference I
can look at with regards to container and contained styles? For example I
wasted 3 hours yesterday trying to figure out how to auto expand a center
div between two float divs. Turns out the problem was the container had a
float: right style so the center div required a float: none.
I have two buttons placed side by side with the left button expanding to
fill the space
.left {
overflow: hidden;
display: block;
width: auto;
}
.right {
float: right;
width: 34px;
}
<div class="right" />
<div class="left" />
It took a long time to get even that working. Finally I figured out the
left side needed overflow: hidden to correctly fill the space.
Now, the left button requires a flyout form on hover. The problem is I
cannot get it to display while the container has the overflow: hidden
style associated. How can I resolve this?
Also, and this is the bain of my CSS experience, is there any reference I
can look at with regards to container and contained styles? For example I
wasted 3 hours yesterday trying to figure out how to auto expand a center
div between two float divs. Turns out the problem was the container had a
float: right style so the center div required a float: none.
jQuery - Rotating an image on click and rotating back the next click
jQuery - Rotating an image on click and rotating back the next click
I have a fiddle to demonstrate what I'm trying to do.
http://jsfiddle.net/LxtmM/
jQuery:
$(".arrow").on("click", function() {
$(".arrow").toggleClass("rotate").css({ "-moz-transform" :
"rotate(-90deg)", "-webkit-transform" : "rotate(-90deg)",
"-ms-transform" : "rotate(-90deg)", "-o-transform" :
"rotate(-90deg)" });
});
Bascially, I want it so that when you click the arrow it rotates
-90degrees and then rotates back on the next click. I understand that
needs some sort of toggle. But I learned that you can just toggle a class
that has the CSS3 transform rotate.
When you click it, it rotates and adds the class, if you click it again it
removes the class but it doesn't animate back. I'm not sure if I should
expect it rotate back when the rotate class is toggled off but it's not
working nonetheless.
Thanks!
I have a fiddle to demonstrate what I'm trying to do.
http://jsfiddle.net/LxtmM/
jQuery:
$(".arrow").on("click", function() {
$(".arrow").toggleClass("rotate").css({ "-moz-transform" :
"rotate(-90deg)", "-webkit-transform" : "rotate(-90deg)",
"-ms-transform" : "rotate(-90deg)", "-o-transform" :
"rotate(-90deg)" });
});
Bascially, I want it so that when you click the arrow it rotates
-90degrees and then rotates back on the next click. I understand that
needs some sort of toggle. But I learned that you can just toggle a class
that has the CSS3 transform rotate.
When you click it, it rotates and adds the class, if you click it again it
removes the class but it doesn't animate back. I'm not sure if I should
expect it rotate back when the rotate class is toggled off but it's not
working nonetheless.
Thanks!
How can I get progress bar to increment by one block till end of bar? Visual Basic 2010
How can I get progress bar to increment by one block till end of bar?
Visual Basic 2010
I was just wondering how I could get a progress bar to increment by one
block each time the correct button is clicked, till eventually the
progress bar is filled and the questions end. I have tried, but didn't
work, so thought I would ask on here for guidance on how to achieve this
or go about this.
Not worked much with progress bars and not worried about maximum values at
the moment or minimum, if that is any help.
Hope I have explained my problem with enough detail and any help will
greatly be appreciated.
Many thanks.
Visual Basic 2010
I was just wondering how I could get a progress bar to increment by one
block each time the correct button is clicked, till eventually the
progress bar is filled and the questions end. I have tried, but didn't
work, so thought I would ask on here for guidance on how to achieve this
or go about this.
Not worked much with progress bars and not worried about maximum values at
the moment or minimum, if that is any help.
Hope I have explained my problem with enough detail and any help will
greatly be appreciated.
Many thanks.
Getting a part of a texture: LWJGL
Getting a part of a texture: LWJGL
I have a big image (1024 x 1024 px) with a lot of icons. For the texture
on the quad I want to get the part of the image between x 128 y 64 and x
256 y 192. How can I do this?
Thanks a lot Thomas :D
I have a big image (1024 x 1024 px) with a lot of icons. For the texture
on the quad I want to get the part of the image between x 128 y 64 and x
256 y 192. How can I do this?
Thanks a lot Thomas :D
adaptative network scanning to quickly find live hosts
adaptative network scanning to quickly find live hosts
I need to find live hosts on a few /16 networks. Topologically speaking,
some hosts are close, while some others may be a few hops away. Speed is
more important that accuracy (I can live with, say, a few % error rate
(live hosts missed)).
Is there a way to adaptively scan such networks - so that fast networks
are scanned quickly while slower ones - less quickly? (as opposed to, for
instance, --max-rate in nmap which is a static setting)
Thank you.
I need to find live hosts on a few /16 networks. Topologically speaking,
some hosts are close, while some others may be a few hops away. Speed is
more important that accuracy (I can live with, say, a few % error rate
(live hosts missed)).
Is there a way to adaptively scan such networks - so that fast networks
are scanned quickly while slower ones - less quickly? (as opposed to, for
instance, --max-rate in nmap which is a static setting)
Thank you.
Intel UNDI, PXE-2.1 (build 083) Copyright (C) 1997-2000 Intel Corporation T
Intel UNDI, PXE-2.1 (build 083) Copyright (C) 1997-2000 Intel Corporation T
Intel UNDI, PXE-2.1 (build 083) Copyright (C) 1997-2000 Intel Corporation
This product is covered by one or more of the following patents:
US5,307,459, US5,434,872, US5,732,094, US6,570,884, US6,115,776 and
US6,327,625 Realtek PCIe FE Family Controller Series v2.35 (06/04/10)
PXE-E61:Media test failure,check cable
Intel UNDI, PXE-2.1 (build 083) Copyright (C) 1997-2000 Intel Corporation
This product is covered by one or more of the following patents:
US5,307,459, US5,434,872, US5,732,094, US6,570,884, US6,115,776 and
US6,327,625 Realtek PCIe FE Family Controller Series v2.35 (06/04/10)
PXE-E61:Media test failure,check cable
Saturday, 17 August 2013
AWS VPN server cost [on hold]
AWS VPN server cost [on hold]
This question is probably naive - please bear with me, I'm still getting
my head around how VPNs work.
TL;DR - if I host a VPN server on an EC2 instance (standalone, not VPC),
will I pay $.05/hr for every device connected to it?
We are considering hosting our VPN server on an AWS EC2 instance. There
will likely be hundreds of connected clients, but very little data
transfer. I'm concerned because of the pricing information in AWS' VPC
overview with regards to VPN connections
(http://aws.amazon.com/vpc/#pricing). It reads "$0.05 per VPN
Connection-hour"
However AWS' suggested use case is establishing a VPN connection to a VPC
so that it may be used as an extension of onsite IT infrastructure, which
I don't think applies in our situation (described below). Subsequently I'm
wondering if that .05/connection/hour pricing model applies. Also our VPN
server will not (or at least does not need to be) in a VPC -- a standalone
EC2 instance will be more than enough.
Our use case, in the event that it's helpful: We need to maintain a VPN
connection with (MikroTik) routers installed at a number of separate
physical locations to periodically push configuration updates.
This question is probably naive - please bear with me, I'm still getting
my head around how VPNs work.
TL;DR - if I host a VPN server on an EC2 instance (standalone, not VPC),
will I pay $.05/hr for every device connected to it?
We are considering hosting our VPN server on an AWS EC2 instance. There
will likely be hundreds of connected clients, but very little data
transfer. I'm concerned because of the pricing information in AWS' VPC
overview with regards to VPN connections
(http://aws.amazon.com/vpc/#pricing). It reads "$0.05 per VPN
Connection-hour"
However AWS' suggested use case is establishing a VPN connection to a VPC
so that it may be used as an extension of onsite IT infrastructure, which
I don't think applies in our situation (described below). Subsequently I'm
wondering if that .05/connection/hour pricing model applies. Also our VPN
server will not (or at least does not need to be) in a VPC -- a standalone
EC2 instance will be more than enough.
Our use case, in the event that it's helpful: We need to maintain a VPN
connection with (MikroTik) routers installed at a number of separate
physical locations to periodically push configuration updates.
SCP long directories
SCP long directories
Im wondering what the quickest way for this is
On my local computer I have a file in /some/long/path/name
When i have SSH'ed into another machine I decide I want the local file to
go in /remote/long/dir/
I then open a new shell, scp the file to home, switch back to the first
shell and mv the file from home to the current directory.
I find this way easier due to tabbed completion etc.
Is there a "trick" to make scp use the files from the computer connecting
to it show in the remote ?
i guess example syntax would be (to be run on the remote machine)
scp host:/tabbed/complete/file file
or would i alawys need a second connection if i decide half way though ?
The computers i connect from dont have direct port access from outside
Im wondering what the quickest way for this is
On my local computer I have a file in /some/long/path/name
When i have SSH'ed into another machine I decide I want the local file to
go in /remote/long/dir/
I then open a new shell, scp the file to home, switch back to the first
shell and mv the file from home to the current directory.
I find this way easier due to tabbed completion etc.
Is there a "trick" to make scp use the files from the computer connecting
to it show in the remote ?
i guess example syntax would be (to be run on the remote machine)
scp host:/tabbed/complete/file file
or would i alawys need a second connection if i decide half way though ?
The computers i connect from dont have direct port access from outside
About a reference collecting the main properties of the modulus and the argument of $f$
About a reference collecting the main properties of the modulus and the
argument of $f$
Let $f$ be an analytic function in the whole complex plane. We can write
$f$ in its polar form: $$f(z)=ñ(z)exp(iè(z))$$ My question is about a
reference collecting the main properties of the modulus and the argument
of $f$.
argument of $f$
Let $f$ be an analytic function in the whole complex plane. We can write
$f$ in its polar form: $$f(z)=ñ(z)exp(iè(z))$$ My question is about a
reference collecting the main properties of the modulus and the argument
of $f$.
Installing Jijna2 on Mac but specifying directory
Installing Jijna2 on Mac but specifying directory
I recently upgraded my Snow Leopard python to 2.7 from 2.6, but the
location of 2.7 is in /library/frameworks/python.frameworks whereas 2.6 is
in /library/python. When I use easy_install to install Jinja2, it
automatically puts it in my 2.6 site-packages folder, but I'd like to put
it in my 2.7 site-packages folder. Can anyone tell me how to do this? I'm
very new to programming so any tips would be much appreciated. Thanks.
I recently upgraded my Snow Leopard python to 2.7 from 2.6, but the
location of 2.7 is in /library/frameworks/python.frameworks whereas 2.6 is
in /library/python. When I use easy_install to install Jinja2, it
automatically puts it in my 2.6 site-packages folder, but I'd like to put
it in my 2.7 site-packages folder. Can anyone tell me how to do this? I'm
very new to programming so any tips would be much appreciated. Thanks.
Here is Practical Explanation about Next Life, Purpose of Human Life, philosophical/religious facts, -?
Here is Practical Explanation about Next Life, Purpose of Human Life,
philosophical/religious facts, -?
theories etc and i Challenge you all So called intelligent Atheists Or So
Called puffed up Rascal Cheaters.
( if anyone have got guts then disprove this Practical Explanation Or
disprove Gravity )
Practical Explanation ( For Example ) :- `1st of all can you tell me every
single seconds detail from that time when you born ?? ( i need every
seconds detail ?? that what- what you have thought and done on every
single second )
can you tell me every single detail of your `1 cheapest Minute Or your
whole hour, day, week, month, year or your whole life ??
if you are not able to tell me about this life then what proof do you have
that you didn't forget your past ? and that you will not forget this
present life in the future ?
that is Fact that Supreme Lord Krishna exists but we posses no such
intelligence to understand him. there is also next life. and i already
proved you that no scientist, no politician, no so-called intelligent man
in this world is able to understand this Truth. cuz they are imagining.
and you cannot imagine what is god, who is god, what is after life etc.
for example :Your father existed before your birth. you cannot say that
before your birth your father don,t exists.
So you have to ask from mother, "Who is my father?" And if she says, "This
gentleman is your father," then it is all right. It is easy. Otherwise, if
you makes research, "Who is my father?" go on searching for life; you'll
never find your father.
( now maybe...maybe you will say that i will search my father from D.N.A,
or i will prove it by photo's, or many other thing's which i will get from
my mother and prove it that who is my Real father.{ So you have to believe
the authority. who is that authority ? she is your mother. you cannot
claim of any photo's, D.N.A or many other things without authority ( or ur
mother ).
if you will show D.N.A, photo's, and many other proofs from other women
then your mother. then what is use of those proofs ??} )
same you have to follow real authority. "Whatever You have spoken, I
accept it," Then there is no difficulty. And You are accepted by Devala,
Narada, Vyasa, and You are speaking Yourself, and later on, all the
acaryas have accepted. Then I'll follow. I'll have to follow great
personalities. The same reason mother says, this gentleman is my father.
That's all. Finish business. Where is the necessity of making research?
All authorities accept Krsna, the Supreme Personality of Godhead. You
accept it; then your searching after God is finished.
Why should you waste your time?
all that is you need is to hear from authority ( same like mother ). and i
heard this truth from authority " Srila Prabhupada " he is my spiritual
master. im not talking these all things from my own.
in this world no `1 can be Peace full. this is all along Fact.
cuz we all are suffering in this world 4 Problems which are Disease, Old
age, Death, and Birth after Birth.
tell me are you really happy ?? you can,t be happy if you will ignore
these 4 main problem. then still you will be Forced by Nature.
if you really want to be happy then follow these 6 Things which are No
illicit sex, No gambling, No drugs, No meat-eating ( No onion and garlic's
)
5th thing is whatever you eat `1st offer it to Supreme Lord Krishna. ( if
you know it what is Guru parama-para then offer them food not direct
Supreme Lord Krishna )
and 6th " Main Thing " is you have to Chant " hare krishna hare krishna
krishna krishna hare hare hare rama hare rama rama rama hare hare ".
If your not able to follow these 4 things no illicit sex, no gambling, no
drugs, no meat-eating then don,t worry but chanting of this holy name (
Hare Krishna Maha-Mantra ) is very-very and very important.
Chant " hare krishna hare krishna krishna krishna hare hare hare rama hare
rama rama rama hare hare " and be happy.
if you still don,t believe on me then chant any other name for 5 Min's and
chant this holy name for 5 Min's and you will see effect. i promise you it
works And chanting at least 16 rounds ( each round of 108 beads ) of the
Hare Krishna maha-mantra daily.
Here is no Question of Holy Books quotes, Personal Experiences, Faith or
Belief. i accept that Sometimes Faith is also Blind. Here is already
Practical explanation which already proved that every`1 else in this world
is nothing more then Busy Foolish and totally idiot.
Source(s): every `1 is already Blind in this world and if you will follow
another Blind then you both will fall in hole. so try to follow that
person who have Spiritual Eyes who can Guide you on Actual Right Path. (
my Authority & Guide is my Spiritual Master " Srila Prabhupada " )
if you want to see Actual Purpose of human life then see this link : (
www.asitis.com {Bookmark it }) read it complete. ( i promise only readers
of this book that they { he/she } will get every single answer which they
want to know about why im in this material world, who im, what will happen
after this life, what is best thing which will make Human Life Perfect,
and what is perfection of Human Life. ) purpose of human life is not to
live like animal cuz every`1 at present time doing 4 thing which are
sleeping, eating, sex & fear. purpose of human life is to become freed
from Birth after birth, Old Age, Disease, and Death.
philosophical/religious facts, -?
theories etc and i Challenge you all So called intelligent Atheists Or So
Called puffed up Rascal Cheaters.
( if anyone have got guts then disprove this Practical Explanation Or
disprove Gravity )
Practical Explanation ( For Example ) :- `1st of all can you tell me every
single seconds detail from that time when you born ?? ( i need every
seconds detail ?? that what- what you have thought and done on every
single second )
can you tell me every single detail of your `1 cheapest Minute Or your
whole hour, day, week, month, year or your whole life ??
if you are not able to tell me about this life then what proof do you have
that you didn't forget your past ? and that you will not forget this
present life in the future ?
that is Fact that Supreme Lord Krishna exists but we posses no such
intelligence to understand him. there is also next life. and i already
proved you that no scientist, no politician, no so-called intelligent man
in this world is able to understand this Truth. cuz they are imagining.
and you cannot imagine what is god, who is god, what is after life etc.
for example :Your father existed before your birth. you cannot say that
before your birth your father don,t exists.
So you have to ask from mother, "Who is my father?" And if she says, "This
gentleman is your father," then it is all right. It is easy. Otherwise, if
you makes research, "Who is my father?" go on searching for life; you'll
never find your father.
( now maybe...maybe you will say that i will search my father from D.N.A,
or i will prove it by photo's, or many other thing's which i will get from
my mother and prove it that who is my Real father.{ So you have to believe
the authority. who is that authority ? she is your mother. you cannot
claim of any photo's, D.N.A or many other things without authority ( or ur
mother ).
if you will show D.N.A, photo's, and many other proofs from other women
then your mother. then what is use of those proofs ??} )
same you have to follow real authority. "Whatever You have spoken, I
accept it," Then there is no difficulty. And You are accepted by Devala,
Narada, Vyasa, and You are speaking Yourself, and later on, all the
acaryas have accepted. Then I'll follow. I'll have to follow great
personalities. The same reason mother says, this gentleman is my father.
That's all. Finish business. Where is the necessity of making research?
All authorities accept Krsna, the Supreme Personality of Godhead. You
accept it; then your searching after God is finished.
Why should you waste your time?
all that is you need is to hear from authority ( same like mother ). and i
heard this truth from authority " Srila Prabhupada " he is my spiritual
master. im not talking these all things from my own.
in this world no `1 can be Peace full. this is all along Fact.
cuz we all are suffering in this world 4 Problems which are Disease, Old
age, Death, and Birth after Birth.
tell me are you really happy ?? you can,t be happy if you will ignore
these 4 main problem. then still you will be Forced by Nature.
if you really want to be happy then follow these 6 Things which are No
illicit sex, No gambling, No drugs, No meat-eating ( No onion and garlic's
)
5th thing is whatever you eat `1st offer it to Supreme Lord Krishna. ( if
you know it what is Guru parama-para then offer them food not direct
Supreme Lord Krishna )
and 6th " Main Thing " is you have to Chant " hare krishna hare krishna
krishna krishna hare hare hare rama hare rama rama rama hare hare ".
If your not able to follow these 4 things no illicit sex, no gambling, no
drugs, no meat-eating then don,t worry but chanting of this holy name (
Hare Krishna Maha-Mantra ) is very-very and very important.
Chant " hare krishna hare krishna krishna krishna hare hare hare rama hare
rama rama rama hare hare " and be happy.
if you still don,t believe on me then chant any other name for 5 Min's and
chant this holy name for 5 Min's and you will see effect. i promise you it
works And chanting at least 16 rounds ( each round of 108 beads ) of the
Hare Krishna maha-mantra daily.
Here is no Question of Holy Books quotes, Personal Experiences, Faith or
Belief. i accept that Sometimes Faith is also Blind. Here is already
Practical explanation which already proved that every`1 else in this world
is nothing more then Busy Foolish and totally idiot.
Source(s): every `1 is already Blind in this world and if you will follow
another Blind then you both will fall in hole. so try to follow that
person who have Spiritual Eyes who can Guide you on Actual Right Path. (
my Authority & Guide is my Spiritual Master " Srila Prabhupada " )
if you want to see Actual Purpose of human life then see this link : (
www.asitis.com {Bookmark it }) read it complete. ( i promise only readers
of this book that they { he/she } will get every single answer which they
want to know about why im in this material world, who im, what will happen
after this life, what is best thing which will make Human Life Perfect,
and what is perfection of Human Life. ) purpose of human life is not to
live like animal cuz every`1 at present time doing 4 thing which are
sleeping, eating, sex & fear. purpose of human life is to become freed
from Birth after birth, Old Age, Disease, and Death.
Spring dependency injection and generic class
Spring dependency injection and generic class
Sorry for my English. I can not to do dependency injection for generic
class in spring. Generic class:
abstract class BaseBO<Id, Entity, DAOClass extends DAO<Id, Entity>>
implements BO<Id, Entity, DAOClass> {
DAOClass dao;
public DAOClass getDAO() {
return dao;
}
//...
}
Use generic class:
public class TaskBO extends BaseBO<Long, Task, TaskDAO> implements
BO<Long, Task, TaskDAO> {
}
I want to do dependency injection in a class TaskBO for property TaskDAO.
But I can only to set dependency TaskDAO via a interface DAO for bean
TaskBO:
<bean id="TaskBO" class="com.otv.model.bo.TaskBO">
<property name="DAO" ref="TaskDAO" />
</bean>
<bean id="TaskDAO" class="com.otv.model.dao.TaskDAO">
<property name="sessionFactory" ref="SessionFactory" />
</bean>
How to set dependency injection via class TaskDAO?
Sorry for my English. I can not to do dependency injection for generic
class in spring. Generic class:
abstract class BaseBO<Id, Entity, DAOClass extends DAO<Id, Entity>>
implements BO<Id, Entity, DAOClass> {
DAOClass dao;
public DAOClass getDAO() {
return dao;
}
//...
}
Use generic class:
public class TaskBO extends BaseBO<Long, Task, TaskDAO> implements
BO<Long, Task, TaskDAO> {
}
I want to do dependency injection in a class TaskBO for property TaskDAO.
But I can only to set dependency TaskDAO via a interface DAO for bean
TaskBO:
<bean id="TaskBO" class="com.otv.model.bo.TaskBO">
<property name="DAO" ref="TaskDAO" />
</bean>
<bean id="TaskDAO" class="com.otv.model.dao.TaskDAO">
<property name="sessionFactory" ref="SessionFactory" />
</bean>
How to set dependency injection via class TaskDAO?
how to create jquery browser history
how to create jquery browser history
Can somebody help me make this work I have a form that is split into four
parts i use only one button next which is append to every step of the form
i just hide the form everytime i click next how can i create a browser
history using this
http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
i already manage to create the hash but it does not do anything
this is my code as of now
$(window).hashchange( function(){
var hash = location.hash;
window.location.hash= 'step'+curPage;
// Set the page title based on the hash.
document.title = 'The hash is ' + ( hash.replace( /^#/, '' ) || 'step1' )
+ '.';
$(".next").attr("href","localhost/carolform/signup.php#step"+curPage);
//$(".next").attr("id","step"+curPage);
// id="step'+curPage+'" href="localhost/carolform/signup.php#step'+curPage+'"
// Iterate over all nav links, setting the "selected" class as-appropriate.
$('.next').each(function(){
var that = $(this);
that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ](
'selected' );
});
});
$(window).hashchange();
Can somebody help me make this work I have a form that is split into four
parts i use only one button next which is append to every step of the form
i just hide the form everytime i click next how can i create a browser
history using this
http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
i already manage to create the hash but it does not do anything
this is my code as of now
$(window).hashchange( function(){
var hash = location.hash;
window.location.hash= 'step'+curPage;
// Set the page title based on the hash.
document.title = 'The hash is ' + ( hash.replace( /^#/, '' ) || 'step1' )
+ '.';
$(".next").attr("href","localhost/carolform/signup.php#step"+curPage);
//$(".next").attr("id","step"+curPage);
// id="step'+curPage+'" href="localhost/carolform/signup.php#step'+curPage+'"
// Iterate over all nav links, setting the "selected" class as-appropriate.
$('.next').each(function(){
var that = $(this);
that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ](
'selected' );
});
});
$(window).hashchange();
Friday, 16 August 2013
Calling functions in extended classes through an object array
Calling functions in extended classes through an object array
I've got an array of objects, some of which use an extended version which
contains a function not available in the base class. How can I call that
function through the array when the array is defined by the base class?
Example
Shape[] shapes = new Shape[10];
shapes[0] = new Circle(10) //10 == radius, only exists in circle class
which extends Shape
shapes[0].getRadius(); //Gives me a compilation error as getRadius()
doesn't exist in the
Shape class, only in the extended Circle class. Is there a way around this?
I've got an array of objects, some of which use an extended version which
contains a function not available in the base class. How can I call that
function through the array when the array is defined by the base class?
Example
Shape[] shapes = new Shape[10];
shapes[0] = new Circle(10) //10 == radius, only exists in circle class
which extends Shape
shapes[0].getRadius(); //Gives me a compilation error as getRadius()
doesn't exist in the
Shape class, only in the extended Circle class. Is there a way around this?
Saturday, 10 August 2013
iphone connects devices on WIFI network
iphone connects devices on WIFI network
How do I use an iphone to discover and connect to other devices like a
printer or a wifi build-in light bulb on the same wifi network ? I read
through a lot of questions on stackoverflow, but seems like using Bonjour
and Gamekit that can only deal with device that can advertise itself like
an iphone, so in other words both devices can be able to see each other
only when they launch the same application, but is there something else
that we can use to discover and find wifi build-in device and connect to
them ?
How do I use an iphone to discover and connect to other devices like a
printer or a wifi build-in light bulb on the same wifi network ? I read
through a lot of questions on stackoverflow, but seems like using Bonjour
and Gamekit that can only deal with device that can advertise itself like
an iphone, so in other words both devices can be able to see each other
only when they launch the same application, but is there something else
that we can use to discover and find wifi build-in device and connect to
them ?
MultiChoiseModeListener methods are never called
MultiChoiseModeListener methods are never called
I have ListView with custom adapter. In activity onCreate() method I set
ListView choice mode to MULTIPLE_CHOISE_MODAL and provide it with
MultiChoiseModeListener implementation I wrote. The problem is listener
methods never get called, except the constructor. Long-clicking just
triggers listview item onClick() method, instead of triggering
onCreateActionMode or anything.
I tried using SimpleCursorAdapter instead of my custom adapter and using
simple_list_item_1 instead if my item layout, has not helped much, methods
are still silent.
So, can anybody provide any ideas what can be causing this issue?
I have ListView with custom adapter. In activity onCreate() method I set
ListView choice mode to MULTIPLE_CHOISE_MODAL and provide it with
MultiChoiseModeListener implementation I wrote. The problem is listener
methods never get called, except the constructor. Long-clicking just
triggers listview item onClick() method, instead of triggering
onCreateActionMode or anything.
I tried using SimpleCursorAdapter instead of my custom adapter and using
simple_list_item_1 instead if my item layout, has not helped much, methods
are still silent.
So, can anybody provide any ideas what can be causing this issue?
Friday, 9 August 2013
Efficiency of infinite loop to service GPIO
Efficiency of infinite loop to service GPIO
I'm using Python on Raspbian (a type of linux) on the Raspberry Pi (an
embedded processor board) to monitor GPIO inputs.
See simplified version of my code below. I have an infinite loop in the
python script waiting for something to happen on a GPIO i/p. Is this the
correct way to do it? I.e. does this mean that the CPU is running at full
whack just going round this loop, leaving no CPU cycles for other stuff?
Especially as I need to be running other things in parallel (e.g. the
browser).
Also what happens if the CPU is busy doing something else and a GPIO i/p
changes? Does the GPIO event get stored somewhere so it is eventually
serviced, or does it just get lost?
Is there a better way of doing this?
(For your answers, please note that I'm new to linux, and v. new to python
and real-time programming)
#!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def ButtonHandler(channel):
print "Button pressed " + str(channel)
# do stuff here
GPIO.add_event_detect(16, GPIO.FALLING, callback=ButtonHandler,
bouncetime=200)
while True:
pass
I'm using Python on Raspbian (a type of linux) on the Raspberry Pi (an
embedded processor board) to monitor GPIO inputs.
See simplified version of my code below. I have an infinite loop in the
python script waiting for something to happen on a GPIO i/p. Is this the
correct way to do it? I.e. does this mean that the CPU is running at full
whack just going round this loop, leaving no CPU cycles for other stuff?
Especially as I need to be running other things in parallel (e.g. the
browser).
Also what happens if the CPU is busy doing something else and a GPIO i/p
changes? Does the GPIO event get stored somewhere so it is eventually
serviced, or does it just get lost?
Is there a better way of doing this?
(For your answers, please note that I'm new to linux, and v. new to python
and real-time programming)
#!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def ButtonHandler(channel):
print "Button pressed " + str(channel)
# do stuff here
GPIO.add_event_detect(16, GPIO.FALLING, callback=ButtonHandler,
bouncetime=200)
while True:
pass
Getting tableView to scroll as one with parent scrollView after being added with addChildViewController
Getting tableView to scroll as one with parent scrollView after being
added with addChildViewController
I'm working through a tutorial on child view controllers in RubyMotion.
(What I'm trying to do is create a tabbed interface in the likes of
Instagram's profile pages.) I have things working, however my problem is
that my container has a scrollView and the child I'm adding is a
tableView, which is itself a scrollView. The two scroll independent of
each other, where I'd like them to scroll as one. Is there a way I can do
that given my code below?
My container:
class ProfileController < SharedController
def viewDidLoad
super
scroll_frame = self.view.bounds
@scroll = UIScrollView.alloc.initWithFrame(scroll_frame)
@scroll.bounces = true
@scroll.delegate = self
@scroll.alwaysBounceVertical = true
@scroll.contentSize =
CGSizeMake(UIScreen.mainScreen.bounds.size.width,
scroll_frame.size.height)
main_container = UIViewController.alloc.init
self.push(main_container)
end
def tap_child(sender)
set_active_tab(sender)
controller =
ChildPartialController.alloc.initWithNibName(nil, bundle:nil)
controller.data = @data[:child]
controller.parent = self
controller.scroll_view = @scroll
self.push(controller)
end
end
The child:
class ChildPartialController < SharedController
attr_accessor :data, :scroll_view, :parent
def viewDidAppear(animated)
scroll_view.contentSize =
CGSizeMake(UIScreen.mainScreen.bounds.size.width, 272)
end
def viewDidLoad
super
self.title = "Cred"
@data = data
@table = UITableView.alloc.initWithFrame(
CGRectMake(0, parent.tab_bar.frame.origin.y +
parent.tab_bar.frame.size.height, self.view.bounds.size.width,
self.view.bounds.size.height),
style: UITableViewStyleGrouped
)
@table.autoresizingMask = UIViewAutoresizingFlexibleHeight
@table.rowHeight = 30
parent.view.addSubview(@table)
@table.dataSource = self
@table.delegate = self
end
end
SharedCode:
class SharedController < UIViewController
def push(to_vc, animated = false)
from_vc = self.stack[-1] # could be nil
self.stack.pop if self.stack.count > 1
self.stack.push(to_vc)
self.addChildViewController(to_vc)
post_animate = lambda { |finished|
to_vc.didMoveToParentViewController(self)
to_vc.viewDidAppear(animated)
}
if !from_vc.nil?
to_vc.view.frame = child_frame
to_vc.viewWillAppear(animated)
end
@scroll.addSubview(to_vc.view)
post_animate.call(true)
p self.stack.count
end
def child_height
self.view.bounds.size.height - 232
end
def child_width
self.view.bounds.size.width
end
def child_frame
CGRectMake(0, self.tab_bar.frame.origin.y +
self.tab_bar.frame.size.height + 10, child_width, child_height)
end
def offscreen_top_frame
CGRectMake(0, 50 - child_height, child_width, child_height)
end
def offscreen_bottom_frame
CGRectMake(0, self.view.bounds.size.height, child_width, child_height)
end
end
added with addChildViewController
I'm working through a tutorial on child view controllers in RubyMotion.
(What I'm trying to do is create a tabbed interface in the likes of
Instagram's profile pages.) I have things working, however my problem is
that my container has a scrollView and the child I'm adding is a
tableView, which is itself a scrollView. The two scroll independent of
each other, where I'd like them to scroll as one. Is there a way I can do
that given my code below?
My container:
class ProfileController < SharedController
def viewDidLoad
super
scroll_frame = self.view.bounds
@scroll = UIScrollView.alloc.initWithFrame(scroll_frame)
@scroll.bounces = true
@scroll.delegate = self
@scroll.alwaysBounceVertical = true
@scroll.contentSize =
CGSizeMake(UIScreen.mainScreen.bounds.size.width,
scroll_frame.size.height)
main_container = UIViewController.alloc.init
self.push(main_container)
end
def tap_child(sender)
set_active_tab(sender)
controller =
ChildPartialController.alloc.initWithNibName(nil, bundle:nil)
controller.data = @data[:child]
controller.parent = self
controller.scroll_view = @scroll
self.push(controller)
end
end
The child:
class ChildPartialController < SharedController
attr_accessor :data, :scroll_view, :parent
def viewDidAppear(animated)
scroll_view.contentSize =
CGSizeMake(UIScreen.mainScreen.bounds.size.width, 272)
end
def viewDidLoad
super
self.title = "Cred"
@data = data
@table = UITableView.alloc.initWithFrame(
CGRectMake(0, parent.tab_bar.frame.origin.y +
parent.tab_bar.frame.size.height, self.view.bounds.size.width,
self.view.bounds.size.height),
style: UITableViewStyleGrouped
)
@table.autoresizingMask = UIViewAutoresizingFlexibleHeight
@table.rowHeight = 30
parent.view.addSubview(@table)
@table.dataSource = self
@table.delegate = self
end
end
SharedCode:
class SharedController < UIViewController
def push(to_vc, animated = false)
from_vc = self.stack[-1] # could be nil
self.stack.pop if self.stack.count > 1
self.stack.push(to_vc)
self.addChildViewController(to_vc)
post_animate = lambda { |finished|
to_vc.didMoveToParentViewController(self)
to_vc.viewDidAppear(animated)
}
if !from_vc.nil?
to_vc.view.frame = child_frame
to_vc.viewWillAppear(animated)
end
@scroll.addSubview(to_vc.view)
post_animate.call(true)
p self.stack.count
end
def child_height
self.view.bounds.size.height - 232
end
def child_width
self.view.bounds.size.width
end
def child_frame
CGRectMake(0, self.tab_bar.frame.origin.y +
self.tab_bar.frame.size.height + 10, child_width, child_height)
end
def offscreen_top_frame
CGRectMake(0, 50 - child_height, child_width, child_height)
end
def offscreen_bottom_frame
CGRectMake(0, self.view.bounds.size.height, child_width, child_height)
end
end
checking network reachability at a particular instant
checking network reachability at a particular instant
When the user presses a button, I need to know whether the device is
connected to the internet at that very instant--not whether he was
connected 3 seconds ago. The reachability (tonymillion) notifier takes
about that long to update.
I thought that I would be able to check for actual access using the
following methods:
if (!([[Reachability reachabilityWithHostname:@"www.google.com"]
currentReachabilityStatus] == NotReachable)) NSLog(@"reachable");
if ([[Reachability reachabilityWithHostname:@"www.google.com"]
currentReachabilityStatus] == NotReachable) NSLog(@"not reachable");
But results indicated that in fact currentReachabilityStatus does not
perform an actual network check; it only checks the same flag that is
updated with ~3 seconds' delay.
What's an efficient way of actually checking for network access on the spot?
When the user presses a button, I need to know whether the device is
connected to the internet at that very instant--not whether he was
connected 3 seconds ago. The reachability (tonymillion) notifier takes
about that long to update.
I thought that I would be able to check for actual access using the
following methods:
if (!([[Reachability reachabilityWithHostname:@"www.google.com"]
currentReachabilityStatus] == NotReachable)) NSLog(@"reachable");
if ([[Reachability reachabilityWithHostname:@"www.google.com"]
currentReachabilityStatus] == NotReachable) NSLog(@"not reachable");
But results indicated that in fact currentReachabilityStatus does not
perform an actual network check; it only checks the same flag that is
updated with ~3 seconds' delay.
What's an efficient way of actually checking for network access on the spot?
ArrayList select coordinates, if there are less clients than coordinates, give each client a coordinate
ArrayList select coordinates, if there are less clients than coordinates,
give each client a coordinate
Coordinate[] coords = {
new Coordinate(3093, 3630), new Coordinate(3095, 3632), new
Coordinate(3098, 3633),
new Coordinate(3101, 3633), new Coordinate(3104, 3631), new
Coordinate(3106, 3629),
new Coordinate(3107, 3627), new Coordinate(3108, 3624), new
Coordinate(3109, 3620),
new Coordinate(3108, 3617), new Coordinate(3106, 3614), new
Coordinate(3102, 3613),
new Coordinate(3099, 3613), new Coordinate(3097, 3613), new
Coordinate(3093, 3614),
new Coordinate(3090, 3617), new Coordinate(3087, 3619)
};
int random = Misc.random(coords.length - 1);
Coordinate coord = coords[random];
boolean found = false;
if (insidePlayers.size() < coords.length) {
if (spawnPoints.contains(coord)) {
found = false;
}
while (!found) {
random = Misc.random(coords.length - 1);
coord = coords[random];
if (!spawnPoints.contains(coord)) {
player.spawnPointX = coords[random].getX();
player.spawnPointY = coords[random].getY();
spawnPoints.add(coord);
found = true;
break;
}
}
}
else {
player.spawnPointX = coords[random].getX();
player.spawnPointX = coords[random].getY();
}
Basically what I am trying to do here is, if there are more clients than
available coordinates (spots), then give each player his own coordinate
(So other clients can't have the same coords).
But unfortunately it doesn't work, sometimes clients are getting the same
coordinates. Why is it happening? what did I do wrong?
Coordinate class:
public class Coordinate {
private int x = 0;
private int y = 0;
public Coordinate(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
}
ArrayList:
public static ArrayList<Coordinate> spawnPoints = new
ArrayList<Coordinate>();
So what's wrong there?
give each client a coordinate
Coordinate[] coords = {
new Coordinate(3093, 3630), new Coordinate(3095, 3632), new
Coordinate(3098, 3633),
new Coordinate(3101, 3633), new Coordinate(3104, 3631), new
Coordinate(3106, 3629),
new Coordinate(3107, 3627), new Coordinate(3108, 3624), new
Coordinate(3109, 3620),
new Coordinate(3108, 3617), new Coordinate(3106, 3614), new
Coordinate(3102, 3613),
new Coordinate(3099, 3613), new Coordinate(3097, 3613), new
Coordinate(3093, 3614),
new Coordinate(3090, 3617), new Coordinate(3087, 3619)
};
int random = Misc.random(coords.length - 1);
Coordinate coord = coords[random];
boolean found = false;
if (insidePlayers.size() < coords.length) {
if (spawnPoints.contains(coord)) {
found = false;
}
while (!found) {
random = Misc.random(coords.length - 1);
coord = coords[random];
if (!spawnPoints.contains(coord)) {
player.spawnPointX = coords[random].getX();
player.spawnPointY = coords[random].getY();
spawnPoints.add(coord);
found = true;
break;
}
}
}
else {
player.spawnPointX = coords[random].getX();
player.spawnPointX = coords[random].getY();
}
Basically what I am trying to do here is, if there are more clients than
available coordinates (spots), then give each player his own coordinate
(So other clients can't have the same coords).
But unfortunately it doesn't work, sometimes clients are getting the same
coordinates. Why is it happening? what did I do wrong?
Coordinate class:
public class Coordinate {
private int x = 0;
private int y = 0;
public Coordinate(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
}
ArrayList:
public static ArrayList<Coordinate> spawnPoints = new
ArrayList<Coordinate>();
So what's wrong there?
modal inside an ng-repeat directive causes crash
modal inside an ng-repeat directive causes crash
i am trying to put inside a table abutton that will open a modal. but no
matter which button i click it seems that it tries to open it many times.
i have put the openModal and closeModal inside the main controller. i
believe the problem might be because i am using it inside an ng-repeat?
but in any case i do not know what is going wrong. what am i doing wrong?
i am using this modal:
http://angular-ui.github.io/bootstrap/#/modal
the html code:
<div class="row">
<div class="span4" ng-repeat="court in courts">
<table class="table table-condensed table-bordered table-hover">
<caption><h4>court {{court.records[0].id}}<h4></caption>
<tr>
<th style='text-align:center'>Hour</th>
<th style='text-align:center'>Player 1</th>
<th style='text-align:center'>Player 2</th>
<th></th>
</tr>
<tr ng-repeat="record in court.records">
<td width="50" >{{record.hour}}</td>
<td ng-style="user1Payed(record)" style='text-align:center'></td>
<td ng-style="user2Payed(record)" style='text-align:center'></td>
<td> <!-- options button -->
<button class="btn" ng-click="openModal()">Open me!</button>
<div modal="shouldBeOpen" close="closeModal()" options="opts">
<div class="modal-header">
<h3>I'm a modal!</h3>
</div>
<div class="modal-body">
<ul>
<li ng-repeat="item in items">{{item}}</li>
</ul>
</div>
<div class="modal-footer">
<button class="btn btn-warning cancel"
ng-click="closeModal()">Cancel</button>
</div>
</div>
</td> <!-- options button end -->
</tr>
</table>
</div>
</div>
and the controller code:
function CourtsController($scope, $window, $http, CourtsService, $timeout) {
$scope.openModal = function () {
$scope.shouldBeOpen = true;
};
$scope.closeModal = function () {
$scope.closeMsg = 'I was closed at: ' + new Date();
$scope.shouldBeOpen = false;
};
$scope.items = [
"Guest Payment",
"Member Payment",
"League (no payment)",
"no Payment"
];
$scope.opts = {
backdropFade: true,
dialogFade:true
};
i am trying to put inside a table abutton that will open a modal. but no
matter which button i click it seems that it tries to open it many times.
i have put the openModal and closeModal inside the main controller. i
believe the problem might be because i am using it inside an ng-repeat?
but in any case i do not know what is going wrong. what am i doing wrong?
i am using this modal:
http://angular-ui.github.io/bootstrap/#/modal
the html code:
<div class="row">
<div class="span4" ng-repeat="court in courts">
<table class="table table-condensed table-bordered table-hover">
<caption><h4>court {{court.records[0].id}}<h4></caption>
<tr>
<th style='text-align:center'>Hour</th>
<th style='text-align:center'>Player 1</th>
<th style='text-align:center'>Player 2</th>
<th></th>
</tr>
<tr ng-repeat="record in court.records">
<td width="50" >{{record.hour}}</td>
<td ng-style="user1Payed(record)" style='text-align:center'></td>
<td ng-style="user2Payed(record)" style='text-align:center'></td>
<td> <!-- options button -->
<button class="btn" ng-click="openModal()">Open me!</button>
<div modal="shouldBeOpen" close="closeModal()" options="opts">
<div class="modal-header">
<h3>I'm a modal!</h3>
</div>
<div class="modal-body">
<ul>
<li ng-repeat="item in items">{{item}}</li>
</ul>
</div>
<div class="modal-footer">
<button class="btn btn-warning cancel"
ng-click="closeModal()">Cancel</button>
</div>
</div>
</td> <!-- options button end -->
</tr>
</table>
</div>
</div>
and the controller code:
function CourtsController($scope, $window, $http, CourtsService, $timeout) {
$scope.openModal = function () {
$scope.shouldBeOpen = true;
};
$scope.closeModal = function () {
$scope.closeMsg = 'I was closed at: ' + new Date();
$scope.shouldBeOpen = false;
};
$scope.items = [
"Guest Payment",
"Member Payment",
"League (no payment)",
"no Payment"
];
$scope.opts = {
backdropFade: true,
dialogFade:true
};
Subscribe to:
Comments (Atom)