AngularJS - Why select drop down doesn't have $event on change
I am newbie to AngularJS. I have a question, why does select doesn't
passes the $event?
HTML
<div ng-controller="foo">
<select ng-model="item" ng-options="opts as opts.name for opts in
sels" ng-change="lstViewChange($event)"
ng-click="listViewClick($event)"></select>
</div>
Script
var myApp = angular.module('myApp', []);
angular.element(document).ready(function() {
angular.bootstrap(document, ['myApp']);
});
function foo($scope) {
$scope.sels = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
$scope.lstViewChange = function($event){
console.log('change', $event);
}
$scope.listViewClick = function($event){
console.log('click', $event);
}
}
Have a look at this fiddle http://jsfiddle.net/dkrotts/BtrZH/7/. Click
passes a event but change doesn't.
Saturday, 31 August 2013
iOS how to use .p12 certification?
iOS how to use .p12 certification?
my teacher only gave me a .p12 certification but no developer account. How
can I use it to test my app on the real device? Even publish the app?
Thanks!
my teacher only gave me a .p12 certification but no developer account. How
can I use it to test my app on the real device? Even publish the app?
Thanks!
How input in a string a XML content:encode
How input in a string a XML content:encode
I have this XML
<rss>
<channel>
<item>
<title>
Title content
</title>
<link>
http://www2.XXXXXX
</link>
<dc:creator>YYYYY</dc:creator>
<category>FFFFF</category>
<description>
<![CDATA[<P>O XXXXX (...)]]>
</description>
<content:encoded>
<![CDATA[<P>O XXXXXXX XXXXXXXXXX XXXXX XXXXX XXXXX XXXXXXXXXX XXXXX
XXXXX</P>]]>
</content:encoded>
</item>
....
I use this code to read this XML, and I want get the content value from XML
$rawFeed = (file_get_contents($url_feed));
$xmldoc = new SimpleXmlElement($rawFeed);
foreach ($xmldoc->channel->item as $xmlinfo){
$title = $xmlinfo->title);
$content = $xmlinfo->content);
}
The problem is: I can recover the string $title = 'Title content', but I
cant return in a string $content
PS: I try use content:encoded, but doesn't work too
PS2. when I print_r($xmlinfo), I get
SimpleXMLElement Object ( [title] => TITLE XXXXXX [link] =>
http://www2.XXXXX.php? [category] => YYY [description] =>
SimpleXMLElement Object ( ) )
I have this XML
<rss>
<channel>
<item>
<title>
Title content
</title>
<link>
http://www2.XXXXXX
</link>
<dc:creator>YYYYY</dc:creator>
<category>FFFFF</category>
<description>
<![CDATA[<P>O XXXXX (...)]]>
</description>
<content:encoded>
<![CDATA[<P>O XXXXXXX XXXXXXXXXX XXXXX XXXXX XXXXX XXXXXXXXXX XXXXX
XXXXX</P>]]>
</content:encoded>
</item>
....
I use this code to read this XML, and I want get the content value from XML
$rawFeed = (file_get_contents($url_feed));
$xmldoc = new SimpleXmlElement($rawFeed);
foreach ($xmldoc->channel->item as $xmlinfo){
$title = $xmlinfo->title);
$content = $xmlinfo->content);
}
The problem is: I can recover the string $title = 'Title content', but I
cant return in a string $content
PS: I try use content:encoded, but doesn't work too
PS2. when I print_r($xmlinfo), I get
SimpleXMLElement Object ( [title] => TITLE XXXXXX [link] =>
http://www2.XXXXX.php? [category] => YYY [description] =>
SimpleXMLElement Object ( ) )
View not attached to window manager exception even isfinishing is called
View not attached to window manager exception even isfinishing is called
I keep getting this exception "View not attached to window manager"
reports from ACRA and it is always happening around my dialog.dismiss() in
my async task. I have searched SO and I added the (!isFinishing())
condition but I still get it. Can you please tell me how I can solve it?
Here is a sample code where it happens
private class MyAsyncTask extends AsyncTask<String, Void, Void> {
private ProgressDialog dialog;
private PropertyTask asyncTask;
public MyAsyncTask (PropertyTask task){
this.asyncTask = task;
}
@Override
protected void onPreExecute() {
dialog = ProgressDialog.show(ListTasksActivity.this, "Please
wait..", "working..", true);
}
@Override
protected Void doInBackground(String... params) {
//Some DB work here
return null;
}
@Override
protected void onPostExecute(Void result) {
if(!isFinishing()){
dialog.dismiss(); <-------- Problem happens
}
}
}
I keep getting this exception "View not attached to window manager"
reports from ACRA and it is always happening around my dialog.dismiss() in
my async task. I have searched SO and I added the (!isFinishing())
condition but I still get it. Can you please tell me how I can solve it?
Here is a sample code where it happens
private class MyAsyncTask extends AsyncTask<String, Void, Void> {
private ProgressDialog dialog;
private PropertyTask asyncTask;
public MyAsyncTask (PropertyTask task){
this.asyncTask = task;
}
@Override
protected void onPreExecute() {
dialog = ProgressDialog.show(ListTasksActivity.this, "Please
wait..", "working..", true);
}
@Override
protected Void doInBackground(String... params) {
//Some DB work here
return null;
}
@Override
protected void onPostExecute(Void result) {
if(!isFinishing()){
dialog.dismiss(); <-------- Problem happens
}
}
}
How do I get user specic pages using javascript only?
How do I get user specic pages using javascript only?
I am creating a website where each user will have their uniq page. users
can visit other user's pages by
http://website/user?user=<username>&session=<session>
Now I want to simplify above URL to
http://website/user/<username> (something like pinterest or facebook)
I thought I can use mod_rewrite. However, mod_rewrite is for server side.
I do not want to include any PHP code. What I do to get data for a user :
load the basic HTML template and then based on which user we are talking
about, load user's data asynchronously.
Can I achieve above in JS? If yes, how?
-Ajay
I am creating a website where each user will have their uniq page. users
can visit other user's pages by
http://website/user?user=<username>&session=<session>
Now I want to simplify above URL to
http://website/user/<username> (something like pinterest or facebook)
I thought I can use mod_rewrite. However, mod_rewrite is for server side.
I do not want to include any PHP code. What I do to get data for a user :
load the basic HTML template and then based on which user we are talking
about, load user's data asynchronously.
Can I achieve above in JS? If yes, how?
-Ajay
Getting "This QueryDict instance is immutable" on one Django view but not another
Getting "This QueryDict instance is immutable" on one Django view but not
another
I have two views, one that is working fine when I try to add to the POST
data when a form is not valid, another that gives me a "This QueryDict
instance is immutable" error when trying to do the same thing. I know
these views are too similar to exist in the first place and plan on
combining them... but would like to first understand what is the
difference that makes one of them fail.
This view works fine:
@login_required
def url_parse(request):
cu = request.user
if request.method == 'POST':
form = UrlBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.url = form.cleaned_data['url']
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = UrlBragForm()
return render_to_response('brag/url_brag.html', {'form':form,},
context_instance=RequestContext(request))
But this view gives me a "This QueryDict instance is immutable" when
trying to fill the request.POST['brag'] with the 'clean' data when view is
not valid:
@login_required
def brag_add_image(request):
cu = request.user
if request.method == 'POST':
form = ImageAddBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
b.url = 'http://%s%s' %
(Site.objects.get_current().domain,
reverse('image_display', args=(b.pk,)))
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = ImageAddBragForm()
return render_to_response('brag/image_brag_add.html', {'form':form,},
context_instance=RequestContext(request))
another
I have two views, one that is working fine when I try to add to the POST
data when a form is not valid, another that gives me a "This QueryDict
instance is immutable" error when trying to do the same thing. I know
these views are too similar to exist in the first place and plan on
combining them... but would like to first understand what is the
difference that makes one of them fail.
This view works fine:
@login_required
def url_parse(request):
cu = request.user
if request.method == 'POST':
form = UrlBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.url = form.cleaned_data['url']
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = UrlBragForm()
return render_to_response('brag/url_brag.html', {'form':form,},
context_instance=RequestContext(request))
But this view gives me a "This QueryDict instance is immutable" when
trying to fill the request.POST['brag'] with the 'clean' data when view is
not valid:
@login_required
def brag_add_image(request):
cu = request.user
if request.method == 'POST':
form = ImageAddBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
b.url = 'http://%s%s' %
(Site.objects.get_current().domain,
reverse('image_display', args=(b.pk,)))
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = ImageAddBragForm()
return render_to_response('brag/image_brag_add.html', {'form':form,},
context_instance=RequestContext(request))
How insert a image in canvas and after insert text in these canvas
How insert a image in canvas and after insert text in these canvas
I'm trying to insert a image in a canvas and after I want to insert a
input text in the same canvas but I cant do it, Anybody can help me?
thanks.
I'm trying to insert a image in a canvas and after I want to insert a
input text in the same canvas but I cant do it, Anybody can help me?
thanks.
How to retrieve the data from mindbodyonline using there API
How to retrieve the data from mindbodyonline using there API
I am working on a project where I need to get the data from the
mindbodyonline website , there is a demo page they have provided which
give the getClassDescription , but i want other services as
staffService appointmentService
etc.
I want to get the all data stored in the mindbody online , i need to pass
just the sourcename and password with siteID and the API should provide me
all the data related to my account in there.
Badly stuck need help.
I am working on a project where I need to get the data from the
mindbodyonline website , there is a demo page they have provided which
give the getClassDescription , but i want other services as
staffService appointmentService
etc.
I want to get the all data stored in the mindbody online , i need to pass
just the sourcename and password with siteID and the API should provide me
all the data related to my account in there.
Badly stuck need help.
Friday, 30 August 2013
Loop, Read stops after one record with GUI (doesn't loop)
Loop, Read stops after one record with GUI (doesn't loop)
I have a script for entering records in our system that was originally
working fine with a MsgBox, but I added a GUI to show the record entry.
Now the script stops after the first record.
In the example below I've stripped out all of the actions and record lines
to help make this easier to parse, but I've kept in all the important
stuff and tested this version of the script.
Loop, read, C:\_AutoHotKey\AA_test.txt
{
StringSplit, LineArray, A_LoopReadLine, %A_Tab%
aaduedate := LineArray1
aauniqueid := LineArray2
aaprefix := LineArray3
aasequence := LineArray4
aadescript := LineArray5
aaelig := LineArray6
;-------------------------------------------------------------------------------------
;Use these to test the file match in the Input File.
;Remove surrounding comments and surround the rest of the script up to the
last brace.
SendInput, Prefix: %aaprefix% {enter}
SendInput, Sequence: %aasequence% {enter}
SendInput, Description: %aadescript% {enter}
SendInput, Eligibility: %aaelig% {enter}
SendInput, ID Card: %aaidcard% {enter}
;---------------------------------------------------------------------------------------
;Pop-up validation menu
Gui, Add, Button, x22 y380 w100 h30 , &Submit
Gui, Add, Button, x362 y380 w100 h30 , &Cancel
Gui, Font, S14 CDefault, Verdana
Gui, Add, Text, x152 y10 w210 h30 +Center, Is the entry correct?
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x102 y40 w90 h20 , %aaprefix%
Gui, Add, Text, x102 y70 w130 h20 , %aaelig%
Gui, Add, Text, x312 y70 w30 h20 , %aadescript%
Gui, Add, Text, x432 y70 w30 h20 , %aaidcard%
Gui, Font, S8 CDefault, Verdana
Gui, Add, Text, x132 y380 w230 h40 +Center, Click Submit/press S to
continue. Click cancel to stop script.
; Generated using SmartGUI Creator 4.0
Gui, Show, x9 y250 h428 w480, Auto Action Validation
Return
ButtonCancel:
ExitApp
ButtonSubmit:
Gui, Submit ;
MouseMove, 630,55
Sleep, 100
SendInput, {Click 630,55}
SendInput ^S
Return
}
The buttons do work and clicking Submit will send the MouseMove and
SendInput. But after that it just stops and doesn't load the next record
in the text file.
Thanks in advance!
I have a script for entering records in our system that was originally
working fine with a MsgBox, but I added a GUI to show the record entry.
Now the script stops after the first record.
In the example below I've stripped out all of the actions and record lines
to help make this easier to parse, but I've kept in all the important
stuff and tested this version of the script.
Loop, read, C:\_AutoHotKey\AA_test.txt
{
StringSplit, LineArray, A_LoopReadLine, %A_Tab%
aaduedate := LineArray1
aauniqueid := LineArray2
aaprefix := LineArray3
aasequence := LineArray4
aadescript := LineArray5
aaelig := LineArray6
;-------------------------------------------------------------------------------------
;Use these to test the file match in the Input File.
;Remove surrounding comments and surround the rest of the script up to the
last brace.
SendInput, Prefix: %aaprefix% {enter}
SendInput, Sequence: %aasequence% {enter}
SendInput, Description: %aadescript% {enter}
SendInput, Eligibility: %aaelig% {enter}
SendInput, ID Card: %aaidcard% {enter}
;---------------------------------------------------------------------------------------
;Pop-up validation menu
Gui, Add, Button, x22 y380 w100 h30 , &Submit
Gui, Add, Button, x362 y380 w100 h30 , &Cancel
Gui, Font, S14 CDefault, Verdana
Gui, Add, Text, x152 y10 w210 h30 +Center, Is the entry correct?
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x102 y40 w90 h20 , %aaprefix%
Gui, Add, Text, x102 y70 w130 h20 , %aaelig%
Gui, Add, Text, x312 y70 w30 h20 , %aadescript%
Gui, Add, Text, x432 y70 w30 h20 , %aaidcard%
Gui, Font, S8 CDefault, Verdana
Gui, Add, Text, x132 y380 w230 h40 +Center, Click Submit/press S to
continue. Click cancel to stop script.
; Generated using SmartGUI Creator 4.0
Gui, Show, x9 y250 h428 w480, Auto Action Validation
Return
ButtonCancel:
ExitApp
ButtonSubmit:
Gui, Submit ;
MouseMove, 630,55
Sleep, 100
SendInput, {Click 630,55}
SendInput ^S
Return
}
The buttons do work and clicking Submit will send the MouseMove and
SendInput. But after that it just stops and doesn't load the next record
in the text file.
Thanks in advance!
Thursday, 29 August 2013
how to remember parameter values used on last build in Jenkins/Hudson
how to remember parameter values used on last build in Jenkins/Hudson
I need remember the last parameters values when I begin a new build with
parameters.
I Have two string parameters
${BRANCH}
${ServerSpecified}
On The first build execution I need those values in blank, but for the
second execution i need the values of the first execution, in the third
execution the values of the second execution, and so on...
I need install a plugin?, I tried using dynamic param with groovy, but I
can't extract the last value, Somebody know how make this or other best
idea.. thank you guys
I need remember the last parameters values when I begin a new build with
parameters.
I Have two string parameters
${BRANCH}
${ServerSpecified}
On The first build execution I need those values in blank, but for the
second execution i need the values of the first execution, in the third
execution the values of the second execution, and so on...
I need install a plugin?, I tried using dynamic param with groovy, but I
can't extract the last value, Somebody know how make this or other best
idea.. thank you guys
When iam trying to run spring example i am facing the following exception
When iam trying to run spring example i am facing the following exception
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [spring.test.StockValueFetcher] for bean with name 'stockBean'
defined in ServletContext resource [/WEB-INF/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
spring.test.StockValueFetcher
and my applicationContext.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="stockBean" class="spring.test.StockValueFetcher">
</bean>
</beans>
i have searched for the same in stackoverflow and other sites but i
couldnot find any helpful solution
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [spring.test.StockValueFetcher] for bean with name 'stockBean'
defined in ServletContext resource [/WEB-INF/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
spring.test.StockValueFetcher
and my applicationContext.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="stockBean" class="spring.test.StockValueFetcher">
</bean>
</beans>
i have searched for the same in stackoverflow and other sites but i
couldnot find any helpful solution
Wednesday, 28 August 2013
Build errors in eclipse
Build errors in eclipse
i have a big problem, i can't compile my eclipse projects.
Idon't understand whta is the problem. I have already searched for answer
but i stay helpless!
Hier the build error in eclipse:
Thank you!
i have a big problem, i can't compile my eclipse projects.
Idon't understand whta is the problem. I have already searched for answer
but i stay helpless!
Hier the build error in eclipse:
Thank you!
Shell script: variable scope in functions
Shell script: variable scope in functions
I wrote a quick shell script to emulate the situation of xkcd #981
(without hard links, just symlinks to parent dirs) and used a recursive
function to create all the directories. Unfortunately this script does not
provide the desired result, so I think my understanding of the scope of
variable $count is wrong.
How can I properly make the function use recursion to create twenty levels
of folders, each containing 3 folders (3^20 folders, ending in soft links
back to the top)?
#!/bin/bash
echo "Generating folders:"
toplevel=$PWD
count=1
GEN_DIRS() {
for i in 1 2 3
do
dirname=$RANDOM
mkdir $dirname
cd $dirname
count=$(expr $count + 1)
if [ $count < 20 ] ; then
GEN_DIRS
else
ln -s $toplevel "./$dirname"
fi
done
}
GEN_DIRS
exit
I wrote a quick shell script to emulate the situation of xkcd #981
(without hard links, just symlinks to parent dirs) and used a recursive
function to create all the directories. Unfortunately this script does not
provide the desired result, so I think my understanding of the scope of
variable $count is wrong.
How can I properly make the function use recursion to create twenty levels
of folders, each containing 3 folders (3^20 folders, ending in soft links
back to the top)?
#!/bin/bash
echo "Generating folders:"
toplevel=$PWD
count=1
GEN_DIRS() {
for i in 1 2 3
do
dirname=$RANDOM
mkdir $dirname
cd $dirname
count=$(expr $count + 1)
if [ $count < 20 ] ; then
GEN_DIRS
else
ln -s $toplevel "./$dirname"
fi
done
}
GEN_DIRS
exit
Resque job on Heroku stops without finishing
Resque job on Heroku stops without finishing
I am using heroku + resquetogo + rails 3.2.
My dynos are:
1 web ( web bundle exec rails server -p $PORT ) 1 resque (resque env
TERM_CHILD=1 RESQUE_TERM_TIMEOUT=240 bundle exec rake...) 1 worker (
worker bundle exec rake jobs:work)
My Rails app has the next config:
config/initializers/redis.rb
ENV["REDISTOGO_URL"] ||= "some url "
uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password =>
uri.password)
Resque.redis = REDIS
app/workers/my_worker.rb
class MyWorker
@queue = :test
def self.perform()
...
...
end
end
Setup
setup rake task
task :setup => :environment do
...
Resque.enqueue(MyWorker)
...
end
Procfile
resque: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=240 bundle exec rake resque:work
Resque Task
resque.rake
require "resque/tasks"
task "resque:setup" => :environment do
ENV['QUEUE'] = '*'
end
Alias
desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work"
Now when i run: "heroku run rake setup", i can see how the different
bakground jobs start to fire and work, but suddenly everyhting stops. No
error(already checked heroku logs -tail), no term signal, no nothing. It
just stops.
Any idea,?
Regards
I am using heroku + resquetogo + rails 3.2.
My dynos are:
1 web ( web bundle exec rails server -p $PORT ) 1 resque (resque env
TERM_CHILD=1 RESQUE_TERM_TIMEOUT=240 bundle exec rake...) 1 worker (
worker bundle exec rake jobs:work)
My Rails app has the next config:
config/initializers/redis.rb
ENV["REDISTOGO_URL"] ||= "some url "
uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password =>
uri.password)
Resque.redis = REDIS
app/workers/my_worker.rb
class MyWorker
@queue = :test
def self.perform()
...
...
end
end
Setup
setup rake task
task :setup => :environment do
...
Resque.enqueue(MyWorker)
...
end
Procfile
resque: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=240 bundle exec rake resque:work
Resque Task
resque.rake
require "resque/tasks"
task "resque:setup" => :environment do
ENV['QUEUE'] = '*'
end
Alias
desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work"
Now when i run: "heroku run rake setup", i can see how the different
bakground jobs start to fire and work, but suddenly everyhting stops. No
error(already checked heroku logs -tail), no term signal, no nothing. It
just stops.
Any idea,?
Regards
Cannot post in phpBB2 forum after moving DB
Cannot post in phpBB2 forum after moving DB
I changed my hosting provider and move my phpBB2 forum. I copied all files
and moved db. Everything is looking OK but I cannot make new post. In
particular when I try to post everything is OK but new topic isn't there.
All SQL queries is executed correctly and data is in DB but the problem is
in ID of the topic and the post. When insert row in phpbb_topics table
it's correct but the second query insert data in phpbb_posts with 0 in
topic_id field. The same happens with INSERT INTO phpbb_posts_text query.
It insert 0 in post_id field instead real id of post. Why is this
hapenning? The PHP code is the same. I don't change it. Tha data from old
DB is there and AUTO_INCREMENT field in information_schema db for this
tables is correct. Where is the problem? The only difference is the
server. Version of PHP is the same - 5.2.17 but MySQL is upper -
5.5.30-MariaDB-log (old was 5.1.63-cll). Is it possible some php function
not return correct id of last inserted row in db (apparently returned 0
instead real id).
I changed my hosting provider and move my phpBB2 forum. I copied all files
and moved db. Everything is looking OK but I cannot make new post. In
particular when I try to post everything is OK but new topic isn't there.
All SQL queries is executed correctly and data is in DB but the problem is
in ID of the topic and the post. When insert row in phpbb_topics table
it's correct but the second query insert data in phpbb_posts with 0 in
topic_id field. The same happens with INSERT INTO phpbb_posts_text query.
It insert 0 in post_id field instead real id of post. Why is this
hapenning? The PHP code is the same. I don't change it. Tha data from old
DB is there and AUTO_INCREMENT field in information_schema db for this
tables is correct. Where is the problem? The only difference is the
server. Version of PHP is the same - 5.2.17 but MySQL is upper -
5.5.30-MariaDB-log (old was 5.1.63-cll). Is it possible some php function
not return correct id of last inserted row in db (apparently returned 0
instead real id).
What is meant by PUT method idempotent in RESTful web service?
What is meant by PUT method idempotent in RESTful web service?
I am trying to decide which Http method should be used PUT or POST.
While looking at some posts on StackOverlflow I could see this post.
One of the answers in post says
PUT is idempotent, so if you PUT an object twice, it has no effect. This
is a nice property, so I would use PUT when possible.
Can some one help me out here with an example. Lets say that I have a
scenario where I am trying to create a student whose entry would be passed
in Student table in a RDBMS.
So here if I try to PUT that entry again and again will there be no effect?
I am trying to decide which Http method should be used PUT or POST.
While looking at some posts on StackOverlflow I could see this post.
One of the answers in post says
PUT is idempotent, so if you PUT an object twice, it has no effect. This
is a nice property, so I would use PUT when possible.
Can some one help me out here with an example. Lets say that I have a
scenario where I am trying to create a student whose entry would be passed
in Student table in a RDBMS.
So here if I try to PUT that entry again and again will there be no effect?
Securely adding new users to content server? [on hold]
Securely adding new users to content server? [on hold]
1) I'm currently making a small time storage server for personal use a
maybe a few friends. If you already have an account and can work UNIX
command line, then you can use programs such as puTTY to access it. I'm
currently making a program that lets you visually transfer files back and
forth, with a layout similar to dropbox. However, I'd like to add a
"Create new user" feature and I'm not sure how to securely do it.
Sure, I can have the program execute something like "sudo adduser jim" and
supply the sudo password, but this would require me to include an
administrative password within the jar file. I know there are obfuscation
programs out there, but it doesn't necessarily make it more secure. I'd
prefer to create users with ssh, but I'm open to whatever works and is
secure.
2) I just thought of something. What if I created an administrative user
with a their sudo ability limited to only creating new users? Does this
sound like a reasonably secure solution? If not, what are the cons of this
method?
1) I'm currently making a small time storage server for personal use a
maybe a few friends. If you already have an account and can work UNIX
command line, then you can use programs such as puTTY to access it. I'm
currently making a program that lets you visually transfer files back and
forth, with a layout similar to dropbox. However, I'd like to add a
"Create new user" feature and I'm not sure how to securely do it.
Sure, I can have the program execute something like "sudo adduser jim" and
supply the sudo password, but this would require me to include an
administrative password within the jar file. I know there are obfuscation
programs out there, but it doesn't necessarily make it more secure. I'd
prefer to create users with ssh, but I'm open to whatever works and is
secure.
2) I just thought of something. What if I created an administrative user
with a their sudo ability limited to only creating new users? Does this
sound like a reasonably secure solution? If not, what are the cons of this
method?
Tuesday, 27 August 2013
jquery function is not working
jquery function is not working
I have placed a repeater enveloped in a div inside an update panel.and add
a jquery function in the of page to add some effect on it. the jquery
function is called on every page_load event. it is working well n a test
page but doesn't show any effect when I implement it in the master page my
jquery function is
<script type="text/javascript">
function pageLoad(sender, args) {
// JQuery code goes here
function domReady() {
$('#btn1').click(showMessage);
$('#btn1').trigger('click');
}
function showMessage() {
$('#message').fadeOut(10);
$('#message').slideDown(1000);
};
$(domReady);
};
</script>}
and html is
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="5000"
ontick="Timer1_Tick">
</asp:Timer>
<br />
<div style="height:480px;overflow:scroll;">
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<div id="message" >
<img id="image" alt="visitors" runat="server"
src="~/icon-visitors.png" height="32" width="32"
/></td><td>
<b>A New visitor come from </b><b
class="data"><%#Eval("lt_country") %></b>
<%#Eval("pk_id") %> <br />
<b>Ip :- </b><%#Eval("lt_ip") %><b>/ Browser
:-</b><%#Browser(Eval("lt_browser").ToString()) %><b>/
Operating System
:</b><%#Os(Eval("lt_browser").ToString()) %><br /><br
/>
</div>
</ItemTemplate>
</asp:Repeater>
<button id="btn1" style="visibility:hidden;"></button>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
I have placed a repeater enveloped in a div inside an update panel.and add
a jquery function in the of page to add some effect on it. the jquery
function is called on every page_load event. it is working well n a test
page but doesn't show any effect when I implement it in the master page my
jquery function is
<script type="text/javascript">
function pageLoad(sender, args) {
// JQuery code goes here
function domReady() {
$('#btn1').click(showMessage);
$('#btn1').trigger('click');
}
function showMessage() {
$('#message').fadeOut(10);
$('#message').slideDown(1000);
};
$(domReady);
};
</script>}
and html is
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="5000"
ontick="Timer1_Tick">
</asp:Timer>
<br />
<div style="height:480px;overflow:scroll;">
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<div id="message" >
<img id="image" alt="visitors" runat="server"
src="~/icon-visitors.png" height="32" width="32"
/></td><td>
<b>A New visitor come from </b><b
class="data"><%#Eval("lt_country") %></b>
<%#Eval("pk_id") %> <br />
<b>Ip :- </b><%#Eval("lt_ip") %><b>/ Browser
:-</b><%#Browser(Eval("lt_browser").ToString()) %><b>/
Operating System
:</b><%#Os(Eval("lt_browser").ToString()) %><br /><br
/>
</div>
</ItemTemplate>
</asp:Repeater>
<button id="btn1" style="visibility:hidden;"></button>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
copy and paste in *pure* command-line environment
copy and paste in *pure* command-line environment
I have Ubuntu running on my machine, but the windows manager sometimes
goes on vacation for sometime! And I also find it faster to work in the
command-line environment.
The only downside to this is that there's no way (that I know of) to
copy/paste text from the terminal.
Does anyone happen to know if there is anyone to copy/paste text in a pure
command-line environment? (ie., no mouse (or its relatives))
THanks
I have Ubuntu running on my machine, but the windows manager sometimes
goes on vacation for sometime! And I also find it faster to work in the
command-line environment.
The only downside to this is that there's no way (that I know of) to
copy/paste text from the terminal.
Does anyone happen to know if there is anyone to copy/paste text in a pure
command-line environment? (ie., no mouse (or its relatives))
THanks
Comparing if a stack of data exists in two different tables
Comparing if a stack of data exists in two different tables
im new to Oracle and sql but I was assigned this job and I hope someone
can help me out with this one.
Basically I am given a database link to connect to a remote database and I
extract some information from a single table in there and a few other
tables from a local database, and then process it and insert it into a
table in the local database. I`ve managed to do this succesfully but now I
need a way to confirm that all of the data from the remote database was
actually copied into the local database. How would I go about doing this?
This is the code I have to insert the information to my local db.
INSERT INTO kcrt_requests_int RI
RI.TRANSACTION_ID,
RI.DESCRIPTION,
RI.CREATED_USERNAME,
RI.REQUEST_TYPE_ID,
RI.STATUS_ID,
RI.WORKFLOW_ID,
RI.WORKFLOW_STEP_ID,
RI.RELEASED_FLAG,
RI.USER_DATA1,
RI.USER_DATA2,
RI.USER_DATA3,
RI.USER_DATA4,
RI.USER_DATA7)
SELECT
KCRT_TRANSACTIONS_S.NEXTVAL,
RD.PARAMETER13||' '||R.DESCRIPTION,
'[SYS.USERNAME]',
'0001',
'31876',
'34987', '1234',
'Y',
PP.PROJECT_ID,
VP.REVIEWDATE,
RD.PARAMETER9,
R.REQUEST_ID,
RD.PARAMETER13
FROM
KCRT_REQUEST_TYPES_NLS RT,
KCRT_REQUESTS R,
KCRT_REQUEST_DETAILS RD,
v_projects@XXXXX VP,
PM_PROJECTS PP
WHERE
R.REQUEST_TYPE=RT.REQUEST_TYPE_ID
AND R.REQUEST_ID=RD.REQUEST_ID
AND RD.BATCH_NUMBER=1
AND RT.REQUEST_TYPE_NAME 'AAAAA'
AND R.STATUS_CODE = 'BBBBB'
AND RD.PARAMETER13 = to_char(VP.IDBANK)
AND VP.REVIEWDATE=(SELECT MAX (VP.REVIEWDATE) FROM v_projects@XXXXX VP)
AND R.REQUEST_ID=PP.PFM_REQUEST_ID
AND RD.BATCH_NUMBER=1
So pretty much I will try to compare RI.USER_DATA7 to VP.IDBANK and see if
KCRT_REQUESTS_INT has every row that v_projects@XXXXX has.
Thanks for any help!
im new to Oracle and sql but I was assigned this job and I hope someone
can help me out with this one.
Basically I am given a database link to connect to a remote database and I
extract some information from a single table in there and a few other
tables from a local database, and then process it and insert it into a
table in the local database. I`ve managed to do this succesfully but now I
need a way to confirm that all of the data from the remote database was
actually copied into the local database. How would I go about doing this?
This is the code I have to insert the information to my local db.
INSERT INTO kcrt_requests_int RI
RI.TRANSACTION_ID,
RI.DESCRIPTION,
RI.CREATED_USERNAME,
RI.REQUEST_TYPE_ID,
RI.STATUS_ID,
RI.WORKFLOW_ID,
RI.WORKFLOW_STEP_ID,
RI.RELEASED_FLAG,
RI.USER_DATA1,
RI.USER_DATA2,
RI.USER_DATA3,
RI.USER_DATA4,
RI.USER_DATA7)
SELECT
KCRT_TRANSACTIONS_S.NEXTVAL,
RD.PARAMETER13||' '||R.DESCRIPTION,
'[SYS.USERNAME]',
'0001',
'31876',
'34987', '1234',
'Y',
PP.PROJECT_ID,
VP.REVIEWDATE,
RD.PARAMETER9,
R.REQUEST_ID,
RD.PARAMETER13
FROM
KCRT_REQUEST_TYPES_NLS RT,
KCRT_REQUESTS R,
KCRT_REQUEST_DETAILS RD,
v_projects@XXXXX VP,
PM_PROJECTS PP
WHERE
R.REQUEST_TYPE=RT.REQUEST_TYPE_ID
AND R.REQUEST_ID=RD.REQUEST_ID
AND RD.BATCH_NUMBER=1
AND RT.REQUEST_TYPE_NAME 'AAAAA'
AND R.STATUS_CODE = 'BBBBB'
AND RD.PARAMETER13 = to_char(VP.IDBANK)
AND VP.REVIEWDATE=(SELECT MAX (VP.REVIEWDATE) FROM v_projects@XXXXX VP)
AND R.REQUEST_ID=PP.PFM_REQUEST_ID
AND RD.BATCH_NUMBER=1
So pretty much I will try to compare RI.USER_DATA7 to VP.IDBANK and see if
KCRT_REQUESTS_INT has every row that v_projects@XXXXX has.
Thanks for any help!
Communicate between 2 web client in asp.net?
Communicate between 2 web client in asp.net?
are there have any solution to communicate between 2 web client in the
same web server ??? for example, so I have 2 web client (A and B) and the
web server (S). So A & B is online now, when A make a post-back to S and
include some information that need to pass to B, At this time how can B
know A have some information need to pass for it ??? are there have any
way to trigger the S pass the information to B that B don't need to make a
post-back to S ???
are there have any solution to communicate between 2 web client in the
same web server ??? for example, so I have 2 web client (A and B) and the
web server (S). So A & B is online now, when A make a post-back to S and
include some information that need to pass to B, At this time how can B
know A have some information need to pass for it ??? are there have any
way to trigger the S pass the information to B that B don't need to make a
post-back to S ???
Tcl namespace renaming to avoid conflicts
Tcl namespace renaming to avoid conflicts
I want to rename or delete namespace in tcl ,can anyone tell me how to do it
rename gk ""
here gk is the namespace
I want to rename or delete namespace in tcl ,can anyone tell me how to do it
rename gk ""
here gk is the namespace
Piwik tracking hanging at database insert
Piwik tracking hanging at database insert
I'm using Piwik to track hits to my site. It's fairly popular (~4k
visits/30k pageviews per day on average); until recently it was hosted on
Dreamhost and barely worked because it was too big to archive without
hitting the memory limit.
I recently moved it to my VPS using nginx and php5-fpm, but now I have
another problem: the tracker keeps hanging at the query. Currently, it's
using its own pool of php5-fpm processes, but they tend to get clogged:
[27-Aug-2013 03:20:05] WARNING: [pool stats] child 5908, script
'/var/www/stats/piwik.php' (request: "GET /piwik.php") execution timed
out (76.106048 sec), terminating
[27-Aug-2013 03:20:05] WARNING: [pool stats] child 5905, script
'/var/www/stats/piwik.php' (request: "GET /piwik.php") execution timed
out (82.416656 sec), terminating
[27-Aug-2013 03:20:05] WARNING: [pool stats] child 5914 exited on signal
15 (SIGTERM) after 75.932611 seconds from start
[27-Aug-2013 03:20:05] NOTICE: [pool stats] child 6219 started
etc etc etc ...
The slow log points to a large SELECT query in core/Tracker/Visit.php:1203
[27-Aug-2013 03:17:52] [pool stats] pid 5789
script_filename = /var/www/stats/piwik.php
[0x091b21b4] xecute() /var/www/stats/core/Tracker/Db/Pdo/Mysql.php:159
[0x091b2024] query() /var/www/stats/core/Tracker/Db/Pdo/Mysql.php:126
[0x091b0bfc] fetch() /var/www/stats/core/Tracker/Visit.php:1203
The tables are optimized and as far as I know up to date. I can't find any
reason why the insert query keeps hanging; I've used mysqltuner to try to
adjust caching/etc to reasonable values, but for whatever reason the
processes continue to lock up and clog the system.
The problem isn't always obvious, either; it can go for a while before
everything suddenly goes downhill. I haven't been able to find any obvious
correlation between when it starts falling apart and any particular
request or log.
I'm using Piwik to track hits to my site. It's fairly popular (~4k
visits/30k pageviews per day on average); until recently it was hosted on
Dreamhost and barely worked because it was too big to archive without
hitting the memory limit.
I recently moved it to my VPS using nginx and php5-fpm, but now I have
another problem: the tracker keeps hanging at the query. Currently, it's
using its own pool of php5-fpm processes, but they tend to get clogged:
[27-Aug-2013 03:20:05] WARNING: [pool stats] child 5908, script
'/var/www/stats/piwik.php' (request: "GET /piwik.php") execution timed
out (76.106048 sec), terminating
[27-Aug-2013 03:20:05] WARNING: [pool stats] child 5905, script
'/var/www/stats/piwik.php' (request: "GET /piwik.php") execution timed
out (82.416656 sec), terminating
[27-Aug-2013 03:20:05] WARNING: [pool stats] child 5914 exited on signal
15 (SIGTERM) after 75.932611 seconds from start
[27-Aug-2013 03:20:05] NOTICE: [pool stats] child 6219 started
etc etc etc ...
The slow log points to a large SELECT query in core/Tracker/Visit.php:1203
[27-Aug-2013 03:17:52] [pool stats] pid 5789
script_filename = /var/www/stats/piwik.php
[0x091b21b4] xecute() /var/www/stats/core/Tracker/Db/Pdo/Mysql.php:159
[0x091b2024] query() /var/www/stats/core/Tracker/Db/Pdo/Mysql.php:126
[0x091b0bfc] fetch() /var/www/stats/core/Tracker/Visit.php:1203
The tables are optimized and as far as I know up to date. I can't find any
reason why the insert query keeps hanging; I've used mysqltuner to try to
adjust caching/etc to reasonable values, but for whatever reason the
processes continue to lock up and clog the system.
The problem isn't always obvious, either; it can go for a while before
everything suddenly goes downhill. I haven't been able to find any obvious
correlation between when it starts falling apart and any particular
request or log.
Monday, 26 August 2013
Rails 4 equivalent of Rails 3 'Model.all'
Rails 4 equivalent of Rails 3 'Model.all'
In Rails 3 if I wanted to hit the db I'd take .all on the end of a query.
This is useful for when I'm doing things like refreshing cache on writes
(so reads always hit cache).
Now in Rails 4, Model.all returns an ActiveRecord::Relation object (ie
doesn't hit the db). What is the best way to get it actually go to the db
and return the records specified?
In Rails 3 if I wanted to hit the db I'd take .all on the end of a query.
This is useful for when I'm doing things like refreshing cache on writes
(so reads always hit cache).
Now in Rails 4, Model.all returns an ActiveRecord::Relation object (ie
doesn't hit the db). What is the best way to get it actually go to the db
and return the records specified?
Set up smart mailbox to hold all messages to AND from a particular person
Set up smart mailbox to hold all messages to AND from a particular person
I want a smart mailbox that will display all the emails sent to me by a
particular person as well as all the emails I've sent them.
I assumed that setting the rules to be
Contains messages that match ANY of the following;
From Is Equal To Person
Any Recipient Is Equal To Person
but all I get is messages from Person.
This doesn't do the trick so what am I missing? Shouldn't it return any
emails sent from Person and any emails wherein Person is a recipient?
I want a smart mailbox that will display all the emails sent to me by a
particular person as well as all the emails I've sent them.
I assumed that setting the rules to be
Contains messages that match ANY of the following;
From Is Equal To Person
Any Recipient Is Equal To Person
but all I get is messages from Person.
This doesn't do the trick so what am I missing? Shouldn't it return any
emails sent from Person and any emails wherein Person is a recipient?
AngularJS custom directive using event listener
AngularJS custom directive using event listener
I am trying to create a custom directive that contains a text box that is
shown, expanded and focused when a user clicks a button. And when the user
clicks away from the expanded text box it should minimize, disappear and
then show the original button. Here's what I have so far:
http://jsfiddle.net/Z6RzD/152/
Here is the section that I am having problems with:
if (htmlTxtBox.addEventListener !== undefined) {
console.log("first");
htmlTxtBox.addEventListener('focus', setFocus(), false);
//this function is automatically called even when textBox is in focus
//htmlTxtBox.addEventListener('blur', setNoFocus(), false);
console.log("ifHasFocus: " + scope.showInput);
} else if (htmlTxtBox.attachEvent != undefined) {
console.log("second");
htmlTxtBox.attachEvent('onfocus', setFocus());
htmlTxtBox.attachEvent('onblur', setNoFocus());
} else {
console.log("third");
htmlTxtBox.onmouseover = setFocus();
htmlTxtBox.onmouseout = setNoFocus();
}
And the corresponding functions that run with the event listener:
function setFocus() {
scope.$apply('showInput = true');
console.log("setFocus: " + scope.showInput);
}
function setNoFocus(){
scope.$apply('showInput = false');
console.log("setNoFocus: " + scope.showInput);
}
My problem is that the setFocus and setNoFocus functions run no matter
what. How can I structure these functions to where they run only when the
textbox is focused or blurred? I appreciate any help. Thanks!
I am trying to create a custom directive that contains a text box that is
shown, expanded and focused when a user clicks a button. And when the user
clicks away from the expanded text box it should minimize, disappear and
then show the original button. Here's what I have so far:
http://jsfiddle.net/Z6RzD/152/
Here is the section that I am having problems with:
if (htmlTxtBox.addEventListener !== undefined) {
console.log("first");
htmlTxtBox.addEventListener('focus', setFocus(), false);
//this function is automatically called even when textBox is in focus
//htmlTxtBox.addEventListener('blur', setNoFocus(), false);
console.log("ifHasFocus: " + scope.showInput);
} else if (htmlTxtBox.attachEvent != undefined) {
console.log("second");
htmlTxtBox.attachEvent('onfocus', setFocus());
htmlTxtBox.attachEvent('onblur', setNoFocus());
} else {
console.log("third");
htmlTxtBox.onmouseover = setFocus();
htmlTxtBox.onmouseout = setNoFocus();
}
And the corresponding functions that run with the event listener:
function setFocus() {
scope.$apply('showInput = true');
console.log("setFocus: " + scope.showInput);
}
function setNoFocus(){
scope.$apply('showInput = false');
console.log("setNoFocus: " + scope.showInput);
}
My problem is that the setFocus and setNoFocus functions run no matter
what. How can I structure these functions to where they run only when the
textbox is focused or blurred? I appreciate any help. Thanks!
populate google chart datatable with arrayToDataTable in django template
populate google chart datatable with arrayToDataTable in django template
I have a list of tuples passed to the template. I want to populate a
datatable with it. Here is the code. Does anyone know what is wrong with
it? Currently nothing shows on the webpage. Thank you.
var dt=new google.visualization.arrayToDataTable([
['Name','LastGPA','CurGPA','IntervalA','IntervalB','Major'],
{% for d in data %}
[{{d.0}},{{d.1}},{{d.2}},{{d.3}},{{d.4}},{{d.5}}]
{% if not forloop.last %},{% endif %}
{% endfor %}
]);
summary_table.draw(dt);
I have a list of tuples passed to the template. I want to populate a
datatable with it. Here is the code. Does anyone know what is wrong with
it? Currently nothing shows on the webpage. Thank you.
var dt=new google.visualization.arrayToDataTable([
['Name','LastGPA','CurGPA','IntervalA','IntervalB','Major'],
{% for d in data %}
[{{d.0}},{{d.1}},{{d.2}},{{d.3}},{{d.4}},{{d.5}}]
{% if not forloop.last %},{% endif %}
{% endfor %}
]);
summary_table.draw(dt);
gromacs compilation gives undefined reference error
gromacs compilation gives undefined reference error
i would like to use gromacs on my open suse 12.3 platform but am having
trouble with it. when trying to compile an analyzing tool using
gmx_template i first got this error:
g++ -L/usr/local/gromacs/lib -o msd msd.o -lmd -lgmx -lfftw3f -lxml2 -lnsl
-lm
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
/usr/local /gromacs/lib/libgmx.a(pthreads.c.o): undefined reference to
symbol 'pthread_getaffinity_np@@GLIBC_2.3.4'
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
note: 'pthread_getaffinity_np@@GLIBC_2.3.4' is defined in DSO
/lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: * [msd] Fehler 1
then i added /lib64/libpthread.so.0 to the -L options in the makefile
but now i get a lot of errors like this:
/usr/local/gromacs/lib/libgmx.a(pbc.c.o): In function
`put_atoms_in_box_omp._omp_fn.0':
pbc.c:(.text+0x862f): undefined reference to `omp_get_num_threads'
i think they are all related to openmp. i do not understand enough of the
building process to enable openmp support (probably -fopenmp) and am at
the same time surprised in case i would have to change the cmake files in
order to make gromacs work. i used the quick and dirty install following
the gromacs installation instructions on their website.
any suggestions what i can do / did wrong so far ? i am using gcc 4.7
i would like to use gromacs on my open suse 12.3 platform but am having
trouble with it. when trying to compile an analyzing tool using
gmx_template i first got this error:
g++ -L/usr/local/gromacs/lib -o msd msd.o -lmd -lgmx -lfftw3f -lxml2 -lnsl
-lm
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
/usr/local /gromacs/lib/libgmx.a(pthreads.c.o): undefined reference to
symbol 'pthread_getaffinity_np@@GLIBC_2.3.4'
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
note: 'pthread_getaffinity_np@@GLIBC_2.3.4' is defined in DSO
/lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: * [msd] Fehler 1
then i added /lib64/libpthread.so.0 to the -L options in the makefile
but now i get a lot of errors like this:
/usr/local/gromacs/lib/libgmx.a(pbc.c.o): In function
`put_atoms_in_box_omp._omp_fn.0':
pbc.c:(.text+0x862f): undefined reference to `omp_get_num_threads'
i think they are all related to openmp. i do not understand enough of the
building process to enable openmp support (probably -fopenmp) and am at
the same time surprised in case i would have to change the cmake files in
order to make gromacs work. i used the quick and dirty install following
the gromacs installation instructions on their website.
any suggestions what i can do / did wrong so far ? i am using gcc 4.7
IIS is taking lot of time to deliver first javascript and image file
IIS is taking lot of time to deliver first javascript and image file
We have a Content Management Application and when we did the testing using
a load runner we saw very good performance (pages were rendered less than
2 seconds (most of them in milliseconds).
But now we are monitoring the application with various tools and we
noticed that the first session of the user is taking a lot of time (like
50 seconds) and when we check the first javascript and the first image
loads in about 20 to 30 seconds each. It is always the first javascript
and first image (how small the file size is, I swapped the file order and
see the same behavior) I am not sure where to start the debugging. Any
help where to start the debugging will be highly appricated.
Thanks
We have a Content Management Application and when we did the testing using
a load runner we saw very good performance (pages were rendered less than
2 seconds (most of them in milliseconds).
But now we are monitoring the application with various tools and we
noticed that the first session of the user is taking a lot of time (like
50 seconds) and when we check the first javascript and the first image
loads in about 20 to 30 seconds each. It is always the first javascript
and first image (how small the file size is, I swapped the file order and
see the same behavior) I am not sure where to start the debugging. Any
help where to start the debugging will be highly appricated.
Thanks
Under what circumstances is it feasible to use exception handling?
Under what circumstances is it feasible to use exception handling?
I have seen many exception handling mechanisms where they simply weren't
necessary. A lot of the times the problem could have been solved in a much
cleaner way using simple if statements.
For example, things like:
Invalid input
Division by zero
Wrong type
Container range check
Null pointer
Uninitialized data
... and so on.
Could someone provide an example where it would be a better approach to
handle exceptions?
I have seen many exception handling mechanisms where they simply weren't
necessary. A lot of the times the problem could have been solved in a much
cleaner way using simple if statements.
For example, things like:
Invalid input
Division by zero
Wrong type
Container range check
Null pointer
Uninitialized data
... and so on.
Could someone provide an example where it would be a better approach to
handle exceptions?
Can we add class attribute in option element?
Can we add class attribute in option element?
I want to add class for my option element. Is that valid to add class
attribute in HTML option element?
I want to add class for my option element. Is that valid to add class
attribute in HTML option element?
Sunday, 25 August 2013
SQL, how to find consecutive rows based on the value of a column?
SQL, how to find consecutive rows based on the value of a column?
I have some data. I want to group them based on the value of data column.
If there are 3 or more consecutive rows that have data bigger than 10,
then those rows are what I want.
So for this data:
use tempdb;
go
set nocount on;
if object_id('t', 'U') is not null
drop table t;
go
create table t
(
id int primary key identity,
[when] datetime,
data int
)
go
insert into t([when], data) values ('20130801', 1);
insert into t([when], data) values ('20130802', 121);
insert into t([when], data) values ('20130803', 132);
insert into t([when], data) values ('20130804', 15);
insert into t([when], data) values ('20130805', 9);
insert into t([when], data) values ('20130806', 1435);
insert into t([when], data) values ('20130807', 143);
insert into t([when], data) values ('20130808', 18);
insert into t([when], data) values ('20130809', 19);
insert into t([when], data) values ('20130810', 1);
insert into t([when], data) values ('20130811', 1234);
insert into t([when], data) values ('20130812', 124);
insert into t([when], data) values ('20130813', 6);
select * from t;
What I want is:
id when data
----------- ----------------------- -----------
2 2013-08-02 00:00:00.000 121
3 2013-08-03 00:00:00.000 132
4 2013-08-04 00:00:00.000 15
6 2013-08-06 00:00:00.000 1435
7 2013-08-07 00:00:00.000 143
8 2013-08-08 00:00:00.000 18
9 2013-08-09 00:00:00.000 19
How to do that? Thanks.
I have some data. I want to group them based on the value of data column.
If there are 3 or more consecutive rows that have data bigger than 10,
then those rows are what I want.
So for this data:
use tempdb;
go
set nocount on;
if object_id('t', 'U') is not null
drop table t;
go
create table t
(
id int primary key identity,
[when] datetime,
data int
)
go
insert into t([when], data) values ('20130801', 1);
insert into t([when], data) values ('20130802', 121);
insert into t([when], data) values ('20130803', 132);
insert into t([when], data) values ('20130804', 15);
insert into t([when], data) values ('20130805', 9);
insert into t([when], data) values ('20130806', 1435);
insert into t([when], data) values ('20130807', 143);
insert into t([when], data) values ('20130808', 18);
insert into t([when], data) values ('20130809', 19);
insert into t([when], data) values ('20130810', 1);
insert into t([when], data) values ('20130811', 1234);
insert into t([when], data) values ('20130812', 124);
insert into t([when], data) values ('20130813', 6);
select * from t;
What I want is:
id when data
----------- ----------------------- -----------
2 2013-08-02 00:00:00.000 121
3 2013-08-03 00:00:00.000 132
4 2013-08-04 00:00:00.000 15
6 2013-08-06 00:00:00.000 1435
7 2013-08-07 00:00:00.000 143
8 2013-08-08 00:00:00.000 18
9 2013-08-09 00:00:00.000 19
How to do that? Thanks.
Easiest way to monitor New Relic APDEX in realtime
Easiest way to monitor New Relic APDEX in realtime
We're scaling our servers based on APDEX value, and for now I'm polling
for it every X minutes.
I'd like to know if there is a way to get APDEX value when it CHANGES
through WebHooks. From what I read in docs, I can get WebHooks
notification only whenever there is an alert or deployment, but what I'm
looking for is to get a notification whenever APDEX value changes.
Thank you in advance - Jack
We're scaling our servers based on APDEX value, and for now I'm polling
for it every X minutes.
I'd like to know if there is a way to get APDEX value when it CHANGES
through WebHooks. From what I read in docs, I can get WebHooks
notification only whenever there is an alert or deployment, but what I'm
looking for is to get a notification whenever APDEX value changes.
Thank you in advance - Jack
Saturday, 24 August 2013
How does Android volume control work?
How does Android volume control work?
For example, when you use the Volume rocker to raise the volume, a volume
adjuster appears without interfering with the ongoing activity. I will
able to continue playing a game for example, without it pausing and still
have the ability to increase the volume. I am talking about this volume
control http://imgur.com/Ars7H7w
Anyone know how this is achieved? Source code maybe?
For example, when you use the Volume rocker to raise the volume, a volume
adjuster appears without interfering with the ongoing activity. I will
able to continue playing a game for example, without it pausing and still
have the ability to increase the volume. I am talking about this volume
control http://imgur.com/Ars7H7w
Anyone know how this is achieved? Source code maybe?
Multiple item name copying
Multiple item name copying
So I've got a folder with 2n files. n them are .foo files, n of them .bar
files. I want to copy the filenames of the .foo files (which are all
different) to the .bar files ordered alphabetically. The extension must
remain as they are.
So I've got a folder with 2n files. n them are .foo files, n of them .bar
files. I want to copy the filenames of the .foo files (which are all
different) to the .bar files ordered alphabetically. The extension must
remain as they are.
User Login and Password: Database Conformation
User Login and Password: Database Conformation
I am creating an app that requires a user to login before enter the main
app. When he hits the "login" button, it should check to make sure that
the email/username and password are correct before allowing the user into
the app or else give them an error. I have been having a hard time trying
to figure out how to do this. Here is my main_activity pages which show
the main login screen.
<LinearLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical">
<!-- Email Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#372c24"
android:text="@string/Email"/>
<EditText
android:id="@+id/Email_enter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:hint="@string/Email_enter"
android:singleLine="true"
android:inputType="textEmailAddress"/>
<!-- Password Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#372c24"
android:text="@string/edit_message2"/>
<EditText
android:id="@+id/Password_enter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:hint="@string/Password_enter"
android:inputType="textPassword"
android:singleLine="true" />
<!-- Login button -->
<Button android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="@string/Login"
android:onClick="sendMessage"/>
<Button
android:id="@+id/query"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Query"
android:onClick="View arg0"/>
Please ignore the "query" button for now. Here is the java file:
package com.example.awesomefilebuilder;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Base_Activity {
public final static String EXTRA_MESSAGE =
"com.example.awesomefilebuilder.MESSAGE";
public final String TAG = "MainActivity";
public final String edit_message ="Username";
public static final String DATABASE_NAME = "data";
public static final String TABLE_NAME = "comments_table";
public static final String C_ID = "_id";
public static final String NAME = "name";
public static final String COMMENT = "comment";
public static final String EMAIL = "email";
public static final String TIME = "time";
public static final String PASSWORD = "password";
public static final int VERSION = 1;
View view;
SQLiteDatabase db;
DbHelper dbhelper;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
DbHelper dbhelper = new DbHelper(getApplicationContext());
db = dbhelper.getWritableDatabase();
view = inflater.inflate(R. layout.activity_main, container,false);
ContentValues cv = new ContentValues();
cv.put(DbHelper.NAME, NAME);
cv.put(DbHelper.COMMENT, COMMENT);
cv.put(DbHelper.EMAIL, EMAIL);
cv.put(DbHelper.PASSWORD, PASSWORD);
db.insert(DbHelper.TABLE_NAME, null, cv);
Button query = (Button) view.findViewById(R.id.query);
query.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0)
{
String [] columns = {DbHelper.NAME, DbHelper.COMMENT,
DbHelper.EMAIL};
Cursor cursor = db.query(DbHelper.TABLE_NAME, null, null,
null, null, null, null);
cursor.moveToFirst();
while(cursor.moveToNext())
{
String name =
cursor.getString(cursor.getColumnIndex(DbHelper.NAME));
String comment =
cursor.getString(cursor.getColumnIndex(DbHelper.COMMENT));
String password =
cursor.getString(cursor.getColumnIndex(DbHelper.PASSWORD));
String email =
cursor.getString(cursor.getColumnIndex(DbHelper.EMAIL));
Toast.makeText(getApplicationContext(), "Name = "+
name +"/nComment= "+
comment,Toast.LENGTH_SHORT).show();
}
cursor.close();
}
});
return view;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.i(TAG, "onCreate" );
}
@Override
public void onDestroy() {
super.onDestroy(); // Always call the superclass
// Stop method tracing that the activity started during onCreate()
android.os.Debug.stopMethodTracing();
}
/** Called when the user clicks the Send button */
public void sendMessage(View view) {
Intent intent = new Intent(this, HomePageMain.class);
EditText editText = (EditText) findViewById(R.id.Email_enter);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
Log.i(TAG, "sendMessage" );
}
};
When the user hits the Login button, I want the app to check the data
before allowing them in or giving an error. How do I do this here? After
that, if the data does check out correctly, I want the app to send the
user to the next main page called HomePageMain.class.
If any other pages are needed, please let me know. Thanks in advance! I
really apperciate it.
I am creating an app that requires a user to login before enter the main
app. When he hits the "login" button, it should check to make sure that
the email/username and password are correct before allowing the user into
the app or else give them an error. I have been having a hard time trying
to figure out how to do this. Here is my main_activity pages which show
the main login screen.
<LinearLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical">
<!-- Email Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#372c24"
android:text="@string/Email"/>
<EditText
android:id="@+id/Email_enter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:hint="@string/Email_enter"
android:singleLine="true"
android:inputType="textEmailAddress"/>
<!-- Password Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#372c24"
android:text="@string/edit_message2"/>
<EditText
android:id="@+id/Password_enter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:hint="@string/Password_enter"
android:inputType="textPassword"
android:singleLine="true" />
<!-- Login button -->
<Button android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="@string/Login"
android:onClick="sendMessage"/>
<Button
android:id="@+id/query"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Query"
android:onClick="View arg0"/>
Please ignore the "query" button for now. Here is the java file:
package com.example.awesomefilebuilder;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Base_Activity {
public final static String EXTRA_MESSAGE =
"com.example.awesomefilebuilder.MESSAGE";
public final String TAG = "MainActivity";
public final String edit_message ="Username";
public static final String DATABASE_NAME = "data";
public static final String TABLE_NAME = "comments_table";
public static final String C_ID = "_id";
public static final String NAME = "name";
public static final String COMMENT = "comment";
public static final String EMAIL = "email";
public static final String TIME = "time";
public static final String PASSWORD = "password";
public static final int VERSION = 1;
View view;
SQLiteDatabase db;
DbHelper dbhelper;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
DbHelper dbhelper = new DbHelper(getApplicationContext());
db = dbhelper.getWritableDatabase();
view = inflater.inflate(R. layout.activity_main, container,false);
ContentValues cv = new ContentValues();
cv.put(DbHelper.NAME, NAME);
cv.put(DbHelper.COMMENT, COMMENT);
cv.put(DbHelper.EMAIL, EMAIL);
cv.put(DbHelper.PASSWORD, PASSWORD);
db.insert(DbHelper.TABLE_NAME, null, cv);
Button query = (Button) view.findViewById(R.id.query);
query.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0)
{
String [] columns = {DbHelper.NAME, DbHelper.COMMENT,
DbHelper.EMAIL};
Cursor cursor = db.query(DbHelper.TABLE_NAME, null, null,
null, null, null, null);
cursor.moveToFirst();
while(cursor.moveToNext())
{
String name =
cursor.getString(cursor.getColumnIndex(DbHelper.NAME));
String comment =
cursor.getString(cursor.getColumnIndex(DbHelper.COMMENT));
String password =
cursor.getString(cursor.getColumnIndex(DbHelper.PASSWORD));
String email =
cursor.getString(cursor.getColumnIndex(DbHelper.EMAIL));
Toast.makeText(getApplicationContext(), "Name = "+
name +"/nComment= "+
comment,Toast.LENGTH_SHORT).show();
}
cursor.close();
}
});
return view;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.i(TAG, "onCreate" );
}
@Override
public void onDestroy() {
super.onDestroy(); // Always call the superclass
// Stop method tracing that the activity started during onCreate()
android.os.Debug.stopMethodTracing();
}
/** Called when the user clicks the Send button */
public void sendMessage(View view) {
Intent intent = new Intent(this, HomePageMain.class);
EditText editText = (EditText) findViewById(R.id.Email_enter);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
Log.i(TAG, "sendMessage" );
}
};
When the user hits the Login button, I want the app to check the data
before allowing them in or giving an error. How do I do this here? After
that, if the data does check out correctly, I want the app to send the
user to the next main page called HomePageMain.class.
If any other pages are needed, please let me know. Thanks in advance! I
really apperciate it.
how to convert ashx written in c#.net?
how to convert ashx written in c#.net?
In fact I dont know any thing in php , but I have .ashx oage written in
c#.net , and I need to convert this page to php to use this page on linux
server , please I need suggestions . I have use asp.net 3.5
In fact I dont know any thing in php , but I have .ashx oage written in
c#.net , and I need to convert this page to php to use this page on linux
server , please I need suggestions . I have use asp.net 3.5
How do I find "prob=?" in this equation pbinom(q=5,size=10,prob=?,lower.tail=FALSE)=.1?
How do I find "prob=?" in this equation
pbinom(q=5,size=10,prob=?,lower.tail=FALSE)=.1?
How do I solve for the "prob=" parameter of pbinom() if I want pbinom() to
equal a specific value and I assume values for "q=" and "size="
parameters? Let's assume that I want pbinom() to equal 0.1 when I have
q=5, size=10, and lower.tail=FALSE, is there a function or way to
determine to what the "prob=" parameter should be equal? For example:
> pbinom(q=5,size=10,prob=.3542,lower.tail=FALSE)
[1] 0.09998054
Through trial and error, I found that prob=.3542 is close enough. I know
that qbinom() is the inverse of pbinom(), but I'm not interested in
finding q=5 given I want pbinom()=.1. I instead want to find "prob=" given
I know pbinom(q=5,size=10,prob=?,lower.tail=FALSE)=.1. Thanks in advance
for your help.
*Sorry if this has already been answered elsewhere. I looked and couldn't
find it. Seems pretty simple, so I was surprised.
pbinom(q=5,size=10,prob=?,lower.tail=FALSE)=.1?
How do I solve for the "prob=" parameter of pbinom() if I want pbinom() to
equal a specific value and I assume values for "q=" and "size="
parameters? Let's assume that I want pbinom() to equal 0.1 when I have
q=5, size=10, and lower.tail=FALSE, is there a function or way to
determine to what the "prob=" parameter should be equal? For example:
> pbinom(q=5,size=10,prob=.3542,lower.tail=FALSE)
[1] 0.09998054
Through trial and error, I found that prob=.3542 is close enough. I know
that qbinom() is the inverse of pbinom(), but I'm not interested in
finding q=5 given I want pbinom()=.1. I instead want to find "prob=" given
I know pbinom(q=5,size=10,prob=?,lower.tail=FALSE)=.1. Thanks in advance
for your help.
*Sorry if this has already been answered elsewhere. I looked and couldn't
find it. Seems pretty simple, so I was surprised.
Javascript function return array undefined
Javascript function return array undefined
I have a function loadTileSet(). This function must return arrTiles (image
data array), but function is returning UNDEFINED. I'm using push to put
data into array..
function loadTileSet(){
var imgTileSet = new Image();
imgTileSet.src = 'tileset.png';
var imageTileNumWidth = 23;
var imageTileNumHeight = 21;
var arrTiles = [];
imgTileSet.onload = function(){
var imageWidth = imgTileSet.width;
var imageHeight = imgTileSet.height;
sndCanvasWidth = imageWidth/imageTileNumWidth;
sndCanvasHeight = imageHeight/imageTileNumHeight;
canvas.width = imageWidth;
canvas.height = imageHeight;
ctx.drawImage(imgTileSet,0,0,imageWidth,imageHeight);
var i=0;
var j=0;
var t=0;
for(i=0;i<imageWidth;i+=sndCanvasWidth){
for(j=0;j<imageHeight;j+=sndCanvasHeight){
var myImageData =
ctx.getImageData(j,i,sndCanvasWidth,sndCanvasHeight);
arrTiles.push(myImageData);
}
}
return arrTiles;
}
}
and here I try to put array into another
var arrNew = loadTileSet();
console.log(arrNew[0]);
I have a function loadTileSet(). This function must return arrTiles (image
data array), but function is returning UNDEFINED. I'm using push to put
data into array..
function loadTileSet(){
var imgTileSet = new Image();
imgTileSet.src = 'tileset.png';
var imageTileNumWidth = 23;
var imageTileNumHeight = 21;
var arrTiles = [];
imgTileSet.onload = function(){
var imageWidth = imgTileSet.width;
var imageHeight = imgTileSet.height;
sndCanvasWidth = imageWidth/imageTileNumWidth;
sndCanvasHeight = imageHeight/imageTileNumHeight;
canvas.width = imageWidth;
canvas.height = imageHeight;
ctx.drawImage(imgTileSet,0,0,imageWidth,imageHeight);
var i=0;
var j=0;
var t=0;
for(i=0;i<imageWidth;i+=sndCanvasWidth){
for(j=0;j<imageHeight;j+=sndCanvasHeight){
var myImageData =
ctx.getImageData(j,i,sndCanvasWidth,sndCanvasHeight);
arrTiles.push(myImageData);
}
}
return arrTiles;
}
}
and here I try to put array into another
var arrNew = loadTileSet();
console.log(arrNew[0]);
How to match a numbers in different language?
How to match a numbers in different language?
I have a numbers which is in japanese text and a number in english text.
example:
In japanese language six=‚U
In english language six=6
So when I compare this value it return false I have used CompareTo() but
it doesn't returns 0
How to match this values????
I have a numbers which is in japanese text and a number in english text.
example:
In japanese language six=‚U
In english language six=6
So when I compare this value it return false I have used CompareTo() but
it doesn't returns 0
How to match this values????
Converting Seconds to Time Format
Converting Seconds to Time Format
I am trying to find a good solution for converting seconds to time format.
I have this function which works fine for my needs so far.
function secondstotime(secs)
{
var t = new Date(1970,0,1);
t.setSeconds(secs);
var s = t.toTimeString().substr(0,8);
if(secs > 86399)
s = Math.floor((t - Date.parse("1/1/70")) / 3600000) + s.substr(2);
return s;
}
alert(secondstotime(1920));
So you can run this in jsfiddle http://jsfiddle.net/7Pp5z/
So this works great and works for hours etc but i am looking to strip the
zeros to the left of the time. Taking the example
i want 00:32:00
to become 32:00 so it looks better that way when outputted to the browser
Can someone tell me the best way to do this or does anyone have another
function they could possibly share.
Thanks
I am trying to find a good solution for converting seconds to time format.
I have this function which works fine for my needs so far.
function secondstotime(secs)
{
var t = new Date(1970,0,1);
t.setSeconds(secs);
var s = t.toTimeString().substr(0,8);
if(secs > 86399)
s = Math.floor((t - Date.parse("1/1/70")) / 3600000) + s.substr(2);
return s;
}
alert(secondstotime(1920));
So you can run this in jsfiddle http://jsfiddle.net/7Pp5z/
So this works great and works for hours etc but i am looking to strip the
zeros to the left of the time. Taking the example
i want 00:32:00
to become 32:00 so it looks better that way when outputted to the browser
Can someone tell me the best way to do this or does anyone have another
function they could possibly share.
Thanks
NTQueryObject - STATUS_INVALID_INFO_CLASS error
NTQueryObject - STATUS_INVALID_INFO_CLASS error
when using the Delphi code provided as answer on this page,
Delphi - get what files are opened by an application
I get nice results on Windows 8 but an error on XP in the provided
function "GetObjectInfo" : NTQueryObject called at line 4 is returning
STATUS_INVALID_INFO_CLASS (3221225475).
It seems that the class ObjectNameInformation is not a valid info class.
I use Delphi 7.
Any help ?
when using the Delphi code provided as answer on this page,
Delphi - get what files are opened by an application
I get nice results on Windows 8 but an error on XP in the provided
function "GetObjectInfo" : NTQueryObject called at line 4 is returning
STATUS_INVALID_INFO_CLASS (3221225475).
It seems that the class ObjectNameInformation is not a valid info class.
I use Delphi 7.
Any help ?
Friday, 23 August 2013
Arduino error: ISO C++ forbids declaration of 'LinkedListItem' with no type
Arduino error: ISO C++ forbids declaration of 'LinkedListItem' with no type
I'm getting an error while attempting to write a program for an Arduino.
I'm a novice at C++ so this very well could be something simple and
obvious that I am missing. I am attempting to create a simple templated
linked list but keep running into issues. I have the following declared
within its own ino file in my sketchbook. When I attempt to use the
LinkedListItem class, I get the following error. Even if I remove the
templating, I still get the same error.
error: ISO C++ forbids declaration of 'LinkedListItem' with no type
LinkedList:9: error: expected ';' before '<' token
And the code:
template <class T>
class LinkedListItem {
public:
LinkedListItem(T value);
T getValue();
LinkedListItem<T>* getPreviousItem();
void setPrevious(LinkedListItem<T>* previous);
LinkedListItem<T>* getNextItem();
void setNext(LinkedListItem<T>* next);
private:
LinkedListItem<T>* _previous;
LinkedListItem<T>* _next;
T _value;
};
template <class T>
LinkedListItem<T>::LinkedListItem(T value) {
_value = value;
}
template <class T>
T LinkedListItem<T>::getValue() {
return _value;
}
template <class T>
LinkedListItem<T>* LinkedListItem<T>::getPreviousItem() {
return _previous;
}
template <class T>
void LinkedListItem<T>::setPrevious(LinkedListItem<T>* previous) {
_previous = previous;
}
template <class T>
LinkedListItem<T>* LinkedListItem<T>::getNextItem() {
return _next;
}
template <class T>
void LinkedListItem<T>::setNext(LinkedListItem<T>* next) {
_next = next;
}
I am declaring a pointer to a LinkedListItem like this:
LinkedListItem<String>* getCurrent();
Any help would be very much appreciated.
I'm getting an error while attempting to write a program for an Arduino.
I'm a novice at C++ so this very well could be something simple and
obvious that I am missing. I am attempting to create a simple templated
linked list but keep running into issues. I have the following declared
within its own ino file in my sketchbook. When I attempt to use the
LinkedListItem class, I get the following error. Even if I remove the
templating, I still get the same error.
error: ISO C++ forbids declaration of 'LinkedListItem' with no type
LinkedList:9: error: expected ';' before '<' token
And the code:
template <class T>
class LinkedListItem {
public:
LinkedListItem(T value);
T getValue();
LinkedListItem<T>* getPreviousItem();
void setPrevious(LinkedListItem<T>* previous);
LinkedListItem<T>* getNextItem();
void setNext(LinkedListItem<T>* next);
private:
LinkedListItem<T>* _previous;
LinkedListItem<T>* _next;
T _value;
};
template <class T>
LinkedListItem<T>::LinkedListItem(T value) {
_value = value;
}
template <class T>
T LinkedListItem<T>::getValue() {
return _value;
}
template <class T>
LinkedListItem<T>* LinkedListItem<T>::getPreviousItem() {
return _previous;
}
template <class T>
void LinkedListItem<T>::setPrevious(LinkedListItem<T>* previous) {
_previous = previous;
}
template <class T>
LinkedListItem<T>* LinkedListItem<T>::getNextItem() {
return _next;
}
template <class T>
void LinkedListItem<T>::setNext(LinkedListItem<T>* next) {
_next = next;
}
I am declaring a pointer to a LinkedListItem like this:
LinkedListItem<String>* getCurrent();
Any help would be very much appreciated.
Jquery Fade in background-image on dynamically created div
Jquery Fade in background-image on dynamically created div
I've searched everywhere, but can't seem to find an answer to this... I'm
looking for a way to check if a dynamically created div's background image
has loaded.
I have built a photo gallery that first makes an ajax call and then
creates divs with background images to display thumbnails of all the
photos in the gallery. You can check it out here:
http://www.aslamhusain.com/design.php#id=set_Allison_Basha
I would like to find a way to fadein each div when it loads, but I can't
find a way to check if the background image has loaded. Is this even
possible? Your help is much appreciated! First time posting here, this
site has always been a lifesaver for me!! Thanks in advance,
Here is the code:
if($("#"+gallery_id).length<=0){
$.ajax({
url: "get_photos.php?gallery="+gallery,
success: function(data){
//create gallery div
$("#wrapper").append("<div class='page'
id='"+gallery_id+"'><h2>"+gallery+"</h2></div>")
//sort ajax data
window.pic_array = data.split("***");
var total_images = window.pic_array.length - 1;
for(i=0;i<total_images;i++){
var pic_data = window.pic_array[i].split("|")
var date = pic_data[0] ;
var comment = pic_data[1];
var photo = pic_data[2];
var width = pic_data[3];
var height = pic_data[4]
var new_div = $("<div/>", {
id: "image_"+i,
class: "thumbnail_div",
click: Function("float_image('"+i+"')"),
css: {
backgroundImage: "url(thumbs/"+photo+")",
}
})
new_div.appendTo($("#"+gallery_id))
}
}
});
}
I've searched everywhere, but can't seem to find an answer to this... I'm
looking for a way to check if a dynamically created div's background image
has loaded.
I have built a photo gallery that first makes an ajax call and then
creates divs with background images to display thumbnails of all the
photos in the gallery. You can check it out here:
http://www.aslamhusain.com/design.php#id=set_Allison_Basha
I would like to find a way to fadein each div when it loads, but I can't
find a way to check if the background image has loaded. Is this even
possible? Your help is much appreciated! First time posting here, this
site has always been a lifesaver for me!! Thanks in advance,
Here is the code:
if($("#"+gallery_id).length<=0){
$.ajax({
url: "get_photos.php?gallery="+gallery,
success: function(data){
//create gallery div
$("#wrapper").append("<div class='page'
id='"+gallery_id+"'><h2>"+gallery+"</h2></div>")
//sort ajax data
window.pic_array = data.split("***");
var total_images = window.pic_array.length - 1;
for(i=0;i<total_images;i++){
var pic_data = window.pic_array[i].split("|")
var date = pic_data[0] ;
var comment = pic_data[1];
var photo = pic_data[2];
var width = pic_data[3];
var height = pic_data[4]
var new_div = $("<div/>", {
id: "image_"+i,
class: "thumbnail_div",
click: Function("float_image('"+i+"')"),
css: {
backgroundImage: "url(thumbs/"+photo+")",
}
})
new_div.appendTo($("#"+gallery_id))
}
}
});
}
Mysqlbug: Could not find a text editor. (tried emacs)
Mysqlbug: Could not find a text editor. (tried emacs)
I want to check with what configurations mysql was configured. I found
that mysqlbug can retrieve that info, but i'm getting the following error:
mysqlbug
Finding system information for a MySQL bug report
test -x
Could not find a text editor. (tried emacs)
You can change editor by setting the environment variable VISUAL.
If your shell is a bourne shell (sh) do
VISUAL=your_editors_name; export VISUAL
If your shell is a C shell (csh) do
setenv VISUAL your_editors_name
I want to check with what configurations mysql was configured. I found
that mysqlbug can retrieve that info, but i'm getting the following error:
mysqlbug
Finding system information for a MySQL bug report
test -x
Could not find a text editor. (tried emacs)
You can change editor by setting the environment variable VISUAL.
If your shell is a bourne shell (sh) do
VISUAL=your_editors_name; export VISUAL
If your shell is a C shell (csh) do
setenv VISUAL your_editors_name
jQuery: Perform a clean submit by removing hidden divs
jQuery: Perform a clean submit by removing hidden divs
I am trying to perform a 'clean' submit, i.e. a submit that is invoked
after removing all hidden divs from the form field.
Since this is a feature I am going to use more often, I shiftet my code
into the extend-part:
$.fn.extend({
bindCleanSubmit: function() {
$(this).submit( function(event) {
event.preventDefault();
$(this).find("div:hidden").remove();
console.log("trying to commit...");
return true;
});
}
});
Now, all divs are removed, the console event is triggered but at the end
the submit has not performed.
Do you now the problem here?
Thanks a lot!
I am trying to perform a 'clean' submit, i.e. a submit that is invoked
after removing all hidden divs from the form field.
Since this is a feature I am going to use more often, I shiftet my code
into the extend-part:
$.fn.extend({
bindCleanSubmit: function() {
$(this).submit( function(event) {
event.preventDefault();
$(this).find("div:hidden").remove();
console.log("trying to commit...");
return true;
});
}
});
Now, all divs are removed, the console event is triggered but at the end
the submit has not performed.
Do you now the problem here?
Thanks a lot!
How and for how long do browsers store Etags?
How and for how long do browsers store Etags?
I wish to implement etag based cache-control, and I am wondering how long
Etags are stored in a browser and if they can be kept for longer than the
current session.
I have the server setting and sending etags for responses correctly, and I
am sending requests from the browser with jQuery.ajax.
The system works correctly, responding with the appropriate 304 response
if the Not-Modified header (previous etag) matches the generated etag on
the server. This all works fine for the current session, however when I
close the browser and reopen it, the Not-Modified header is not being sent
by jQuery any more.
I am wondering if there are any methods I could use to trigger the default
browser behaviour, and send the Not-Modified header for responses (if
applicable), without manually setting the header in the ajax request or
storing the etag in localStorage/indexedDb.
I wish to implement etag based cache-control, and I am wondering how long
Etags are stored in a browser and if they can be kept for longer than the
current session.
I have the server setting and sending etags for responses correctly, and I
am sending requests from the browser with jQuery.ajax.
The system works correctly, responding with the appropriate 304 response
if the Not-Modified header (previous etag) matches the generated etag on
the server. This all works fine for the current session, however when I
close the browser and reopen it, the Not-Modified header is not being sent
by jQuery any more.
I am wondering if there are any methods I could use to trigger the default
browser behaviour, and send the Not-Modified header for responses (if
applicable), without manually setting the header in the ajax request or
storing the etag in localStorage/indexedDb.
How to get value of PartyList field using Javascript and oData in CRM 2011
How to get value of PartyList field using Javascript and oData in CRM 2011
due to CRM 2011 online problems with IE10, we have decided to convert all
front-end JavaScript from Soap to oData. Everything was going fine, I
installed the oData designer, centralized the queries in functions, but i
ran into a problem when i tried to retrieve the partylist field Resources
for ServiceActivity.
The oData query I got using the oData Query designer is the following (the
guid is a sample)
ServiceAppointmentSet?$select=Resources&$filter=ActivityId eq
guid'83CA6B11-6C0A-E311-8BB5-B499BAFE71A5'
but in the response i get an error that the Resources field was not found.
I tried without the select, and debugged the returned oData object, but
noticed that it doesn't show both Resources and Customers partylist fields
that are in ServiceActivity.
ServiceAppointmentSet?$filter=ActivityId eq
guid'83CA6B11-6C0A-E311-8BB5-B499BAFE71A5'
Does anyone have any ideas?
due to CRM 2011 online problems with IE10, we have decided to convert all
front-end JavaScript from Soap to oData. Everything was going fine, I
installed the oData designer, centralized the queries in functions, but i
ran into a problem when i tried to retrieve the partylist field Resources
for ServiceActivity.
The oData query I got using the oData Query designer is the following (the
guid is a sample)
ServiceAppointmentSet?$select=Resources&$filter=ActivityId eq
guid'83CA6B11-6C0A-E311-8BB5-B499BAFE71A5'
but in the response i get an error that the Resources field was not found.
I tried without the select, and debugged the returned oData object, but
noticed that it doesn't show both Resources and Customers partylist fields
that are in ServiceActivity.
ServiceAppointmentSet?$filter=ActivityId eq
guid'83CA6B11-6C0A-E311-8BB5-B499BAFE71A5'
Does anyone have any ideas?
Thursday, 22 August 2013
How to solve: $\,\,8^x=6x$
How to solve: $\,\,8^x=6x$
I am stuck on the following problem which one of my friends gave me:
Solve: $8^x=6x$.
We see that $$8^x=6x \implies 2^{3x}=6x$$. Now I am not sure how to
proceed further. Taking logarithm on both sides of the equation does not
help much. Clearly, $x=\frac 1 3$ satisfies the given equation but I am
not sure how to get it .
Can someone help? Thanks and regards to all.
I am stuck on the following problem which one of my friends gave me:
Solve: $8^x=6x$.
We see that $$8^x=6x \implies 2^{3x}=6x$$. Now I am not sure how to
proceed further. Taking logarithm on both sides of the equation does not
help much. Clearly, $x=\frac 1 3$ satisfies the given equation but I am
not sure how to get it .
Can someone help? Thanks and regards to all.
EM_EXGETSEL does not relate to text selection order. How do I do determine the cursor position in a piece of selected text?
EM_EXGETSEL does not relate to text selection order. How do I do determine
the cursor position in a piece of selected text?
When I do:
SendMessage(editControlHWND, EM_EXGETSEL, 0, (LPARAM)&charRange);
I get the selected range of text. However, I want to know where the cursor
is in this selection, ie at the end, OR at the beginning.
ie, has the user selected the text 'backwards', as in something like
dragging from right to left.
EM_EXGETSEL will always have the smaller number in cpMin, so clearly does
not relate to the selection order.
I obviously can't get the cursor position with EM_EXGETSEL for comparison
in this situation because a chunk of stuff is already selected.
Is there any way to get the cursor's current individual position (so that
I can compare it to cpMin/cpMax)? Or alternatively, is there any way of
determining where the cursor is in a block of selected text?
the cursor position in a piece of selected text?
When I do:
SendMessage(editControlHWND, EM_EXGETSEL, 0, (LPARAM)&charRange);
I get the selected range of text. However, I want to know where the cursor
is in this selection, ie at the end, OR at the beginning.
ie, has the user selected the text 'backwards', as in something like
dragging from right to left.
EM_EXGETSEL will always have the smaller number in cpMin, so clearly does
not relate to the selection order.
I obviously can't get the cursor position with EM_EXGETSEL for comparison
in this situation because a chunk of stuff is already selected.
Is there any way to get the cursor's current individual position (so that
I can compare it to cpMin/cpMax)? Or alternatively, is there any way of
determining where the cursor is in a block of selected text?
Changing a call to a JSON object to make program more abstract
Changing a call to a JSON object to make program more abstract
I have a program that builds a number of divs via data in a JSON file. I
call the info in the program like so:
'<p>English test score = ' + division[i].Eng5Thirteen +'</p>'
where Eng is the subject, 5 is the grade and Thirteen is the year (2013).
I do a variation of this a ton of times.
Is there a way to update this program next year by just changing a
variable that stores the word 'Thirteen' to 'Fourteen' and it will reflect
through my whole program so I don't have to change it all next year? Maybe
my whole program is inefficient?
You can see the code here and the running program here.
I have a program that builds a number of divs via data in a JSON file. I
call the info in the program like so:
'<p>English test score = ' + division[i].Eng5Thirteen +'</p>'
where Eng is the subject, 5 is the grade and Thirteen is the year (2013).
I do a variation of this a ton of times.
Is there a way to update this program next year by just changing a
variable that stores the word 'Thirteen' to 'Fourteen' and it will reflect
through my whole program so I don't have to change it all next year? Maybe
my whole program is inefficient?
You can see the code here and the running program here.
Where can i find native code for some android classes?
Where can i find native code for some android classes?
I'd like to find native code for Usb-related classes f.e.
UsbDeviceConnection. getFileDescriptor() function returns native_get_fd()
which is in native code.
I'd like to fix android issue:
https://code.google.com/p/android/issues/detail?id=58873
I'd like to find native code for Usb-related classes f.e.
UsbDeviceConnection. getFileDescriptor() function returns native_get_fd()
which is in native code.
I'd like to fix android issue:
https://code.google.com/p/android/issues/detail?id=58873
error inserting a module in Linux -1 Device or resource busy
error inserting a module in Linux -1 Device or resource busy
When I try to insert the module (ecryptfs.ko), I get the following error:
insmod: error inserting './ecryptfs.ko': -1 Device or resource busy
My linux kernel version is 2.6.39.4 and the source of ecryptfs is the part
of it. Could some one please help me out?
below is the dmesg
[ 58.976395] Failed to register filesystem
When I try to insert the module (ecryptfs.ko), I get the following error:
insmod: error inserting './ecryptfs.ko': -1 Device or resource busy
My linux kernel version is 2.6.39.4 and the source of ecryptfs is the part
of it. Could some one please help me out?
below is the dmesg
[ 58.976395] Failed to register filesystem
Vector resize without initialization
Vector resize without initialization
vector.resize is defined to resize the vector, and initialize the new
objects with either the default value T() or a value you can provide.
But, I'm working on something that's very performance aware, and i need to
resize the vector without assigning a value, and assign the values later
on.
I know I can use an Allocator class and replace the construct member
function.
But the problem with that is that it will change the vector template
signature, and may cause a LOT of changes in the code (I have a large code
base, and this is basically important in one small utility function).
Is there a way to do that without using an Allocator ?
vector.resize is defined to resize the vector, and initialize the new
objects with either the default value T() or a value you can provide.
But, I'm working on something that's very performance aware, and i need to
resize the vector without assigning a value, and assign the values later
on.
I know I can use an Allocator class and replace the construct member
function.
But the problem with that is that it will change the vector template
signature, and may cause a LOT of changes in the code (I have a large code
base, and this is basically important in one small utility function).
Is there a way to do that without using an Allocator ?
Android Webview JNI ERROR with loadUrl
Android Webview JNI ERROR with loadUrl
I'm writing an Android App which is opening a locally stored html file
check.html. This html file is showing some nice text and then
http-forwarding to my real wanted webpage. Now it can happen, that the
server is down, or even the network is unplugged, but I want the app to
keep trying to reach it all the time.
In case that just the server is down, Android has some latency when asking
for the webpage before returning to onReceivedError(), so I don't have a
problem, but if the network is unplugged, it returns immediately.
After 1 to 2 minutes my app crashes with:
08-22 14:17:47.382: D/dalvikvm(8337): GC_CONCURRENT freed 178K, 3% free
12530K/12807K, paused 0ms+7ms
08-22 14:17:57.572: D/dalvikvm(8337): GC_CONCURRENT freed 235K, 3% free
14253K/14599K, paused 0ms+7ms
08-22 14:18:07.882: D/dalvikvm(8337): GC_CONCURRENT freed 241K, 3% free
15969K/16327K, paused 0ms+10ms
08-22 14:18:17.717: D/dalvikvm(8337): GC_CONCURRENT freed 237K, 2% free
17717K/18055K, paused 0ms+13ms
08-22 14:18:28.757: D/dalvikvm(8337): GC_CONCURRENT freed 249K, 2% free
19468K/19783K, paused 3ms+3ms
08-22 14:18:39.105: D/dalvikvm(8337): GC_CONCURRENT freed 241K, 2% free
21185K/21511K, paused 4ms+10ms
08-22 14:18:49.008: D/dalvikvm(8337): GC_CONCURRENT freed 238K, 2% free
22900K/23239K, paused 0ms+10ms
08-22 14:18:51.157: E/dalvikvm(8337): JNI ERROR (app bug): local reference
table overflow (max=512)
08-22 14:18:51.157: W/dalvikvm(8337): JNI local reference table
(0x1729e78) dump:
08-22 14:18:51.157: W/dalvikvm(8337): Last 10 entries (of 512):
08-22 14:18:51.157: W/dalvikvm(8337): 511: 0x410dec88
android.content.res.AssetManager
08-22 14:18:51.157: W/dalvikvm(8337): 510: 0x4215db30 byte[] (32768 elements)
08-22 14:18:51.157: W/dalvikvm(8337): 509: 0x42155b18 byte[] (32768 elements)
08-22 14:18:51.158: E/dalvikvm(8337): Failed adding to JNI local ref table
(has 512 entries)
Here is the code:
mWebView = (WebView) findViewById(R.id.webView);
mWebView.setWebChromeClient(new KB_WebChromeClient(this));
mWebView.setWebViewClient(new KB_WebViewClient());
mWebView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
mWebView.clearCache(true);
mWebView.clearHistory();
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.addJavascriptInterface(new WebAppInterface(this, this), "Android");
mWebView.loadUrl("file:///android_asset/check.html");
The WebViewClient has the following code:
public class KB_WebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
view.clearCache(true);
}
@Override
public void onReceivedError (WebView view, int errorCode, String
description, String failingUrl)
{
view.loadUrl("file:///android_asset/check.html");
}
}
Basically, the check.html page is loaded, onPageFinished is called and
then the html forwards to the other page, which is not working, so
onReceivedError is called, which will start loading the check.html again
aso.
On my research I found SO: Android Expand JNI Local Reference Table, where
the answer is
You need to delete local references to classes as well as to objects.
What does it mean and where is my problem? Does webview.loadUrl create
anything complex and the Garbage Collector is not fast enough to clean up?
I don't create the WebView all the time, so what is messing around?
Thanks for help in advance!
I'm writing an Android App which is opening a locally stored html file
check.html. This html file is showing some nice text and then
http-forwarding to my real wanted webpage. Now it can happen, that the
server is down, or even the network is unplugged, but I want the app to
keep trying to reach it all the time.
In case that just the server is down, Android has some latency when asking
for the webpage before returning to onReceivedError(), so I don't have a
problem, but if the network is unplugged, it returns immediately.
After 1 to 2 minutes my app crashes with:
08-22 14:17:47.382: D/dalvikvm(8337): GC_CONCURRENT freed 178K, 3% free
12530K/12807K, paused 0ms+7ms
08-22 14:17:57.572: D/dalvikvm(8337): GC_CONCURRENT freed 235K, 3% free
14253K/14599K, paused 0ms+7ms
08-22 14:18:07.882: D/dalvikvm(8337): GC_CONCURRENT freed 241K, 3% free
15969K/16327K, paused 0ms+10ms
08-22 14:18:17.717: D/dalvikvm(8337): GC_CONCURRENT freed 237K, 2% free
17717K/18055K, paused 0ms+13ms
08-22 14:18:28.757: D/dalvikvm(8337): GC_CONCURRENT freed 249K, 2% free
19468K/19783K, paused 3ms+3ms
08-22 14:18:39.105: D/dalvikvm(8337): GC_CONCURRENT freed 241K, 2% free
21185K/21511K, paused 4ms+10ms
08-22 14:18:49.008: D/dalvikvm(8337): GC_CONCURRENT freed 238K, 2% free
22900K/23239K, paused 0ms+10ms
08-22 14:18:51.157: E/dalvikvm(8337): JNI ERROR (app bug): local reference
table overflow (max=512)
08-22 14:18:51.157: W/dalvikvm(8337): JNI local reference table
(0x1729e78) dump:
08-22 14:18:51.157: W/dalvikvm(8337): Last 10 entries (of 512):
08-22 14:18:51.157: W/dalvikvm(8337): 511: 0x410dec88
android.content.res.AssetManager
08-22 14:18:51.157: W/dalvikvm(8337): 510: 0x4215db30 byte[] (32768 elements)
08-22 14:18:51.157: W/dalvikvm(8337): 509: 0x42155b18 byte[] (32768 elements)
08-22 14:18:51.158: E/dalvikvm(8337): Failed adding to JNI local ref table
(has 512 entries)
Here is the code:
mWebView = (WebView) findViewById(R.id.webView);
mWebView.setWebChromeClient(new KB_WebChromeClient(this));
mWebView.setWebViewClient(new KB_WebViewClient());
mWebView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
mWebView.clearCache(true);
mWebView.clearHistory();
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.addJavascriptInterface(new WebAppInterface(this, this), "Android");
mWebView.loadUrl("file:///android_asset/check.html");
The WebViewClient has the following code:
public class KB_WebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
view.clearCache(true);
}
@Override
public void onReceivedError (WebView view, int errorCode, String
description, String failingUrl)
{
view.loadUrl("file:///android_asset/check.html");
}
}
Basically, the check.html page is loaded, onPageFinished is called and
then the html forwards to the other page, which is not working, so
onReceivedError is called, which will start loading the check.html again
aso.
On my research I found SO: Android Expand JNI Local Reference Table, where
the answer is
You need to delete local references to classes as well as to objects.
What does it mean and where is my problem? Does webview.loadUrl create
anything complex and the Garbage Collector is not fast enough to clean up?
I don't create the WebView all the time, so what is messing around?
Thanks for help in advance!
Wednesday, 21 August 2013
gSOAP call WCF,but "wsse:Security" lead to error.Fllow is my code
gSOAP call WCF,but "wsse:Security" lead to error.Fllow is my code
gSOAP 2.8.15 [ wsdl2h -c -o smart.h http://www.myweb/?wsdl ]
and then i use: [ soapcpp2 -c -C -I E:\gsoap-2.8\gsoap\import smart.h ]
min code:
struct soap soap;
soap_init(&soap);
_tempuri__GetRolePrivilegeList param;
char* str="001";
param.strXML=str;
_tempuri__GetRolePrivilegeListResponse respons;
if
(soap_call___tempuri__GetRolePrivilegeList(&soap,NULL,NULL,¶m,&respons)
== 0)
{
cout<<respons.GetRolePrivilegeListResult<<endl;
}else{}
but when exec at line 6283 of soapC.c,it's error. this line txt:
if (soap_out_PointerTo_wsse__Security(soap, "wsse:Security", -1,
&a->wsse__Security, ""))
the WCF Build with VS2010 and C#. Thanks everyone look this problem,and
help me.
gSOAP 2.8.15 [ wsdl2h -c -o smart.h http://www.myweb/?wsdl ]
and then i use: [ soapcpp2 -c -C -I E:\gsoap-2.8\gsoap\import smart.h ]
min code:
struct soap soap;
soap_init(&soap);
_tempuri__GetRolePrivilegeList param;
char* str="001";
param.strXML=str;
_tempuri__GetRolePrivilegeListResponse respons;
if
(soap_call___tempuri__GetRolePrivilegeList(&soap,NULL,NULL,¶m,&respons)
== 0)
{
cout<<respons.GetRolePrivilegeListResult<<endl;
}else{}
but when exec at line 6283 of soapC.c,it's error. this line txt:
if (soap_out_PointerTo_wsse__Security(soap, "wsse:Security", -1,
&a->wsse__Security, ""))
the WCF Build with VS2010 and C#. Thanks everyone look this problem,and
help me.
pass extraParams within the MVC tree store as load parameters
pass extraParams within the MVC tree store as load parameters
Suppose I have the following Sencha MVC tree store below. I'd like to pass
two parameters, defined in "extraParams" to the load, but I need to get a
reference to "this" in order to get the current values of the record
clicked. Before I started working with MVC, I used to pass them in the
autoLoad config, but the problem this time is that I need a reference to
this. Can I still do it that way, or should it be done a different way. I
tried the "beforeload" event, and that did not work.
Ext.define('MyApp.store.Test', {
extend: 'Ext.data.TreeStore',
xtype: 'store-test',
model : 'MyApp.model.Test',
nodeParam: 'node',
root: {
text: 'root',
id: '0',
expanded: true
},
proxy: {
type: 'direct',
directFn: CRUD.read,
reader: {
root: 'data'
},
extraParams: {
delimited_id: '0',
formatted_id: '0'
}
},
autoLoad: false,
listeners: {
// load: function( this, node, records, successful, eOpts ) {
// },
beforeload: function(store, operation, options) {
// not working ?
//operation.params.delimited_id =
operation.node.get('delimited_id');
//operation.params.formatted_id = operation.node.get('node_id');
// not working ?
//this.proxy.extraParams.delimited_id =
operation.node.get('delimited_id');
//this.proxy.extraParams.node_id = operation.node.get('node_id');
}
} // listeners
});
Suppose I have the following Sencha MVC tree store below. I'd like to pass
two parameters, defined in "extraParams" to the load, but I need to get a
reference to "this" in order to get the current values of the record
clicked. Before I started working with MVC, I used to pass them in the
autoLoad config, but the problem this time is that I need a reference to
this. Can I still do it that way, or should it be done a different way. I
tried the "beforeload" event, and that did not work.
Ext.define('MyApp.store.Test', {
extend: 'Ext.data.TreeStore',
xtype: 'store-test',
model : 'MyApp.model.Test',
nodeParam: 'node',
root: {
text: 'root',
id: '0',
expanded: true
},
proxy: {
type: 'direct',
directFn: CRUD.read,
reader: {
root: 'data'
},
extraParams: {
delimited_id: '0',
formatted_id: '0'
}
},
autoLoad: false,
listeners: {
// load: function( this, node, records, successful, eOpts ) {
// },
beforeload: function(store, operation, options) {
// not working ?
//operation.params.delimited_id =
operation.node.get('delimited_id');
//operation.params.formatted_id = operation.node.get('node_id');
// not working ?
//this.proxy.extraParams.delimited_id =
operation.node.get('delimited_id');
//this.proxy.extraParams.node_id = operation.node.get('node_id');
}
} // listeners
});
404 requesting SyncStatus... a.k.a. Status
404 requesting SyncStatus... a.k.a. Status
I am trying to make a query to get the SyncStatus objects that have
failed. In The API Explorer you have to choose the "Status" menu option in
order to test this and submit requests to https:///sb/STATUS/v2/, even
though the response XML refers to it as SyncStatus... so not really sure
what it should be called exactly.
But that's not really my problem. My problem is that when I submit a
request (details below) I get a 404 error. It works perfectly find in the
API Explorer, with the exact same XML in the body. I make other calls to
the API all the time, so I know my framework is working.
Help?
REQUEST HEADERS
Content-Length: 322
Authorization:
OAuth
oauth_consumer_key="KEY",
oauth_nonce="NONCE",
oauth_signature="SIG",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1377117362",
oauth_token="TOKEN",
oauth_version="1.0"
Content-Type: text/xml
Host: services.intuit.com
Connection: Keep-Alive
REQUEST BODY
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><SyncStatusRequest
ErroredObjectsOnly="true" xmlns="http://www.intuit.com/sb/cdm/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.intuit.com/sb/cdm/xmlrequest
RestDataFilter.xsd"><OfferingId>ipp</OfferingId></SyncStatusRequest>
RESPONSE (with some new lines added for readability)
<html><head><title>JBoss Web/2.1.12.GA-patch-03 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head>
<body>
<h1>HTTP Status 404 - Null subresource for path:
https://internal.services.intuit.com/sb/status/v2/725079435</h1>
<HR size="1" noshade="noshade">
<p>
<b>type</b>
Status report</p><p><b>message</b> <u>Null subresource for path:
https://internal.services.intuit.com/sb/status/v2/725079435</u>
</p><p>
<b>description</b>
<u>The requested resource (Null subresource for path:
https://internal.services.intuit.com/sb/status/v2/725079435) is not
available.</u>
</p>
<HR size="1" noshade="noshade">
<h3>JBoss Web/2.1.12.GA-patch-03</h3>
</body></html>
I am trying to make a query to get the SyncStatus objects that have
failed. In The API Explorer you have to choose the "Status" menu option in
order to test this and submit requests to https:///sb/STATUS/v2/, even
though the response XML refers to it as SyncStatus... so not really sure
what it should be called exactly.
But that's not really my problem. My problem is that when I submit a
request (details below) I get a 404 error. It works perfectly find in the
API Explorer, with the exact same XML in the body. I make other calls to
the API all the time, so I know my framework is working.
Help?
REQUEST HEADERS
Content-Length: 322
Authorization:
OAuth
oauth_consumer_key="KEY",
oauth_nonce="NONCE",
oauth_signature="SIG",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1377117362",
oauth_token="TOKEN",
oauth_version="1.0"
Content-Type: text/xml
Host: services.intuit.com
Connection: Keep-Alive
REQUEST BODY
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><SyncStatusRequest
ErroredObjectsOnly="true" xmlns="http://www.intuit.com/sb/cdm/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.intuit.com/sb/cdm/xmlrequest
RestDataFilter.xsd"><OfferingId>ipp</OfferingId></SyncStatusRequest>
RESPONSE (with some new lines added for readability)
<html><head><title>JBoss Web/2.1.12.GA-patch-03 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head>
<body>
<h1>HTTP Status 404 - Null subresource for path:
https://internal.services.intuit.com/sb/status/v2/725079435</h1>
<HR size="1" noshade="noshade">
<p>
<b>type</b>
Status report</p><p><b>message</b> <u>Null subresource for path:
https://internal.services.intuit.com/sb/status/v2/725079435</u>
</p><p>
<b>description</b>
<u>The requested resource (Null subresource for path:
https://internal.services.intuit.com/sb/status/v2/725079435) is not
available.</u>
</p>
<HR size="1" noshade="noshade">
<h3>JBoss Web/2.1.12.GA-patch-03</h3>
</body></html>
How to traverse the DOM to determine maximum nesting depth?
How to traverse the DOM to determine maximum nesting depth?
For example:
// ...
<body>
<div>
<div>
</div>
</div>
</body>
// ...
This nest depth would be 3? But more generally, how can I traverse the DOM
to find this information?
I'm interested in treating the DOM like an n-ary tree modeled as an object
literal as described in this post:
n-ary tree in JavaScript
For example:
// ...
<body>
<div>
<div>
</div>
</div>
</body>
// ...
This nest depth would be 3? But more generally, how can I traverse the DOM
to find this information?
I'm interested in treating the DOM like an n-ary tree modeled as an object
literal as described in this post:
n-ary tree in JavaScript
C# - Wait for process start
C# - Wait for process start
So what I am attempting to do is start explorer from my program then pop
my application back in front of explorer or just start explorer behind my
application...
Currently I have explorer starting then I have actions to bring my
application to the front but explorer can take a few seconds to start and
that messes up my whole chain of events.
This is what I am currently doing:
Process process = new Process();
process.StartInfo.FileName = environmentVariable + "\\explorer.exe";
process.StartInfo.Arguments =
!string.IsNullOrEmpty(this.uxMainFolder.Text) ? this.uxMainFolder.Text +
"\\" + path2 : Path.Combine("R:\\Project", path2);
try
{
process.Start();
this.WindowState = FormWindowState.Minimized;
this.Show();
this.WindowState = FormWindowState.Normal;
}
finally
{
process.Dispose();
}
Any light you can shed on this problem would be much appreciated.
So what I am attempting to do is start explorer from my program then pop
my application back in front of explorer or just start explorer behind my
application...
Currently I have explorer starting then I have actions to bring my
application to the front but explorer can take a few seconds to start and
that messes up my whole chain of events.
This is what I am currently doing:
Process process = new Process();
process.StartInfo.FileName = environmentVariable + "\\explorer.exe";
process.StartInfo.Arguments =
!string.IsNullOrEmpty(this.uxMainFolder.Text) ? this.uxMainFolder.Text +
"\\" + path2 : Path.Combine("R:\\Project", path2);
try
{
process.Start();
this.WindowState = FormWindowState.Minimized;
this.Show();
this.WindowState = FormWindowState.Normal;
}
finally
{
process.Dispose();
}
Any light you can shed on this problem would be much appreciated.
How to do port forwarding/redirecting on Debian?
How to do port forwarding/redirecting on Debian?
I have two questions.
Question 1: My debian machine has interface eth3 with ip 192.168.57.28. If
someone tries to connect to 192.168.57.28:1234 how do I redirect the
request to another machine: 192.168.57.25:80?
Question 2: If my debian machine has two interfaces: eth3 with
192.168.57.28 and ppp0 with some dynamic IP and someone tries to connect
via ppp0 on port 1234, how do I redirect the request to 192.168.57.25:80?
I have tried this:
iptables -t nat -A PREROUTING -p tcp --dport 1234 -j DNAT --to-destination
192.168.57.25:80
echo 1 > /proc/sys/net/ipv4/ip_forward
but it does not work.
I have two questions.
Question 1: My debian machine has interface eth3 with ip 192.168.57.28. If
someone tries to connect to 192.168.57.28:1234 how do I redirect the
request to another machine: 192.168.57.25:80?
Question 2: If my debian machine has two interfaces: eth3 with
192.168.57.28 and ppp0 with some dynamic IP and someone tries to connect
via ppp0 on port 1234, how do I redirect the request to 192.168.57.25:80?
I have tried this:
iptables -t nat -A PREROUTING -p tcp --dport 1234 -j DNAT --to-destination
192.168.57.25:80
echo 1 > /proc/sys/net/ipv4/ip_forward
but it does not work.
Tuesday, 20 August 2013
You must have an argument in the function passed to `to`
You must have an argument in the function passed to `to`
i am trying to get started with ember framework . i write a code
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Ember.js • TodoMVC</title>
<link rel="stylesheet" href="style.css">
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/libs/handlebars.js"></script>
<script src="js/libs/ember-latest.min.js"></script>
<script src="js/libs/ember-data-latest.min.js"></script>
<script src="js/application.js"></script>
<script src="js/router.js"></script>
</head>
<body>
<section id="todoapp">
<header id="header">
<h1>todos</h1>
<input type="text" id="new-todo" placeholder="What needs to be
done?" />
</header>
<section id="main">
<ul id="todo-list">
<li class="completed">
<input type="checkbox" class="toggle">
<label>Learn Ember.js</label><button class="destroy"></button>
</li>
<li>
<input type="checkbox" class="toggle">
<label>...</label><button class="destroy"></button>
</li>
<li>
<input type="checkbox" class="toggle">
<label>Profit!</label><button class="destroy"></button>
</li>
</ul>
<input type="checkbox" id="toggle-all">
</section>
<footer id="footer">
<span id="todo-count">
<strong>2</strong> todos left
</span>
<ul id="filters">
<li>
<a href="all" class="selected">All</a>
</li>
<li>
<a href="active">Active</a>
</li>
<li>
<a href="completed">Completed</a>
</li>
</ul>
<button id="clear-completed">
Clear completed (1)
</button>
</footer>
</section>
<footer id="info">
<p>Double-click to edit a todo</p>
</footer>
</body>
</html>
when i run it its giving me error in developer console
Uncaught TypeError: Object function
(){r||a.proto(),i(this,s,g),i(this,"_super",g);var
o=u(this);if(o.proto=this,e){var
c=e;e=null,this.reopen.apply(this,c)}if(t){var h=t;t=null;for(var
m=this.concatenatedProperties,f=0,d=h.length;d>f;f++){var b=h[f];for(var y
in b)if(b.hasOwnProperty(y)){var
w=b[y],_=Ember.IS_BINDING;if(_.test(y)){var
C=o.bindings;C?o.hasOwnProperty("bindings")||(C=o.bindings=n(o.bindings)):C=o.bindings={},C[y]=w}var
O=o.descs[y];if(m&&v(m,y)>=0){var S=this[y];w=S?"function"==typeof
S.concat?S.concat(w):Ember.makeArray(S).concat(w):Ember.makeArray(w)}O?O.set(this,y,w):typeof
this.setUnknownProperty!="function"||y in
this?E?Ember.defineProperty(this,y,null,w):this[y]=w:this.setUnknownProperty(y,w)}}}p(this,o),delete
o.proto,l(this),this.init.apply(this,arguments)} has no method
'registerInjection' ember-data-latest.min.js:11
Uncaught Error: You must have an argument in the function passed to `to`
ember-latest.min.js:19
Uncaught Error: No route matched the URL '' ember-latest.min.js:19
can any one please help why i am facing this error ??
i am trying to get started with ember framework . i write a code
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Ember.js • TodoMVC</title>
<link rel="stylesheet" href="style.css">
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/libs/handlebars.js"></script>
<script src="js/libs/ember-latest.min.js"></script>
<script src="js/libs/ember-data-latest.min.js"></script>
<script src="js/application.js"></script>
<script src="js/router.js"></script>
</head>
<body>
<section id="todoapp">
<header id="header">
<h1>todos</h1>
<input type="text" id="new-todo" placeholder="What needs to be
done?" />
</header>
<section id="main">
<ul id="todo-list">
<li class="completed">
<input type="checkbox" class="toggle">
<label>Learn Ember.js</label><button class="destroy"></button>
</li>
<li>
<input type="checkbox" class="toggle">
<label>...</label><button class="destroy"></button>
</li>
<li>
<input type="checkbox" class="toggle">
<label>Profit!</label><button class="destroy"></button>
</li>
</ul>
<input type="checkbox" id="toggle-all">
</section>
<footer id="footer">
<span id="todo-count">
<strong>2</strong> todos left
</span>
<ul id="filters">
<li>
<a href="all" class="selected">All</a>
</li>
<li>
<a href="active">Active</a>
</li>
<li>
<a href="completed">Completed</a>
</li>
</ul>
<button id="clear-completed">
Clear completed (1)
</button>
</footer>
</section>
<footer id="info">
<p>Double-click to edit a todo</p>
</footer>
</body>
</html>
when i run it its giving me error in developer console
Uncaught TypeError: Object function
(){r||a.proto(),i(this,s,g),i(this,"_super",g);var
o=u(this);if(o.proto=this,e){var
c=e;e=null,this.reopen.apply(this,c)}if(t){var h=t;t=null;for(var
m=this.concatenatedProperties,f=0,d=h.length;d>f;f++){var b=h[f];for(var y
in b)if(b.hasOwnProperty(y)){var
w=b[y],_=Ember.IS_BINDING;if(_.test(y)){var
C=o.bindings;C?o.hasOwnProperty("bindings")||(C=o.bindings=n(o.bindings)):C=o.bindings={},C[y]=w}var
O=o.descs[y];if(m&&v(m,y)>=0){var S=this[y];w=S?"function"==typeof
S.concat?S.concat(w):Ember.makeArray(S).concat(w):Ember.makeArray(w)}O?O.set(this,y,w):typeof
this.setUnknownProperty!="function"||y in
this?E?Ember.defineProperty(this,y,null,w):this[y]=w:this.setUnknownProperty(y,w)}}}p(this,o),delete
o.proto,l(this),this.init.apply(this,arguments)} has no method
'registerInjection' ember-data-latest.min.js:11
Uncaught Error: You must have an argument in the function passed to `to`
ember-latest.min.js:19
Uncaught Error: No route matched the URL '' ember-latest.min.js:19
can any one please help why i am facing this error ??
List Sorting with specific text and order based on user choice
List Sorting with specific text and order based on user choice
I would like to sort the following list based on prop1 first and then
based on the prop2 values of my choice. For example I would like sort the
list in ascending order using prop1 and then prop2 which contains the
value "application", then prop2 which contains the value "core" and then
then prop2 which contains the value "project"
IList<Test> tests = new List<Test>
{
new Test{prop1 = "Name1", prop2="project235"},
new Test{prop1 = "Name1", prop2="core222"},
new Test{prop1 = "Name1", prop2="application33331"},
new Test{prop1 = "Name1", prop2="project"},
new Test{prop1 = "Name1", prop2="application21"},
new Test{prop1 = "Name1", prop2="core1"},
new Test{prop1 = "Name1", prop2="application"},
new Test{prop1 = "Name2", prop2="application"},
new Test{prop1 = "Name2", prop2="core"},
new Test{prop1 = "Name2", prop2="project"}
};
The final output should look like this
Name1 application
Name1 application21
Name1 application33331
Name1 core1
Name1 core222
Name1 project
Name1 project235
Name2 application
Name2 core
Name2 project
Thank you in advance!!!!
I would like to sort the following list based on prop1 first and then
based on the prop2 values of my choice. For example I would like sort the
list in ascending order using prop1 and then prop2 which contains the
value "application", then prop2 which contains the value "core" and then
then prop2 which contains the value "project"
IList<Test> tests = new List<Test>
{
new Test{prop1 = "Name1", prop2="project235"},
new Test{prop1 = "Name1", prop2="core222"},
new Test{prop1 = "Name1", prop2="application33331"},
new Test{prop1 = "Name1", prop2="project"},
new Test{prop1 = "Name1", prop2="application21"},
new Test{prop1 = "Name1", prop2="core1"},
new Test{prop1 = "Name1", prop2="application"},
new Test{prop1 = "Name2", prop2="application"},
new Test{prop1 = "Name2", prop2="core"},
new Test{prop1 = "Name2", prop2="project"}
};
The final output should look like this
Name1 application
Name1 application21
Name1 application33331
Name1 core1
Name1 core222
Name1 project
Name1 project235
Name2 application
Name2 core
Name2 project
Thank you in advance!!!!
How to prevent automatic conversion to float of pandas Series when nan is added to it?
How to prevent automatic conversion to float of pandas Series when nan is
added to it?
I am adding data to a pandas series via the Series#append method.
Unfortunately, when nan is added to a bool series, it is automatically
converted to a float series. Is there any way to avoid it?
>>> Series([True])
0 True
dtype: bool
>>> Series([True]).append(Series([np.nan]))
0 1
0 NaN
dtype: float64
added to it?
I am adding data to a pandas series via the Series#append method.
Unfortunately, when nan is added to a bool series, it is automatically
converted to a float series. Is there any way to avoid it?
>>> Series([True])
0 True
dtype: bool
>>> Series([True]).append(Series([np.nan]))
0 1
0 NaN
dtype: float64
How to get the dimensions of my Button in advance?
How to get the dimensions of my Button in advance?
Hello guys I am basically doing a piano app. After much thought I think
I've figured how most piano apps are done and I'm stuck here and this
seems to be very crucial to get all the other functionality such as the
slide,multitouch,adding keys,etc.
Is it possible to know the dimensions of my drawable button before Hand?
Say I have basically two drawable key button, piano keys C and D:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="bottom" >
<Button
android:id="@+id/ckey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/keybutton" />
<Button
android:id="@+id/dkey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/keybutton" />
For a piano app(white keys), they both use the same selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/key"
android:state_pressed="true"/>
<item
android:drawable="@drawable/key_pressed"/>
</selector>
But I would like to know the dimensions OR the location BEFOREHAND of the
Button created so that I can draw a region on Top of that button and use
that region for onTouchListener. I need that region so that I can use
onTouch.
@Override
public boolean onTouch(View v, MotionEvent event) {
int numberOfKeys = 2;
Region[] keyBoard = new Region[2]; //for 2 White Piano Keys
Integer pointerIndex = event.getActionIndex();
Float x = event.getX(pointerIndex);
Float y = event.getY(pointerIndex);
for(int j=0;j<1;j++){
if(this.keyBoard[j].contains(x.intValue(),y.intValue())){
//play corresponding sound
}
}
So knowing the dimensions of my images: key.png and key_pressed.png and
the screen width and height and maybe other parameters I don't know. is It
possible to know beforehand the dimensions or COORDINATES or Location of
my buttons before the app is launched?
Otherwise, how can I get the coordinates? it seems getTop() and getLeft()
are not good options because they return 0 since the images take time to
load therefore the code cannot retrieve it.
Thanks guys. I'm super noob by the way. I apologize if I missed something.
Hello guys I am basically doing a piano app. After much thought I think
I've figured how most piano apps are done and I'm stuck here and this
seems to be very crucial to get all the other functionality such as the
slide,multitouch,adding keys,etc.
Is it possible to know the dimensions of my drawable button before Hand?
Say I have basically two drawable key button, piano keys C and D:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="bottom" >
<Button
android:id="@+id/ckey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/keybutton" />
<Button
android:id="@+id/dkey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/keybutton" />
For a piano app(white keys), they both use the same selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/key"
android:state_pressed="true"/>
<item
android:drawable="@drawable/key_pressed"/>
</selector>
But I would like to know the dimensions OR the location BEFOREHAND of the
Button created so that I can draw a region on Top of that button and use
that region for onTouchListener. I need that region so that I can use
onTouch.
@Override
public boolean onTouch(View v, MotionEvent event) {
int numberOfKeys = 2;
Region[] keyBoard = new Region[2]; //for 2 White Piano Keys
Integer pointerIndex = event.getActionIndex();
Float x = event.getX(pointerIndex);
Float y = event.getY(pointerIndex);
for(int j=0;j<1;j++){
if(this.keyBoard[j].contains(x.intValue(),y.intValue())){
//play corresponding sound
}
}
So knowing the dimensions of my images: key.png and key_pressed.png and
the screen width and height and maybe other parameters I don't know. is It
possible to know beforehand the dimensions or COORDINATES or Location of
my buttons before the app is launched?
Otherwise, how can I get the coordinates? it seems getTop() and getLeft()
are not good options because they return 0 since the images take time to
load therefore the code cannot retrieve it.
Thanks guys. I'm super noob by the way. I apologize if I missed something.
PHP: combine arrays
PHP: combine arrays
What is the easiest/best way in PHP to combine arrays like this:
From:
Array A:
idA,valueA1,valueA2,...
idB,valueB1,valueB2,...
idC,valueC1,valueC2,...
Array B:
idA,valueAx,valueA2y,...
idC,valueCx,valueC2y,...
idD,valueDx,valueD2y,...
To:
idA,valueA1,valueA2,...,valueAx,valueA2y,...
idB,valueB1,valueB2,...,,,...
idC,valueC1,valueC2,...,valueCx,valueC2y,...
idD,,,...,valueDx,valueD2y,...
Thanks for your help!
What is the easiest/best way in PHP to combine arrays like this:
From:
Array A:
idA,valueA1,valueA2,...
idB,valueB1,valueB2,...
idC,valueC1,valueC2,...
Array B:
idA,valueAx,valueA2y,...
idC,valueCx,valueC2y,...
idD,valueDx,valueD2y,...
To:
idA,valueA1,valueA2,...,valueAx,valueA2y,...
idB,valueB1,valueB2,...,,,...
idC,valueC1,valueC2,...,valueCx,valueC2y,...
idD,,,...,valueDx,valueD2y,...
Thanks for your help!
How to plus the weeknumber
How to plus the weeknumber
I need have a script that plus one to the current week number if the user
has clicked a button. I have tried following:
$week_number = date("W");
if(isset($_GET['for'])){
$week_number++;
echo $week_number;
}
But unfortunately it does not work. Any suggestions? :)
I need have a script that plus one to the current week number if the user
has clicked a button. I have tried following:
$week_number = date("W");
if(isset($_GET['for'])){
$week_number++;
echo $week_number;
}
But unfortunately it does not work. Any suggestions? :)
What is the different between these two Eobjects generated from the same resource
What is the different between these two Eobjects generated from the same
resource
I don't understand why there are two different EObjects that (for me)
should mean the same thing
var script1 = resource.getContents().get(0) as Script
var script2 = resource.parseResult.rootASTElement as Script
They seem to contain different information and I don't see why that would
be.(yeah they come from different places) but more importantly I don't see
why I'm there are two ways of getting (different) Script implementations
(from the same sourcecode / resource).
script1 gets passed to the infererer. Why not script2?
resource
I don't understand why there are two different EObjects that (for me)
should mean the same thing
var script1 = resource.getContents().get(0) as Script
var script2 = resource.parseResult.rootASTElement as Script
They seem to contain different information and I don't see why that would
be.(yeah they come from different places) but more importantly I don't see
why I'm there are two ways of getting (different) Script implementations
(from the same sourcecode / resource).
script1 gets passed to the infererer. Why not script2?
Monday, 19 August 2013
Uploading APK file error The picture in the apk is invalid.
Uploading APK file error "The picture in the apk is invalid."
I got an error "Upload failed.The picture in the apk is invalid." when I
uploaded my .apk file to to the Google Play market.
All the images file type is either .gif or .png in my package.
Besides, I searched some answers about the uploading error here but it
didn't work .Can anyone help me?
I got an error "Upload failed.The picture in the apk is invalid." when I
uploaded my .apk file to to the Google Play market.
All the images file type is either .gif or .png in my package.
Besides, I searched some answers about the uploading error here but it
didn't work .Can anyone help me?
Help identifying tablet manufacturer and model to get specs
Help identifying tablet manufacturer and model to get specs
I received a 7" tablet as a "gift" when I attended a presentation
recently. I'd like to find out some specs about it (processor details, who
the manufacturer is in case I need support, etc.). I hope someone can help
point me in the right direction...
The device came in a white and blue box that said "Android" and "Tablet
PC" on it. There is no mention of any manufacturer, so my guess is I got
an extremely cheap Chinese tablet. The instructions seem to indicate
so...the English in it is horrible.
Based on the "About tablet" section in Settings, it seems to be running
stock Android 4.0.4 and its model number is "TWD_MID". I did some searches
but couldn't find any conclusive manufacturer/specs.
It has 1GB of internal storage, another "internal storage" worth 1.71GB,
and it has a "TF Card" slot...which takes MicroSD cards.
Thanks in advance...
Kevin
I received a 7" tablet as a "gift" when I attended a presentation
recently. I'd like to find out some specs about it (processor details, who
the manufacturer is in case I need support, etc.). I hope someone can help
point me in the right direction...
The device came in a white and blue box that said "Android" and "Tablet
PC" on it. There is no mention of any manufacturer, so my guess is I got
an extremely cheap Chinese tablet. The instructions seem to indicate
so...the English in it is horrible.
Based on the "About tablet" section in Settings, it seems to be running
stock Android 4.0.4 and its model number is "TWD_MID". I did some searches
but couldn't find any conclusive manufacturer/specs.
It has 1GB of internal storage, another "internal storage" worth 1.71GB,
and it has a "TF Card" slot...which takes MicroSD cards.
Thanks in advance...
Kevin
IONICS ISAPI (IIRF) Rewrite Exclusions
IONICS ISAPI (IIRF) Rewrite Exclusions
I'm a novice at regular expressions and ISAPI redirects. I am using the
IIRF ISAPI rewrite filter found here http://iirf.codeplex.com/. This is
what I want to do:
Specify a directory in which all* HTTP requests are redirected to HTTPS
*Exclude a subdirectory, or specific file, from that redirection
For example, I may want http://www.mysite.com/example/ to redirect to
https://www.mysite.com/example/, and also
http://www.mysite.com/example/foo/, http://www.mysite.com/example/bar/,
etc. - all redirect to https://www.mysite.com/example/foo/ and so forth.
However, I may want http://www.mysite.com/example/cat/ NOT to redirect to
https://www.mysite.com/example/cat/, nor its child sub-directory
http://www.mysite.com/example/cat/food/.
The redirect I'm using looks like this:
RewriteCond %{SERVER_PORT} ^80$
RedirectRule ^/(example/.*) https://%{HTTP_HOST}/$1 [R=301]
And it seems to be working as expected - no problems there. According to
this example
(http://iirf.codeplex.com/wikipage?title=Exclude1&referringTitle=Examples),
there's a special rewrite character in IIRF, -, which tells the filter to
do nothing. There is also a flag, [L], which tells the filter that the
preceding rule is the last rule for that request, and to ignore any
following rules which also match.
So I have another redirect which looks like this:
RedirectRule (.*)/cat/(.*)$ - [L]
And so my iirf.ini file looks like this:
#Exclusions
RedirectRule (.*)/cat/(.*)$ - [L]
#Redirects
RewriteCond %{SERVER_PORT} ^80$
RedirectRule ^/(example/.*) https://%{HTTP_HOST}/$1 [R=301]
The HTTPS redirection is working fine. The excluded URLs, though, aren't
working - they get caught in a redirection loop. If I remove the HTTPS
redirect, then the exclusions work fine. Why is this happening? Am I
misunderstanding the way that the [L] flag works?
Thanks!
I'm a novice at regular expressions and ISAPI redirects. I am using the
IIRF ISAPI rewrite filter found here http://iirf.codeplex.com/. This is
what I want to do:
Specify a directory in which all* HTTP requests are redirected to HTTPS
*Exclude a subdirectory, or specific file, from that redirection
For example, I may want http://www.mysite.com/example/ to redirect to
https://www.mysite.com/example/, and also
http://www.mysite.com/example/foo/, http://www.mysite.com/example/bar/,
etc. - all redirect to https://www.mysite.com/example/foo/ and so forth.
However, I may want http://www.mysite.com/example/cat/ NOT to redirect to
https://www.mysite.com/example/cat/, nor its child sub-directory
http://www.mysite.com/example/cat/food/.
The redirect I'm using looks like this:
RewriteCond %{SERVER_PORT} ^80$
RedirectRule ^/(example/.*) https://%{HTTP_HOST}/$1 [R=301]
And it seems to be working as expected - no problems there. According to
this example
(http://iirf.codeplex.com/wikipage?title=Exclude1&referringTitle=Examples),
there's a special rewrite character in IIRF, -, which tells the filter to
do nothing. There is also a flag, [L], which tells the filter that the
preceding rule is the last rule for that request, and to ignore any
following rules which also match.
So I have another redirect which looks like this:
RedirectRule (.*)/cat/(.*)$ - [L]
And so my iirf.ini file looks like this:
#Exclusions
RedirectRule (.*)/cat/(.*)$ - [L]
#Redirects
RewriteCond %{SERVER_PORT} ^80$
RedirectRule ^/(example/.*) https://%{HTTP_HOST}/$1 [R=301]
The HTTPS redirection is working fine. The excluded URLs, though, aren't
working - they get caught in a redirection loop. If I remove the HTTPS
redirect, then the exclusions work fine. Why is this happening? Am I
misunderstanding the way that the [L] flag works?
Thanks!
How to detect when the device switch from portrait to landscape mode?
How to detect when the device switch from portrait to landscape mode?
I have an app which shows fullscreen bitmaps in an activity. In order to
provide fast loading time, I load them in the memory. But when the screen
changes orientation, I would like to clear the cache in order to fill it
again with bitmaps that fit inside the new dimensions. The only problem is
that in order to do this, I need to detect when an orientation change
occurs. Do anyone know how to detect this?
I have an app which shows fullscreen bitmaps in an activity. In order to
provide fast loading time, I load them in the memory. But when the screen
changes orientation, I would like to clear the cache in order to fill it
again with bitmaps that fit inside the new dimensions. The only problem is
that in order to do this, I need to detect when an orientation change
occurs. Do anyone know how to detect this?
In java why is it bad to set a field with both setter and getter as public?
In java why is it bad to set a field with both setter and getter as public?
Consider the following Java code:
public class SomeClass{
private int data;
public void setData(int data){
this.data = data;
}
public int getData(){
return this.data;
}
}
In the above code the value of data can be accessed from anywhere. So why
not just make the field data public?
Consider the following Java code:
public class SomeClass{
private int data;
public void setData(int data){
this.data = data;
}
public int getData(){
return this.data;
}
}
In the above code the value of data can be accessed from anywhere. So why
not just make the field data public?
Get the text of the textView selected using Robotium
Get the text of the textView selected using Robotium
I am automating a product using robotium. I need to do some dat validation
kind of task there.
Scenario is like:
We click on a list, select some items in the list and do some operation.
I want to put the names of the items selected into an array. Such that i
can compare it later.
I used the following code:
for(i=0; i<=n;i++) {
solo.clickInList(i); Array1[i]=solo.getText(i).toString(); }
But sadly, this statement is not extracting the text of the textView
selected but the id of the textView.
Please help me by giving an example of how to get the text of the TextView
selected. At a fix!!
I am automating a product using robotium. I need to do some dat validation
kind of task there.
Scenario is like:
We click on a list, select some items in the list and do some operation.
I want to put the names of the items selected into an array. Such that i
can compare it later.
I used the following code:
for(i=0; i<=n;i++) {
solo.clickInList(i); Array1[i]=solo.getText(i).toString(); }
But sadly, this statement is not extracting the text of the textView
selected but the id of the textView.
Please help me by giving an example of how to get the text of the TextView
selected. At a fix!!
Sunday, 18 August 2013
DataGrid can not be edit
DataGrid can not be edit
I want to use a DataGrid in my window to show and edit some lines of
string.Code as below:
public class StringWrapper
{
public string Value { get; set; }
}
DataGrid dgd = new DataGrid();
dgd.HorizontalAlignment = HorizontalAlignment.Left;
DataGridTextColumn textcolumn = new DataGridTextColumn();
textcolumn.Width = 150;
textcolumn.Header = "Value";
textcolumn.Binding = new Binding("Value");
dgd.Columns.Add(textcolumn);
foreach (var s in lststring)
{
dgd.Items.Add(new StringWrapper { Value = "test string" });
}
spanel.Children.Add(dgd);
Now I can show the string list in a DataGrid,but when I want to edit
it,the program will crash.
EDIT:
The compiler says: 'Edit item' is not allowed for this view.
I want to use a DataGrid in my window to show and edit some lines of
string.Code as below:
public class StringWrapper
{
public string Value { get; set; }
}
DataGrid dgd = new DataGrid();
dgd.HorizontalAlignment = HorizontalAlignment.Left;
DataGridTextColumn textcolumn = new DataGridTextColumn();
textcolumn.Width = 150;
textcolumn.Header = "Value";
textcolumn.Binding = new Binding("Value");
dgd.Columns.Add(textcolumn);
foreach (var s in lststring)
{
dgd.Items.Add(new StringWrapper { Value = "test string" });
}
spanel.Children.Add(dgd);
Now I can show the string list in a DataGrid,but when I want to edit
it,the program will crash.
EDIT:
The compiler says: 'Edit item' is not allowed for this view.
slideToggle stops functioning after div got updated by Ajax
slideToggle stops functioning after div got updated by Ajax
I experience an issue where .slideToggle() or .slideUp()/.slideDown() stop
functioning when the container div data get updated by Ajax. Consider this
initial structure:
<ul class="main-container">
<li>
<div class="data-container"><!--display:none; through CSS-->
<p>empty</p>
</div>
</li>
</ul>
And the slideToggle script:
$('.main-container li').click(function(){
$(this).find('div.data-container').slideToggle();
});
Then there is an Ajax update like this:
$('.main-container').replaceWith(data)
The updated structure becomes:
<ul class="main-container">
<li>
<div class="data-container"><!--display:none; through CSS-->
<ol>
<li>data1</li>
<li>data2</li>
</ol>
</div>
</li>
</ul>
Then the slideToggle stops functioning until I reload the page. Is there
any work around rather than using .slideToggle() or
.slideUp()/.slideDown() ?
I experience an issue where .slideToggle() or .slideUp()/.slideDown() stop
functioning when the container div data get updated by Ajax. Consider this
initial structure:
<ul class="main-container">
<li>
<div class="data-container"><!--display:none; through CSS-->
<p>empty</p>
</div>
</li>
</ul>
And the slideToggle script:
$('.main-container li').click(function(){
$(this).find('div.data-container').slideToggle();
});
Then there is an Ajax update like this:
$('.main-container').replaceWith(data)
The updated structure becomes:
<ul class="main-container">
<li>
<div class="data-container"><!--display:none; through CSS-->
<ol>
<li>data1</li>
<li>data2</li>
</ol>
</div>
</li>
</ul>
Then the slideToggle stops functioning until I reload the page. Is there
any work around rather than using .slideToggle() or
.slideUp()/.slideDown() ?
Isend/Irecv doesn`t work but Send/Recv does
Isend/Irecv doesn`t work but Send/Recv does
When I use Send/Recv my code works but when I replace Send/Recv with
Isend/Irecv it yields segmentation fault. But before going anywhere else I
wanted to verify whether the following snippet seems alrite or not.
The rest of the code should be fine as Send/Recv works; but I have pasted
here as its long.
DO I=1,52
REQ(I)=MPI_REQUEST_NULL
ENDDO
IF (TASKID.NE.0) THEN
NT=TASKID
CALL
MPI_ISEND(RCC(IIST:IIEND,JJST:JJEND,KKST:KKEND),SIZE(RCC),MPI_DOUBLE_PRECISION,0,8,MPI_COMM_WORLD,REQ(NT),IERR)
ENDIF
IF (TASKID.EQ.0) THEN
DO NT = 1,26
CALL
MPI_IRECV(CC(RSPANX(NT):RSPANXE(NT),RSPANY(NT):RSPANYE(NT),RSPANZ(NT):RSPANZE(NT)),SIZECC(NT),MPI_DOUBLE_PRECISION,NT,8,MPI_COMM_WORLD,REQ(NT+26),IERR)
ENDDO
ENDIF
CALL MPI_WAITALL(52,REQ,ISTAT,IERR)
When I use Send/Recv my code works but when I replace Send/Recv with
Isend/Irecv it yields segmentation fault. But before going anywhere else I
wanted to verify whether the following snippet seems alrite or not.
The rest of the code should be fine as Send/Recv works; but I have pasted
here as its long.
DO I=1,52
REQ(I)=MPI_REQUEST_NULL
ENDDO
IF (TASKID.NE.0) THEN
NT=TASKID
CALL
MPI_ISEND(RCC(IIST:IIEND,JJST:JJEND,KKST:KKEND),SIZE(RCC),MPI_DOUBLE_PRECISION,0,8,MPI_COMM_WORLD,REQ(NT),IERR)
ENDIF
IF (TASKID.EQ.0) THEN
DO NT = 1,26
CALL
MPI_IRECV(CC(RSPANX(NT):RSPANXE(NT),RSPANY(NT):RSPANYE(NT),RSPANZ(NT):RSPANZE(NT)),SIZECC(NT),MPI_DOUBLE_PRECISION,NT,8,MPI_COMM_WORLD,REQ(NT+26),IERR)
ENDDO
ENDIF
CALL MPI_WAITALL(52,REQ,ISTAT,IERR)
What to do about terminal's "killall" command if you're not-american and FBI, FEDS want to find something to jail you with
What to do about terminal's "killall" command if you're not-american and
FBI, FEDS want to find something to jail you with
You type
kill all
in the terminal
but FBI is monitoring you.
they use this as an evidence that you wanted to kill all americans.
you get 3 consequtive life sentences behind bars without the possibility
of...
echo "php";
what to do about this in python ?
FBI, FEDS want to find something to jail you with
You type
kill all
in the terminal
but FBI is monitoring you.
they use this as an evidence that you wanted to kill all americans.
you get 3 consequtive life sentences behind bars without the possibility
of...
echo "php";
what to do about this in python ?
Perl - How to solve the trouble with encoding in windows console?
Perl - How to solve the trouble with encoding in windows console?
Trying to use russian lettaz and console acts like a donkey, because does
not react on use utf8/utf-8 or cp1251 directives. What the encoding of the
text marked by red colour I don't know. Anybody knows how to solve that ?
Code listing below:
#!/usr/bin/perl -w
use strict;
use warnings;
use Tie::IxHash;
use encoding 'utf8';
tie my %hash, "Tie::IxHash";
%hash = (
'øëÿïà' => 'ñåðàÿ',
'âîäêà' => 'ãîðüêàÿ',
'âîáëà' => 'âêóñíàÿ');
print " óïîðÿäî÷åííîé âñòàâêå ñïèñîê õåøà òàêîé:\n";
foreach my $qwerty (keys %hash){
print " $qwerty\n";
}
print "Êðîìå òîãî, ïðåäìåòû îáëàäàþò íåêîòîðûìè ñâîéñòâàìè:\n";
while((my $predmet, my $opredelenie) = each %hash){
print $predmet $opredelenie,"\n";
}
Trying to use russian lettaz and console acts like a donkey, because does
not react on use utf8/utf-8 or cp1251 directives. What the encoding of the
text marked by red colour I don't know. Anybody knows how to solve that ?
Code listing below:
#!/usr/bin/perl -w
use strict;
use warnings;
use Tie::IxHash;
use encoding 'utf8';
tie my %hash, "Tie::IxHash";
%hash = (
'øëÿïà' => 'ñåðàÿ',
'âîäêà' => 'ãîðüêàÿ',
'âîáëà' => 'âêóñíàÿ');
print " óïîðÿäî÷åííîé âñòàâêå ñïèñîê õåøà òàêîé:\n";
foreach my $qwerty (keys %hash){
print " $qwerty\n";
}
print "Êðîìå òîãî, ïðåäìåòû îáëàäàþò íåêîòîðûìè ñâîéñòâàìè:\n";
while((my $predmet, my $opredelenie) = each %hash){
print $predmet $opredelenie,"\n";
}
What error it could be
What error it could be
like you could see here in code under that there is no syntax error but
each and every line seems right but when this code is being used in my
Application the " if " statement not works...... its not matching the
string with already existing string array. if i remove that if statements
it works fine for all the iteration. (i've checked by putting same
entities but it's still not working)
I don't want solution i want to know the reason....??? Thanks
NOTE:
s1 ' is a string array (not empty)
searchentry ' is a string (not empty)
Code:
public void searchCapability(){
boolean NotFound=true;
///////////////// Linear Folder Search /////////////
for(int i=0; i<s1.length; i++){
if(searchentry==s1[i]){ // code under this if is not working as
if is true or false
l1.setSelectedIndex(i);
NotFound=false;
}
}
/////////////////// Linear File search /////////////
for(int i2=0; i2<s2.length; i2++){
// code under this if is not working as if is true or false
if((searchentry+".xls")==s2[i2]){
l2.setSelectedIndex(i2);
t1.setText(s3);
NotFound=false;
}
}
if(NotFound==true){
JOptionPane.showMessageDialog(null, "Entry Not Found :)",
"Error", JOptionPane.INFORMATION_MESSAGE);
}
}
like you could see here in code under that there is no syntax error but
each and every line seems right but when this code is being used in my
Application the " if " statement not works...... its not matching the
string with already existing string array. if i remove that if statements
it works fine for all the iteration. (i've checked by putting same
entities but it's still not working)
I don't want solution i want to know the reason....??? Thanks
NOTE:
s1 ' is a string array (not empty)
searchentry ' is a string (not empty)
Code:
public void searchCapability(){
boolean NotFound=true;
///////////////// Linear Folder Search /////////////
for(int i=0; i<s1.length; i++){
if(searchentry==s1[i]){ // code under this if is not working as
if is true or false
l1.setSelectedIndex(i);
NotFound=false;
}
}
/////////////////// Linear File search /////////////
for(int i2=0; i2<s2.length; i2++){
// code under this if is not working as if is true or false
if((searchentry+".xls")==s2[i2]){
l2.setSelectedIndex(i2);
t1.setText(s3);
NotFound=false;
}
}
if(NotFound==true){
JOptionPane.showMessageDialog(null, "Entry Not Found :)",
"Error", JOptionPane.INFORMATION_MESSAGE);
}
}
Saturday, 17 August 2013
How to limit this query to only those authors that wrote more than one book using Oracle?
How to limit this query to only those authors that wrote more than one
book using Oracle?
I have been trying to limit this query to just the authors that wrote more
than one book (should be four), but I can not figure it out. Can someone
please help?
Here is my code:
SELECT title, COUNT(authorid) AS "Number of Authors"
FROM book_author, books, publisher
WHERE publisher.pubid(+) = books.pubid
AND books.bookid(+) = book_author.bookid
GROUP BY title;
Here are the results:
SQL> SELECT title, COUNT(authorid) AS "Number of Authors"
2 FROM book_author, books, publisher
3 WHERE publisher.pubid(+) = books.pubid
4 AND books.bookid(+) = book_author.bookid
5 GROUP BY title;
TITLE Number of Authors
------------------------------ -----------------
DATABASE IMPLEMENTATION 3
PAINLESS CHILD-REARING 3
HOW TO GET FASTER PIZZA 1
SHORTEST POEMS 1
BIG BEAR AND LITTLE DOVE 1
BODYBUILD IN 10 MINUTES A DAY 2
HOLY GRAIL OF ORACLE 1
HANDCRANKED COMPUTERS 2
HOW TO MANAGE THE MANAGER 1
COOKING WITH MUSHROOMS 1
BUILDING A CAR WITH TOOTHPICKS 1
E-BUSINESS THE EASY WAY 1
REVENGE OF MICKEY 1
THE WOK WAY TO COOK 1
14 rows selected.
Any help would be much appreciated.
book using Oracle?
I have been trying to limit this query to just the authors that wrote more
than one book (should be four), but I can not figure it out. Can someone
please help?
Here is my code:
SELECT title, COUNT(authorid) AS "Number of Authors"
FROM book_author, books, publisher
WHERE publisher.pubid(+) = books.pubid
AND books.bookid(+) = book_author.bookid
GROUP BY title;
Here are the results:
SQL> SELECT title, COUNT(authorid) AS "Number of Authors"
2 FROM book_author, books, publisher
3 WHERE publisher.pubid(+) = books.pubid
4 AND books.bookid(+) = book_author.bookid
5 GROUP BY title;
TITLE Number of Authors
------------------------------ -----------------
DATABASE IMPLEMENTATION 3
PAINLESS CHILD-REARING 3
HOW TO GET FASTER PIZZA 1
SHORTEST POEMS 1
BIG BEAR AND LITTLE DOVE 1
BODYBUILD IN 10 MINUTES A DAY 2
HOLY GRAIL OF ORACLE 1
HANDCRANKED COMPUTERS 2
HOW TO MANAGE THE MANAGER 1
COOKING WITH MUSHROOMS 1
BUILDING A CAR WITH TOOTHPICKS 1
E-BUSINESS THE EASY WAY 1
REVENGE OF MICKEY 1
THE WOK WAY TO COOK 1
14 rows selected.
Any help would be much appreciated.
Different Behavior between Numeric Literals and Constrained Function Parameters in Haskell
Different Behavior between Numeric Literals and Constrained Function
Parameters in Haskell
I've been trying to figure out the more finnicky bits of Haskell's type
system by writing a Vector library. Ideally, I'd like an overloaded vector
multiplication operation that works a bit like C++, i.e, you can multiply
a vector of any size by a scalar, in either order. I've tried to combine
the multiple parameter type classes and type families extension to do
this:
data Vec2 a = Vec2 (a,a) deriving (Show, Eq, Read)
class Vector a where
(<+>) :: a -> a -> a
class VectorMul a b where
type Result a b
(<*>) :: a -> b -> Result a b
instance (Num a) => Vector (Vec2 a) where
Vec2 (x1,y1) <+> Vec2 (x2,y2) = Vec2 (x1+x2, y1+y2)
instance (Num a) => VectorMul (Vec2 a) a where
type Result (Vec2 a) a = (Vec2 a)
Vec2 (x,y) <*> a = Vec2 (x*a, y*a)
works :: (Num a) => Vec2 a -> a -> Vec2 a
works a b = a <*> b
This code seems to work, at least when used as in the function "works".
But when I try to type a simple expression like "Vec2 (3,4) <*> 5" into
GHCi, it reports the (Num xx) type variables to be ambiguous. This is
strange to me... what am I missing in this case? Haskell should be able to
choose the same arbitrary type for the literals, to make the type
expression work (as it does in the works function).
Parameters in Haskell
I've been trying to figure out the more finnicky bits of Haskell's type
system by writing a Vector library. Ideally, I'd like an overloaded vector
multiplication operation that works a bit like C++, i.e, you can multiply
a vector of any size by a scalar, in either order. I've tried to combine
the multiple parameter type classes and type families extension to do
this:
data Vec2 a = Vec2 (a,a) deriving (Show, Eq, Read)
class Vector a where
(<+>) :: a -> a -> a
class VectorMul a b where
type Result a b
(<*>) :: a -> b -> Result a b
instance (Num a) => Vector (Vec2 a) where
Vec2 (x1,y1) <+> Vec2 (x2,y2) = Vec2 (x1+x2, y1+y2)
instance (Num a) => VectorMul (Vec2 a) a where
type Result (Vec2 a) a = (Vec2 a)
Vec2 (x,y) <*> a = Vec2 (x*a, y*a)
works :: (Num a) => Vec2 a -> a -> Vec2 a
works a b = a <*> b
This code seems to work, at least when used as in the function "works".
But when I try to type a simple expression like "Vec2 (3,4) <*> 5" into
GHCi, it reports the (Num xx) type variables to be ambiguous. This is
strange to me... what am I missing in this case? Haskell should be able to
choose the same arbitrary type for the literals, to make the type
expression work (as it does in the works function).
Subscribe to:
Comments (Atom)