PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
30k
⌀ | Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,351,016 | 07/05/2012 19:14:26 | 268,826 | 02/08/2010 17:17:03 | 88 | 3 | CakePHP 1.3 - Calling Shells from a Controller? | I cannot for the life of me figure out how to call a shell from a controller.
We have a background process that packages up data in a .pdf, and we don't want to bog down the page loads waiting for this to occur, so we want to put all this processing in a shell.
I've figured out how to pass values to a shell with $this->args
I know you can use App::import('Shell','TestShell')... but after that I am lost.
How do I call the main() function of the shell within a controller? | shell | cakephp | controller | null | null | null | open | CakePHP 1.3 - Calling Shells from a Controller?
===
I cannot for the life of me figure out how to call a shell from a controller.
We have a background process that packages up data in a .pdf, and we don't want to bog down the page loads waiting for this to occur, so we want to put all this processing in a shell.
I've figured out how to pass values to a shell with $this->args
I know you can use App::import('Shell','TestShell')... but after that I am lost.
How do I call the main() function of the shell within a controller? | 0 |
11,351,019 | 07/05/2012 19:14:43 | 574,663 | 01/13/2011 17:54:58 | 673 | 17 | Improve Regex to get 6 digit Date (MMDDYY) | I'm currently using:
[0-1]{1}[0-9]{1}[0-3]{1}[0-9]{1}[0-1]{1}[0-9]{1}
to match a 6 digit date. Is there a way to make this more restrictive, my issue is that I have other 6-8 digits digits contained in the text and I am getting the occasional false positive in the non-date sequence.
Any suggestions ?
Thanks !
p.s Should Say that the year will always be above 2000 and less then Current Date, hence the restriction on the year. | c# | .net | regex | null | null | null | open | Improve Regex to get 6 digit Date (MMDDYY)
===
I'm currently using:
[0-1]{1}[0-9]{1}[0-3]{1}[0-9]{1}[0-1]{1}[0-9]{1}
to match a 6 digit date. Is there a way to make this more restrictive, my issue is that I have other 6-8 digits digits contained in the text and I am getting the occasional false positive in the non-date sequence.
Any suggestions ?
Thanks !
p.s Should Say that the year will always be above 2000 and less then Current Date, hence the restriction on the year. | 0 |
11,351,020 | 07/05/2012 19:14:44 | 1,229,037 | 02/23/2012 17:56:22 | 60 | 0 | Generating an XML document from Java objects where the structure is very different | **The Problem**
I have a complex model object tree in Java that needs to be translated back and forth into an XML document. The object structure of the XML document's schema is extremely different from the model's object tree. The two are interchangeable, but the translation requires lots of context-driven logic where parent/child-like relationships are used.
**Some Background**
I'm working with model objects that are well established in a older system and the XML document's schema is fairly new. Since lots of our code depends on the structure of the model objects, we don't want to restructure them. Here is a simplified example of the type of structural differences I'm dealing with:
> *Example data model tree*
> Item
> * Description
> * cost
> * ...
> Person
> * First Name
> * Last Name
> * Address
> * ...
> Address
> * Street
> * City
> * ...
> Sale_Transaction (*this is the thing being translated)
> * Buyer (Person)
> * Seller (Person)
> * Sold Items[] (List<Item>)
> * Exchanged Items[] (List<Item>)
> * Location of Transaction (Address)
> *Example XML Document Structure*
> Exchange
> * Type
> * Parties
> * contact_ref
> * id
> * contact_id
> * Exchange Details
> * type
> * total_amount_exchanged
> * Items
> * Item
> * type
> * owning_party_contact_ref_id
> * exchange_use_type
>* Contacts
> * Contact
> * id
> * type
> Exchange Type: [ CASH SALE | BARTER | COMBINATION CASH AND BARTER ]
> Contact Type: [ PERSON | ADDRESS ]
> Exchange Details Type: [ CASH EXCHANGE | BARTER EXCHANGE ]
Mapping between Sale_Transaction and Exchange is possible, just not 1-1. In the example, the "buyer" in the model would be mapped to both a contact and a contact reference element in the XML document. Also, the value of the "owning_party_contact_ref_id" attribute of an "Item" element would be determined by looking at several different values in the Sale_Transaction object tree.
If an object tree I'm working with needs some translation in order to be used in an XML document, my go-to tool is an XmlAdapter. In this case though, I don't see using JAXB XML adapters as a viable solution. As far as I know, XmlAdapters work with individual objects and don't have a way to get at the context of the entire tree being marshalled/unmarshalled.
**The Question**
I'm sure this type of problem is fairly common, so how do you handle it? Is there a way of handling this problem with standard tools?
**What I've come up with**
In case it's interesting, here are the possible approaches that I've come up with:
*#1*
Separate the object tree translation problem from the XML generation problem. I have a home-grown tool that assists with generating object trees based on some context object. I could create the JAXB classes from the XML schema, then rely on this tool to generate the objects of those classes based on the context of our model object. This would work well to generate an XML document from the model object tree, but not the other way around. It also means relying on non-standard tools, which I'd like to avoid if possible.
*#2*
Go XmlAdapter crazy and modify the model classes to be able to retain translation state information (e.g. This object in the model tree was used to create this element in the XML document). This would keep the problem very close to the standard usage model for JAXB, but I think it would be a nightmare to develop, test and maintain.
*#3*
Separate the object tree problem like I would in #1, but use JDOM instead of JAXB. This would remove all of the JAXB required classes and mappings, but require another custom tool be built to manage the model object to DOM tree mappings.
I'm not super excited about any of the three solutions, but I'm most partial to #1. | java | xml | jaxb | mapping | null | null | open | Generating an XML document from Java objects where the structure is very different
===
**The Problem**
I have a complex model object tree in Java that needs to be translated back and forth into an XML document. The object structure of the XML document's schema is extremely different from the model's object tree. The two are interchangeable, but the translation requires lots of context-driven logic where parent/child-like relationships are used.
**Some Background**
I'm working with model objects that are well established in a older system and the XML document's schema is fairly new. Since lots of our code depends on the structure of the model objects, we don't want to restructure them. Here is a simplified example of the type of structural differences I'm dealing with:
> *Example data model tree*
> Item
> * Description
> * cost
> * ...
> Person
> * First Name
> * Last Name
> * Address
> * ...
> Address
> * Street
> * City
> * ...
> Sale_Transaction (*this is the thing being translated)
> * Buyer (Person)
> * Seller (Person)
> * Sold Items[] (List<Item>)
> * Exchanged Items[] (List<Item>)
> * Location of Transaction (Address)
> *Example XML Document Structure*
> Exchange
> * Type
> * Parties
> * contact_ref
> * id
> * contact_id
> * Exchange Details
> * type
> * total_amount_exchanged
> * Items
> * Item
> * type
> * owning_party_contact_ref_id
> * exchange_use_type
>* Contacts
> * Contact
> * id
> * type
> Exchange Type: [ CASH SALE | BARTER | COMBINATION CASH AND BARTER ]
> Contact Type: [ PERSON | ADDRESS ]
> Exchange Details Type: [ CASH EXCHANGE | BARTER EXCHANGE ]
Mapping between Sale_Transaction and Exchange is possible, just not 1-1. In the example, the "buyer" in the model would be mapped to both a contact and a contact reference element in the XML document. Also, the value of the "owning_party_contact_ref_id" attribute of an "Item" element would be determined by looking at several different values in the Sale_Transaction object tree.
If an object tree I'm working with needs some translation in order to be used in an XML document, my go-to tool is an XmlAdapter. In this case though, I don't see using JAXB XML adapters as a viable solution. As far as I know, XmlAdapters work with individual objects and don't have a way to get at the context of the entire tree being marshalled/unmarshalled.
**The Question**
I'm sure this type of problem is fairly common, so how do you handle it? Is there a way of handling this problem with standard tools?
**What I've come up with**
In case it's interesting, here are the possible approaches that I've come up with:
*#1*
Separate the object tree translation problem from the XML generation problem. I have a home-grown tool that assists with generating object trees based on some context object. I could create the JAXB classes from the XML schema, then rely on this tool to generate the objects of those classes based on the context of our model object. This would work well to generate an XML document from the model object tree, but not the other way around. It also means relying on non-standard tools, which I'd like to avoid if possible.
*#2*
Go XmlAdapter crazy and modify the model classes to be able to retain translation state information (e.g. This object in the model tree was used to create this element in the XML document). This would keep the problem very close to the standard usage model for JAXB, but I think it would be a nightmare to develop, test and maintain.
*#3*
Separate the object tree problem like I would in #1, but use JDOM instead of JAXB. This would remove all of the JAXB required classes and mappings, but require another custom tool be built to manage the model object to DOM tree mappings.
I'm not super excited about any of the three solutions, but I'm most partial to #1. | 0 |
11,351,025 | 07/05/2012 19:15:01 | 1,359,072 | 04/26/2012 15:18:55 | 26 | 0 | Access 2003: Determine whether one or all of 4 fields exist in table | I have a table which changes every day but will always have the same name (Scrubbed). I need a query to determine whether the new fields exist in the table that day. I'll call them field1, field2, field3, field4.
I had a sql query:
SELECT Scrubbed.field1, Scrubbed.field2, Scrubbed.field3, Scrubbed.field4
FROM Scrubbed;
Which errors with a message box (new fields not in table) if it doesn't find all 4 fields. This isn't working out. If the table contains fields 1 and 2 but not 3 and 4, I need the user to know that without opening the table.
Thanks in advance for any suggestions. | ms-access | null | null | null | null | null | open | Access 2003: Determine whether one or all of 4 fields exist in table
===
I have a table which changes every day but will always have the same name (Scrubbed). I need a query to determine whether the new fields exist in the table that day. I'll call them field1, field2, field3, field4.
I had a sql query:
SELECT Scrubbed.field1, Scrubbed.field2, Scrubbed.field3, Scrubbed.field4
FROM Scrubbed;
Which errors with a message box (new fields not in table) if it doesn't find all 4 fields. This isn't working out. If the table contains fields 1 and 2 but not 3 and 4, I need the user to know that without opening the table.
Thanks in advance for any suggestions. | 0 |
11,351,004 | 07/05/2012 19:13:52 | 704,836 | 04/12/2011 20:17:37 | 15 | 0 | f:ajax onerror called before listener | I have a simple form and a pretty simple bean that listens to an ajax event. Here is some of the code:
<script type="text/javascript">
function myfunction() {
alert('error');
}
</script>
<h:commandButton id="someid" value="somevalue" >
<f:ajax event="click" execute="someids" listener="#{MyBean.fireEvent}" onerror="myfunction()" />
</h:commandButton>
I am using eclipse in debug to see when `MyBean.fireEvent` is getting called and as far as I can tell it is getting called after `onerror="myfunction()"` is executed. What could be the reason for that?
I am using mojarra 2.0 with Resin.
Thanks. | jsf | jsf-2.0 | jsf-1.2 | mojarra | null | null | open | f:ajax onerror called before listener
===
I have a simple form and a pretty simple bean that listens to an ajax event. Here is some of the code:
<script type="text/javascript">
function myfunction() {
alert('error');
}
</script>
<h:commandButton id="someid" value="somevalue" >
<f:ajax event="click" execute="someids" listener="#{MyBean.fireEvent}" onerror="myfunction()" />
</h:commandButton>
I am using eclipse in debug to see when `MyBean.fireEvent` is getting called and as far as I can tell it is getting called after `onerror="myfunction()"` is executed. What could be the reason for that?
I am using mojarra 2.0 with Resin.
Thanks. | 0 |
11,351,029 | 07/05/2012 19:15:26 | 43,960 | 12/06/2008 17:17:21 | 2,151 | 46 | Clean approach to store Key-Value "properties"? | Let say I have one model for cars. Each car has attributes: color, size, weight, etc... I want users to allow the creation of new attributes for each car objects. However I want to share "attributes" so that the attribute "size" only exists once in the db but values exist for each object where users have added them.
My old approach were two models: Car, KeyValue(key: String, value:String) and Car had a 1:m relationship to KeyValue.
Now, to ensure my above constraint I thought of the following:
- Three objects: Car, Key, Value
- Value(Key: Key)
- Car (1:m relation to Value)
However, this reverse approach works very well but does not look "clean" to me. Therefore, I'd like to ask whether a cleaner approach is possbile. | django | django-models | null | null | null | null | open | Clean approach to store Key-Value "properties"?
===
Let say I have one model for cars. Each car has attributes: color, size, weight, etc... I want users to allow the creation of new attributes for each car objects. However I want to share "attributes" so that the attribute "size" only exists once in the db but values exist for each object where users have added them.
My old approach were two models: Car, KeyValue(key: String, value:String) and Car had a 1:m relationship to KeyValue.
Now, to ensure my above constraint I thought of the following:
- Three objects: Car, Key, Value
- Value(Key: Key)
- Car (1:m relation to Value)
However, this reverse approach works very well but does not look "clean" to me. Therefore, I'd like to ask whether a cleaner approach is possbile. | 0 |
11,351,030 | 07/05/2012 19:15:37 | 814,178 | 06/24/2011 13:58:39 | 579 | 43 | Regular Expression to get chunk of Alpha characters around a forward slash (JAVA) | I'm not really good at regular expressions so I need some help here.
I have a long string of garbled characters (special and alpha numeric); however somewhere in the middle I have a chunk that I'm interested in where it has two sets of words separated by a forward slash like:
$234207YELLOW/GREEN$M4/ZlAVadvae1bUAoIfaEbEAZ4HdBHr2ftv+3tIo+yw==
And I'm interested in the YELLOW/GREEN part of the whole thing; and the part that I'm interested in can be anywhere in the string so I can't rely on an index :(
Can you help me find the regex that I can use in my Java code to get this?
Thanks.
| java | regex | null | null | null | null | open | Regular Expression to get chunk of Alpha characters around a forward slash (JAVA)
===
I'm not really good at regular expressions so I need some help here.
I have a long string of garbled characters (special and alpha numeric); however somewhere in the middle I have a chunk that I'm interested in where it has two sets of words separated by a forward slash like:
$234207YELLOW/GREEN$M4/ZlAVadvae1bUAoIfaEbEAZ4HdBHr2ftv+3tIo+yw==
And I'm interested in the YELLOW/GREEN part of the whole thing; and the part that I'm interested in can be anywhere in the string so I can't rely on an index :(
Can you help me find the regex that I can use in my Java code to get this?
Thanks.
| 0 |
11,351,031 | 07/05/2012 19:15:46 | 1,033,422 | 11/07/2011 08:39:35 | 12 | 4 | should job schedulers be shared in a soa environment? | Say for example, an accounting service has a need to schedule ledger update jobs,
1. should the accounting service include it's own scheduler? or,
2. should job scheduling be a shared service?
I guess option (a) makes the service more autonomous?
What other criteria should be involved in making the decision? | soa | null | null | null | null | null | open | should job schedulers be shared in a soa environment?
===
Say for example, an accounting service has a need to schedule ledger update jobs,
1. should the accounting service include it's own scheduler? or,
2. should job scheduling be a shared service?
I guess option (a) makes the service more autonomous?
What other criteria should be involved in making the decision? | 0 |
11,351,032 | 07/05/2012 19:16:08 | 99,463 | 05/01/2009 16:50:40 | 631 | 15 | Named tuple and optional keyword arguments | I'm trying to convert a longish hollow "data" class into a named tuple. My class currently looks like this:
class Node(object):
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
After conversion to `namedtuple` it looks like:
from collections import namedtuple
Node = namedtuple('Node', 'val left right')
But there is a problem here. My original class allowed me to pass in just a value and took care of the default by using default values for the named/keyword arguments. Something like:
class BinaryTree(object):
def __init__(self, val):
self.root = Node(val)
But this doesn't work in the case of my refactored named tuple since it expects me to pass all the fields. I can of course replace the occurrences of `Node(val)` to `Node(val, None, None)` but it isn't to my liking.
So does there exist a good trick which can make my re-write successful without adding a lot of code complexity (metaprogramming) or should I just swallow the pill and go ahead with the "search and replace"? :)
TIA
-- sauke | python | optional-arguments | namedtuple | null | null | null | open | Named tuple and optional keyword arguments
===
I'm trying to convert a longish hollow "data" class into a named tuple. My class currently looks like this:
class Node(object):
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
After conversion to `namedtuple` it looks like:
from collections import namedtuple
Node = namedtuple('Node', 'val left right')
But there is a problem here. My original class allowed me to pass in just a value and took care of the default by using default values for the named/keyword arguments. Something like:
class BinaryTree(object):
def __init__(self, val):
self.root = Node(val)
But this doesn't work in the case of my refactored named tuple since it expects me to pass all the fields. I can of course replace the occurrences of `Node(val)` to `Node(val, None, None)` but it isn't to my liking.
So does there exist a good trick which can make my re-write successful without adding a lot of code complexity (metaprogramming) or should I just swallow the pill and go ahead with the "search and replace"? :)
TIA
-- sauke | 0 |
11,351,021 | 07/05/2012 19:14:48 | 806,345 | 06/20/2011 09:12:23 | 1 | 2 | triggering route from a link | I have a multilingual website where the visitors can change language using a drop down list.
This drop down list is made of several a links, foreaxmple:
<a class="es-ES" href="javascript:void(0);"> <img src="/Content/images/Flags/flag_spain.png" alt="İspanyolca"/>español</a>
When a link from above is clicked the language of the site changes to the chosen language.
Now I have made some routes within the global.asax that takes a language code and stick it in the url. I can trigger these routes using this code
<%= Html.ActionLink("Spanish", ViewContext.RouteData.Values["action"].ToString(), new { language = "es" })%>
This will give me a url that looks like :
ttp://localhost:2535/es
or
ttp://localhost:2535/es/Home/About
I want to combine these links! That means when a user clicks the first mentioned link
<a class="es-ES" href="javascript:void(0);">
<img src="/Content/images/Flags/flag_spain.png" alt="İspanyolca"/>español
</a>
,then I want the link to behave like it does already, but I also want the functionality of this code (the second link, which changes the url to reflect chosen language)
<%= Html.ActionLink("Spanish", ViewContext.RouteData.Values["action"].ToString(), new { language = "es" })%>
How do I do this.
Please note that it is the first link that is the (important one), since it triggers the actual language swift, and contains all the nice css formatting and even javascript.
I just want the functionality of the actionlink to be "triggered or put" inside of the first link.
Hope someone can help.
Thanks. | multilingual | nerddinner | null | null | null | null | open | triggering route from a link
===
I have a multilingual website where the visitors can change language using a drop down list.
This drop down list is made of several a links, foreaxmple:
<a class="es-ES" href="javascript:void(0);"> <img src="/Content/images/Flags/flag_spain.png" alt="İspanyolca"/>español</a>
When a link from above is clicked the language of the site changes to the chosen language.
Now I have made some routes within the global.asax that takes a language code and stick it in the url. I can trigger these routes using this code
<%= Html.ActionLink("Spanish", ViewContext.RouteData.Values["action"].ToString(), new { language = "es" })%>
This will give me a url that looks like :
ttp://localhost:2535/es
or
ttp://localhost:2535/es/Home/About
I want to combine these links! That means when a user clicks the first mentioned link
<a class="es-ES" href="javascript:void(0);">
<img src="/Content/images/Flags/flag_spain.png" alt="İspanyolca"/>español
</a>
,then I want the link to behave like it does already, but I also want the functionality of this code (the second link, which changes the url to reflect chosen language)
<%= Html.ActionLink("Spanish", ViewContext.RouteData.Values["action"].ToString(), new { language = "es" })%>
How do I do this.
Please note that it is the first link that is the (important one), since it triggers the actual language swift, and contains all the nice css formatting and even javascript.
I just want the functionality of the actionlink to be "triggered or put" inside of the first link.
Hope someone can help.
Thanks. | 0 |
11,351,023 | 07/05/2012 19:14:53 | 1,504,970 | 07/05/2012 19:10:46 | 1 | 0 | Cygwin Diff always returns exit code 57 | the Diff utility on my Cygwin always returns exit code of 57, no matter if files match, missmatch or do not exists.
I have installed diffutils successfully;
$ cygcheck -c diffutils
Cygwin Package Information
Package Version Status
diffutils 3.2-1 OK
$ which diff
/usr/bin/diff
| cygwin | diff | null | null | null | null | open | Cygwin Diff always returns exit code 57
===
the Diff utility on my Cygwin always returns exit code of 57, no matter if files match, missmatch or do not exists.
I have installed diffutils successfully;
$ cygcheck -c diffutils
Cygwin Package Information
Package Version Status
diffutils 3.2-1 OK
$ which diff
/usr/bin/diff
| 0 |
11,351,024 | 07/05/2012 19:14:53 | 396,987 | 07/08/2010 09:01:20 | 254 | 24 | Fetching the comment from Disqus | Currently I am using the Disqus in my Ruby on Rails App for the comment functionality.I've an article section so user comes and create various articles. And other user can see those articles and make comments on those.
So I want fetch the all comments made by a particular User lets say U1 for all the articles say A1,A2 ,A3.
So I can show those comments of User on the User profile section.
Thanks in advance.
GS | ruby-on-rails-3 | disqus | null | null | null | null | open | Fetching the comment from Disqus
===
Currently I am using the Disqus in my Ruby on Rails App for the comment functionality.I've an article section so user comes and create various articles. And other user can see those articles and make comments on those.
So I want fetch the all comments made by a particular User lets say U1 for all the articles say A1,A2 ,A3.
So I can show those comments of User on the User profile section.
Thanks in advance.
GS | 0 |
11,660,710 | 07/26/2012 00:29:29 | 845,248 | 07/14/2011 19:06:24 | 118 | 14 | CSS transition fade in | So I have used CSS transitions before but I have a unique case with this one. I am writing a custom plugin for creating modals. Essentially I create a div on the fly (document.createElement('div')) and append it to the body with a few classes. These classes define color and opacity. I would like to use strictly CSS to be able to fade in this div, but making the state change seems difficult b/c they require some user interaction.
Tried some advanced selectors hoping it would case a state change, tried media query hoping to change state...looking for any ideas and suggestions, I really want to keep this in CSS if possible | css | css3 | transition | null | null | null | open | CSS transition fade in
===
So I have used CSS transitions before but I have a unique case with this one. I am writing a custom plugin for creating modals. Essentially I create a div on the fly (document.createElement('div')) and append it to the body with a few classes. These classes define color and opacity. I would like to use strictly CSS to be able to fade in this div, but making the state change seems difficult b/c they require some user interaction.
Tried some advanced selectors hoping it would case a state change, tried media query hoping to change state...looking for any ideas and suggestions, I really want to keep this in CSS if possible | 0 |
11,660,713 | 07/26/2012 00:30:13 | 570,782 | 01/11/2011 04:36:28 | 80 | 1 | jquery select return both options when click not the most recent | my question may sound a little confusion, but i hope after reading this it will be a little more clearer.
html
<form id="form">
selected: <input type="text" name="opt" id="opt">
<ul id="list">
<li>car</li>
<li>bus</li>
<li>bike</li>
</ul>
<input type="submit" name="submit" value="submit">
</form>
jquery
$('#list li').click(function(){
var id= $(this).text();
$('#form').submit(function(){
alert(id);
});
});
when i select an option then select another before clicking submit, it alert one after the other, for eg if i click car then bike it alert bike then it flashes and the alert car. the aim is to only have it alert the final click or in other words the one that is the chosen option. so instead of alert both i want to alert bike since that was the final option | jquery | jquery-ui | null | null | null | null | open | jquery select return both options when click not the most recent
===
my question may sound a little confusion, but i hope after reading this it will be a little more clearer.
html
<form id="form">
selected: <input type="text" name="opt" id="opt">
<ul id="list">
<li>car</li>
<li>bus</li>
<li>bike</li>
</ul>
<input type="submit" name="submit" value="submit">
</form>
jquery
$('#list li').click(function(){
var id= $(this).text();
$('#form').submit(function(){
alert(id);
});
});
when i select an option then select another before clicking submit, it alert one after the other, for eg if i click car then bike it alert bike then it flashes and the alert car. the aim is to only have it alert the final click or in other words the one that is the chosen option. so instead of alert both i want to alert bike since that was the final option | 0 |
11,648,653 | 07/25/2012 11:26:43 | 1,522,590 | 07/13/2012 04:47:51 | 84 | 3 | solve equation,strange resule | here is my code to solve equation:
fx=function(x){ x^3-x-3}
solve=function(a,b,eps){
if(abs(fx(a))<0.00001) return(list(root=a,fun=fx(a)))
else if(abs(fx(b))<0.00001) return(list(root=b,fun=fx(b)))
else if (fx(a)*fx(b)>0) return(list(root="failed to find"))
if (a>b){
c<-a
a<-b
a<-b}
while( b-a>eps ){
x=(a+b)/2
if (fx(x)==0) {return(list(root=x,fun=fx(x))) }
else if (fx(a)*fx(x)<0) {b=x }
else {a=x}}
myroot=(a+b)/2
return(list(root=myroot,value=fx(myroot)))
}
> solve(1,3,1e-8)
$root
[1] 1.6717
$value
[1] 2.674228e-08
> fx(1.6717)
[1] 8.73813e-07
why fx(1.6717) != $value ,i want to know the reason
8.73813e-07!=2.674228e-08??
| r | null | null | null | null | null | open | solve equation,strange resule
===
here is my code to solve equation:
fx=function(x){ x^3-x-3}
solve=function(a,b,eps){
if(abs(fx(a))<0.00001) return(list(root=a,fun=fx(a)))
else if(abs(fx(b))<0.00001) return(list(root=b,fun=fx(b)))
else if (fx(a)*fx(b)>0) return(list(root="failed to find"))
if (a>b){
c<-a
a<-b
a<-b}
while( b-a>eps ){
x=(a+b)/2
if (fx(x)==0) {return(list(root=x,fun=fx(x))) }
else if (fx(a)*fx(x)<0) {b=x }
else {a=x}}
myroot=(a+b)/2
return(list(root=myroot,value=fx(myroot)))
}
> solve(1,3,1e-8)
$root
[1] 1.6717
$value
[1] 2.674228e-08
> fx(1.6717)
[1] 8.73813e-07
why fx(1.6717) != $value ,i want to know the reason
8.73813e-07!=2.674228e-08??
| 0 |
11,660,670 | 07/26/2012 00:25:21 | 1,388,084 | 05/10/2012 20:39:09 | 17 | 1 | how to resize the frame afte anevent happened? | I created a form to choose a database service such as SQL server and Oracle, and its version .then connect to it by clicking the Connect button....but before connection is made, some parameters should be set in order to place in URL...
jButton2 = new JButton();
getContentPane().add(jButton2);
jButton2.setText("Connect");
jButton2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
LinkedFrame inst = new LinkedFrame();
inst.setLocationRelativeTo(rootPane);
inst.setVisible(true);
}
});
}
this code is for the Connect button. LinkedFrame is a new form for gathering required information including DB name, Username and Password.this form is created as you click the button and disappears as you fill in the fields all and press enter...
this is the LinkedFrame code:
private class DatabaseSelectionHandler implements ActionListener{
public void actionPerformed(ActionEvent evt){
database=jTextField1.getText();
username=jTextField2.getText();
pass=new String(jPasswordField1.getPassword());
if(database.isEmpty() || username.isEmpty() || pass.isEmpty())
JOptionPane.showMessageDialog(null, "Please fill all fields", "Error", JOptionPane.ERROR_MESSAGE);
else
{ setVisible(false);
if (service.equalsIgnoreCase("sqlserver"))
Connector.MSSQLConnection(service);
else
Connector.ORACLEConnection(service);
}
}
}
now I have some questions:
1- I have used the Connector method in the linkedFrame event handler with static attributes for sharing between my classes...is there any other way to share these attributes?!!
2-I want to resize my main frame(not linkedframe) as soon as connection is made in order to make queries. how can it be coded?and where?
TNX a lot in advance for your help.
| java | events | resize | frame | null | null | open | how to resize the frame afte anevent happened?
===
I created a form to choose a database service such as SQL server and Oracle, and its version .then connect to it by clicking the Connect button....but before connection is made, some parameters should be set in order to place in URL...
jButton2 = new JButton();
getContentPane().add(jButton2);
jButton2.setText("Connect");
jButton2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
LinkedFrame inst = new LinkedFrame();
inst.setLocationRelativeTo(rootPane);
inst.setVisible(true);
}
});
}
this code is for the Connect button. LinkedFrame is a new form for gathering required information including DB name, Username and Password.this form is created as you click the button and disappears as you fill in the fields all and press enter...
this is the LinkedFrame code:
private class DatabaseSelectionHandler implements ActionListener{
public void actionPerformed(ActionEvent evt){
database=jTextField1.getText();
username=jTextField2.getText();
pass=new String(jPasswordField1.getPassword());
if(database.isEmpty() || username.isEmpty() || pass.isEmpty())
JOptionPane.showMessageDialog(null, "Please fill all fields", "Error", JOptionPane.ERROR_MESSAGE);
else
{ setVisible(false);
if (service.equalsIgnoreCase("sqlserver"))
Connector.MSSQLConnection(service);
else
Connector.ORACLEConnection(service);
}
}
}
now I have some questions:
1- I have used the Connector method in the linkedFrame event handler with static attributes for sharing between my classes...is there any other way to share these attributes?!!
2-I want to resize my main frame(not linkedframe) as soon as connection is made in order to make queries. how can it be coded?and where?
TNX a lot in advance for your help.
| 0 |
11,660,716 | 07/26/2012 00:30:53 | 1,515,679 | 07/10/2012 18:08:02 | 19 | 0 | trying to find "top n" but getting some errors with dates | Let's say I am trying to find the top 10 icecream flavors sold by a store starting from this month. My current query however only gives me the top ten flavors from 7/01
select *
from buy_history
where date > '2012-07-01 00:00:00'
group by flavor
order by max(purchase_count) desc
limit 10;
(yes apparently there can be multiple icecream purchases per millisecond.)
the table looks something like
buy_history(id, flavor, date, purchase_count) | mysql | null | null | null | null | null | open | trying to find "top n" but getting some errors with dates
===
Let's say I am trying to find the top 10 icecream flavors sold by a store starting from this month. My current query however only gives me the top ten flavors from 7/01
select *
from buy_history
where date > '2012-07-01 00:00:00'
group by flavor
order by max(purchase_count) desc
limit 10;
(yes apparently there can be multiple icecream purchases per millisecond.)
the table looks something like
buy_history(id, flavor, date, purchase_count) | 0 |
11,660,720 | 07/26/2012 00:31:17 | 1,553,146 | 07/26/2012 00:16:53 | 1 | 0 | ASP.Net 4 session data missing with Safari 5.1.5 | I am having a strange issue with Safari 5.1.5, I have an ASP.NET page (version 4) that is making use of a wziard control. On a particular step of the wizard I am collecting information, the user is required to click a link button which performs a postback and populates a datagrid on the same step of the Wizard.
The data is loaded into a dataset and the databind is working fine and information is displayed on the page. Along with this the dataset is loaded into a session object for use later in the wizard.
When the user is finished on this particular step the next button (on the wizard) is clicked and a check is performed to make sure that ample information is provided. This is done by retrieving the dataset from the session object and the relevant table is interrogated.
In Google Chrome, IE and Opera this works fine and the dataset is retrieved and the data exists. However in Safari 5.1.5 and Firefox 14 the dataset is empty. Exactly the same code is run for all browsers.
I have stepped through the code in using both Google and Safari and when in Safari the datatable of the dataset is empty even though it was used to populate the datagrid.
I though perhaps that the dataset was being corrupted before being loaded into the session object, but I have tested this by retrieving the dataset from the session immediately after is was assigned to the session variable and then serializing the dataset to XML. The XML file shows that the information was loaded into the datatable and into the session.
Has anyone seen behaviour like this before or have any suggestions as to where to go from here.
Thanks in advance
Glen. | asp.net | session | safari | null | null | null | open | ASP.Net 4 session data missing with Safari 5.1.5
===
I am having a strange issue with Safari 5.1.5, I have an ASP.NET page (version 4) that is making use of a wziard control. On a particular step of the wizard I am collecting information, the user is required to click a link button which performs a postback and populates a datagrid on the same step of the Wizard.
The data is loaded into a dataset and the databind is working fine and information is displayed on the page. Along with this the dataset is loaded into a session object for use later in the wizard.
When the user is finished on this particular step the next button (on the wizard) is clicked and a check is performed to make sure that ample information is provided. This is done by retrieving the dataset from the session object and the relevant table is interrogated.
In Google Chrome, IE and Opera this works fine and the dataset is retrieved and the data exists. However in Safari 5.1.5 and Firefox 14 the dataset is empty. Exactly the same code is run for all browsers.
I have stepped through the code in using both Google and Safari and when in Safari the datatable of the dataset is empty even though it was used to populate the datagrid.
I though perhaps that the dataset was being corrupted before being loaded into the session object, but I have tested this by retrieving the dataset from the session immediately after is was assigned to the session variable and then serializing the dataset to XML. The XML file shows that the information was loaded into the datatable and into the session.
Has anyone seen behaviour like this before or have any suggestions as to where to go from here.
Thanks in advance
Glen. | 0 |
11,660,721 | 07/26/2012 00:31:44 | 637,146 | 02/28/2011 04:34:11 | 327 | 19 | MySQL Function Returns Column Value | With the help of StackOverflow I have a MySQL query that works. After making a few changes it returns `zip` and `distance`. I been trying to make a Function to set parameters for the given lat and lng values and return the zip from the other table. However the query returns two values, I only need one.
SELECT loc.zip,(((ACOS(SIN((lat*PI()/180)) * SIN((`latitude`*PI()/180))+COS((lat*PI()/180)) * COS((`latitude`*pi()/180)) * COS(((lng - `longitude`)*PI()/180))))*180/PI())*60*1.1515) AS `distance` FROM geov1.zcta loc HAVING distance < 5 LIMIT 1;
So far this is what I have as my Function:
BEGIN
DECLARE lat VARCHAR(15);
DECLARE lng VARCHAR(15);
DECLARE zip BIGINT;
SET zip = SELECT loc.zip,(((ACOS(SIN((lat*PI()/180)) * SIN((`latitude`*PI()/180))+COS((lat*PI()/180)) * COS((`latitude`*pi()/180)) * COS(((lng - `longitude`)*PI()/180))))*180/PI())*60*1.1515) AS `distance` FROM geov1.zcta loc HAVING distance < 5 LIMIT 1;
RETURN zip;
END
This does not work, give me and error that there is some wrong in line 10 which is this:
`longitude`)*PI()/180))))*180/PI())*60*1.1515) AS `distance` FROM geov1.zcta loc HAVING distance < 5 LIMIT 1;
At this point I am at a loss, I just need to have the query return the zip with the given coordinates. Thank you for the help. | mysql | null | null | null | null | null | open | MySQL Function Returns Column Value
===
With the help of StackOverflow I have a MySQL query that works. After making a few changes it returns `zip` and `distance`. I been trying to make a Function to set parameters for the given lat and lng values and return the zip from the other table. However the query returns two values, I only need one.
SELECT loc.zip,(((ACOS(SIN((lat*PI()/180)) * SIN((`latitude`*PI()/180))+COS((lat*PI()/180)) * COS((`latitude`*pi()/180)) * COS(((lng - `longitude`)*PI()/180))))*180/PI())*60*1.1515) AS `distance` FROM geov1.zcta loc HAVING distance < 5 LIMIT 1;
So far this is what I have as my Function:
BEGIN
DECLARE lat VARCHAR(15);
DECLARE lng VARCHAR(15);
DECLARE zip BIGINT;
SET zip = SELECT loc.zip,(((ACOS(SIN((lat*PI()/180)) * SIN((`latitude`*PI()/180))+COS((lat*PI()/180)) * COS((`latitude`*pi()/180)) * COS(((lng - `longitude`)*PI()/180))))*180/PI())*60*1.1515) AS `distance` FROM geov1.zcta loc HAVING distance < 5 LIMIT 1;
RETURN zip;
END
This does not work, give me and error that there is some wrong in line 10 which is this:
`longitude`)*PI()/180))))*180/PI())*60*1.1515) AS `distance` FROM geov1.zcta loc HAVING distance < 5 LIMIT 1;
At this point I am at a loss, I just need to have the query return the zip with the given coordinates. Thank you for the help. | 0 |
11,660,722 | 07/26/2012 00:31:50 | 1,553,133 | 07/26/2012 00:06:02 | 1 | 0 | Can I grab Grails messages strings before returning the messages entry string and args? | Obviously simplified, but I'm attempting to build a string which I would pass into another messages.properties entry. For example, maybe I had entries that looked like this:
someField.sillyError.good=good
someField.sillyError.bad=bad
someField.validation.error=This has been a [{3}] morning
With validation that looked like this:
static constraints = {
someField(nullable: false, blank: false, validator: { val, obj ->
def someOtherEntry = g.message(code: 'someField.sillyError.' + val)
return ['someField.validation.error', someOtherEntry]
}
}
The call to `g.message()` doesn't work, and I can't seem to use anything else to get it either. | grails | grails-validation | null | null | null | null | open | Can I grab Grails messages strings before returning the messages entry string and args?
===
Obviously simplified, but I'm attempting to build a string which I would pass into another messages.properties entry. For example, maybe I had entries that looked like this:
someField.sillyError.good=good
someField.sillyError.bad=bad
someField.validation.error=This has been a [{3}] morning
With validation that looked like this:
static constraints = {
someField(nullable: false, blank: false, validator: { val, obj ->
def someOtherEntry = g.message(code: 'someField.sillyError.' + val)
return ['someField.validation.error', someOtherEntry]
}
}
The call to `g.message()` doesn't work, and I can't seem to use anything else to get it either. | 0 |
11,660,723 | 07/26/2012 00:31:55 | 216,524 | 11/22/2009 16:14:27 | 39 | 1 | How can I obtain a list of page posts including ghost/dark posts for a page? | The regular `https://graph.facebook.com/PAGE_ID/posts?access_token___` call just returns standard page posts. How can I include these? | api | facebook-graph-api | null | null | null | null | open | How can I obtain a list of page posts including ghost/dark posts for a page?
===
The regular `https://graph.facebook.com/PAGE_ID/posts?access_token___` call just returns standard page posts. How can I include these? | 0 |
11,660,718 | 07/26/2012 00:30:56 | 1,553,153 | 07/26/2012 00:24:46 | 1 | 0 | Can't getting links in google maps v3 to open marker infowindows | I have a problem getting links in google maps v3 to open marker infowindows.
Can anyone help with this please.
Code is here: http://pastebin.com/PgTtzdBq
Thanks | google-maps-api-3 | null | null | null | null | null | open | Can't getting links in google maps v3 to open marker infowindows
===
I have a problem getting links in google maps v3 to open marker infowindows.
Can anyone help with this please.
Code is here: http://pastebin.com/PgTtzdBq
Thanks | 0 |
11,734,734 | 07/31/2012 06:55:43 | 1,423,656 | 05/29/2012 12:16:36 | 44 | 2 | I have a race condition in my code | How do I know? Well the code works 8 out of 10 times, I don't know how can you help me but anyway I hope you can, code:
#pragma optimize( "", off )
#include <string>
#include <vector>
#include <ctime>
#include "utils/settings.h"
#include "utils/settings_handle.h"
#include "utils/newick_reader.h"
#include "utils/fasta_reader.h"
#include "utils/xml_writer.h"
#include "utils/model_factory.h"
#include "utils/evol_model.h"
#include "utils/optimal_reference.h"
#include "utils/log_output.h"
#include "main/node.h"
#include "main/reads_aligner.h"
#include "utils/text_utils.h"
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <iterator>
#include <algorithm>
#include <deque>
Includes.
int THREADS = boost::thread::hardware_concurrency();
using namespace std;
using namespace ppa;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > wait;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > running_jobs;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > dups;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > done;
deque<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > deque_wait;
deque<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > deque_run;
deque<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > deque_done;
int nodes_count = 0;
boost::mutex result_mutex;
boost::thread_group g;
boost::condition cond;
int n = 1;
Globals.
Function to get the tuples:
void find_tuples(ppa::Node* parent, ppa::Node* &root) {
ppa::Node *current = root;
parent = current;
queue < boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> > tuplets;
int i = 0;
if (current->has_left_child() != false) {
cout << parent->get_name() << " " << parent->left_child->get_name() << " " <<
parent->right_child->get_name() << endl;
if (parent->left_child->get_name().find("#") != string::npos || parent->right_child-
>get_name().find("#") != string::npos) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, false);
dups.push_back(test);
} else {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, true);
dups.push_back(test);
}
Space:
find_tuples(parent, current->left_child);
}
if (current->has_right_child() != false) {
cout << parent->get_name() << " " << parent->left_child->get_name() << " " <<
parent->right_child->get_name() << endl;
if (parent->left_child->get_name().find("#") != string::npos || parent->right_child-
>get_name().find("#") != string::npos) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, false);
dups.push_back(test);
} else {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, true);
dups.push_back(test);
}
find_tuples(parent, current->right_child);
}
}
Nothing:
bool myfunction(int i, int j) {
return (i < j);
}
Function that helps me check which tuples are in deque done and checks which ones matches deque wait:
bool tuple_compare(boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool>
&tuple_from_done) {
for (int i = 0; i < deque_wait.size(); i++) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple_from_wait =
deque_wait.at(i);
ppa::Node *father = boost::get < 0 > (tuple_from_wait);
ppa::Node *son = boost::get < 0 > (tuple_from_wait);
ppa::Node *second_son = boost::get < 2 > (tuple_from_wait);
bool has_seq = boost::get < 3 > (tuple_from_wait);
cout << "checking this two " << boost::get < 1 > (tuple_from_wait)->get_name() << " bool sequence "
<< boost::get < 1 > (tuple_from_wait)->node_has_sequence_object << " and this "
<< boost::get < 2 > (tuple_from_wait)->get_name() << " bool seq " << boost::get < 2 > (tuple_from_wait)->node_has_sequence_object
<< " with " << boost::get < 0 > (tuple_from_done)->get_name() << endl;
if (boost::get < 0 > (tuple_from_done)->get_name() == boost::get < 1 > (tuple_from_wait)->get_name()
|| boost::get < 0 > (tuple_from_done)->get_name() == boost::get < 2 > (tuple_from_wait)->get_name()) {
cout << " found in here this we need to check if there is something if the sons have a sequences!!!! " << endl;
if (boost::get < 1 > (tuple_from_wait)->node_has_sequence_object == true && boost::get < 2 > (tuple_from_wait)->node_has_sequence_object == true) {
cout << " ding, ding, we have one ready!!!" << endl;
deque_run.push_back(tuple_from_wait);
deque_wait.erase(deque_wait.begin() + i);
return true;
Space:
} else {
cout << "not ready yet" << endl;
return false;
}
} else {
cout << " " << endl;
}
}
return false;
}
Function that starts the threads
void threaded_function(Model_factory &mf, ppa::Node *root) {
try {
while (true) {
result_mutex.lock();
if (deque_wait.empty()) {
cout << "is empty we are done" << endl; //this thread is done
if (!deque_run.empty()) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple_run = deque_run.back();
deque_run.pop_back();
ppa::Node* father = boost::get < 0 > (tuple_run);
ppa::Node* first_son = boost::get < 1 > (tuple_run);
ppa::Node* second_son = boost::get < 2 > (tuple_run);
bool check = boost::get < 3 > (tuple_run);
father->start_alignment_new(&mf);
father->node_has_sequence_object = true;
first_son->node_has_sequence_object = true;
second_son->node_has_sequence_object = true;
Space:
cout << "this aligmnet done" << father->get_name() << " " << first_son->get_name()
<< " " << second_son->get_name() << endl;
deque_done.push_back(tuple_run);
}
result_mutex.unlock();
break;
} else {
if (deque_run.empty()) {
cout << "nothing is running and there is nothing to run check the done for the new " << endl; // check done deque
for (int i = 0; i < deque_done.size(); i++) {
tuple_compare(deque_done.at(i));
result_mutex.unlock();
}
} else {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple_run = deque_run.back();
Space:
deque_run.pop_back();
result_mutex.unlock();
ppa::Node* father = boost::get < 0 > (tuple_run);
ppa::Node* first_son = boost::get < 1 > (tuple_run);
ppa::Node* second_son = boost::get < 2 > (tuple_run);
bool check = boost::get < 3 > (tuple_run);
father->start_alignment_new(&mf);
father->node_has_sequence_object = true;
first_son->node_has_sequence_object = true;
second_son->node_has_sequence_object = true;
result_mutex.lock();
cout << "this aligmnet done" << father->get_name() << " " << first_son->get_name()
<< " " << second_son->get_name() << endl;
deque_done.push_back(tuple_run);
result_mutex.unlock();
}
}
}
} catch (boost::lock_error& le) {
cout << le.what() << endl;
}
}
So I will tell you what I'm doing, first I need to find the tuples that have a father and two sons, if the two sons have a sequence they go to the deque run otherwise they go to wait, then it align the run, put it in done and check the wait to see where is it in wait as a son, check if the other son has a sequence, if it has it aligns them and so on until there are no more waiting, but I don't know where could it be the race cond. because i have a mutex blocking any read or write for the queues, I hope is clear to check it, thanks. | c++ | multithreading | boost | race-condition | null | 07/31/2012 08:12:55 | too localized | I have a race condition in my code
===
How do I know? Well the code works 8 out of 10 times, I don't know how can you help me but anyway I hope you can, code:
#pragma optimize( "", off )
#include <string>
#include <vector>
#include <ctime>
#include "utils/settings.h"
#include "utils/settings_handle.h"
#include "utils/newick_reader.h"
#include "utils/fasta_reader.h"
#include "utils/xml_writer.h"
#include "utils/model_factory.h"
#include "utils/evol_model.h"
#include "utils/optimal_reference.h"
#include "utils/log_output.h"
#include "main/node.h"
#include "main/reads_aligner.h"
#include "utils/text_utils.h"
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <iterator>
#include <algorithm>
#include <deque>
Includes.
int THREADS = boost::thread::hardware_concurrency();
using namespace std;
using namespace ppa;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > wait;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > running_jobs;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > dups;
vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > done;
deque<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > deque_wait;
deque<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > deque_run;
deque<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > deque_done;
int nodes_count = 0;
boost::mutex result_mutex;
boost::thread_group g;
boost::condition cond;
int n = 1;
Globals.
Function to get the tuples:
void find_tuples(ppa::Node* parent, ppa::Node* &root) {
ppa::Node *current = root;
parent = current;
queue < boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> > tuplets;
int i = 0;
if (current->has_left_child() != false) {
cout << parent->get_name() << " " << parent->left_child->get_name() << " " <<
parent->right_child->get_name() << endl;
if (parent->left_child->get_name().find("#") != string::npos || parent->right_child-
>get_name().find("#") != string::npos) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, false);
dups.push_back(test);
} else {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, true);
dups.push_back(test);
}
Space:
find_tuples(parent, current->left_child);
}
if (current->has_right_child() != false) {
cout << parent->get_name() << " " << parent->left_child->get_name() << " " <<
parent->right_child->get_name() << endl;
if (parent->left_child->get_name().find("#") != string::npos || parent->right_child-
>get_name().find("#") != string::npos) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, false);
dups.push_back(test);
} else {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> test =
boost::make_tuple(parent, parent->left_child, parent->right_child, true);
dups.push_back(test);
}
find_tuples(parent, current->right_child);
}
}
Nothing:
bool myfunction(int i, int j) {
return (i < j);
}
Function that helps me check which tuples are in deque done and checks which ones matches deque wait:
bool tuple_compare(boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool>
&tuple_from_done) {
for (int i = 0; i < deque_wait.size(); i++) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple_from_wait =
deque_wait.at(i);
ppa::Node *father = boost::get < 0 > (tuple_from_wait);
ppa::Node *son = boost::get < 0 > (tuple_from_wait);
ppa::Node *second_son = boost::get < 2 > (tuple_from_wait);
bool has_seq = boost::get < 3 > (tuple_from_wait);
cout << "checking this two " << boost::get < 1 > (tuple_from_wait)->get_name() << " bool sequence "
<< boost::get < 1 > (tuple_from_wait)->node_has_sequence_object << " and this "
<< boost::get < 2 > (tuple_from_wait)->get_name() << " bool seq " << boost::get < 2 > (tuple_from_wait)->node_has_sequence_object
<< " with " << boost::get < 0 > (tuple_from_done)->get_name() << endl;
if (boost::get < 0 > (tuple_from_done)->get_name() == boost::get < 1 > (tuple_from_wait)->get_name()
|| boost::get < 0 > (tuple_from_done)->get_name() == boost::get < 2 > (tuple_from_wait)->get_name()) {
cout << " found in here this we need to check if there is something if the sons have a sequences!!!! " << endl;
if (boost::get < 1 > (tuple_from_wait)->node_has_sequence_object == true && boost::get < 2 > (tuple_from_wait)->node_has_sequence_object == true) {
cout << " ding, ding, we have one ready!!!" << endl;
deque_run.push_back(tuple_from_wait);
deque_wait.erase(deque_wait.begin() + i);
return true;
Space:
} else {
cout << "not ready yet" << endl;
return false;
}
} else {
cout << " " << endl;
}
}
return false;
}
Function that starts the threads
void threaded_function(Model_factory &mf, ppa::Node *root) {
try {
while (true) {
result_mutex.lock();
if (deque_wait.empty()) {
cout << "is empty we are done" << endl; //this thread is done
if (!deque_run.empty()) {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple_run = deque_run.back();
deque_run.pop_back();
ppa::Node* father = boost::get < 0 > (tuple_run);
ppa::Node* first_son = boost::get < 1 > (tuple_run);
ppa::Node* second_son = boost::get < 2 > (tuple_run);
bool check = boost::get < 3 > (tuple_run);
father->start_alignment_new(&mf);
father->node_has_sequence_object = true;
first_son->node_has_sequence_object = true;
second_son->node_has_sequence_object = true;
Space:
cout << "this aligmnet done" << father->get_name() << " " << first_son->get_name()
<< " " << second_son->get_name() << endl;
deque_done.push_back(tuple_run);
}
result_mutex.unlock();
break;
} else {
if (deque_run.empty()) {
cout << "nothing is running and there is nothing to run check the done for the new " << endl; // check done deque
for (int i = 0; i < deque_done.size(); i++) {
tuple_compare(deque_done.at(i));
result_mutex.unlock();
}
} else {
boost::tuple < ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple_run = deque_run.back();
Space:
deque_run.pop_back();
result_mutex.unlock();
ppa::Node* father = boost::get < 0 > (tuple_run);
ppa::Node* first_son = boost::get < 1 > (tuple_run);
ppa::Node* second_son = boost::get < 2 > (tuple_run);
bool check = boost::get < 3 > (tuple_run);
father->start_alignment_new(&mf);
father->node_has_sequence_object = true;
first_son->node_has_sequence_object = true;
second_son->node_has_sequence_object = true;
result_mutex.lock();
cout << "this aligmnet done" << father->get_name() << " " << first_son->get_name()
<< " " << second_son->get_name() << endl;
deque_done.push_back(tuple_run);
result_mutex.unlock();
}
}
}
} catch (boost::lock_error& le) {
cout << le.what() << endl;
}
}
So I will tell you what I'm doing, first I need to find the tuples that have a father and two sons, if the two sons have a sequence they go to the deque run otherwise they go to wait, then it align the run, put it in done and check the wait to see where is it in wait as a son, check if the other son has a sequence, if it has it aligns them and so on until there are no more waiting, but I don't know where could it be the race cond. because i have a mutex blocking any read or write for the queues, I hope is clear to check it, thanks. | 3 |
11,734,736 | 07/31/2012 06:55:48 | 1,433,268 | 06/03/2012 07:21:15 | 183 | 15 | ModX: Resource Content box not appearing when editing resource | I went to edit a page on my ModX Evo site and cannot access any of the content in my resource. The box 'Resource Content', that usually holds TinyMCE is not appearing at all. I have tried on multiple browsers and even another machine, but it is just not appearing.
Does anyone know how to fix this at all? | modx | modx-evolution | null | null | null | null | open | ModX: Resource Content box not appearing when editing resource
===
I went to edit a page on my ModX Evo site and cannot access any of the content in my resource. The box 'Resource Content', that usually holds TinyMCE is not appearing at all. I have tried on multiple browsers and even another machine, but it is just not appearing.
Does anyone know how to fix this at all? | 0 |
11,734,737 | 07/31/2012 06:55:48 | 932,219 | 09/07/2011 07:41:17 | 3 | 2 | get tree structure data from mysql | i am using mysql,
problem is , i have a group id like '101' and i want to get all device id's which is under his account and also those id's which are under its sub groups
for eg: if group id is 101: then
device_id should be
1. 44444
2. 33333
3. 55555
Table : Groups --------------------------------------------------------------------------------------
group_id | parent_id | group_name
--------------------------------------------------------------------------------------
101 | null | matrix
102 | 101 | sub_matrix1
103 | 101 | sub_matrix2
104 | null | abc
105 | 104 | sub_abc
106 | null | mega
---------------------------------------------------------------------------------------
Table : Devices
--------------------------------------------------------------------------------------
device_id | group_id | device_name
--------------------------------------------------------------------------------------
44444 | 101 | m1
33333 | 101 | m1
22222 | 102 | m1
55555 | 103 | m1
88888 | 104 | m1
---------------------------------------------------------------------------------------
| mysql | query | null | null | null | null | open | get tree structure data from mysql
===
i am using mysql,
problem is , i have a group id like '101' and i want to get all device id's which is under his account and also those id's which are under its sub groups
for eg: if group id is 101: then
device_id should be
1. 44444
2. 33333
3. 55555
Table : Groups --------------------------------------------------------------------------------------
group_id | parent_id | group_name
--------------------------------------------------------------------------------------
101 | null | matrix
102 | 101 | sub_matrix1
103 | 101 | sub_matrix2
104 | null | abc
105 | 104 | sub_abc
106 | null | mega
---------------------------------------------------------------------------------------
Table : Devices
--------------------------------------------------------------------------------------
device_id | group_id | device_name
--------------------------------------------------------------------------------------
44444 | 101 | m1
33333 | 101 | m1
22222 | 102 | m1
55555 | 103 | m1
88888 | 104 | m1
---------------------------------------------------------------------------------------
| 0 |
11,734,738 | 07/31/2012 06:55:54 | 606,009 | 02/07/2011 06:19:56 | 1 | 0 | create base dn using jndi | I am creating the basedn in openDJ using JNDI but i am getting the below error.
javax.naming.NameNotFoundException: [LDAP: error code 32 - The provided entry dc=naren,dc=naren cannot be added because its suffix is not defined as one of the suffixes within the Directory Server]; remaining name 'dc=naren,dc=naren'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3057)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2978)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2785)
at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:801)
Code i am using is :
Attribute objclass = new BasicAttribute("objectclass");
objclass.add("ds-cfg-root-dn-user");
attrs.put("dn","ds-cfg-backend-id=userRoot,cn=Backends,cn=config");
ctx.createSubcontext("dc=naren,dc=naren");
ctx.close(); | java | null | null | null | null | null | open | create base dn using jndi
===
I am creating the basedn in openDJ using JNDI but i am getting the below error.
javax.naming.NameNotFoundException: [LDAP: error code 32 - The provided entry dc=naren,dc=naren cannot be added because its suffix is not defined as one of the suffixes within the Directory Server]; remaining name 'dc=naren,dc=naren'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3057)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2978)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2785)
at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:801)
Code i am using is :
Attribute objclass = new BasicAttribute("objectclass");
objclass.add("ds-cfg-root-dn-user");
attrs.put("dn","ds-cfg-backend-id=userRoot,cn=Backends,cn=config");
ctx.createSubcontext("dc=naren,dc=naren");
ctx.close(); | 0 |
11,734,743 | 07/31/2012 06:56:16 | 1,528,534 | 07/16/2012 10:04:30 | 3 | 0 | emberjs array binding not auto update | I try to bind a array from another array's change. but it not work.
The test.js code like this:
var App = Em.Application.create();
Item = Ember.Object.extend({
name: null
});
CompareItem = Ember.Object.extend({
i: null,
j: null
});
Row = Ember.Object.extend({
title: null,
tds: []
});
// see emberjs.com/documention "changes in arrays"
App.Items = Ember.Object.create({
items: [
Item.create({name: "01"})
,Item.create({name: "02"})
,Item.create({name: "03"})
],
compareItems: function() {
var tdItems = [];
var items = this.get('items');
items.forEach(function(left, i, lself) {
var cprItems = [];
items.forEach(function(right, j, rself) {
var compareItem = null;
compareItem = CompareItem.create({
i: i,
j: j
});
cprItems[j] = compareItem;
});
var row = Row.create({
title: "["+i+"]",
tds: cprItems
});
tdItems[i] = row;
});
return tdItems;
}.property('items.@each')
});
App.Input = Em.TextField.extend({
change: function(evt){
var items = this.value.split(" ");
items.forEach(function(item, index, all) {
if ($.trim(item)!=""){
var it = Item.create({name: item});
App.Items.get("items").pushObject(it);
}
});
}
});
App.Table = Em.View.extend({
templateName: 'bsc-table',
items: App.Items.get("items")
});
App.EditTr = Em.View.extend({
compareItems: App.Items.get("compareItems")
});
App.EditTh = Em.View.extend({
});
App.EditTd = Em.View.extend({
});
// Em.run.sync();
var bsctable = App.Table.create();
bsctable.app
The html code like this:
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="ie6"> <![endif]--> <!--[if IE 7 ]> <html lang="en" class="ie7"> <![endif]--> <!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9 ]> <html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="stylesheet" href="css/style.css?v=2">
<style type="text/css">
.border-table {
border: 1px solid #960; border-collapse: collapse;
}
.border-table th,td {
border: 1px solid #960; border-collapse: collapse; padding: 5px;
}
.txtInput {width:50px;}
</style>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/x-handlebars" data-template-name="bsc-table">
<table class="border-table">
<thead>
<tr>
<th>items</th>
{{#each items}}
<th>
{{name}}
</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#view App.EditTr}}
{{#each compareItems}}
<tr>
{{#view App.EditTh itemTrBinding="this"}}
<th>
[{{itemTr.title}}]
</th>
{{#each itemTr.tds}}
{{#view App.EditTd itemTdBinding="this"}}
<td>
[{{itemTd.i}}]
[{{itemTd.j}}]
</td>
{{/view}}
{{/each}}
{{/view}}
</tr>
{{/each}}
{{/view}}
</tbody>
</table>
</script>
</head>
<body>
<script type="text/x-handlebars">
{{#view App.Input}}{{/view}}
</script>
<script src="js/libs/jquery-1.7.2.min.js"></script>
<script src="js/libs/ember-0.9.8.1.min.js"></script>
<script src="js/test.js"></script>
</body>
</html>
then, If you type "04 05 06" into the text field, except that table will be 6*6, but now it is not. like that compareItems is a new one every time, but the table use the old one when the items changed. how to solve this? | arrays | binding | emberjs | null | null | null | open | emberjs array binding not auto update
===
I try to bind a array from another array's change. but it not work.
The test.js code like this:
var App = Em.Application.create();
Item = Ember.Object.extend({
name: null
});
CompareItem = Ember.Object.extend({
i: null,
j: null
});
Row = Ember.Object.extend({
title: null,
tds: []
});
// see emberjs.com/documention "changes in arrays"
App.Items = Ember.Object.create({
items: [
Item.create({name: "01"})
,Item.create({name: "02"})
,Item.create({name: "03"})
],
compareItems: function() {
var tdItems = [];
var items = this.get('items');
items.forEach(function(left, i, lself) {
var cprItems = [];
items.forEach(function(right, j, rself) {
var compareItem = null;
compareItem = CompareItem.create({
i: i,
j: j
});
cprItems[j] = compareItem;
});
var row = Row.create({
title: "["+i+"]",
tds: cprItems
});
tdItems[i] = row;
});
return tdItems;
}.property('items.@each')
});
App.Input = Em.TextField.extend({
change: function(evt){
var items = this.value.split(" ");
items.forEach(function(item, index, all) {
if ($.trim(item)!=""){
var it = Item.create({name: item});
App.Items.get("items").pushObject(it);
}
});
}
});
App.Table = Em.View.extend({
templateName: 'bsc-table',
items: App.Items.get("items")
});
App.EditTr = Em.View.extend({
compareItems: App.Items.get("compareItems")
});
App.EditTh = Em.View.extend({
});
App.EditTd = Em.View.extend({
});
// Em.run.sync();
var bsctable = App.Table.create();
bsctable.app
The html code like this:
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="ie6"> <![endif]--> <!--[if IE 7 ]> <html lang="en" class="ie7"> <![endif]--> <!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9 ]> <html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="stylesheet" href="css/style.css?v=2">
<style type="text/css">
.border-table {
border: 1px solid #960; border-collapse: collapse;
}
.border-table th,td {
border: 1px solid #960; border-collapse: collapse; padding: 5px;
}
.txtInput {width:50px;}
</style>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/x-handlebars" data-template-name="bsc-table">
<table class="border-table">
<thead>
<tr>
<th>items</th>
{{#each items}}
<th>
{{name}}
</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#view App.EditTr}}
{{#each compareItems}}
<tr>
{{#view App.EditTh itemTrBinding="this"}}
<th>
[{{itemTr.title}}]
</th>
{{#each itemTr.tds}}
{{#view App.EditTd itemTdBinding="this"}}
<td>
[{{itemTd.i}}]
[{{itemTd.j}}]
</td>
{{/view}}
{{/each}}
{{/view}}
</tr>
{{/each}}
{{/view}}
</tbody>
</table>
</script>
</head>
<body>
<script type="text/x-handlebars">
{{#view App.Input}}{{/view}}
</script>
<script src="js/libs/jquery-1.7.2.min.js"></script>
<script src="js/libs/ember-0.9.8.1.min.js"></script>
<script src="js/test.js"></script>
</body>
</html>
then, If you type "04 05 06" into the text field, except that table will be 6*6, but now it is not. like that compareItems is a new one every time, but the table use the old one when the items changed. how to solve this? | 0 |
11,734,745 | 07/31/2012 06:56:21 | 527,590 | 12/02/2010 06:21:07 | 212 | 24 | Camel Spring-WS. Setting custom SOAP header | I have configured Camel SOAP proxy service using Spring DSL. Everything was working nice untill I found that I need to set a custom header inside <soapenv:Header/> for SOAP response message.
I am using spring-ws component and latest Camel 2.10.0.
Here is an example of my spring route (I skipped some irrelevant transformations):
<bean id="ahc_binding" class="ru.fabit.ExampleAHCBinding"/>
<bean id="response_assembler" class="ru.fabit.ExampleResponseAssembler"/>
<camel:camelContext id="get_regions">
<camel:dataFormats>
<camel:jaxb id="main_jaxb" prettyPrint="true"
contextPath="ru.fabit.rosstelecom.webservice.models.smev" />
</camel:dataFormats>
<camel:route>
<camel:from uri="spring-ws:rootqname:{http://fabit.ru/service}getRegionsRequest?endpointMapping=#endpointMapping"/>
<camel:unmarshal ref="main_jaxb"/>
<camel:to uri="ahc:http://localhost:9001/service/regions"/>
<camel:unmarshal ref="main_jaxb"/>
<camel:process ref="response_assembler"/>
</camel:route>
</camel:camelContext>
And here is the code for ExampleResponseAssembler.java ("response_assembler" bean). It is the last element in the route. And it's responsibility to get unmarshalled response object from some external service (from AHC component, actually) and assemble the proper SOAP response for overall route.
public class ExampleResponseAssembler implements Processor {
@Override
public void process(final Exchange exchange) throws Exception {
final Object responseMessage = exchange.getIn().getBody();
final GetRegionsResponse regionsResponse = new GetRegionsResponse();
final MessageDataType messageData = new MessageDataType();
final AppDataType appData = new AppDataType();
appData.setAny(responseMessage);
messageData.setAppData(appData);
regionsResponse.setMessageData(messageData);
exchange.getOut().setBody(regionsResponse);
final HeaderType header = exchange.getProperty("exampleHeader", HeaderType.class);
exchange.getOut().setHeader("CamelSpringWebServiceSoapHeader", header);
}
}
When I set the Body that way it is parsed correctly. I can see it in SaopUI. But header is not there. That was a naive approach to set the SOAP header I guess.
And I can't find any relevant info about this.
Although I was able to find some JIRA tickets regarding this problem - [link][1], it is still unclear how to handle with setting some custom SOAP headers. And ticket is marked as "unresolved"
Maybe I need some override voodoo magick here (override MessageFactory, MessageSender or something else). Seems like a minor issue, but...
[1]: https://issues.apache.org/jira/browse/CAMEL-4515 | java | soap | header | apache-camel | spring-ws | null | open | Camel Spring-WS. Setting custom SOAP header
===
I have configured Camel SOAP proxy service using Spring DSL. Everything was working nice untill I found that I need to set a custom header inside <soapenv:Header/> for SOAP response message.
I am using spring-ws component and latest Camel 2.10.0.
Here is an example of my spring route (I skipped some irrelevant transformations):
<bean id="ahc_binding" class="ru.fabit.ExampleAHCBinding"/>
<bean id="response_assembler" class="ru.fabit.ExampleResponseAssembler"/>
<camel:camelContext id="get_regions">
<camel:dataFormats>
<camel:jaxb id="main_jaxb" prettyPrint="true"
contextPath="ru.fabit.rosstelecom.webservice.models.smev" />
</camel:dataFormats>
<camel:route>
<camel:from uri="spring-ws:rootqname:{http://fabit.ru/service}getRegionsRequest?endpointMapping=#endpointMapping"/>
<camel:unmarshal ref="main_jaxb"/>
<camel:to uri="ahc:http://localhost:9001/service/regions"/>
<camel:unmarshal ref="main_jaxb"/>
<camel:process ref="response_assembler"/>
</camel:route>
</camel:camelContext>
And here is the code for ExampleResponseAssembler.java ("response_assembler" bean). It is the last element in the route. And it's responsibility to get unmarshalled response object from some external service (from AHC component, actually) and assemble the proper SOAP response for overall route.
public class ExampleResponseAssembler implements Processor {
@Override
public void process(final Exchange exchange) throws Exception {
final Object responseMessage = exchange.getIn().getBody();
final GetRegionsResponse regionsResponse = new GetRegionsResponse();
final MessageDataType messageData = new MessageDataType();
final AppDataType appData = new AppDataType();
appData.setAny(responseMessage);
messageData.setAppData(appData);
regionsResponse.setMessageData(messageData);
exchange.getOut().setBody(regionsResponse);
final HeaderType header = exchange.getProperty("exampleHeader", HeaderType.class);
exchange.getOut().setHeader("CamelSpringWebServiceSoapHeader", header);
}
}
When I set the Body that way it is parsed correctly. I can see it in SaopUI. But header is not there. That was a naive approach to set the SOAP header I guess.
And I can't find any relevant info about this.
Although I was able to find some JIRA tickets regarding this problem - [link][1], it is still unclear how to handle with setting some custom SOAP headers. And ticket is marked as "unresolved"
Maybe I need some override voodoo magick here (override MessageFactory, MessageSender or something else). Seems like a minor issue, but...
[1]: https://issues.apache.org/jira/browse/CAMEL-4515 | 0 |
11,734,308 | 07/31/2012 06:24:45 | 1,201,160 | 02/10/2012 03:09:27 | 106 | 5 | footer for gridview | i have a gridView and i generate the data of column[6] by myself using code behind.
by looking at the code below, i have a footer for my gridview. and the problem is my text for column[6] won't appear if i use footer. if i delete the footertext code, then my text for column[6] is appear. what is the problem? both of the code cant use togather? i already set ShowFooter="True"
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < (this.GridView1.Rows.Count); i++)
{
this.GridView1.Rows[i].Cells[6].Text = "testing";
//GridView1.Columns[1].FooterText ="footer 1";
}
} | gridview | footer | null | null | null | null | open | footer for gridview
===
i have a gridView and i generate the data of column[6] by myself using code behind.
by looking at the code below, i have a footer for my gridview. and the problem is my text for column[6] won't appear if i use footer. if i delete the footertext code, then my text for column[6] is appear. what is the problem? both of the code cant use togather? i already set ShowFooter="True"
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < (this.GridView1.Rows.Count); i++)
{
this.GridView1.Rows[i].Cells[6].Text = "testing";
//GridView1.Columns[1].FooterText ="footer 1";
}
} | 0 |
11,734,309 | 07/31/2012 06:24:47 | 1,400,565 | 05/17/2012 09:08:18 | 78 | 3 | delete file from jetty server using java 7 | I am working on web application which is running on jetty server.
In this application I am uploading and image and use this image in my jsp page.
Now when I want to delete it using
Files.delete(File Path)
It gives me error
java.nio.file.FileSystemException: "File Path": The process cannot access the fi
le because it is being used by another process. | java | jetty | java-7 | null | null | null | open | delete file from jetty server using java 7
===
I am working on web application which is running on jetty server.
In this application I am uploading and image and use this image in my jsp page.
Now when I want to delete it using
Files.delete(File Path)
It gives me error
java.nio.file.FileSystemException: "File Path": The process cannot access the fi
le because it is being used by another process. | 0 |
11,734,749 | 07/31/2012 06:56:40 | 741,162 | 05/06/2011 05:55:00 | 111 | 0 | Is there a good CMS framework that easy to develop and maintenance? | I'm a developer, sometimes my friends ask me to make a site for them, maybe that's not complicated or only a few data process functions. But even a tiny function requires time to develop, test and maintenance. And as I'm a background developer, even the function works, it's always ugly :(, they don't like it.
Before I ask this, I tried Spring-roo, it's an amazing tool. By creating a business entity, all the codes from view layer to persistence layer are generated. But the same problem, UI works embarrassed me.
So my question is, is there a good CMS framework(.net or java based is preferred) that easy to develop and maintenance? Sometimes I only need a login area in the middle of main page, after logged in, users click on the left navigator to choose the function and right main page show the datalist or provide functions. I need such a tool, can anyone help? Thanks | java | .net | frameworks | content-management-system | null | 08/01/2012 07:50:45 | not constructive | Is there a good CMS framework that easy to develop and maintenance?
===
I'm a developer, sometimes my friends ask me to make a site for them, maybe that's not complicated or only a few data process functions. But even a tiny function requires time to develop, test and maintenance. And as I'm a background developer, even the function works, it's always ugly :(, they don't like it.
Before I ask this, I tried Spring-roo, it's an amazing tool. By creating a business entity, all the codes from view layer to persistence layer are generated. But the same problem, UI works embarrassed me.
So my question is, is there a good CMS framework(.net or java based is preferred) that easy to develop and maintenance? Sometimes I only need a login area in the middle of main page, after logged in, users click on the left navigator to choose the function and right main page show the datalist or provide functions. I need such a tool, can anyone help? Thanks | 4 |
11,734,752 | 07/31/2012 06:56:45 | 1,191,841 | 02/06/2012 08:27:09 | 1,153 | 73 | Add after event listener in configuration | I know it is possible to add listeners to events that fire after the event has fired like this:
oDocumentCategories.addAfterListener("activeitemchange", function(oContainer, sValue, oldValue){
//Do stuff here
});
But is it also possible to attach them whilst creating the elements?
Just like this:
var oButton = Ext.create("Ext.Button", {
text: "Button",
listeners: {
tap: function(){
//Tap event here
}
}
});
But only then for an after listener. | events | configuration | sencha-touch-2 | event-listeners | null | null | open | Add after event listener in configuration
===
I know it is possible to add listeners to events that fire after the event has fired like this:
oDocumentCategories.addAfterListener("activeitemchange", function(oContainer, sValue, oldValue){
//Do stuff here
});
But is it also possible to attach them whilst creating the elements?
Just like this:
var oButton = Ext.create("Ext.Button", {
text: "Button",
listeners: {
tap: function(){
//Tap event here
}
}
});
But only then for an after listener. | 0 |
11,734,754 | 07/31/2012 06:57:02 | 1,450,352 | 06/12/2012 04:59:33 | 1 | 0 | Facebook Comment box below each post for facebook application | Im creating a forum applicationon facebook where users can post a query and it is answerd by some experts.
below each query a facebook coment box has to appear.now the problem is that the comments in all the boxes are the same.
how do i have separate comment boxes for each query??
my code for the page is below
while ($row = mysql_fetch_assoc($query)) {echo '<tr>
<td> </td> <td>
<fb:comments data-href="http://opensocial.ignitee.com/fbtabs/thomascook/customer_care/index.php?post_id={$row["question_id"]}" num_posts="20" width="680"></fb:comments>
</td></tr>';}
Thanks
| facebook | facebook-comments | forums | null | null | null | open | Facebook Comment box below each post for facebook application
===
Im creating a forum applicationon facebook where users can post a query and it is answerd by some experts.
below each query a facebook coment box has to appear.now the problem is that the comments in all the boxes are the same.
how do i have separate comment boxes for each query??
my code for the page is below
while ($row = mysql_fetch_assoc($query)) {echo '<tr>
<td> </td> <td>
<fb:comments data-href="http://opensocial.ignitee.com/fbtabs/thomascook/customer_care/index.php?post_id={$row["question_id"]}" num_posts="20" width="680"></fb:comments>
</td></tr>';}
Thanks
| 0 |
11,734,757 | 07/31/2012 06:57:33 | 648,368 | 03/07/2011 15:19:06 | 339 | 43 | Implementing INotfyPropertyChanged for calculated properties | i am a bit new to MVVM, and was wondering
lets say i have defined `ObservableCollection<Differences> Diffs`
i also have a property such
public bool IsSame
{
get
{
return Diffs.Count == 0;
}
}
but i dont get how i suppose to implement the OnPropertyChanged for IsSame...
because it is implicit from the Diff List...
- should i attach to the List `OnCollectionChanged` Event and then check if it changes `IsSame` ?
- should i use a backing field anyway and handle the List `OnCollectionChanged` ?
Thank you very much. | c# | wpf | mvvm | inotifypropertychanged | inotifycollectionchanged | null | open | Implementing INotfyPropertyChanged for calculated properties
===
i am a bit new to MVVM, and was wondering
lets say i have defined `ObservableCollection<Differences> Diffs`
i also have a property such
public bool IsSame
{
get
{
return Diffs.Count == 0;
}
}
but i dont get how i suppose to implement the OnPropertyChanged for IsSame...
because it is implicit from the Diff List...
- should i attach to the List `OnCollectionChanged` Event and then check if it changes `IsSame` ?
- should i use a backing field anyway and handle the List `OnCollectionChanged` ?
Thank you very much. | 0 |
11,542,512 | 07/18/2012 13:26:48 | 1,534,901 | 07/18/2012 13:22:13 | 1 | 0 | Setting Active Directory User Password Error (RPC-Server is unavailable) | I'm creating an ASP.NET Web Application which should set a password on an event.
Now I always get the error "RPC-Server is unavailable. (Exception HRESULT: 0x800706BA)"
PrincipalContext context = new PrincipalContext(ContextType.Domain, "FOOBAR.LOC", @"FOOBAR\Administrator", "password");
UserPrincipal principal = UserPrincipal.FindByIdentity(context, "myuser");
principal.SetPassword("newpassword");
I searched the whole internet for a solution but couldn't find any.
Cheers | c# | asp.net | user | null | null | null | open | Setting Active Directory User Password Error (RPC-Server is unavailable)
===
I'm creating an ASP.NET Web Application which should set a password on an event.
Now I always get the error "RPC-Server is unavailable. (Exception HRESULT: 0x800706BA)"
PrincipalContext context = new PrincipalContext(ContextType.Domain, "FOOBAR.LOC", @"FOOBAR\Administrator", "password");
UserPrincipal principal = UserPrincipal.FindByIdentity(context, "myuser");
principal.SetPassword("newpassword");
I searched the whole internet for a solution but couldn't find any.
Cheers | 0 |
11,542,514 | 07/18/2012 13:26:53 | 20,489 | 09/22/2008 14:40:28 | 533 | 11 | Visual Studio 2010 MS Build | Is there a way to see the default command line arguments that Visual Studio 2010 uses for deploying a project? | visual-studio-2010 | msbuild | null | null | null | null | open | Visual Studio 2010 MS Build
===
Is there a way to see the default command line arguments that Visual Studio 2010 uses for deploying a project? | 0 |
11,531,109 | 07/17/2012 21:25:05 | 1,532,985 | 07/17/2012 20:57:22 | 1 | 0 | How to get x and y coordinates of image inside an imageview in android? | I stuck in this problem, I have an imageView and I would like to get a position of my touch only inside the image. When I touch out of image I must display x=0 and y=0. In this app I must know resize, zoom and rotate the image, there functions are fixed, but I have problem with the coords of image only inside the image.
Please, help me solve this problem.
Thanks a lot. | android | image | imageview | coordinates | null | null | open | How to get x and y coordinates of image inside an imageview in android?
===
I stuck in this problem, I have an imageView and I would like to get a position of my touch only inside the image. When I touch out of image I must display x=0 and y=0. In this app I must know resize, zoom and rotate the image, there functions are fixed, but I have problem with the coords of image only inside the image.
Please, help me solve this problem.
Thanks a lot. | 0 |
11,531,110 | 07/17/2012 21:25:08 | 1,533,018 | 07/17/2012 21:13:14 | 1 | 0 | MFC button not appearing as topmost | I have a vector of buttons that I want them to appear in two dialogs. Some in my current window, other one in parent of the current window. And I want them to appear as topmost.
So, for the current window, it works ok.
For the parent window, I set the parent, the button is being correctly positioned, but it is appearing behind another button.
I am already setting SWP_NOZORDER.
std::vector<CGdipButtonEx*> m_trashIcons;
...
m_trashButtons[i]->SetWindowPos(nullptr,x,y,25,25,SWP_NOZORDER ); | windows | mfc | null | null | null | null | open | MFC button not appearing as topmost
===
I have a vector of buttons that I want them to appear in two dialogs. Some in my current window, other one in parent of the current window. And I want them to appear as topmost.
So, for the current window, it works ok.
For the parent window, I set the parent, the button is being correctly positioned, but it is appearing behind another button.
I am already setting SWP_NOZORDER.
std::vector<CGdipButtonEx*> m_trashIcons;
...
m_trashButtons[i]->SetWindowPos(nullptr,x,y,25,25,SWP_NOZORDER ); | 0 |
11,542,516 | 07/18/2012 13:26:55 | 492,508 | 10/31/2010 01:10:27 | 737 | 30 | Update screen content based on select box change using f:ajax | I'm using JSF2 with Richfaces 4.
I have the following JSF:
<h:panelGrid columns="2" cellspacing="5">
<h:outputLabel value="#{msg.FrequencyOfSpending}" />
<h:selectOneMenu id="ruleFrequencyOptions" value="#{Rule.ruleControls.ControlOne.controlParams.Period.valueSelected}" styleClass="commonSelect">
<f:selectItems value="#{Rule.ruleControls.ControlOne.controlParams.Period.validValues}" itemLabelEscaped="true" />
<f:ajax event="valueChange" listener="#{Rule.ruleControls.ControlOne.controlParams.Period.valueSelectedChange}" onerror="handleAjaxError" />
</h:selectOneMenu>
</h:panelGrid>
<a4j:repeat value="#{Rule.ruleParams.Action.properties}" var="RuleParamProperty" id="budgetRuleIterator">
<h:panelGrid columns="4" cellspacing="5" columnClasses="ruleParamCheckbox, ruleParamAction, ruleParamActionFrequency, ruleParamActionInput">
<h:selectBooleanCheckbox value="#{RuleParamProperty.selected}">
<a4j:ajax event="click" listener="#{RuleParamProperty.selectedChange}" onerror="handleAjaxError" />
</h:selectBooleanCheckbox>
<h:outputText value="#{msg[RuleParamProperty.name]}" />
<h:panelGrid columns="3">
<h:outputText value="#{msg.Action_1}" />
<h:outputText value="#{msg[Rule.ruleControls.ControlOne.controlParams.Period.valueSelected]}" id="ruleActionFrequency" class="italic-text" />
<h:outputText value="#{msg.Action_3}" />
</h:panelGrid>
<h:inputText value="#{RuleParamProperty.inputValue}" />
</h:panelGrid>
</a4j:repeat>
<br/>
Every time someone selects a new value from the *ruleFrequencyOptions* select box, I need the new value to be reflected/shown here:
<h:outputText value="#{msg[Rule.ruleControls.ControlOne.controlParams.Period.valueSelected]}" id="ruleActionFrequency" class="italic-text" />
<br/>
Assigning an Id to the *h:outputText* and using the *render* attribute on f:ajax does not work due to JSF's beautifull auto generation of Id's!
<br/><br/>
Is there some method I can attach to the *f:ajax* compoent to achieve this?
| ajax | jsf-2.0 | richfaces | null | null | null | open | Update screen content based on select box change using f:ajax
===
I'm using JSF2 with Richfaces 4.
I have the following JSF:
<h:panelGrid columns="2" cellspacing="5">
<h:outputLabel value="#{msg.FrequencyOfSpending}" />
<h:selectOneMenu id="ruleFrequencyOptions" value="#{Rule.ruleControls.ControlOne.controlParams.Period.valueSelected}" styleClass="commonSelect">
<f:selectItems value="#{Rule.ruleControls.ControlOne.controlParams.Period.validValues}" itemLabelEscaped="true" />
<f:ajax event="valueChange" listener="#{Rule.ruleControls.ControlOne.controlParams.Period.valueSelectedChange}" onerror="handleAjaxError" />
</h:selectOneMenu>
</h:panelGrid>
<a4j:repeat value="#{Rule.ruleParams.Action.properties}" var="RuleParamProperty" id="budgetRuleIterator">
<h:panelGrid columns="4" cellspacing="5" columnClasses="ruleParamCheckbox, ruleParamAction, ruleParamActionFrequency, ruleParamActionInput">
<h:selectBooleanCheckbox value="#{RuleParamProperty.selected}">
<a4j:ajax event="click" listener="#{RuleParamProperty.selectedChange}" onerror="handleAjaxError" />
</h:selectBooleanCheckbox>
<h:outputText value="#{msg[RuleParamProperty.name]}" />
<h:panelGrid columns="3">
<h:outputText value="#{msg.Action_1}" />
<h:outputText value="#{msg[Rule.ruleControls.ControlOne.controlParams.Period.valueSelected]}" id="ruleActionFrequency" class="italic-text" />
<h:outputText value="#{msg.Action_3}" />
</h:panelGrid>
<h:inputText value="#{RuleParamProperty.inputValue}" />
</h:panelGrid>
</a4j:repeat>
<br/>
Every time someone selects a new value from the *ruleFrequencyOptions* select box, I need the new value to be reflected/shown here:
<h:outputText value="#{msg[Rule.ruleControls.ControlOne.controlParams.Period.valueSelected]}" id="ruleActionFrequency" class="italic-text" />
<br/>
Assigning an Id to the *h:outputText* and using the *render* attribute on f:ajax does not work due to JSF's beautifull auto generation of Id's!
<br/><br/>
Is there some method I can attach to the *f:ajax* compoent to achieve this?
| 0 |
11,542,518 | 07/18/2012 13:26:58 | 1,308,063 | 04/02/2012 12:48:03 | 41 | 2 | IE loads same css on one page all the time wrong | IE loads same css to all page but on one page it shows CSS WRONG! ALL THE TIME.
when you click on other pages it loads same css and it's fine! i can't figure out why it shows it wrong! when i try to inspect CSS throe browsers (ff, chrome, IE) they show identical style, eaven IE shows same styles and values, but it displays wrong everthing
it's like he knowledges CSS, but doesn't care about it - AND ONLY FROM ONE PAGE
http://pilsetas.lv/jaunumi/
IT'S SO FRUSTRATING | internet-explorer | internet | explorer | null | null | null | open | IE loads same css on one page all the time wrong
===
IE loads same css to all page but on one page it shows CSS WRONG! ALL THE TIME.
when you click on other pages it loads same css and it's fine! i can't figure out why it shows it wrong! when i try to inspect CSS throe browsers (ff, chrome, IE) they show identical style, eaven IE shows same styles and values, but it displays wrong everthing
it's like he knowledges CSS, but doesn't care about it - AND ONLY FROM ONE PAGE
http://pilsetas.lv/jaunumi/
IT'S SO FRUSTRATING | 0 |
11,542,510 | 07/18/2012 13:26:33 | 962,469 | 09/24/2011 09:30:36 | 136 | 1 | using preg_replace in php to remove space in php | I have the following String `+ Example + Test + Test2` and using preg_replace I would like to get the following result `+Example +Test +Test2`
I have been trying to use the following code
preg_replace("/\s*([\+])\s*/", "$1", $string)
but this one is returning
+Example+Test+Test2
| php | null | null | null | null | null | open | using preg_replace in php to remove space in php
===
I have the following String `+ Example + Test + Test2` and using preg_replace I would like to get the following result `+Example +Test +Test2`
I have been trying to use the following code
preg_replace("/\s*([\+])\s*/", "$1", $string)
but this one is returning
+Example+Test+Test2
| 0 |
11,542,528 | 07/18/2012 13:27:23 | 930,125 | 09/06/2011 07:09:43 | 119 | 4 | did two sequential glDrawPixels works for alpha blend? | I want to blend two tga images with alpha channel assigned. the base image and the foreground image, and the foreground image has just several characters with the alpha set to 255, and the rest alpha value of the foreground image is set to 0. with this foreground image, I can add some characters on the base image (only the characters covers on the base image, the rest of the foreground image is transparent). I use some OpenGL code like this:
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, m_width, m_height);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glWindowPos3i(0, 0, 0);
// draw the base image to the FBO
glDrawPixels(m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_base.imageData);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glWindowPos3i(0, 0, 0);
// draw the foreground image to blend with the base image
glDrawPixels(m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_foreground.imageData);
GL_ERROR;
glDisable(GL_BLEND);
The problem is that it don't work. the program just render the base image and there is no characters (in the foreground image) on it? I think it should work and I don't know why it didn't. I have test it and there is no `gl_error` happened. Any body can help? The blend function works ok between the background color which `glColor` set and the first `glDrawPixels`. However, it don't work between the first and the second `glDrawPixels`, why? | opengl | alphablending | null | null | null | null | open | did two sequential glDrawPixels works for alpha blend?
===
I want to blend two tga images with alpha channel assigned. the base image and the foreground image, and the foreground image has just several characters with the alpha set to 255, and the rest alpha value of the foreground image is set to 0. with this foreground image, I can add some characters on the base image (only the characters covers on the base image, the rest of the foreground image is transparent). I use some OpenGL code like this:
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, m_width, m_height);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glWindowPos3i(0, 0, 0);
// draw the base image to the FBO
glDrawPixels(m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_base.imageData);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glWindowPos3i(0, 0, 0);
// draw the foreground image to blend with the base image
glDrawPixels(m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_foreground.imageData);
GL_ERROR;
glDisable(GL_BLEND);
The problem is that it don't work. the program just render the base image and there is no characters (in the foreground image) on it? I think it should work and I don't know why it didn't. I have test it and there is no `gl_error` happened. Any body can help? The blend function works ok between the background color which `glColor` set and the first `glDrawPixels`. However, it don't work between the first and the second `glDrawPixels`, why? | 0 |
11,542,530 | 07/18/2012 13:27:41 | 467,874 | 10/06/2010 11:21:13 | 768 | 16 | Using JUnit Categories with Maven Failsafe plugin | I'm using JUnit Categories to separate integration tests from unit tests. The Surefire plugin configuration works - it skips the tests annotated with my marker interface IntegrationTest.
However, the Failsafe plugin doesn't pick the integration tests. I've even tried to specify the junit47 provider, but zero tests are run in the integration-test phase.
Here is the pom.xml fragment:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<groups>com.mycompany.test.IntegrationTest</groups>
<excludedGroups>com.mycompany.test.UnitTest</excludedGroups>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
</plugin>
Here is the Failsafe part of the log:
[INFO] --- maven-failsafe-plugin:2.12:integration-test (default) @ MyProject.war ---
[INFO] Failsafe report directory: /home/stoupa/MyProject/war/target/failsafe-reports
[INFO] Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Concurrency config is parallel='none', perCoreThreadCount=true, threadCount=2, useUnlimitedThreads=false
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Is the org.apache.maven.surefire.junitcore.JUnitCoreProvider that can be seen in the log output the right one? | maven | junit | maven-failsafe-plugin | null | null | null | open | Using JUnit Categories with Maven Failsafe plugin
===
I'm using JUnit Categories to separate integration tests from unit tests. The Surefire plugin configuration works - it skips the tests annotated with my marker interface IntegrationTest.
However, the Failsafe plugin doesn't pick the integration tests. I've even tried to specify the junit47 provider, but zero tests are run in the integration-test phase.
Here is the pom.xml fragment:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<groups>com.mycompany.test.IntegrationTest</groups>
<excludedGroups>com.mycompany.test.UnitTest</excludedGroups>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
</plugin>
Here is the Failsafe part of the log:
[INFO] --- maven-failsafe-plugin:2.12:integration-test (default) @ MyProject.war ---
[INFO] Failsafe report directory: /home/stoupa/MyProject/war/target/failsafe-reports
[INFO] Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Concurrency config is parallel='none', perCoreThreadCount=true, threadCount=2, useUnlimitedThreads=false
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Is the org.apache.maven.surefire.junitcore.JUnitCoreProvider that can be seen in the log output the right one? | 0 |
11,472,543 | 07/13/2012 14:29:39 | 761,335 | 05/19/2011 15:16:07 | 1 | 0 | generating tables from jpa with limited character length | I want to create a text field in a database with varchar(700) (I want 700 characters max).
I tried to define it like this:
@Entity
@Table(name = "t_foo)
public class Foo {
@Column(unique = true, nullable = false)
@Id
private String idNational;
@Column(length=700)
private String comment;
...
The table generate has the following properties:
idNational varchar(255) NOT NULL
comment longtext NULL
I would really like the comment to be varchar(700). Is there a reason it makes it a longtext? Is there a way I can make it varchar? Maybe this is an easy question, but I haven't found the solution! Do I have to create the tables with DDL instead?
Thank you!
| java | jpa | varchar | longtext | null | null | open | generating tables from jpa with limited character length
===
I want to create a text field in a database with varchar(700) (I want 700 characters max).
I tried to define it like this:
@Entity
@Table(name = "t_foo)
public class Foo {
@Column(unique = true, nullable = false)
@Id
private String idNational;
@Column(length=700)
private String comment;
...
The table generate has the following properties:
idNational varchar(255) NOT NULL
comment longtext NULL
I would really like the comment to be varchar(700). Is there a reason it makes it a longtext? Is there a way I can make it varchar? Maybe this is an easy question, but I haven't found the solution! Do I have to create the tables with DDL instead?
Thank you!
| 0 |
11,472,708 | 07/13/2012 14:39:20 | 228,298 | 12/09/2009 20:52:41 | 4,321 | 193 | Get Window Handle of Chrome Tab from Within Extension? | I've written a Chrome Extension (w/ NPAPI as well) that allows my application and Chrome to communicate with each other. That is all mostly working fine.
What I'm trying to do now is be able to tie the HWND of a Chrome window to a particular Window ID & Tab ID.
When I'm inside of Chrome (via the plugin) I have the Tab ID and Window ID and I can do most operations based on that.
When I'm outside of Chrome (via my application) I can see the window structure and get the HWND of the various tabs.
Is there any way that I can tie them together reliably such that my application could tell Chrome to get me information about/from a specific tab? | google-chrome | google-chrome-extension | npapi | window-handles | null | null | open | Get Window Handle of Chrome Tab from Within Extension?
===
I've written a Chrome Extension (w/ NPAPI as well) that allows my application and Chrome to communicate with each other. That is all mostly working fine.
What I'm trying to do now is be able to tie the HWND of a Chrome window to a particular Window ID & Tab ID.
When I'm inside of Chrome (via the plugin) I have the Tab ID and Window ID and I can do most operations based on that.
When I'm outside of Chrome (via my application) I can see the window structure and get the HWND of the various tabs.
Is there any way that I can tie them together reliably such that my application could tell Chrome to get me information about/from a specific tab? | 0 |
11,472,711 | 07/13/2012 14:39:35 | 181,771 | 09/30/2009 11:50:25 | 4,708 | 76 | What is an EventListener in contrast to an EventHandler? | How can I implement one? Will it work across multiple assemblies? If not, how can I make it work? | c# | eventlistener | null | null | null | 07/18/2012 14:35:25 | not constructive | What is an EventListener in contrast to an EventHandler?
===
How can I implement one? Will it work across multiple assemblies? If not, how can I make it work? | 4 |
11,472,720 | 07/13/2012 14:40:08 | 1,523,856 | 07/13/2012 14:36:44 | 1 | 0 | Create copy of a database only schema | I am relativley new to MS SQL server. I need to create a test database from exisitng test data base with same schema and get the data from production and fill the newly created empty database. For this I was using generate scripts in SSMS. But now I need to do it on regular basis in a job. Please guide me how I can create empty databases automatically at a point of time. | database | sql-server-2005 | null | null | null | null | open | Create copy of a database only schema
===
I am relativley new to MS SQL server. I need to create a test database from exisitng test data base with same schema and get the data from production and fill the newly created empty database. For this I was using generate scripts in SSMS. But now I need to do it on regular basis in a job. Please guide me how I can create empty databases automatically at a point of time. | 0 |
11,472,722 | 07/13/2012 14:40:20 | 815,225 | 06/25/2011 10:22:32 | 601 | 45 | Atan2 table c++ | I'm trying to calculate the angles of two points in 2D space. It works with the following:
double angle;
x = player->x - x;
z = player->z - y;
angle = atan2 (x, y);
angle *= (180.0 / M_PI);
if(angle < 0) angle += 360;
if(angle >= 360) angle -= 360;
return angle;
However I want to use a table for better results:
x = player->x - x;
z = player->y - y;
return atanTable[x+32][y+32];
With init:
int xp = -32;
int yp = -32;
for (int x = 0; x < 64; x++, xp++)
for (int y = 0; y < 64; y++, yp++){
double angle;
angle = atan2 (xp, yp);
angle *= (180.0 / M_PI);
if(angle < 0) angle += 360;
if(angle >= 360) angle -= 360;
atanTable[x][y] = angle;
}
The angle is only calculated for values -32 to 32 for x and y.
The table is not properly produced however. I get values of only around 359 and 0, while I should get a range of 0 to 360 degrees.
Am I misusing atan2 somehow? | c++ | null | null | null | null | null | open | Atan2 table c++
===
I'm trying to calculate the angles of two points in 2D space. It works with the following:
double angle;
x = player->x - x;
z = player->z - y;
angle = atan2 (x, y);
angle *= (180.0 / M_PI);
if(angle < 0) angle += 360;
if(angle >= 360) angle -= 360;
return angle;
However I want to use a table for better results:
x = player->x - x;
z = player->y - y;
return atanTable[x+32][y+32];
With init:
int xp = -32;
int yp = -32;
for (int x = 0; x < 64; x++, xp++)
for (int y = 0; y < 64; y++, yp++){
double angle;
angle = atan2 (xp, yp);
angle *= (180.0 / M_PI);
if(angle < 0) angle += 360;
if(angle >= 360) angle -= 360;
atanTable[x][y] = angle;
}
The angle is only calculated for values -32 to 32 for x and y.
The table is not properly produced however. I get values of only around 359 and 0, while I should get a range of 0 to 360 degrees.
Am I misusing atan2 somehow? | 0 |
11,571,967 | 07/20/2012 02:18:03 | 1,522,426 | 07/13/2012 02:21:22 | 1 | 0 | Perl framework for html | I want to authorise a team dedicatedly for password reset/printer queue delete kind of L1 tasks. I have planned to do so via 1 menu using Perl script. And I want it to be front end at HTML. I don't want user to login in server's black screen. They just login into web portal-> see the menu-> select an item-> do the task->exit.
Now, I am thinking what framework I can use to achieve this.
How user password would be transferred securely from web portal to my server?
How are you going to encrypt/secure the web communication?
How are you going to encrypt/secure passwords?
Even if you use one of the built-in methods for encrypting the passwords at authentication time, how will you secure passwords in user input for something like a password reset function?
I really need your valuable suggestions on this.
thanks,
Prashant | perl | null | null | null | null | 07/25/2012 02:44:04 | not a real question | Perl framework for html
===
I want to authorise a team dedicatedly for password reset/printer queue delete kind of L1 tasks. I have planned to do so via 1 menu using Perl script. And I want it to be front end at HTML. I don't want user to login in server's black screen. They just login into web portal-> see the menu-> select an item-> do the task->exit.
Now, I am thinking what framework I can use to achieve this.
How user password would be transferred securely from web portal to my server?
How are you going to encrypt/secure the web communication?
How are you going to encrypt/secure passwords?
Even if you use one of the built-in methods for encrypting the passwords at authentication time, how will you secure passwords in user input for something like a password reset function?
I really need your valuable suggestions on this.
thanks,
Prashant | 1 |
11,571,969 | 07/20/2012 02:18:10 | 958,263 | 10/26/2010 10:27:17 | 56 | 1 | Beanshell - using arraylist | I am using beanshell and i want to use arraylist
My code -
import java.util.*;
List test= new ArrayList();
test.add("Last Name");
But I am getting following exception
Caused by: org.apache.bsf.BSFException: BeanShell script error:Typed variable declaration :
Attempt to resolve method: add() on undefined variable or class name: test: at Line: 206
Any idea what is causing the problem?
Thanks
| java | javascript | beanshell | null | null | null | open | Beanshell - using arraylist
===
I am using beanshell and i want to use arraylist
My code -
import java.util.*;
List test= new ArrayList();
test.add("Last Name");
But I am getting following exception
Caused by: org.apache.bsf.BSFException: BeanShell script error:Typed variable declaration :
Attempt to resolve method: add() on undefined variable or class name: test: at Line: 206
Any idea what is causing the problem?
Thanks
| 0 |
11,571,971 | 07/20/2012 02:18:47 | 1,536,620 | 07/19/2012 02:48:33 | 1 | 0 | Can We use flash content in an android application And will it work as Jelly Bean is not supporting flash..? | tell Guys that will flash content will work in applications on android jelly bean as its not supporting flash...Share your knowledge about this.. | flash | application | javabeans | contents | jelly | null | open | Can We use flash content in an android application And will it work as Jelly Bean is not supporting flash..?
===
tell Guys that will flash content will work in applications on android jelly bean as its not supporting flash...Share your knowledge about this.. | 0 |
11,571,975 | 07/20/2012 02:19:40 | 1,467,294 | 06/19/2012 18:40:31 | 1 | 0 | Strings.exe won't print output? | I'm trying to extract information from a dump of a file with LZX Compression, I am using Strings.exe as that displays what I need to add for the rest of the other project to compile in 'Low Level' PPC.
I've tried going onto COMMAND PROMPT and typing this:
CD Desktop strings.exe -n 3 default-2.exe and it dumps it, but I can't select the whole dump, so I done this:
CD Desktop strings.exe -n 3 default-2.exe command promt >strings.txt but it prints out the usage of the program, they're is not any way which strings.exe prints output I believe, anyone have an idea how to print info out to text file instead of a windows with Strings.exe????
Thanks, sorry if this is not clear, I'm reall tired. | c# | c++ | c | null | null | null | open | Strings.exe won't print output?
===
I'm trying to extract information from a dump of a file with LZX Compression, I am using Strings.exe as that displays what I need to add for the rest of the other project to compile in 'Low Level' PPC.
I've tried going onto COMMAND PROMPT and typing this:
CD Desktop strings.exe -n 3 default-2.exe and it dumps it, but I can't select the whole dump, so I done this:
CD Desktop strings.exe -n 3 default-2.exe command promt >strings.txt but it prints out the usage of the program, they're is not any way which strings.exe prints output I believe, anyone have an idea how to print info out to text file instead of a windows with Strings.exe????
Thanks, sorry if this is not clear, I'm reall tired. | 0 |
11,571,977 | 07/20/2012 02:20:15 | 896,075 | 08/16/2011 06:05:08 | 13 | 3 | How to use TCPDF with PHP mail function | $to = '[email protected]';
$subject = 'Receipt';
$repEmail = '[email protected]';
$fileName = 'receipt.pdf';
$fileatt = $pdf->Output($fileName, 'E');
$attachment = chunk_split($fileatt);
$eol = PHP_EOL;
$separator = md5(time());
$headers = 'From: Sender <'.$repEmail.'>'.$eol;
$headers .= 'MIME-Version: 1.0' .$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"";
$message = "--".$separator.$eol;
$message .= "Content-Transfer-Encoding: 7bit".$eol.$eol;
$message .= "This is a MIME encoded message.".$eol;
$message .= "--".$separator.$eol;
$message .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$message .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$message .= "--".$separator.$eol;
$message .= "Content-Type: application/pdf; name=\"".$fileName."\"".$eol;
$message .= "Content-Transfer-Encoding: base64".$eol;
$message .= "Content-Disposition: attachment".$eol.$eol;
$message .= $attachment.$eol;
$message .= "--".$separator."--";
if (mail($to, $subject, $message, $headers)){
$action = 'action=Receipt%20Sent';
header('Location: ../index.php?'.$action);
}
else {
$action = 'action=Send%20Failed';
header('Location: ../index.php?'.$action);
}
I have been using TCPDF for a short amount of time now to generate PDF files from forms. It works quite well and that part of the PHP has not changed. Now I want to send those PDF files to my email account.
The emailing is actually working with this coding and attaching a PDF. The issue is that it is simply a blank PDF at rough 100 bytes in size. Which of course is not a valid PDF nor does it have anything to do with the responses from the form.
I am really not familiar with the attaching of files to an email in PHP and any help resolving this issue would be greatly appreciated. | php | email | pdf | attachment | tcpdf | null | open | How to use TCPDF with PHP mail function
===
$to = '[email protected]';
$subject = 'Receipt';
$repEmail = '[email protected]';
$fileName = 'receipt.pdf';
$fileatt = $pdf->Output($fileName, 'E');
$attachment = chunk_split($fileatt);
$eol = PHP_EOL;
$separator = md5(time());
$headers = 'From: Sender <'.$repEmail.'>'.$eol;
$headers .= 'MIME-Version: 1.0' .$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"";
$message = "--".$separator.$eol;
$message .= "Content-Transfer-Encoding: 7bit".$eol.$eol;
$message .= "This is a MIME encoded message.".$eol;
$message .= "--".$separator.$eol;
$message .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$message .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$message .= "--".$separator.$eol;
$message .= "Content-Type: application/pdf; name=\"".$fileName."\"".$eol;
$message .= "Content-Transfer-Encoding: base64".$eol;
$message .= "Content-Disposition: attachment".$eol.$eol;
$message .= $attachment.$eol;
$message .= "--".$separator."--";
if (mail($to, $subject, $message, $headers)){
$action = 'action=Receipt%20Sent';
header('Location: ../index.php?'.$action);
}
else {
$action = 'action=Send%20Failed';
header('Location: ../index.php?'.$action);
}
I have been using TCPDF for a short amount of time now to generate PDF files from forms. It works quite well and that part of the PHP has not changed. Now I want to send those PDF files to my email account.
The emailing is actually working with this coding and attaching a PDF. The issue is that it is simply a blank PDF at rough 100 bytes in size. Which of course is not a valid PDF nor does it have anything to do with the responses from the form.
I am really not familiar with the attaching of files to an email in PHP and any help resolving this issue would be greatly appreciated. | 0 |
11,571,676 | 07/20/2012 01:33:24 | 1,532,668 | 07/17/2012 18:21:48 | 21 | 0 | Find the location and determine the corresponding value of another array having the same location of one array | if a=[5 8 1 2 6 7 1 4 2 3 7 8],b=[ 7 6 3 1 5 4 2 0 1 8 9 4]
a1=[1 7 3] corresponds to a matrix and
d should be [3 4 8]..d is the exact location of the corresponding a value can i get me this in matlab | matlab | null | null | null | null | null | open | Find the location and determine the corresponding value of another array having the same location of one array
===
if a=[5 8 1 2 6 7 1 4 2 3 7 8],b=[ 7 6 3 1 5 4 2 0 1 8 9 4]
a1=[1 7 3] corresponds to a matrix and
d should be [3 4 8]..d is the exact location of the corresponding a value can i get me this in matlab | 0 |
11,571,677 | 07/20/2012 01:33:52 | 1,491,929 | 06/29/2012 18:29:54 | 1 | 0 | What folder should i put my production website into? | I will be running 2 vhosts (dev and production). I'm thinking about creating 2 users (dev and prod) and directing apache to look into /home/dev/www and /home/prod/www. If I do this I will need to give apache the proper permissions to manage those folders.
Does this sound like a bad idea? Would it make more sense to just use /var/www/prod/ and var/www/dev ?
Thanks for any insight. | apache | web-hosting | null | null | null | null | open | What folder should i put my production website into?
===
I will be running 2 vhosts (dev and production). I'm thinking about creating 2 users (dev and prod) and directing apache to look into /home/dev/www and /home/prod/www. If I do this I will need to give apache the proper permissions to manage those folders.
Does this sound like a bad idea? Would it make more sense to just use /var/www/prod/ and var/www/dev ?
Thanks for any insight. | 0 |
11,571,980 | 07/20/2012 02:20:36 | 111,910 | 05/25/2009 02:33:50 | 1,446 | 23 | R: `unlist` using a lot of time when summing a subset of a matrix | I have a program which pulls data out of a MySQL database, decodes a pair of
binary columns, and then sums together a subset of of the rows within the pair
of binary columns. Running the program on a sample data set takes 12-14 seconds,
with 9-10 of those taken up by `unlist`. I'm wondering if there is any way to
speed things up.
## Structure of the table
The rows I'm getting from the database look like:
| array_length | mz_array | intensity_array |
|--------------+-----------------+-----------------|
| 98 | 00c077e66340... | 002091c37240... |
| 74 | c04a7c7340... | db87734000... |
where `array_length` is the number of little-endian doubles in the two arrays
(they are guaranteed to be the same length). So the first row has 98 doubles in
each of `mz_array` and `intensity_array`. `array_length` has a mean of 825 and a
median of 620 with 13,000 rows.
## Decoding the binary arrays
Each row gets decoded by being passed to the following function. Once the binary
arrays have been decoded, `array_length` is no longer needed.
DecodeSpectrum <- function(array_length, mz_array, intensity_array) {
sapply(list(mz_array=mz_array, intensity_array=intensity_array),
readBin,
what="double",
endian="little",
n=array_length)
}
## Summing the arrays
The next step is to sum the values in `intensity_array`, but only if their
corresponding entry in `mz_array` is within a certain window. The arrays are
ordered by `mz_array`, ascending. I am using the following function to sum up
the `intensity_array` values:
SumInWindow <- function(spectrum, lower, upper) {
sum(spectrum[spectrum[,1] > lower & spectrum[,1] < upper, 2])
}
Where `spectrum` is the output from `DecodeSpectrum`, a `matrix`.
## Operating over list of rows
Each row is handled by:
ProcessSegment <- function(spectra, window_bounds) {
lower <- window_bounds[1]
upper <- window_bounds[2]
## Decode a single spectrum and sum the intensities within the window.
SumDecode <- function (...) {
SumInWindow(DecodeSpectrum(...), lower, upper)
}
do.call("mapply", c(SumDecode, spectra))
}
And finally, the rows are fetched and handed off to `ProcessSegment` with this
function:
ProcessAllSegments <- function(conn, window_bounds) {
nextSeg <- function() odbcFetchRows(conn, max=batchSize, buffsize=batchSize)
while ((res <- nextSeg())$stat == 1 && res$data[[1]] > 0) {
print(ProcessSegment(res$data, window_bounds))
}
}
I'm doing the fetches in segments so that R doesn't have to load the entire data
set into memory at once (it was causing out of memory errors). I'm using the
`RODBC` driver because the `RMySQL` driver isn't able to return unsullied binary
values (as far as I could tell).
## Performance
For a sample data set of about 140MiB, the whole process takes around 14 seconds
to complete, which is not that bad for 13,000 rows. Still, I think there's room
for improvement, especially when looking at the `Rprof` output:
$by.self
self.time self.pct total.time total.pct
"unlist" 10.26 69.99 10.30 70.26
"SumInWindow" 1.06 7.23 13.92 94.95
"mapply" 0.48 3.27 14.44 98.50
"as.vector" 0.44 3.00 10.60 72.31
"array" 0.40 2.73 0.40 2.73
"FUN" 0.40 2.73 0.40 2.73
"list" 0.30 2.05 0.30 2.05
"<" 0.22 1.50 0.22 1.50
"unique" 0.18 1.23 0.36 2.46
">" 0.18 1.23 0.18 1.23
".Call" 0.16 1.09 0.16 1.09
"lapply" 0.14 0.95 0.86 5.87
"simplify2array" 0.10 0.68 11.48 78.31
"&" 0.10 0.68 0.10 0.68
"sapply" 0.06 0.41 12.36 84.31
"c" 0.06 0.41 0.06 0.41
"is.factor" 0.04 0.27 0.04 0.27
"match.fun" 0.04 0.27 0.04 0.27
"<Anonymous>" 0.02 0.14 13.94 95.09
"unique.default" 0.02 0.14 0.06 0.41
$by.total
total.time total.pct self.time self.pct
"ProcessAllSegments" 14.66 100.00 0.00 0.00
"do.call" 14.50 98.91 0.00 0.00
"ProcessSegment" 14.50 98.91 0.00 0.00
"mapply" 14.44 98.50 0.48 3.27
"<Anonymous>" 13.94 95.09 0.02 0.14
"SumInWindow" 13.92 94.95 1.06 7.23
"sapply" 12.36 84.31 0.06 0.41
"DecodeSpectrum" 12.36 84.31 0.00 0.00
"simplify2array" 11.48 78.31 0.10 0.68
"as.vector" 10.60 72.31 0.44 3.00
"unlist" 10.30 70.26 10.26 69.99
"lapply" 0.86 5.87 0.14 0.95
"array" 0.40 2.73 0.40 2.73
"FUN" 0.40 2.73 0.40 2.73
"unique" 0.36 2.46 0.18 1.23
"list" 0.30 2.05 0.30 2.05
"<" 0.22 1.50 0.22 1.50
">" 0.18 1.23 0.18 1.23
".Call" 0.16 1.09 0.16 1.09
"nextSeg" 0.16 1.09 0.00 0.00
"odbcFetchRows" 0.16 1.09 0.00 0.00
"&" 0.10 0.68 0.10 0.68
"c" 0.06 0.41 0.06 0.41
"unique.default" 0.06 0.41 0.02 0.14
"is.factor" 0.04 0.27 0.04 0.27
"match.fun" 0.04 0.27 0.04 0.27
$sample.interval
[1] 0.02
$sampling.time
[1] 14.66
I'm surprised to see `unlist` taking up so much time; this says to me that there
might be some redundant copying or rearranging going on. I'm new at R, so it's
entirely possible that this is normal, but I'd like to know if there's anything
glaringly wrong.
| r | matrix | data.frame | null | null | null | open | R: `unlist` using a lot of time when summing a subset of a matrix
===
I have a program which pulls data out of a MySQL database, decodes a pair of
binary columns, and then sums together a subset of of the rows within the pair
of binary columns. Running the program on a sample data set takes 12-14 seconds,
with 9-10 of those taken up by `unlist`. I'm wondering if there is any way to
speed things up.
## Structure of the table
The rows I'm getting from the database look like:
| array_length | mz_array | intensity_array |
|--------------+-----------------+-----------------|
| 98 | 00c077e66340... | 002091c37240... |
| 74 | c04a7c7340... | db87734000... |
where `array_length` is the number of little-endian doubles in the two arrays
(they are guaranteed to be the same length). So the first row has 98 doubles in
each of `mz_array` and `intensity_array`. `array_length` has a mean of 825 and a
median of 620 with 13,000 rows.
## Decoding the binary arrays
Each row gets decoded by being passed to the following function. Once the binary
arrays have been decoded, `array_length` is no longer needed.
DecodeSpectrum <- function(array_length, mz_array, intensity_array) {
sapply(list(mz_array=mz_array, intensity_array=intensity_array),
readBin,
what="double",
endian="little",
n=array_length)
}
## Summing the arrays
The next step is to sum the values in `intensity_array`, but only if their
corresponding entry in `mz_array` is within a certain window. The arrays are
ordered by `mz_array`, ascending. I am using the following function to sum up
the `intensity_array` values:
SumInWindow <- function(spectrum, lower, upper) {
sum(spectrum[spectrum[,1] > lower & spectrum[,1] < upper, 2])
}
Where `spectrum` is the output from `DecodeSpectrum`, a `matrix`.
## Operating over list of rows
Each row is handled by:
ProcessSegment <- function(spectra, window_bounds) {
lower <- window_bounds[1]
upper <- window_bounds[2]
## Decode a single spectrum and sum the intensities within the window.
SumDecode <- function (...) {
SumInWindow(DecodeSpectrum(...), lower, upper)
}
do.call("mapply", c(SumDecode, spectra))
}
And finally, the rows are fetched and handed off to `ProcessSegment` with this
function:
ProcessAllSegments <- function(conn, window_bounds) {
nextSeg <- function() odbcFetchRows(conn, max=batchSize, buffsize=batchSize)
while ((res <- nextSeg())$stat == 1 && res$data[[1]] > 0) {
print(ProcessSegment(res$data, window_bounds))
}
}
I'm doing the fetches in segments so that R doesn't have to load the entire data
set into memory at once (it was causing out of memory errors). I'm using the
`RODBC` driver because the `RMySQL` driver isn't able to return unsullied binary
values (as far as I could tell).
## Performance
For a sample data set of about 140MiB, the whole process takes around 14 seconds
to complete, which is not that bad for 13,000 rows. Still, I think there's room
for improvement, especially when looking at the `Rprof` output:
$by.self
self.time self.pct total.time total.pct
"unlist" 10.26 69.99 10.30 70.26
"SumInWindow" 1.06 7.23 13.92 94.95
"mapply" 0.48 3.27 14.44 98.50
"as.vector" 0.44 3.00 10.60 72.31
"array" 0.40 2.73 0.40 2.73
"FUN" 0.40 2.73 0.40 2.73
"list" 0.30 2.05 0.30 2.05
"<" 0.22 1.50 0.22 1.50
"unique" 0.18 1.23 0.36 2.46
">" 0.18 1.23 0.18 1.23
".Call" 0.16 1.09 0.16 1.09
"lapply" 0.14 0.95 0.86 5.87
"simplify2array" 0.10 0.68 11.48 78.31
"&" 0.10 0.68 0.10 0.68
"sapply" 0.06 0.41 12.36 84.31
"c" 0.06 0.41 0.06 0.41
"is.factor" 0.04 0.27 0.04 0.27
"match.fun" 0.04 0.27 0.04 0.27
"<Anonymous>" 0.02 0.14 13.94 95.09
"unique.default" 0.02 0.14 0.06 0.41
$by.total
total.time total.pct self.time self.pct
"ProcessAllSegments" 14.66 100.00 0.00 0.00
"do.call" 14.50 98.91 0.00 0.00
"ProcessSegment" 14.50 98.91 0.00 0.00
"mapply" 14.44 98.50 0.48 3.27
"<Anonymous>" 13.94 95.09 0.02 0.14
"SumInWindow" 13.92 94.95 1.06 7.23
"sapply" 12.36 84.31 0.06 0.41
"DecodeSpectrum" 12.36 84.31 0.00 0.00
"simplify2array" 11.48 78.31 0.10 0.68
"as.vector" 10.60 72.31 0.44 3.00
"unlist" 10.30 70.26 10.26 69.99
"lapply" 0.86 5.87 0.14 0.95
"array" 0.40 2.73 0.40 2.73
"FUN" 0.40 2.73 0.40 2.73
"unique" 0.36 2.46 0.18 1.23
"list" 0.30 2.05 0.30 2.05
"<" 0.22 1.50 0.22 1.50
">" 0.18 1.23 0.18 1.23
".Call" 0.16 1.09 0.16 1.09
"nextSeg" 0.16 1.09 0.00 0.00
"odbcFetchRows" 0.16 1.09 0.00 0.00
"&" 0.10 0.68 0.10 0.68
"c" 0.06 0.41 0.06 0.41
"unique.default" 0.06 0.41 0.02 0.14
"is.factor" 0.04 0.27 0.04 0.27
"match.fun" 0.04 0.27 0.04 0.27
$sample.interval
[1] 0.02
$sampling.time
[1] 14.66
I'm surprised to see `unlist` taking up so much time; this says to me that there
might be some redundant copying or rearranging going on. I'm new at R, so it's
entirely possible that this is normal, but I'd like to know if there's anything
glaringly wrong.
| 0 |
11,571,984 | 07/20/2012 02:21:06 | 941,241 | 09/12/2011 19:44:04 | 261 | 13 | Serving raw JSON and processing images via API across multiple applications | SO,
I thought about putting this on severfault, but it's more of a coding question.
I've developed an API that uses LAMP to serve and receive data from multiple applications (android, iphone, etc)
It's main tasks are doing mysql queries (some simple, some rather complex) and serving the responses as raw JSON data,
storing vector and image file mysql blobs (base64 encoded, also get served through JSON),
receiving base64 encoded images as POST data and doing image processing using GD library and imagemagick
In development/alpha I don't have any problems with speed or efficiency, however we are ready to get a dedicated server going to serve very high volume traffic (hundreds of thousands of people logging in daily),
So, my question: How does PHP + Apache stack up to other configurations/coding language in terms of speed and ability to handle many connections, given my API's tasks?
I know Ruby on Rails pretty well, and JavaScript pretty fluently, so I have been doing my homework on RoR3 and node.js
But I want to know, what are your experiences as seasoned developers?
I honestly trust SO more than most of the blogs I've been reading.
Thanks for all of your input
Cheers | api | node.js | lamp | high-traffic | null | null | open | Serving raw JSON and processing images via API across multiple applications
===
SO,
I thought about putting this on severfault, but it's more of a coding question.
I've developed an API that uses LAMP to serve and receive data from multiple applications (android, iphone, etc)
It's main tasks are doing mysql queries (some simple, some rather complex) and serving the responses as raw JSON data,
storing vector and image file mysql blobs (base64 encoded, also get served through JSON),
receiving base64 encoded images as POST data and doing image processing using GD library and imagemagick
In development/alpha I don't have any problems with speed or efficiency, however we are ready to get a dedicated server going to serve very high volume traffic (hundreds of thousands of people logging in daily),
So, my question: How does PHP + Apache stack up to other configurations/coding language in terms of speed and ability to handle many connections, given my API's tasks?
I know Ruby on Rails pretty well, and JavaScript pretty fluently, so I have been doing my homework on RoR3 and node.js
But I want to know, what are your experiences as seasoned developers?
I honestly trust SO more than most of the blogs I've been reading.
Thanks for all of your input
Cheers | 0 |
11,571,987 | 07/20/2012 02:21:15 | 1,198,203 | 02/08/2012 20:31:31 | 73 | 2 | is this a secure implementation of password reset email | I am redesigning a password reset email mechanism because the existing implementation scares the hell out of me. My goal is to generate reset codes that are:
* Expired
* Tamper Resistant
* Single Use
* Resistant to replay attacks
The format of the reset code I have come up with is:
B64(B64(iv)||B64(E(uid||timestamp)))
Where B64 is base64 encoding and E is for symmetric encryption. The iv is the initialization vector used for encryption (randomly generated), and is in the clear. The || indicates concatenation and I actually use the string "||" as the separator. The uid is an opaque identifier of the user so I can look them up in the database.
The timestamp allows for a code to be expired.
I am using AES 256 in Galois Counter Mode which should provide protection from modified ciphertext attacks.
The encryption key is stored on the server, and used to perform the encryption.
The iv has a dual use. When the reset code is generated the iv is stored with the user in the database. This is used to enforce single-use of a reset code (it gets cleared when a reset code is processed) as well as prevent use of reset codes generated previously. If the iv in the database does not match the iv used to decrypt the reset code, the request is refused. This may also help with security in the event that the encryption key on the server is somehow compromised, as the attacker has to inject the iv into the database as well to make it work. Of course if the attacker is on the host we are pretty much toast...
Are there any weaknesses in this design I am not seeing, or does it needs additional improvement? I look forward to your comments.
Thanks! | security | email | passwords | reset | encryption-symmetric | 07/21/2012 14:35:19 | off topic | is this a secure implementation of password reset email
===
I am redesigning a password reset email mechanism because the existing implementation scares the hell out of me. My goal is to generate reset codes that are:
* Expired
* Tamper Resistant
* Single Use
* Resistant to replay attacks
The format of the reset code I have come up with is:
B64(B64(iv)||B64(E(uid||timestamp)))
Where B64 is base64 encoding and E is for symmetric encryption. The iv is the initialization vector used for encryption (randomly generated), and is in the clear. The || indicates concatenation and I actually use the string "||" as the separator. The uid is an opaque identifier of the user so I can look them up in the database.
The timestamp allows for a code to be expired.
I am using AES 256 in Galois Counter Mode which should provide protection from modified ciphertext attacks.
The encryption key is stored on the server, and used to perform the encryption.
The iv has a dual use. When the reset code is generated the iv is stored with the user in the database. This is used to enforce single-use of a reset code (it gets cleared when a reset code is processed) as well as prevent use of reset codes generated previously. If the iv in the database does not match the iv used to decrypt the reset code, the request is refused. This may also help with security in the event that the encryption key on the server is somehow compromised, as the attacker has to inject the iv into the database as well to make it work. Of course if the attacker is on the host we are pretty much toast...
Are there any weaknesses in this design I am not seeing, or does it needs additional improvement? I look forward to your comments.
Thanks! | 2 |
11,571,991 | 07/20/2012 02:21:42 | 329,443 | 04/30/2010 03:24:56 | 137 | 8 | Using CFUUIDRefs as a Dictionary's keys | I have a bunch of devices.
They each have a UUID that distinguishes them from each other.
Logically, this is the natural thing to key them by in a dictionary tracking them all, then.
However, the [device UUID] method passes back a CFUUIDRef.
First off, this isn't an object.
But hey, we can fix that.
[device_dictionary setObject:device for Key(__bridge id)[device uuid]];
No, wait, that's not a valid key: It doesn't implement the <NSCopying> protocol.
What's more, since I'm casting these CFUUIDRefs into objects on the fly, will the dictionary even realize when it's been passed the same CFUUIDRef twice? Or will the new object created on the fly by the cast not register as the same object?
Care to help me brainstorm on this? How would you key a dictionary with UUIDs, when they were available as non-objects? | iphone | nsdictionary | null | null | null | null | open | Using CFUUIDRefs as a Dictionary's keys
===
I have a bunch of devices.
They each have a UUID that distinguishes them from each other.
Logically, this is the natural thing to key them by in a dictionary tracking them all, then.
However, the [device UUID] method passes back a CFUUIDRef.
First off, this isn't an object.
But hey, we can fix that.
[device_dictionary setObject:device for Key(__bridge id)[device uuid]];
No, wait, that's not a valid key: It doesn't implement the <NSCopying> protocol.
What's more, since I'm casting these CFUUIDRefs into objects on the fly, will the dictionary even realize when it's been passed the same CFUUIDRef twice? Or will the new object created on the fly by the cast not register as the same object?
Care to help me brainstorm on this? How would you key a dictionary with UUIDs, when they were available as non-objects? | 0 |
11,650,959 | 07/25/2012 13:34:13 | 462,233 | 09/29/2010 20:34:50 | 865 | 38 | Prevent connected socket from closing in Python | I have simple function that act like a **client**. It sents an event message and wait for an ack(I removed that part for simplicity). After that it'll get receive more messages:
def send_data(message):
"""Connect to server and get requests"""
sock = socket.socket()
host = 'localhost'
port = 8000
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host,port))
try:
if message:
sock.sendall(message)
# Look for the response
has_request = False
while not has_request:
data = sock.recv(1024)
#First I get ACK, code not listed here...
#Next iteration, I got my request message
has_request = True
finally:
print >> sys.stderr, 'Closing socket'
sock.close()
return data
I call this in the `__main__` statement:
if __name__ == '__main__':
server_data = send_data(event)
if server_data:
parse_request(server_data)
However I need to prevent the socket to be closed automatically. Because I have to sent another messagea after I parsed the request. I removed the sock.close() but the socket still get closed. Is this because I'm returing the data and I'm out of the functions scope?
I just want to connect, and then receive and sent messages without any problems, at any time in my program.
| python | sockets | null | null | null | null | open | Prevent connected socket from closing in Python
===
I have simple function that act like a **client**. It sents an event message and wait for an ack(I removed that part for simplicity). After that it'll get receive more messages:
def send_data(message):
"""Connect to server and get requests"""
sock = socket.socket()
host = 'localhost'
port = 8000
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host,port))
try:
if message:
sock.sendall(message)
# Look for the response
has_request = False
while not has_request:
data = sock.recv(1024)
#First I get ACK, code not listed here...
#Next iteration, I got my request message
has_request = True
finally:
print >> sys.stderr, 'Closing socket'
sock.close()
return data
I call this in the `__main__` statement:
if __name__ == '__main__':
server_data = send_data(event)
if server_data:
parse_request(server_data)
However I need to prevent the socket to be closed automatically. Because I have to sent another messagea after I parsed the request. I removed the sock.close() but the socket still get closed. Is this because I'm returing the data and I'm out of the functions scope?
I just want to connect, and then receive and sent messages without any problems, at any time in my program.
| 0 |
11,650,960 | 07/25/2012 13:34:16 | 1,535,709 | 07/18/2012 17:54:06 | 1 | 1 | Error in the page | Hi i am create a php script for my android application which authenticate the user. In that the following error is accured.
Connected WelcomeYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘ AND Password = ‘' at line 1
query :- $query = "SELECT * FROM admin WHERE Username = ‘$un’ AND Password = ‘$pw’";
$result = mysql_query($query) or die(mysql_error());;
| php | android | web-services | null | null | null | open | Error in the page
===
Hi i am create a php script for my android application which authenticate the user. In that the following error is accured.
Connected WelcomeYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘ AND Password = ‘' at line 1
query :- $query = "SELECT * FROM admin WHERE Username = ‘$un’ AND Password = ‘$pw’";
$result = mysql_query($query) or die(mysql_error());;
| 0 |
11,651,134 | 07/25/2012 13:43:05 | 1,551,632 | 07/25/2012 12:41:56 | 1 | 0 | Add tilted (floating) axes to overlay with standard axes | I am looking for a means to add an additional axis pair, both tilted and origin displaced. They should be added to axes already used for displaying an image.
The result should look somehow close to
y x+y
|\ /
9 | + -2 + 18
| \ /
| \ /
8 | x
| / \
| / \
7 | + 14 \x-y
|/ + 2
+--------------------- x
7 8 9
(unfortunately I was not allowed to upload the actual Image that I created)
The center of the tilted axes should be localized at a certain coordinate (x0,y0), in my case (8,8), and I'd like to be able to treat the new axes like the normal axes, i.e use functions like set_xlabel, grid, etc. on them.
I was trying to get results using Affine2D transforms, floating axes and spines, but was unable to get the correct grip on this matter. Any help is greatly welcome.
The unimportant part of the image was done using
import numpy as np
import matplotlib.pyplot as plt
X = Y = np.linspace(7, 9, 100)
XX, YY = np.meshgrid(X,Y)
Z = np.exp(-(XX-XX.mean())**2/1 - (YY-YY.mean())**2/5)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow(Z, origin='lower', extent=[X.min(), X.max(), Y.min(), Y.max()])
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.grid(True, color='white')
[1]: http://i.stack.imgur.com/mfd09.png
Thanks in advance. | python | matplotlib | axes | null | null | null | open | Add tilted (floating) axes to overlay with standard axes
===
I am looking for a means to add an additional axis pair, both tilted and origin displaced. They should be added to axes already used for displaying an image.
The result should look somehow close to
y x+y
|\ /
9 | + -2 + 18
| \ /
| \ /
8 | x
| / \
| / \
7 | + 14 \x-y
|/ + 2
+--------------------- x
7 8 9
(unfortunately I was not allowed to upload the actual Image that I created)
The center of the tilted axes should be localized at a certain coordinate (x0,y0), in my case (8,8), and I'd like to be able to treat the new axes like the normal axes, i.e use functions like set_xlabel, grid, etc. on them.
I was trying to get results using Affine2D transforms, floating axes and spines, but was unable to get the correct grip on this matter. Any help is greatly welcome.
The unimportant part of the image was done using
import numpy as np
import matplotlib.pyplot as plt
X = Y = np.linspace(7, 9, 100)
XX, YY = np.meshgrid(X,Y)
Z = np.exp(-(XX-XX.mean())**2/1 - (YY-YY.mean())**2/5)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow(Z, origin='lower', extent=[X.min(), X.max(), Y.min(), Y.max()])
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.grid(True, color='white')
[1]: http://i.stack.imgur.com/mfd09.png
Thanks in advance. | 0 |
11,651,136 | 07/25/2012 13:43:16 | 1,459,583 | 06/15/2012 19:05:52 | 32 | 4 | AppleScript string concatenation in JavaScript | I'm trying to automate the Google Docs login process, but the methods that I thought would work yield nothing. The code is as follows.
display dialog "Username" default answer ""
set Username to the result
display dialog "Password" default answer "" with hidden answer
set myPassword to the result
tell application "Google Chrome"
tell window 1
set newTab to make new tab with properties {URL:"https://accounts.google.com/ServiceLogin?service=writely&passive=1209600&continue=https://docs.google.com/?tab%3Dwo%23&followup=https://docs.google.com/?tab%3Dwo<mpl=homepage"}
repeat 50 times --wait until the page loads...
delay 0.1
end repeat
tell active tab
execute javascript "document.getElementById('Email').value = '" & Username & "'"
end tell
end tell
end tell
The code in question is `execute javascript "document.getElementById('Email').value = '" & Username & "'"`. Whenever I try to execute the JavaScript using string concatenation, I get the following error: "Can’t make {text returned:"hello", button returned:"OK"} into type Unicode text."
I've also tried to use the following instead of altering the field's value <br />
`execute javascript "document.getElementById('Email').click()"` along with a `keystroke` command. However, that didn't work either. Am I doing something wrong, or is it just AppleScript?
It is worth noting that the following code works <br /> `execute javascript "document.getElementById('Email').value = '" & "Hello" & "'"`.
| javascript | dom | applescript | null | null | null | open | AppleScript string concatenation in JavaScript
===
I'm trying to automate the Google Docs login process, but the methods that I thought would work yield nothing. The code is as follows.
display dialog "Username" default answer ""
set Username to the result
display dialog "Password" default answer "" with hidden answer
set myPassword to the result
tell application "Google Chrome"
tell window 1
set newTab to make new tab with properties {URL:"https://accounts.google.com/ServiceLogin?service=writely&passive=1209600&continue=https://docs.google.com/?tab%3Dwo%23&followup=https://docs.google.com/?tab%3Dwo<mpl=homepage"}
repeat 50 times --wait until the page loads...
delay 0.1
end repeat
tell active tab
execute javascript "document.getElementById('Email').value = '" & Username & "'"
end tell
end tell
end tell
The code in question is `execute javascript "document.getElementById('Email').value = '" & Username & "'"`. Whenever I try to execute the JavaScript using string concatenation, I get the following error: "Can’t make {text returned:"hello", button returned:"OK"} into type Unicode text."
I've also tried to use the following instead of altering the field's value <br />
`execute javascript "document.getElementById('Email').click()"` along with a `keystroke` command. However, that didn't work either. Am I doing something wrong, or is it just AppleScript?
It is worth noting that the following code works <br /> `execute javascript "document.getElementById('Email').value = '" & "Hello" & "'"`.
| 0 |
11,651,137 | 07/25/2012 13:43:21 | 1,418,747 | 05/26/2012 07:16:36 | 1 | 0 | Which python web framework has more tutorials / books / documentation and more resources to learn? | i know python well, i listed out to learn Django but the django book is 2 yrs old, only updated documentation is there, is this enough for learning Django?
Can you tell any other Framework with has pretty decent documentation / books / tutorials than Django and as powerful as Django?
Thanks in Advance | python | django | web-frameworks | null | null | 07/25/2012 13:59:06 | not constructive | Which python web framework has more tutorials / books / documentation and more resources to learn?
===
i know python well, i listed out to learn Django but the django book is 2 yrs old, only updated documentation is there, is this enough for learning Django?
Can you tell any other Framework with has pretty decent documentation / books / tutorials than Django and as powerful as Django?
Thanks in Advance | 4 |
6,858,977 | 07/28/2011 12:28:40 | 87,154 | 04/04/2009 19:51:53 | 175 | 3 | How to get a facebook url like www.facebook.com/mysite | I have seen this everywhere, on television and now on bottles of Evian water. they have their Facebook page as [www.facebook.com/evianUK][1]
[1]: http://www.facebook.com/evianUK
I have created a company Facebook page for a website I'm building and I want to have the website name as part of the url.
I know how to do mod rewrite but obviously i can't on here.
Is there a setting i need to change or how is it done? | facebook | url | null | null | null | null | open | How to get a facebook url like www.facebook.com/mysite
===
I have seen this everywhere, on television and now on bottles of Evian water. they have their Facebook page as [www.facebook.com/evianUK][1]
[1]: http://www.facebook.com/evianUK
I have created a company Facebook page for a website I'm building and I want to have the website name as part of the url.
I know how to do mod rewrite but obviously i can't on here.
Is there a setting i need to change or how is it done? | 0 |
11,651,150 | 07/25/2012 13:43:48 | 1,055,276 | 11/19/2011 12:24:00 | 495 | 37 | App won't run on iOS 4.2, Architecture issue | I have an app that I developed in Xcode 4.3.2. I am using the base SDK as 5.1. The app installs fine in iOS 5.0 and above. But I need to support iOS 4.0 and above.
The compiler I am using is Apple LLVM compiler 3.1.
I have added both armv6 and armv7 to the architectures (See attached image)![Image][1])
[1]: http://i.stack.imgur.com/iutua.png
I created an AdHoc build. When I sync it using iTunes, it syncs fine with iOS 5.0 and above, I have not tested in iOS 4.3, but it does not install in iOS 4.2.1. It gives this error:
The app "App Name" could not be installed on the iPod "iPod Name" because it is not compatible with this iPod.
Any thoughts?
Thanks. | iphone | ios | xcode4.3 | xcodebuild | armv6 | null | open | App won't run on iOS 4.2, Architecture issue
===
I have an app that I developed in Xcode 4.3.2. I am using the base SDK as 5.1. The app installs fine in iOS 5.0 and above. But I need to support iOS 4.0 and above.
The compiler I am using is Apple LLVM compiler 3.1.
I have added both armv6 and armv7 to the architectures (See attached image)![Image][1])
[1]: http://i.stack.imgur.com/iutua.png
I created an AdHoc build. When I sync it using iTunes, it syncs fine with iOS 5.0 and above, I have not tested in iOS 4.3, but it does not install in iOS 4.2.1. It gives this error:
The app "App Name" could not be installed on the iPod "iPod Name" because it is not compatible with this iPod.
Any thoughts?
Thanks. | 0 |
11,651,151 | 07/25/2012 13:43:49 | 1,463,899 | 06/18/2012 13:59:59 | 11 | 0 | Reading line 3 to 5 from file, how do I make those line numbers into variables? | I am super new to perl but I am simply trying to open a file and reading some lines from it.
The code so far looks like this:
open FILE, "file.txt" or die "can not open file"; while (<FILE>) { print if
($.== 3..5) }
But I need to be able to change what lines to get. So those 3 and 5 numbers need to be variables.
Also can someone help me understand this code better? I'm wondering what $. is exactly and how would I replace the print command with putting it into an array or something to work further with those lines?
Thank you! | perl | null | null | null | null | null | open | Reading line 3 to 5 from file, how do I make those line numbers into variables?
===
I am super new to perl but I am simply trying to open a file and reading some lines from it.
The code so far looks like this:
open FILE, "file.txt" or die "can not open file"; while (<FILE>) { print if
($.== 3..5) }
But I need to be able to change what lines to get. So those 3 and 5 numbers need to be variables.
Also can someone help me understand this code better? I'm wondering what $. is exactly and how would I replace the print command with putting it into an array or something to work further with those lines?
Thank you! | 0 |
11,350,958 | 07/05/2012 19:09:58 | 189,551 | 10/14/2009 02:57:18 | 1,093 | 53 | In ColdFusion, is there a numberFormat() mask to drop the decimal if it is 0? | I'm trying to format numbers so that 2 decimal places show up, unless it is a whole number - then I don't want a decimal point to show. I've tried `0.00`, `_.__`, `9.99` and several combinations. Is there a mask for the `numberFormat` function that can get this result? | coldfusion | coldfusion-9 | numberformat | null | null | null | open | In ColdFusion, is there a numberFormat() mask to drop the decimal if it is 0?
===
I'm trying to format numbers so that 2 decimal places show up, unless it is a whole number - then I don't want a decimal point to show. I've tried `0.00`, `_.__`, `9.99` and several combinations. Is there a mask for the `numberFormat` function that can get this result? | 0 |
11,350,959 | 07/05/2012 19:10:01 | 300,129 | 03/23/2010 16:51:01 | 974 | 20 | Some Androids Uploading Scrambled Images | I am using this code to upload photos on Android devices:
public void uploadPhoto() {
try {
// Create HttpPost
HttpPost post = new HttpPost("http://www.example.com/upload.php");
HttpClient client = new DefaultHttpClient();
client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
MultipartEntity entity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE );
// Add the Picture as "userfile"
entity.addPart( "userfile", new FileBody(
new File( "/sdcard/", currentFilename + ".jpg" ),
"image/jpeg")
);
// Send the data to the server
post.setEntity( entity );
client.execute( post );
} catch (Exception e) {
// catch
} finally {
// finally
}
}
This works on my LG Transformer running Android 2.2.2 and Droid X running Android 2.3.4
However - a user who has an HTC Evo running 2.3.4 (Same as my Droid X) is experiencing that all of her uploaded photos are scrambled when they get to the server. The image looks like an array of jagged colored lines.
Any ideas about what might be going on here and what could be done to remedy the problem? | android | post | photos | null | null | null | open | Some Androids Uploading Scrambled Images
===
I am using this code to upload photos on Android devices:
public void uploadPhoto() {
try {
// Create HttpPost
HttpPost post = new HttpPost("http://www.example.com/upload.php");
HttpClient client = new DefaultHttpClient();
client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
MultipartEntity entity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE );
// Add the Picture as "userfile"
entity.addPart( "userfile", new FileBody(
new File( "/sdcard/", currentFilename + ".jpg" ),
"image/jpeg")
);
// Send the data to the server
post.setEntity( entity );
client.execute( post );
} catch (Exception e) {
// catch
} finally {
// finally
}
}
This works on my LG Transformer running Android 2.2.2 and Droid X running Android 2.3.4
However - a user who has an HTC Evo running 2.3.4 (Same as my Droid X) is experiencing that all of her uploaded photos are scrambled when they get to the server. The image looks like an array of jagged colored lines.
Any ideas about what might be going on here and what could be done to remedy the problem? | 0 |
11,351,041 | 07/05/2012 19:16:25 | 1,466,871 | 06/19/2012 15:29:22 | 1 | 0 | Sprockets::CircularDependencyError application.js has already been required | In my application, I receive a Sprockets::CircularDependencyError application.js has already been required. This affects every page in my application because none of the JS loads. Note - this error occurred after a fairly complex merge.
My assumption (please correct me if I'm wrong) is that this error occurs because two different files require application.js. If so, in which files should I look to debug this error? How could I test my application to determine what files are already requiring application.js?
Thank you very much for any help. I'd be more than happy to supply any pertinent information. | ruby-on-rails-3 | sprockets | null | null | null | null | open | Sprockets::CircularDependencyError application.js has already been required
===
In my application, I receive a Sprockets::CircularDependencyError application.js has already been required. This affects every page in my application because none of the JS loads. Note - this error occurred after a fairly complex merge.
My assumption (please correct me if I'm wrong) is that this error occurs because two different files require application.js. If so, in which files should I look to debug this error? How could I test my application to determine what files are already requiring application.js?
Thank you very much for any help. I'd be more than happy to supply any pertinent information. | 0 |
11,351,043 | 07/05/2012 19:16:29 | 1,046,501 | 11/14/2011 22:43:01 | 434 | 2 | Enclose a variable in single quotes in Python | How do I enclose a variable within single quotations in python? It's probably very simple but I can't seem to get it! I need to url-encode the variable `term`. `Term` is entered in a form by a user and is passed to a function where it is url-encoded `term=urllib.quote(term)`. If the user entered "apple computer" as their term, after url-encoding it would be "apple%20comptuer". What I want to do is have the term surrounded by single-quotes before url encoding, so that it will be "'apple computer'" then after url-encoding "%23apple%20computer%23". I need to pass the term to a url and it won't work unless I use this syntax. Any suggestions?
Sample Code:
import urllib2
import requests
def encode():
import urllib2
query= avariable #The word this variable= is to be enclosed by single quotes
query = urllib2.quote(query)
return dict(query=query)
def results():
bing = "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(query)s&$top=50&$format=json"
API_KEY = 'akey'
r = requests.get(bing % encode(), auth=('', API_KEY))
return r.json | python | null | null | null | null | null | open | Enclose a variable in single quotes in Python
===
How do I enclose a variable within single quotations in python? It's probably very simple but I can't seem to get it! I need to url-encode the variable `term`. `Term` is entered in a form by a user and is passed to a function where it is url-encoded `term=urllib.quote(term)`. If the user entered "apple computer" as their term, after url-encoding it would be "apple%20comptuer". What I want to do is have the term surrounded by single-quotes before url encoding, so that it will be "'apple computer'" then after url-encoding "%23apple%20computer%23". I need to pass the term to a url and it won't work unless I use this syntax. Any suggestions?
Sample Code:
import urllib2
import requests
def encode():
import urllib2
query= avariable #The word this variable= is to be enclosed by single quotes
query = urllib2.quote(query)
return dict(query=query)
def results():
bing = "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(query)s&$top=50&$format=json"
API_KEY = 'akey'
r = requests.get(bing % encode(), auth=('', API_KEY))
return r.json | 0 |
11,350,983 | 07/05/2012 19:12:15 | 1,049,601 | 11/16/2011 12:04:47 | 20 | 1 | Unable to connect to SQL Server 2008 in .Net | i am working on one c#.net web service.
i have deployed a web service which is working perfectly on my local system but when i tries to run the same service on my virtual dedicated server it is giving error to me.
this is my connection string
con.ConnectionString = "Data Source = <serverinstance>\\SQLEXPRESS; Initial Catalog = DomainTable; User ID= <serverinstance>\\admin; Password = <Windows_Login_Password>;
before this i was using this connection string
con.ConnectionString = "Data Source=<serverinstance>\\SQLEXPRESS; Initial Catalog=DomainTable; Integrated Security=SSPI";
none of them is working for me. please help its really really important | c# | .net | database | sql-server-2008 | null | null | open | Unable to connect to SQL Server 2008 in .Net
===
i am working on one c#.net web service.
i have deployed a web service which is working perfectly on my local system but when i tries to run the same service on my virtual dedicated server it is giving error to me.
this is my connection string
con.ConnectionString = "Data Source = <serverinstance>\\SQLEXPRESS; Initial Catalog = DomainTable; User ID= <serverinstance>\\admin; Password = <Windows_Login_Password>;
before this i was using this connection string
con.ConnectionString = "Data Source=<serverinstance>\\SQLEXPRESS; Initial Catalog=DomainTable; Integrated Security=SSPI";
none of them is working for me. please help its really really important | 0 |
11,350,985 | 07/05/2012 19:12:22 | 753,261 | 05/14/2011 03:15:11 | 1 | 0 | How to add swap to Amazon EC2 instance Ununtu 12.04 LTS? | default Ubuntu 12.04 LTS doesn't create swap for some reason.
Is there "proper" way to add it after install?
root@aux3:/disk1# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 8.0G 1.4G 6.3G 18% /
udev 1.9G 12K 1.9G 1% /dev
tmpfs 751M 188K 750M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
/dev/xvdb 394G 79G 296G 21% /mnt
root@aux3:/disk1# swapon -s
Filename
root@aux3:/disk1#
| ubuntu-12.04 | null | null | null | null | null | open | How to add swap to Amazon EC2 instance Ununtu 12.04 LTS?
===
default Ubuntu 12.04 LTS doesn't create swap for some reason.
Is there "proper" way to add it after install?
root@aux3:/disk1# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 8.0G 1.4G 6.3G 18% /
udev 1.9G 12K 1.9G 1% /dev
tmpfs 751M 188K 750M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 0 1.9G 0% /run/shm
/dev/xvdb 394G 79G 296G 21% /mnt
root@aux3:/disk1# swapon -s
Filename
root@aux3:/disk1#
| 0 |
11,351,046 | 07/05/2012 19:16:41 | 1,504,874 | 07/05/2012 18:26:33 | 8 | 0 | Oracle drop column and unused column | I have one table like test and 3 columns
1. Name
2 .id
3 .address
after some time i know one column is not in used then i have to drop one column `id` .
oracle has one feature to unused column so i didn't get what is differenc between `drop` column vs set `unused` column .
| oracle | null | null | null | null | null | open | Oracle drop column and unused column
===
I have one table like test and 3 columns
1. Name
2 .id
3 .address
after some time i know one column is not in used then i have to drop one column `id` .
oracle has one feature to unused column so i didn't get what is differenc between `drop` column vs set `unused` column .
| 0 |
11,351,058 | 07/05/2012 19:17:28 | 747,661 | 05/10/2011 21:40:56 | 1 | 0 | Comet implementation on glassfish v3 | I am trying to implement comet grizzly on my glassfish server v3.
I am trying to connect web server from desktop application using http url object.
I am creating ObjectInputStreamer and ObjectOutputStreamer at both client and web server.
In webserver servlet I am creating ObjectOutputStream to write response back to client.
And this output streamer I am attaching to handling of comet so that I could push data to client without request on same response channel afterwards.
and on client I am not closing the InputStreamer so that I can read the response pushed by webserver using comet.
But on writing data on output stream from webserver it is not giving any exception but still I am not able to read at client end which gives EOFException on reading from opened Input Stream.
Thanks,
Ali | java | comet | glassfish-3 | null | null | null | open | Comet implementation on glassfish v3
===
I am trying to implement comet grizzly on my glassfish server v3.
I am trying to connect web server from desktop application using http url object.
I am creating ObjectInputStreamer and ObjectOutputStreamer at both client and web server.
In webserver servlet I am creating ObjectOutputStream to write response back to client.
And this output streamer I am attaching to handling of comet so that I could push data to client without request on same response channel afterwards.
and on client I am not closing the InputStreamer so that I can read the response pushed by webserver using comet.
But on writing data on output stream from webserver it is not giving any exception but still I am not able to read at client end which gives EOFException on reading from opened Input Stream.
Thanks,
Ali | 0 |
11,351,060 | 07/05/2012 19:17:56 | 803,292 | 06/17/2011 13:19:48 | 3 | 0 | How can I display the name of the prpt file on a report in Pentaho Report Designer | This maybe simple but I am trying to display the name of the report(.prpt file) in the Page footer section of the Pentaho report. Is there any way to do this in the Pentaho Report Designer? | pentaho | null | null | null | null | null | open | How can I display the name of the prpt file on a report in Pentaho Report Designer
===
This maybe simple but I am trying to display the name of the report(.prpt file) in the Page footer section of the Pentaho report. Is there any way to do this in the Pentaho Report Designer? | 0 |
11,350,435 | 07/05/2012 18:33:52 | 369,247 | 06/17/2010 11:09:46 | 3,558 | 138 | Linq Expression to execute existing expression on a child property | Here is a simple class
public class Parent
{
public Child Child { get; set; }
}
Here is the method I'm trying to implement
Expression<Func<Parent, long>> GetChildIDExpr(Expression<Func<Child, long>> objectIdExpr)
{
//So I need to return an expression that can accept a Parent
//and apply the given expression to its Child property.
}
Sounds simple enough, but I just can't work it out!
How can I implement this method? | c# | linq | expression-trees | null | null | null | open | Linq Expression to execute existing expression on a child property
===
Here is a simple class
public class Parent
{
public Child Child { get; set; }
}
Here is the method I'm trying to implement
Expression<Func<Parent, long>> GetChildIDExpr(Expression<Func<Child, long>> objectIdExpr)
{
//So I need to return an expression that can accept a Parent
//and apply the given expression to its Child property.
}
Sounds simple enough, but I just can't work it out!
How can I implement this method? | 0 |
11,693,173 | 07/27/2012 17:59:40 | 1,480,902 | 06/25/2012 19:27:47 | 5 | 0 | Fusion Tables Layer infoWindow list | I am trying to print queried FusionTablesLayer rows into a separate div rather than open the information in a standard infoWindow when a marker is clicked. Basically I am trying to show the info for each marker, just like you would get when doing a normal google maps search. The Google Maps API v3 seems to only pull information from FusionTablesLayers when you click on a particular marker. All of the JSON examples I have found to perform a similar task seem to use the SQL API for Fusion Tables, which has been deprecated. I need to find a way to query the table using an orderBy distance. The map query I am using is below and this query works perfectly for populating the points on the map.
var Layer = new google.maps.FusionTablesLayer({
query: {
select: 'Latitude',
from: 'table_id',
orderBy: "ST_DISTANCE(Latitude, LATLNG"+latlng+")",
limit: 50
}
}); | google-maps-api-3 | google-maps-markers | google-fusion-tables | null | null | null | open | Fusion Tables Layer infoWindow list
===
I am trying to print queried FusionTablesLayer rows into a separate div rather than open the information in a standard infoWindow when a marker is clicked. Basically I am trying to show the info for each marker, just like you would get when doing a normal google maps search. The Google Maps API v3 seems to only pull information from FusionTablesLayers when you click on a particular marker. All of the JSON examples I have found to perform a similar task seem to use the SQL API for Fusion Tables, which has been deprecated. I need to find a way to query the table using an orderBy distance. The map query I am using is below and this query works perfectly for populating the points on the map.
var Layer = new google.maps.FusionTablesLayer({
query: {
select: 'Latitude',
from: 'table_id',
orderBy: "ST_DISTANCE(Latitude, LATLNG"+latlng+")",
limit: 50
}
}); | 0 |
11,693,178 | 07/27/2012 17:59:52 | 1,146,764 | 01/13/2012 01:34:09 | 449 | 25 | Rails - Order videos by comments count | I have a `Video` model and a `VideoComment`one with an association to `Video`.
I am trying to find the **most commented videos**.
How can I do that? | ruby-on-rails | null | null | null | null | null | open | Rails - Order videos by comments count
===
I have a `Video` model and a `VideoComment`one with an association to `Video`.
I am trying to find the **most commented videos**.
How can I do that? | 0 |
11,693,352 | 07/27/2012 18:11:31 | 466,011 | 10/04/2010 16:06:11 | 402 | 6 | How can I edit command-line args in shortcuts generated by InstallShield? | Sometimes when an installer installs a program, and creates shortcuts, for some reason they aren't "normal" shortcuts. They have the Target textbox and Open File Location button greyed out, like such:
![][1]
I'm using InstallShield 2011 LE (Limited Edition) for Visual Studio 2010. It works as advertised, but I don't see any options to change the way it creates shortcuts. The program I'm installing would greatly benefit from adding command line arguments to that Target textbox. If I go find the executable in Program Files, and Send To -> Desktop (create shortcut), I (and my users) can modify that one, no problem. I don't want to have to make them go through this step, though.
How are shortcuts placed by an installer different from "normal" shortcuts?
[1]: http://i.stack.imgur.com/qiwjL.png | command-line-arguments | installshield | shortcuts | null | null | null | open | How can I edit command-line args in shortcuts generated by InstallShield?
===
Sometimes when an installer installs a program, and creates shortcuts, for some reason they aren't "normal" shortcuts. They have the Target textbox and Open File Location button greyed out, like such:
![][1]
I'm using InstallShield 2011 LE (Limited Edition) for Visual Studio 2010. It works as advertised, but I don't see any options to change the way it creates shortcuts. The program I'm installing would greatly benefit from adding command line arguments to that Target textbox. If I go find the executable in Program Files, and Send To -> Desktop (create shortcut), I (and my users) can modify that one, no problem. I don't want to have to make them go through this step, though.
How are shortcuts placed by an installer different from "normal" shortcuts?
[1]: http://i.stack.imgur.com/qiwjL.png | 0 |
11,693,353 | 07/27/2012 18:11:33 | 1,558,330 | 07/27/2012 17:20:17 | 1 | 0 | How to App Develop with Enterprise certificate | i hope some one can help me and clean up my understanding to handle the d
We are new in taking part in App Development, so we enroll for the 99$ in the iOS Dev Center.
Up to here all is clear and we know how to use the iOS Dev Center and XCode to develop Apps.
But now one client ask us if we can't develop some Apps for him and use his Enterprise license.
For that he gave us some files. So we got a distribution.cer, distribution.p12 (Password protected), distribution.pem and key.key file.
Here starts now my question what and how i can do with that files, that i can develop a small Demo App with his Enterprise license.
I will be really appreciation, if some one can help me and explain if with that files it is possible to develop a App or if it is impossible because of.
Thank you | iphone | ios | ios5 | iphone-sdk-4.0 | enterprise | null | open | How to App Develop with Enterprise certificate
===
i hope some one can help me and clean up my understanding to handle the d
We are new in taking part in App Development, so we enroll for the 99$ in the iOS Dev Center.
Up to here all is clear and we know how to use the iOS Dev Center and XCode to develop Apps.
But now one client ask us if we can't develop some Apps for him and use his Enterprise license.
For that he gave us some files. So we got a distribution.cer, distribution.p12 (Password protected), distribution.pem and key.key file.
Here starts now my question what and how i can do with that files, that i can develop a small Demo App with his Enterprise license.
I will be really appreciation, if some one can help me and explain if with that files it is possible to develop a App or if it is impossible because of.
Thank you | 0 |
11,693,354 | 07/27/2012 18:11:34 | 1,558,395 | 07/27/2012 17:50:33 | 1 | 0 | issue with url rewriting | i have multiple rules on web.config they are:
1. <rewrite url="~/(.+)-(.+)-(.+)-(.+)-(.+).aspx" to="~/byalphabetical.aspx?alph=$5"/>
this one works fine , it check the 5 string and base on that it goes to byalphabetical.aspx page.
2. <rewrite url="~/(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
<rewrite url="~/(.+)-(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
<rewrite url="~/(.+)-(.+)-(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
i have try this for, if any url with (3 to 4 dash(-)) it goes to b.aspx page with first text search.
i just want it to know is this a right way or can i optimize it?
one more issue i m facing is. if my url is www.ysad.com/test-me-url-link.aspx then it goes to b.aspx page (as i have set rewrite path for it,)
but when my url is **www.ysad.com/category/test-me-url-link.aspx** the also it get hit the same page.
where i have not mention files form category folders are need to move as per in my web.config
<rewrite url="~/(.+)-(.+)-(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
please suggest where i m wrong?
| asp.net | null | null | null | null | null | open | issue with url rewriting
===
i have multiple rules on web.config they are:
1. <rewrite url="~/(.+)-(.+)-(.+)-(.+)-(.+).aspx" to="~/byalphabetical.aspx?alph=$5"/>
this one works fine , it check the 5 string and base on that it goes to byalphabetical.aspx page.
2. <rewrite url="~/(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
<rewrite url="~/(.+)-(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
<rewrite url="~/(.+)-(.+)-(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
i have try this for, if any url with (3 to 4 dash(-)) it goes to b.aspx page with first text search.
i just want it to know is this a right way or can i optimize it?
one more issue i m facing is. if my url is www.ysad.com/test-me-url-link.aspx then it goes to b.aspx page (as i have set rewrite path for it,)
but when my url is **www.ysad.com/category/test-me-url-link.aspx** the also it get hit the same page.
where i have not mention files form category folders are need to move as per in my web.config
<rewrite url="~/(.+)-(.+)-(.+)-(.+).aspx" to="~/b.aspx?alph=$1"/>
please suggest where i m wrong?
| 0 |
11,693,356 | 07/27/2012 18:11:41 | 1,489,223 | 06/28/2012 16:33:02 | 15 | 2 | json.loads function doesn't receive proper JSON - EXCEPTION: Expecting property name: line 1 column 1 (char 1) | I am on Windows 7 and my curl expression is as follows:
curl --header "X-CSRFToken: csrftoken" -X POST -H "Content-type:application/json" -d "{"username":"Steven"}"
However an exception is thrown at
simplejson.loads(request.body)
presumably because the json.loads function doesn't receive proper JSON.
It reads: Caught Exception: Expecting property name: line 1 column 1 (char 1)
What is going on here? | json | exception | curl | null | null | null | open | json.loads function doesn't receive proper JSON - EXCEPTION: Expecting property name: line 1 column 1 (char 1)
===
I am on Windows 7 and my curl expression is as follows:
curl --header "X-CSRFToken: csrftoken" -X POST -H "Content-type:application/json" -d "{"username":"Steven"}"
However an exception is thrown at
simplejson.loads(request.body)
presumably because the json.loads function doesn't receive proper JSON.
It reads: Caught Exception: Expecting property name: line 1 column 1 (char 1)
What is going on here? | 0 |
11,693,359 | 07/27/2012 18:11:57 | 1,226,906 | 02/22/2012 21:24:34 | 21 | 2 | Declare Array Variable To Use In A Ruby On Rails View | I am using Ruby 1.9.3 and Rails 3.2.6. I want to create a page where users can invite friends to sign up. The page would contain a number of fields where a user can enter email addresses. I would like these stored in an array. Basically each field on the page would be an element in the array. My hope is to loop through the array elements, verify each email address entered, update a temp email field on my table then launch an ActionMailer to send the invite email.
I would like this array initialized each time the user goes to the invite page. From what I have read in the book **Programming Ruby 1.9** I should be able to declare an array like this somewhere.
friend_email = Array.new
I need the variable available long enough to access it in my controller when I verify the data entered in my view. From my limited understanding of variables they generally are not available outside of where they are declared aka initialized. This makes it interesting when trying to send entered information to a mailer. I have used temp fields on my model to simplify things.
If there is a better way to do this I would appreciate the information. I will also continue doing research. I have seen only the one I list below where an array is populated by an existing table then displayed in a view. I want to populate the array from the view.
http://stackoverflow.com/questions/9014923/render-an-array-in-a-view-in-ruby-on-rails
Any help would be appreciated. | ruby-on-rails | ruby | ruby-on-rails-3.2 | ruby-on-rails-3.2.1 | ruby-on-rails-3.2.5 | null | open | Declare Array Variable To Use In A Ruby On Rails View
===
I am using Ruby 1.9.3 and Rails 3.2.6. I want to create a page where users can invite friends to sign up. The page would contain a number of fields where a user can enter email addresses. I would like these stored in an array. Basically each field on the page would be an element in the array. My hope is to loop through the array elements, verify each email address entered, update a temp email field on my table then launch an ActionMailer to send the invite email.
I would like this array initialized each time the user goes to the invite page. From what I have read in the book **Programming Ruby 1.9** I should be able to declare an array like this somewhere.
friend_email = Array.new
I need the variable available long enough to access it in my controller when I verify the data entered in my view. From my limited understanding of variables they generally are not available outside of where they are declared aka initialized. This makes it interesting when trying to send entered information to a mailer. I have used temp fields on my model to simplify things.
If there is a better way to do this I would appreciate the information. I will also continue doing research. I have seen only the one I list below where an array is populated by an existing table then displayed in a view. I want to populate the array from the view.
http://stackoverflow.com/questions/9014923/render-an-array-in-a-view-in-ruby-on-rails
Any help would be appreciated. | 0 |
11,693,360 | 07/27/2012 18:11:58 | 716,082 | 04/19/2011 22:06:10 | 960 | 34 | mysql2 gem Can't build native extensions | Our intern's computer is having problems installing the mysql2 gem. We just upgraded his computer from OS X 10.6 to 10.8 (Mountain Lion). I have tried installing mysql through homebrew and through the 64 bit DMG installer. I also tried symlinking to the dev tools (as pointed out here: http://stackoverflow.com/questions/11682429/not-able-to-install-some-gems-after-mountain-lion-upgrade). We have Xcode (4.4) installed and the command line tools installed. We tried a reboot after installing the command line tools.
This is his PATH declaration from `~/.bashrc`:
PATH=/usr/local/bin:$PATH:$HOME/.rvm/bin:/usr/local/mysql/bin # Add RVM to PATH for scripting
Symlink:
Diego-Blantons-MacBook-Pro-3:~ lmrunner07$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
Password:
Try to install gem:
Diego-Blantons-MacBook-Pro-3:~ lmrunner07$ gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
compiling client.c
In file included from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h:32,
from ./mysql2_ext.h:8,
from client.c:1:
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:105: error: size of array ‘ruby_check_sizeof_long’ is negative
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:109: error: size of array ‘ruby_check_sizeof_voidp’ is negative
In file included from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:34,
from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:1382,
from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h:32,
from ./mysql2_ext.h:8,
from client.c:1:
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/st.h:67: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative
client.c: In function ‘rb_raise_mysql2_error’:
client.c:98: warning: ISO C90 forbids mixed declarations and code
client.c: In function ‘rb_mysql_client_socket’:
client.c:590: warning: ISO C90 forbids mixed declarations and code
make: *** [client.o] Error 1
Gem files will remain installed in /Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
I've removed the homebrew installed mysql as well as the launch agent. Also `rm -rf` the gem directory (Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11) | ruby-on-rails | osx | gem | mysql2 | null | null | open | mysql2 gem Can't build native extensions
===
Our intern's computer is having problems installing the mysql2 gem. We just upgraded his computer from OS X 10.6 to 10.8 (Mountain Lion). I have tried installing mysql through homebrew and through the 64 bit DMG installer. I also tried symlinking to the dev tools (as pointed out here: http://stackoverflow.com/questions/11682429/not-able-to-install-some-gems-after-mountain-lion-upgrade). We have Xcode (4.4) installed and the command line tools installed. We tried a reboot after installing the command line tools.
This is his PATH declaration from `~/.bashrc`:
PATH=/usr/local/bin:$PATH:$HOME/.rvm/bin:/usr/local/mysql/bin # Add RVM to PATH for scripting
Symlink:
Diego-Blantons-MacBook-Pro-3:~ lmrunner07$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
Password:
Try to install gem:
Diego-Blantons-MacBook-Pro-3:~ lmrunner07$ gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
compiling client.c
In file included from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h:32,
from ./mysql2_ext.h:8,
from client.c:1:
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:105: error: size of array ‘ruby_check_sizeof_long’ is negative
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:109: error: size of array ‘ruby_check_sizeof_voidp’ is negative
In file included from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:34,
from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:1382,
from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h:32,
from ./mysql2_ext.h:8,
from client.c:1:
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/st.h:67: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative
client.c: In function ‘rb_raise_mysql2_error’:
client.c:98: warning: ISO C90 forbids mixed declarations and code
client.c: In function ‘rb_mysql_client_socket’:
client.c:590: warning: ISO C90 forbids mixed declarations and code
make: *** [client.o] Error 1
Gem files will remain installed in /Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
I've removed the homebrew installed mysql as well as the launch agent. Also `rm -rf` the gem directory (Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11) | 0 |
11,693,362 | 07/27/2012 18:12:03 | 1,558,301 | 07/27/2012 17:02:59 | 1 | 0 | Mysterious UDP packages altering TCP window size | I have a robotic device that asks me for measurement data over ethernet, about 20 times per second. It sends UDP packets to port 5020 for every request, and expects me to answer. I use a Linux box together with my sensor. A usual pair of request and answer looks like:
No. Time Source Dest Prot Info
65 2.555132 192.168.2.5 192.168.2.3 TCP 47906 > zenginkyo-1 [PSH, ACK] Seq=167 Ack=254 Win=8192 Len=8
66 2.555184 192.168.2.3 192.168.2.5 TCP zenginkyo-1 > 47906 [PSH, ACK] Seq=254 Ack=175 Win=5840 Len=14
...
I used Wireshark to capture this on my Linux box. The robotic device is 192.168.2.5, my Linux box is 192.168.2.3. Wireshark calls the UDP port 5020 "zenginkyo-1". The packets are rather small: 8 and 14 bytes length.
This way it looks most of the time, and the communication works without any trouble. However, sometimes it happens that the robotic device signals an error. This error is rather hard to trace. My server program is a C program, `sendto()` and `recvfrom` do not return anything suspicious. But everytime this happens, at least the last few hundert requests and answers look like:
No. Time Source Dest Prot Info
608 15.223983 192.168.2.5 192.168.2.3 TCP 44193 > zenginkyo-1 [PSH, ACK] Seq=2364 Ack=4100 Win=8192 Len=8
609 15.224047 192.168.2.3 192.168.2.5 TCP zenginkyo-1 > 44193 [PSH, ACK] Seq=4100 Ack=2372 Win=5840 Len=14
610 15.231733 192.168.2.5 192.168.2.3 TCP 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8179 Len=0
611 15.232235 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8180 Len=0
612 15.233251 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8182 Len=0
613 15.233732 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8184 Len=0
614 15.234206 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8186 Len=0
615 15.235087 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8188 Len=0
616 15.235581 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8190 Len=0
617 15.236077 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8192 Len=0
...
The robotic device sends its request, and I send the answer (No. 608 and 609).
After that, the device sends a bunch of empty packets, starting with No. 610. It seems to be signaling a change in the TCP window size: Win=8179. Please notice that it usually claims Win=8192. After this, it increments the window size by 1 or 2 until it reaches 8192 again. Then it waits until it sends its next request, where the same pattern accurs again and again.
I do not get my mysterious error every time I watch this pattern, but everythime I see the error, I see this pattern too. This might be evidence that the two are related.
Please notice that packets 610 to 617 share the same TCP sequence number: Seq=2372. As of my understanding, this is not legal in TCP. Is this true?
I do not even know what these packages mean. I send only 14 bytes on every request, so the TCP window should be large enough in any case. Do you know how to make sense of this? Is there anything I can do on my Linux box to make these packages disappear, or is it bug in the robotic device? | c | unix | tcp | udp | null | null | open | Mysterious UDP packages altering TCP window size
===
I have a robotic device that asks me for measurement data over ethernet, about 20 times per second. It sends UDP packets to port 5020 for every request, and expects me to answer. I use a Linux box together with my sensor. A usual pair of request and answer looks like:
No. Time Source Dest Prot Info
65 2.555132 192.168.2.5 192.168.2.3 TCP 47906 > zenginkyo-1 [PSH, ACK] Seq=167 Ack=254 Win=8192 Len=8
66 2.555184 192.168.2.3 192.168.2.5 TCP zenginkyo-1 > 47906 [PSH, ACK] Seq=254 Ack=175 Win=5840 Len=14
...
I used Wireshark to capture this on my Linux box. The robotic device is 192.168.2.5, my Linux box is 192.168.2.3. Wireshark calls the UDP port 5020 "zenginkyo-1". The packets are rather small: 8 and 14 bytes length.
This way it looks most of the time, and the communication works without any trouble. However, sometimes it happens that the robotic device signals an error. This error is rather hard to trace. My server program is a C program, `sendto()` and `recvfrom` do not return anything suspicious. But everytime this happens, at least the last few hundert requests and answers look like:
No. Time Source Dest Prot Info
608 15.223983 192.168.2.5 192.168.2.3 TCP 44193 > zenginkyo-1 [PSH, ACK] Seq=2364 Ack=4100 Win=8192 Len=8
609 15.224047 192.168.2.3 192.168.2.5 TCP zenginkyo-1 > 44193 [PSH, ACK] Seq=4100 Ack=2372 Win=5840 Len=14
610 15.231733 192.168.2.5 192.168.2.3 TCP 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8179 Len=0
611 15.232235 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8180 Len=0
612 15.233251 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8182 Len=0
613 15.233732 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8184 Len=0
614 15.234206 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8186 Len=0
615 15.235087 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8188 Len=0
616 15.235581 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8190 Len=0
617 15.236077 192.168.2.5 192.168.2.3 TCP [TCP Window Update] 44193 > zenginkyo-1 [ACK] Seq=2372 Ack=4114 Win=8192 Len=0
...
The robotic device sends its request, and I send the answer (No. 608 and 609).
After that, the device sends a bunch of empty packets, starting with No. 610. It seems to be signaling a change in the TCP window size: Win=8179. Please notice that it usually claims Win=8192. After this, it increments the window size by 1 or 2 until it reaches 8192 again. Then it waits until it sends its next request, where the same pattern accurs again and again.
I do not get my mysterious error every time I watch this pattern, but everythime I see the error, I see this pattern too. This might be evidence that the two are related.
Please notice that packets 610 to 617 share the same TCP sequence number: Seq=2372. As of my understanding, this is not legal in TCP. Is this true?
I do not even know what these packages mean. I send only 14 bytes on every request, so the TCP window should be large enough in any case. Do you know how to make sense of this? Is there anything I can do on my Linux box to make these packages disappear, or is it bug in the robotic device? | 0 |
11,693,364 | 07/27/2012 18:12:14 | 806,490 | 06/20/2011 10:50:26 | 41 | 1 | What has changed in Terminal.app in OS X 10.8? | Just upgraded OS X to Mountain Lion and noticed that Terminal.app version has changed from 2.2.3 to 2.3. Unfortunately, can`t find any information about what has changed.
Do you know if there is any place that provides very detailed changelog regarding OS and Apps?
| terminal | osx-mountain-lion | null | null | null | null | open | What has changed in Terminal.app in OS X 10.8?
===
Just upgraded OS X to Mountain Lion and noticed that Terminal.app version has changed from 2.2.3 to 2.3. Unfortunately, can`t find any information about what has changed.
Do you know if there is any place that provides very detailed changelog regarding OS and Apps?
| 0 |
11,693,365 | 07/27/2012 18:12:16 | 17,803 | 09/18/2008 15:01:08 | 9,090 | 237 | Difficulties with long-lived TCP connections in ASP.NET server-side code during local debugging | Let's say you have an ASP.NET website that you launched locally from VS2010, using IIS Express . You test the app, decide you want to make some changes. You stop the debugger. But, in actuality, the application is still running, you can still pull up pages, etc.
Then you update some library code, and launch again. Does it re-use an existing "app-pool"? Do objects with static initailizers get called again when enountered? Or are they only called again if they are from updated binaries (but unchanged library references are not reinitialized?) Are you starting from a blank slate?
The problem I am facing is that my server-side code is creating long-lived unmanaged objects (TCP connections, namely). I "stop debugging" my application, make a change, and try to launch it again. But I get an error, because the port is already bound, because the previous instance never fully "stopped" and let go of it. Even if I right-click the IIS Express icon in the system tray, and tell it to "stop all", it doesn't seem to help. Sometimes, by trying to relaunch I'll get an error that IIS Express crashed. Sometimes, the only thing I can do is closed down VS2010, open my solution again, and then launch. Obviously, this is less than ideal.
Any ideas? What is happening to the existing application running in memory when I try to re-deploy, and why are my unmanaged resources not being released? | asp.net | visual-studio-2010 | iis-express | null | null | null | open | Difficulties with long-lived TCP connections in ASP.NET server-side code during local debugging
===
Let's say you have an ASP.NET website that you launched locally from VS2010, using IIS Express . You test the app, decide you want to make some changes. You stop the debugger. But, in actuality, the application is still running, you can still pull up pages, etc.
Then you update some library code, and launch again. Does it re-use an existing "app-pool"? Do objects with static initailizers get called again when enountered? Or are they only called again if they are from updated binaries (but unchanged library references are not reinitialized?) Are you starting from a blank slate?
The problem I am facing is that my server-side code is creating long-lived unmanaged objects (TCP connections, namely). I "stop debugging" my application, make a change, and try to launch it again. But I get an error, because the port is already bound, because the previous instance never fully "stopped" and let go of it. Even if I right-click the IIS Express icon in the system tray, and tell it to "stop all", it doesn't seem to help. Sometimes, by trying to relaunch I'll get an error that IIS Express crashed. Sometimes, the only thing I can do is closed down VS2010, open my solution again, and then launch. Obviously, this is less than ideal.
Any ideas? What is happening to the existing application running in memory when I try to re-deploy, and why are my unmanaged resources not being released? | 0 |
11,567,995 | 07/19/2012 19:33:53 | 390,745 | 07/13/2010 17:28:45 | 408 | 28 | Filter by UserProfile fields with sfGuard plugin | How do I filter by the sfGuardUserProfile fields, when using the sfGuard plugin in Symfony 1.4?
As I think is standard, I created a sf_guard_user_profile table to hold fields like first name, last name, and so on.
I have a fairly stock list of users for my admin index page. I can filter by the username just fine. But I cannot filter by a field that is in the sf_guard_user_profile table, like last_name.
My generator.yml looks like
generator:
class: sfPropelGenerator
param:
model_class: sfGuardUser
config:
list:
display: [=username, first_name, last_name, last_login, role]
batch_actions: []
filter:
display: [username]
form:
class: myGuardUserAdminForm
I can get the fields to show up in the form on the page by changing to:
filter:
class: sfGuardUserProfileFormFilter
but when I submit that form with a valid value for last_name, it doesn't filter. All records are returned. | symfony | symfony-1.4 | sfguard | null | null | null | open | Filter by UserProfile fields with sfGuard plugin
===
How do I filter by the sfGuardUserProfile fields, when using the sfGuard plugin in Symfony 1.4?
As I think is standard, I created a sf_guard_user_profile table to hold fields like first name, last name, and so on.
I have a fairly stock list of users for my admin index page. I can filter by the username just fine. But I cannot filter by a field that is in the sf_guard_user_profile table, like last_name.
My generator.yml looks like
generator:
class: sfPropelGenerator
param:
model_class: sfGuardUser
config:
list:
display: [=username, first_name, last_name, last_login, role]
batch_actions: []
filter:
display: [username]
form:
class: myGuardUserAdminForm
I can get the fields to show up in the form on the page by changing to:
filter:
class: sfGuardUserProfileFormFilter
but when I submit that form with a valid value for last_name, it doesn't filter. All records are returned. | 0 |
11,567,998 | 07/19/2012 19:34:03 | 1,538,886 | 07/19/2012 19:10:19 | 1 | 0 | Google Calendar Display Customization | I'm using the code found here: http://james.cridland.net/code/google-calendar.html
I'm currently trying to make the following customization, but unfortunately I am novice at PHP and couldn't make anything work in the way I'd like:
- I'd like to have it display only ###DATESTART### if it is an event lasting only a single day (all-day event), but if it is an event that lasts more than a day to display in the following format: ###DATESTART### - ###DATEEND###
Actual start times are not a factor for the front-end and will not be displayed to users.
One of the problem with the if statements I was making is that when an event is scheduled as an "all-day event" (let's say July 20), it outputs as July 20, 2012 @ 12:00am - July 21, 2012 @12:00, which is technically accurate, but confusing for users.
I was attempting to see if ###DATESTART### == ###DATEEND### but obviously for all-day events these would be different dates given the implementation of all-day events.
Any help here would be greatly appreciated!
| php | google-calendar | null | null | null | null | open | Google Calendar Display Customization
===
I'm using the code found here: http://james.cridland.net/code/google-calendar.html
I'm currently trying to make the following customization, but unfortunately I am novice at PHP and couldn't make anything work in the way I'd like:
- I'd like to have it display only ###DATESTART### if it is an event lasting only a single day (all-day event), but if it is an event that lasts more than a day to display in the following format: ###DATESTART### - ###DATEEND###
Actual start times are not a factor for the front-end and will not be displayed to users.
One of the problem with the if statements I was making is that when an event is scheduled as an "all-day event" (let's say July 20), it outputs as July 20, 2012 @ 12:00am - July 21, 2012 @12:00, which is technically accurate, but confusing for users.
I was attempting to see if ###DATESTART### == ###DATEEND### but obviously for all-day events these would be different dates given the implementation of all-day events.
Any help here would be greatly appreciated!
| 0 |
11,568,007 | 07/19/2012 19:34:29 | 884,652 | 08/08/2011 19:01:03 | 108 | 1 | Phonegap: Unable to start receiver nullpointerexeption | I found an android app. You can see it here: https://github.com/ChrLipp/SmsReceiver-Phonegap
When I run it it receives a text message and displays it on the screen. However if the app is closed and a text is received the phone crashes and the above error is returned (unable to start receiver). However in the logs it looks like the app is still able to get the message data (which is what i want) but then crashes.
Any advice?
Basically I want a app that when it closes/runs to background still is able to get the data from the text and do something with it. | android | phonegap | android-intent | broadcastreceiver | null | null | open | Phonegap: Unable to start receiver nullpointerexeption
===
I found an android app. You can see it here: https://github.com/ChrLipp/SmsReceiver-Phonegap
When I run it it receives a text message and displays it on the screen. However if the app is closed and a text is received the phone crashes and the above error is returned (unable to start receiver). However in the logs it looks like the app is still able to get the message data (which is what i want) but then crashes.
Any advice?
Basically I want a app that when it closes/runs to background still is able to get the data from the text and do something with it. | 0 |
11,568,008 | 07/19/2012 19:34:32 | 1,529,800 | 07/16/2012 18:54:11 | 1 | 0 | Python zero-size array to ufunc.reduce without identity | I'm trying to make a histogram of some data that is being stored in an ndarray. The histogram is part of a set of analysis which I've made into a class in a python program. The part of the code that isn't working is below.
def histogram(self, iters):
samples = T.MCMC(iters) #Returns an [iters,3,4] ndarray
histAC = plt.figure(self.ip) #plt is matplotlib's pyplot
self.ip+=1 #defined at the beginning of the class to start at 0
for l in range(0,4):
h = histAC.add_subplot(2,(iters+1)/2,l+1)
for i in range(0,0.5*self.chan_num):
intAvg = mean(samples[:,i,l])
print intAvg
for k in range(0,iters):
samples[k,i,l]=samples[k,i,l]-intAvg
print "Samples is ",samples
h.hist(samples,bins=5000,range=[-6e-9,6e-9],histtype='step')
h.legend(loc='upper right')
h.set_title("AC Pulse Integral Histograms: "+str(l))
figname = 'ACHistograms.png'
figpath = 'plot'+str(self.ip)
print "Finished!"
#plt.savefig(figpath + figname, format = 'png')
This gives me the following error message:
File "johnmcmc.py", line 257, in histogram
h.hist(samples,bins=5000,range=[-6e-9,6e-9],histtype='step') #removed label=apdlabel
File "/x/tsfit/local/lib/python2.6/site-packages/matplotlib/axes.py", line 7238, in hist
ymin = np.amin(m[m!=0]) # filter out the 0 height bins
File "/x/tsfit/local/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line 1829, in amin
return amin(axis, out)
ValueError: zero-size array to ufunc.reduce without identity
The only search results I've found have been multiple copies of the same two conversations, from which the only thing I learned was that python histograms don't like getting fed empty arrays, which is why I added the print statement right above the line that's giving me trouble to make sure the array isn't empty.
Has anyone else come across this error before? | python | numpy | null | null | null | null | open | Python zero-size array to ufunc.reduce without identity
===
I'm trying to make a histogram of some data that is being stored in an ndarray. The histogram is part of a set of analysis which I've made into a class in a python program. The part of the code that isn't working is below.
def histogram(self, iters):
samples = T.MCMC(iters) #Returns an [iters,3,4] ndarray
histAC = plt.figure(self.ip) #plt is matplotlib's pyplot
self.ip+=1 #defined at the beginning of the class to start at 0
for l in range(0,4):
h = histAC.add_subplot(2,(iters+1)/2,l+1)
for i in range(0,0.5*self.chan_num):
intAvg = mean(samples[:,i,l])
print intAvg
for k in range(0,iters):
samples[k,i,l]=samples[k,i,l]-intAvg
print "Samples is ",samples
h.hist(samples,bins=5000,range=[-6e-9,6e-9],histtype='step')
h.legend(loc='upper right')
h.set_title("AC Pulse Integral Histograms: "+str(l))
figname = 'ACHistograms.png'
figpath = 'plot'+str(self.ip)
print "Finished!"
#plt.savefig(figpath + figname, format = 'png')
This gives me the following error message:
File "johnmcmc.py", line 257, in histogram
h.hist(samples,bins=5000,range=[-6e-9,6e-9],histtype='step') #removed label=apdlabel
File "/x/tsfit/local/lib/python2.6/site-packages/matplotlib/axes.py", line 7238, in hist
ymin = np.amin(m[m!=0]) # filter out the 0 height bins
File "/x/tsfit/local/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line 1829, in amin
return amin(axis, out)
ValueError: zero-size array to ufunc.reduce without identity
The only search results I've found have been multiple copies of the same two conversations, from which the only thing I learned was that python histograms don't like getting fed empty arrays, which is why I added the print statement right above the line that's giving me trouble to make sure the array isn't empty.
Has anyone else come across this error before? | 0 |
11,568,010 | 07/19/2012 19:34:50 | 1,074,343 | 11/30/2011 22:17:44 | 1 | 1 | Java If objects (x,y) are near other objects (x,y) | I have two separate objects in java. Object1 and Object2, both are the same size and square. For each object I can get the x and y coordinates. What I need to do is check if Object1 is within a certain distance of Object2. That distance is within 32 points on both the X and Y axis.
once the condition has been met then I can run my code. e.g.
if ( check condition ) {
//my code here
}
| java | math | if-statement | coordinates | null | null | open | Java If objects (x,y) are near other objects (x,y)
===
I have two separate objects in java. Object1 and Object2, both are the same size and square. For each object I can get the x and y coordinates. What I need to do is check if Object1 is within a certain distance of Object2. That distance is within 32 points on both the X and Y axis.
once the condition has been met then I can run my code. e.g.
if ( check condition ) {
//my code here
}
| 0 |
11,567,792 | 07/19/2012 19:17:42 | 1,492,812 | 06/30/2012 09:29:38 | 31 | 0 | C++ syntax error : missing ';' before '<' | Ehh, I'm having an issue which i don't understand...
class ManagedGlobals
{
public: gcroot<Editor^> MainEditor;
};
Why does my compiler give me:
syntax error : missing ';' before '<'
Why? | c++ | semicolon | null | null | null | null | open | C++ syntax error : missing ';' before '<'
===
Ehh, I'm having an issue which i don't understand...
class ManagedGlobals
{
public: gcroot<Editor^> MainEditor;
};
Why does my compiler give me:
syntax error : missing ';' before '<'
Why? | 0 |
11,568,013 | 07/19/2012 19:35:12 | 830,545 | 07/05/2011 22:27:49 | 316 | 7 | Is there a way to store multiple data types in a single hashtable variable? | I have a `Hashtable` which has a key of `String` and the value as `String`, but I've reached a point in my project where I need to be able to store multiple different data types. For example, I'm going to need to store `int`, `String`, `Date`, etc, all in one `Hashtable`. | java | null | null | null | null | null | open | Is there a way to store multiple data types in a single hashtable variable?
===
I have a `Hashtable` which has a key of `String` and the value as `String`, but I've reached a point in my project where I need to be able to store multiple different data types. For example, I'm going to need to store `int`, `String`, `Date`, etc, all in one `Hashtable`. | 0 |
11,568,015 | 07/19/2012 19:35:21 | 1,242,186 | 03/01/2012 08:44:14 | 31 | 1 | rendring simple_form errors | I have list with posts (pages#home), on click I open list with comments (posts#show), where I declare variable @feed_items. In the end of the comments I have simple_form for new comment (comments#create). Problem: if error occuring on submit button, I need to render existed list with comments and form with errors.
I'm trying in comments#create:
if @comment.save
...
else
render 'posts/show'
end
but in this case variable @feed_items isn't declared because method posts#show didn't called. When I trying to write redirect_to I see list with comments but without error messages. How to do this? | ruby-on-rails | ruby-on-rails-3 | simple-form | null | null | null | open | rendring simple_form errors
===
I have list with posts (pages#home), on click I open list with comments (posts#show), where I declare variable @feed_items. In the end of the comments I have simple_form for new comment (comments#create). Problem: if error occuring on submit button, I need to render existed list with comments and form with errors.
I'm trying in comments#create:
if @comment.save
...
else
render 'posts/show'
end
but in this case variable @feed_items isn't declared because method posts#show didn't called. When I trying to write redirect_to I see list with comments but without error messages. How to do this? | 0 |
11,568,016 | 07/19/2012 19:35:37 | 1,462,138 | 06/17/2012 17:24:51 | 1 | 0 | How to retrieve a list of public Google Docs from one user | Is there a way to retrieve a JSON or XML resource from Google Docs using an HTTP GET? I want to list public-only docs belonging to me on a web page, so the user viewing the web page should not need authentication or even to have a Google account.
I can do this easily in the Blogger API.
https://www.googleapis.com/blogger/v3/blogs/blogId/posts
Don't really care the method (writing in PHP) for retrieving the data, but I want it to happen server side and it should not require authentication by the user.
Have I missed something?
| php | xml | json | google-docs-api | null | null | open | How to retrieve a list of public Google Docs from one user
===
Is there a way to retrieve a JSON or XML resource from Google Docs using an HTTP GET? I want to list public-only docs belonging to me on a web page, so the user viewing the web page should not need authentication or even to have a Google account.
I can do this easily in the Blogger API.
https://www.googleapis.com/blogger/v3/blogs/blogId/posts
Don't really care the method (writing in PHP) for retrieving the data, but I want it to happen server side and it should not require authentication by the user.
Have I missed something?
| 0 |
11,568,017 | 07/19/2012 19:35:45 | 1,129,819 | 01/04/2012 11:27:53 | 59 | 2 | What's the best way to add a background to Android project? | My question is less about the programmatic aspect of Android and more about the designing of it.
My designer gave me a background so we can add it to our project.
It's a 960 x 640 image (iPhone designer :) and now I am wondering how I should apply it to my background's Theme.
Should I ask the designer to give me this background in ldpi, mdpi, hdpi and xhdpi resolutions? What's the performance impact of having an image as background in my application?
Or should I just convert it to a 9patch image and save it in the drawable folder?
I tried creating the 9patch image, but the background has some noise in it, and it stretched it incorrectly.
Many thanks,
Felipe | android | design | background | null | null | null | open | What's the best way to add a background to Android project?
===
My question is less about the programmatic aspect of Android and more about the designing of it.
My designer gave me a background so we can add it to our project.
It's a 960 x 640 image (iPhone designer :) and now I am wondering how I should apply it to my background's Theme.
Should I ask the designer to give me this background in ldpi, mdpi, hdpi and xhdpi resolutions? What's the performance impact of having an image as background in my application?
Or should I just convert it to a 9patch image and save it in the drawable folder?
I tried creating the 9patch image, but the background has some noise in it, and it stretched it incorrectly.
Many thanks,
Felipe | 0 |
11,568,019 | 07/19/2012 19:35:48 | 1,312,004 | 04/04/2012 05:37:38 | 1 | 0 | How to make two Fragments appear side-by-side in a ViewPager? | In Google Play on tablets, click on Apps and you will see a ViewPager with CATEGORIES, FEATURED, TOP PAID, and so on. When you swipe your finger from TOP PAID to FEATURED, the Fragment for TOP PAID leaves completely and simultaneously brings in the FEATURED Fragment.
However, when you scroll to CATEGORIES, you'll see that the left half of the FEATURED Fragment remains on the screen alongside with CATEGORIES instead of completing leaving the screen. The left half of FEATURED is still scrollable and its child views can still be clicked on...etc.
How is this done? I notice that this behavior is not seen in Google Play on phones. | android | android-fragments | android-viewpager | null | null | null | open | How to make two Fragments appear side-by-side in a ViewPager?
===
In Google Play on tablets, click on Apps and you will see a ViewPager with CATEGORIES, FEATURED, TOP PAID, and so on. When you swipe your finger from TOP PAID to FEATURED, the Fragment for TOP PAID leaves completely and simultaneously brings in the FEATURED Fragment.
However, when you scroll to CATEGORIES, you'll see that the left half of the FEATURED Fragment remains on the screen alongside with CATEGORIES instead of completing leaving the screen. The left half of FEATURED is still scrollable and its child views can still be clicked on...etc.
How is this done? I notice that this behavior is not seen in Google Play on phones. | 0 |
11,568,023 | 07/19/2012 19:35:51 | 144,695 | 07/24/2009 18:53:31 | 4,106 | 37 | modalViewController presented from UISplitViewController comes up as the wrong orientation | I have a `UISplitViewController` that is set at the rootView of my application. When `viewDidLoad` is called in my left view controller I do a check, then present a modal view controller using the following:
SiteConfiguration *config = [[SiteConfiguration alloc] initWithStyle:UITableViewStyleGrouped];
config.firstLoad = YES;
UINavigationController *configNav = [[UINavigationController alloc] initWithRootViewController:config];
if ([Utility isIpad]) {
configNav.modalPresentationStyle = UIModalPresentationFormSheet;
configNav.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[[AppDelegate instance].splitViewController presentModalViewController:configNav animated:YES];
} else {
[self presentModalViewController:configNav animated:YES];
}
If the iPad is in landscape mode while the app loads, the modalView is shown with an incorrect orientation:
![enter image description here][1]
[1]: http://i.stack.imgur.com/ksFhx.jpg
I can rotate the iPad to fix this, but WHY does it load up wrong? I have `shouldAutorotateToInterfaceOrientation:` returning YES in my `SiteConfiguration` viewController. What could be causing this? | objective-c | ios | cocoa-touch | uisplitviewcontroller | modalviewcontroller | null | open | modalViewController presented from UISplitViewController comes up as the wrong orientation
===
I have a `UISplitViewController` that is set at the rootView of my application. When `viewDidLoad` is called in my left view controller I do a check, then present a modal view controller using the following:
SiteConfiguration *config = [[SiteConfiguration alloc] initWithStyle:UITableViewStyleGrouped];
config.firstLoad = YES;
UINavigationController *configNav = [[UINavigationController alloc] initWithRootViewController:config];
if ([Utility isIpad]) {
configNav.modalPresentationStyle = UIModalPresentationFormSheet;
configNav.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[[AppDelegate instance].splitViewController presentModalViewController:configNav animated:YES];
} else {
[self presentModalViewController:configNav animated:YES];
}
If the iPad is in landscape mode while the app loads, the modalView is shown with an incorrect orientation:
![enter image description here][1]
[1]: http://i.stack.imgur.com/ksFhx.jpg
I can rotate the iPad to fix this, but WHY does it load up wrong? I have `shouldAutorotateToInterfaceOrientation:` returning YES in my `SiteConfiguration` viewController. What could be causing this? | 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.