javascript object declaration no working as i want it to
i am creating a (lame) game, in which i declare the object player like so:
var player = {
"id": "player",
"displayText" : "<img src =
'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-eG_HT8y1uyGyfEnAOTV1PZmAyA2hCR3et4-UeSilkBw23CZaKHqQsIeOt1Odcxmzle5mqaiOSVqOTdTJ5157ryIqnytK6BGvQj8tipG9TYuXNeS64mLlu259ZNw6lrN7R0xq5Zs_s8I/s1600/smileys_001_01.png'"
+
"class='onTop' id='" + this.id + "' alt='you' border='0' />" +
"<div id = '" + this.id + "health' class = 'healthLost hide'></div>",
};
however this.id is returning undefined, why and what can i do to fix this?
Saturday, 31 August 2013
ChildAction triggered on dropdown change in partial view
ChildAction triggered on dropdown change in partial view
I want to trigger a ChildAction on the Home Controller on the onchange
event of a dropdown. The dropdown is located at the _Layout.cshtml.
Is it possible to do it on javascript?
Here is my code as of the moment.
$('#langDropdown').change(function() {
var lang = $(this).val();
alert(lang);
});
And here is my dropdown:
@Html.DropDownList("Language", ViewData["Languages"] as SelectList, new {
id = language })
It not inside of any form. Any suggestion how can I do it. Thanks!
Note: I just use alert for testing purposes.
I want to trigger a ChildAction on the Home Controller on the onchange
event of a dropdown. The dropdown is located at the _Layout.cshtml.
Is it possible to do it on javascript?
Here is my code as of the moment.
$('#langDropdown').change(function() {
var lang = $(this).val();
alert(lang);
});
And here is my dropdown:
@Html.DropDownList("Language", ViewData["Languages"] as SelectList, new {
id = language })
It not inside of any form. Any suggestion how can I do it. Thanks!
Note: I just use alert for testing purposes.
Structural-type casting does not work with String?
Structural-type casting does not work with String?
Given these definitions:
type HasMkString = { def mkString(sep:String):String }
val name = "John"
val names = List("Peter", "Gabriel")
And given these facts:
name.mkString("-") // => "J-o-h-n"
name.isInstanceOf[HasMkString] // => true
names.isInstanceOf[HasMkString] // => true
While this works:
names.asInstanceOf[HasMkString].mkString("-")
// => Peter-Gabriel
This does not work:
name.asInstanceOf[HasMkString].mkString(", ")
java.lang.NoSuchMethodException: java.lang.String.mkString(java.lang.String)
at java.lang.Class.getMethod(Class.java:1624)
at .reflMethod$Method1(<console>:10)
at .<init>(<console>:10)
at .<clinit>(<console>:10)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
Why is that? Is it because String is a Java class? Can I work around this
problem? Is this a bug/shortcoming in the Scala implementation?
Given these definitions:
type HasMkString = { def mkString(sep:String):String }
val name = "John"
val names = List("Peter", "Gabriel")
And given these facts:
name.mkString("-") // => "J-o-h-n"
name.isInstanceOf[HasMkString] // => true
names.isInstanceOf[HasMkString] // => true
While this works:
names.asInstanceOf[HasMkString].mkString("-")
// => Peter-Gabriel
This does not work:
name.asInstanceOf[HasMkString].mkString(", ")
java.lang.NoSuchMethodException: java.lang.String.mkString(java.lang.String)
at java.lang.Class.getMethod(Class.java:1624)
at .reflMethod$Method1(<console>:10)
at .<init>(<console>:10)
at .<clinit>(<console>:10)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
Why is that? Is it because String is a Java class? Can I work around this
problem? Is this a bug/shortcoming in the Scala implementation?
Controller#needs - Route has dot in it?
Controller#needs - Route has dot in it?
I recently had to convert all of my routes to the deeply nested version.
For example: pages.page became books.book.pages.page. It was necessary for
some of the linking I was doing. The problem is that I have a controller
that declares that it needs another controller. Specifically, it needed
the book controller. But now the book controller is the books.book
controller. This presents an issue because this code no longer works:
this.get('controllers.books.book');
Now it thinks that book is just a property of the books controller, when
in reality, it's all one property. How can I resolve this issue? So far
I've tried these methods, none of which work:
this.get('controllers').get('books.book');
this.get('controllers.`books.book`');
this.get("controllers.'books.book'");
I recently had to convert all of my routes to the deeply nested version.
For example: pages.page became books.book.pages.page. It was necessary for
some of the linking I was doing. The problem is that I have a controller
that declares that it needs another controller. Specifically, it needed
the book controller. But now the book controller is the books.book
controller. This presents an issue because this code no longer works:
this.get('controllers.books.book');
Now it thinks that book is just a property of the books controller, when
in reality, it's all one property. How can I resolve this issue? So far
I've tried these methods, none of which work:
this.get('controllers').get('books.book');
this.get('controllers.`books.book`');
this.get("controllers.'books.book'");
PHP - Generating several forms, but the forms only ever output the same thing for each form
PHP - Generating several forms, but the forms only ever output the same
thing for each form
Ok so I basically have generated a list of links that use forms to send a
variable to PHP that would allow me to load different things on the next
page from each link. However, each link seems to only request the same
data from the database each time
Here is the first page:
thing for each form
Ok so I basically have generated a list of links that use forms to send a
variable to PHP that would allow me to load different things on the next
page from each link. However, each link seems to only request the same
data from the database each time
Here is the first page:
Friday, 30 August 2013
In a traditional tiered web application (Model, View, Control), where is JavaScript usually used? What is NOT recommended to be used for?
In a traditional tiered web application (Model, View, Control), where is
JavaScript usually used? What is NOT recommended to be used for?
guys please help me to this question: In a traditional tiered web
application (Model, View, Control), where is JavaScript usually used? What
is NOT recommended to be used for?
JavaScript usually used? What is NOT recommended to be used for?
guys please help me to this question: In a traditional tiered web
application (Model, View, Control), where is JavaScript usually used? What
is NOT recommended to be used for?
Wednesday, 28 August 2013
Grouping items with a header using Caliburn.Micro
Grouping items with a header using Caliburn.Micro
I am building a MVVM WPF application using Caliburn Micro. Unfortunately
I've not an expert in XAML. What I am trying to do is display a list of
schedule items. I want to group these items by date (so all items under
today would be together and then a separator and then all items under
tomorrow next) like so:
Date: 8/28/2013
Schedule Event One
Schedule Event Three
Schedule Event Four
Date: 8/29/2013
Schedule Event Two
Schedule Event Five
I can list them easily enough but breaking them up by group is more
difficult. The examples I've seen aren't very documented and they tend to
use code-behind or static resources. I am looking to do this using MVVM
and Caliburn Micro so neither of those types of solutions will work and I
can't figure out how to adapt them.
My (simplified for this post) model looks like this:
public class ScheduleItemModel
{
public string Title { get; set; }
public DateTime EventDate { get; set; }
public string Description { get; set; }
}
On the XAML side, I am using an ItemsControl inside a StackPanel like so:
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderThickness="0,0,0,0" BorderBrush="Black"
VerticalAlignment="Center">
<TextBlock FontSize="20" Margin="5,0,5,0"
VerticalAlignment="Center" Text="{Binding Title}"></TextBlock>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
This works to display all of the items in the list from my ViewModel
(which is an ObservableCollection of my Models). I tried adding a
GroupStyle to my template like so:
<ItemsControl.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<Border Grid.Row="0" BorderThickness="0,0,0,1"
BorderBrush="Black" Margin="5,0,5,0" >
<TextBlock FontSize="20" FontWeight="Thin"
Text="{Binding Path=Name}"
Margin="0,5,0,5" HorizontalAlignment="Center" />
</Border>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ItemsControl.GroupStyle>
The problem is that I don't know how to wire it all up.
I am building a MVVM WPF application using Caliburn Micro. Unfortunately
I've not an expert in XAML. What I am trying to do is display a list of
schedule items. I want to group these items by date (so all items under
today would be together and then a separator and then all items under
tomorrow next) like so:
Date: 8/28/2013
Schedule Event One
Schedule Event Three
Schedule Event Four
Date: 8/29/2013
Schedule Event Two
Schedule Event Five
I can list them easily enough but breaking them up by group is more
difficult. The examples I've seen aren't very documented and they tend to
use code-behind or static resources. I am looking to do this using MVVM
and Caliburn Micro so neither of those types of solutions will work and I
can't figure out how to adapt them.
My (simplified for this post) model looks like this:
public class ScheduleItemModel
{
public string Title { get; set; }
public DateTime EventDate { get; set; }
public string Description { get; set; }
}
On the XAML side, I am using an ItemsControl inside a StackPanel like so:
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderThickness="0,0,0,0" BorderBrush="Black"
VerticalAlignment="Center">
<TextBlock FontSize="20" Margin="5,0,5,0"
VerticalAlignment="Center" Text="{Binding Title}"></TextBlock>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
This works to display all of the items in the list from my ViewModel
(which is an ObservableCollection of my Models). I tried adding a
GroupStyle to my template like so:
<ItemsControl.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<Border Grid.Row="0" BorderThickness="0,0,0,1"
BorderBrush="Black" Margin="5,0,5,0" >
<TextBlock FontSize="20" FontWeight="Thin"
Text="{Binding Path=Name}"
Margin="0,5,0,5" HorizontalAlignment="Center" />
</Border>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ItemsControl.GroupStyle>
The problem is that I don't know how to wire it all up.
OG. More than 1 video on page
OG. More than 1 video on page
How can I add OG markup for more than 1 video, placed on a page? I need an
example please.
I had added markup for 1 video but have no idea how to do it for 2 or more.
How can I add OG markup for more than 1 video, placed on a page? I need an
example please.
I had added markup for 1 video but have no idea how to do it for 2 or more.
Archive file from a document library to another with metadatas
Archive file from a document library to another with metadatas
I'm quite a newbie concerning the SharePoint API, but I have been asked to
code something quickly with it.
I have to programmatically move files from a document library to another,
an "archive" one, on the same site and preserve the file's metadatas. This
will happen on a SharePoint 2010 farm.
From now on, I've been able to identify the expiration date of each file
in the library. If the expiration date is inferior or equal today, than I
must archive the file.
The "Archive" Library has been created in order to be identical to the
original one.
It seems, from what I've been told and what I read, that a simple copy
will lose those metadatas.
I've of course searched on Google, but I've been lost from going to one
site to another one, with so many examples that I do not know if it fit my
simple case...
Have you been confronted with this kind of problems ? Is there a sample of
code out there that could help me ?
Many thanks in advance,
JN
I'm quite a newbie concerning the SharePoint API, but I have been asked to
code something quickly with it.
I have to programmatically move files from a document library to another,
an "archive" one, on the same site and preserve the file's metadatas. This
will happen on a SharePoint 2010 farm.
From now on, I've been able to identify the expiration date of each file
in the library. If the expiration date is inferior or equal today, than I
must archive the file.
The "Archive" Library has been created in order to be identical to the
original one.
It seems, from what I've been told and what I read, that a simple copy
will lose those metadatas.
I've of course searched on Google, but I've been lost from going to one
site to another one, with so many examples that I do not know if it fit my
simple case...
Have you been confronted with this kind of problems ? Is there a sample of
code out there that could help me ?
Many thanks in advance,
JN
How to implement MySQL SET concept with over 64 members?
How to implement MySQL SET concept with over 64 members?
What is the best way to replicate the behaviour of a MySQL SET col type,
with over 64 members?
I need to do what I would naturally do with a MySQL SET with around 85
different options. (The limit is 64.) What would be the best way to
implement this?
I've looked at this question, which suggests a JOIN, but my members are
only 6-char strings, is the most efficient way really to create an entire
new, 1-column table of these members (I'll call it table 2), and then a
third table of 2 cols linking an id from table 1 (where I would have
created my SET column) and table 2?
What is the best way to replicate the behaviour of a MySQL SET col type,
with over 64 members?
I need to do what I would naturally do with a MySQL SET with around 85
different options. (The limit is 64.) What would be the best way to
implement this?
I've looked at this question, which suggests a JOIN, but my members are
only 6-char strings, is the most efficient way really to create an entire
new, 1-column table of these members (I'll call it table 2), and then a
third table of 2 cols linking an id from table 1 (where I would have
created my SET column) and table 2?
How to change the minimum collaps for bootstrap navbar
How to change the minimum collaps for bootstrap navbar
I recently created a pretty long list in my bootsstrap navbar, i wondered
how i can change the setting for when my navbars to hide into the
javascript button, check out the page with the problem at:
http://www.twoog.org.
Thanks on beforehand.
I recently created a pretty long list in my bootsstrap navbar, i wondered
how i can change the setting for when my navbars to hide into the
javascript button, check out the page with the problem at:
http://www.twoog.org.
Thanks on beforehand.
Tuesday, 27 August 2013
Newsfeed update instruction syntax
Newsfeed update instruction syntax
I am receiving news update instruction from a Feed. Thing is, a news
provider push newsfeed to our server. Once in a while they push same feed
but the content is an update instruction instead of the actual content.
This is the update instruction of previously sent article.
Here is some example of update instructions.
CORRECTS DAY OF WEEK TO TUESDAY, NOT MONDAY
CORRECTS ISRAELI TO PALESTINIAN AUTHORITY SECURITY FORCES IN FIRST SENTENCE
CORRECTS AGE TO 13 NOT 15
CORRECTS TO CLARIFY IT IS COOK COUNTY'S EARLY EXPANSION OF MEDICAID UNDER
PRESIDENT OBAMA'S HEALTH LAW AND EXPLAIN ESPITIA'S ROLE IN THE PROCESS -
ADVANCE FOR USE MONDAY, AUG. 26 AND THEREAFTER
Is it a standard instruction? If yes, is there any syntax for this? How
can I parse it with python?
I am receiving news update instruction from a Feed. Thing is, a news
provider push newsfeed to our server. Once in a while they push same feed
but the content is an update instruction instead of the actual content.
This is the update instruction of previously sent article.
Here is some example of update instructions.
CORRECTS DAY OF WEEK TO TUESDAY, NOT MONDAY
CORRECTS ISRAELI TO PALESTINIAN AUTHORITY SECURITY FORCES IN FIRST SENTENCE
CORRECTS AGE TO 13 NOT 15
CORRECTS TO CLARIFY IT IS COOK COUNTY'S EARLY EXPANSION OF MEDICAID UNDER
PRESIDENT OBAMA'S HEALTH LAW AND EXPLAIN ESPITIA'S ROLE IN THE PROCESS -
ADVANCE FOR USE MONDAY, AUG. 26 AND THEREAFTER
Is it a standard instruction? If yes, is there any syntax for this? How
can I parse it with python?
check if current dir contains spaces in its name
check if current dir contains spaces in its name
I would like my script to abort if the current directory contains a space
in its name.
My thought was to use %~s but so far my efforts are frustrating. The
following works, but I don't like it. My attempts at passing a parameter
have been futile.
Any suggestion for improvements?
@echo off
setlocal enableextensions
for /f %%f in ("%cd%") do (
if NOT "%%f" == "%cd%" (
echo bad dir"%cd%" contains spaces
) else (
echo no spaces in "%cd%"
)
)
)
I would like my script to abort if the current directory contains a space
in its name.
My thought was to use %~s but so far my efforts are frustrating. The
following works, but I don't like it. My attempts at passing a parameter
have been futile.
Any suggestion for improvements?
@echo off
setlocal enableextensions
for /f %%f in ("%cd%") do (
if NOT "%%f" == "%cd%" (
echo bad dir"%cd%" contains spaces
) else (
echo no spaces in "%cd%"
)
)
)
How to create a Angular.js $resource/$http factory service to handle a query string with multiple parameters from an external resource?
How to create a Angular.js $resource/$http factory service to handle a
query string with multiple parameters from an external resource?
How could a factory $resource or $http service be created to handle a
query string with multiple arbitrary parameters from an external resource?
eg.
#/animals
#/animals?gender=m
#/animals?color=black
#/animals?size=small
#/animals?gender=m&color=black
#/animals?size=med&gender=f
#/animals?size=lg&gender=m&color=red
The idea is that there are buttons/inputs which the user can press to add
to the current list of parameters in the query string to get a new list of
animals with the desired properties in different combinations. I have
tried the following but it doesn't reload or add new parameters to the
existing url as desired. Also, I'm not sure if $route.current.params
should be called in the controller or the factory and if that's the best
way to do it.
angular.module(Animals, ['$resource', '$route', '$location',
function($resource, $route, $location) {
return $resource('http://thezoo.com/animals', $route.current.params, {
query: {method: 'GET', isArray: true}});
}]);
Thanks :)
query string with multiple parameters from an external resource?
How could a factory $resource or $http service be created to handle a
query string with multiple arbitrary parameters from an external resource?
eg.
#/animals
#/animals?gender=m
#/animals?color=black
#/animals?size=small
#/animals?gender=m&color=black
#/animals?size=med&gender=f
#/animals?size=lg&gender=m&color=red
The idea is that there are buttons/inputs which the user can press to add
to the current list of parameters in the query string to get a new list of
animals with the desired properties in different combinations. I have
tried the following but it doesn't reload or add new parameters to the
existing url as desired. Also, I'm not sure if $route.current.params
should be called in the controller or the factory and if that's the best
way to do it.
angular.module(Animals, ['$resource', '$route', '$location',
function($resource, $route, $location) {
return $resource('http://thezoo.com/animals', $route.current.params, {
query: {method: 'GET', isArray: true}});
}]);
Thanks :)
(each call to glTranslate is cumulative on the modelview matrix) what does it mean and how to disable this feature?
(each call to glTranslate is cumulative on the modelview matrix) what does
it mean and how to disable this feature?
Studying the book OpenGL SuperBible fram Addison-Wesley, I read:
each call to glTranslate is cumulative on the modelview matrix
what does it mean?
Does it mean that for example this code:
glTranslatef(2.0,3.0,0);
glTranslatef(4.0,5.0,0);
first moves an object that is on the origin to the point (2,3,0) and then
translates it from the (2,3,0) to (2+4,3+5,0+0) = (6,8,0) not from the
origin again?
Is this true about glScalef and glRotatef too?
for example this code:
glScalef(2.0,3.0,4.0);
glScalef(3.0,4.0,5.0);
first turn a 1x1x1 cuboid to a 2x3x4 cubic rectangle and then turns this
cubic rectangle to a 6x12x20 one?
And at last, Does this code mean that a total 75 degrees rotation around
the x-axis?
glRotatef(30.0,1,0,0);
glRotatef(45.0,1,0,0);
the most importantant: Does calling glLoadIdentity() before each call of
these functions cancels these feature?
I mean Do you think this code assures that each time translates will be
done from the origin? , scale changes will be done from the initial state?
void COpenGLControl::ZoomToFullExtent()
{
float zoom1 = (float)oglWindowWidth/(float)ImageWidth;
float zoom2 = (float)oglWindowHeight/(float)ImageHeight;
m_fZoom = min(zoom1,zoom2);
m_fZoomInverse = 1/m_fZoom;
m_fPosX = 0;
m_fPosY = 0;
OnDraw(NULL);
}
void COpenGLControl::FixedZoomIn()
{
m_fZoom = 2*m_fZoom;
m_fZoomInverse = 1/m_fZoom;
OnDraw(NULL);
}
void COpenGLControl::FixedZoomOut()
{
m_fZoom = 0.5*m_fZoom;
m_fZoomInverse = 1/m_fZoom;
OnDraw(NULL);
}
void COpenGLControl::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (WantToPan)
{
if (m_fLastX < 0.0f && m_fLastY < 0.0f)
{
m_fLastX = (float)point.x;
m_fLastY = (float)point.y;
}
diffX = (int)(point.x - m_fLastX);
diffY = (int)(point.y - m_fLastY);
m_fLastX = (float)point.x;
m_fLastY = (float)point.y;
if (nFlags & MK_MBUTTON)
{
m_fPosX += (float)0.2f*m_fZoomInverse*diffX;
m_fPosY += (float)0.2f*m_fZoomInverse*diffY;
}
OnDraw(NULL);
}
CWnd::OnMouseMove(nFlags, point);
}
void COpenGLControl::OnDraw(CDC *pDC)
{
// TODO: Camera controls
wglMakeCurrent(hdc,hrc);
glLoadIdentity();
gluLookAt(0,0,1,0,0,0,0,1,0);
glScalef(m_fZoom,m_fZoom,1.0);
glTranslatef(m_fPosX, m_fPosY, 0.0f);
wglMakeCurrent(NULL, NULL);
}
it mean and how to disable this feature?
Studying the book OpenGL SuperBible fram Addison-Wesley, I read:
each call to glTranslate is cumulative on the modelview matrix
what does it mean?
Does it mean that for example this code:
glTranslatef(2.0,3.0,0);
glTranslatef(4.0,5.0,0);
first moves an object that is on the origin to the point (2,3,0) and then
translates it from the (2,3,0) to (2+4,3+5,0+0) = (6,8,0) not from the
origin again?
Is this true about glScalef and glRotatef too?
for example this code:
glScalef(2.0,3.0,4.0);
glScalef(3.0,4.0,5.0);
first turn a 1x1x1 cuboid to a 2x3x4 cubic rectangle and then turns this
cubic rectangle to a 6x12x20 one?
And at last, Does this code mean that a total 75 degrees rotation around
the x-axis?
glRotatef(30.0,1,0,0);
glRotatef(45.0,1,0,0);
the most importantant: Does calling glLoadIdentity() before each call of
these functions cancels these feature?
I mean Do you think this code assures that each time translates will be
done from the origin? , scale changes will be done from the initial state?
void COpenGLControl::ZoomToFullExtent()
{
float zoom1 = (float)oglWindowWidth/(float)ImageWidth;
float zoom2 = (float)oglWindowHeight/(float)ImageHeight;
m_fZoom = min(zoom1,zoom2);
m_fZoomInverse = 1/m_fZoom;
m_fPosX = 0;
m_fPosY = 0;
OnDraw(NULL);
}
void COpenGLControl::FixedZoomIn()
{
m_fZoom = 2*m_fZoom;
m_fZoomInverse = 1/m_fZoom;
OnDraw(NULL);
}
void COpenGLControl::FixedZoomOut()
{
m_fZoom = 0.5*m_fZoom;
m_fZoomInverse = 1/m_fZoom;
OnDraw(NULL);
}
void COpenGLControl::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (WantToPan)
{
if (m_fLastX < 0.0f && m_fLastY < 0.0f)
{
m_fLastX = (float)point.x;
m_fLastY = (float)point.y;
}
diffX = (int)(point.x - m_fLastX);
diffY = (int)(point.y - m_fLastY);
m_fLastX = (float)point.x;
m_fLastY = (float)point.y;
if (nFlags & MK_MBUTTON)
{
m_fPosX += (float)0.2f*m_fZoomInverse*diffX;
m_fPosY += (float)0.2f*m_fZoomInverse*diffY;
}
OnDraw(NULL);
}
CWnd::OnMouseMove(nFlags, point);
}
void COpenGLControl::OnDraw(CDC *pDC)
{
// TODO: Camera controls
wglMakeCurrent(hdc,hrc);
glLoadIdentity();
gluLookAt(0,0,1,0,0,0,0,1,0);
glScalef(m_fZoom,m_fZoom,1.0);
glTranslatef(m_fPosX, m_fPosY, 0.0f);
wglMakeCurrent(NULL, NULL);
}
oracle SQL.merge multiple coloumns
oracle SQL.merge multiple coloumns
I have data as below
A B
= 1
= 2
!= 3
= 4
!= 5
I need to put these into one coloumn so that all '!=' are below "=" data
and with '!=' as dummy row
1
2
4
!=
3
5
I have data as below
A B
= 1
= 2
!= 3
= 4
!= 5
I need to put these into one coloumn so that all '!=' are below "=" data
and with '!=' as dummy row
1
2
4
!=
3
5
Create inner Shadow in a UIButton
Create inner Shadow in a UIButton
I want to create a inner Shadow. The Shadow should be inside the Button on
the bottom. But i can only create a Shadow outside of the Button, like
this:
self.button.layer.masksToBounds = NO;
self.button.layer.shadowColor = [UIColor blackColor].CGColor;
self.button.layer.shadowOpacity = 0.8;
self.button.layer.shadowRadius = 12;
self.button.layer.shadowOffset = CGSizeMake(50.0f, 50.0f);
Whats wrong?
Thanks!!
I want to create a inner Shadow. The Shadow should be inside the Button on
the bottom. But i can only create a Shadow outside of the Button, like
this:
self.button.layer.masksToBounds = NO;
self.button.layer.shadowColor = [UIColor blackColor].CGColor;
self.button.layer.shadowOpacity = 0.8;
self.button.layer.shadowRadius = 12;
self.button.layer.shadowOffset = CGSizeMake(50.0f, 50.0f);
Whats wrong?
Thanks!!
Unable to get location on Samsung galaxy S4
Unable to get location on Samsung galaxy S4
I have developed an android application in which I am fetching user's
current location at app launch. I have used Google play services and fused
client to obtain the location. When I launch my app with Wi-Fi on,
everything works fine. But when I am launching the app with mobile network
turned on, I am not able to fetch location. I debugged my code, and I came
to conclusion that whenever I run app using mobile networks,
"onLocationChanged" callback is not getting triggered. Also I want to
mention one thing more specifically that, this issue is occurring in
Samsung S4 more frequently. Can anybody please guide me, why I am getting
this issue..?
I have developed an android application in which I am fetching user's
current location at app launch. I have used Google play services and fused
client to obtain the location. When I launch my app with Wi-Fi on,
everything works fine. But when I am launching the app with mobile network
turned on, I am not able to fetch location. I debugged my code, and I came
to conclusion that whenever I run app using mobile networks,
"onLocationChanged" callback is not getting triggered. Also I want to
mention one thing more specifically that, this issue is occurring in
Samsung S4 more frequently. Can anybody please guide me, why I am getting
this issue..?
Monday, 26 August 2013
JavaScript, setInterval with a count
JavaScript, setInterval with a count
If possible I'd like to use to remove count and use an argument in
self.addOrbitTrap(). At the moment for testing my code does something like
this:
Bbrot.prototype.findMSet = function() {
//...code
var self = this;
canvasInterval = setInterval(function() {
self.addOrbitTrap();
}, 0);
}
var count = 0;
Bbrot.prototype.addOrbitTrap = function() {
//...code
count++;
}
If possible I'd like to use to remove count and use an argument in
self.addOrbitTrap(). At the moment for testing my code does something like
this:
Bbrot.prototype.findMSet = function() {
//...code
var self = this;
canvasInterval = setInterval(function() {
self.addOrbitTrap();
}, 0);
}
var count = 0;
Bbrot.prototype.addOrbitTrap = function() {
//...code
count++;
}
Get Two Specific Word Using Regex and Save it to HashMap
Get Two Specific Word Using Regex and Save it to HashMap
I need a help, I have a String like
LOCALHOST = https://192.168.56.1
I want to get the "LOCALHOST" and the IP address then save it to HashMap
This is my code so far, I didnt know how to use regex, please help The
output that I want is in HashMap {LOCALHOST=192.168.56.1}
public static void main(String[] args) {
try {
String line = "LOCALHOST = https://192.168.56.1";
//this must be a hash map
ArrayList<String> urls = new ArrayList<String>();
//didnt know how to get two string
Matcher m = Pattern.compile("([^ =]+)").matcher(line);
while (m.find()) {
urls.add(m.group());
}
System.out.println(urls);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
Thank you for the help
I need a help, I have a String like
LOCALHOST = https://192.168.56.1
I want to get the "LOCALHOST" and the IP address then save it to HashMap
This is my code so far, I didnt know how to use regex, please help The
output that I want is in HashMap {LOCALHOST=192.168.56.1}
public static void main(String[] args) {
try {
String line = "LOCALHOST = https://192.168.56.1";
//this must be a hash map
ArrayList<String> urls = new ArrayList<String>();
//didnt know how to get two string
Matcher m = Pattern.compile("([^ =]+)").matcher(line);
while (m.find()) {
urls.add(m.group());
}
System.out.println(urls);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
Thank you for the help
unable to show a progress bar properly
unable to show a progress bar properly
i want to show in my activity a progress bar as a response to a button
click. i read in another question that i should use async task in order to
show/not show the progress bar but when i click on the button the progress
bar is not shown properly (it appears for much less time then it should)
any suggestions?
the activity code:
public void chooseContactFromList(View view){
ProgressBar pBar = (ProgressBar) findViewById(R.id.progressBar1);
circleActivity progressTask = (circleActivity) new
circleActivity(pBar).execute();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
CharSequence[] cs=nameList.toArray(new CharSequence[nameList.size()]);
builder.setTitle("Make your selection");
builder.setItems(cs, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
reciverNumber = phoneList.get(item);
}
});
AlertDialog alert = builder.create();
alert.show();
progressTask.cancel(true);
}
the AsyncTask code:
public class circleActivity extends AsyncTask<Void, Void, Void> {
private ProgressBar progressBar;
public circleActivity(ProgressBar pBar) {
progressBar=pBar;
}
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
progressBar.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Void result) {
progressBar.setVisibility(View.INVISIBLE);
}
@Override
protected void onProgressUpdate(Void ... progress) {
}
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
return null;
}
}
thanks
i want to show in my activity a progress bar as a response to a button
click. i read in another question that i should use async task in order to
show/not show the progress bar but when i click on the button the progress
bar is not shown properly (it appears for much less time then it should)
any suggestions?
the activity code:
public void chooseContactFromList(View view){
ProgressBar pBar = (ProgressBar) findViewById(R.id.progressBar1);
circleActivity progressTask = (circleActivity) new
circleActivity(pBar).execute();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
CharSequence[] cs=nameList.toArray(new CharSequence[nameList.size()]);
builder.setTitle("Make your selection");
builder.setItems(cs, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
reciverNumber = phoneList.get(item);
}
});
AlertDialog alert = builder.create();
alert.show();
progressTask.cancel(true);
}
the AsyncTask code:
public class circleActivity extends AsyncTask<Void, Void, Void> {
private ProgressBar progressBar;
public circleActivity(ProgressBar pBar) {
progressBar=pBar;
}
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
progressBar.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Void result) {
progressBar.setVisibility(View.INVISIBLE);
}
@Override
protected void onProgressUpdate(Void ... progress) {
}
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
return null;
}
}
thanks
tcpdump: can't create rx ring on packet socket: Cannot allocate memory
tcpdump: can't create rx ring on packet socket: Cannot allocate memory
I've been using tcpdump without any issues before this error popped up. I
use the following two commands with variations as soon as my server is
attacked so the packets automatically get dumped if the packet rate is
high.
tcpdump -i eth0 -p -nn -s0 -c 2000 -w $dumpdir/dump.`date
+"%Y%m%d-%H%M%S"`.cap
tcpdump -nn -s0 -c 2000 -w $dumpdir/dump.`date +"%Y%m%d-%H%M%S"`.cap
The following error shows up in console as soon as I'm under attack:
tcpdump: can't create rx ring on packet socket: Cannot allocate memory
Using the command manually works so my guess is that something gets
overloaded in the event of an attack. Here is my RAM usage though:
root@x:~# free -m
total used free shared buffers cached
Mem: 2004 1255 749 0 1 29
-/+ buffers/cache: 1225 779
Swap: 2047 1095 952
And currently, it is much lower than it used to be when the command worked.
I've been using tcpdump without any issues before this error popped up. I
use the following two commands with variations as soon as my server is
attacked so the packets automatically get dumped if the packet rate is
high.
tcpdump -i eth0 -p -nn -s0 -c 2000 -w $dumpdir/dump.`date
+"%Y%m%d-%H%M%S"`.cap
tcpdump -nn -s0 -c 2000 -w $dumpdir/dump.`date +"%Y%m%d-%H%M%S"`.cap
The following error shows up in console as soon as I'm under attack:
tcpdump: can't create rx ring on packet socket: Cannot allocate memory
Using the command manually works so my guess is that something gets
overloaded in the event of an attack. Here is my RAM usage though:
root@x:~# free -m
total used free shared buffers cached
Mem: 2004 1255 749 0 1 29
-/+ buffers/cache: 1225 779
Swap: 2047 1095 952
And currently, it is much lower than it used to be when the command worked.
Nexus 4: Is there a "surgical" way to retrieve data from storage?
Nexus 4: Is there a "surgical" way to retrieve data from storage?
Nexus 4 took a dive in the ocean (salt water) and now it is resting in a
rice bowl. While we all hope for a seamless recovery, I understand all the
corrosion niceties salt water brings to the party.
However, the phone has unsynced pictures/videos that I'd like to retrieve.
Connecting it via adb/usb/otherb is not an option of course, since it does
not turn on.
Is there a more intrusive/surgical way to get to the data? I don't mind
soldering that storage out and connecting it to something that can read
it.
Nexus 4 took a dive in the ocean (salt water) and now it is resting in a
rice bowl. While we all hope for a seamless recovery, I understand all the
corrosion niceties salt water brings to the party.
However, the phone has unsynced pictures/videos that I'd like to retrieve.
Connecting it via adb/usb/otherb is not an option of course, since it does
not turn on.
Is there a more intrusive/surgical way to get to the data? I don't mind
soldering that storage out and connecting it to something that can read
it.
Asynchronous Subprocess completion status
Asynchronous Subprocess completion status
I have a Task object which has to undergo several processing. The process
has many sub-processes taking Task from the input queue, process them and
place them in a output queue for the next subprocess. The process has
multiple processing path, and hence multiple exit points. I need some kind
of tracking mechanism to find out, processing of an Task object is
completed. For this, I have added a TaskWatch, which keeps the Task Id and
waits for notification from the exit points. Each exit point, after
completing its process, has to send a notification explicitly. Is there
any way / mechanism / pattern through which each exit point intimates the
TaskWatch about the completion. I am implementing it in Java.
I have a Task object which has to undergo several processing. The process
has many sub-processes taking Task from the input queue, process them and
place them in a output queue for the next subprocess. The process has
multiple processing path, and hence multiple exit points. I need some kind
of tracking mechanism to find out, processing of an Task object is
completed. For this, I have added a TaskWatch, which keeps the Task Id and
waits for notification from the exit points. Each exit point, after
completing its process, has to send a notification explicitly. Is there
any way / mechanism / pattern through which each exit point intimates the
TaskWatch about the completion. I am implementing it in Java.
I want to work Gitlab, But I can not connect in browser
I want to work Gitlab, But I can not connect in browser
I read Document
https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md
https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/databases.md
check
$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
message
Checking Environment ...
Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.7.0 ? ... OK (1.7.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... yes
post-receive hooks in repos are links: ... can't check, you have no projects
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Checking Sidekiq ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.1)
Checking GitLab ... Finished
But
But I can not connect in browser. What is wrong? How to debug?
I read Document
https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md
https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/databases.md
check
$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
message
Checking Environment ...
Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.7.0 ? ... OK (1.7.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... yes
post-receive hooks in repos are links: ... can't check, you have no projects
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Checking Sidekiq ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.1)
Checking GitLab ... Finished
But
But I can not connect in browser. What is wrong? How to debug?
Sunday, 25 August 2013
Drupal prevent unauthorized access
Drupal prevent unauthorized access
How to prevent unauthorized url access in drupal?
I already tried 'access arguments' => array('access administration pages')
but it didn't work
How to prevent unauthorized url access in drupal?
I already tried 'access arguments' => array('access administration pages')
but it didn't work
PHP PDO INSERT query failing
PHP PDO INSERT query failing
So i'm making this project, and one of the INSERT queries I'm using seems
to malfunction. I have other INSERT queries on the same project that do
work, so I'm not really sure what the problem is. This is the query that
malfunctions. Dumping the errors turns up nothing, but no rows are
affected.
$qry3 = $conn->prepare("INSERT INTO usermovie(user,movie) VALUES(:user,
:filmid)");
$qry3->bindParam(':user',$user,PDO::PARAM_STR,16);
$qry3->bindParam(':filmid',$film,PDO::PARAM_INT);
$qry3->execute(); //usermovie, user and movie are the
correct names for the table and columns.
For comparison, this insert query in the same project does work, and
creates a new entry.
$qry2 = $conn->prepare("INSERT INTO users(userid,userpass,email,credits)
VALUES(:username, :password, :email,0)");
$qry2->bindParam(':username', $nusername, PDO::PARAM_STR, 16);
$qry2->bindParam(':password', $npassword, PDO::PARAM_STR, 16);
$qry2->bindParam(':email', $nemail, PDO::PARAM_STR, 16);
$qry2->execute();
So i'm making this project, and one of the INSERT queries I'm using seems
to malfunction. I have other INSERT queries on the same project that do
work, so I'm not really sure what the problem is. This is the query that
malfunctions. Dumping the errors turns up nothing, but no rows are
affected.
$qry3 = $conn->prepare("INSERT INTO usermovie(user,movie) VALUES(:user,
:filmid)");
$qry3->bindParam(':user',$user,PDO::PARAM_STR,16);
$qry3->bindParam(':filmid',$film,PDO::PARAM_INT);
$qry3->execute(); //usermovie, user and movie are the
correct names for the table and columns.
For comparison, this insert query in the same project does work, and
creates a new entry.
$qry2 = $conn->prepare("INSERT INTO users(userid,userpass,email,credits)
VALUES(:username, :password, :email,0)");
$qry2->bindParam(':username', $nusername, PDO::PARAM_STR, 16);
$qry2->bindParam(':password', $npassword, PDO::PARAM_STR, 16);
$qry2->bindParam(':email', $nemail, PDO::PARAM_STR, 16);
$qry2->execute();
yii : $model->save() inserts null values when we I have empty rules
yii : $model->save() inserts null values when we I have empty rules
I don't have any rules for the input fields, (name,place, position) so my
model's rules function returns an empty array, but then empty values are
getting saved into the database table.
public function rules()
{
return array();
}
Also when I omit rules() function from my model
$model->save()
returns true but DB table get inserted with empty values.
so how can I omit rules() function from my model class ?
I don't have any rules for the input fields, (name,place, position) so my
model's rules function returns an empty array, but then empty values are
getting saved into the database table.
public function rules()
{
return array();
}
Also when I omit rules() function from my model
$model->save()
returns true but DB table get inserted with empty values.
so how can I omit rules() function from my model class ?
Saturday, 24 August 2013
Sidekiq "needs X11" in a rails project
Sidekiq "needs X11" in a rails project
I'm trying to use sidekiq in a project but have run into an unusual
problem that makes no sense. I've got multiple rails applications on my
laptop, many of which are using sidekiq, and are running fine without any
problems.
This application also uses sidekiq, and used to work however I'm not
running into a problem. I've not touched the project for a while, but the
only difference between now, and when it used to work is the upgrade from
OS X Lion, to Mountain Lion. This however hasn't effected other projects,
so I'm not sure what's going on. When I try to launch Sidekiq, I get an
alert stating
To open "sidekiq," you need to install X11.
Would you like to install X11 now?
It's the standard Apple alert, however I don't understand why Sidekiq is
supposedly trying to use X11, and why it isn't using it on my other
projects?
I'm using
Rails 3.2.8
Ruby 1.9.3p125
Sidekiq 2.13.1
Any help would be really appreciated :)
I'm trying to use sidekiq in a project but have run into an unusual
problem that makes no sense. I've got multiple rails applications on my
laptop, many of which are using sidekiq, and are running fine without any
problems.
This application also uses sidekiq, and used to work however I'm not
running into a problem. I've not touched the project for a while, but the
only difference between now, and when it used to work is the upgrade from
OS X Lion, to Mountain Lion. This however hasn't effected other projects,
so I'm not sure what's going on. When I try to launch Sidekiq, I get an
alert stating
To open "sidekiq," you need to install X11.
Would you like to install X11 now?
It's the standard Apple alert, however I don't understand why Sidekiq is
supposedly trying to use X11, and why it isn't using it on my other
projects?
I'm using
Rails 3.2.8
Ruby 1.9.3p125
Sidekiq 2.13.1
Any help would be really appreciated :)
how to configure the channels in OMNeT++?
how to configure the channels in OMNeT++?
i would like to know the channel conditions like ping latency, delay and
throughput in omnet++, and also i would like to change them dynamically
during the run time. for first i want to use some data rate and then i
want to use different data rate. how can we configure the channel
conditions?
I would really appreciate if any help you can provide.
i would like to know the channel conditions like ping latency, delay and
throughput in omnet++, and also i would like to change them dynamically
during the run time. for first i want to use some data rate and then i
want to use different data rate. how can we configure the channel
conditions?
I would really appreciate if any help you can provide.
TKIP Encryption not visible
TKIP Encryption not visible
When I want to connecto to my AP whih uses Security type = WPA2 - Personal
Encryption = TKIP There is no field I can enter TKIP encryption, I am
asked only for Name, security type and Security key
When I want to connecto to my AP whih uses Security type = WPA2 - Personal
Encryption = TKIP There is no field I can enter TKIP encryption, I am
asked only for Name, security type and Security key
XSLT mapping help required for the below given format
XSLT mapping help required for the below given format
COMPANY00022639 GeoBeacon COMPANY00022639GeoExplorer 2005 Series
Hi, I need to map each column of every row into two different variables.
Can somebody help me on this.
Thanks in advance.
Regards, Rajesh
COMPANY00022639 GeoBeacon COMPANY00022639GeoExplorer 2005 Series
Hi, I need to map each column of every row into two different variables.
Can somebody help me on this.
Thanks in advance.
Regards, Rajesh
ACPI events not registering
ACPI events not registering
After upgrading to linux-generic-lts-raring, the ACPI events on my laptop
don't seem to firing the associated scripts. For example, closing the lid
does not turn off the screen and suspend the computer (note: both events
are failing to fire). I just discovered that unplugging my laptop didn't
register that the battery was available, even though the battery was
clearly being used (laptop still had power).
The laptop is a Dell Inspiron 14z (not the ultrabook model), and previous
ACPI events worked correctly under kernel 3.2.
After upgrading to linux-generic-lts-raring, the ACPI events on my laptop
don't seem to firing the associated scripts. For example, closing the lid
does not turn off the screen and suspend the computer (note: both events
are failing to fire). I just discovered that unplugging my laptop didn't
register that the battery was available, even though the battery was
clearly being used (laptop still had power).
The laptop is a Dell Inspiron 14z (not the ultrabook model), and previous
ACPI events worked correctly under kernel 3.2.
Returning std::move(f) in std::for_each
Returning std::move(f) in std::for_each
I'm writing an implementation of standard c++ library for study.
The C++11 standard says that for_each returns std::move(f).
template <class InputIterator, class Function>
Function for_each(InputIterator first, InputIterator last, Function f);
Returns: std::move(f).
I thought that function scope local variable is move-constructed when it's
returned. Should I return move(f) explicitly?
I'm writing an implementation of standard c++ library for study.
The C++11 standard says that for_each returns std::move(f).
template <class InputIterator, class Function>
Function for_each(InputIterator first, InputIterator last, Function f);
Returns: std::move(f).
I thought that function scope local variable is move-constructed when it's
returned. Should I return move(f) explicitly?
How can I force "no splines" in GraphViz html-like labels?
How can I force "no splines" in GraphViz html-like labels?
I am interested in making all of the edges in this graph straight.
From what I understand, setting splines to false should do this.
In one case, an edge has no splines, and goes right over the top of
another node.
In the case of the html-like label, splines appear, causing the edge to
look like a large loop.
Is there a way to force "no splines"?
[View output image here.]
Thanks in advance for any help or suggestions!
strict graph G {
splines=false;
"html" [
shape = none
margin = 0
label = <<TABLE>
<TR>
<TD PORT="d">Isend(0)</TD>
</TR>
<TR>
<TD PORT="e">Irecv(1)</TD>
</TR>
</TABLE>>
];
html -- a;
html -- b;
html -- c;
a -- c;
html:d -- html:e;
}
I am interested in making all of the edges in this graph straight.
From what I understand, setting splines to false should do this.
In one case, an edge has no splines, and goes right over the top of
another node.
In the case of the html-like label, splines appear, causing the edge to
look like a large loop.
Is there a way to force "no splines"?
[View output image here.]
Thanks in advance for any help or suggestions!
strict graph G {
splines=false;
"html" [
shape = none
margin = 0
label = <<TABLE>
<TR>
<TD PORT="d">Isend(0)</TD>
</TR>
<TR>
<TD PORT="e">Irecv(1)</TD>
</TR>
</TABLE>>
];
html -- a;
html -- b;
html -- c;
a -- c;
html:d -- html:e;
}
Java Netbeans override paint() function in a JPanel
Java Netbeans override paint() function in a JPanel
Hi I'm a newbie programmer
I want to develop a Java program's GUI using Netbeans IDE
Using Netbeans UI Editor,
First, I create a new JFrame Form
Then, I add a JPanel from the toolbar/palette
Question is,
How can I override the paint() function of the newly created JPanel ?
I want to draw a background and some spheres inside the JPanel,
I tried using getGraphics() function to paint and draw, it does the job,
but it won't draw anymore when I call repaint()
Should I create a new class implementing JPanel, with my custom paint()
function, instead ?
Hi I'm a newbie programmer
I want to develop a Java program's GUI using Netbeans IDE
Using Netbeans UI Editor,
First, I create a new JFrame Form
Then, I add a JPanel from the toolbar/palette
Question is,
How can I override the paint() function of the newly created JPanel ?
I want to draw a background and some spheres inside the JPanel,
I tried using getGraphics() function to paint and draw, it does the job,
but it won't draw anymore when I call repaint()
Should I create a new class implementing JPanel, with my custom paint()
function, instead ?
Friday, 23 August 2013
Protcol Buffers - Python - Issue with tutorial
Protcol Buffers - Python - Issue with tutorial
Context
I'm working through this tutorial:
https://developers.google.com/protocol-buffers/docs/pythontutorial
I've created files by copy and pasting from the above tutorial
Issue
When I run the the file in python launchernothing happens:
Context
I'm working through this tutorial:
https://developers.google.com/protocol-buffers/docs/pythontutorial
I've created files by copy and pasting from the above tutorial
Issue
When I run the the file in python launchernothing happens:
Web-based Node Editing
Web-based Node Editing
http://jsbin.com/OCimonO/1/edit
Sample image of what I'm trying to learn.
There's a few out there for graphics, but I can't find any for scripting.
So I decided to experiment and try and make my own by making a simple
"hello world" to begin with.
I have a hello world hub added and I want to connect it to render via svg
and when connected to generate a callback function placed inside of the
hub, but not when page loads. I got the easy part setup which is designing
the ui, but I'm asking for a little bit of help or guidance to see if
anyone can help/guide me to a solution to my current problem here.
Any help would be greatly appreciated.
http://jsbin.com/OCimonO/1/edit
Sample image of what I'm trying to learn.
There's a few out there for graphics, but I can't find any for scripting.
So I decided to experiment and try and make my own by making a simple
"hello world" to begin with.
I have a hello world hub added and I want to connect it to render via svg
and when connected to generate a callback function placed inside of the
hub, but not when page loads. I got the easy part setup which is designing
the ui, but I'm asking for a little bit of help or guidance to see if
anyone can help/guide me to a solution to my current problem here.
Any help would be greatly appreciated.
Wordpress: Menu item 'forum' disappear when it becomes Current-menu-item
Wordpress: Menu item 'forum' disappear when it becomes Current-menu-item
After a number of updates in Wordpress, one of my menu items (Forum
(Simple:Press) disappears when I choose this page in my menu.
Before the update it works all perfect, and at this moment all my other
menu items are working good as well. So Only the Forum menu item gives
this problem.
By inspecting of elements I saw that the word 'Forum' is missing.
Another menu item (Profiel) f.i. works fine. Profiel
After a number of updates in Wordpress, one of my menu items (Forum
(Simple:Press) disappears when I choose this page in my menu.
Before the update it works all perfect, and at this moment all my other
menu items are working good as well. So Only the Forum menu item gives
this problem.
By inspecting of elements I saw that the word 'Forum' is missing.
Another menu item (Profiel) f.i. works fine. Profiel
Why is port 2121 "closed" when netstat says it is Listening?
Why is port 2121 "closed" when netstat says it is Listening?
I'm running iis 6, and I created two ftp sites. One is running on port 21,
and it works just fine. The other is running on port 2121, and I did all
of the following: 1) I opened port 2121 in my firewall (even turned
firewall off completely). 2) I bound my new ftp site to port 2121, and it
shows that 2121 is bound by it. 3) I ran a elevated cmd prompt and typed
netstat -a and it shows port 2121 is "listening". 4) I browse on the local
system to ftp:// localhost:2121and it goes straight to the FTP server, no
problems.
Yet when I try to go to the ftp server from a computer that is connected
to a different internet provider (aka, my cell phone), it times out trying
to connect. When I go to any port checker website and tell it to test to
see if my port is open, it says "port 2121 is closed" on my site. Huh?
Netstat says it is "listening"?
So I tried also binding port 5999, and that times out too.
My "site" is a hosted VPS server provided by myhosting.com, so I trust
that they wouldn't be blocking any of my ports. That should answer your
questions regarding whether or not I am behind a router that isn't
forwarding the port.
Any help would be appreciated.
I'm running iis 6, and I created two ftp sites. One is running on port 21,
and it works just fine. The other is running on port 2121, and I did all
of the following: 1) I opened port 2121 in my firewall (even turned
firewall off completely). 2) I bound my new ftp site to port 2121, and it
shows that 2121 is bound by it. 3) I ran a elevated cmd prompt and typed
netstat -a and it shows port 2121 is "listening". 4) I browse on the local
system to ftp:// localhost:2121and it goes straight to the FTP server, no
problems.
Yet when I try to go to the ftp server from a computer that is connected
to a different internet provider (aka, my cell phone), it times out trying
to connect. When I go to any port checker website and tell it to test to
see if my port is open, it says "port 2121 is closed" on my site. Huh?
Netstat says it is "listening"?
So I tried also binding port 5999, and that times out too.
My "site" is a hosted VPS server provided by myhosting.com, so I trust
that they wouldn't be blocking any of my ports. That should answer your
questions regarding whether or not I am behind a router that isn't
forwarding the port.
Any help would be appreciated.
Joining master and child with only the row count of child table
Joining master and child with only the row count of child table
Master Table:
CREATE TABLE [dbo].[db_Chat](
[ChatID] [int] IDENTITY(1,1) NOT NULL,
[MemberID] [int] NOT NULL,
[MsgText] [nvarchar](300) COLLATE Chinese_Taiwan_Stroke_CI_AS NOT NULL,
[DateCreated] [smalldatetime] NOT NULL,
CONSTRAINT [PK_db_Chat] PRIMARY KEY CLUSTERED
(
[ChatID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
Child Table:
CREATE TABLE [dbo].[db_Chat_Read](
[ChatReadID] [int] IDENTITY(1,1) NOT NULL,
[MemberID] [int] NOT NULL,
[ChatID] [int] NOT NULL,
[DateCreated] [smalldatetime] NOT NULL,
CONSTRAINT [PK_db_Chat_Read] PRIMARY KEY CLUSTERED
(
[ChatReadID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
I want to join the two tables and show the number of rows of child table,
if there is no row selected then it can show zero.
I know the following code works fine.
select c.ChatID, COUNT(*) as ACount from db_chat c
left join db_Chat_Read r
on c.ChatID = r.ChatID
where c.ChatGroupID=2
GROUP BY c.ChatID
But I need something like this in a single SQL code, the following SQL
code is invalid, but it is to show what result I want: I need full fields
of master table with only Row Count of child table.
select c.*, COUNT(r.*) from db_chat c
left join db_Chat_Read r
on c.ChatID = r.ChatID
where c.ChatGroupID=2
Thank you~!
Master Table:
CREATE TABLE [dbo].[db_Chat](
[ChatID] [int] IDENTITY(1,1) NOT NULL,
[MemberID] [int] NOT NULL,
[MsgText] [nvarchar](300) COLLATE Chinese_Taiwan_Stroke_CI_AS NOT NULL,
[DateCreated] [smalldatetime] NOT NULL,
CONSTRAINT [PK_db_Chat] PRIMARY KEY CLUSTERED
(
[ChatID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
Child Table:
CREATE TABLE [dbo].[db_Chat_Read](
[ChatReadID] [int] IDENTITY(1,1) NOT NULL,
[MemberID] [int] NOT NULL,
[ChatID] [int] NOT NULL,
[DateCreated] [smalldatetime] NOT NULL,
CONSTRAINT [PK_db_Chat_Read] PRIMARY KEY CLUSTERED
(
[ChatReadID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
I want to join the two tables and show the number of rows of child table,
if there is no row selected then it can show zero.
I know the following code works fine.
select c.ChatID, COUNT(*) as ACount from db_chat c
left join db_Chat_Read r
on c.ChatID = r.ChatID
where c.ChatGroupID=2
GROUP BY c.ChatID
But I need something like this in a single SQL code, the following SQL
code is invalid, but it is to show what result I want: I need full fields
of master table with only Row Count of child table.
select c.*, COUNT(r.*) from db_chat c
left join db_Chat_Read r
on c.ChatID = r.ChatID
where c.ChatGroupID=2
Thank you~!
Problems with jQuery mobile and the iPhone3
Problems with jQuery mobile and the iPhone3
The following site http://m.cadresonline.com works without problem on
iPhone4, 5 but but not with the iPhone3, the loading logo shows up and it
freezes whatever the link we click.
jQuery-mobile is supposed to handle this device
(http://jquerymobile.com/gbs/) so I am wondering why it doesn't work.
jQuery mobile version: 1.3.1
The Javascript is loaded with the head.js script
PS: When not using head.js, even the homepage was never loaded at all on
iPhone3.
The following site http://m.cadresonline.com works without problem on
iPhone4, 5 but but not with the iPhone3, the loading logo shows up and it
freezes whatever the link we click.
jQuery-mobile is supposed to handle this device
(http://jquerymobile.com/gbs/) so I am wondering why it doesn't work.
jQuery mobile version: 1.3.1
The Javascript is loaded with the head.js script
PS: When not using head.js, even the homepage was never loaded at all on
iPhone3.
Thursday, 22 August 2013
Google Drive FileList returns empty items
Google Drive FileList returns empty items
I am working on google drive integration.i have done getting api access
key using google console and also done with oauth2 authentication.i
already used google calendar integration and its working fine but when i
integrating drive which want to retrieving file list its return empty.I
don't know what is wrong.following is my code.Thanks in Advanced.
public class RetriveFromDrive extends AsyncTask<Void,Void,Void>
{
List<File> result=new ArrayList<File>();
Files.List request;
@Override
protected Void doInBackground(Void... params) {
try{
// TODO Auto-generated method stub
Log.d("Msg", "Do in Background");
request=gDrive.files().list();
Log.d("Msg", request.toString());
FileList file =request.execute();
result.addAll(file.getItems());
names=new ArrayList<String>();
for (File file1 :result) {
names.add(file1.getTitle());
Log.d("Names", names.toString());
}
}catch(Exception e)
{
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void params) {
// TODO Auto-generated method stub
super.onPostExecute(params);
Log.d("Msg","onPostExecute");
Log.d("Names",names.toString());
}`
I am working on google drive integration.i have done getting api access
key using google console and also done with oauth2 authentication.i
already used google calendar integration and its working fine but when i
integrating drive which want to retrieving file list its return empty.I
don't know what is wrong.following is my code.Thanks in Advanced.
public class RetriveFromDrive extends AsyncTask<Void,Void,Void>
{
List<File> result=new ArrayList<File>();
Files.List request;
@Override
protected Void doInBackground(Void... params) {
try{
// TODO Auto-generated method stub
Log.d("Msg", "Do in Background");
request=gDrive.files().list();
Log.d("Msg", request.toString());
FileList file =request.execute();
result.addAll(file.getItems());
names=new ArrayList<String>();
for (File file1 :result) {
names.add(file1.getTitle());
Log.d("Names", names.toString());
}
}catch(Exception e)
{
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void params) {
// TODO Auto-generated method stub
super.onPostExecute(params);
Log.d("Msg","onPostExecute");
Log.d("Names",names.toString());
}`
Glassfish JDBC: Do I have to use only jdbc/__default?
Glassfish JDBC: Do I have to use only jdbc/__default?
I try to use Glassfish/MySQL. I have created JDBC resource and JDBC
connection pool for MySQL.
But if I tried to put MySQL JDBC resource in , nothing works.
Then if I tried to modify jdbc/__default and change its connection pool
from DerbyPool to MySQL, it works. My entity gets persists to the correct
table.
So do I have to use jdbc/__default only as my JDBC resource for my app?
How can I use the JDBC resource and JDBC connection pool I created in my
app?
I really have hard time understanding how to use JDBC in Glassfish.
This is my first time to ask question in this forum. Thank you very much.
I try to use Glassfish/MySQL. I have created JDBC resource and JDBC
connection pool for MySQL.
But if I tried to put MySQL JDBC resource in , nothing works.
Then if I tried to modify jdbc/__default and change its connection pool
from DerbyPool to MySQL, it works. My entity gets persists to the correct
table.
So do I have to use jdbc/__default only as my JDBC resource for my app?
How can I use the JDBC resource and JDBC connection pool I created in my
app?
I really have hard time understanding how to use JDBC in Glassfish.
This is my first time to ask question in this forum. Thank you very much.
ASP.NET/C# FTP Upload
ASP.NET/C# FTP Upload
I have spent the better part of a day researching this issue (including
numerous Stack Overflow questions, but none have helped.
I have a simple FTP upload utility on an ASP.NET page. Here is the code
behind:
protected void btnUpload_Click(object sender, EventArgs e)
{
BLLSites site = (BLLSites)Session["SelectedSite"];
List<string> allowableExtensions = GetAllowableFileExtensions();
string extension = System.IO.Path.GetExtension(FileUpload.FileName);
bool extensionAllowed = allowableExtensions.Any(x =>
String.Equals(x, extension,
StringComparison.InvariantCultureIgnoreCase));
string folderPath = "ftp://MyPath/MyFolder";
string uploadPath = "ftp://MyPath/MyFolder/MyFile.pdf";
if (extensionAllowed)
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new
Uri(uploadPath));
request.Method = WebRequestMethods.Ftp.UploadFile;
request.UsePassive = false;
request.UseBinary = true;
request.Credentials = new NetworkCredential("UserName",
"Password", "localhost");
request.ContentLength = FileUpload.FileContent.Length;
request.KeepAlive = false;
// Copy the contents of the file to the request stream.
string fullPath = Path.GetFileName(FileUpload.FileName);
//BinaryReader reader = new BinaryReader(FileUpload.FileContent);
byte[] fileContents = new
BinaryReader(FileUpload.FileContent).ReadBytes((int)FileUpload.FileContent.Length);
try
{
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(fileContents, 0,
fileContents.Length);
requestStream.Close();
}
}
catch (Exception ex)
{
...
}
I am developing in Visual Studio 2010 using .NET 4.0. I am uploading to an
Amazon Cloud server that has an FTP site running in IIS. When I run my
application in debug mode and execute the upload function, the file
appears on the Amazon server. The problem occurs when I deploy the code to
the web server (also on the Amazon server). I get the following exception
whether I launch the site directly on the server or through my own web
browser:
The remote server returned an error: (501) Syntax error in parameters or
arguments
The exception occurs during the section of code:
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
}
I have checked all of my permissions on the FTP site, but everything seems
OK. I have tried both PASSIVE and ACTIVE mode. Nothing seems to work. Any
help would be greatly appreciated.
I have spent the better part of a day researching this issue (including
numerous Stack Overflow questions, but none have helped.
I have a simple FTP upload utility on an ASP.NET page. Here is the code
behind:
protected void btnUpload_Click(object sender, EventArgs e)
{
BLLSites site = (BLLSites)Session["SelectedSite"];
List<string> allowableExtensions = GetAllowableFileExtensions();
string extension = System.IO.Path.GetExtension(FileUpload.FileName);
bool extensionAllowed = allowableExtensions.Any(x =>
String.Equals(x, extension,
StringComparison.InvariantCultureIgnoreCase));
string folderPath = "ftp://MyPath/MyFolder";
string uploadPath = "ftp://MyPath/MyFolder/MyFile.pdf";
if (extensionAllowed)
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new
Uri(uploadPath));
request.Method = WebRequestMethods.Ftp.UploadFile;
request.UsePassive = false;
request.UseBinary = true;
request.Credentials = new NetworkCredential("UserName",
"Password", "localhost");
request.ContentLength = FileUpload.FileContent.Length;
request.KeepAlive = false;
// Copy the contents of the file to the request stream.
string fullPath = Path.GetFileName(FileUpload.FileName);
//BinaryReader reader = new BinaryReader(FileUpload.FileContent);
byte[] fileContents = new
BinaryReader(FileUpload.FileContent).ReadBytes((int)FileUpload.FileContent.Length);
try
{
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(fileContents, 0,
fileContents.Length);
requestStream.Close();
}
}
catch (Exception ex)
{
...
}
I am developing in Visual Studio 2010 using .NET 4.0. I am uploading to an
Amazon Cloud server that has an FTP site running in IIS. When I run my
application in debug mode and execute the upload function, the file
appears on the Amazon server. The problem occurs when I deploy the code to
the web server (also on the Amazon server). I get the following exception
whether I launch the site directly on the server or through my own web
browser:
The remote server returned an error: (501) Syntax error in parameters or
arguments
The exception occurs during the section of code:
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
}
I have checked all of my permissions on the FTP site, but everything seems
OK. I have tried both PASSIVE and ACTIVE mode. Nothing seems to work. Any
help would be greatly appreciated.
Each function not working as expected when using custom function
Each function not working as expected when using custom function
Consider this code running on page ready:
$("input.extraOption[checked]").each(function() {
console.log($(this));
$(this).closest('.questionRow').find('.date').attr("disabled", true);
$(this).closest('.questionRow').find('.dateSpan').hide();
$(this).closest('.questionRow').find('.date').val("");
$(this).closest('.questionRow').find('.textareaResize').attr("disabled",
true);
$(this).closest('.questionRow').find('.textareaResize').val("");
$(this).closest('.questionRow').find('.text').attr("disabled", true);
$(this).closest('.questionRow').find('.text').val("");
$(this).closest('.questionRow').find('.checkbox').attr("disabled",
true);
});
I want to refactor these calls as they are used elsewhere as well, so I
created the following function:
jQuery.fn.extend({
toggleAnswers: function (disable) {
var group = $(this);
group.find('.date').attr("disabled", disable);
group.find('.date').val("");
group.find('.textareaResize').attr("disabled", disable);
group.find('.textareaResize').val("");
group.find('.text').attr("disabled", disable);
group.find('.text').val("");
group.find('.checkbox').attr("disabled", disable);
if(checkedStatus === true){
group.find('.dateSpan').hide();
}else{
group.find('.dateSpan').show();
}
return group;
}
});
I then proceed to changing the 8 $(this).closest(...) calls with:
$(this).closest('.questionRow').toggleAnswers(true);
Here's the problem: on a page with 5 elements that match the selector,
only the first one suffers the changes (in other words I only get one
console.log)! Before the refactor I get the expected change in all 5
elements.
What is being done wrong in this refactor?
Consider this code running on page ready:
$("input.extraOption[checked]").each(function() {
console.log($(this));
$(this).closest('.questionRow').find('.date').attr("disabled", true);
$(this).closest('.questionRow').find('.dateSpan').hide();
$(this).closest('.questionRow').find('.date').val("");
$(this).closest('.questionRow').find('.textareaResize').attr("disabled",
true);
$(this).closest('.questionRow').find('.textareaResize').val("");
$(this).closest('.questionRow').find('.text').attr("disabled", true);
$(this).closest('.questionRow').find('.text').val("");
$(this).closest('.questionRow').find('.checkbox').attr("disabled",
true);
});
I want to refactor these calls as they are used elsewhere as well, so I
created the following function:
jQuery.fn.extend({
toggleAnswers: function (disable) {
var group = $(this);
group.find('.date').attr("disabled", disable);
group.find('.date').val("");
group.find('.textareaResize').attr("disabled", disable);
group.find('.textareaResize').val("");
group.find('.text').attr("disabled", disable);
group.find('.text').val("");
group.find('.checkbox').attr("disabled", disable);
if(checkedStatus === true){
group.find('.dateSpan').hide();
}else{
group.find('.dateSpan').show();
}
return group;
}
});
I then proceed to changing the 8 $(this).closest(...) calls with:
$(this).closest('.questionRow').toggleAnswers(true);
Here's the problem: on a page with 5 elements that match the selector,
only the first one suffers the changes (in other words I only get one
console.log)! Before the refactor I get the expected change in all 5
elements.
What is being done wrong in this refactor?
Castle Windsor not supplying NLog component when using ASP.NET MVC filters
Castle Windsor not supplying NLog component when using ASP.NET MVC filters
Registration
container.AddFacility<LoggingFacility>(f =>
f.LogUsing(LoggerImplementation.NLog)
.WithConfig("NLog.config"));
This code is as per this documentation page.
Now this is the code where NLog will be used i.e. Castle Windsor will
supply NLog as the _logger implementation:
public class EmailController : Controller
{
private ILogger _logger = NullLogger.Instance;
...
public ILogger Logger
{
get { return _logger; }
set { _logger = value; }
}
public ActionResult Send(UserMessageModel userMessage, bool
captchaValid, string captchaErrorMessage)
{
if (ModelState.IsValid)
{
try
{
// Do something
}
catch (Exception ex)
{
_logger.Error(string.Format("Error msg:{0}\rError
stacktrace:{1}", ex.Message, ex.StackTrace));
...
}
}
...
}
}
However if I change the code thus:
[CustomHandleError] public class EmailController : Controller {
[CustomHandleError] public ActionResult Send(UserMessageModel userMessage,
bool captchaValid, string captchaErrorMessage) {
if (ModelState.IsValid)
{
// Do something
}
...
}
...
}
public class CustomHandleError: HandleErrorAttribute
{
private ILogger _logger = NullLogger.Instance;
public ILogger Logger
{
get { return _logger; }
set { _logger = value; }
}
public override void OnException(ExceptionContext filterContext)
{
if (filterContext == null)
{
base.OnException(null);
}
_logger.Error(string.Format("Error msg:{0}\rError stacktrace:{1}",
filterContext.Exception.Message,
filterContext.Exception.StackTrace));
if (filterContext.HttpContext.IsCustomErrorEnabled)
{
filterContext.ExceptionHandled = true;
base.OnException(filterContext);
}
}
}
In this case the _logger is "NullLogger.Instance". I thought that the fact
that I had a "Logger" property meant that Castle Windsor would then change
_logger to NLog similar to the previous code.
What could I be misunderstanding?
Registration
container.AddFacility<LoggingFacility>(f =>
f.LogUsing(LoggerImplementation.NLog)
.WithConfig("NLog.config"));
This code is as per this documentation page.
Now this is the code where NLog will be used i.e. Castle Windsor will
supply NLog as the _logger implementation:
public class EmailController : Controller
{
private ILogger _logger = NullLogger.Instance;
...
public ILogger Logger
{
get { return _logger; }
set { _logger = value; }
}
public ActionResult Send(UserMessageModel userMessage, bool
captchaValid, string captchaErrorMessage)
{
if (ModelState.IsValid)
{
try
{
// Do something
}
catch (Exception ex)
{
_logger.Error(string.Format("Error msg:{0}\rError
stacktrace:{1}", ex.Message, ex.StackTrace));
...
}
}
...
}
}
However if I change the code thus:
[CustomHandleError] public class EmailController : Controller {
[CustomHandleError] public ActionResult Send(UserMessageModel userMessage,
bool captchaValid, string captchaErrorMessage) {
if (ModelState.IsValid)
{
// Do something
}
...
}
...
}
public class CustomHandleError: HandleErrorAttribute
{
private ILogger _logger = NullLogger.Instance;
public ILogger Logger
{
get { return _logger; }
set { _logger = value; }
}
public override void OnException(ExceptionContext filterContext)
{
if (filterContext == null)
{
base.OnException(null);
}
_logger.Error(string.Format("Error msg:{0}\rError stacktrace:{1}",
filterContext.Exception.Message,
filterContext.Exception.StackTrace));
if (filterContext.HttpContext.IsCustomErrorEnabled)
{
filterContext.ExceptionHandled = true;
base.OnException(filterContext);
}
}
}
In this case the _logger is "NullLogger.Instance". I thought that the fact
that I had a "Logger" property meant that Castle Windsor would then change
_logger to NLog similar to the previous code.
What could I be misunderstanding?
How to merge multiple data sets and append comments to a new variable
How to merge multiple data sets and append comments to a new variable
I have multiple data sets (hundreds) with time series data like this:
"File name";"18%MC001.TXT";"V 1.24"
"Title comment";"231020124070"
"Trigger Time";"'13-04-05 13:53:51"
"Ch";"A 1- 1";"A 1- 2";"A 1- 3";"A 1- 4";"A 1- 5";"A 1- 6";"A 1- 7";"A 1-
8";"A 1- 9";"A 1-10";"A 1-11";"A 1-12";"A 1-13";"A 1-14";"A 1-15";"A 2-
1";"A 2- 2";"A 2- 4";
"Mode";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";
"Range";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";
"Comment";"Prove1";"Prove1";"Prove2";"Prove2";"Prove3";"Prove3";"Prove4";"Prove4";"Prove5";"Prove5";"Prove6";"Prove6";"Prove7";"Prove7";"Prove8";"Prove8";"Prove9";"Prove9";
"Scaling";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";
"Ratio";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";"
1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";"
1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";"
1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";
"Offset";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";"
0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";"
0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";"
0.00000E+00";" 0.00000E+00";"-3.00000E+00";"-3.00000E+00";
"Time";"1-1[V]";"1-2[V]";"1-3[V]";"1-4[V]";"1-5[V]";"1-6[V]";"1-7[V]";"1-8[V]";"1-9[V]";"1-10[V]";"1-11[V]";"1-12[V]";"1-13[V]";"1-14[V]";"1-15[V]";"2-1[V]";"2-2[V]";"2-4[V]";"Event";
0,000000000E+00; 8,69500E-01; 4,80350E+00; 3,76000E-01; 7,34950E+00;
5,60750E+00; 4,66450E+00; 8,31600E+00; 8,13950E+00; 6,66050E+00;
9,69700E+00; 1,81750E+00; 1,10900E+00; 6,82400E+00; 4,04900E+00;
9,82150E+00; 6,98000E+00; 2,94750E+00; 4,08750E+00;0;
1,000000000E+01; 8,69500E-01; 4,80350E+00; 3,76000E-01; 7,34950E+00;
5,60750E+00; 4,66500E+00; 8,31600E+00; 8,13950E+00; 6,66050E+00;
9,69700E+00; 1,81700E+00; 1,10900E+00; 6,82400E+00; 4,04900E+00;
9,82150E+00; 6,98000E+00; 2,94750E+00; 4,08800E+00;0;
Each data set has a unique datetime value (Trigger Time) that is treated
as a comment. Each data set also has a Time variable indicating the time
that has passed since the datetime in Trigger Time. What I want to do is
calculate the datetime for each observation, so that I can graph the data
as a time series using R Statistics. Is there a way to accomplish this?
Merging the datasets and appending the comments does not necessarily have
to be done in R.
I have successfully imported the data from all files in R Statistics using
the list.files and llply functions, as suggested by Matt Bogard in this
blog post. I think I then need to do something similar to what learnr is
suggesting here, but so far my attempts at extracting Trigger Time and
adding a new variable with Trigger Time for each observation have been
unsuccessful.
Solving the problem with Open Refine causes the program to chrash every
time I try to load all the data sets. R may not be the best tool for
processing text files, but I don't have any experience with Python, Ruby
or similar languages.
I have multiple data sets (hundreds) with time series data like this:
"File name";"18%MC001.TXT";"V 1.24"
"Title comment";"231020124070"
"Trigger Time";"'13-04-05 13:53:51"
"Ch";"A 1- 1";"A 1- 2";"A 1- 3";"A 1- 4";"A 1- 5";"A 1- 6";"A 1- 7";"A 1-
8";"A 1- 9";"A 1-10";"A 1-11";"A 1-12";"A 1-13";"A 1-14";"A 1-15";"A 2-
1";"A 2- 2";"A 2- 4";
"Mode";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";"Voltage";
"Range";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";"10V";
"Comment";"Prove1";"Prove1";"Prove2";"Prove2";"Prove3";"Prove3";"Prove4";"Prove4";"Prove5";"Prove5";"Prove6";"Prove6";"Prove7";"Prove7";"Prove8";"Prove8";"Prove9";"Prove9";
"Scaling";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";"Off";
"Ratio";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";"
1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";"
1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";"
1.00000E+00";" 1.00000E+00";" 1.00000E+00";" 1.00000E+00";
"Offset";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";"
0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";"
0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";" 0.00000E+00";"
0.00000E+00";" 0.00000E+00";"-3.00000E+00";"-3.00000E+00";
"Time";"1-1[V]";"1-2[V]";"1-3[V]";"1-4[V]";"1-5[V]";"1-6[V]";"1-7[V]";"1-8[V]";"1-9[V]";"1-10[V]";"1-11[V]";"1-12[V]";"1-13[V]";"1-14[V]";"1-15[V]";"2-1[V]";"2-2[V]";"2-4[V]";"Event";
0,000000000E+00; 8,69500E-01; 4,80350E+00; 3,76000E-01; 7,34950E+00;
5,60750E+00; 4,66450E+00; 8,31600E+00; 8,13950E+00; 6,66050E+00;
9,69700E+00; 1,81750E+00; 1,10900E+00; 6,82400E+00; 4,04900E+00;
9,82150E+00; 6,98000E+00; 2,94750E+00; 4,08750E+00;0;
1,000000000E+01; 8,69500E-01; 4,80350E+00; 3,76000E-01; 7,34950E+00;
5,60750E+00; 4,66500E+00; 8,31600E+00; 8,13950E+00; 6,66050E+00;
9,69700E+00; 1,81700E+00; 1,10900E+00; 6,82400E+00; 4,04900E+00;
9,82150E+00; 6,98000E+00; 2,94750E+00; 4,08800E+00;0;
Each data set has a unique datetime value (Trigger Time) that is treated
as a comment. Each data set also has a Time variable indicating the time
that has passed since the datetime in Trigger Time. What I want to do is
calculate the datetime for each observation, so that I can graph the data
as a time series using R Statistics. Is there a way to accomplish this?
Merging the datasets and appending the comments does not necessarily have
to be done in R.
I have successfully imported the data from all files in R Statistics using
the list.files and llply functions, as suggested by Matt Bogard in this
blog post. I think I then need to do something similar to what learnr is
suggesting here, but so far my attempts at extracting Trigger Time and
adding a new variable with Trigger Time for each observation have been
unsuccessful.
Solving the problem with Open Refine causes the program to chrash every
time I try to load all the data sets. R may not be the best tool for
processing text files, but I don't have any experience with Python, Ruby
or similar languages.
Wednesday, 21 August 2013
shows different message in windows and linux server
shows different message in windows and linux server
I am using
<a href=" <?=base_url();
?>index.php/admins/candidate/inactive/<?=$list['candidateid']; ?>"
onclick="return confirm('Are you sure you want to inactive this candidate
?');"><img src='/images/inactive.png'> </a>
for the delete/inactivate confirmation message in my project.
When I run in my local system I see below message when I click on
inactivate link.
and when I deploy the application to linux production server, I get below
message. please see below image.
but here in production server, it shows "The page at www.xyz.xom says: ".
Why it is that?
Please help, I want to show only message, not the above "The page at..."
text.
Please suggest the solution.
I am using
<a href=" <?=base_url();
?>index.php/admins/candidate/inactive/<?=$list['candidateid']; ?>"
onclick="return confirm('Are you sure you want to inactive this candidate
?');"><img src='/images/inactive.png'> </a>
for the delete/inactivate confirmation message in my project.
When I run in my local system I see below message when I click on
inactivate link.
and when I deploy the application to linux production server, I get below
message. please see below image.
but here in production server, it shows "The page at www.xyz.xom says: ".
Why it is that?
Please help, I want to show only message, not the above "The page at..."
text.
Please suggest the solution.
GCM not working with app
GCM not working with app
I'm having issues getting GCM working for my app. My webapp is using
django and uses the following app: https://github.com/bogdal/django-gcm
I have the API_KEY set properly, as per instructions on these pages:
http://developer.android.com/google/gcm/index.html
I have the following on my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testapp"
android:launchMode="singleInstance"
android:versionCode="11"
android:versionName="1.2.0">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17"/>
<permission android:name="com.testapp.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- This app has permission to register with GCM and receive message -->
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="com.testapp.permission.C2D_MESSAGE"/>
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/Theme.MyTheme">
<receiver
android:name="com.testapp.pager.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action
android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.testapp"/>
</intent-filter>
</receiver>
<service android:name=".pager.GCMIntentService"
android:enabled="true"/>
<service android:name=".services.TimeService"/>
</application>
</manifest>
Can somebody please point me in the right direction?
I'm having issues getting GCM working for my app. My webapp is using
django and uses the following app: https://github.com/bogdal/django-gcm
I have the API_KEY set properly, as per instructions on these pages:
http://developer.android.com/google/gcm/index.html
I have the following on my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testapp"
android:launchMode="singleInstance"
android:versionCode="11"
android:versionName="1.2.0">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17"/>
<permission android:name="com.testapp.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- This app has permission to register with GCM and receive message -->
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="com.testapp.permission.C2D_MESSAGE"/>
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/Theme.MyTheme">
<receiver
android:name="com.testapp.pager.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action
android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.testapp"/>
</intent-filter>
</receiver>
<service android:name=".pager.GCMIntentService"
android:enabled="true"/>
<service android:name=".services.TimeService"/>
</application>
</manifest>
Can somebody please point me in the right direction?
How to hode a progm, the, reopen on a hotkey C#
How to hode a progm, the, reopen on a hotkey C#
Is there a way to hide a window on close, and then have the window reopen
when you press a hot key?
Is there a way to hide a window on close, and then have the window reopen
when you press a hot key?
C++ Circular Linked List : remove element
C++ Circular Linked List : remove element
I am done with insertion, search in circular linked list but for removal I
am getting compiler errors...
Following is my structure for nodes.
struct node
{
int p_data;
struct node* p_next;
node(node* head, int data)
{
p_next = head;
p_data = data;
}
explicit node(int data)
{
p_next = nullptr;
p_data = data;
}
};
node* remove_circular(node* head, node* target)
{
if (head == target->p_next)
{
delete head;
return nullptr;
}
auto next_pointer = target->p_next;
target->p_data = next_pointer->p_data;
target->p_next = next_pointer->p_next;
delete p_next;
return target;
}
and in main function I call
head = remove_circular(head, head);
head = remove_circular(head, temp);
this is to remove head element and another element that temp points to.
But I am getting errors
Anybody has any idea to remove one element from circular list??
I am done with insertion, search in circular linked list but for removal I
am getting compiler errors...
Following is my structure for nodes.
struct node
{
int p_data;
struct node* p_next;
node(node* head, int data)
{
p_next = head;
p_data = data;
}
explicit node(int data)
{
p_next = nullptr;
p_data = data;
}
};
node* remove_circular(node* head, node* target)
{
if (head == target->p_next)
{
delete head;
return nullptr;
}
auto next_pointer = target->p_next;
target->p_data = next_pointer->p_data;
target->p_next = next_pointer->p_next;
delete p_next;
return target;
}
and in main function I call
head = remove_circular(head, head);
head = remove_circular(head, temp);
this is to remove head element and another element that temp points to.
But I am getting errors
Anybody has any idea to remove one element from circular list??
Data transfer from a view from one database to a table in another database
Data transfer from a view from one database to a table in another database
I am just trying to find out whether this is the right way to do this
task. Any other suggestions to improve this is greatly appreciated.
I have the following on my SSIS package.
Data Flow task and established a OLE DB connection to the source database
where the view is.
Execute SQL task - I am executing a query with a INSERT INTO Destination
Except (all those records that are already there from the source.)
Send mail task is to send out an email.
How to know that the data transfer is successful? So that I can use the
send mail to indicate success or failure.
How to schedule this package so that it runs automatically (Every Tuesday.)
I am just trying to find out whether this is the right way to do this
task. Any other suggestions to improve this is greatly appreciated.
I have the following on my SSIS package.
Data Flow task and established a OLE DB connection to the source database
where the view is.
Execute SQL task - I am executing a query with a INSERT INTO Destination
Except (all those records that are already there from the source.)
Send mail task is to send out an email.
How to know that the data transfer is successful? So that I can use the
send mail to indicate success or failure.
How to schedule this package so that it runs automatically (Every Tuesday.)
C++ passing an object to a function, the operator= is not called
C++ passing an object to a function, the operator= is not called
So here is the code snippet:
class MyClass { public: MyClass(char chIn) { std::cout << "Constructor!"
<< std::endl; }
MyClass & operator= (char chIn) { std::cout << "Assigment operator!" <<
std::endl; } } ;
void Func(MyClass objIn) { return; }
int _tmain(int argc, _TCHAR* argv[]) { Func('T'); system("PAUSE"); return
0; }
In the upper example the constructor of the object is called!!!! Why is
this behavior? Shouldn't the assigment operator be called? Because we're
assigning a value to the function parameter, aren't we?
So here is the code snippet:
class MyClass { public: MyClass(char chIn) { std::cout << "Constructor!"
<< std::endl; }
MyClass & operator= (char chIn) { std::cout << "Assigment operator!" <<
std::endl; } } ;
void Func(MyClass objIn) { return; }
int _tmain(int argc, _TCHAR* argv[]) { Func('T'); system("PAUSE"); return
0; }
In the upper example the constructor of the object is called!!!! Why is
this behavior? Shouldn't the assigment operator be called? Because we're
assigning a value to the function parameter, aren't we?
How to Implement Free Language Converter tool on the Website?
How to Implement Free Language Converter tool on the Website?
I Just Want to know that How to use any free language converter tool on
the website? If we talk about tool provided by google then really it is
free tool and can be implemented on each and every website? Plz Suggest.
Thanks Sandeep
I Just Want to know that How to use any free language converter tool on
the website? If we talk about tool provided by google then really it is
free tool and can be implemented on each and every website? Plz Suggest.
Thanks Sandeep
Tuesday, 20 August 2013
How to get the value at a special position of a set that create the hashmap
How to get the value at a special position of a set that create the hashmap
I am currently confuse and get stuck at the logic of the code. Go from the
beginning to the end, I run to a point that a condition happens and I want
to track back and get the text at that position, but I do not know how to
go inverse way to get it. I also give example of output to the comment,
which text should be extract and where it should be printed. Here is the
code:
public <ANNOTATION_TYPE, SPAN_TYPE> void add(
Collection<? extends ANNOTATION_TYPE> referenceAnnotations,
Collection<? extends ANNOTATION_TYPE> predictedAnnotations,
Function<ANNOTATION_TYPE, SPAN_TYPE> annotationToSpan) throws IOException {
// map gold spans to their outcomes
Map<SPAN_TYPE, String> referenceSpanOutcomes = new HashMap<SPAN_TYPE,
String>();
for (ANNOTATION_TYPE ann : referenceAnnotations) {
NamedEntityMention nm = (NamedEntityMention) ann;
NamedEntity ne = nm.getMentionedEntity();
String text= nm.getCoveredText(); // Here is the 1st text that should be
extract, but only at the place when the "else" condition is satisfied
String out = ne.getEntityType();
referenceSpanOutcomes.put(annotationToSpan.apply(ann), out);
}
// map system spans to their outcomes
Map<SPAN_TYPE, String> predictedSpanOutcomes = new HashMap<SPAN_TYPE,
String>();
for (ANNOTATION_TYPE ann : predictedAnnotations) {
String out = getFeature((Annotation)ann, "mentionType");
predictedSpanOutcomes.put(annotationToSpan.apply(ann), out);
NamedEntityMention nm2 = (NamedEntityMention) ann;
NamedEntity ne2 = nm2.getMentionedEntity();
String text2= nm2.getCoveredText(); // Here is the 2nd text that
should be extract, but only at the place when the "else" condition is
satisfied
}
// update the gold and system outcomes
this.referenceOutcomes.addAll(referenceSpanOutcomes.values());//output
[GPE x 38, PER x 313, FAC, VEH, LOC x 10, ORG x 48]
this.predictedOutcomes.addAll(predictedSpanOutcomes.values());//output
[GPE x 30, PER x 264, FAC x 6, WEA x 2, VEH, LOC x 9, ORG x 25]
// determine the outcomes that were correct
Set<SPAN_TYPE> intersection = new HashSet<SPAN_TYPE>();
intersection.addAll(referenceSpanOutcomes.keySet()); //output
[Span{begin=1785, end=1789}, Span{begin=2974, end=2976}, Span{begin=2559,
end=2569}, Span{begin=1381, end=1384}, Span{begin=2518, end=2531},etc.
intersection.retainAll(predictedSpanOutcomes.keySet());//output get all
same of two set: referenceSpanOutcomes.keySet and
predictedSpanOutcomes.keySet
for (SPAN_TYPE span : intersection) {
String goldOutcome = referenceSpanOutcomes.get(span);
//output goldOutcome: PER, FAC, LOC, ORG, GPE,
String systemOutcome = predictedSpanOutcomes.get(span);
//output systemOutcome: PER, FAC, LOC, ORG, GPE,
if (Objects.equal(goldOutcome, systemOutcome)) {
this.correctOutcomes.add(goldOutcome);
} //end if
else //here is where I want to get the 1st and 2nd text
{
//Print the 1st and 2nd text here to file !
}
}
}
What I think of is may be we also "put" that text/text2 to a List or
something so that it could have the same structure with the
referenceSpanOutcomes/predictedSpanOutcomes then later we just track back
at the same postion where the "else" condition happen. But how should it
be done ?
I am currently confuse and get stuck at the logic of the code. Go from the
beginning to the end, I run to a point that a condition happens and I want
to track back and get the text at that position, but I do not know how to
go inverse way to get it. I also give example of output to the comment,
which text should be extract and where it should be printed. Here is the
code:
public <ANNOTATION_TYPE, SPAN_TYPE> void add(
Collection<? extends ANNOTATION_TYPE> referenceAnnotations,
Collection<? extends ANNOTATION_TYPE> predictedAnnotations,
Function<ANNOTATION_TYPE, SPAN_TYPE> annotationToSpan) throws IOException {
// map gold spans to their outcomes
Map<SPAN_TYPE, String> referenceSpanOutcomes = new HashMap<SPAN_TYPE,
String>();
for (ANNOTATION_TYPE ann : referenceAnnotations) {
NamedEntityMention nm = (NamedEntityMention) ann;
NamedEntity ne = nm.getMentionedEntity();
String text= nm.getCoveredText(); // Here is the 1st text that should be
extract, but only at the place when the "else" condition is satisfied
String out = ne.getEntityType();
referenceSpanOutcomes.put(annotationToSpan.apply(ann), out);
}
// map system spans to their outcomes
Map<SPAN_TYPE, String> predictedSpanOutcomes = new HashMap<SPAN_TYPE,
String>();
for (ANNOTATION_TYPE ann : predictedAnnotations) {
String out = getFeature((Annotation)ann, "mentionType");
predictedSpanOutcomes.put(annotationToSpan.apply(ann), out);
NamedEntityMention nm2 = (NamedEntityMention) ann;
NamedEntity ne2 = nm2.getMentionedEntity();
String text2= nm2.getCoveredText(); // Here is the 2nd text that
should be extract, but only at the place when the "else" condition is
satisfied
}
// update the gold and system outcomes
this.referenceOutcomes.addAll(referenceSpanOutcomes.values());//output
[GPE x 38, PER x 313, FAC, VEH, LOC x 10, ORG x 48]
this.predictedOutcomes.addAll(predictedSpanOutcomes.values());//output
[GPE x 30, PER x 264, FAC x 6, WEA x 2, VEH, LOC x 9, ORG x 25]
// determine the outcomes that were correct
Set<SPAN_TYPE> intersection = new HashSet<SPAN_TYPE>();
intersection.addAll(referenceSpanOutcomes.keySet()); //output
[Span{begin=1785, end=1789}, Span{begin=2974, end=2976}, Span{begin=2559,
end=2569}, Span{begin=1381, end=1384}, Span{begin=2518, end=2531},etc.
intersection.retainAll(predictedSpanOutcomes.keySet());//output get all
same of two set: referenceSpanOutcomes.keySet and
predictedSpanOutcomes.keySet
for (SPAN_TYPE span : intersection) {
String goldOutcome = referenceSpanOutcomes.get(span);
//output goldOutcome: PER, FAC, LOC, ORG, GPE,
String systemOutcome = predictedSpanOutcomes.get(span);
//output systemOutcome: PER, FAC, LOC, ORG, GPE,
if (Objects.equal(goldOutcome, systemOutcome)) {
this.correctOutcomes.add(goldOutcome);
} //end if
else //here is where I want to get the 1st and 2nd text
{
//Print the 1st and 2nd text here to file !
}
}
}
What I think of is may be we also "put" that text/text2 to a List or
something so that it could have the same structure with the
referenceSpanOutcomes/predictedSpanOutcomes then later we just track back
at the same postion where the "else" condition happen. But how should it
be done ?
Placing random numbers in a grid
Placing random numbers in a grid
I need to place numbers within a grid such that it doesn't collide with
each other. This number placement should be random and can be horizontal
or vertical. The numbers basically indicate the locations of the ships. So
the points for the ships should be together and need to be random and
should not collide.
I have tried it:
int main()
{
srand(time(NULL));
int Grid[64];
int battleShips;
bool battleShipFilled;
for(int i = 0; i < 64; i++)
Grid[i]=0;
for(int i = 1; i <= 5; i++)
{
battleShips = 1;
while(battleShips != 5)
{
int horizontal = rand()%2;
if(horizontal == 0)
{
battleShipFilled = false;
while(!battleShipFilled)
{
int row = rand()%8;
int column = rand()%8;
while(Grid[(row)*8+(column)] == 1)
{
row = rand()%8;
column = rand()%8;
}
int j = 0;
if(i == 1) j= (i+1);
else j= i;
for(int k = -j/2; k <= j/2; k++)
{
int numberOfCorrectLocation = 0;
while(numberOfCorrectLocation != j)
{
if(row+k> 0 && row+k<8)
{
if(Grid[(row+k)*8+(column)] == 1) break;
numberOfCorrectLocation++;
}
}
if(numberOfCorrectLocation !=i) break;
}
for(int k = -j/2; k <= j/2; k++)
Grid[(row+k)*8+(column)] = 1;
battleShipFilled = true;
}
battleShips++;
}
else
{
battleShipFilled = false;
while(!battleShipFilled)
{
int row = rand()%8;
int column = rand()%8;
while(Grid[(row)*8+(column)] == 1)
{
row = rand()%8;
column = rand()%8;
}
int j = 0;
if(i == 1) j= (i+1);
else j= i;
for(int k = -j/2; k <= j/2; k++)
{
int numberOfCorrectLocation = 0;
while(numberOfCorrectLocation != i)
{
if(row+k> 0 && row+k<8)
{
if(Grid[(row)*8+(column+k)] == 1) break;
numberOfCorrectLocation++;
}
}
if(numberOfCorrectLocation !=i) break;
}
for(int k = -j/2; k <= j/2; k++)
Grid[(row)*8+(column+k)] = 1;
battleShipFilled = true;
}
battleShips++;
}
}
}
}
But the code i have written is not able to generate the numbers randomly
in the 8x8 grid.
Need some guidance on how to solve this. If there is any better way of
doing it, please tell me...
I need to place numbers within a grid such that it doesn't collide with
each other. This number placement should be random and can be horizontal
or vertical. The numbers basically indicate the locations of the ships. So
the points for the ships should be together and need to be random and
should not collide.
I have tried it:
int main()
{
srand(time(NULL));
int Grid[64];
int battleShips;
bool battleShipFilled;
for(int i = 0; i < 64; i++)
Grid[i]=0;
for(int i = 1; i <= 5; i++)
{
battleShips = 1;
while(battleShips != 5)
{
int horizontal = rand()%2;
if(horizontal == 0)
{
battleShipFilled = false;
while(!battleShipFilled)
{
int row = rand()%8;
int column = rand()%8;
while(Grid[(row)*8+(column)] == 1)
{
row = rand()%8;
column = rand()%8;
}
int j = 0;
if(i == 1) j= (i+1);
else j= i;
for(int k = -j/2; k <= j/2; k++)
{
int numberOfCorrectLocation = 0;
while(numberOfCorrectLocation != j)
{
if(row+k> 0 && row+k<8)
{
if(Grid[(row+k)*8+(column)] == 1) break;
numberOfCorrectLocation++;
}
}
if(numberOfCorrectLocation !=i) break;
}
for(int k = -j/2; k <= j/2; k++)
Grid[(row+k)*8+(column)] = 1;
battleShipFilled = true;
}
battleShips++;
}
else
{
battleShipFilled = false;
while(!battleShipFilled)
{
int row = rand()%8;
int column = rand()%8;
while(Grid[(row)*8+(column)] == 1)
{
row = rand()%8;
column = rand()%8;
}
int j = 0;
if(i == 1) j= (i+1);
else j= i;
for(int k = -j/2; k <= j/2; k++)
{
int numberOfCorrectLocation = 0;
while(numberOfCorrectLocation != i)
{
if(row+k> 0 && row+k<8)
{
if(Grid[(row)*8+(column+k)] == 1) break;
numberOfCorrectLocation++;
}
}
if(numberOfCorrectLocation !=i) break;
}
for(int k = -j/2; k <= j/2; k++)
Grid[(row)*8+(column+k)] = 1;
battleShipFilled = true;
}
battleShips++;
}
}
}
}
But the code i have written is not able to generate the numbers randomly
in the 8x8 grid.
Need some guidance on how to solve this. If there is any better way of
doing it, please tell me...
@Template symfony2 500 internal server error
@Template symfony2 500 internal server error
Hello i have used this
http://www.lucas.courot.com/how-to-create-a-contact-form-using-symfony2.html
tutorial for a contact form and in my wamp machine i make everything work
okay. Now i uploaded the site to nginx server configured and the site is
working okay except the contact page. httt://intelmarketing.es when i try
to click to contact it gets the
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please e-mail us at [email] and let us know what you
were doing when this error occurred. We will fix it as soon as possible.
Sorry for any inconvenience caused.
and i think is something with the @template path that i'm using it
here is the code that is working on wamp server but i don't know whats is
wrong when it goes online..
<?php
namespace Aleksandar\IntelMarketingBundle\Controller;
use Aleksandar\IntelMarketingBundle\Form\Type\ContactType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @Route("/contact", _name="contact")
* @Template("AleksandarIntelMarketingBundle::contact.html.php")
*/
public function contactAction(Request $request)
{
$form = $this->createForm(new ContactType());
if ($request->isMethod('POST')) {
$form->bind($request);
if ($form->isValid()) {
$message = \Swift_Message::newInstance()
->setSubject($form->get('subject')->getData())
->setFrom($form->get('email')->getData())
->setTo('aleksandar@intelmarketing.es')
->setBody(
$this->renderView(
'AleksandarIntelMarketingBundle:Mail:contact.html.php',
array(
'ip' => $request->getClientIp(),
'name' => $form->get('name')->getData(),
'message' => $form->get('message')->getData()
)
)
);
$this->get('mailer')->send($message);
$request->getSession()->getFlashBag()->add('success', 'Your
email has been sent! Thanks!');
return
$this->redirect($this->generateUrl('aleksandar_intel_marketing_contactpage'));
}
}
return array(
'form' => $form->createView()
);
}
}
Hello i have used this
http://www.lucas.courot.com/how-to-create-a-contact-form-using-symfony2.html
tutorial for a contact form and in my wamp machine i make everything work
okay. Now i uploaded the site to nginx server configured and the site is
working okay except the contact page. httt://intelmarketing.es when i try
to click to contact it gets the
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please e-mail us at [email] and let us know what you
were doing when this error occurred. We will fix it as soon as possible.
Sorry for any inconvenience caused.
and i think is something with the @template path that i'm using it
here is the code that is working on wamp server but i don't know whats is
wrong when it goes online..
<?php
namespace Aleksandar\IntelMarketingBundle\Controller;
use Aleksandar\IntelMarketingBundle\Form\Type\ContactType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @Route("/contact", _name="contact")
* @Template("AleksandarIntelMarketingBundle::contact.html.php")
*/
public function contactAction(Request $request)
{
$form = $this->createForm(new ContactType());
if ($request->isMethod('POST')) {
$form->bind($request);
if ($form->isValid()) {
$message = \Swift_Message::newInstance()
->setSubject($form->get('subject')->getData())
->setFrom($form->get('email')->getData())
->setTo('aleksandar@intelmarketing.es')
->setBody(
$this->renderView(
'AleksandarIntelMarketingBundle:Mail:contact.html.php',
array(
'ip' => $request->getClientIp(),
'name' => $form->get('name')->getData(),
'message' => $form->get('message')->getData()
)
)
);
$this->get('mailer')->send($message);
$request->getSession()->getFlashBag()->add('success', 'Your
email has been sent! Thanks!');
return
$this->redirect($this->generateUrl('aleksandar_intel_marketing_contactpage'));
}
}
return array(
'form' => $form->createView()
);
}
}
Derivation of the trapezoidal rule
Derivation of the trapezoidal rule
I am a student in High school learning Math HL (International
Baccalaureate) and I need a derivation of the trapezoidal rule based on
numerical integration.
P.S trapezoidal rule and composite trapezoidal rule are 2 different
methods. I only want some regarding trapezoidal rule.
thank you.
I am a student in High school learning Math HL (International
Baccalaureate) and I need a derivation of the trapezoidal rule based on
numerical integration.
P.S trapezoidal rule and composite trapezoidal rule are 2 different
methods. I only want some regarding trapezoidal rule.
thank you.
Ruby FileUtils.mv invalid multibyte character
Ruby FileUtils.mv invalid multibyte character
I'm use FileUtils.mv to move folder like this:
FileUtils.mv("/home/sean/_site/", "/home/sean/projects/_site/")
but that not working, because the _site folder contains the following files:
?????ʼ???????????????
????fedora????ʱ??ʾcannot-open-font-file-true?İ취
?˿?????firefox????????
?ȸ?gaeӦ???̵?
??ǧ??ǧѰ???ⲿ??Ʒ???ɹ??ĵط?
but when I use system command then everything is ok, like this:
mv /home/sean/_site /home/sean/projects/_site
My system is ubuntu 12.04 LTS server, ruby is 2.0.0p195.
I'm use FileUtils.mv to move folder like this:
FileUtils.mv("/home/sean/_site/", "/home/sean/projects/_site/")
but that not working, because the _site folder contains the following files:
?????ʼ???????????????
????fedora????ʱ??ʾcannot-open-font-file-true?İ취
?˿?????firefox????????
?ȸ?gaeӦ???̵?
??ǧ??ǧѰ???ⲿ??Ʒ???ɹ??ĵط?
but when I use system command then everything is ok, like this:
mv /home/sean/_site /home/sean/projects/_site
My system is ubuntu 12.04 LTS server, ruby is 2.0.0p195.
JavaFx Application crashes on Exit
JavaFx Application crashes on Exit
I have an Problem with my Java Fx Application. On exit it crashes with the
following error:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000709a1e90,
pid=712, tid=8400
#
# JRE version: 7.0_25-b17
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode
windows-amd64 compressed oops)
# Problematic frame:
# C 0x00000000709a1e90[thread 7596 also had an error]
#
# Failed to write core dump. Minidumps are not enabled by default on
client versions of Windows
#
# An error report file with more information is saved as:
# C:\workspaces\hs_err_pid712.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
The logfile includes this:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000709a1e90,
pid=712, tid=8400
#
# JRE version: 7.0_25-b17
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode
windows-amd64 compressed oops)
# Problematic frame:
# C 0x00000000709a1e90
#
# Failed to write core dump. Minidumps are not enabled by default on
client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x000000001fdf7000): JavaThread "QuantumRenderer-0"
daemon [_thread_in_native, id=8400,
stack(0x0000000023b10000,0x0000000023c10000)]
siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008
0x00000000709a1e90
Registers:
RAX=0x00000000709a1e90, RBX=0x00000006e5ed7640, RCX=0x000000001fdf71d8,
RDX=0x0000000023c0ee40
RSP=0x0000000023c0edb8, RBP=0x0000000023c0ee30, RSI=0x0000000000000007,
RDI=0x0000000003d5bbd4
R8 =0x0000000000010001, R9 =0x00000000000000cb, R10=0x000000000270237c,
R11=0x0000000069a89860
R12=0x0000000000000000, R13=0x00000006e5ed7640, R14=0x0000000023c0ee58,
R15=0x000000001fdf7000
RIP=0x00000000709a1e90, EFLAGS=0x0000000000010206
Top of Stack: (sp=0x0000000023c0edb8)
0x0000000023c0edb8: 00000000027023a8 000000001220e4a0
0x0000000023c0edc8: 0000000014402460 0000000200004019
0x0000000023c0edd8: 0000000c00000078 00000006e66cf190
0x0000000023c0ede8: 0000000000000000 0000000023c0edf0
0x0000000023c0edf8: 0000000000000000 0000000023c0ee58
0x0000000023c0ee08: 00000006e5eda738 0000000000000000
0x0000000023c0ee18: 00000006e5ed7640 0000000000000000
0x0000000023c0ee28: 0000000023c0ee50 0000000023c0eea0
0x0000000023c0ee38: 00000000026f6374 0000000703fff258
0x0000000023c0ee48: 00000000026ff1d6 0000000000010001
0x0000000023c0ee58: 0000000703f66780 0000000023c0ee60
0x0000000023c0ee68: 00000006e5ed80dc 0000000023c0eeb8
0x0000000023c0ee78: 00000006e5eda738 0000000000000000
0x0000000023c0ee88: 00000006e5ed80f0 0000000023c0ee50
0x0000000023c0ee98: 0000000023c0eeb0 0000000023c0ef10
0x0000000023c0eea8: 00000000026f63d3 0000000703f66780
Instructions: (pc=0x00000000709a1e90)
0x00000000709a1e70:
[error occurred during error reporting (printing registers, top of stack,
instructions near pc), id 0xc0000005]
Register to memory mapping:
RAX=0x00000000709a1e90 is an unknown value
RBX=0x00000006e5ed7640 is an oop
{method}
- klass: {other class}
RCX=0x000000001fdf71d8 is an unknown value
RDX=0x0000000023c0ee40 is pointing into the stack for thread:
0x000000001fdf7000
RSP=0x0000000023c0edb8 is pointing into the stack for thread:
0x000000001fdf7000
RBP=0x0000000023c0ee30 is pointing into the stack for thread:
0x000000001fdf7000
RSI=0x0000000000000007 is an unknown value
RDI=0x0000000003d5bbd4 is an unknown value
R8 =0x0000000000010001 is an unknown value
R9 =0x00000000000000cb is an unknown value
R10=0x000000000270237c is an Interpreter codelet
method entry point (kind = native) [0x0000000002702100,
0x0000000002702980] 2176 bytes
R11=0x0000000069a89860 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x00000006e5ed7640 is an oop
{method}
- klass: {other class}
R14=0x0000000023c0ee58 is pointing into the stack for thread:
0x000000001fdf7000
R15=0x000000001fdf7000 is a thread
Stack: [0x0000000023b10000,0x0000000023c10000], sp=0x0000000023c0edb8,
free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native
code)
C 0x00000000709a1e90
j
com.sun.prism.d3d.D3DPipeline.getResourceFactory(Lcom/sun/glass/ui/Screen;)Lcom/sun/prism/ResourceFactory;+4
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer.dispose()V+64
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer$1.factoryReleased()V+4
j com.sun.prism.impl.BaseResourceFactory.notifyReleased()V+41
j com.sun.prism.d3d.D3DResourceFactory.notifyReleased()V+42
j com.sun.prism.d3d.D3DPipeline.notifyAllResourcesReleased()V+23
j com.sun.prism.d3d.D3DPipeline.dispose()V+26
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.cleanup()V+9
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+14
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
V [jvm.dll+0x1a6844]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.sun.prism.d3d.D3DPipeline.nGetAdapterOrdinal(J)I+0
j
com.sun.prism.d3d.D3DPipeline.getResourceFactory(Lcom/sun/glass/ui/Screen;)Lcom/sun/prism/ResourceFactory;+4
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer.dispose()V+64
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer$1.factoryReleased()V+4
j com.sun.prism.impl.BaseResourceFactory.notifyReleased()V+41
j com.sun.prism.d3d.D3DResourceFactory.notifyReleased()V+42
j com.sun.prism.d3d.D3DPipeline.notifyAllResourcesReleased()V+23
j com.sun.prism.d3d.D3DPipeline.dispose()V+26
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.cleanup()V+9
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+14
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x000000001fdfb800 JavaThread "AWT-EventQueue-0" [_thread_blocked,
id=8240, stack(0x0000000023030000,0x0000000023130000)]
0x000000001fdfa800 JavaThread "AWT-Shutdown" [_thread_blocked, id=8496,
stack(0x0000000024f80000,0x0000000025080000)]
0x000000001402b000 JavaThread "Thread-105" daemon [_thread_in_native,
id=8732, stack(0x0000000025390000,0x0000000025490000)]
0x000000001402c000 JavaThread "JFXMedia Player EventQueueThread" daemon
[_thread_blocked, id=8640, stack(0x0000000025150000,0x0000000025250000)]
0x0000000014028000 JavaThread "Thread-48" daemon [_thread_in_native,
id=8420, stack(0x0000000028bb0000,0x0000000028cb0000)]
0x0000000014027800 JavaThread "JFXMedia Player EventQueueThread" daemon
[_thread_blocked, id=7312, stack(0x0000000028ec0000,0x0000000028fc0000)]
0x0000000014026800 JavaThread "Media Resource Disposer" daemon
[_thread_blocked, id=5648, stack(0x0000000024ce0000,0x0000000024de0000)]
0x000000001fdfa000 JavaThread "Prism Font Disposer" daemon
[_thread_blocked, id=9160, stack(0x0000000022d50000,0x0000000022e50000)]
0x000000001fdf9000 JavaThread "Thread-12" daemon [_thread_in_native,
id=7596, stack(0x0000000024a10000,0x0000000024b10000)]
0x000000001fdf8800 JavaThread "JavaFX Application Thread"
[_thread_in_native, id=9140,
stack(0x0000000023dd0000,0x0000000023ed0000)]
0x000000001fdf7800 JavaThread "Disposer" daemon [_thread_blocked,
id=8796, stack(0x0000000024e30000,0x0000000024f30000)]
=>0x000000001fdf7000 JavaThread "QuantumRenderer-0" daemon
[_thread_in_native, id=8400, stack(0x0000000023b10000,0x0000000023c10000)]
0x00000000140bc800 JavaThread "Thread-8" daemon [_thread_in_native,
id=7224, stack(0x000000001b820000,0x000000001b920000)]
0x0000000014765800 JavaThread "HouseKeeper" daemon [_thread_blocked,
id=8596, stack(0x000000001d3c0000,0x000000001d4c0000)]
0x00000000145b3000 JavaThread "TimerQueue" daemon [_thread_blocked,
id=3540, stack(0x000000001c8c0000,0x000000001c9c0000)]
0x00000000143e7000 JavaThread "Java2D Disposer" daemon [_thread_blocked,
id=5544, stack(0x0000000014c60000,0x0000000014d60000)]
0x000000001222a000 JavaThread "Service Thread" daemon [_thread_blocked,
id=8252, stack(0x0000000013af0000,0x0000000013bf0000)]
0x0000000012227000 JavaThread "C2 CompilerThread1" daemon
[_thread_blocked, id=8684, stack(0x00000000139c0000,0x0000000013ac0000)]
0x0000000012213000 JavaThread "C2 CompilerThread0" daemon
[_thread_blocked, id=7272, stack(0x0000000013830000,0x0000000013930000)]
0x0000000012212000 JavaThread "Attach Listener" daemon [_thread_blocked,
id=8772, stack(0x0000000013670000,0x0000000013770000)]
0x000000001220a800 JavaThread "Signal Dispatcher" daemon
[_thread_blocked, id=6900, stack(0x00000000134b0000,0x00000000135b0000)]
0x000000000228e800 JavaThread "Finalizer" daemon [_thread_blocked,
id=8352, stack(0x0000000013370000,0x0000000013470000)]
0x0000000002287800 JavaThread "Reference Handler" daemon
[_thread_blocked, id=9208, stack(0x0000000013200000,0x0000000013300000)]
0x00000000001ae800 JavaThread "main" [_thread_blocked, id=8356,
stack(0x00000000025f0000,0x00000000026f0000)]
Other Threads:
0x0000000012183000 VMThread [stack:
0x0000000013090000,0x0000000013190000] [id=8520]
0x0000000013c00800 WatcherThread [stack:
0x0000000012f50000,0x0000000013050000] [id=792]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
PSYoungGen total 323456K, used 116276K [0x00000007aaeb0000,
0x00000007d0d60000, 0x0000000800000000)
eden space 321152K, 36% used
[0x00000007aaeb0000,0x00000007b203d170,0x00000007be850000)
from space 2304K, 0% used
[0x00000007ce420000,0x00000007ce420000,0x00000007ce660000)
to space 21888K, 0% used
[0x00000007cf800000,0x00000007cf800000,0x00000007d0d60000)
ParOldGen total 174208K, used 58619K [0x0000000700c00000,
0x000000070b620000, 0x00000007aaeb0000)
object space 174208K, 33% used
[0x0000000700c00000,0x000000070453ef98,0x000000070b620000)
PSPermGen total 217280K, used 97403K [0x00000006e0c00000,
0x00000006ee030000, 0x0000000700c00000)
object space 217280K, 44% used
[0x00000006e0c00000,0x00000006e6b1ee00,0x00000006ee030000)
Card table byte_map: [0x00000000056f0000,0x0000000005ff0000]
byte_map_base: 0x0000000001fea000
Polling page: 0x0000000000140000
Code Cache [0x00000000026f0000, 0x0000000002cd0000, 0x00000000056f0000)
total_blobs=2619 nmethods=1494 adapters=1075 free_code_cache=43416Kb
largest_free_block=44218368
Compilation events (10 events):
Event: 207.573 Thread 0x0000000012213000 1646
javax.swing.text.AbstractDocument$LeafElement::getEndOffset (10 bytes)
Event: 207.574 Thread 0x0000000012213000 nmethod 1646 0x0000000002aa5c10
code [0x0000000002aa5d60, 0x0000000002aa5e38]
Event: 207.579 Thread 0x0000000012227000 1647
javax.swing.text.html.StyleSheet$ViewAttributeSet::getAttribute (61 bytes)
Event: 207.581 Thread 0x0000000012227000 nmethod 1647 0x00000000029e68d0
code [0x00000000029e6a60, 0x00000000029e6c30]
Event: 207.593 Thread 0x0000000012213000 1648
javax.swing.text.LabelView::sync (12 bytes)
Event: 207.594 Thread 0x0000000012213000 nmethod 1648 0x00000000029e65d0
code [0x00000000029e6720, 0x00000000029e67f8]
Event: 208.679 Thread 0x0000000012227000 1649
oracle.jdbc.driver.T4CMAREngine::unmarshalSB4 (8 bytes)
Event: 208.679 Thread 0x0000000012213000 1650
oracle.jdbc.driver.T4CMAREngine::unmarshalDALC (53 bytes)
Event: 208.679 Thread 0x0000000012227000 nmethod 1649 0x0000000002aa4d90
code [0x0000000002aa4ee0, 0x0000000002aa4f68]
Event: 208.681 Thread 0x0000000012213000 nmethod 1650 0x0000000002aa4690
code [0x0000000002aa4800, 0x0000000002aa4a98]
VM Arguments:
jvm_args: -XX:MaxPermSize=512m -Dfile.encoding=Cp1252
java_command:
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Java\jdk1.6.0_20_64bit
PATH=C:\oracle\product\11.2.0\dbhome_1\bin;C:\Program Files
(x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program
Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD
APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program
Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth
Software\syswow64;c:\dev\Apache Software
Foundation\apache-maven-2.0.9\bin;c:\dev\Apache Software
Foundation\apache-ant-1.8.1\bin
USERNAME=af7711
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 7 , 64 bit Build 7601 Service Pack 1
CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58
stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2,
popcnt, avx, ht, tsc, tscinvbit, tscinv
Memory: 4k page, physical 16723516k(8101396k free), swap
33445172k(23323688k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (23.25-b01) for windows-amd64
JRE (1.7.0_25-b17), built on Jun 21 2013 12:58:32 by "java_re" with
unknown MS VC++:1600
time: Tue Aug 20 08:29:31 2013
elapsed time: 208 seconds
The source for starting the FX-Application an handling the exit and close
events looks like this:
private final Semaphore sem = new Semaphore(0);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new JFXPanel(); // initializes JavaFX environment
Platform.runLater(new Runnable() {
@Override
public void run() {
Stage stage = new Stage();
stage.setTitle(moduleInfo.getDisplayName());
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent arg0) {
sem.release();
}
});
stage.setOnHiding(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent arg0) {
sem.release();
}
});
MainFXApplication mainAppWindow = new MainFXApplication();
try {
mainAppWindow.start(stage, getContext());
} catch (Exception ex) {
LOGGER.error("Exception while fx ", ex);
NtsSpeedPosException.mapException(new
RuntimeException(ex));
}
}
});
}
});
// Thread waits here until the semaphore gets released
sem.acquire();
I have an Problem with my Java Fx Application. On exit it crashes with the
following error:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000709a1e90,
pid=712, tid=8400
#
# JRE version: 7.0_25-b17
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode
windows-amd64 compressed oops)
# Problematic frame:
# C 0x00000000709a1e90[thread 7596 also had an error]
#
# Failed to write core dump. Minidumps are not enabled by default on
client versions of Windows
#
# An error report file with more information is saved as:
# C:\workspaces\hs_err_pid712.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
The logfile includes this:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000709a1e90,
pid=712, tid=8400
#
# JRE version: 7.0_25-b17
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode
windows-amd64 compressed oops)
# Problematic frame:
# C 0x00000000709a1e90
#
# Failed to write core dump. Minidumps are not enabled by default on
client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x000000001fdf7000): JavaThread "QuantumRenderer-0"
daemon [_thread_in_native, id=8400,
stack(0x0000000023b10000,0x0000000023c10000)]
siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008
0x00000000709a1e90
Registers:
RAX=0x00000000709a1e90, RBX=0x00000006e5ed7640, RCX=0x000000001fdf71d8,
RDX=0x0000000023c0ee40
RSP=0x0000000023c0edb8, RBP=0x0000000023c0ee30, RSI=0x0000000000000007,
RDI=0x0000000003d5bbd4
R8 =0x0000000000010001, R9 =0x00000000000000cb, R10=0x000000000270237c,
R11=0x0000000069a89860
R12=0x0000000000000000, R13=0x00000006e5ed7640, R14=0x0000000023c0ee58,
R15=0x000000001fdf7000
RIP=0x00000000709a1e90, EFLAGS=0x0000000000010206
Top of Stack: (sp=0x0000000023c0edb8)
0x0000000023c0edb8: 00000000027023a8 000000001220e4a0
0x0000000023c0edc8: 0000000014402460 0000000200004019
0x0000000023c0edd8: 0000000c00000078 00000006e66cf190
0x0000000023c0ede8: 0000000000000000 0000000023c0edf0
0x0000000023c0edf8: 0000000000000000 0000000023c0ee58
0x0000000023c0ee08: 00000006e5eda738 0000000000000000
0x0000000023c0ee18: 00000006e5ed7640 0000000000000000
0x0000000023c0ee28: 0000000023c0ee50 0000000023c0eea0
0x0000000023c0ee38: 00000000026f6374 0000000703fff258
0x0000000023c0ee48: 00000000026ff1d6 0000000000010001
0x0000000023c0ee58: 0000000703f66780 0000000023c0ee60
0x0000000023c0ee68: 00000006e5ed80dc 0000000023c0eeb8
0x0000000023c0ee78: 00000006e5eda738 0000000000000000
0x0000000023c0ee88: 00000006e5ed80f0 0000000023c0ee50
0x0000000023c0ee98: 0000000023c0eeb0 0000000023c0ef10
0x0000000023c0eea8: 00000000026f63d3 0000000703f66780
Instructions: (pc=0x00000000709a1e90)
0x00000000709a1e70:
[error occurred during error reporting (printing registers, top of stack,
instructions near pc), id 0xc0000005]
Register to memory mapping:
RAX=0x00000000709a1e90 is an unknown value
RBX=0x00000006e5ed7640 is an oop
{method}
- klass: {other class}
RCX=0x000000001fdf71d8 is an unknown value
RDX=0x0000000023c0ee40 is pointing into the stack for thread:
0x000000001fdf7000
RSP=0x0000000023c0edb8 is pointing into the stack for thread:
0x000000001fdf7000
RBP=0x0000000023c0ee30 is pointing into the stack for thread:
0x000000001fdf7000
RSI=0x0000000000000007 is an unknown value
RDI=0x0000000003d5bbd4 is an unknown value
R8 =0x0000000000010001 is an unknown value
R9 =0x00000000000000cb is an unknown value
R10=0x000000000270237c is an Interpreter codelet
method entry point (kind = native) [0x0000000002702100,
0x0000000002702980] 2176 bytes
R11=0x0000000069a89860 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x00000006e5ed7640 is an oop
{method}
- klass: {other class}
R14=0x0000000023c0ee58 is pointing into the stack for thread:
0x000000001fdf7000
R15=0x000000001fdf7000 is a thread
Stack: [0x0000000023b10000,0x0000000023c10000], sp=0x0000000023c0edb8,
free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native
code)
C 0x00000000709a1e90
j
com.sun.prism.d3d.D3DPipeline.getResourceFactory(Lcom/sun/glass/ui/Screen;)Lcom/sun/prism/ResourceFactory;+4
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer.dispose()V+64
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer$1.factoryReleased()V+4
j com.sun.prism.impl.BaseResourceFactory.notifyReleased()V+41
j com.sun.prism.d3d.D3DResourceFactory.notifyReleased()V+42
j com.sun.prism.d3d.D3DPipeline.notifyAllResourcesReleased()V+23
j com.sun.prism.d3d.D3DPipeline.dispose()V+26
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.cleanup()V+9
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+14
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
V [jvm.dll+0x1a6844]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.sun.prism.d3d.D3DPipeline.nGetAdapterOrdinal(J)I+0
j
com.sun.prism.d3d.D3DPipeline.getResourceFactory(Lcom/sun/glass/ui/Screen;)Lcom/sun/prism/ResourceFactory;+4
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer.dispose()V+64
j com.sun.scenario.effect.impl.prism.ps.PPSRenderer$1.factoryReleased()V+4
j com.sun.prism.impl.BaseResourceFactory.notifyReleased()V+41
j com.sun.prism.d3d.D3DResourceFactory.notifyReleased()V+42
j com.sun.prism.d3d.D3DPipeline.notifyAllResourcesReleased()V+23
j com.sun.prism.d3d.D3DPipeline.dispose()V+26
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.cleanup()V+9
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+14
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x000000001fdfb800 JavaThread "AWT-EventQueue-0" [_thread_blocked,
id=8240, stack(0x0000000023030000,0x0000000023130000)]
0x000000001fdfa800 JavaThread "AWT-Shutdown" [_thread_blocked, id=8496,
stack(0x0000000024f80000,0x0000000025080000)]
0x000000001402b000 JavaThread "Thread-105" daemon [_thread_in_native,
id=8732, stack(0x0000000025390000,0x0000000025490000)]
0x000000001402c000 JavaThread "JFXMedia Player EventQueueThread" daemon
[_thread_blocked, id=8640, stack(0x0000000025150000,0x0000000025250000)]
0x0000000014028000 JavaThread "Thread-48" daemon [_thread_in_native,
id=8420, stack(0x0000000028bb0000,0x0000000028cb0000)]
0x0000000014027800 JavaThread "JFXMedia Player EventQueueThread" daemon
[_thread_blocked, id=7312, stack(0x0000000028ec0000,0x0000000028fc0000)]
0x0000000014026800 JavaThread "Media Resource Disposer" daemon
[_thread_blocked, id=5648, stack(0x0000000024ce0000,0x0000000024de0000)]
0x000000001fdfa000 JavaThread "Prism Font Disposer" daemon
[_thread_blocked, id=9160, stack(0x0000000022d50000,0x0000000022e50000)]
0x000000001fdf9000 JavaThread "Thread-12" daemon [_thread_in_native,
id=7596, stack(0x0000000024a10000,0x0000000024b10000)]
0x000000001fdf8800 JavaThread "JavaFX Application Thread"
[_thread_in_native, id=9140,
stack(0x0000000023dd0000,0x0000000023ed0000)]
0x000000001fdf7800 JavaThread "Disposer" daemon [_thread_blocked,
id=8796, stack(0x0000000024e30000,0x0000000024f30000)]
=>0x000000001fdf7000 JavaThread "QuantumRenderer-0" daemon
[_thread_in_native, id=8400, stack(0x0000000023b10000,0x0000000023c10000)]
0x00000000140bc800 JavaThread "Thread-8" daemon [_thread_in_native,
id=7224, stack(0x000000001b820000,0x000000001b920000)]
0x0000000014765800 JavaThread "HouseKeeper" daemon [_thread_blocked,
id=8596, stack(0x000000001d3c0000,0x000000001d4c0000)]
0x00000000145b3000 JavaThread "TimerQueue" daemon [_thread_blocked,
id=3540, stack(0x000000001c8c0000,0x000000001c9c0000)]
0x00000000143e7000 JavaThread "Java2D Disposer" daemon [_thread_blocked,
id=5544, stack(0x0000000014c60000,0x0000000014d60000)]
0x000000001222a000 JavaThread "Service Thread" daemon [_thread_blocked,
id=8252, stack(0x0000000013af0000,0x0000000013bf0000)]
0x0000000012227000 JavaThread "C2 CompilerThread1" daemon
[_thread_blocked, id=8684, stack(0x00000000139c0000,0x0000000013ac0000)]
0x0000000012213000 JavaThread "C2 CompilerThread0" daemon
[_thread_blocked, id=7272, stack(0x0000000013830000,0x0000000013930000)]
0x0000000012212000 JavaThread "Attach Listener" daemon [_thread_blocked,
id=8772, stack(0x0000000013670000,0x0000000013770000)]
0x000000001220a800 JavaThread "Signal Dispatcher" daemon
[_thread_blocked, id=6900, stack(0x00000000134b0000,0x00000000135b0000)]
0x000000000228e800 JavaThread "Finalizer" daemon [_thread_blocked,
id=8352, stack(0x0000000013370000,0x0000000013470000)]
0x0000000002287800 JavaThread "Reference Handler" daemon
[_thread_blocked, id=9208, stack(0x0000000013200000,0x0000000013300000)]
0x00000000001ae800 JavaThread "main" [_thread_blocked, id=8356,
stack(0x00000000025f0000,0x00000000026f0000)]
Other Threads:
0x0000000012183000 VMThread [stack:
0x0000000013090000,0x0000000013190000] [id=8520]
0x0000000013c00800 WatcherThread [stack:
0x0000000012f50000,0x0000000013050000] [id=792]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
PSYoungGen total 323456K, used 116276K [0x00000007aaeb0000,
0x00000007d0d60000, 0x0000000800000000)
eden space 321152K, 36% used
[0x00000007aaeb0000,0x00000007b203d170,0x00000007be850000)
from space 2304K, 0% used
[0x00000007ce420000,0x00000007ce420000,0x00000007ce660000)
to space 21888K, 0% used
[0x00000007cf800000,0x00000007cf800000,0x00000007d0d60000)
ParOldGen total 174208K, used 58619K [0x0000000700c00000,
0x000000070b620000, 0x00000007aaeb0000)
object space 174208K, 33% used
[0x0000000700c00000,0x000000070453ef98,0x000000070b620000)
PSPermGen total 217280K, used 97403K [0x00000006e0c00000,
0x00000006ee030000, 0x0000000700c00000)
object space 217280K, 44% used
[0x00000006e0c00000,0x00000006e6b1ee00,0x00000006ee030000)
Card table byte_map: [0x00000000056f0000,0x0000000005ff0000]
byte_map_base: 0x0000000001fea000
Polling page: 0x0000000000140000
Code Cache [0x00000000026f0000, 0x0000000002cd0000, 0x00000000056f0000)
total_blobs=2619 nmethods=1494 adapters=1075 free_code_cache=43416Kb
largest_free_block=44218368
Compilation events (10 events):
Event: 207.573 Thread 0x0000000012213000 1646
javax.swing.text.AbstractDocument$LeafElement::getEndOffset (10 bytes)
Event: 207.574 Thread 0x0000000012213000 nmethod 1646 0x0000000002aa5c10
code [0x0000000002aa5d60, 0x0000000002aa5e38]
Event: 207.579 Thread 0x0000000012227000 1647
javax.swing.text.html.StyleSheet$ViewAttributeSet::getAttribute (61 bytes)
Event: 207.581 Thread 0x0000000012227000 nmethod 1647 0x00000000029e68d0
code [0x00000000029e6a60, 0x00000000029e6c30]
Event: 207.593 Thread 0x0000000012213000 1648
javax.swing.text.LabelView::sync (12 bytes)
Event: 207.594 Thread 0x0000000012213000 nmethod 1648 0x00000000029e65d0
code [0x00000000029e6720, 0x00000000029e67f8]
Event: 208.679 Thread 0x0000000012227000 1649
oracle.jdbc.driver.T4CMAREngine::unmarshalSB4 (8 bytes)
Event: 208.679 Thread 0x0000000012213000 1650
oracle.jdbc.driver.T4CMAREngine::unmarshalDALC (53 bytes)
Event: 208.679 Thread 0x0000000012227000 nmethod 1649 0x0000000002aa4d90
code [0x0000000002aa4ee0, 0x0000000002aa4f68]
Event: 208.681 Thread 0x0000000012213000 nmethod 1650 0x0000000002aa4690
code [0x0000000002aa4800, 0x0000000002aa4a98]
VM Arguments:
jvm_args: -XX:MaxPermSize=512m -Dfile.encoding=Cp1252
java_command:
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Java\jdk1.6.0_20_64bit
PATH=C:\oracle\product\11.2.0\dbhome_1\bin;C:\Program Files
(x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program
Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD
APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program
Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth
Software\syswow64;c:\dev\Apache Software
Foundation\apache-maven-2.0.9\bin;c:\dev\Apache Software
Foundation\apache-ant-1.8.1\bin
USERNAME=af7711
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 7 , 64 bit Build 7601 Service Pack 1
CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58
stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2,
popcnt, avx, ht, tsc, tscinvbit, tscinv
Memory: 4k page, physical 16723516k(8101396k free), swap
33445172k(23323688k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (23.25-b01) for windows-amd64
JRE (1.7.0_25-b17), built on Jun 21 2013 12:58:32 by "java_re" with
unknown MS VC++:1600
time: Tue Aug 20 08:29:31 2013
elapsed time: 208 seconds
The source for starting the FX-Application an handling the exit and close
events looks like this:
private final Semaphore sem = new Semaphore(0);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new JFXPanel(); // initializes JavaFX environment
Platform.runLater(new Runnable() {
@Override
public void run() {
Stage stage = new Stage();
stage.setTitle(moduleInfo.getDisplayName());
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent arg0) {
sem.release();
}
});
stage.setOnHiding(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent arg0) {
sem.release();
}
});
MainFXApplication mainAppWindow = new MainFXApplication();
try {
mainAppWindow.start(stage, getContext());
} catch (Exception ex) {
LOGGER.error("Exception while fx ", ex);
NtsSpeedPosException.mapException(new
RuntimeException(ex));
}
}
});
}
});
// Thread waits here until the semaphore gets released
sem.acquire();
Monday, 19 August 2013
how to create own hotspot software using java programming [on hold]
how to create own hotspot software using java programming [on hold]
I want to create a wifi hotspot for my final year project using java. It
seems that I should built a firm ware for it. Can please anyone help on it
I want to create a wifi hotspot for my final year project using java. It
seems that I should built a firm ware for it. Can please anyone help on it
How do I edit jQuery.mmenu.js to allow classes (not only IDs) to be targeted?
How do I edit jQuery.mmenu.js to allow classes (not only IDs) to be targeted?
I'm working on a mobile site and I want to reveal hidden submenus
underneath divs like Twitter's mobile site (swipe a tweet to reveal other
options). I really like the interface in the jQuery.mmenu.js plug-in, but
it's limited to only target IDs and I need to target classes.
I'm sure this is something that was set-up by Fred, which means
theoretically it could be changed.
The code can all be downloaded here: http://mmenu.frebsite.nl/
PS. This post is mostly intended for Fred as per his contact requirements,
but if anyone can think of a solution I'd love to try it.
I'm working on a mobile site and I want to reveal hidden submenus
underneath divs like Twitter's mobile site (swipe a tweet to reveal other
options). I really like the interface in the jQuery.mmenu.js plug-in, but
it's limited to only target IDs and I need to target classes.
I'm sure this is something that was set-up by Fred, which means
theoretically it could be changed.
The code can all be downloaded here: http://mmenu.frebsite.nl/
PS. This post is mostly intended for Fred as per his contact requirements,
but if anyone can think of a solution I'd love to try it.
VersionOne rest API description attribute format
VersionOne rest API description attribute format
Successfully using the VersionOne API to create stories using the REST
API. Unfortunately the description field seems to strip all xml tags. (The
example online uses
, but this does not work)
So have something like:
POST /VersionOne/rest-1.v1/Data/Story HTTP/1.1
Content-Type: text/xml; charset=utf-8
Content-Length: 221
<Asset>
<Attribute name="Name" act="set">New Story</Attribute>
<Relation name="Scope" act="set">
<Asset idref="Scope:0" />
</Relation>
<Attribute name="Description" act="set">
<p>first line</p>
<p> second line</p>
</Attribute>
</Asset>
Any way to insert formatting? Basically we are using this as a story to
test our recently created artifact and want to refer to the
defects/stories that are included in the artifact. Any help much
appreciated, thanks.
Successfully using the VersionOne API to create stories using the REST
API. Unfortunately the description field seems to strip all xml tags. (The
example online uses
, but this does not work)
So have something like:
POST /VersionOne/rest-1.v1/Data/Story HTTP/1.1
Content-Type: text/xml; charset=utf-8
Content-Length: 221
<Asset>
<Attribute name="Name" act="set">New Story</Attribute>
<Relation name="Scope" act="set">
<Asset idref="Scope:0" />
</Relation>
<Attribute name="Description" act="set">
<p>first line</p>
<p> second line</p>
</Attribute>
</Asset>
Any way to insert formatting? Basically we are using this as a story to
test our recently created artifact and want to refer to the
defects/stories that are included in the artifact. Any help much
appreciated, thanks.
Add Labels ggplot2
Add Labels ggplot2
How to add labels by a seperate vector on geom_bar() plot?
a<-as.POSIXlt("2013-07-01 00:00:00",origin = "1960-01-01",tz="GMT")
b<-as.POSIXlt("2013-07-08 00:00:00",origin = "1960-01-01",tz="GMT")
week1<-sample(seq(as.numeric(a),by=60*60,length.out=200),200,T)
week2<-sample(seq(as.numeric(b),by=60*60,length.out=200),200,T)
times<-c(week1,week2)
class(times)<-c("POSIXt","POSIXct")
times<-as.POSIXlt(times,origin = "1960-01-01",tz="GMT")
key<-sample(LETTERS[1:3],200,T)
df<-data.frame(times=times,order=factor(rep(1:2,each=100)), key=key)
p<-ggplot(df, aes(x=key, y=..count.. ,fill=key ) )
p<-p + geom_bar()
p<-p + facet_wrap( ~ order,ncol=2)
p<-p + coord_flip()
p
I like to add the number of each key value, which is represented by df1$y:
df1<-ddply(df, .(key,order), summarize, y=length(key))
p<-p + geom_text(aes(label=df$1y), vjust=0)
How to add labels by a seperate vector on geom_bar() plot?
a<-as.POSIXlt("2013-07-01 00:00:00",origin = "1960-01-01",tz="GMT")
b<-as.POSIXlt("2013-07-08 00:00:00",origin = "1960-01-01",tz="GMT")
week1<-sample(seq(as.numeric(a),by=60*60,length.out=200),200,T)
week2<-sample(seq(as.numeric(b),by=60*60,length.out=200),200,T)
times<-c(week1,week2)
class(times)<-c("POSIXt","POSIXct")
times<-as.POSIXlt(times,origin = "1960-01-01",tz="GMT")
key<-sample(LETTERS[1:3],200,T)
df<-data.frame(times=times,order=factor(rep(1:2,each=100)), key=key)
p<-ggplot(df, aes(x=key, y=..count.. ,fill=key ) )
p<-p + geom_bar()
p<-p + facet_wrap( ~ order,ncol=2)
p<-p + coord_flip()
p
I like to add the number of each key value, which is represented by df1$y:
df1<-ddply(df, .(key,order), summarize, y=length(key))
p<-p + geom_text(aes(label=df$1y), vjust=0)
Sunday, 18 August 2013
Easy way to get multi-level javascript object property
Easy way to get multi-level javascript object property
I always need to deal with multi-level js objects where existence of
properties are not certain:
try { value1 = obj.a.b.c; } catch(e) { value1 = 1; }
try { value2 = obj.d.e.f; } catch(e) { value2 = 2; }
......
Is there an easier way or a generic function (e.g. ifnull(obj.d.e.f, 2) )
that does not require a lot of try catches?
I always need to deal with multi-level js objects where existence of
properties are not certain:
try { value1 = obj.a.b.c; } catch(e) { value1 = 1; }
try { value2 = obj.d.e.f; } catch(e) { value2 = 2; }
......
Is there an easier way or a generic function (e.g. ifnull(obj.d.e.f, 2) )
that does not require a lot of try catches?
LibGDX - Color Picker
LibGDX - Color Picker
How to implement color picker in LibGDX like below:
Any help will be appreciated.
How to implement color picker in LibGDX like below:
Any help will be appreciated.
Is Python Extensions for Windows the best (or only) way to get win32ui?
Is Python Extensions for Windows the best (or only) way to get win32ui?
I'm seeing:
ImportError: No module named win32ui
So I guess the Python27 installation didn't include win32ui. Where is the
best way to obtain it without screwing up my existing setup? Thanks for
any help.
I'm seeing:
ImportError: No module named win32ui
So I guess the Python27 installation didn't include win32ui. Where is the
best way to obtain it without screwing up my existing setup? Thanks for
any help.
filter sql rows using update statement
filter sql rows using update statement
I am trying to write a query which can get invalid refby(is related to
id), please check following db structure...
| id | acnumber | refby |
+----+-----------+--------+
| 1 | ac01 | 2 |
+----+-----------+--------+
| 2 | ac02 | 1 |
+----+-----------+--------+
| 3 | ac03 | 5 |
+----+-----------+--------+
As you can there is no id with value of 5 in above table so query must
return 3rd row as result.
I have tried...
SELECT * FROM tbl.members WHERE refby != (SELECT id FROM tbl.members WHERE
id = refby)
But not giving correct results, please help, thanks.
I am trying to write a query which can get invalid refby(is related to
id), please check following db structure...
| id | acnumber | refby |
+----+-----------+--------+
| 1 | ac01 | 2 |
+----+-----------+--------+
| 2 | ac02 | 1 |
+----+-----------+--------+
| 3 | ac03 | 5 |
+----+-----------+--------+
As you can there is no id with value of 5 in above table so query must
return 3rd row as result.
I have tried...
SELECT * FROM tbl.members WHERE refby != (SELECT id FROM tbl.members WHERE
id = refby)
But not giving correct results, please help, thanks.
You must set myJID before calling connect error
You must set myJID before calling connect error
I want to implement 'OpenFire' server for chat application. I got source
code on git at https://github.com/rayaleen/OpenFireClient. On login button
action it shows me following error:
Error connecting: Error Domain=XMPPStreamErrorDomain Code=2 "You must set
myJID before calling connect." UserInfo=0x7a87c80
{NSLocalizedDescription=You must set myJID before calling connect.}
But I could not find any document to implement this. Does any one have any
idea about this type of error? Any link for documentation would be more
helpful.
I want to implement 'OpenFire' server for chat application. I got source
code on git at https://github.com/rayaleen/OpenFireClient. On login button
action it shows me following error:
Error connecting: Error Domain=XMPPStreamErrorDomain Code=2 "You must set
myJID before calling connect." UserInfo=0x7a87c80
{NSLocalizedDescription=You must set myJID before calling connect.}
But I could not find any document to implement this. Does any one have any
idea about this type of error? Any link for documentation would be more
helpful.
Identify success or failure messages in sequence diagrams
Identify success or failure messages in sequence diagrams
I am trying to express that only if QA approves a media does it get saved.
The user would get a message of success or failure either way. Is this the
correct way to model it?
I am trying to express that only if QA approves a media does it get saved.
The user would get a message of success or failure either way. Is this the
correct way to model it?
Saturday, 17 August 2013
Step.js return callback in middle step
Step.js return callback in middle step
I am so confused with StepJS. What I am trying to do is in STEP 3 if
data.message is defined then I should update my update_stat object with
"err = yes" and return original "cb" without going in other steps.
if you look at Step-3, when I comment line below:
# update_stat.err = "yes"
STEP - 4/5/6/7 are not executed and callback 'cb' goes back but when I
uncomment above line and set "err" value to "yes"
Steps 4,5,6,7 are executed : ( any help will be appreciated
update: (doc, cb) ->
self = this
update_stat = {
err: "no",
type: "none",
message: "none"
}
Step(
() ->
console.log("step - 1")
step_callback = this
self.parse_interface(step_callback)
return
, (err, data) ->
# console.log("=========== parse interface data")
# console.info(data)
console.log("step - 2")
step_callback = this
if _.isArray(data) and data.length is 0
step_callback(undefined, true)
else
self.update_interface(data, step_callback)
return
, (err, data) ->
console.log("step - 3")
step_callback = this
# throw err if err
console.log("=========== RESULT OF UPDATE interface")
console.info(data)
if data.message?
# update_stat.err = "yes"
# update_status.type = "update interface"
# update_status.message = data.message
cb(undefined, update_stat)
else
self.parse_routes(step_callback)
return
, (err, data) ->
console.log("step - 4")
step_callback = this
if _.isArray(data) and data.length is 0
step_callback(undefined, true)
else
self.update_routes(data, step_callback)
return
, (err, data) ->
step_callback = this
console.log("step - 5")
console.log("=========== RESULT OF UPDATE Routes")
console.info(data)
throw err if err
if data.message?
# console.log("I am here..............")
# update_status.error = true
# update_status.type = "update routes"
# update_status.message = data.message
# console.info(update_stat)
cb(undefined, update_stat)
return
self.parse_vlan(step_callback)
return
, (err, data) ->
console.log("step - 6")
console.log(data)
step_callback = this
if _.isArray(data) and data.length is 0
step_callback(undefined, true)
else
self.update_vlans(data, step_callback)
return
, (err, data) ->
console.log("step - 7")
console.log("=========== RESULT OF UPDATE vlans")
console.info(data)
throw err if err
if data.message?
# update_status.error = true
# update_status.type = "update vlans"
# update_status.message = data.message
cb(undefined, update_stat)
else
cb(undefined, update_stat)
)
I am so confused with StepJS. What I am trying to do is in STEP 3 if
data.message is defined then I should update my update_stat object with
"err = yes" and return original "cb" without going in other steps.
if you look at Step-3, when I comment line below:
# update_stat.err = "yes"
STEP - 4/5/6/7 are not executed and callback 'cb' goes back but when I
uncomment above line and set "err" value to "yes"
Steps 4,5,6,7 are executed : ( any help will be appreciated
update: (doc, cb) ->
self = this
update_stat = {
err: "no",
type: "none",
message: "none"
}
Step(
() ->
console.log("step - 1")
step_callback = this
self.parse_interface(step_callback)
return
, (err, data) ->
# console.log("=========== parse interface data")
# console.info(data)
console.log("step - 2")
step_callback = this
if _.isArray(data) and data.length is 0
step_callback(undefined, true)
else
self.update_interface(data, step_callback)
return
, (err, data) ->
console.log("step - 3")
step_callback = this
# throw err if err
console.log("=========== RESULT OF UPDATE interface")
console.info(data)
if data.message?
# update_stat.err = "yes"
# update_status.type = "update interface"
# update_status.message = data.message
cb(undefined, update_stat)
else
self.parse_routes(step_callback)
return
, (err, data) ->
console.log("step - 4")
step_callback = this
if _.isArray(data) and data.length is 0
step_callback(undefined, true)
else
self.update_routes(data, step_callback)
return
, (err, data) ->
step_callback = this
console.log("step - 5")
console.log("=========== RESULT OF UPDATE Routes")
console.info(data)
throw err if err
if data.message?
# console.log("I am here..............")
# update_status.error = true
# update_status.type = "update routes"
# update_status.message = data.message
# console.info(update_stat)
cb(undefined, update_stat)
return
self.parse_vlan(step_callback)
return
, (err, data) ->
console.log("step - 6")
console.log(data)
step_callback = this
if _.isArray(data) and data.length is 0
step_callback(undefined, true)
else
self.update_vlans(data, step_callback)
return
, (err, data) ->
console.log("step - 7")
console.log("=========== RESULT OF UPDATE vlans")
console.info(data)
throw err if err
if data.message?
# update_status.error = true
# update_status.type = "update vlans"
# update_status.message = data.message
cb(undefined, update_stat)
else
cb(undefined, update_stat)
)
Subscribe to:
Posts (Atom)