Pyramid PostgreSQL basic example
I can't find any examples of PostgreSQL being used with Pyramid, I'd like
to see an example showing how to get a simple CRUD application running.
Saturday, 31 August 2013
My NSString data didnt tranfer over to a view controller
My NSString data didnt tranfer over to a view controller
In my App I'm using a Navigation controller. My problem is, when I go to
previous view (using the generated navigation back button) my NSString
data doesn't transfer over. I don't know how to save these NSString values
when I navigate through the stack from navigation controller.I need to
send an email with these NSString values.
This is my original view controller before pushing back button
-(void)button{
NSString *dd = @"text";
viewcontroller.string = dd;
}
This is the previous controller after pushing the back button (view
controller) .h
@property (strong,nonatomic) NSString *string;
.m
NSString *emailBody = [NSString stringWithFormat:@"%@ ",
string];
In my App I'm using a Navigation controller. My problem is, when I go to
previous view (using the generated navigation back button) my NSString
data doesn't transfer over. I don't know how to save these NSString values
when I navigate through the stack from navigation controller.I need to
send an email with these NSString values.
This is my original view controller before pushing back button
-(void)button{
NSString *dd = @"text";
viewcontroller.string = dd;
}
This is the previous controller after pushing the back button (view
controller) .h
@property (strong,nonatomic) NSString *string;
.m
NSString *emailBody = [NSString stringWithFormat:@"%@ ",
string];
Grab information from a php script and display on a winform
Grab information from a php script and display on a winform
I have a php script that returns a list of file directories held at the
root of a remote server that I need to display in my winform application.
For example if I put the link in my browser it returns something like the
following:
511157.jpg|Koala.jpg|VIDEO0031.3gp|Test_Folder.folder
However, I have never accessed a php script through a C# application
before and nor have I displayed the information it may hold.
Is there a best practice for being able to connect and grab the
information via a php script? Could someone please point me in the right
direction to achieve what I would like to achieve.
I have a php script that returns a list of file directories held at the
root of a remote server that I need to display in my winform application.
For example if I put the link in my browser it returns something like the
following:
511157.jpg|Koala.jpg|VIDEO0031.3gp|Test_Folder.folder
However, I have never accessed a php script through a C# application
before and nor have I displayed the information it may hold.
Is there a best practice for being able to connect and grab the
information via a php script? Could someone please point me in the right
direction to achieve what I would like to achieve.
How do I write Ruby's each_cons in Clojure?
How do I write Ruby's each_cons in Clojure?
How can I rewrite this Ruby code in Clojure?
seq = [1, 2, 3, 4, 5].each_cons(2)
#=> lazy Enumerable of pairs
seq.to_a
=> [[1, 2], [2, 3], [3, 4], [4, 5]]
Clojure:
(??? 2 [1 2 3 4 5])
;=> lazy seq of [1 2] [2 3] [3 4] [4 5]
How can I rewrite this Ruby code in Clojure?
seq = [1, 2, 3, 4, 5].each_cons(2)
#=> lazy Enumerable of pairs
seq.to_a
=> [[1, 2], [2, 3], [3, 4], [4, 5]]
Clojure:
(??? 2 [1 2 3 4 5])
;=> lazy seq of [1 2] [2 3] [3 4] [4 5]
Python loop efficiency
Python loop efficiency
I was just wondering if there is a more cpu efficient way of writing the
following loop as I need to speed my program up?
for char in data:
if char in self.key:
match += chr(self.key.index(char))
Thanks in advance for any help, Clinton.
I was just wondering if there is a more cpu efficient way of writing the
following loop as I need to speed my program up?
for char in data:
if char in self.key:
match += chr(self.key.index(char))
Thanks in advance for any help, Clinton.
Timer not starting in vb.net
Timer not starting in vb.net
net program that uses excel as a datasource. I then fill a datagridview
with this datasource and make changes to the dataset via the datagridview.
I'm trying to find a way to refresh this dataset via a button that will
update the values after a change. My only problem is that I'm trying to
set up a timer in my refresh method but it never initializes/starts. I
can't figure out why, from what I've found online the way to start a timer
in vb.net is to set the timer variable to enabled = true. I've stepped
into my debugger and found that the timer never starts. Here is my code
below, if there is anyone who can figure out why this timer isn't starting
I would greatly appreciate your help!
Dim mytimer As New System.Timers.Timer
Sub refresh()
write2Size()
mytimer.timer = New System.Timers.Timer(20000)
'Starting Timer
mytimer.Enabled = True
Cursor.Current = Cursors.WaitCursor
AddHandler mytimer.Elapsed, AddressOf OnTimedEvent
'Setting the cursor back to normal here
Cursor.Current = Cursors.Default
mytimer.Enabled = False
objworkbook.Save()
objExcel.ActiveWorkbook.Save()
myDS.Clear()
retrieveUpdate()
End Sub
Private Shared Sub OnTimedEvent(source As Object, e As ElapsedEventArgs)
Console.WriteLine("The Elapsed event was raised at {0}, e.SignalTime)
End Sub
net program that uses excel as a datasource. I then fill a datagridview
with this datasource and make changes to the dataset via the datagridview.
I'm trying to find a way to refresh this dataset via a button that will
update the values after a change. My only problem is that I'm trying to
set up a timer in my refresh method but it never initializes/starts. I
can't figure out why, from what I've found online the way to start a timer
in vb.net is to set the timer variable to enabled = true. I've stepped
into my debugger and found that the timer never starts. Here is my code
below, if there is anyone who can figure out why this timer isn't starting
I would greatly appreciate your help!
Dim mytimer As New System.Timers.Timer
Sub refresh()
write2Size()
mytimer.timer = New System.Timers.Timer(20000)
'Starting Timer
mytimer.Enabled = True
Cursor.Current = Cursors.WaitCursor
AddHandler mytimer.Elapsed, AddressOf OnTimedEvent
'Setting the cursor back to normal here
Cursor.Current = Cursors.Default
mytimer.Enabled = False
objworkbook.Save()
objExcel.ActiveWorkbook.Save()
myDS.Clear()
retrieveUpdate()
End Sub
Private Shared Sub OnTimedEvent(source As Object, e As ElapsedEventArgs)
Console.WriteLine("The Elapsed event was raised at {0}, e.SignalTime)
End Sub
Store reference to another element on a jQuery object with the $.data()
Store reference to another element on a jQuery object with the $.data()
For my plugin, for simplifying the code (not as an absolute necessity) and
reducing unnecessary duplicate jQuery selector method calls, I wish to use
the $.data() jQuery method to link nodes together:
JavaScript
// This is all wrapped in a dom ready function
$('.main-nav > ul > li > a').each(function(edx, anchor){
var $anchor = $(anchor),
targetID = anchor.href, // eg. '#example-div-id'
$target = $(targetID);
// Bind together
$.data( $anchor, 'myTarget', $target );
$.data( $target, 'myTrigger', $anchor );
// Here a console.log() outputs the correct node for either of the above
// console.log( $.data( $target, 'myTrigger') );
//=> [<a href="#example-div-id">Example</a>]
});
// So that later in other methods I can use the following
// ... set $exampleTarget to a node depending on some state
var trigger = $.data( $exampleTarget, 'myTrigger' );
// Desired output of a console.log(trigger);
//=> [<a href="#example-div-id">Example</a>]
// Actual output
//=> undefined
So could someone please explain this behaviour regarding $.data().
For my plugin, for simplifying the code (not as an absolute necessity) and
reducing unnecessary duplicate jQuery selector method calls, I wish to use
the $.data() jQuery method to link nodes together:
JavaScript
// This is all wrapped in a dom ready function
$('.main-nav > ul > li > a').each(function(edx, anchor){
var $anchor = $(anchor),
targetID = anchor.href, // eg. '#example-div-id'
$target = $(targetID);
// Bind together
$.data( $anchor, 'myTarget', $target );
$.data( $target, 'myTrigger', $anchor );
// Here a console.log() outputs the correct node for either of the above
// console.log( $.data( $target, 'myTrigger') );
//=> [<a href="#example-div-id">Example</a>]
});
// So that later in other methods I can use the following
// ... set $exampleTarget to a node depending on some state
var trigger = $.data( $exampleTarget, 'myTrigger' );
// Desired output of a console.log(trigger);
//=> [<a href="#example-div-id">Example</a>]
// Actual output
//=> undefined
So could someone please explain this behaviour regarding $.data().
Friday, 30 August 2013
Combining Similar Data - Arrays in PHP
Combining Similar Data - Arrays in PHP
I have a 2d array such as the following:
Jan 1, 10
Jan 2, 20
Jan 2, 15
Jan 3, 20
Jan 3, 10
Jan 3, 5
And i need to create a way to scan this array, and add the numbers for
similar dates into a new array, so that:
Jan 1, 10
Jan 2, 35
Jan 3, 35
What is the quickest way to accomplish this? Thank you!
I have a 2d array such as the following:
Jan 1, 10
Jan 2, 20
Jan 2, 15
Jan 3, 20
Jan 3, 10
Jan 3, 5
And i need to create a way to scan this array, and add the numbers for
similar dates into a new array, so that:
Jan 1, 10
Jan 2, 35
Jan 3, 35
What is the quickest way to accomplish this? Thank you!
Thursday, 29 August 2013
Spacing in HTML or css
Spacing in HTML or css
i am an oracle guy but i came cross a task that require writing HTML or
CSS code
my question is how can i make spaces or set the positioning
my task is to make the page look like this
report1 13 tabs space report2 report3 13 tabs space report4 report5 13
tabs space report6
please be as detailed as much as you can because as i have told you am an
oracle guy that dont have a clue about HTML
Thanks in Advance
i am an oracle guy but i came cross a task that require writing HTML or
CSS code
my question is how can i make spaces or set the positioning
my task is to make the page look like this
report1 13 tabs space report2 report3 13 tabs space report4 report5 13
tabs space report6
please be as detailed as much as you can because as i have told you am an
oracle guy that dont have a clue about HTML
Thanks in Advance
Reordering divs responsively with Twitter Bootstrap?
Reordering divs responsively with Twitter Bootstrap?
I am working with Twitter Bootstrap v3 and want to reorder elements
responsively, using column ordering and offsetting.
This is how I would like to use my elements. At -xs or -sm breakpoints,
with the containing div stacked 4 to a row:
At -md or -lg breakpoints, with the containing div stacked 2 to a row:
This is the current code - I know how to set the classes on the containing
div, but not on A, B and C:
<div class="row">
<div class="containing col-xs-6 col-sm-6 col-md-3 col-lg-3">
<div class="row">
<div class="a col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
A</div>
<div class="b col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
B</div>
<div class="c col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
C</div>
</div>
</div>
... more containing divs...
</div>
I can't figure out how to get A, B and C in the right order with Bootstrap
3's column ordering and offsetting. Is it actually possible?
This is as far as I've got using JSFiddle: http://jsfiddle.net/3vYgR/
I am working with Twitter Bootstrap v3 and want to reorder elements
responsively, using column ordering and offsetting.
This is how I would like to use my elements. At -xs or -sm breakpoints,
with the containing div stacked 4 to a row:
At -md or -lg breakpoints, with the containing div stacked 2 to a row:
This is the current code - I know how to set the classes on the containing
div, but not on A, B and C:
<div class="row">
<div class="containing col-xs-6 col-sm-6 col-md-3 col-lg-3">
<div class="row">
<div class="a col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
A</div>
<div class="b col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
B</div>
<div class="c col-xs-12 col-sm-12 col-md-6 col-lg-6">Content of
C</div>
</div>
</div>
... more containing divs...
</div>
I can't figure out how to get A, B and C in the right order with Bootstrap
3's column ordering and offsetting. Is it actually possible?
This is as far as I've got using JSFiddle: http://jsfiddle.net/3vYgR/
Project Structure using CastleWindsor
Project Structure using CastleWindsor
I have a solution which is made up of several projects such as: DataLayer
(Contains the EntityFramework), UnitTests, WebForms(Contains the MVP),
CommonClasses (Contains common services classes).
Would you implement a single container for all of these projects, which is
in a separate class-library application?
Or would you simply have a separate Windsor setup to handle dependencies
within each one alone, but what if there is inner dependency between the
individual projects.
Thanks.
I have a solution which is made up of several projects such as: DataLayer
(Contains the EntityFramework), UnitTests, WebForms(Contains the MVP),
CommonClasses (Contains common services classes).
Would you implement a single container for all of these projects, which is
in a separate class-library application?
Or would you simply have a separate Windsor setup to handle dependencies
within each one alone, but what if there is inner dependency between the
individual projects.
Thanks.
Wednesday, 28 August 2013
How do I give all list items a max-width without having all of them fill that width
How do I give all list items a max-width without having all of them fill
that width
http://cdpn.io/gsDHK
Link to Codepen ^
I have a problem with this list. I need to break the words at a certain
point on all of these, but I am unable to change the HTML within the list
items.
I set a max-width of 72px on each list item. But Now they are all 72px
wide. They should be auto width with a max width of 72px. The white space
on either side of each list item has to be even. As you can see on the
Learning Center link, there is more white space than on the others.
that width
http://cdpn.io/gsDHK
Link to Codepen ^
I have a problem with this list. I need to break the words at a certain
point on all of these, but I am unable to change the HTML within the list
items.
I set a max-width of 72px on each list item. But Now they are all 72px
wide. They should be auto width with a max width of 72px. The white space
on either side of each list item has to be even. As you can see on the
Learning Center link, there is more white space than on the others.
Null Pointer exception and intent error
Null Pointer exception and intent error
My App Always crash whenever I click on a button... the button gets text
from an edittext, and i believe that that is why i have a null pointer
exception. First question: how can i check if the editText is empty? I
already tried .equals(""), .equals(null), same with matches, and .lenght
== 0 Second, when i try to call the intent for my listActivity class i get
a handling error. (Activity not found. No activity to handle.) Ill give
you my onClickListener
ON CLICK LISTENER
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
searchInEnglish = rSearchEnglish.isChecked();
searchInDovahzul = rSearchDovahzul.isChecked();
searchBox = (EditText) findViewById(R.id.tvSearch);
if (searchBox.getText().toString().equals("")){
if (searchInEnglish) {
int counter = 0;
for (int i = 0; i < englishArray.length; i++) {
if
(englishArray[i].contains(searchBox.getText()))
{
counter++;
Intent search = new Intent(
"net.fernandezgodinho.pedro.dovahzuldictionary.SEARCHLIST");
startActivity(search);
}
}
setFinalSearch(searchResultsEnglish);
}
if (searchInDovahzul = true) {
int counter = 0;
for (int i = 0; i < dovahzulArray.length; i++) {
if
(dovahzulArray[i].contains(searchBox.getText()))
{
counter++;
Intent search = new Intent(
"net.fernandezgodinho.pedro.dovahzuldictionary.SEARCHLIST");
startActivity(search);
}
}
}
} else {
Toast.makeText(MainActivity.this, "Please use at least
two characters", Toast.LENGTH_LONG).show();
}
}
});
My App Always crash whenever I click on a button... the button gets text
from an edittext, and i believe that that is why i have a null pointer
exception. First question: how can i check if the editText is empty? I
already tried .equals(""), .equals(null), same with matches, and .lenght
== 0 Second, when i try to call the intent for my listActivity class i get
a handling error. (Activity not found. No activity to handle.) Ill give
you my onClickListener
ON CLICK LISTENER
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
searchInEnglish = rSearchEnglish.isChecked();
searchInDovahzul = rSearchDovahzul.isChecked();
searchBox = (EditText) findViewById(R.id.tvSearch);
if (searchBox.getText().toString().equals("")){
if (searchInEnglish) {
int counter = 0;
for (int i = 0; i < englishArray.length; i++) {
if
(englishArray[i].contains(searchBox.getText()))
{
counter++;
Intent search = new Intent(
"net.fernandezgodinho.pedro.dovahzuldictionary.SEARCHLIST");
startActivity(search);
}
}
setFinalSearch(searchResultsEnglish);
}
if (searchInDovahzul = true) {
int counter = 0;
for (int i = 0; i < dovahzulArray.length; i++) {
if
(dovahzulArray[i].contains(searchBox.getText()))
{
counter++;
Intent search = new Intent(
"net.fernandezgodinho.pedro.dovahzuldictionary.SEARCHLIST");
startActivity(search);
}
}
}
} else {
Toast.makeText(MainActivity.this, "Please use at least
two characters", Toast.LENGTH_LONG).show();
}
}
});
Tuesday, 27 August 2013
Ruby Page object Gem - Unable to pick a platform for the provided browser (RuntimeError)
Ruby Page object Gem - Unable to pick a platform for the provided browser
(RuntimeError)
I get this error on running my feature file.
Unable to pick a platform for the provided browser (RuntimeError)
Help required, please.
Here is the code;
class GooglePage include PageObject
def self.visitor visit("http://www.google.com") end
end
env.rb
require 'selenium-webdriver' require 'page-object' require 'rubygems'
require 'page-object/page_factory'
World (PageObject::PageFactory) @browser = Selenium::WebDriver.for :firefox
Step-Definitions
require_relative 'GooglePage'
Given(/^I am on the Google home page$/) do
visit(GooglePage) # visit('http://www.google.com')
on(GooglePage).visitor end
(RuntimeError)
I get this error on running my feature file.
Unable to pick a platform for the provided browser (RuntimeError)
Help required, please.
Here is the code;
class GooglePage include PageObject
def self.visitor visit("http://www.google.com") end
end
env.rb
require 'selenium-webdriver' require 'page-object' require 'rubygems'
require 'page-object/page_factory'
World (PageObject::PageFactory) @browser = Selenium::WebDriver.for :firefox
Step-Definitions
require_relative 'GooglePage'
Given(/^I am on the Google home page$/) do
visit(GooglePage) # visit('http://www.google.com')
on(GooglePage).visitor end
How can I integrate data on regular bases between 2 different MySQL Servers?
How can I integrate data on regular bases between 2 different MySQL Servers?
I currently have 2 MySQL Serve running on a different machines. Once of
them is a staging environment (A) and another is a production environment
(B). What I need to do is to take data from (A) and update/insert into B
based on the conditions. If MySQL had Linked option then I can simply
create a stored procedure that does the work for me and that would solve
my whole problem. Unfortunately a great product like MySQL does not have
this necessary future.
But since I can't write a procedure to do that what application I can use
that will do the integration for me? note this integration will need to be
automatic so it can be done daily and sometimes hourly.
My question is there an integration application out there that will
integrate data from on MySQL Server to another automatically?
Thanks
I currently have 2 MySQL Serve running on a different machines. Once of
them is a staging environment (A) and another is a production environment
(B). What I need to do is to take data from (A) and update/insert into B
based on the conditions. If MySQL had Linked option then I can simply
create a stored procedure that does the work for me and that would solve
my whole problem. Unfortunately a great product like MySQL does not have
this necessary future.
But since I can't write a procedure to do that what application I can use
that will do the integration for me? note this integration will need to be
automatic so it can be done daily and sometimes hourly.
My question is there an integration application out there that will
integrate data from on MySQL Server to another automatically?
Thanks
javascript init an object without the new keyword
javascript init an object without the new keyword
What's the difference between:
function Foo(){} var foo1 = Foo();
and
var foo2 = new Foo()
As far as I tested, foo1 gives nothing. typeof foo1 is undefined while
with new it's ok as expected.
What's the reason the that without the new keyword I get the undefined
result?
What's the difference between:
function Foo(){} var foo1 = Foo();
and
var foo2 = new Foo()
As far as I tested, foo1 gives nothing. typeof foo1 is undefined while
with new it's ok as expected.
What's the reason the that without the new keyword I get the undefined
result?
Figure out if number is a minus or a positive number
Figure out if number is a minus or a positive number
Say I have a range which consists of "< -10" and I split this up using a
regex call which leaves me with '<' '-10'.
I then have a function which gets me the number from the split and I call
it like range1.getMin(), this would return '-10' but when I use
range1.getMin().indexOf('-') it doesn't work.
Say I have a range which consists of "< -10" and I split this up using a
regex call which leaves me with '<' '-10'.
I then have a function which gets me the number from the split and I call
it like range1.getMin(), this would return '-10' but when I use
range1.getMin().indexOf('-') it doesn't work.
Monday, 26 August 2013
how webcore interacts with graphics in case of any webkit based browsers?
how webcore interacts with graphics in case of any webkit based browsers?
how webcore interacts with graphics in case of any webkit based browsers?
I need to know the module separation between webcore and graphics part?
what are the exact messages delivered by webcore to graphics libraries and
how are they handled in them?
how webcore interacts with graphics in case of any webkit based browsers?
I need to know the module separation between webcore and graphics part?
what are the exact messages delivered by webcore to graphics libraries and
how are they handled in them?
MySQL missing databases
MySQL missing databases
I'm running MySQL 5.1 under Windows 7. If I start the MySQL Command Line
Client and type:
show databases;
it returns:
information_schema, aircraft_taxiing, dvd_collection, eqndb, mydb, mysql,
test and test_db
all of which are in the directory in my.ini:
datadir="C:/ProgramData/MySQL/MySQL Server 5.1/Data/"
If I open a command prompt window and type mysql it only gives
information_schema, test and test_db
What happened to the rest of the databases? I've been trying to connect
Python to MySQL using MySQLdb and can open any of the three databases, but
none of the missing ones. My goal is to make the Python connection in the
end, but I'd like to understand what's going on at the command prompt,
too.
Thanks.
I'm running MySQL 5.1 under Windows 7. If I start the MySQL Command Line
Client and type:
show databases;
it returns:
information_schema, aircraft_taxiing, dvd_collection, eqndb, mydb, mysql,
test and test_db
all of which are in the directory in my.ini:
datadir="C:/ProgramData/MySQL/MySQL Server 5.1/Data/"
If I open a command prompt window and type mysql it only gives
information_schema, test and test_db
What happened to the rest of the databases? I've been trying to connect
Python to MySQL using MySQLdb and can open any of the three databases, but
none of the missing ones. My goal is to make the Python connection in the
end, but I'd like to understand what's going on at the command prompt,
too.
Thanks.
array not saving input
array not saving input
hey back again with the same code, well edited so it works better. anyway
trying to add the button input into the array and that works. what doesn't
work is the fact every time i call the function do() the values reset due
to them being local. i tried to fix this by making it global(within the
class) using the self.store array. this didn't seem to fix the problem so
if someone could help would be much appreciated here is the relevant code
def __init__(self,master):#is the master for the button widgets
self.count=0
self.store=["0"]
frame=Frame(master)
frame.pack()
self.addition = Button(frame, text="+", command=self.add)#when
clicked sends a call back for a +
self.addition.pack()
self.subtraction = Button(frame, text="-", command=self.sub)#when
clicked sends a call back for a -
self.subtraction.pack()
self.equate = Button(frame, text="=", command=self.equate)#when
clicked sends a call back for a =
self.equate.pack()
self.one = Button(frame, text="1", command=self.one)#when clicked
sends a call back for a -
self.one.pack()
def add(self):
self.do("+")
self.count=self.count+1
def sub(self):
self.do("-")
self.count=self.count+1
def equate(self):
self.do("=")
def one(self):
self.do("1")
self.count=self.count+1
def do(self, X):#will hopefully colaborate all of the inputs
cont, num = True, 0
strstore="3 + 8"#temporarily used to make sure the calculating works
self.store=["2","1","+","2","3","4"]#holds the numbers used to calculate.
for num in range(1):
if X == "=":
cont = False
self.store[self.count]=X
print(self.store[self.count])
print(self.store[:])#test code
if cont == False:
print(self.eval_binary_expr(*(strstore.split())))
hey back again with the same code, well edited so it works better. anyway
trying to add the button input into the array and that works. what doesn't
work is the fact every time i call the function do() the values reset due
to them being local. i tried to fix this by making it global(within the
class) using the self.store array. this didn't seem to fix the problem so
if someone could help would be much appreciated here is the relevant code
def __init__(self,master):#is the master for the button widgets
self.count=0
self.store=["0"]
frame=Frame(master)
frame.pack()
self.addition = Button(frame, text="+", command=self.add)#when
clicked sends a call back for a +
self.addition.pack()
self.subtraction = Button(frame, text="-", command=self.sub)#when
clicked sends a call back for a -
self.subtraction.pack()
self.equate = Button(frame, text="=", command=self.equate)#when
clicked sends a call back for a =
self.equate.pack()
self.one = Button(frame, text="1", command=self.one)#when clicked
sends a call back for a -
self.one.pack()
def add(self):
self.do("+")
self.count=self.count+1
def sub(self):
self.do("-")
self.count=self.count+1
def equate(self):
self.do("=")
def one(self):
self.do("1")
self.count=self.count+1
def do(self, X):#will hopefully colaborate all of the inputs
cont, num = True, 0
strstore="3 + 8"#temporarily used to make sure the calculating works
self.store=["2","1","+","2","3","4"]#holds the numbers used to calculate.
for num in range(1):
if X == "=":
cont = False
self.store[self.count]=X
print(self.store[self.count])
print(self.store[:])#test code
if cont == False:
print(self.eval_binary_expr(*(strstore.split())))
Estimating remaining time for SKDownload
Estimating remaining time for SKDownload
I'm using Apple's hosting option for a reasonably large (800mb) in-app
purchase. The download works great but the "Time Remaining" property on
SKDownload is wildly incorrect (it varies between 2 seconds to 45 seconds
during the download, which obviously takes at least a couple of minutes in
reality).
Has anyone else experienced this and is there another way to reliable
estimate the download time?
I'm using Apple's hosting option for a reasonably large (800mb) in-app
purchase. The download works great but the "Time Remaining" property on
SKDownload is wildly incorrect (it varies between 2 seconds to 45 seconds
during the download, which obviously takes at least a couple of minutes in
reality).
Has anyone else experienced this and is there another way to reliable
estimate the download time?
How would I make an HTML-based application from existing Java code
How would I make an HTML-based application from existing Java code
I'm trying to make a web-based application that can retrieve, modify,
delete data, and add data to a relational database. I've created a simple
database and written up some Java code that can perform all of these
actions with the database.
However, one of the stipulations for the creation of this application is
that it must be HTML-based and cannot use Java applets, Flash,
Silverlight, or other plugins. Does that mean that I'll need to scrap all
of my code (along with all of my work), or is there some way that I can
adapt my code to fit within this constraint? Also, how would I go about
making this into a web app?
I'm trying to make a web-based application that can retrieve, modify,
delete data, and add data to a relational database. I've created a simple
database and written up some Java code that can perform all of these
actions with the database.
However, one of the stipulations for the creation of this application is
that it must be HTML-based and cannot use Java applets, Flash,
Silverlight, or other plugins. Does that mean that I'll need to scrap all
of my code (along with all of my work), or is there some way that I can
adapt my code to fit within this constraint? Also, how would I go about
making this into a web app?
Smarty array usage
Smarty array usage
I have this array :
Array
(
[Apple] => Array
(
[0] => Array
(
[id_device] => 1
[device_name] => iPhone 5
[device_brand] => Apple
)
[1] => Array
(
[id_device] => 2
[device_name] => iPhone 4/4S
[device_brand] => Apple
)
)
[Samsung] => Array
(
[0] => Array
(
[id_device] => 3
[device_name] => Galaxy S4
[device_brand] => Samsung
)
[1] => Array
(
[id_device] => 4
[device_name] => Galaxy S3
[device_brand] => Samsung
)
)
)
I'd like to generate with smarty a simple thing :
<div class="Apple">
<p rel="1">iPhone 5</p>
<p rel="2">iPhone 4/4S</p>
</div>
<div class="Samsung">
<p rel="3">Galaxy S4</p>
<p rel="4">Galaxy S3</p>
</div>
But I just can't make it, I'm quite mad tonight, two very simple problems
and an afternoon wasted ^^ (moreover I'm not really confident with arrays
yet). Could you just help me ?
Pleaaaase ^^
Thanks for reading anyway !
I have this array :
Array
(
[Apple] => Array
(
[0] => Array
(
[id_device] => 1
[device_name] => iPhone 5
[device_brand] => Apple
)
[1] => Array
(
[id_device] => 2
[device_name] => iPhone 4/4S
[device_brand] => Apple
)
)
[Samsung] => Array
(
[0] => Array
(
[id_device] => 3
[device_name] => Galaxy S4
[device_brand] => Samsung
)
[1] => Array
(
[id_device] => 4
[device_name] => Galaxy S3
[device_brand] => Samsung
)
)
)
I'd like to generate with smarty a simple thing :
<div class="Apple">
<p rel="1">iPhone 5</p>
<p rel="2">iPhone 4/4S</p>
</div>
<div class="Samsung">
<p rel="3">Galaxy S4</p>
<p rel="4">Galaxy S3</p>
</div>
But I just can't make it, I'm quite mad tonight, two very simple problems
and an afternoon wasted ^^ (moreover I'm not really confident with arrays
yet). Could you just help me ?
Pleaaaase ^^
Thanks for reading anyway !
Filter users by attribute
Filter users by attribute
This gives a list of UserPrincipals from our ActiveDirectory where Users
are in group "x":
var domainContext = new PrincipalContext(ContextType.Domain);
var groupPrincipal = GroupPrincipal.FindByIdentity(domainContext,
IdentityType.SamAccountName, "x");
Now how would I filter the users in this list by a custom attribute? All
users have an entry in the custom property "Building", and I want to the
list to contain only users from a certain building.
SOLUTION
stupid me ... cast the members from groupPrincipal to DirectoryEntry, then
access properties ..
foreach (var member in groupPrincipal.Members)
{
// maybe some try-catch ..
System.DirectoryServices.DirectoryEntry i =
(System.DirectoryServices.DirectoryEntry)member.GetUnderlyingObject();
if (i.Properties["building"].Value.toString() == "NSA HQ")
{
// Do stuff here
}
}
This gives a list of UserPrincipals from our ActiveDirectory where Users
are in group "x":
var domainContext = new PrincipalContext(ContextType.Domain);
var groupPrincipal = GroupPrincipal.FindByIdentity(domainContext,
IdentityType.SamAccountName, "x");
Now how would I filter the users in this list by a custom attribute? All
users have an entry in the custom property "Building", and I want to the
list to contain only users from a certain building.
SOLUTION
stupid me ... cast the members from groupPrincipal to DirectoryEntry, then
access properties ..
foreach (var member in groupPrincipal.Members)
{
// maybe some try-catch ..
System.DirectoryServices.DirectoryEntry i =
(System.DirectoryServices.DirectoryEntry)member.GetUnderlyingObject();
if (i.Properties["building"].Value.toString() == "NSA HQ")
{
// Do stuff here
}
}
Driver installation date
Driver installation date
I have made a little C# program which installs a driver by giving it a
path to the driver files.
The installation itself succeeds. The problem is, that the installation
date in the driver's properties in the device manager remains unchanged
and is set to the last installed driver which was installed in the "usual"
way through windows driver installer.
Is there a way to manually change the driver installation date so when I
look at the properties of the driver I can see a correct date?
I have made a little C# program which installs a driver by giving it a
path to the driver files.
The installation itself succeeds. The problem is, that the installation
date in the driver's properties in the device manager remains unchanged
and is set to the last installed driver which was installed in the "usual"
way through windows driver installer.
Is there a way to manually change the driver installation date so when I
look at the properties of the driver I can see a correct date?
i have already root my nexus4=?iso-8859-1?Q?=2Cbut_why_it_shows_=93shell@mako:/_$_=94when_i_enter_comm?=andadb sh=?iso-8859-1?Q?command=93adb_shell=94?=
i have already root my nexus4,but why it shows "shell@mako:/ $ "when i
enter command"adb shell"
Should not shell@mako:/ $ be shell@mako:/ #? Or I haven't root
successfully yet? How to check whether my nexus4 have root successfully?
Thanks!
enter command"adb shell"
Should not shell@mako:/ $ be shell@mako:/ #? Or I haven't root
successfully yet? How to check whether my nexus4 have root successfully?
Thanks!
Oracle: Rollback only crash iteration of loop
Oracle: Rollback only crash iteration of loop
I need help to accomplish rollback on iteration if one or more iterations
crash and to commit all others iteration if they success. If crash, it
will rollback whole transaction. Think this can be done with Savepoints,
but I'm not very familiar with them. This is a basic example what i try to
achieve.
DECLARE
...
BEGIN
FOR i IN 1 .. 10
LOOP
BEGIN
-- Some DML and stored procs with DML
INSERT INTO a .. .;
INSERT INTO b .. .;
INSERT INTO a .. .;
DELETE FROM a .. .;
UPDATE INTO c .. .;
m_package.some_proc_with_dml;
EXCEPTION
WHEN OTHERS THEN
merror := merror + || ', ' || + sqlerrm;
miserror := TRUE;
END;
END LOOP;
COMMIT;
IF miserror THEN
raise_application_error(-20000, merror);
END IF;
END;
Thanks in Advance.
I need help to accomplish rollback on iteration if one or more iterations
crash and to commit all others iteration if they success. If crash, it
will rollback whole transaction. Think this can be done with Savepoints,
but I'm not very familiar with them. This is a basic example what i try to
achieve.
DECLARE
...
BEGIN
FOR i IN 1 .. 10
LOOP
BEGIN
-- Some DML and stored procs with DML
INSERT INTO a .. .;
INSERT INTO b .. .;
INSERT INTO a .. .;
DELETE FROM a .. .;
UPDATE INTO c .. .;
m_package.some_proc_with_dml;
EXCEPTION
WHEN OTHERS THEN
merror := merror + || ', ' || + sqlerrm;
miserror := TRUE;
END;
END LOOP;
COMMIT;
IF miserror THEN
raise_application_error(-20000, merror);
END IF;
END;
Thanks in Advance.
Sunday, 25 August 2013
A regex to identify spans with given class names
A regex to identify spans with given class names
I am in the process of writing a custom BBCode editor (I have excellent
reasons for doing this and not using a readymade effort) which generates,
amongst other things HTML markup such as
<span class='className'>...</span>
All of this is done and works well. However, I also need to do the reverse
transformation from HTML to my BBCode where from time-to-time I need to
identify all spans that use a given classname. For example
<span class='classNameA' style='font-family"Arial"'>Span content</span> so
I can convert it to my BBCode markup
[font=Arial]Span Content[/font]
I am well aware of the dangers of using regexs to parse any old HTML and
that is not my intent. I just need to reverse parse my own HTML tags -
with everything else passing through to the BBCode editor display.
To cut a long story short - I am no good with regexs particularly those
that require lookaheads etc. I would much appreciate any help with
creating a JavaScript regex for this job.
I am in the process of writing a custom BBCode editor (I have excellent
reasons for doing this and not using a readymade effort) which generates,
amongst other things HTML markup such as
<span class='className'>...</span>
All of this is done and works well. However, I also need to do the reverse
transformation from HTML to my BBCode where from time-to-time I need to
identify all spans that use a given classname. For example
<span class='classNameA' style='font-family"Arial"'>Span content</span> so
I can convert it to my BBCode markup
[font=Arial]Span Content[/font]
I am well aware of the dangers of using regexs to parse any old HTML and
that is not my intent. I just need to reverse parse my own HTML tags -
with everything else passing through to the BBCode editor display.
To cut a long story short - I am no good with regexs particularly those
that require lookaheads etc. I would much appreciate any help with
creating a JavaScript regex for this job.
Build desktop application with ruby on rails
Build desktop application with ruby on rails
How to Build desktop application via ruby on rails?
I know rails scaffold mvc and would like to generate desktop like that.
How to Build desktop application via ruby on rails?
I know rails scaffold mvc and would like to generate desktop like that.
[ Singles & Dating ] Open Question : Why do i feel like this about a boy?
[ Singles & Dating ] Open Question : Why do i feel like this about a boy?
So 3 years ago I moved to Tamworth and went to a new high school and i met
this boy named Mitch we was really good friends in high school and I was
happy, but 2 years later I moved away to Birmingham which is only about
15-20mins away so I wasn't to fussed about never seeing him again, but a
couple of months after he told me that he was moving away to Cornwall i
was devastated knowing that i was literally never going to see him again.
we didn't talk for like 3months after that, when he popped up we started
to talk and he told me he had a massive crush on me when we went to the
same school and this just blew me away. he started to confess how he had
feelings for me but it would never happen as he lived so far away now, I
agreed but since that night when he told me I'm never able to get him out
of my head. I don't know what is wrong with me because every time I talk
to him I get these butterflies in my stomach. my mom has even started to
notice the amount of times I blush when on my computer. But every time we
chat it just reminds me that he is gone and I will properly will never see
him again. It feels like a dark storm cloud just appears over my head and
I just feel depressed and upset. No matter what he'll always be on my mind
and I don't understand why? Is it love? I've never been in love so I
really don't know the feeling. I don't understand It's confusing me so
much!
So 3 years ago I moved to Tamworth and went to a new high school and i met
this boy named Mitch we was really good friends in high school and I was
happy, but 2 years later I moved away to Birmingham which is only about
15-20mins away so I wasn't to fussed about never seeing him again, but a
couple of months after he told me that he was moving away to Cornwall i
was devastated knowing that i was literally never going to see him again.
we didn't talk for like 3months after that, when he popped up we started
to talk and he told me he had a massive crush on me when we went to the
same school and this just blew me away. he started to confess how he had
feelings for me but it would never happen as he lived so far away now, I
agreed but since that night when he told me I'm never able to get him out
of my head. I don't know what is wrong with me because every time I talk
to him I get these butterflies in my stomach. my mom has even started to
notice the amount of times I blush when on my computer. But every time we
chat it just reminds me that he is gone and I will properly will never see
him again. It feels like a dark storm cloud just appears over my head and
I just feel depressed and upset. No matter what he'll always be on my mind
and I don't understand why? Is it love? I've never been in love so I
really don't know the feeling. I don't understand It's confusing me so
much!
[ Other - Beauty & Style ] Open Question : How To Act More Feminine?
[ Other - Beauty & Style ] Open Question : How To Act More Feminine?
I feel like I need to act more feminine. I'm a major tomboy and I don't
really think guys find that attractive. I've been called intimidating and
other things. I always hang out with guys. I mean, I dress girly sometimes
– but rarely, maybe once every two weeks – and people always notice; guys
and girls, then they go, "Oh my gosh! You look like a girl today, your
boobs are actually out a little and you're wearing skinny jeans!".. This
is usually because I'm mostly in band t-shirts, sports t-shirts, regular
jeans, and Converse or Vans. So I was wondering if anyone had any tips on
being and acting more feminine? Please? I'm so sick of being called
intimating and everything. I feel like people are afraid of me, when I'm
actually super sweet and caring.
I feel like I need to act more feminine. I'm a major tomboy and I don't
really think guys find that attractive. I've been called intimidating and
other things. I always hang out with guys. I mean, I dress girly sometimes
– but rarely, maybe once every two weeks – and people always notice; guys
and girls, then they go, "Oh my gosh! You look like a girl today, your
boobs are actually out a little and you're wearing skinny jeans!".. This
is usually because I'm mostly in band t-shirts, sports t-shirts, regular
jeans, and Converse or Vans. So I was wondering if anyone had any tips on
being and acting more feminine? Please? I'm so sick of being called
intimating and everything. I feel like people are afraid of me, when I'm
actually super sweet and caring.
Switcheroo gone after last update
Switcheroo gone after last update
since the last kernel update for Ubuntu 13.04, the folder
/sys/kernel/debug/vgaswitcheroo/switch is gone on my Laptop (Acer Aspire
3820TG)
Checking the output of grep -i /boot/config-* tells me that my kernel
supports switcheroo however, the file is gone (and yes, I checked that as
root).
Can anybody please give me a hint? I almost checked the whole internet for
an appropriate answer but nobody seems to have the same problem.
Thanks, Edwin
since the last kernel update for Ubuntu 13.04, the folder
/sys/kernel/debug/vgaswitcheroo/switch is gone on my Laptop (Acer Aspire
3820TG)
Checking the output of grep -i /boot/config-* tells me that my kernel
supports switcheroo however, the file is gone (and yes, I checked that as
root).
Can anybody please give me a hint? I almost checked the whole internet for
an appropriate answer but nobody seems to have the same problem.
Thanks, Edwin
Saturday, 24 August 2013
Booting failing in Debian like distros?
Booting failing in Debian like distros?
I've tried Ubuntu, Linux Mint and Debian, even though all have worked
great for me I'm keeping with Ubuntu, I tested 12.04, 12.10 and even
13.04. The 12.04 LTS is the one I work with.
There's one issue persisting in the three distros I've tested, sometimes
at random occasions the boot fails, after GRUB, it shows only a _ as
prompt and it remains indefinitely, I've let pass up to an hour, last and
best I could do was to wait for a while and try again until I get the
Linux to load.
Everytime this happens and I've selected recovery mode I get logs like these:
So, I blame the last line:
[ 0. .... ]Booting Node 0, Processors #1
to be the issue, all first log lines appear continuously but it'll stop then.
I already updated BIOS, but there's something I think it might be the
issue and that's the Hyperthreading, I had disabled it after BIOS update
and it stopped happening, now I enabled it for installing a 64 bits OS in
VMWare Player and it happened again.
I googled and I've not really found a solution.
I've tried Ubuntu, Linux Mint and Debian, even though all have worked
great for me I'm keeping with Ubuntu, I tested 12.04, 12.10 and even
13.04. The 12.04 LTS is the one I work with.
There's one issue persisting in the three distros I've tested, sometimes
at random occasions the boot fails, after GRUB, it shows only a _ as
prompt and it remains indefinitely, I've let pass up to an hour, last and
best I could do was to wait for a while and try again until I get the
Linux to load.
Everytime this happens and I've selected recovery mode I get logs like these:
So, I blame the last line:
[ 0. .... ]Booting Node 0, Processors #1
to be the issue, all first log lines appear continuously but it'll stop then.
I already updated BIOS, but there's something I think it might be the
issue and that's the Hyperthreading, I had disabled it after BIOS update
and it stopped happening, now I enabled it for installing a 64 bits OS in
VMWare Player and it happened again.
I googled and I've not really found a solution.
Cannot run sudo update-manager
Cannot run sudo update-manager
I cannot run sudo update-manager. I dont know whats wrong. Do you know?
(precise)acer@localhost:~$ sudo update-manager
[sudo] password for acer:
(process:5761): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
WARNING:root:estimate_kernel_size_in_boot() returned '0'?
Traceback (most recent call last):
File "/usr/bin/update-manager", line 64, in <module>
help=_("Directory that contains the data files").decode(enc))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17:
ordinal not in range(128)
(precise)acer@localhost:~$
(precise)acer@localhost:~$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "sv_SV:en",
LC_ALL = (unset),
LC_MESSAGES = "sv_SV.UTF-8",
LANG = "sv_SV.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales...
en_AG.UTF-8... up-to-date
en_AU.UTF-8... up-to-date
en_BW.UTF-8... up-to-date
en_CA.UTF-8... up-to-date
en_DK.UTF-8... up-to-date
en_GB.UTF-8... up-to-date
en_HK.UTF-8... up-to-date
en_IE.UTF-8... up-to-date
en_IN.UTF-8... up-to-date
en_NG.UTF-8... up-to-date
en_NZ.UTF-8... up-to-date
en_PH.UTF-8... up-to-date
en_SG.UTF-8... up-to-date
en_US.UTF-8... up-to-date
en_ZA.UTF-8... up-to-date
en_ZM.UTF-8... up-to-date
en_ZW.UTF-8... up-to-date
sv_FI.UTF-8... up-to-date
sv_SE.UTF-8... up-to-date
Generation complete.
(precise)acer@localhost:~$
I use swedish language, but not swedish keyboard layout beacuse i dont
know how to install that.
I cannot run sudo update-manager. I dont know whats wrong. Do you know?
(precise)acer@localhost:~$ sudo update-manager
[sudo] password for acer:
(process:5761): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
WARNING:root:estimate_kernel_size_in_boot() returned '0'?
Traceback (most recent call last):
File "/usr/bin/update-manager", line 64, in <module>
help=_("Directory that contains the data files").decode(enc))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17:
ordinal not in range(128)
(precise)acer@localhost:~$
(precise)acer@localhost:~$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "sv_SV:en",
LC_ALL = (unset),
LC_MESSAGES = "sv_SV.UTF-8",
LANG = "sv_SV.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales...
en_AG.UTF-8... up-to-date
en_AU.UTF-8... up-to-date
en_BW.UTF-8... up-to-date
en_CA.UTF-8... up-to-date
en_DK.UTF-8... up-to-date
en_GB.UTF-8... up-to-date
en_HK.UTF-8... up-to-date
en_IE.UTF-8... up-to-date
en_IN.UTF-8... up-to-date
en_NG.UTF-8... up-to-date
en_NZ.UTF-8... up-to-date
en_PH.UTF-8... up-to-date
en_SG.UTF-8... up-to-date
en_US.UTF-8... up-to-date
en_ZA.UTF-8... up-to-date
en_ZM.UTF-8... up-to-date
en_ZW.UTF-8... up-to-date
sv_FI.UTF-8... up-to-date
sv_SE.UTF-8... up-to-date
Generation complete.
(precise)acer@localhost:~$
I use swedish language, but not swedish keyboard layout beacuse i dont
know how to install that.
moving ball app with acceleration sensor does not look smooth and continuous
moving ball app with acceleration sensor does not look smooth and continuous
Hello I'm new to android and I would like to learn it very much. Now, I'm
trying to learn making games with android using sensors. What I'm trying
to do is to make a ball moving in the screen using acceleration sensor.
Actually, I did some part of it. The ball moves in the screen when
acceleration of x and y changes. But my problem is that it does not look
smooth. It looks like the ball is not drawn on the screen in continuous
paths. I use the SurfaceView class for this app and I made the drawing on
different thread than the main thread. Below part of code is from my
MainActivity class and it is the sensor related part:
@Override
public void onSensorChanged(SensorEvent event) {
// TODO Auto-generated method stub
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
long actualTime = System.currentTimeMillis();
long delta_t = actualTime - lastUpdate;
lastUpdate = actualTime;
ax = event.values[0];
ay = event.values[1];
if (ax > 0) {
isleft = true;
delta_x = (float) (0.005 * ax * delta_t * delta_t);
}
if (ax < 0) {
isleft = false;
delta_x = (float) (-0.005 * ax * delta_t * delta_t);
}
if (ay > 0) {
isdown = true;
delta_y = (float) (0.005 * ay * delta_t * delta_t);
}
if (ay < 0) {
isdown = false;
delta_y = (float) (-0.005 * ay * delta_t * delta_t);
}
getBallPos();
}
}
private void getBallPos() {
delta_x /= 10000;
delta_y /= 10000;
for (int i = 1; i <= 10000; i++) {
if (isleft)
ballview.setX_loc(ballview.getX_loc() - delta_x);
if (!isleft)
ballview.setX_loc(ballview.getX_loc() + delta_x);
if (isdown)
ballview.setY_loc(ballview.getY_loc() + delta_y);
if (!isdown)
ballview.setY_loc(ballview.getY_loc() - delta_y);
}
}
Below part of code is from my BallGame class that extends SurfaceView and
I do the drawings on a different thread:
@Override
public void run() {
// TODO Auto-generated method stub
while (isItOk) {
if (!holder.getSurface().isValid()) {
continue;
}
canvas = holder.lockCanvas();
canvas.drawARGB(255, 150, 150, 10);
// canvas.drawLine(lineStartX, lineStartY, lineEndX,
lineEndY,
// paint);
checkBoundaries();
canvas.drawBitmap(ball, x_loc, y_loc, null);
holder.unlockCanvasAndPost(canvas);
}
}
private void checkBoundaries() {
if (x_loc > canvas.getWidth() - ballWidth) {
x_loc = canvas.getWidth() - ballWidth;
}
if (y_loc > canvas.getHeight() - ballHeight) {
y_loc = canvas.getHeight() - ballHeight;
}
if (x_loc < 0) {
x_loc = 0;
}
if (y_loc < 0) {
y_loc = 0;
}
}
If you help me in these codes, I will be very pleased. I'm very eager to
learn android but I difficultly find anywhere that I can learn android. So
if anybody suggest somewhere that I can learn android very much, I will be
very pleased.
Thank you
Hello I'm new to android and I would like to learn it very much. Now, I'm
trying to learn making games with android using sensors. What I'm trying
to do is to make a ball moving in the screen using acceleration sensor.
Actually, I did some part of it. The ball moves in the screen when
acceleration of x and y changes. But my problem is that it does not look
smooth. It looks like the ball is not drawn on the screen in continuous
paths. I use the SurfaceView class for this app and I made the drawing on
different thread than the main thread. Below part of code is from my
MainActivity class and it is the sensor related part:
@Override
public void onSensorChanged(SensorEvent event) {
// TODO Auto-generated method stub
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
long actualTime = System.currentTimeMillis();
long delta_t = actualTime - lastUpdate;
lastUpdate = actualTime;
ax = event.values[0];
ay = event.values[1];
if (ax > 0) {
isleft = true;
delta_x = (float) (0.005 * ax * delta_t * delta_t);
}
if (ax < 0) {
isleft = false;
delta_x = (float) (-0.005 * ax * delta_t * delta_t);
}
if (ay > 0) {
isdown = true;
delta_y = (float) (0.005 * ay * delta_t * delta_t);
}
if (ay < 0) {
isdown = false;
delta_y = (float) (-0.005 * ay * delta_t * delta_t);
}
getBallPos();
}
}
private void getBallPos() {
delta_x /= 10000;
delta_y /= 10000;
for (int i = 1; i <= 10000; i++) {
if (isleft)
ballview.setX_loc(ballview.getX_loc() - delta_x);
if (!isleft)
ballview.setX_loc(ballview.getX_loc() + delta_x);
if (isdown)
ballview.setY_loc(ballview.getY_loc() + delta_y);
if (!isdown)
ballview.setY_loc(ballview.getY_loc() - delta_y);
}
}
Below part of code is from my BallGame class that extends SurfaceView and
I do the drawings on a different thread:
@Override
public void run() {
// TODO Auto-generated method stub
while (isItOk) {
if (!holder.getSurface().isValid()) {
continue;
}
canvas = holder.lockCanvas();
canvas.drawARGB(255, 150, 150, 10);
// canvas.drawLine(lineStartX, lineStartY, lineEndX,
lineEndY,
// paint);
checkBoundaries();
canvas.drawBitmap(ball, x_loc, y_loc, null);
holder.unlockCanvasAndPost(canvas);
}
}
private void checkBoundaries() {
if (x_loc > canvas.getWidth() - ballWidth) {
x_loc = canvas.getWidth() - ballWidth;
}
if (y_loc > canvas.getHeight() - ballHeight) {
y_loc = canvas.getHeight() - ballHeight;
}
if (x_loc < 0) {
x_loc = 0;
}
if (y_loc < 0) {
y_loc = 0;
}
}
If you help me in these codes, I will be very pleased. I'm very eager to
learn android but I difficultly find anywhere that I can learn android. So
if anybody suggest somewhere that I can learn android very much, I will be
very pleased.
Thank you
iMacros extracting link URL
iMacros extracting link URL
Trying to exctract a link url with iMacros for Firefox plugin.
The following input html code is on the website to be scraped
<div class="subcl">
<a href="http://www.url.com/01.html" target="_blank">
Lastname01, Firstname01 </a>
</div>
Desired output from iMacros
http://www.url.com/01.html
Since there are further links on the website the class="subcl" should be
included in the code. Maybe there is a way to implement a nested
structure? I would prefer - if possible - non Javascript code since I
don't code in it myself.
The following macro code didn't work
VERSION BUILD=8300326 RECORDER=FX
TAB T=1
'URL GOTO=http://www.url.com/search
TAG POS=1 TYPE=DIV ATTR=CLASS:subcl* EXTRACT=HREF
Trying to exctract a link url with iMacros for Firefox plugin.
The following input html code is on the website to be scraped
<div class="subcl">
<a href="http://www.url.com/01.html" target="_blank">
Lastname01, Firstname01 </a>
</div>
Desired output from iMacros
http://www.url.com/01.html
Since there are further links on the website the class="subcl" should be
included in the code. Maybe there is a way to implement a nested
structure? I would prefer - if possible - non Javascript code since I
don't code in it myself.
The following macro code didn't work
VERSION BUILD=8300326 RECORDER=FX
TAB T=1
'URL GOTO=http://www.url.com/search
TAG POS=1 TYPE=DIV ATTR=CLASS:subcl* EXTRACT=HREF
Add Chakra os benz to grub 1.99
Add Chakra os benz to grub 1.99
I have Debian 7 with grub 1.99 in sda1 and Chakra OS without grub in sda2
I want to make a dual boot via grub 1,99, how?
I have Debian 7 with grub 1.99 in sda1 and Chakra OS without grub in sda2
I want to make a dual boot via grub 1,99, how?
Autorised Twitter application only once
Autorised Twitter application only once
I am developing one application. where I need to provide the feature to
post a message on twitter after login. users need to authorize using their
twitter account only once. some authentication code / token will be store
in DB for future action
To do this which API do I need to be used ??
I have used https://dev.twitter.com/docs/api/1/get/oauth/authorize
(https://api.twitter.com/oauth/authorize) API to authorize the user for
the first time. it will return oauth_token and oauth_verifier
How can I use these two parameters to post the message on Twitter for any
authorized user (authorized previously) ??
Please let me know
I am developing one application. where I need to provide the feature to
post a message on twitter after login. users need to authorize using their
twitter account only once. some authentication code / token will be store
in DB for future action
To do this which API do I need to be used ??
I have used https://dev.twitter.com/docs/api/1/get/oauth/authorize
(https://api.twitter.com/oauth/authorize) API to authorize the user for
the first time. it will return oauth_token and oauth_verifier
How can I use these two parameters to post the message on Twitter for any
authorized user (authorized previously) ??
Please let me know
Windows 8 activation by phone doesn't let me type all the numbers
Windows 8 activation by phone doesn't let me type all the numbers
I recently had to change my motherboard and now Windows 8 is complaining
about activation.
I call the activation wizard and start to enter my code but it doesn't let
me enter all numbers and on the 3rd block it says an error was detected.
I attempt to talk with a CSR, they ask me if its Windows 8 related and
then it tells me to contact the volume license supplier and hangs up. (I
have no idea what this is)
I recently had to change my motherboard and now Windows 8 is complaining
about activation.
I call the activation wizard and start to enter my code but it doesn't let
me enter all numbers and on the 3rd block it says an error was detected.
I attempt to talk with a CSR, they ask me if its Windows 8 related and
then it tells me to contact the volume license supplier and hangs up. (I
have no idea what this is)
Friday, 23 August 2013
VBA Macro to list out all the slides in a powerpoint
VBA Macro to list out all the slides in a powerpoint
I want to list out all slides in a powerpoint along with their slides
numbers and titles, if any. Is there a macro to do that ?
thanks kabir...
I want to list out all slides in a powerpoint along with their slides
numbers and titles, if any. Is there a macro to do that ?
thanks kabir...
Knockout.js dynamic links do not click through
Knockout.js dynamic links do not click through
I am working on a new project that is using knockout js. I have setup a
small table that displays images and info entered into a form that
populates an observable array. I have the images wrapped with an anchor
(link) tag and I am feeding the in the href through the KO data-bind. See
below.
<a data-bind="attr: {href: imgUrl}" target="_blank"><img class="imgThumb"
data-bind="attr: {src: imgUrl}"/></a>
All of this displays as expected, however none of the links will actually
click through to the image location.
An array entry looks like this:
col1: 'Bert', col2: 'Muppet', col3: 'Sesame Street', imgUrl:
'http://images3.wikia.nocookie.net/__cb20101210195428/muppet/images/4/40/Bert1970s.jpg'
The rendered HTML looks like this:
<a data-bind="attr: {href: imgUrl}}" target="_blank"
href="http://images3.wikia.nocookie.net/__cb20101210195428/muppet/images/4/40/Bert1970s.jpg"><img
class="imgThumb" data-bind="attr: {src: imgUrl}"
src="http://images3.wikia.nocookie.net/__cb20101210195428/muppet/images/4/40/Bert1970s.jpg"></a>
Once again, none of my links work, they will not click through to the
image location as I expect them to. Can anyone help me here and point out
what I am missing. Also, of note, I have tried adding a click: function(){
return true; } as well, and that didn't help either. Thanks in advance.
I am working on a new project that is using knockout js. I have setup a
small table that displays images and info entered into a form that
populates an observable array. I have the images wrapped with an anchor
(link) tag and I am feeding the in the href through the KO data-bind. See
below.
<a data-bind="attr: {href: imgUrl}" target="_blank"><img class="imgThumb"
data-bind="attr: {src: imgUrl}"/></a>
All of this displays as expected, however none of the links will actually
click through to the image location.
An array entry looks like this:
col1: 'Bert', col2: 'Muppet', col3: 'Sesame Street', imgUrl:
'http://images3.wikia.nocookie.net/__cb20101210195428/muppet/images/4/40/Bert1970s.jpg'
The rendered HTML looks like this:
<a data-bind="attr: {href: imgUrl}}" target="_blank"
href="http://images3.wikia.nocookie.net/__cb20101210195428/muppet/images/4/40/Bert1970s.jpg"><img
class="imgThumb" data-bind="attr: {src: imgUrl}"
src="http://images3.wikia.nocookie.net/__cb20101210195428/muppet/images/4/40/Bert1970s.jpg"></a>
Once again, none of my links work, they will not click through to the
image location as I expect them to. Can anyone help me here and point out
what I am missing. Also, of note, I have tried adding a click: function(){
return true; } as well, and that didn't help either. Thanks in advance.
How I add actions to popover buttons?
How I add actions to popover buttons?
I'm new in iOS programming and ...
I have a UIView that acts like a popover, and I have a button inside of it
and I want program it to reload the game. If I associate the UIView
popover with the same file of main View I call the method [self
reloadGame]; but this don't work. But if I not associate the UIView
popover to that file how I can call the method?
I'm new in iOS programming and ...
I have a UIView that acts like a popover, and I have a button inside of it
and I want program it to reload the game. If I associate the UIView
popover with the same file of main View I call the method [self
reloadGame]; but this don't work. But if I not associate the UIView
popover to that file how I can call the method?
Infer interface by type at compile time
Infer interface by type at compile time
Is there any way to infer an interface from an object based on its type.
For instance if I had the following object:
public class Person
{
public string FirstName
{ get; set; }
public string LastName
{ get; set; }
}
I would like to be able to infer this interface:
public interface IPerson
{
string FirstName
{ get; set; }
string LastName
{ get; set; }
}
What I would like to do is be able to create a generic proxy factory,
using reflection.emit, that adheres to the inferred interface at compile
time. I know that I could instead return a dynamic object with all the
object's properties, but that is all handled at runtime vs. compilation.
Is there any way to infer an interface from an object based on its type.
For instance if I had the following object:
public class Person
{
public string FirstName
{ get; set; }
public string LastName
{ get; set; }
}
I would like to be able to infer this interface:
public interface IPerson
{
string FirstName
{ get; set; }
string LastName
{ get; set; }
}
What I would like to do is be able to create a generic proxy factory,
using reflection.emit, that adheres to the inferred interface at compile
time. I know that I could instead return a dynamic object with all the
object's properties, but that is all handled at runtime vs. compilation.
Can't use object variables without getter methods
Can't use object variables without getter methods
I have an abstract class, AbstractNode, and a concrete class which extends
it- Node.
I am trying to "program to an interface" by declaring objects of
AbstractClass and instantiating them with new Node().
When I try to use the variables in Node after initializing them in the
constructor, I get a Null Pointer. But everything works fine if I use a
getter method instead. What am I missing?
public abstract class AbstractNode
{
String str;
public abstract String getStr();
}
public class Node extends AbstractNode
{
String str;
public Node()
{
str= new String();
}
public String getStr()
{
return str;
}
}
And the main method looks like this:
public static void main(String[] args)
{
AbstractNode n= new Node();
String nullStr= n.str;
String regularStr= n.getStr();
}
Now, nullStr contains a null reference, and regularStr contains a
reference to n.str. What is happening in here? I can access other fields
which do not require initialization, like int, directly without any getter
methods.
I have an abstract class, AbstractNode, and a concrete class which extends
it- Node.
I am trying to "program to an interface" by declaring objects of
AbstractClass and instantiating them with new Node().
When I try to use the variables in Node after initializing them in the
constructor, I get a Null Pointer. But everything works fine if I use a
getter method instead. What am I missing?
public abstract class AbstractNode
{
String str;
public abstract String getStr();
}
public class Node extends AbstractNode
{
String str;
public Node()
{
str= new String();
}
public String getStr()
{
return str;
}
}
And the main method looks like this:
public static void main(String[] args)
{
AbstractNode n= new Node();
String nullStr= n.str;
String regularStr= n.getStr();
}
Now, nullStr contains a null reference, and regularStr contains a
reference to n.str. What is happening in here? I can access other fields
which do not require initialization, like int, directly without any getter
methods.
Refactor Method Complexity in RAILS
Refactor Method Complexity in RAILS
Hi I synchronized my app with Code Climate for code review.
lib/models/user/synchrony/basecamp_inc.rb
def todo_list(todos,basecamp_account,proj_id)
todos.map{|todo|
task = basecamp_tasklist(proj_id,todo['id'],basecamp_account)
task_list(task['todos']['remaining'],task['name'],'remain') if
task['todos']['remaining'].present?
task_list(task['todos']['completed'],task['name'],'complete') if
task['todos']['completed'].present?
}
end
def task_list(tasks,todo_list,status)
tasks.map{|task|
task_created(task,todo_list)
task['assignee'].present? &&
user_owner?(task['assignee']['name']) ? save_task_activity('was
assigned to a',task,todo_list,task['updated_at'],'assign') :
[tasks,todo_list,status]
status == 'complete' && user_owner?(task['completer']['name'])
&& current_date?(task['completed_at']) ?
save_task_activity('finished',task,todo_list,task['completed_at'],'finished')
: [tasks,todo_list,status]
}
end
The codes above were detected by code climate as having complex methods. I
don't get why code climate thought of it as complex. So then, the rank of
that code is still C and I want to refactor it. Any workarounds how to
improve this?
Hi I synchronized my app with Code Climate for code review.
lib/models/user/synchrony/basecamp_inc.rb
def todo_list(todos,basecamp_account,proj_id)
todos.map{|todo|
task = basecamp_tasklist(proj_id,todo['id'],basecamp_account)
task_list(task['todos']['remaining'],task['name'],'remain') if
task['todos']['remaining'].present?
task_list(task['todos']['completed'],task['name'],'complete') if
task['todos']['completed'].present?
}
end
def task_list(tasks,todo_list,status)
tasks.map{|task|
task_created(task,todo_list)
task['assignee'].present? &&
user_owner?(task['assignee']['name']) ? save_task_activity('was
assigned to a',task,todo_list,task['updated_at'],'assign') :
[tasks,todo_list,status]
status == 'complete' && user_owner?(task['completer']['name'])
&& current_date?(task['completed_at']) ?
save_task_activity('finished',task,todo_list,task['completed_at'],'finished')
: [tasks,todo_list,status]
}
end
The codes above were detected by code climate as having complex methods. I
don't get why code climate thought of it as complex. So then, the rank of
that code is still C and I want to refactor it. Any workarounds how to
improve this?
Thursday, 22 August 2013
ubuntu create vpn connection
ubuntu create vpn connection
Ubuntu 13.04 Trying to connect to VPN with having IP, username and
password. In Windows vpn connection does work. Thanks in advance.
/etc/ppp/options.pptp
lock
noauth
nobsdcomp
nodeflate
persist
/etc/ppp/peers/vpn
maxfail 0
lcp-echo-interval 60
lcp-echo-failure 4
defaultroute
pty "pptp x.x.x.x --nolaunchpppd"
name user
remotename PPTP
+chap
file /etc/ppp/options.pptp
ipparam vpn
/var/log/syslog
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: pppd 2.4.5 started by
root, uid 0
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: using channel 50999
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: Using interface ppp0
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: Connect: ppp0 <-->
/dev/pts/26
Aug 23 10:16:28 av-HP-Pro-3500-Series NetworkManager[1031]:
SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/ppp0,
iface: ppp0)
Aug 23 10:16:28 av-HP-Pro-3500-Series NetworkManager[1031]:
SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/ppp0,
iface: ppp0): no ifupdown configuration found.
Aug 23 10:16:28 av-HP-Pro-3500-Series NetworkManager[1031]: <warn>
/sys/devices/virtual/net/ppp0: couldn't determine device driver;
ignoring...
Aug 23 10:16:28 av-HP-Pro-3500-Series pptp[1227]: anon
log[main:pptp.c:314]: The synchronous pptp option is NOT activated
Aug 23 10:17:01 av-HP-Pro-3500-Series CRON[1234]: (root) CMD ( cd / &&
run-parts --report /etc/cron.hourly)
Aug 23 10:19:06 av-HP-Pro-3500-Series pppd[1225]: Terminating on signal 15
Aug 23 10:19:06 av-HP-Pro-3500-Series pppd[1225]: Connection terminated.
Ubuntu 13.04 Trying to connect to VPN with having IP, username and
password. In Windows vpn connection does work. Thanks in advance.
/etc/ppp/options.pptp
lock
noauth
nobsdcomp
nodeflate
persist
/etc/ppp/peers/vpn
maxfail 0
lcp-echo-interval 60
lcp-echo-failure 4
defaultroute
pty "pptp x.x.x.x --nolaunchpppd"
name user
remotename PPTP
+chap
file /etc/ppp/options.pptp
ipparam vpn
/var/log/syslog
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: pppd 2.4.5 started by
root, uid 0
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: using channel 50999
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: Using interface ppp0
Aug 23 10:16:28 av-HP-Pro-3500-Series pppd[1225]: Connect: ppp0 <-->
/dev/pts/26
Aug 23 10:16:28 av-HP-Pro-3500-Series NetworkManager[1031]:
SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/ppp0,
iface: ppp0)
Aug 23 10:16:28 av-HP-Pro-3500-Series NetworkManager[1031]:
SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/ppp0,
iface: ppp0): no ifupdown configuration found.
Aug 23 10:16:28 av-HP-Pro-3500-Series NetworkManager[1031]: <warn>
/sys/devices/virtual/net/ppp0: couldn't determine device driver;
ignoring...
Aug 23 10:16:28 av-HP-Pro-3500-Series pptp[1227]: anon
log[main:pptp.c:314]: The synchronous pptp option is NOT activated
Aug 23 10:17:01 av-HP-Pro-3500-Series CRON[1234]: (root) CMD ( cd / &&
run-parts --report /etc/cron.hourly)
Aug 23 10:19:06 av-HP-Pro-3500-Series pppd[1225]: Terminating on signal 15
Aug 23 10:19:06 av-HP-Pro-3500-Series pppd[1225]: Connection terminated.
.js ScrollTop to div or section tag
.js ScrollTop to div or section tag
I have the following script that allows me to add an anchor-link with a
.class attached to my HTML document, which would then scroll the user to a
position on the webpage when clicked on.
HTML:
<li class="about-scroll">About</li>
JavaScript:
$('.about-scroll').click(function () {
$('body,html').animate({
scrollTop: 646
}, 1600);
return false;
});
This works fine, however, as the content isn't always static (drop-down
accordions, a responsive layout etc.), how would I be able to scroll to a
specific #div or section tag rather than a numeric value on the page?
Example:
<div class="about">
<h3>About</h3>
...
...
...
</div> <!-- end .about -->
I have the following script that allows me to add an anchor-link with a
.class attached to my HTML document, which would then scroll the user to a
position on the webpage when clicked on.
HTML:
<li class="about-scroll">About</li>
JavaScript:
$('.about-scroll').click(function () {
$('body,html').animate({
scrollTop: 646
}, 1600);
return false;
});
This works fine, however, as the content isn't always static (drop-down
accordions, a responsive layout etc.), how would I be able to scroll to a
specific #div or section tag rather than a numeric value on the page?
Example:
<div class="about">
<h3>About</h3>
...
...
...
</div> <!-- end .about -->
How to display @ScriptAssert message in Spring Velocity view?
How to display @ScriptAssert message in Spring Velocity view?
pI have a class called Member, and it has this at the top:/p
precode@ScriptAssert( lang = MiscConstants.JAVASCRIPT, script =
(_this.password != null amp;amp; _this.passwordConfirmation != null
amp;amp; _this.password.equals(_this.passwordConfirmation)), message =
TranslationConstants.PASSWORDS_MUST_MATCH ) /code/pre pThis class is used
in form binding in Spring MVC./p pThe rule itself is working, strongbut
I'm not seeing what I hoped as an error message in my Velocity
view/strong./p pWhat I see in red is: ScriptAssert. What I hoped to see
was the translation of this key:
TranslationConstants.PASSWORDS_MUST_MATCH./p pThis is in my Velocity view
file:/p precode#springBind(signupForm) #if($status.errors.hasErrors())
#foreach($e in $status.errorCodes) lt;div class=form-errorgt; lt;div
class=alert alert-errorgt;$elt;/divgt; lt;/divgt;
pI have a class called Member, and it has this at the top:/p
precode@ScriptAssert( lang = MiscConstants.JAVASCRIPT, script =
(_this.password != null amp;amp; _this.passwordConfirmation != null
amp;amp; _this.password.equals(_this.passwordConfirmation)), message =
TranslationConstants.PASSWORDS_MUST_MATCH ) /code/pre pThis class is used
in form binding in Spring MVC./p pThe rule itself is working, strongbut
I'm not seeing what I hoped as an error message in my Velocity
view/strong./p pWhat I see in red is: ScriptAssert. What I hoped to see
was the translation of this key:
TranslationConstants.PASSWORDS_MUST_MATCH./p pThis is in my Velocity view
file:/p precode#springBind(signupForm) #if($status.errors.hasErrors())
#foreach($e in $status.errorCodes) lt;div class=form-errorgt; lt;div
class=alert alert-errorgt;$elt;/divgt; lt;/divgt;
Loading package with Win32::Console - no output
Loading package with Win32::Console - no output
why do I get no output, when I load this package (WinXP SP3, Strawberry
Perl 5.18.1)?
package MY_TEST;
use warnings;
use strict;
use Win32::Console;
my $output;
$output ||= Win32::Console->new( STD_OUTPUT_HANDLE );
1;
Script:
#!/usr/bin/env perl
use warnings;
use strict;
use 5.10.0;
use FindBin qw($RealBin);
use MY_TEST;
say 'Hello World';
No output.
why do I get no output, when I load this package (WinXP SP3, Strawberry
Perl 5.18.1)?
package MY_TEST;
use warnings;
use strict;
use Win32::Console;
my $output;
$output ||= Win32::Console->new( STD_OUTPUT_HANDLE );
1;
Script:
#!/usr/bin/env perl
use warnings;
use strict;
use 5.10.0;
use FindBin qw($RealBin);
use MY_TEST;
say 'Hello World';
No output.
Import global variable with latest assigned value
Import global variable with latest assigned value
I'm trying to import global variable from one file to another. Though the
value of variable is changed at multiple location and i need to import
latest value that global variable carries.
file_One.py:
a = "Old Value"
def some_somefunction():
global a
a = "New Value"
Now I need the global variable with value "New Value" to be imported.
file_two.py:
import file_One
print file_One.a
o/p
Old value
Is there a way i can import global variable a with "New Value"?
I'm trying to import global variable from one file to another. Though the
value of variable is changed at multiple location and i need to import
latest value that global variable carries.
file_One.py:
a = "Old Value"
def some_somefunction():
global a
a = "New Value"
Now I need the global variable with value "New Value" to be imported.
file_two.py:
import file_One
print file_One.a
o/p
Old value
Is there a way i can import global variable a with "New Value"?
intellij plugin com.intellij failed to initialized
intellij plugin com.intellij failed to initialized
everyone, here I encounter a problem after the installation of Intellij
IDEA 12.1.3 on my WINDOWS XP sp2 System.
Here, I just describe it as follows: After the second time installation,
the startup of Intellij encounts that "plugin com.intellij failed to
initialized and will be disabled: Unknown macro:$ROOT_CONFIG$ in storage
spec : $ROOT_CONFIG$/keymaps please restart Intellij IDEA"
PS: this problem only happened for the second and so on installation of
the Intellij IDEA on my system.
everyone, here I encounter a problem after the installation of Intellij
IDEA 12.1.3 on my WINDOWS XP sp2 System.
Here, I just describe it as follows: After the second time installation,
the startup of Intellij encounts that "plugin com.intellij failed to
initialized and will be disabled: Unknown macro:$ROOT_CONFIG$ in storage
spec : $ROOT_CONFIG$/keymaps please restart Intellij IDEA"
PS: this problem only happened for the second and so on installation of
the Intellij IDEA on my system.
Change language on Android
Change language on Android
I use below code to change language:
res.getConfiguration().locale = Locale.TRADITIONAL_CHINESE;
It works.
But according to here.
Some language not exist, such as Portuguese, Russian, Spanish, it cannot
be set by this Locale.TRADITIONAL_CHINESE.
I mean Locale. not contains these language, but not that after set not work.
How can I set these language.
I use below code to change language:
res.getConfiguration().locale = Locale.TRADITIONAL_CHINESE;
It works.
But according to here.
Some language not exist, such as Portuguese, Russian, Spanish, it cannot
be set by this Locale.TRADITIONAL_CHINESE.
I mean Locale. not contains these language, but not that after set not work.
How can I set these language.
Wednesday, 21 August 2013
Turning off peripheral causing unexpected behavior
Turning off peripheral causing unexpected behavior
Using both Android 4.3/Samsung BLE 2.0 SDK, it is observed that when a
peripheral is turned off, the SDK will receive onConnectionStateChange
(DEVICE_DISCONNECTED) either immediately or after ~20s delay. From my
experience this depends on the peripheral implementation, some of them
will tried to report they are being turned off and some just doesn't, so
the SDK have to wait for ~20s for the timeout.
To remove this behaviour, I tried to use a Timer to check if I can read a
certain characteristic. If the read timed out, I will call
disconnect(Android 4.3)/cancelConnection(Samsung) to terminate the
connection. The call itself is successful and the onConnectionStateChange
callback return a status GATT_SUCCESS. Then I turned the peripheral on and
connect to it immediately, discover the services , and encounter problem
when I tried to read/write/notify any notification. By using LightBlue in
iOS I can confirm that the peripheral is not connected.
After exactly 20s from turning off the peripheral, I will receive a
DEVICE_DISCONNECTED callback. I connect again afterwards, and everything
operates fine afterwards.
There are two question : 1. Are we supposed to connect to the peripheral
during the 20s delay? 2. Is there any way to get notified when a
peripheral is turned off?
Thanks in advance.
Using both Android 4.3/Samsung BLE 2.0 SDK, it is observed that when a
peripheral is turned off, the SDK will receive onConnectionStateChange
(DEVICE_DISCONNECTED) either immediately or after ~20s delay. From my
experience this depends on the peripheral implementation, some of them
will tried to report they are being turned off and some just doesn't, so
the SDK have to wait for ~20s for the timeout.
To remove this behaviour, I tried to use a Timer to check if I can read a
certain characteristic. If the read timed out, I will call
disconnect(Android 4.3)/cancelConnection(Samsung) to terminate the
connection. The call itself is successful and the onConnectionStateChange
callback return a status GATT_SUCCESS. Then I turned the peripheral on and
connect to it immediately, discover the services , and encounter problem
when I tried to read/write/notify any notification. By using LightBlue in
iOS I can confirm that the peripheral is not connected.
After exactly 20s from turning off the peripheral, I will receive a
DEVICE_DISCONNECTED callback. I connect again afterwards, and everything
operates fine afterwards.
There are two question : 1. Are we supposed to connect to the peripheral
during the 20s delay? 2. Is there any way to get notified when a
peripheral is turned off?
Thanks in advance.
Checking if two jar classes are the same
Checking if two jar classes are the same
So Im trying to figure out if two .jars have the same .class file name.
I've done this -
cat jarFilePaths | xargs -n 1 jar tf | grep 'joda'
What do I do to see if two of these have the same .class file name.
jarFilePaths is a list of file paths of jars.
So Im trying to figure out if two .jars have the same .class file name.
I've done this -
cat jarFilePaths | xargs -n 1 jar tf | grep 'joda'
What do I do to see if two of these have the same .class file name.
jarFilePaths is a list of file paths of jars.
temp value is always show new value instead of old value
temp value is always show new value instead of old value
Can someone help me with this code its suppose to change the Lft and Rgt
properties on a department in the selected_deparmtents list. The problem
I'm having is getting the old value or previous value in the temp variable
which holds the previous departments Lft and Rgt properties. What it does
is show the updated value on the temp.Lft property which is wrong I want
the previous Lft property to do the calulation. Does anyone know how I can
get around this problem
int counter = 0;
int lft = department.Lft;
int rgt;
Department temp;
List<Department> clones = new List<Department>(selected_departments);
foreach (Department dept in selected_departments)
{
if (counter < 1)
{
rgt = (dept.Rgt - dept.Lft);
dept.Lft = lft;
dept.Rgt = lft + rgt;
}
else
{
temp = clones.ElementAt(counter - 1); // <-- incorrect
// previous departments value should be old value
lft = lft + (dept.Lft - temp.Lft);// here temp.Lft always show the
newly updated value
rgt = lft + (dept.Rgt - dept.Lft);
dept.Lft = lft;
dept.Rgt = rgt;
}
db.Entry(dept).State = EntityState.Modified;
db.SaveChanges();
counter++;
}
Can someone help me with this code its suppose to change the Lft and Rgt
properties on a department in the selected_deparmtents list. The problem
I'm having is getting the old value or previous value in the temp variable
which holds the previous departments Lft and Rgt properties. What it does
is show the updated value on the temp.Lft property which is wrong I want
the previous Lft property to do the calulation. Does anyone know how I can
get around this problem
int counter = 0;
int lft = department.Lft;
int rgt;
Department temp;
List<Department> clones = new List<Department>(selected_departments);
foreach (Department dept in selected_departments)
{
if (counter < 1)
{
rgt = (dept.Rgt - dept.Lft);
dept.Lft = lft;
dept.Rgt = lft + rgt;
}
else
{
temp = clones.ElementAt(counter - 1); // <-- incorrect
// previous departments value should be old value
lft = lft + (dept.Lft - temp.Lft);// here temp.Lft always show the
newly updated value
rgt = lft + (dept.Rgt - dept.Lft);
dept.Lft = lft;
dept.Rgt = rgt;
}
db.Entry(dept).State = EntityState.Modified;
db.SaveChanges();
counter++;
}
ASP.Net MVC C# AutoMapper using Where statement
ASP.Net MVC C# AutoMapper using Where statement
using AutoMapper - is it possible, when mapping a domain to a viewmodel,
to use the where statement, to limit what is mapped to the viewmodel, eg.
I use the following to map the Offer list to the OfferVM viewmodel:
vm.Offers = Mapper.Map<IList<Offer>, IList<OfferVM>>(offers);
However, I only want to map items in the list Offer to OfferVM if a
property on the Offer is set to true, eg:
vm.Offers = Mapper.Map<IList<Offer>, IList<OfferVM>>(offers)
.Where(x => x.RoomName1s==true);
But this gives the error:
Cannot implicitly convert type
'System.Collections.Generic.IEnumerable<FGBS.ViewModels.OfferVM>'
to
'System.Collections.Generic.IList<FGBS.ViewModels.OfferVM>'.
An explicit conversion exists (are you missing a cast?)
Thanks for any help.
Mark
using AutoMapper - is it possible, when mapping a domain to a viewmodel,
to use the where statement, to limit what is mapped to the viewmodel, eg.
I use the following to map the Offer list to the OfferVM viewmodel:
vm.Offers = Mapper.Map<IList<Offer>, IList<OfferVM>>(offers);
However, I only want to map items in the list Offer to OfferVM if a
property on the Offer is set to true, eg:
vm.Offers = Mapper.Map<IList<Offer>, IList<OfferVM>>(offers)
.Where(x => x.RoomName1s==true);
But this gives the error:
Cannot implicitly convert type
'System.Collections.Generic.IEnumerable<FGBS.ViewModels.OfferVM>'
to
'System.Collections.Generic.IList<FGBS.ViewModels.OfferVM>'.
An explicit conversion exists (are you missing a cast?)
Thanks for any help.
Mark
CSS center, fixed nav
CSS center, fixed nav
I have a page that is 1600px wide. The main area though is only 900px
wide. I have a navigation that is suppose to be fixed in the center of the
page ( which it is ). My problem is when I open the page, the page is
fixed left instead of being centered when opened. What do I need to do to
center everything within the 900px when a user visits the site?
The code isn't exact because it's detailed but it basically goes like
this: http://jsfiddle.net/wznQk/
<body>
<div class="container">
<div class="header">
<div class="subheader">
<div class="navigation">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li class="logo"><img
src="images/ogsystemslogo.png" /></li>
<li>CAREERS</li>
<li>CONTACT</li>
</ul>
</div>
<div class="undernav">
<div class="short">
<img src="images/bluemark.png" />
<div class="top">TOP OGS NEWS:</div>
</div>
</div>
</div>
</div>
<div class="content">
</div>
</div>
</body>
CSS
.body {
width: 1600px;
height: 100%;
margin: 0 auto;
padding: 0px;
border: 0px;
position: relative;
text-align: center;
}
.container {
width: 1600px;
height: 100%;
position: relative;
margin: 0 auto;
padding: 0px;
border: 0px;
text-align: center;
}
.header {
width: 1600px;
height: 150px;
margin: 0 10% 0 10%;
padding: 0px;
border: 0px;
background-color: white;
position: fixed;
}
.subheader {
width: 1600px;
height: 100px;
margin: 0 auto;
position: fixed;
background-color: white;
top: 0px;
}
.navigation {
font-family: 'Champagne & Limousines';
font-size: 20px;
text-align: left;
width: 1600px;
height: 100px;
padding: 0px;
margin-left: 0 auto;
border: 0px;
list-style: none;
text-decoration: none;
display: table-cell;
vertical-align: middle;
color: #006699;
background-color: white;
}
.navigation ul {
width: 590px;
height: 20px;
list-style: none;
text-decoration: none;
position: relative;
line-height: 55px;
margin: 0 auto;
background-color: white;
padding: 0px;
border: 0px;
}
.navigation ul li {
width: 70px;
height: 15px;
float: left;
padding-left: 35px;
background-color: white;
}
I have a page that is 1600px wide. The main area though is only 900px
wide. I have a navigation that is suppose to be fixed in the center of the
page ( which it is ). My problem is when I open the page, the page is
fixed left instead of being centered when opened. What do I need to do to
center everything within the 900px when a user visits the site?
The code isn't exact because it's detailed but it basically goes like
this: http://jsfiddle.net/wznQk/
<body>
<div class="container">
<div class="header">
<div class="subheader">
<div class="navigation">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li class="logo"><img
src="images/ogsystemslogo.png" /></li>
<li>CAREERS</li>
<li>CONTACT</li>
</ul>
</div>
<div class="undernav">
<div class="short">
<img src="images/bluemark.png" />
<div class="top">TOP OGS NEWS:</div>
</div>
</div>
</div>
</div>
<div class="content">
</div>
</div>
</body>
CSS
.body {
width: 1600px;
height: 100%;
margin: 0 auto;
padding: 0px;
border: 0px;
position: relative;
text-align: center;
}
.container {
width: 1600px;
height: 100%;
position: relative;
margin: 0 auto;
padding: 0px;
border: 0px;
text-align: center;
}
.header {
width: 1600px;
height: 150px;
margin: 0 10% 0 10%;
padding: 0px;
border: 0px;
background-color: white;
position: fixed;
}
.subheader {
width: 1600px;
height: 100px;
margin: 0 auto;
position: fixed;
background-color: white;
top: 0px;
}
.navigation {
font-family: 'Champagne & Limousines';
font-size: 20px;
text-align: left;
width: 1600px;
height: 100px;
padding: 0px;
margin-left: 0 auto;
border: 0px;
list-style: none;
text-decoration: none;
display: table-cell;
vertical-align: middle;
color: #006699;
background-color: white;
}
.navigation ul {
width: 590px;
height: 20px;
list-style: none;
text-decoration: none;
position: relative;
line-height: 55px;
margin: 0 auto;
background-color: white;
padding: 0px;
border: 0px;
}
.navigation ul li {
width: 70px;
height: 15px;
float: left;
padding-left: 35px;
background-color: white;
}
handling touch event with nested elements?
handling touch event with nested elements?
Im having this problem with jquery and the layout of my html.
for example say you have a div element with id "#test" and a child element
img with class "nested"
<div id="test">
<img class="nested" src="example.jpg">
</div>
with Jquery I have two touch events,
$(document).on("click", "#test", function(){
console.log("clicked on test id");
});
$(document).on("click", ".nested", function(){
console.log("clicked on nested element");
});
my problem is on the second touch event, when the user clciked on nested
item, this will also trigger the first element, because obviously its
nested, and i don't want that to happen.
im pretty sure this is a simple problem, but i don't seem to get it.
Im having this problem with jquery and the layout of my html.
for example say you have a div element with id "#test" and a child element
img with class "nested"
<div id="test">
<img class="nested" src="example.jpg">
</div>
with Jquery I have two touch events,
$(document).on("click", "#test", function(){
console.log("clicked on test id");
});
$(document).on("click", ".nested", function(){
console.log("clicked on nested element");
});
my problem is on the second touch event, when the user clciked on nested
item, this will also trigger the first element, because obviously its
nested, and i don't want that to happen.
im pretty sure this is a simple problem, but i don't seem to get it.
Using GPUImage to filter a view live
Using GPUImage to filter a view live
I am trying to use GPUImage to filter a view as it is updated in a kind of
iOS 7 style overlay. To do this I am running the following code on an
NSTimer, however my NSLog is showing that [self.backgroundUIImage
imageFromCurrentlyProcessedOutput] is returning (null) I know that the
view self.background is working properly as it is also added to the view
(self.finalImageView has also already been added to the view). I am not
sure whether I'm going about this the right way at all as there is no real
documentation on how to do this on the GPUImage github page. Does anybody
know if it is possible to use GPUImage in this way?
if (!self.backgroundUIImage) {
self.backgroundUIImage = [[GPUImageUIElement alloc]
initWithView:self.background];
GPUImageFastBlurFilter *fastBlur = [[GPUImageFastBlurFilter alloc]
init];
fastBlur.blurSize = 0.5;
[self.backgroundUIImage addTarget:fastBlur];
[self.backgroundUIImage update];
}
[self.backgroundUIImage update];
NSLog(@"image : %@",[self.backgroundUIImage
imageFromCurrentlyProcessedOutput]);
self.finalImageView.image = [self.backgroundUIImage
imageFromCurrentlyProcessedOutput];
[self bringSubviewToFront:self.finalImageView];
I am trying to use GPUImage to filter a view as it is updated in a kind of
iOS 7 style overlay. To do this I am running the following code on an
NSTimer, however my NSLog is showing that [self.backgroundUIImage
imageFromCurrentlyProcessedOutput] is returning (null) I know that the
view self.background is working properly as it is also added to the view
(self.finalImageView has also already been added to the view). I am not
sure whether I'm going about this the right way at all as there is no real
documentation on how to do this on the GPUImage github page. Does anybody
know if it is possible to use GPUImage in this way?
if (!self.backgroundUIImage) {
self.backgroundUIImage = [[GPUImageUIElement alloc]
initWithView:self.background];
GPUImageFastBlurFilter *fastBlur = [[GPUImageFastBlurFilter alloc]
init];
fastBlur.blurSize = 0.5;
[self.backgroundUIImage addTarget:fastBlur];
[self.backgroundUIImage update];
}
[self.backgroundUIImage update];
NSLog(@"image : %@",[self.backgroundUIImage
imageFromCurrentlyProcessedOutput]);
self.finalImageView.image = [self.backgroundUIImage
imageFromCurrentlyProcessedOutput];
[self bringSubviewToFront:self.finalImageView];
Tuesday, 20 August 2013
Check if a python thread threw an exception
Check if a python thread threw an exception
I have a set of tasks to do in parallel, but at the end of them, I need to
know if any of the threads threw an exception. I don't need to handle the
exception directly, I just need to know if one of the threads failed with
an exception, so I can cleanly terminate the script
Here is a simple example:
#!/usr/bin/python
from time import sleep
from threading import Thread
def func(a):
for i in range(0,5):
print a
sleep(1)
def func_ex():
sleep(2)
raise Exception("Blah")
x = [Thread(target=func, args=("T1",)), Thread(target=func, args=("T2",)),
Thread(target=func_ex, args=())]
print "Starting"
for t in x:
t.start()
print "Joining"
for t in x:
t.join()
print "End"
Before "End", I want to iterate through the threads, see if any failed,
and then decide if I can continue with the script, or if I need to exit at
this point.
I don't need to intercept the exception or stop the other threads, I just
need to know at the end if any failed.
I have a set of tasks to do in parallel, but at the end of them, I need to
know if any of the threads threw an exception. I don't need to handle the
exception directly, I just need to know if one of the threads failed with
an exception, so I can cleanly terminate the script
Here is a simple example:
#!/usr/bin/python
from time import sleep
from threading import Thread
def func(a):
for i in range(0,5):
print a
sleep(1)
def func_ex():
sleep(2)
raise Exception("Blah")
x = [Thread(target=func, args=("T1",)), Thread(target=func, args=("T2",)),
Thread(target=func_ex, args=())]
print "Starting"
for t in x:
t.start()
print "Joining"
for t in x:
t.join()
print "End"
Before "End", I want to iterate through the threads, see if any failed,
and then decide if I can continue with the script, or if I need to exit at
this point.
I don't need to intercept the exception or stop the other threads, I just
need to know at the end if any failed.
regex match within parenthesis
regex match within parenthesis
I'm attempting to use some regular expressions that I made for Python also
work with R.
Here is what I have in Python (using the excellent re module), with my
expected 3 matches:
import re
line = 'VARIABLES = "First [T]" "Second [L]" "Third [1/T]"'
re.findall('"(.*?)"', line)
# ['First [T]', 'Second [L]', 'Third [1/T]']
Now with R, here is my best attempt:
line <- 'VARIABLES = "First [T]" "Second [L]" "Third [1/T]"'
m <- gregexpr('"(.*?)"', line)
regmatches(line, m)[[1]]
# [1] "\"First [T]\"" "\"Second [L]\"" "\"Third [1/T]\""
Why did R match the whole pattern, rather than just within the
parenthesis? I was expecting:
[1] "First [T]" "Second [L]" "Third [1/T]"
Furthermore, perl=TRUE didn't make any difference. Is it safe to assume
that R's regex does not consider matching only the parenthesis, or is
there some trick that I'm missing?
I'm attempting to use some regular expressions that I made for Python also
work with R.
Here is what I have in Python (using the excellent re module), with my
expected 3 matches:
import re
line = 'VARIABLES = "First [T]" "Second [L]" "Third [1/T]"'
re.findall('"(.*?)"', line)
# ['First [T]', 'Second [L]', 'Third [1/T]']
Now with R, here is my best attempt:
line <- 'VARIABLES = "First [T]" "Second [L]" "Third [1/T]"'
m <- gregexpr('"(.*?)"', line)
regmatches(line, m)[[1]]
# [1] "\"First [T]\"" "\"Second [L]\"" "\"Third [1/T]\""
Why did R match the whole pattern, rather than just within the
parenthesis? I was expecting:
[1] "First [T]" "Second [L]" "Third [1/T]"
Furthermore, perl=TRUE didn't make any difference. Is it safe to assume
that R's regex does not consider matching only the parenthesis, or is
there some trick that I'm missing?
Accessing logging functionality from a class library
Accessing logging functionality from a class library
I have a solution with two projects, my WPF application project which
references the second project, a class library. The WPF application uses
Caliburn.Micro. I would like some classes in the library to log messages
through Caliburn.Micro's logging facility (which I've set up with log4net,
but that should be irrelevant).
To see if this would work, I put the following class into my library to
see if anything would show up in my log, and called it from one of my
viewmodels:
public class TempClass {
private static ILog Log = LogManager.GetLog(typeof(TempClass));
public static void LogSomething(string something) {
Log.Info(something);
}
}
It didn't work.
The class library can't reference my WPF application's project because
that would cause a circular reference. I figure I could have a static
object in the library that holds a reference to the WPF app's LogManager,
and I could set that up in my bootstrapper, but that doesn't feel like the
right solution.
What is a good solution to this problem?
I have a solution with two projects, my WPF application project which
references the second project, a class library. The WPF application uses
Caliburn.Micro. I would like some classes in the library to log messages
through Caliburn.Micro's logging facility (which I've set up with log4net,
but that should be irrelevant).
To see if this would work, I put the following class into my library to
see if anything would show up in my log, and called it from one of my
viewmodels:
public class TempClass {
private static ILog Log = LogManager.GetLog(typeof(TempClass));
public static void LogSomething(string something) {
Log.Info(something);
}
}
It didn't work.
The class library can't reference my WPF application's project because
that would cause a circular reference. I figure I could have a static
object in the library that holds a reference to the WPF app's LogManager,
and I could set that up in my bootstrapper, but that doesn't feel like the
right solution.
What is a good solution to this problem?
Creating table 3*3 based on elements number from asp.net codebehind
Creating table 3*3 based on elements number from asp.net codebehind
public void GetTableData(int index, List<SubCategory> subcatList, int
PageSize, string type)
{
int count = 0;
int number = 0;
lowerbound = (index - 1) * PageSize;
upperbound = (index * PageSize) - 1;
IEnumerable<SubCategory> take = subcatList.Skip((index - 1) *
PageSize).Take(PageSize);
int numberOfRows = 3;
int numberofColumns = take.Count() / numberOfRows + 1;
number = take.Count();
for (int row = 0; row < 3; row++)
{
HtmlTableRow tblrows = new HtmlTableRow();
bool broke = false;
for (int col = 0; col < 3; col++)
{
if (count >= take.Count())
{
broke = true;
break;
}
HtmlTableCell tblcells = new HtmlTableCell();
HtmlGenericControl span = new HtmlGenericControl("span");
System.Web.UI.HtmlControls.HtmlImage img = new
System.Web.UI.HtmlControls.HtmlImage();
base64 =
Convert.ToBase64String(take.ElementAt(count).SubCategoryImageData);
img.Src = "data:image/png;base64," + base64;
img.Alt = "base64";
HtmlAnchor a = new HtmlAnchor();
a.InnerHtml = take.ElementAt(count).SubCategoryName;
Label breakline = new Label();
breakline.Text = "<br/>";
a.HRef = "~/BrowseGamesBySubcategory.aspx?subcatid=" +
take.ElementAt(count).SubCategoryId;
tblcells.Style.Add("background-color", "#f8f8ff");
tblcells.Style.Add("text-align", "center");
// Add the control to the TableCell
span.Controls.Add(img);
tblcells.Controls.Add(span);
tblcells.Controls.Add(breakline);
tblcells.Controls.Add(a);
// Add the TableCell to the TableRow
tblrows.Cells.Add(tblcells);
count = count + 1;
}
// Add the TableRow to the Table
if (broke)
{
resttablegame.Rows.Add(tblrows);
break;
}
else
{
resttablegame.Rows.Add(tblrows);
}
}
}
I am trying to create a table of elements from code behind asp.net based
on the number of elements Conditions: At a time only 3 rows and 3 columns
can be there in the table and 9 elements in each of the cells.
My issue is when i try to populate my second page of the table say it has
11 elements 9 will be shown in the first page and rest 2 have to be shown
on the second page with table having 1 row and two columns
How do i do this? please help i am getting two rows and two columns
however it should just be 1 row and two columns
public void GetTableData(int index, List<SubCategory> subcatList, int
PageSize, string type)
{
int count = 0;
int number = 0;
lowerbound = (index - 1) * PageSize;
upperbound = (index * PageSize) - 1;
IEnumerable<SubCategory> take = subcatList.Skip((index - 1) *
PageSize).Take(PageSize);
int numberOfRows = 3;
int numberofColumns = take.Count() / numberOfRows + 1;
number = take.Count();
for (int row = 0; row < 3; row++)
{
HtmlTableRow tblrows = new HtmlTableRow();
bool broke = false;
for (int col = 0; col < 3; col++)
{
if (count >= take.Count())
{
broke = true;
break;
}
HtmlTableCell tblcells = new HtmlTableCell();
HtmlGenericControl span = new HtmlGenericControl("span");
System.Web.UI.HtmlControls.HtmlImage img = new
System.Web.UI.HtmlControls.HtmlImage();
base64 =
Convert.ToBase64String(take.ElementAt(count).SubCategoryImageData);
img.Src = "data:image/png;base64," + base64;
img.Alt = "base64";
HtmlAnchor a = new HtmlAnchor();
a.InnerHtml = take.ElementAt(count).SubCategoryName;
Label breakline = new Label();
breakline.Text = "<br/>";
a.HRef = "~/BrowseGamesBySubcategory.aspx?subcatid=" +
take.ElementAt(count).SubCategoryId;
tblcells.Style.Add("background-color", "#f8f8ff");
tblcells.Style.Add("text-align", "center");
// Add the control to the TableCell
span.Controls.Add(img);
tblcells.Controls.Add(span);
tblcells.Controls.Add(breakline);
tblcells.Controls.Add(a);
// Add the TableCell to the TableRow
tblrows.Cells.Add(tblcells);
count = count + 1;
}
// Add the TableRow to the Table
if (broke)
{
resttablegame.Rows.Add(tblrows);
break;
}
else
{
resttablegame.Rows.Add(tblrows);
}
}
}
I am trying to create a table of elements from code behind asp.net based
on the number of elements Conditions: At a time only 3 rows and 3 columns
can be there in the table and 9 elements in each of the cells.
My issue is when i try to populate my second page of the table say it has
11 elements 9 will be shown in the first page and rest 2 have to be shown
on the second page with table having 1 row and two columns
How do i do this? please help i am getting two rows and two columns
however it should just be 1 row and two columns
PhoneGap Application Testing issues on BlackBerry 9220 OS 7.1
PhoneGap Application Testing issues on BlackBerry 9220 OS 7.1
We are working on a PhoneGap2.9 application for BlackBerry 6,7 and 10 and
we are testing it on Curve 9220 with OS 7.1 and it is taking 25 minutes to
put the application onto device using "BlackBerry Desktop Manager" and
this whole process it time consuming
We would like to know if there are any better ways to do it
any suggestions would be highly appreciated
Rash
We are working on a PhoneGap2.9 application for BlackBerry 6,7 and 10 and
we are testing it on Curve 9220 with OS 7.1 and it is taking 25 minutes to
put the application onto device using "BlackBerry Desktop Manager" and
this whole process it time consuming
We would like to know if there are any better ways to do it
any suggestions would be highly appreciated
Rash
Please explain a meaning of a statement
Please explain a meaning of a statement
In the years since transgression I have sought no absolution, only bare
forgiveness. In good faith I have removed myself from all temptation,
sacrificed to prove my commitment however I can imagine.
I can not understand the last part "sacrificed to prove my commitment
however I can imagine", could you explain this sentence to me?
In the years since transgression I have sought no absolution, only bare
forgiveness. In good faith I have removed myself from all temptation,
sacrificed to prove my commitment however I can imagine.
I can not understand the last part "sacrificed to prove my commitment
however I can imagine", could you explain this sentence to me?
open and get exact size of existing memory mapped file on windows
open and get exact size of existing memory mapped file on windows
There is one of our service log file which mapped to memory. I have
another application tracing some regex on log file, so I need to get log
file size periodically and read coming lines if any. I check log file size
by ftell() to get size in bytes however it returns 4mb since it is mapped
to 4mb are I guess. My logic simply like below:
FILE *f = fopen("logfile.log", "r")
fseek(f, previousEnd, SEEK_SET)
// ftell() always returns 4mb when actual file size is less than 4mb
// I need to get exact size of log file
currentEnd = ftell(f)
//read from previousEnd to currentEnd with fread
previousEnd = currentEnd
Is there a way to get exact size of existing mapped files in bytes on
windows? Any suggestion and idea appreciated. Thanks.
There is one of our service log file which mapped to memory. I have
another application tracing some regex on log file, so I need to get log
file size periodically and read coming lines if any. I check log file size
by ftell() to get size in bytes however it returns 4mb since it is mapped
to 4mb are I guess. My logic simply like below:
FILE *f = fopen("logfile.log", "r")
fseek(f, previousEnd, SEEK_SET)
// ftell() always returns 4mb when actual file size is less than 4mb
// I need to get exact size of log file
currentEnd = ftell(f)
//read from previousEnd to currentEnd with fread
previousEnd = currentEnd
Is there a way to get exact size of existing mapped files in bytes on
windows? Any suggestion and idea appreciated. Thanks.
Monday, 19 August 2013
Extract Identifier from Principal Component Analysis with Missing Data in R
Extract Identifier from Principal Component Analysis with Missing Data in R
I am conducting a principal component analysis in R on vectors with
missing data. I want to extract the score from the principal component and
match the values with the observations that are not missing in the
original frame but I can't figure out how to extract and match on the
right identifiers. For example:
x1 <- c(1,2,3,NA, 5,6,7)
x2 <- c(7,NA,6,NA, 4,3,2)
frame <- cbind(x1,x2)
pca_ob<- princomp(~frame)
pca_ob$score[,1]
This produces the following output:
1 3 5 6 7
4.273146 2.104705 -0.715732 -2.125950 -3.536168
I would like to bind pca_ob$score[,1] with the original frame based on the
identifiers and fill the rest in with NAs. Any thoughts? Thanks.
I am conducting a principal component analysis in R on vectors with
missing data. I want to extract the score from the principal component and
match the values with the observations that are not missing in the
original frame but I can't figure out how to extract and match on the
right identifiers. For example:
x1 <- c(1,2,3,NA, 5,6,7)
x2 <- c(7,NA,6,NA, 4,3,2)
frame <- cbind(x1,x2)
pca_ob<- princomp(~frame)
pca_ob$score[,1]
This produces the following output:
1 3 5 6 7
4.273146 2.104705 -0.715732 -2.125950 -3.536168
I would like to bind pca_ob$score[,1] with the original frame based on the
identifiers and fill the rest in with NAs. Any thoughts? Thanks.
"Peer Not Autherticated" in maven when trying to run a job in JENKINS
"Peer Not Autherticated" in maven when trying to run a job in JENKINS
When I try running a maven job in Jenkins, the build is not successful.
The error message in the console displays the following :
[INFO]
------------------------------------------------------------------------
Downloading:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
resources-plugin/2.5/maven-resources-plugin-2.5.pom
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 0.640s
[INFO] Finished at: Tue Aug 20 11:21:36 EST 2013
[INFO] Final Memory: 6M/16M
[INFO]
------------------------------------------------------------------------
mavenExecutionResult exceptions not empty
message : Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or
one of its dependencies could not be resolved: Failed to read artifact
descriptor for
org.apache.maven.plugins:maven-resources-plugin:jar:2.5
cause : Failed to read artifact descriptor for
org.apache.maven.plugins:maven- resources-plugin:jar:2.5
Stack trace :
org.apache.maven.plugin.PluginResolutionException: Plugin
org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its
dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-resources-plugin:jar:2.5
at
org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
at
org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:139)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:116)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:129)
at
org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at
org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at
hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
Failed to read artifact descriptor for
org.apache.maven.plugins:maven-resources-plugin:jar:2.5
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:279)
at
org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:115)
... 33 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
Could not transfer artifact
org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central
(http://repo.maven.apache.org/maven2): peer not authenticated
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
... 36 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could
not transfer artifact
org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central
(http://repo.maven.apache.org/maven2): peer not authenticated
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
at
org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
... 3 more
Caused by: org.apache.maven.wagon.TransferFailedException: peer not
authenticated
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:892)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601)
... 4 more
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at
sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:397)
at
org.apache.maven.wagon.providers.http.httpclient.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126)
at
org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLSocketFactory.createLayeredSocket(SSLSocketFactory.java:628)
at
org.apache.maven.wagon.shared.http4.ConfigurableSSLSocketFactoryDecorator.createLayeredSocket(ConfigurableSSLSocketFactoryDecorator.java:57)
at
org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultClientConnectionOperator.updateSecureConnection(DefaultClientConnectionOperator.java:232)
at
org.apache.maven.wagon.providers.http.httpclient.impl.conn.ManagedClientConnectionImpl.layerProtocol(ManagedClientConnectionImpl.java:401)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.establishRoute(DefaultRequestDirector.java:842)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:649)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:746)
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:886)
... 8 more
channel stopped
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -
Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\J
AVA_S~1\classes\jasmine.jar
Finished: FAILURE
I'm able to get to know the root cause of the error is some authentication
issue("peer not authenticated"). But not able to get it resolved as I am
not aware what authetication I need to key in and where to key in.
Additional details : I am using Maven 3.0.3 and JDK 1.7
Thanks in advance for your time in helping me resolving the issue. Let me
know if you need any additional info.
Thanks
When I try running a maven job in Jenkins, the build is not successful.
The error message in the console displays the following :
[INFO]
------------------------------------------------------------------------
Downloading:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
resources-plugin/2.5/maven-resources-plugin-2.5.pom
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 0.640s
[INFO] Finished at: Tue Aug 20 11:21:36 EST 2013
[INFO] Final Memory: 6M/16M
[INFO]
------------------------------------------------------------------------
mavenExecutionResult exceptions not empty
message : Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or
one of its dependencies could not be resolved: Failed to read artifact
descriptor for
org.apache.maven.plugins:maven-resources-plugin:jar:2.5
cause : Failed to read artifact descriptor for
org.apache.maven.plugins:maven- resources-plugin:jar:2.5
Stack trace :
org.apache.maven.plugin.PluginResolutionException: Plugin
org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its
dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-resources-plugin:jar:2.5
at
org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
at
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
at
org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:139)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:116)
at
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:129)
at
org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at
org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at
hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
Failed to read artifact descriptor for
org.apache.maven.plugins:maven-resources-plugin:jar:2.5
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:279)
at
org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:115)
... 33 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
Could not transfer artifact
org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central
(http://repo.maven.apache.org/maven2): peer not authenticated
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
... 36 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could
not transfer artifact
org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central
(http://repo.maven.apache.org/maven2): peer not authenticated
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
at
org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
... 3 more
Caused by: org.apache.maven.wagon.TransferFailedException: peer not
authenticated
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:892)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601)
... 4 more
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at
sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:397)
at
org.apache.maven.wagon.providers.http.httpclient.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126)
at
org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLSocketFactory.createLayeredSocket(SSLSocketFactory.java:628)
at
org.apache.maven.wagon.shared.http4.ConfigurableSSLSocketFactoryDecorator.createLayeredSocket(ConfigurableSSLSocketFactoryDecorator.java:57)
at
org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultClientConnectionOperator.updateSecureConnection(DefaultClientConnectionOperator.java:232)
at
org.apache.maven.wagon.providers.http.httpclient.impl.conn.ManagedClientConnectionImpl.layerProtocol(ManagedClientConnectionImpl.java:401)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.establishRoute(DefaultRequestDirector.java:842)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:649)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at
org.apache.maven.wagon.providers.http.httpclient.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:746)
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:886)
... 8 more
channel stopped
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -
Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\J
AVA_S~1\classes\jasmine.jar
Finished: FAILURE
I'm able to get to know the root cause of the error is some authentication
issue("peer not authenticated"). But not able to get it resolved as I am
not aware what authetication I need to key in and where to key in.
Additional details : I am using Maven 3.0.3 and JDK 1.7
Thanks in advance for your time in helping me resolving the issue. Let me
know if you need any additional info.
Thanks
How configure Selenium test to autenticate and proceed test?
How configure Selenium test to autenticate and proceed test?
I'm using Selenium and JUnit(in Eclipse) to develop a test. In Selenium
and browser(Firefox) the test is OK, but when I export and try in Ecplipse
no work because need make login. I see some examples, but nothing similar.
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://...";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testEcsf() throws Exception {
driver.get(baseUrl + "/...");
driver.findElement(By.cssSelector("font")).click();
driver.findElement(By.xpath("//tr[28]/td[2]/a/font")).click();
driver.findElement(By.xpath("//table[2]/tbody/tr[3]/td/a/font")).click();
driver.findElement(By.xpath("//table[2]/tbody/tr[4]/td/a/font")).click();
driver.findElement(By.xpath("//tr[5]/td/a/font")).click();
new
Select(driver.findElement(By.id("form:_idJsp11:_idJsp28"))).selectByVisibleText("MAR/2013");
new
Select(driver.findElement(By.id("form:_idJsp11:_idJsp32"))).selectByVisibleText("MAR/2013");
driver.findElement(By.id("btnPesquisar")).click();
}
Someone know how I insert in object FirefoxDriver the login of user, or I
need change? I'm trying make a minimal change in code, if possible.
Thanks for help.
I'm using Selenium and JUnit(in Eclipse) to develop a test. In Selenium
and browser(Firefox) the test is OK, but when I export and try in Ecplipse
no work because need make login. I see some examples, but nothing similar.
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://...";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testEcsf() throws Exception {
driver.get(baseUrl + "/...");
driver.findElement(By.cssSelector("font")).click();
driver.findElement(By.xpath("//tr[28]/td[2]/a/font")).click();
driver.findElement(By.xpath("//table[2]/tbody/tr[3]/td/a/font")).click();
driver.findElement(By.xpath("//table[2]/tbody/tr[4]/td/a/font")).click();
driver.findElement(By.xpath("//tr[5]/td/a/font")).click();
new
Select(driver.findElement(By.id("form:_idJsp11:_idJsp28"))).selectByVisibleText("MAR/2013");
new
Select(driver.findElement(By.id("form:_idJsp11:_idJsp32"))).selectByVisibleText("MAR/2013");
driver.findElement(By.id("btnPesquisar")).click();
}
Someone know how I insert in object FirefoxDriver the login of user, or I
need change? I'm trying make a minimal change in code, if possible.
Thanks for help.
Is it possible use column name instead of number as in a function passed to apply?
Is it possible use column name instead of number as in a function passed
to apply?
I would like to apply a function to each row of a data.frame/data.table
cases <- expand.grid(a=c(TRUE,FALSE), b=c(TRUE,FALSE), c=c(TRUE,FALSE))
myFun <- function(data, row){
otherFun(data, row[1], row[2], row[3])
}
apply(cases, 1, myFun, data=dt1)
This works, however,
myFun <- function(data, row){
otherFun(data, row$a, row$b, row$c)
}
This doesn't work.
What's the best way to do it so that it doesn't have to depend on column
orders?
to apply?
I would like to apply a function to each row of a data.frame/data.table
cases <- expand.grid(a=c(TRUE,FALSE), b=c(TRUE,FALSE), c=c(TRUE,FALSE))
myFun <- function(data, row){
otherFun(data, row[1], row[2], row[3])
}
apply(cases, 1, myFun, data=dt1)
This works, however,
myFun <- function(data, row){
otherFun(data, row$a, row$b, row$c)
}
This doesn't work.
What's the best way to do it so that it doesn't have to depend on column
orders?
Sunday, 18 August 2013
How to use TypeForwardedTo in Portable Class Libraries?
How to use TypeForwardedTo in Portable Class Libraries?
I'm trying to build a Portable Class Library which uses implementations
from the platform when available. For example, Lazy<T> is available on
.NET 4.5, Windows Store Apps, Windows Phone 8, BUT it's not available on
Windows Phone 7, Silverlight 4. When my PCL is loaded on one of the
platforms that has a Lazy<T> implementation, I want to use the platform's
implementation. When it's not available on the platform, I want to use my
own implementation. It seems to be possible because the Microsoft BCL is
doing it, but I haven't figured out how to implement it.
I've read that by using the TypeForwardedToAttribute, you can redirect the
PCL to use the implementation from the platform. I'm not quite sure how to
configure my Visual Studio Projects to achieve this result. If CoreLib is
my library, and ShimLib contains my implementation of Lazy<T>. Where do I
add the TypeForwardedToAttribute? The attribute requires an actual Type
reference typeof(System.Lazy<>), which doesn't work when Windows Phone 7
is targeted in the PCL. If I remove Windows Phone 7, then I can't add a
reference from CoreLib to ShimLib because ShimLib doesn't support all the
platforms that CoreLib does. How do I handle this?
Yes, I know Lazy<T> is super easy to implement, but it's just an example,
and my actual situation applies to many more classes that are less trivial
to implement.
I'm trying to build a Portable Class Library which uses implementations
from the platform when available. For example, Lazy<T> is available on
.NET 4.5, Windows Store Apps, Windows Phone 8, BUT it's not available on
Windows Phone 7, Silverlight 4. When my PCL is loaded on one of the
platforms that has a Lazy<T> implementation, I want to use the platform's
implementation. When it's not available on the platform, I want to use my
own implementation. It seems to be possible because the Microsoft BCL is
doing it, but I haven't figured out how to implement it.
I've read that by using the TypeForwardedToAttribute, you can redirect the
PCL to use the implementation from the platform. I'm not quite sure how to
configure my Visual Studio Projects to achieve this result. If CoreLib is
my library, and ShimLib contains my implementation of Lazy<T>. Where do I
add the TypeForwardedToAttribute? The attribute requires an actual Type
reference typeof(System.Lazy<>), which doesn't work when Windows Phone 7
is targeted in the PCL. If I remove Windows Phone 7, then I can't add a
reference from CoreLib to ShimLib because ShimLib doesn't support all the
platforms that CoreLib does. How do I handle this?
Yes, I know Lazy<T> is super easy to implement, but it's just an example,
and my actual situation applies to many more classes that are less trivial
to implement.
Converting HTML to string with HtmlAgilityPack
Converting HTML to string with HtmlAgilityPack
I've parsed a string with HTML to a HtmlAgilityPack.HtmlDocument, but I
can't seem to convert it back to a string.
Dim Document As HtmlAgilityPack.HtmlDocument = New
HtmlAgilityPack.HtmlDocument()
Document.LoadHtml(Result)
I've parsed a string with HTML to a HtmlAgilityPack.HtmlDocument, but I
can't seem to convert it back to a string.
Dim Document As HtmlAgilityPack.HtmlDocument = New
HtmlAgilityPack.HtmlDocument()
Document.LoadHtml(Result)
Why multiple types of Casting in C#
Why multiple types of Casting in C#
I am new to c# and would like to know why the different casting types.
.ToString(), Convert.ToString & (String). What are the differences and
when should they be used. Just need some clarity. Thanks.
I am new to c# and would like to know why the different casting types.
.ToString(), Convert.ToString & (String). What are the differences and
when should they be used. Just need some clarity. Thanks.
Custom comparator for only one property in Angular $filter
Custom comparator for only one property in Angular $filter
First, my reason for creating the custom comparator in the first place is
because an attribute on the expression that is an array--such as
'tags'--required the expression to have the values in a particular order
and wouldn't match otherwise. (So an expression with tags['a', 'b'] would
match ['x', 'a', 'b', 'y'] but not ['x', 'b', 'a', 'y'].)
I've been able to get around this because in Angular's $filter service, it
allows you to provide a custom comparator. However, I'm only able to
filter based on the attributes type, not the key's value.
I want a custom comparator for only one of the attributes in an object. Is
there a way to do that without copying and modifying Angular's source
code?
Here is an example of my custom comparator: (found in
http://plnkr.co/edit/eFeinQhHTIZrzXBm4srq )
$scope.inclusiveFilter = function(expected, actual){
if(expected && actual){
console.log(expected, actual);
if(angular.isArray(expected) && angular.isArray(actual)){
for(var t in actual){
if(expected.indexOf(actual[t]) == -1){
return false;
}
}
}
return true;
}
}
In my example the filter on the tags works just fine, but it no longer
works on $ to match any property, I am only able to compare attributes
based on their type, not their name. So an expression like this could
never work:
{
includeThese: ['a', 'b'],
excludeThese: ['x', 'y']
}
First, my reason for creating the custom comparator in the first place is
because an attribute on the expression that is an array--such as
'tags'--required the expression to have the values in a particular order
and wouldn't match otherwise. (So an expression with tags['a', 'b'] would
match ['x', 'a', 'b', 'y'] but not ['x', 'b', 'a', 'y'].)
I've been able to get around this because in Angular's $filter service, it
allows you to provide a custom comparator. However, I'm only able to
filter based on the attributes type, not the key's value.
I want a custom comparator for only one of the attributes in an object. Is
there a way to do that without copying and modifying Angular's source
code?
Here is an example of my custom comparator: (found in
http://plnkr.co/edit/eFeinQhHTIZrzXBm4srq )
$scope.inclusiveFilter = function(expected, actual){
if(expected && actual){
console.log(expected, actual);
if(angular.isArray(expected) && angular.isArray(actual)){
for(var t in actual){
if(expected.indexOf(actual[t]) == -1){
return false;
}
}
}
return true;
}
}
In my example the filter on the tags works just fine, but it no longer
works on $ to match any property, I am only able to compare attributes
based on their type, not their name. So an expression like this could
never work:
{
includeThese: ['a', 'b'],
excludeThese: ['x', 'y']
}
Using echo in bash with variable
Using echo in bash with variable
I want to use the line below to change password.When i put actual values
instead of variables , the command works perfectly.
echo -e "$sshpass\n$sshpass | (passwd --stdin root)"
$sshpass is a variable containing a password
I tried the following to make command work with no luck
echo -e "/$sshpass\n/$sshpass | (passwd --stdin root)"
echo -e "$sshpass\n$sshpass | (passwd --stdin root)"
echo -e "'$sshpass'\n/'$sshpass' | (passwd --stdin root)"
Anyone can help me here
I want to use the line below to change password.When i put actual values
instead of variables , the command works perfectly.
echo -e "$sshpass\n$sshpass | (passwd --stdin root)"
$sshpass is a variable containing a password
I tried the following to make command work with no luck
echo -e "/$sshpass\n/$sshpass | (passwd --stdin root)"
echo -e "$sshpass\n$sshpass | (passwd --stdin root)"
echo -e "'$sshpass'\n/'$sshpass' | (passwd --stdin root)"
Anyone can help me here
Javascript- code getting executed before all elements are ready.
Javascript- code getting executed before all elements are ready.
I have this code in my web. This page takes multiple image files as input
and displays them before uploading them to server.
<html>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<body>
<header>
<h1>File API - FileReader</h1>
</header>
<label for="files">Select multiple files: </label>
<input id="files" type="file" multiple/>
<div id='10' style=" width:100px; height:50px;
background-color:#006633" onclick="submit_rr(event)">Click</div>
<output id="result" />
</body>
<script language="javascript" type="text/javascript" >
function submit_rr(event){
$('#files').click();
}
$("#files").change(function(){
show_selected(this);
});
function show_selected(input){
for(var i = 0;i< input.files.length; i++) {
var reader = new FileReader();
reader.readAsDataURL(input.files[i]);
reader.onload = function (e) {
var img = new Image;
img.onload = function() {
if(img.width>=img.height){
ratio=img.height/img.width;
height=ratio*100;
height_rem=(100-height)/2;
var crt=document.createElement('div');
crt.id="main_some";
crt.className="ind_req_sty";
var Friend="Friend";
crt.innerHTML="<img id="+i+" width='100px'
height='"+height+"px' src='"+e.target.result+"'/>";
document.getElementById('10').appendChild(crt);
}else{
ratio=img.width/img.height;
width=ratio*100;
var crt=document.createElement('div');
crt.id='main_req';
crt.className="ind_req_sty";
var Friend="Friend";
crt.innerHTML="<img id="+x+" height='100px'
width='"+width+"' src='" + e.target.result
+"'/>";
document.getElementById('10').appendChild(crt);
}
}
img.src=reader.result;
}
}
}
</script>
</html>
Problem is that, this script executes before all the elements are
displayed. As a result only few images are displayed(say 4 out of 10
selected). I tried adding .ready() and .load() but that doesn't work.
However if I add an alert('something') all images are displayed without
any issue. is there a way I can delay execution so that all images are
loaded. I have also tried setTimeout() without any luck. Thanks for your
help
I have this code in my web. This page takes multiple image files as input
and displays them before uploading them to server.
<html>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<body>
<header>
<h1>File API - FileReader</h1>
</header>
<label for="files">Select multiple files: </label>
<input id="files" type="file" multiple/>
<div id='10' style=" width:100px; height:50px;
background-color:#006633" onclick="submit_rr(event)">Click</div>
<output id="result" />
</body>
<script language="javascript" type="text/javascript" >
function submit_rr(event){
$('#files').click();
}
$("#files").change(function(){
show_selected(this);
});
function show_selected(input){
for(var i = 0;i< input.files.length; i++) {
var reader = new FileReader();
reader.readAsDataURL(input.files[i]);
reader.onload = function (e) {
var img = new Image;
img.onload = function() {
if(img.width>=img.height){
ratio=img.height/img.width;
height=ratio*100;
height_rem=(100-height)/2;
var crt=document.createElement('div');
crt.id="main_some";
crt.className="ind_req_sty";
var Friend="Friend";
crt.innerHTML="<img id="+i+" width='100px'
height='"+height+"px' src='"+e.target.result+"'/>";
document.getElementById('10').appendChild(crt);
}else{
ratio=img.width/img.height;
width=ratio*100;
var crt=document.createElement('div');
crt.id='main_req';
crt.className="ind_req_sty";
var Friend="Friend";
crt.innerHTML="<img id="+x+" height='100px'
width='"+width+"' src='" + e.target.result
+"'/>";
document.getElementById('10').appendChild(crt);
}
}
img.src=reader.result;
}
}
}
</script>
</html>
Problem is that, this script executes before all the elements are
displayed. As a result only few images are displayed(say 4 out of 10
selected). I tried adding .ready() and .load() but that doesn't work.
However if I add an alert('something') all images are displayed without
any issue. is there a way I can delay execution so that all images are
loaded. I have also tried setTimeout() without any luck. Thanks for your
help
CKEditor text alignment buttons
CKEditor text alignment buttons
Is there a way to add the align buttons to the toolbar without downloading
the full version of ckeditor?
Thanxx
Is there a way to add the align buttons to the toolbar without downloading
the full version of ckeditor?
Thanxx
Saturday, 17 August 2013
Initializing isotope with dynamic data json
Initializing isotope with dynamic data json
I have searched around but no help. My issue is I am using the isotope
jQuery library to show data (of course) and I am trying to do this by
using a dynamic json dataset. I placed the data in a .json file and I'm
reading it in and parsing information, then placing that info in divs
under my container div like so:
$('#infoContainer').append('<div class="hospital ' + $number + '"><p>' + i
+ '<br />' + hospital.address + '<br />' + hospital.citystatezip +
'</p></div>');
Of course that portion is in an .each() function for each hospital. My
problem is that the initialization code won't show the dynamic divs like
it shows when you manually type them. I'm using what is given on the
isotope website:
$('#infoContainer').isotope({
itemSelector: '.hospital'
});
Any ideas?
I have searched around but no help. My issue is I am using the isotope
jQuery library to show data (of course) and I am trying to do this by
using a dynamic json dataset. I placed the data in a .json file and I'm
reading it in and parsing information, then placing that info in divs
under my container div like so:
$('#infoContainer').append('<div class="hospital ' + $number + '"><p>' + i
+ '<br />' + hospital.address + '<br />' + hospital.citystatezip +
'</p></div>');
Of course that portion is in an .each() function for each hospital. My
problem is that the initialization code won't show the dynamic divs like
it shows when you manually type them. I'm using what is given on the
isotope website:
$('#infoContainer').isotope({
itemSelector: '.hospital'
});
Any ideas?
Tomcat servlet not running - error 404
Tomcat servlet not running - error 404
I have an application that is distributed with tomcat, I wanted to simply
take the webapp from the webapps folder and put it into the webapps folder
of a tomcat server, however when I do this and restart it etc whenever a
servlet is referenced (such as /controller) it returns a 404 as if the
servlets or the mapping aren't working. I'd provide more information but I
am so at a loss I don't even know where to start debugging this (very new
to tomcat) can someone point me in the right direction? Why would it work
locally but not on this server.
I have an application that is distributed with tomcat, I wanted to simply
take the webapp from the webapps folder and put it into the webapps folder
of a tomcat server, however when I do this and restart it etc whenever a
servlet is referenced (such as /controller) it returns a 404 as if the
servlets or the mapping aren't working. I'd provide more information but I
am so at a loss I don't even know where to start debugging this (very new
to tomcat) can someone point me in the right direction? Why would it work
locally but not on this server.
How to think in a OOP way?
How to think in a OOP way?
i am creating a test site which is kind of like a to do list and which
keeps track of your progress. the user will enter an item with its time
limit and the site should keep track of all the information.
so i created 4 tables:
1. for the main title of my list
2. for the items in each title
3. amount of progress i made in each item
4. time i allotted to each item.
now, i am new to php and mysql so is this the right way to tackle this
problem? how many classes should i create to get all these information in
a easy and understandable way.
Thank You
i am creating a test site which is kind of like a to do list and which
keeps track of your progress. the user will enter an item with its time
limit and the site should keep track of all the information.
so i created 4 tables:
1. for the main title of my list
2. for the items in each title
3. amount of progress i made in each item
4. time i allotted to each item.
now, i am new to php and mysql so is this the right way to tackle this
problem? how many classes should i create to get all these information in
a easy and understandable way.
Thank You
Combinatorial interpretation of Fermat's Last Theorem
Combinatorial interpretation of Fermat's Last Theorem
A book that I am reading suggests the following exercise
Suppose we have $n > 2$ objects blue colored bins, red colored bins and
some uncolored bins. Show that Fermat's Last Theorem is equivalent to the
statement that
The number of ways of putting the objects into bins so that the bins of
both colors are shun is never equal to the number of ways to put the
objects into the bins so that neither color is shun.
The book also hints at defining $x$ to be the number of bins that are not
blue, $y$ the number of bins that are not red and $z$ the total number of
bins.
As far as I can come from here is that the above statement (if true) would
imply $(x+y-z)^n = z^n - x^n - y^n$ and I don't see how to proceed from
here.
Anyone happens to know how to prove the equivalence?
A book that I am reading suggests the following exercise
Suppose we have $n > 2$ objects blue colored bins, red colored bins and
some uncolored bins. Show that Fermat's Last Theorem is equivalent to the
statement that
The number of ways of putting the objects into bins so that the bins of
both colors are shun is never equal to the number of ways to put the
objects into the bins so that neither color is shun.
The book also hints at defining $x$ to be the number of bins that are not
blue, $y$ the number of bins that are not red and $z$ the total number of
bins.
As far as I can come from here is that the above statement (if true) would
imply $(x+y-z)^n = z^n - x^n - y^n$ and I don't see how to proceed from
here.
Anyone happens to know how to prove the equivalence?
error :activity_main can not be resolved or not a field
error :activity_main can not be resolved or not a field
getting above error .followed this
but didn't find solution.checked my resource file and all but no use
suggest me sutable solution for this.here placing the actity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="87dp"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_centerVertical="true"
android:text="Button2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button2"
android:layout_below="@+id/button2"
android:layout_marginTop="52dp"
android:text="Button" />
getting above error .followed this
but didn't find solution.checked my resource file and all but no use
suggest me sutable solution for this.here placing the actity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="87dp"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_centerVertical="true"
android:text="Button2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button2"
android:layout_below="@+id/button2"
android:layout_marginTop="52dp"
android:text="Button" />
Why my Adobe Reader renders the PDF like this?
Why my Adobe Reader renders the PDF like this?
What's the matter with my Adobe Reader?
I am using Windows 8 with Adobe Reader X1 11.0.3
What's the matter with my Adobe Reader?
I am using Windows 8 with Adobe Reader X1 11.0.3
Getting a 403 forbidden error when posting in Facebook using Prime31 pkugin from Unity3d
Getting a 403 forbidden error when posting in Facebook using Prime31
pkugin from Unity3d
Before I ask my question here are a few details of my setup and the
problem I am facing. This is my first post on StackOverflow :).
Platform : Unity3d engine + Prime31 plugin for Facebook
Context : I am trying to integrate Facebook into our Mobile iOS app,
developed using Unity3d (still in development), and I am trying to post to
the user's friend's wall using a plugin called Prime31.
Problem : I keep getting a 403 forbidden error when I post to the friends
wall
Code : I am using the following piece of code
var token = FacebookBinding.getAccessToken();
Debug.Log( "access token: " + token );
var param = new Dictionary<string,object>
{
{"message", "Test message for dragons "},
{"access_token" , token},
{"name", "School of Dragons"},
{"caption", "Join the world of Dragons"},
};
Facebook.instance.post(id+"/feed",param, OnPostComplete);
Where id is retrieved from another piece of code.
Additional Info :
With the same setup, publishing on my own wall works. (me/feed instead of
id/feed)
The friend I am trying to post to and myself both are listed as developers
in the account for the app.
I have the the info.plist additions according to the steps provided by
Prime31.
I have done extensive googling on this problem and most of the replies
indicate a high number of posts being made from the server / app as a
possible reason.
Questions :
Is filling in the Native IOS App setting in the developer console a must
for publishing ?
Is the number of posts made by a developer application in Facebook
restricted ? Because I can post to the same friends wall with the same
content outside of the app. This seems to be the least likely scenario.
Why could this problem be happening ?
Any help would be greatly appreciated as we have a deadline approaching in
three days and this feature should be done and ready in a couple of days.
Thanks Anur
pkugin from Unity3d
Before I ask my question here are a few details of my setup and the
problem I am facing. This is my first post on StackOverflow :).
Platform : Unity3d engine + Prime31 plugin for Facebook
Context : I am trying to integrate Facebook into our Mobile iOS app,
developed using Unity3d (still in development), and I am trying to post to
the user's friend's wall using a plugin called Prime31.
Problem : I keep getting a 403 forbidden error when I post to the friends
wall
Code : I am using the following piece of code
var token = FacebookBinding.getAccessToken();
Debug.Log( "access token: " + token );
var param = new Dictionary<string,object>
{
{"message", "Test message for dragons "},
{"access_token" , token},
{"name", "School of Dragons"},
{"caption", "Join the world of Dragons"},
};
Facebook.instance.post(id+"/feed",param, OnPostComplete);
Where id is retrieved from another piece of code.
Additional Info :
With the same setup, publishing on my own wall works. (me/feed instead of
id/feed)
The friend I am trying to post to and myself both are listed as developers
in the account for the app.
I have the the info.plist additions according to the steps provided by
Prime31.
I have done extensive googling on this problem and most of the replies
indicate a high number of posts being made from the server / app as a
possible reason.
Questions :
Is filling in the Native IOS App setting in the developer console a must
for publishing ?
Is the number of posts made by a developer application in Facebook
restricted ? Because I can post to the same friends wall with the same
content outside of the app. This seems to be the least likely scenario.
Why could this problem be happening ?
Any help would be greatly appreciated as we have a deadline approaching in
three days and this feature should be done and ready in a couple of days.
Thanks Anur
Thursday, 8 August 2013
How do I access an element of an array returned by a function in javascript?
How do I access an element of an array returned by a function in javascript?
So I have a function
function getArray(){
return ["a", "b", "c"];
}
and I would like to access one of the elements without having to assign
the return to a variable, like so:
if(true)
if(false || true)
console.log(getArray()[0]);
This is a syntax error, along with .0. I noticed there is no "at" method
and my code uses enough for-in loops that I can't pollute the array object
with a prototype function.
So any ideas? (Yes I am simply trying to avoid curly braces. It is a style
choice.)
So I have a function
function getArray(){
return ["a", "b", "c"];
}
and I would like to access one of the elements without having to assign
the return to a variable, like so:
if(true)
if(false || true)
console.log(getArray()[0]);
This is a syntax error, along with .0. I noticed there is no "at" method
and my code uses enough for-in loops that I can't pollute the array object
with a prototype function.
So any ideas? (Yes I am simply trying to avoid curly braces. It is a style
choice.)
How can I vertically and horizontally align text over an image?
How can I vertically and horizontally align text over an image?
I have a simple image of a ball which I am using as a background. I would
like to overlay text. The text will be a number, i.e. a lottery number.
I have tried various methods but cannot find a solution, e.g.
CSS
#container
{
height:400px;
width:400px;
position:relative;
}
#image
{
position:relative;
left:0;
top:0;
}
#text
{
position:absolute;
color:black;
font-size:18px;
font-weight:bold;
text-align:center;
top:0px;
}
<div id="container">
<img id="image"
src="http://www.powerball-lottery-blog.com/img/balls/ball_white_40.gif"/>
<p id="text">37</p> </div>
</pre>
I just cannot get the number to align vertically and horizontally in the
ball.
Any ideas or suggestions?
Thanks and regards
I have a simple image of a ball which I am using as a background. I would
like to overlay text. The text will be a number, i.e. a lottery number.
I have tried various methods but cannot find a solution, e.g.
CSS
#container
{
height:400px;
width:400px;
position:relative;
}
#image
{
position:relative;
left:0;
top:0;
}
#text
{
position:absolute;
color:black;
font-size:18px;
font-weight:bold;
text-align:center;
top:0px;
}
<div id="container">
<img id="image"
src="http://www.powerball-lottery-blog.com/img/balls/ball_white_40.gif"/>
<p id="text">37</p> </div>
</pre>
I just cannot get the number to align vertically and horizontally in the
ball.
Any ideas or suggestions?
Thanks and regards
can i change where the raw_input cursor is when the program is running - python
can i change where the raw_input cursor is when the program is running -
python
Can I change where the raw_input cursor is when the program is running.
For example my code is;
print raw_input ("Please enter your last name..") print (" Type now ..")
print raw_input ("please enter your first name..")
and I want the "Type now" part to be in the lower part of the screen
somewhere but the flashing | to remain after the "please enter your last
name" part.
Oooo, while I am here, can someone paste me out the code that makes my |
spin around? :D or impress me with something even more fancy?
Thank you everyone who read this question.
python
Can I change where the raw_input cursor is when the program is running.
For example my code is;
print raw_input ("Please enter your last name..") print (" Type now ..")
print raw_input ("please enter your first name..")
and I want the "Type now" part to be in the lower part of the screen
somewhere but the flashing | to remain after the "please enter your last
name" part.
Oooo, while I am here, can someone paste me out the code that makes my |
spin around? :D or impress me with something even more fancy?
Thank you everyone who read this question.
multivariate non-linear optimisation library for java similar to Matlab's solver GRG algorithm
multivariate non-linear optimisation library for java similar to Matlab's
solver GRG algorithm
I have been looking for a good optimisation algorithm for almost a year
now. My problem consists of taking a matrix of observed values, lets call
it 'M' and using a function 'F' which by transforming each of M's cells
one by one produces another Matrix 'N'. then matrices M and N are compared
using least square method and the distance between them should be
minimised by changing the variables of 'F'. There is an array of variables
lets call it 'a' and a single variable 'b' which are used in the function
F. The variable 'b' is consistent between all of the calculations required
to get the matrix 'N'. Now the length of array 'a' depends on the number
of rows, one number from array 'a' corresponds to each row. So lets say to
calculate the 3rd row of 'N' I use F on the value of each cell in the 3rd
row of 'M' together with the variables a[3] and b. to calculate the 4th
row of N i calculate F with the value of each cell from the 4th row in M
in turn together with a[4] and b. And so on And so on. Once I calculate
the whole of N i need to compare it to M and minimize their distance by
adjusting the array of variables a[] and the variable b. I have been using
apache cmaes for smaller matrices but it doesnt work as well as matlab's
solver on large metrices
With kind regards to any genius out there,
Erik
solver GRG algorithm
I have been looking for a good optimisation algorithm for almost a year
now. My problem consists of taking a matrix of observed values, lets call
it 'M' and using a function 'F' which by transforming each of M's cells
one by one produces another Matrix 'N'. then matrices M and N are compared
using least square method and the distance between them should be
minimised by changing the variables of 'F'. There is an array of variables
lets call it 'a' and a single variable 'b' which are used in the function
F. The variable 'b' is consistent between all of the calculations required
to get the matrix 'N'. Now the length of array 'a' depends on the number
of rows, one number from array 'a' corresponds to each row. So lets say to
calculate the 3rd row of 'N' I use F on the value of each cell in the 3rd
row of 'M' together with the variables a[3] and b. to calculate the 4th
row of N i calculate F with the value of each cell from the 4th row in M
in turn together with a[4] and b. And so on And so on. Once I calculate
the whole of N i need to compare it to M and minimize their distance by
adjusting the array of variables a[] and the variable b. I have been using
apache cmaes for smaller matrices but it doesnt work as well as matlab's
solver on large metrices
With kind regards to any genius out there,
Erik
Subscribe to:
Comments (Atom)