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,262,390 | 06/29/2012 13:08:11 | 878,429 | 08/04/2011 11:01:54 | 121 | 15 | Dojo Accordion panel with toolbar and grid inside | Horizontal and vertical scroll bars appear when to put toolbar and grid inside of accordion panel. But if to put just toolbar or grid everything is fine.
So question is how to use toolbar and grid inside of accordion panel?
Here is my test page (Browser - Opera 12.0):
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Number Spinner Fun!</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/resources/dojo.css" media="screen">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dijit/themes/claro/claro.css" media="screen">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojox/grid/resources/Grid.css" media="screen">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojox/grid/resources/claroGrid.css" media="screen">
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js" data-dojo-config="async: true, parseOnLoad:true"></script>
<script>
require(["dijit/layout/BorderContainer", "dijit/layout/AccordionContainer", "dojox/grid/DataGrid", "dojo/data/ItemFileReadStore",
"dijit/layout/ContentPane", "dojo/parser", "dijit/Toolbar", "dijit/form/Button"]);
</script>
<script>
var store = new dojo.data.ItemFileReadStore({
data: {
identifier: "id",
items: [
{id: 1, status: 'On', service: 'ping'},
{id: 2, status: 'On', service: 'pop3'},
{id: 3, status: 'Off', service: 'cpu usage'},
{id: 4, status: 'On', service: 'sntp'},
{id: 5, status: 'On', service: 'disk:/tmp'}
]
}
});
</script>
<style>
html, body {
height: 100%;
margin: 0;
overflow: hidden;
padding: 0;
}
#appLayout {
height: 100%;
}
.noheader, .dojoxGridHeader{
display:none;
}
</style>
<head>
<body class="claro">
<div id="appLayout" class="demoLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'sidebar'">
<div class="edgePanel" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'center', splitter: true">
<div data-dojo-type="dijit.layout.AccordionContainer" data-dojo-props="closable: true"-->
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Services'" style="padding: 0px;">
<div data-dojo-type="dijit.Toolbar">
<div data-dojo-type="dijit.form.Button" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconCut', showLabel:false">Cut</div>
</div>
<table data-dojo-type="dojox.grid.DataGrid" data-dojo-props="store:store" style="width:100%;" class="hoheader">
<thead>
<tr>
<th field="status" width="2em">Status</th>
<th field="service" width="100%">Service</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</body>
</html> | dojo | grid | accordion | toolbar | null | null | open | Dojo Accordion panel with toolbar and grid inside
===
Horizontal and vertical scroll bars appear when to put toolbar and grid inside of accordion panel. But if to put just toolbar or grid everything is fine.
So question is how to use toolbar and grid inside of accordion panel?
Here is my test page (Browser - Opera 12.0):
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Number Spinner Fun!</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/resources/dojo.css" media="screen">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dijit/themes/claro/claro.css" media="screen">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojox/grid/resources/Grid.css" media="screen">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojox/grid/resources/claroGrid.css" media="screen">
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js" data-dojo-config="async: true, parseOnLoad:true"></script>
<script>
require(["dijit/layout/BorderContainer", "dijit/layout/AccordionContainer", "dojox/grid/DataGrid", "dojo/data/ItemFileReadStore",
"dijit/layout/ContentPane", "dojo/parser", "dijit/Toolbar", "dijit/form/Button"]);
</script>
<script>
var store = new dojo.data.ItemFileReadStore({
data: {
identifier: "id",
items: [
{id: 1, status: 'On', service: 'ping'},
{id: 2, status: 'On', service: 'pop3'},
{id: 3, status: 'Off', service: 'cpu usage'},
{id: 4, status: 'On', service: 'sntp'},
{id: 5, status: 'On', service: 'disk:/tmp'}
]
}
});
</script>
<style>
html, body {
height: 100%;
margin: 0;
overflow: hidden;
padding: 0;
}
#appLayout {
height: 100%;
}
.noheader, .dojoxGridHeader{
display:none;
}
</style>
<head>
<body class="claro">
<div id="appLayout" class="demoLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'sidebar'">
<div class="edgePanel" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'center', splitter: true">
<div data-dojo-type="dijit.layout.AccordionContainer" data-dojo-props="closable: true"-->
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Services'" style="padding: 0px;">
<div data-dojo-type="dijit.Toolbar">
<div data-dojo-type="dijit.form.Button" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconCut', showLabel:false">Cut</div>
</div>
<table data-dojo-type="dojox.grid.DataGrid" data-dojo-props="store:store" style="width:100%;" class="hoheader">
<thead>
<tr>
<th field="status" width="2em">Status</th>
<th field="service" width="100%">Service</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</body>
</html> | 0 |
11,387,140 | 07/08/2012 22:09:57 | 812,970 | 12/07/2010 18:18:29 | 115 | 4 | Restore text of jQuery combobox to selected option's text in case the text has been blanked by user? | I am facing an issue with the latest jQuery combobox. The use case is as described below.
1. I type in something into the combobox, which brings up all matching options and I select one of the matching options. This sets the combobox text to the selected item's text.
2. Now, I focus out of the combobox, and then come back to combobox and delete all the text, but not select another item. **The combobox is showing blank text even though the selected value is there.** This appears not very intuitive to me as a blank text should mean no option is selected.
A video illustrating this problem can be found here: [http://screencast.com/t/QLUtZYsL2][1]
**This is what I am aiming for in above use case:**
I want to make sure that in case the user somehow deletes the combobox text, then on leaving the combobox, the text gets restored to selected item's text.
[1]: http://screencast.com/t/QLUtZYsL2 | jquery | jquery-ui | jquery-ui-autocomplete | null | null | null | open | Restore text of jQuery combobox to selected option's text in case the text has been blanked by user?
===
I am facing an issue with the latest jQuery combobox. The use case is as described below.
1. I type in something into the combobox, which brings up all matching options and I select one of the matching options. This sets the combobox text to the selected item's text.
2. Now, I focus out of the combobox, and then come back to combobox and delete all the text, but not select another item. **The combobox is showing blank text even though the selected value is there.** This appears not very intuitive to me as a blank text should mean no option is selected.
A video illustrating this problem can be found here: [http://screencast.com/t/QLUtZYsL2][1]
**This is what I am aiming for in above use case:**
I want to make sure that in case the user somehow deletes the combobox text, then on leaving the combobox, the text gets restored to selected item's text.
[1]: http://screencast.com/t/QLUtZYsL2 | 0 |
11,387,141 | 07/08/2012 22:10:03 | 640,558 | 03/02/2011 04:50:28 | 2,108 | 50 | Can I create sperate queries for different views? | I'm learning sqlalchemy and not sure if I grasp it fully yet(I'm more used to writing queries by hand but I like the idea of abstracting the queries and getting objects). I'm going through the tutorial and trying to apply it to my code and ran into this part when defining a model:
def __repr__(self):
return "<User('%s','%s', '%s')>" % (self.name, self.fullname, self.password)
Its useful because I can just search for a username and get only the info about the user that I want but is there a way to either have multiple of these type of views that I can call? or am I using it wrong and should be writing a specific query for getting different data for different views?
Some context to why I'm asking my site has different templates, and most pages will just need the usersname, first/last name but some pages will require things like twitter or Facebook urls(also fields in the model). | sqlalchemy | null | null | null | null | null | open | Can I create sperate queries for different views?
===
I'm learning sqlalchemy and not sure if I grasp it fully yet(I'm more used to writing queries by hand but I like the idea of abstracting the queries and getting objects). I'm going through the tutorial and trying to apply it to my code and ran into this part when defining a model:
def __repr__(self):
return "<User('%s','%s', '%s')>" % (self.name, self.fullname, self.password)
Its useful because I can just search for a username and get only the info about the user that I want but is there a way to either have multiple of these type of views that I can call? or am I using it wrong and should be writing a specific query for getting different data for different views?
Some context to why I'm asking my site has different templates, and most pages will just need the usersname, first/last name but some pages will require things like twitter or Facebook urls(also fields in the model). | 0 |
11,387,143 | 07/08/2012 22:10:15 | 694,012 | 04/06/2011 01:37:34 | 69 | 5 | Controlling a .mov file with jQuery | So my question is **how do I start a movie with a call to a javascript / jquery function?**
Background:
I have an object in my html that embeds is a .mov file like so:
<object CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="100%" height="100%" class="movie1" id="movie1ie">
<param name="src" value="movies/test.mov">
<param name="autoplay" value="false">
<param name="loop" value="false">
<param name="controller" value="false">
<!--[if !IE]>-->
<object type="video/quicktime" data="movies/test.mov" width="100%" height="100%" class="movie1" id="movie1">
<param name="autoplay" value="false">
<param name="loop" value="false">
<param name="controller" value="false">
</object>
<!--<![endif]-->
</object>
And it seems to be okay, until I want to play the movie with a call to javascript. I am using jQuery so I tried this from within a function:
function startMovie(1){
var playIt = 'movie'+ whom;
$('#' + playIt).get(0).play();
}
But then I get this error:
Uncaught TypeError: Object #<HTMLObjectElement> has no method 'play'
Weird, but I'm no jQuery ninja so I tried to call it using good ole javascript:
function startMovie(1){
var playIt = 'movie'+ whom;
document.getElementById(playIt).Play();
}
But now I get the following error in my console:
Uncaught Error: Error calling method on NPObject.
Which is very wierd, since if I put the following into my console the movie will start playing without errors:
document.getElementById('movie1').Play()
FWIW I am using Chrome on a Mac and the files are running on the local machine (no server).
| javascript | jquery | object | movie | .mov | null | open | Controlling a .mov file with jQuery
===
So my question is **how do I start a movie with a call to a javascript / jquery function?**
Background:
I have an object in my html that embeds is a .mov file like so:
<object CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="100%" height="100%" class="movie1" id="movie1ie">
<param name="src" value="movies/test.mov">
<param name="autoplay" value="false">
<param name="loop" value="false">
<param name="controller" value="false">
<!--[if !IE]>-->
<object type="video/quicktime" data="movies/test.mov" width="100%" height="100%" class="movie1" id="movie1">
<param name="autoplay" value="false">
<param name="loop" value="false">
<param name="controller" value="false">
</object>
<!--<![endif]-->
</object>
And it seems to be okay, until I want to play the movie with a call to javascript. I am using jQuery so I tried this from within a function:
function startMovie(1){
var playIt = 'movie'+ whom;
$('#' + playIt).get(0).play();
}
But then I get this error:
Uncaught TypeError: Object #<HTMLObjectElement> has no method 'play'
Weird, but I'm no jQuery ninja so I tried to call it using good ole javascript:
function startMovie(1){
var playIt = 'movie'+ whom;
document.getElementById(playIt).Play();
}
But now I get the following error in my console:
Uncaught Error: Error calling method on NPObject.
Which is very wierd, since if I put the following into my console the movie will start playing without errors:
document.getElementById('movie1').Play()
FWIW I am using Chrome on a Mac and the files are running on the local machine (no server).
| 0 |
11,382,367 | 07/08/2012 10:21:22 | 217,586 | 11/24/2009 06:23:00 | 1,586 | 66 | identifying if an application is not responding | In my application I am able to retrieve running applications by invoking runningApplications method on shared instance of NSWorkspace.
Now I want to identify if an application is 'not responding' like how it shows in 'Force Quit' window when an application is unresponsive.
Is there any way to identify it? | cocoa | null | null | null | null | null | open | identifying if an application is not responding
===
In my application I am able to retrieve running applications by invoking runningApplications method on shared instance of NSWorkspace.
Now I want to identify if an application is 'not responding' like how it shows in 'Force Quit' window when an application is unresponsive.
Is there any way to identify it? | 0 |
11,387,146 | 07/08/2012 22:11:33 | 1,510,623 | 07/08/2012 21:58:17 | 1 | 0 | Changing font color and background image when hovering over button | For my navigation bar, I have several buttons. When hovering over a button, I want the background image to change and I want the font color to change. The background image is changing fine but I can't get the font color to change. I included both .but1 and .but2 to give an idea of what each of the buttons look like but so far I've only edited .but1 for the hover text.
Any help would be appreciated. Thanks!
**CSS:**
#buttons{
width: 665px;
background: url(images/bg_but.jpg) left top no-repeat;
text-align:center;
height: 46px;
margin-left: 450px;}
#buttons a {
font-family: 'OVerlock', cursive;
font-size: 20px;
display: block;
float: left;
height: 34px;
text-decoration: none;
color: #303030;
padding-top: 12px;
padding-left: 0px;
text-align: center;}
.but1 {
background: url(images/but1-4.png) left top no-repeat;
width: 134px;}
.but1:hover {
color: #FFFFFF;
background:url(images/but11.png) left top no-repeat; }
.but2 { background: url(images/but2.png) left top no-repeat;
width: 132px;}
.but2:hover { background:url(images/but22.png) left top no-repeat;}
**HTML**
<div id="buttons">
<a href="#" class="but1" title="">Home</a>
<a href="#" class="but2" title="">Projects</a>
<a href="#" class="but3" title="">Paintings</a>
<a href="#" class="but4" title="">About</a>
<a href="#" class="but5" title="">Contact</a>
</div> | html | css | null | null | null | null | open | Changing font color and background image when hovering over button
===
For my navigation bar, I have several buttons. When hovering over a button, I want the background image to change and I want the font color to change. The background image is changing fine but I can't get the font color to change. I included both .but1 and .but2 to give an idea of what each of the buttons look like but so far I've only edited .but1 for the hover text.
Any help would be appreciated. Thanks!
**CSS:**
#buttons{
width: 665px;
background: url(images/bg_but.jpg) left top no-repeat;
text-align:center;
height: 46px;
margin-left: 450px;}
#buttons a {
font-family: 'OVerlock', cursive;
font-size: 20px;
display: block;
float: left;
height: 34px;
text-decoration: none;
color: #303030;
padding-top: 12px;
padding-left: 0px;
text-align: center;}
.but1 {
background: url(images/but1-4.png) left top no-repeat;
width: 134px;}
.but1:hover {
color: #FFFFFF;
background:url(images/but11.png) left top no-repeat; }
.but2 { background: url(images/but2.png) left top no-repeat;
width: 132px;}
.but2:hover { background:url(images/but22.png) left top no-repeat;}
**HTML**
<div id="buttons">
<a href="#" class="but1" title="">Home</a>
<a href="#" class="but2" title="">Projects</a>
<a href="#" class="but3" title="">Paintings</a>
<a href="#" class="but4" title="">About</a>
<a href="#" class="but5" title="">Contact</a>
</div> | 0 |
11,387,147 | 07/08/2012 22:11:43 | 1,509,032 | 07/07/2012 17:09:17 | 1 | 0 | Notice: Trying to get property of non-object in .../search.php on line 46 | Can anyone help me with this error? Been looking it at for a while but haven't been able to get it to work. Wrote this a while ago and felt like it worked when I last left it, but I haven't been able to run it when I revisited it. Thanks for all the help.
Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/search/views/layouts/search.php on line 46
Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/search/views/layouts/search.php on line 46
Line 46 is the foreach line 4th from the last line of code.
<?php
include($_SERVER['DOCUMENT_ROOT'].'/'.'search/scripts/JSON.php');
include($_SERVER['DOCUMENT_ROOT'].'/'.'search/scripts/search_fns.php');
$searchquery = urlencode(isset($_GET['search']) ? $_GET['search'] : "news");
// Google Search API
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&"
. "q="
. $searchquery
."&key=ABQIAAAAYIeqEnf9yNjBzcHJK7yDdhSklBzi76D_F0lniPI7JR27aK7eCBSU-xpNs1axVS45y_PX_7_ibsScUA&userip=USERS-IP-ADDRESS&rsz=filtered_cse";
// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://localhost");
$body = curl_exec($ch);
curl_close($ch);
// process the JSON string
$json = new Services_JSON;
$json = $json->decode($body);
$formattedresults = "";
$rating = "";
$search = $searchquery;
?>
<style type="text/css">
td img {display: block;}
</style>
<div id="main">
<?php
foreach($json->responseData->results as $searchresult)
{
if($searchresult->GsearchResultClass == 'GwebSearch')
{ | php | json | null | null | null | null | open | Notice: Trying to get property of non-object in .../search.php on line 46
===
Can anyone help me with this error? Been looking it at for a while but haven't been able to get it to work. Wrote this a while ago and felt like it worked when I last left it, but I haven't been able to run it when I revisited it. Thanks for all the help.
Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/search/views/layouts/search.php on line 46
Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/search/views/layouts/search.php on line 46
Line 46 is the foreach line 4th from the last line of code.
<?php
include($_SERVER['DOCUMENT_ROOT'].'/'.'search/scripts/JSON.php');
include($_SERVER['DOCUMENT_ROOT'].'/'.'search/scripts/search_fns.php');
$searchquery = urlencode(isset($_GET['search']) ? $_GET['search'] : "news");
// Google Search API
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&"
. "q="
. $searchquery
."&key=ABQIAAAAYIeqEnf9yNjBzcHJK7yDdhSklBzi76D_F0lniPI7JR27aK7eCBSU-xpNs1axVS45y_PX_7_ibsScUA&userip=USERS-IP-ADDRESS&rsz=filtered_cse";
// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://localhost");
$body = curl_exec($ch);
curl_close($ch);
// process the JSON string
$json = new Services_JSON;
$json = $json->decode($body);
$formattedresults = "";
$rating = "";
$search = $searchquery;
?>
<style type="text/css">
td img {display: block;}
</style>
<div id="main">
<?php
foreach($json->responseData->results as $searchresult)
{
if($searchresult->GsearchResultClass == 'GwebSearch')
{ | 0 |
11,387,151 | 07/08/2012 22:12:29 | 1,489,938 | 06/28/2012 23:05:52 | 21 | 0 | Number of elements less than a particular number in a sorted list? | Given a number x and a sorted list
I need to find the number of elements less than or equal x in O(logn)
where n is the size of array
I am implementing binary search to return the index but it returns wrong index for some cases
| c | null | null | null | null | 07/09/2012 00:34:58 | not a real question | Number of elements less than a particular number in a sorted list?
===
Given a number x and a sorted list
I need to find the number of elements less than or equal x in O(logn)
where n is the size of array
I am implementing binary search to return the index but it returns wrong index for some cases
| 1 |
11,387,153 | 07/08/2012 22:12:53 | 427,598 | 08/22/2010 11:14:38 | 818 | 45 | Avoid generation of default setter getter | I added my own getter and setter to a variable:
class Person{
private var age = 0
def currentAge = age
def currentAge_=(age: Int) = this.age = age
}
Looking at compiled version gives:
public class Person implements scala.ScalaObject {
private int age;
private int age();
private void age_$eq(int);
public int currentAge();
public void currentAge_$eq(int);
public Person();
}
I want to avoid automatic generation of default getter and setter. Is it possible? | scala | null | null | null | null | null | open | Avoid generation of default setter getter
===
I added my own getter and setter to a variable:
class Person{
private var age = 0
def currentAge = age
def currentAge_=(age: Int) = this.age = age
}
Looking at compiled version gives:
public class Person implements scala.ScalaObject {
private int age;
private int age();
private void age_$eq(int);
public int currentAge();
public void currentAge_$eq(int);
public Person();
}
I want to avoid automatic generation of default getter and setter. Is it possible? | 0 |
11,387,155 | 07/08/2012 22:13:06 | 1,452,181 | 06/12/2012 20:15:30 | 19 | 1 | set class ignoring defined comp fn and errors on default comparison | I am using a custom Set class that is basically the same as the STL Set class
The problem is that I am somehow implementing it incorrectly and the default comparison function is used rather than a comparison I defined.
Set<Lexicon::CorrectionT> Lexicon::suggestCorrections(Lexicon::MatchesT & matchSet)
{
Set<CorrectionT> suggest(compareCorr); //ordered Set
suggestCorrectionsHelper(root, suggest, 0, matchSet.testWord, 0, matchSet.testTime);
return suggest;
}
int compareCorr(Lexicon::CorrectionT a, Lexicon::CorrectionT b)
{
if (a.editDistance < b.editDistance)
return -1;
else if (a.editDistance == b.editDistance)
return 0;
else
return 1;
}
struct CorrectionT {
int editDistance; //stackItems
string suggestedWord; //stackItems
};
Some research:
- [The class library][1]
- An issue with [the same class][2] - suggested that the STL Set class is used, in this case I might still need help understanding how to define the comparison function, so posting question
[1]: http://www.stanford.edu/class/cs106x/cs106lib/class_set.html
[2]: http://stackoverflow.com/questions/5843594/problem-with-calling-libraries
I have 19 C2784 errors all relating to some form of "error C2784: 'bool std::operator ==(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'Lexicon::CorrectionT'
and referencing this code
template <typename Type>
int OperatorCmp(Type one, Type two) {
if (one == two) return 0;
if (one < two) return -1;
return 1;
}
My question: how do you suggest correcting this?
| c++ | visual-studio-2008 | set | null | null | null | open | set class ignoring defined comp fn and errors on default comparison
===
I am using a custom Set class that is basically the same as the STL Set class
The problem is that I am somehow implementing it incorrectly and the default comparison function is used rather than a comparison I defined.
Set<Lexicon::CorrectionT> Lexicon::suggestCorrections(Lexicon::MatchesT & matchSet)
{
Set<CorrectionT> suggest(compareCorr); //ordered Set
suggestCorrectionsHelper(root, suggest, 0, matchSet.testWord, 0, matchSet.testTime);
return suggest;
}
int compareCorr(Lexicon::CorrectionT a, Lexicon::CorrectionT b)
{
if (a.editDistance < b.editDistance)
return -1;
else if (a.editDistance == b.editDistance)
return 0;
else
return 1;
}
struct CorrectionT {
int editDistance; //stackItems
string suggestedWord; //stackItems
};
Some research:
- [The class library][1]
- An issue with [the same class][2] - suggested that the STL Set class is used, in this case I might still need help understanding how to define the comparison function, so posting question
[1]: http://www.stanford.edu/class/cs106x/cs106lib/class_set.html
[2]: http://stackoverflow.com/questions/5843594/problem-with-calling-libraries
I have 19 C2784 errors all relating to some form of "error C2784: 'bool std::operator ==(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'Lexicon::CorrectionT'
and referencing this code
template <typename Type>
int OperatorCmp(Type one, Type two) {
if (one == two) return 0;
if (one < two) return -1;
return 1;
}
My question: how do you suggest correcting this?
| 0 |
11,471,718 | 07/13/2012 13:44:36 | 587,884 | 01/24/2011 17:46:22 | 11,193 | 412 | OpenAL alSourcePlay blocks when called from an Ogre3D application | I wrote a simple **OpenAL** wrapper in C++. It works fine. I followed some tutorials on the net and managed to play some ogg files using **libogg** and **libvorbis**.
Basically this is my play function:
bool GameAudioWrapper::Play(int iSoundId, bool iForceRestart )const
{
int sourceAudioState = 0;
alGetError();
ALint state ;
alGetSourcei(mAudioSources[iSoundId], AL_SOURCE_STATE, &state);
if ( state == AL_PLAYING )
{
if ( iForceRestart )
{
bool ret = Stop( iSoundId);
if (!ret)
return false;
}
else
return false;
}
alSourcePlay(mAudioSources[iSoundId]);
////// This is a busy wait loop but should be good enough for example purpose
do {
// Query the state of the souce
alGetSourcei(mAudioSources[iSoundId], AL_SOURCE_STATE, &state);
} while (state != AL_STOPPED);
if ( CheckErrors( "GameAudioWrapper::Play ") )
return false;
return true;
}
I had to add busy waiting for hear the sound for testing purposes, preventing the application to exit before the sound has been completely played. This suggest me that OpenAL lib runs on it's own thread.
Now I tryed to compile my wrapper both as a static lib or a dll, removing busy waiting, but when I used it from an Ogre3D application it seems that `GameAudioWrapper::Play` blocks the Ogre thread execution.
I can't figure out what could be the problem, does anyone have any idea? | c++ | openal | ogre3d | libogg | libvorbis | null | open | OpenAL alSourcePlay blocks when called from an Ogre3D application
===
I wrote a simple **OpenAL** wrapper in C++. It works fine. I followed some tutorials on the net and managed to play some ogg files using **libogg** and **libvorbis**.
Basically this is my play function:
bool GameAudioWrapper::Play(int iSoundId, bool iForceRestart )const
{
int sourceAudioState = 0;
alGetError();
ALint state ;
alGetSourcei(mAudioSources[iSoundId], AL_SOURCE_STATE, &state);
if ( state == AL_PLAYING )
{
if ( iForceRestart )
{
bool ret = Stop( iSoundId);
if (!ret)
return false;
}
else
return false;
}
alSourcePlay(mAudioSources[iSoundId]);
////// This is a busy wait loop but should be good enough for example purpose
do {
// Query the state of the souce
alGetSourcei(mAudioSources[iSoundId], AL_SOURCE_STATE, &state);
} while (state != AL_STOPPED);
if ( CheckErrors( "GameAudioWrapper::Play ") )
return false;
return true;
}
I had to add busy waiting for hear the sound for testing purposes, preventing the application to exit before the sound has been completely played. This suggest me that OpenAL lib runs on it's own thread.
Now I tryed to compile my wrapper both as a static lib or a dll, removing busy waiting, but when I used it from an Ogre3D application it seems that `GameAudioWrapper::Play` blocks the Ogre thread execution.
I can't figure out what could be the problem, does anyone have any idea? | 0 |
11,471,721 | 07/13/2012 13:44:38 | 1,484,365 | 06/27/2012 02:19:53 | 8 | 1 | How to get subgrid rows based on parent's primary key using jqGrid in ASP.NET MVC | I have created a subgrid in jqgrid and it works fine. But when I click the (+) sign, I get 20 rows for the subgrid (as specified in the rowNum) instead of the rows relevant to the parent's primary key. So, when the parent's primary key value is "1", I need to get the relevant rows in the subgrid, say rows that has parent's primary key as "1". I hope that's possible.
Below is my javascript:
<script type="text/javascript">
$(function () {
$("#list").jqGrid({
url: '/Home/GetData/',
datatype: 'json',
mtype: 'GET',
colNames: ['ID', 'NAME'],
colModel: [
{ name: 'ID', index: 'ID', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
{ name: 'NAME', index: 'NAME', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} }
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 30, 40, 50],
sortname: 'ID',
sortorder: "desc",
viewrecords: true,
caption: 'Request Response',
height: '100%',
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id){
var subgrid_table_id;
subgrid_table_id = subgrid_id + "_t";
jQuery("#"+subgrid_id).html("<table id ='"+subgrid_table_id+"' class='scroll'></table>");
jQuery("#" + subgrid_table_id).jqGrid({
url: "/Home/UpdateData/"+row_id,
datatype: 'json',
colNames: ['ID', 'DEVICENUMBER'],
colModel: [
{ name: 'ID', index: 'ID', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
{ name: 'DEVICENUMBER', index: 'DEVICENUMBER', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} }
],
height: '100%',
rowNum:20,
sortname: 'ID',
sortorder: "asc"
});
},
editurl: '/Home/Create',
height: '100%'
});
$("#list").jqGrid('navGrid', '#pager', { edit: true, add: true, del: true, search: true},
{},
{},
{},
{closeOnEscape: true, multipleSearch: true, closeAfterSearch: true},
{});
});
</script>
ID is the primary key in the parent grid and when I click the subgrid, I need to get the rows corresponding to ID only, not all the rows for the subgrid table.
Please let me know if anyone has any ideas! Thanks in advance. | asp.net-mvc-3 | jqgrid | jqgrid-asp.net | null | null | null | open | How to get subgrid rows based on parent's primary key using jqGrid in ASP.NET MVC
===
I have created a subgrid in jqgrid and it works fine. But when I click the (+) sign, I get 20 rows for the subgrid (as specified in the rowNum) instead of the rows relevant to the parent's primary key. So, when the parent's primary key value is "1", I need to get the relevant rows in the subgrid, say rows that has parent's primary key as "1". I hope that's possible.
Below is my javascript:
<script type="text/javascript">
$(function () {
$("#list").jqGrid({
url: '/Home/GetData/',
datatype: 'json',
mtype: 'GET',
colNames: ['ID', 'NAME'],
colModel: [
{ name: 'ID', index: 'ID', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
{ name: 'NAME', index: 'NAME', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} }
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 30, 40, 50],
sortname: 'ID',
sortorder: "desc",
viewrecords: true,
caption: 'Request Response',
height: '100%',
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id){
var subgrid_table_id;
subgrid_table_id = subgrid_id + "_t";
jQuery("#"+subgrid_id).html("<table id ='"+subgrid_table_id+"' class='scroll'></table>");
jQuery("#" + subgrid_table_id).jqGrid({
url: "/Home/UpdateData/"+row_id,
datatype: 'json',
colNames: ['ID', 'DEVICENUMBER'],
colModel: [
{ name: 'ID', index: 'ID', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
{ name: 'DEVICENUMBER', index: 'DEVICENUMBER', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} }
],
height: '100%',
rowNum:20,
sortname: 'ID',
sortorder: "asc"
});
},
editurl: '/Home/Create',
height: '100%'
});
$("#list").jqGrid('navGrid', '#pager', { edit: true, add: true, del: true, search: true},
{},
{},
{},
{closeOnEscape: true, multipleSearch: true, closeAfterSearch: true},
{});
});
</script>
ID is the primary key in the parent grid and when I click the subgrid, I need to get the rows corresponding to ID only, not all the rows for the subgrid table.
Please let me know if anyone has any ideas! Thanks in advance. | 0 |
11,471,722 | 07/13/2012 13:44:42 | 1,523,701 | 07/13/2012 13:38:38 | 1 | 0 | libstdc++.so.6: cannot open shared object file: No such file or directory | I want to run Cilkscreen command with a cilk++ program but I'v got this error
/usr/local/cilk/bin/../lib32/pinbin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
Can you help me please | c++ | cilk | null | null | null | null | open | libstdc++.so.6: cannot open shared object file: No such file or directory
===
I want to run Cilkscreen command with a cilk++ program but I'v got this error
/usr/local/cilk/bin/../lib32/pinbin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
Can you help me please | 0 |
11,471,723 | 07/13/2012 13:44:47 | 1,399,434 | 05/16/2012 19:01:37 | 50 | 4 | jQuery Function "undefined" according to Visual Studio 2010 | This may be a pretty simple question about jQuery UI and Javascript, but I am still feeling my way through these syntax's. I am trying to update a jQuery progress bar whenever my C# (ASP.NET) program reaches a certain point in different functions. Am I doing this correctly? I can see the empty progress bar on my page, but I cannot get it to update its progress.
Here are my scripts:
<script type="text/javascript">
$(document).ready(function() {
$("#progressbar").progressbar({ value: 0 });
});
function updateProgress(number) {
if (number < 100) {
$("#progressbar").progressbar("value", number);
}
}
</script>
Here are some more of my script references:
<link href="Styles/tomcat.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="colorbox.css" />
<script src="Scripts/jquery-1.7.2.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.21.custom.js" type="text/javascript"></script>
<script type="text/javascript" src="Scripts/jquery.colorbox.js"></script>
<link href="Content/themes/base/jquery.ui.progressbar.css" rel="stylesheet" type="text/css" />
<link href="Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.ui.core.js" type="text/javascript"></script>
<link href="Scripts/jquery-ui-1.8.21.custom.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.ui.progressbar.js" type="text/javascript"></script>
<link href="Scripts/ui.all.css" rel="stylesheet" type="text/css" />
And here is where I try to use the updateProgress() function via a C# function. I am trying to send "10%" to the progress bar but my debugger errors out and says that updateProgress() is not defined.
ScriptManager.RegisterStartupScript(this, this.GetType(), "temp", "<script language='javascript'>UpdateProgress(10);</script>", false); | c# | javascript | jquery | asp.net | jquery-ui-progressbar | null | open | jQuery Function "undefined" according to Visual Studio 2010
===
This may be a pretty simple question about jQuery UI and Javascript, but I am still feeling my way through these syntax's. I am trying to update a jQuery progress bar whenever my C# (ASP.NET) program reaches a certain point in different functions. Am I doing this correctly? I can see the empty progress bar on my page, but I cannot get it to update its progress.
Here are my scripts:
<script type="text/javascript">
$(document).ready(function() {
$("#progressbar").progressbar({ value: 0 });
});
function updateProgress(number) {
if (number < 100) {
$("#progressbar").progressbar("value", number);
}
}
</script>
Here are some more of my script references:
<link href="Styles/tomcat.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="colorbox.css" />
<script src="Scripts/jquery-1.7.2.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.21.custom.js" type="text/javascript"></script>
<script type="text/javascript" src="Scripts/jquery.colorbox.js"></script>
<link href="Content/themes/base/jquery.ui.progressbar.css" rel="stylesheet" type="text/css" />
<link href="Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.ui.core.js" type="text/javascript"></script>
<link href="Scripts/jquery-ui-1.8.21.custom.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.ui.progressbar.js" type="text/javascript"></script>
<link href="Scripts/ui.all.css" rel="stylesheet" type="text/css" />
And here is where I try to use the updateProgress() function via a C# function. I am trying to send "10%" to the progress bar but my debugger errors out and says that updateProgress() is not defined.
ScriptManager.RegisterStartupScript(this, this.GetType(), "temp", "<script language='javascript'>UpdateProgress(10);</script>", false); | 0 |
11,471,576 | 07/13/2012 13:35:04 | 655,134 | 03/11/2011 09:49:34 | 462 | 19 | Crystal Reports setdatasource | Im setting the report datasource in my C# code like this:
report.SetDataSource(dataSource);
And it all works but after that the crystal report still tries to connect to the database.
I though that if i set the datasource from the code the report wont want to get more data from database then.
Is that really like so that even afther setting the datasource from code report goes and askes more data from database? | c# | crystal-reports | datasource | null | null | null | open | Crystal Reports setdatasource
===
Im setting the report datasource in my C# code like this:
report.SetDataSource(dataSource);
And it all works but after that the crystal report still tries to connect to the database.
I though that if i set the datasource from the code the report wont want to get more data from database then.
Is that really like so that even afther setting the datasource from code report goes and askes more data from database? | 0 |
11,471,338 | 07/13/2012 13:20:23 | 5,343 | 09/09/2008 09:57:56 | 3,915 | 132 | Symfony: http_basic authentication works, http_digest fails | I'm configuring a Symfony2 application to use `http_digest` authentication. This is with Symfony 2.1.0-BETA2.
In security.yml, I am simply switching out `http_basic` for `http_digest` and adding the required `key` property. All else remains the same.
Relevant configuration that works:
firewalls:
main:
pattern: ^/
anonymous: ~
form_login: false
provider: fos_user_bundle
http_basic:
realm: "Example Realm"
Relevant configuration that does not work:
firewalls:
main:
pattern: ^/
anonymous: ~
form_login: false
provider: fos_user_bundle
http_digest:
realm: "Example Realm"
key: "%secret%"
As you can see, the only difference is switching out `http_basic` for `http_digest`. Changing the value of the `key` property appears to make no difference.
By working, I mean that with when using `http_basic`, the valid user credentials are accepted. When using `http_digest` the same valid user details are not accepted and the browser's default http authentication prompt is re-displayed.
Between security configuration changes, I clear both the dev and prod caches, empty the browser cache and close the browser.
Is there something critical I'm missing from the configuration? | symfony-2.0 | http-basic-authentication | http-digest | null | null | null | open | Symfony: http_basic authentication works, http_digest fails
===
I'm configuring a Symfony2 application to use `http_digest` authentication. This is with Symfony 2.1.0-BETA2.
In security.yml, I am simply switching out `http_basic` for `http_digest` and adding the required `key` property. All else remains the same.
Relevant configuration that works:
firewalls:
main:
pattern: ^/
anonymous: ~
form_login: false
provider: fos_user_bundle
http_basic:
realm: "Example Realm"
Relevant configuration that does not work:
firewalls:
main:
pattern: ^/
anonymous: ~
form_login: false
provider: fos_user_bundle
http_digest:
realm: "Example Realm"
key: "%secret%"
As you can see, the only difference is switching out `http_basic` for `http_digest`. Changing the value of the `key` property appears to make no difference.
By working, I mean that with when using `http_basic`, the valid user credentials are accepted. When using `http_digest` the same valid user details are not accepted and the browser's default http authentication prompt is re-displayed.
Between security configuration changes, I clear both the dev and prod caches, empty the browser cache and close the browser.
Is there something critical I'm missing from the configuration? | 0 |
11,471,638 | 07/13/2012 13:39:54 | 1,518,069 | 07/11/2012 14:22:34 | 1 | 0 | Time displays for comment box using php and mySQL | How can I set the timing for my comment box like 5 minutes ago,1 hour ago instead of posting the actual date and actual time using php and mySQL. | php | null | null | null | null | 07/14/2012 09:41:31 | not a real question | Time displays for comment box using php and mySQL
===
How can I set the timing for my comment box like 5 minutes ago,1 hour ago instead of posting the actual date and actual time using php and mySQL. | 1 |
11,713,191 | 07/29/2012 21:41:32 | 927,589 | 09/04/2011 13:38:07 | 1,960 | 7 | draw color scale in grid plot in r | I want to plot color scale with grid package. Something like heat.plot (10).
![enter image description here][1]
I am trying something like this:
require(grid)
legendViewport <- viewport(height=0.3, width=0.8)
pushViewport(legendViewport)
grid.rect(gp = gpar(col = "gray90"))
Let's say I want to divide 0 to 1, into 10 and fill heat.colors (10). Is there a simple way to do it.
[1]: http://i.stack.imgur.com/kVWsd.jpg
| r | colors | grid | fill | null | null | open | draw color scale in grid plot in r
===
I want to plot color scale with grid package. Something like heat.plot (10).
![enter image description here][1]
I am trying something like this:
require(grid)
legendViewport <- viewport(height=0.3, width=0.8)
pushViewport(legendViewport)
grid.rect(gp = gpar(col = "gray90"))
Let's say I want to divide 0 to 1, into 10 and fill heat.colors (10). Is there a simple way to do it.
[1]: http://i.stack.imgur.com/kVWsd.jpg
| 0 |
11,713,628 | 07/29/2012 22:44:23 | 1,561,615 | 07/29/2012 22:28:21 | 1 | 0 | Fancybox 2 - inline link | I've seen other similar problems when calling for inline content and have tried some of the solutions on here but none quite do it.
I would like to provide a link that generates the same content as the image already on the page without having to duplicate and hide all the images in another div. (EDIT: I already use a "hidden" class for the DIV containing the image references)
I've almost got it working but the link also generates another thumbnail that then generates the error message "The requested content cannot be loaded". Which is true, there is NO content for that link. I'm sure it's staring right at me but I can't get this thing sorted :(
testing page http://susanglover.com/countryfile2.html
and the code so far
$(document).ready(function() {
$("a#inline").fancybox({'type':'inline'});
$(".fancybox-thumb").fancybox({
prevEffect : 'easeInOutQuad',
nextEffect : 'easeInOutQuad',
closeBtn: false,
arrows: false,
helpers : {
buttons : {} ,
title : {
type: 'outside'
},
overlay : {
opacity : 0.9,
css : {
'background-color' : '#543948'
}
},
thumbs : {
width : 50,
height : 50
}
}
});
});
and the HTML
<a class="fancybox-thumb fancybox-button" rel="fancybox-thumb fancybox-button" href="#inline">gallery link</a> | fancybox-2 | null | null | null | null | null | open | Fancybox 2 - inline link
===
I've seen other similar problems when calling for inline content and have tried some of the solutions on here but none quite do it.
I would like to provide a link that generates the same content as the image already on the page without having to duplicate and hide all the images in another div. (EDIT: I already use a "hidden" class for the DIV containing the image references)
I've almost got it working but the link also generates another thumbnail that then generates the error message "The requested content cannot be loaded". Which is true, there is NO content for that link. I'm sure it's staring right at me but I can't get this thing sorted :(
testing page http://susanglover.com/countryfile2.html
and the code so far
$(document).ready(function() {
$("a#inline").fancybox({'type':'inline'});
$(".fancybox-thumb").fancybox({
prevEffect : 'easeInOutQuad',
nextEffect : 'easeInOutQuad',
closeBtn: false,
arrows: false,
helpers : {
buttons : {} ,
title : {
type: 'outside'
},
overlay : {
opacity : 0.9,
css : {
'background-color' : '#543948'
}
},
thumbs : {
width : 50,
height : 50
}
}
});
});
and the HTML
<a class="fancybox-thumb fancybox-button" rel="fancybox-thumb fancybox-button" href="#inline">gallery link</a> | 0 |
11,713,632 | 07/29/2012 22:45:09 | 1,555,805 | 07/26/2012 19:16:25 | 1 | 0 | Customized Title bar in android | I want to develop a title bar in android like this
1. Home Button - Left aligned
2. Application Title - At the center
3. Image Icon - Right Aligned
I am not sure how to do it.
I am a new user and hence not allowed to post the image here. Sorry for inconvinience. | android | android-titlebar | null | null | null | null | open | Customized Title bar in android
===
I want to develop a title bar in android like this
1. Home Button - Left aligned
2. Application Title - At the center
3. Image Icon - Right Aligned
I am not sure how to do it.
I am a new user and hence not allowed to post the image here. Sorry for inconvinience. | 0 |
11,713,636 | 07/29/2012 22:46:10 | 944,409 | 09/14/2011 10:44:32 | 11 | 1 | setVisibility hides nearby objects aswell | Im hiding a button from within a handler. The handler receives a message from a running thread and then updates the GUI.
The problem is that nearby (not all) buttons and textviews are also dissappearing from the screen.. Im using Relative Layout.
Does anyone know what could be causing the problem?
btnFold = (Button)findViewById(R.id.btnFold);
btnFold.setVisibility(View.VISIBLE); | android | null | null | null | null | null | open | setVisibility hides nearby objects aswell
===
Im hiding a button from within a handler. The handler receives a message from a running thread and then updates the GUI.
The problem is that nearby (not all) buttons and textviews are also dissappearing from the screen.. Im using Relative Layout.
Does anyone know what could be causing the problem?
btnFold = (Button)findViewById(R.id.btnFold);
btnFold.setVisibility(View.VISIBLE); | 0 |
11,713,637 | 07/29/2012 22:46:10 | 587,415 | 01/24/2011 11:36:39 | 881 | 26 | iOS clien server app. Authorization user | I make client server app and for now I implement authorization as first step interaction with a server.
Customer server return for me data in JSON format. But now JSON doesn't have full information.
What I plan:
First one I need some secret key that I will send to server. This key will use for first request. In response I will get JSON with new secret key that I will use for each other request. This is some secret key for unique user. Also for example in response I will get some user id.
So next step is encode. I think i need encode my request with md5 function (I know how it work).
Well, what I have now:
Secret key in app (that will encode before sending on the server).
Secret key (the same as token as I think) which will using for each request.
But this is just my "draft" how I can make it. Can you describe your method how to authorize user using JSON, secret, md5 and etc. I need just figure out with a scheme how I can make it. Or send to me any example. Thanks! | ios | json | client-server | md5 | null | null | open | iOS clien server app. Authorization user
===
I make client server app and for now I implement authorization as first step interaction with a server.
Customer server return for me data in JSON format. But now JSON doesn't have full information.
What I plan:
First one I need some secret key that I will send to server. This key will use for first request. In response I will get JSON with new secret key that I will use for each other request. This is some secret key for unique user. Also for example in response I will get some user id.
So next step is encode. I think i need encode my request with md5 function (I know how it work).
Well, what I have now:
Secret key in app (that will encode before sending on the server).
Secret key (the same as token as I think) which will using for each request.
But this is just my "draft" how I can make it. Can you describe your method how to authorize user using JSON, secret, md5 and etc. I need just figure out with a scheme how I can make it. Or send to me any example. Thanks! | 0 |
11,713,639 | 07/29/2012 22:46:13 | 892,401 | 08/12/2011 20:01:45 | 185 | 1 | jQuery: Ajax Sorting JSON | For some reason, I'm having problems sorting an AJAX Request.
First, Here is my controller data (this returns sorted):
public function get_agents() {
$this->autoRender = false;
$this->Agent->contain();
$agents = $this->Agent->find('list', array('conditions' => array('referral_partner' => 0), 'order' => array('name')));
echo json_encode($agents);
}
This is my jQuery code to retrieve/sort (and fill a SELECT box):
$.ajaxSetup({
async: false
});
$.getJSON("/agents/get_agents",{ajax: 'true'}, function(j) {
var agents_options = '';
$.each(j, function(key, value){
agents_options += '<option value="' + key + '">' + value + '</option>';
})
$('#t' + agents_counter).html(agents_options);
});
The jQuery is not keeping the same sort order. | jquery | null | null | null | null | null | open | jQuery: Ajax Sorting JSON
===
For some reason, I'm having problems sorting an AJAX Request.
First, Here is my controller data (this returns sorted):
public function get_agents() {
$this->autoRender = false;
$this->Agent->contain();
$agents = $this->Agent->find('list', array('conditions' => array('referral_partner' => 0), 'order' => array('name')));
echo json_encode($agents);
}
This is my jQuery code to retrieve/sort (and fill a SELECT box):
$.ajaxSetup({
async: false
});
$.getJSON("/agents/get_agents",{ajax: 'true'}, function(j) {
var agents_options = '';
$.each(j, function(key, value){
agents_options += '<option value="' + key + '">' + value + '</option>';
})
$('#t' + agents_counter).html(agents_options);
});
The jQuery is not keeping the same sort order. | 0 |
11,713,641 | 07/29/2012 22:46:33 | 1,028,986 | 11/04/2011 03:03:49 | 26 | 1 | Detection of parking lot lines and ROI openCV | I am working on a openCV project, trying to detect parking spaces and extract the ROI(Region of Interest) from an image for further vehicle detection. The image provided will consist of all empty parking spaces. I have read several posts and tutorials about this. So far, the approach I have tried are:
1.Convert image to grayscale using `cvtColor()`
2.Blur the image using `blur()`
3.Threshold the image to get edges `threshold()`
4.Find image contours using findContours()
5.Finding all convex contours using `convexHull()`
6.Approx polygonal regions using `approxPolyDP()`
7.Get the points for the result from 5, if total number of points =4.
Check for area and angle.
I guess the problem with this approach is when I do `findContours()`, it finds irregular and longer contours which causes `approxPolyDP` to assume quadrilaterals larger than the parking space itself. Some parking lines have holes/irregularity.
I have also tried `goodFeaturesToTrack()` and it gives corners quite efficiently, but the points stored in the output are in arbitrary order and I think it is going to be quite rigorous to extract quadrilaterals/rectangles from it.
I have spent quite good hours on this. Is there any better approach to this?
[Here][1] is the image I am playing with:
[1]: http://hdswc-westend.housing.ksu.edu/oneshotimage.jpg | c++ | image-processing | opencv | edge-detection | roi | null | open | Detection of parking lot lines and ROI openCV
===
I am working on a openCV project, trying to detect parking spaces and extract the ROI(Region of Interest) from an image for further vehicle detection. The image provided will consist of all empty parking spaces. I have read several posts and tutorials about this. So far, the approach I have tried are:
1.Convert image to grayscale using `cvtColor()`
2.Blur the image using `blur()`
3.Threshold the image to get edges `threshold()`
4.Find image contours using findContours()
5.Finding all convex contours using `convexHull()`
6.Approx polygonal regions using `approxPolyDP()`
7.Get the points for the result from 5, if total number of points =4.
Check for area and angle.
I guess the problem with this approach is when I do `findContours()`, it finds irregular and longer contours which causes `approxPolyDP` to assume quadrilaterals larger than the parking space itself. Some parking lines have holes/irregularity.
I have also tried `goodFeaturesToTrack()` and it gives corners quite efficiently, but the points stored in the output are in arbitrary order and I think it is going to be quite rigorous to extract quadrilaterals/rectangles from it.
I have spent quite good hours on this. Is there any better approach to this?
[Here][1] is the image I am playing with:
[1]: http://hdswc-westend.housing.ksu.edu/oneshotimage.jpg | 0 |
11,713,642 | 07/29/2012 22:47:00 | 1,103,263 | 12/17/2011 08:57:32 | 37 | 4 | Android to detect when you are holding down a button | I need to be able to tell when the user is holding a button down and when the user lets go. This is different from onClickListener and onLongClickListener. How would i go about doing something like this?
For example I press a button that starts a chronometer.(pseudo code)
if ButtonIsBeingPressed
{
chronometer start(); //and keep going
}
else chronometer stop();
//or on release or something
}
| android | audio | button | onclick | onlongclicklistener | null | open | Android to detect when you are holding down a button
===
I need to be able to tell when the user is holding a button down and when the user lets go. This is different from onClickListener and onLongClickListener. How would i go about doing something like this?
For example I press a button that starts a chronometer.(pseudo code)
if ButtonIsBeingPressed
{
chronometer start(); //and keep going
}
else chronometer stop();
//or on release or something
}
| 0 |
11,650,454 | 07/25/2012 13:09:27 | 1,092,450 | 12/11/2011 16:55:07 | 399 | 9 | How to create rotating circle animation in java? | I want to create a rotating circle in the middle of JPanel and be able to set strat/stop rotating and also visible/invisible.
**Does any body know how to do it or any existing example?**
private static class RotatingCirclePanel extends JPanel {
protected void paintComponent(Graphics g) {
}
}
**This is an example of it.**
![enter image description here][1]
[1]: http://i.stack.imgur.com/oQ0tF.gif | java | swing | paintcomponent | painting | null | null | open | How to create rotating circle animation in java?
===
I want to create a rotating circle in the middle of JPanel and be able to set strat/stop rotating and also visible/invisible.
**Does any body know how to do it or any existing example?**
private static class RotatingCirclePanel extends JPanel {
protected void paintComponent(Graphics g) {
}
}
**This is an example of it.**
![enter image description here][1]
[1]: http://i.stack.imgur.com/oQ0tF.gif | 0 |
11,634,714 | 07/24/2012 15:55:43 | 1,540,994 | 07/20/2012 14:05:09 | 6 | 0 | asp c# basic mailto function | I have been trying to go the next line using '\n' similarly used in Java but it doesn't seem to work in this script.
'\n' doesn't work but the entire function does without it.
My question is how do you you go to the next line?
String text_name = Text_Name.Text;
String text_email = Text_Email.Text;
String text_message = Text_Message.Text;
ClientScript.RegisterStartupScript(this.GetType(), "mailto",
"<script type = 'text/javascript'>parent.location='mailto:" + "[email protected]" +
"?subject=" + "Inquiry" +
"&body=" +
"Contact Name: " + text_name + '\n' +
"Contact By: " + text_email + '\n' +
"Inquiry: " + text_message + '\n' +
"'</script>"); | c# | javascript | asp.net | null | null | null | open | asp c# basic mailto function
===
I have been trying to go the next line using '\n' similarly used in Java but it doesn't seem to work in this script.
'\n' doesn't work but the entire function does without it.
My question is how do you you go to the next line?
String text_name = Text_Name.Text;
String text_email = Text_Email.Text;
String text_message = Text_Message.Text;
ClientScript.RegisterStartupScript(this.GetType(), "mailto",
"<script type = 'text/javascript'>parent.location='mailto:" + "[email protected]" +
"?subject=" + "Inquiry" +
"&body=" +
"Contact Name: " + text_name + '\n' +
"Contact By: " + text_email + '\n' +
"Inquiry: " + text_message + '\n' +
"'</script>"); | 0 |
11,650,468 | 07/25/2012 13:10:20 | 1,075,996 | 12/01/2011 17:47:15 | 29 | 0 | Perl script, find first half of string | Within a Perl script I need to process the following string:
426852 total
The string will always contain an integer followed by some white space and the word total. I need to strip away the string part of the variable to just leave an integer that I can compare later in the script.
What is the best way to achieve this?
Thanks
| regex | string | perl | null | null | 07/29/2012 01:06:54 | not a real question | Perl script, find first half of string
===
Within a Perl script I need to process the following string:
426852 total
The string will always contain an integer followed by some white space and the word total. I need to strip away the string part of the variable to just leave an integer that I can compare later in the script.
What is the best way to achieve this?
Thanks
| 1 |
11,650,465 | 07/25/2012 13:10:01 | 337,504 | 05/10/2010 17:24:07 | 1,342 | 64 | Custom Boootloader like GRUB, from scratch | I want to build a custom bootloader (not just changing images) that can actually start two different kernels. I know I can just edit via modifiying these:
default install
label install
menu label ^Install My Linux
kernel /install/vmlinuz
However what I want to accomplish is to integrate my custom hardware driver, that consists of touch screen some buttons etc, to make it available for navigation through the options. Can anybody show me a starting point? I have a little trouble finding on Google; maybe my keywords are wrong. | linux | bootloader | grub | null | null | null | open | Custom Boootloader like GRUB, from scratch
===
I want to build a custom bootloader (not just changing images) that can actually start two different kernels. I know I can just edit via modifiying these:
default install
label install
menu label ^Install My Linux
kernel /install/vmlinuz
However what I want to accomplish is to integrate my custom hardware driver, that consists of touch screen some buttons etc, to make it available for navigation through the options. Can anybody show me a starting point? I have a little trouble finding on Google; maybe my keywords are wrong. | 0 |
11,650,412 | 07/25/2012 13:06:48 | 1,422,006 | 05/28/2012 15:30:46 | 3 | 0 | SQL - Get values from database where column is unique | I need help with an advanced SQL-query(MSSQL 2000).
I have a table called "Result" that lists athletics 100 meter race-times.
A runner can have several racetimes but I want to show only the best time from each runner.
The Result-table contains three columns, Result_id, athlete_id, result_time.
So athlete_id must be unique when I list the values and result_time must be the fastest(lowest) value.
Any ideas? | php | sql | database | null | null | null | open | SQL - Get values from database where column is unique
===
I need help with an advanced SQL-query(MSSQL 2000).
I have a table called "Result" that lists athletics 100 meter race-times.
A runner can have several racetimes but I want to show only the best time from each runner.
The Result-table contains three columns, Result_id, athlete_id, result_time.
So athlete_id must be unique when I list the values and result_time must be the fastest(lowest) value.
Any ideas? | 0 |
11,650,475 | 07/25/2012 13:10:41 | 846,636 | 07/15/2011 14:32:18 | 809 | 39 | Verify the installed application using C# | I want to check a particular file is already installed in the system or not. The below code is my approach, can anybody tell me what am i doing is correct or wrong.
public Form1(bool isSilent, bool isXmlConfig)
{
this.isSilent = isSilent;
this.isXmlConfig = isXmlConfig;
x86 = !Environment.Is64BitOperatingSystem;
string regKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(regKey))
{
if (key != null && key.GetSubKeyNames().Any(keyName => key.OpenSubKey(keyName).GetValue("DisplayName") == "My App's Display Name"))
// Console.WriteLine("Already installed...");
Process.Start("vcredist_x86.exe");
//Console.WriteLine("Start installing...");
}
//if (true )
//{
// Process.Start("vcredist_x86.exe");
//}
MyExtract();
if (!isSilent)
Visible = ShowInTaskbar = false;
}
private void MyExtract()
{
string zipToUnpack = @"N:\Tools\DATABASE\CACHE";
string unpackDirectory = @"N:\Tools\DATABASE\CACHE\OUTPUT\";
using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
{
// here, we extract every entry, but we could extract conditionally
// based on entry name, size, date, checkbox status, etc.
foreach (ZipEntry e in zip1)
{
e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
}
}
Process.Start(unpackDirectory);
}
} | c# | installation | registry | null | null | 07/26/2012 07:59:43 | off topic | Verify the installed application using C#
===
I want to check a particular file is already installed in the system or not. The below code is my approach, can anybody tell me what am i doing is correct or wrong.
public Form1(bool isSilent, bool isXmlConfig)
{
this.isSilent = isSilent;
this.isXmlConfig = isXmlConfig;
x86 = !Environment.Is64BitOperatingSystem;
string regKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(regKey))
{
if (key != null && key.GetSubKeyNames().Any(keyName => key.OpenSubKey(keyName).GetValue("DisplayName") == "My App's Display Name"))
// Console.WriteLine("Already installed...");
Process.Start("vcredist_x86.exe");
//Console.WriteLine("Start installing...");
}
//if (true )
//{
// Process.Start("vcredist_x86.exe");
//}
MyExtract();
if (!isSilent)
Visible = ShowInTaskbar = false;
}
private void MyExtract()
{
string zipToUnpack = @"N:\Tools\DATABASE\CACHE";
string unpackDirectory = @"N:\Tools\DATABASE\CACHE\OUTPUT\";
using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
{
// here, we extract every entry, but we could extract conditionally
// based on entry name, size, date, checkbox status, etc.
foreach (ZipEntry e in zip1)
{
e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
}
}
Process.Start(unpackDirectory);
}
} | 2 |
11,627,966 | 07/24/2012 09:30:58 | 1,340,542 | 04/18/2012 06:42:21 | 47 | 0 | Iphone to parse XML Using touchxml parser? | In my application i have a xml file,which i want to parse using touchxml parse.the xml file is save in my resource folder of my project.
following is my xml file:
<slideshow>
<slides>
<slide src="1-1" tab="1">
<slide src="1-1-1" transition="fade-in" />
</slide>
<slide src="1-2" tab="1" />
<slide src="1-3" tab="1" />
<slide src="1-4" tab="1" />
<slide src="1-5" tab="1" />
<slide src="1-6" tab="1" />
<slide src="2-1" tab="2" />
<slide src="2-2" tab="2" />
<slide src="2-3" tab="2" />
<slide src="3-1" tab="3">
<slide src="3-1-1" transition="none"/>
<slide src="3-1-2" transition="none"/>
<slide src="3-1-3" transition="none"/>
<slide src="3-1-4" transition="none"/>
<slide src="3-1-5" transition="none"/>
</slide>
<slide src="3-2" tab="3" />
<slide src="4-1" tab="4" />
<slide src="4-2" tab="4" />
<slide src="4-3" tab="4" />
<slide src="4-4" tab="4" />
<slide src="4-5" tab="4" />
</slides>
<referenceview src="ref.html" btnsrc="ref.png" />
</slideshow>
please help me out with this.
| iphone | objective-c | ios | xcode | xcode4.3 | null | open | Iphone to parse XML Using touchxml parser?
===
In my application i have a xml file,which i want to parse using touchxml parse.the xml file is save in my resource folder of my project.
following is my xml file:
<slideshow>
<slides>
<slide src="1-1" tab="1">
<slide src="1-1-1" transition="fade-in" />
</slide>
<slide src="1-2" tab="1" />
<slide src="1-3" tab="1" />
<slide src="1-4" tab="1" />
<slide src="1-5" tab="1" />
<slide src="1-6" tab="1" />
<slide src="2-1" tab="2" />
<slide src="2-2" tab="2" />
<slide src="2-3" tab="2" />
<slide src="3-1" tab="3">
<slide src="3-1-1" transition="none"/>
<slide src="3-1-2" transition="none"/>
<slide src="3-1-3" transition="none"/>
<slide src="3-1-4" transition="none"/>
<slide src="3-1-5" transition="none"/>
</slide>
<slide src="3-2" tab="3" />
<slide src="4-1" tab="4" />
<slide src="4-2" tab="4" />
<slide src="4-3" tab="4" />
<slide src="4-4" tab="4" />
<slide src="4-5" tab="4" />
</slides>
<referenceview src="ref.html" btnsrc="ref.png" />
</slideshow>
please help me out with this.
| 0 |
11,627,977 | 07/24/2012 09:31:30 | 1,548,143 | 07/24/2012 09:11:27 | 1 | 0 | Sublime Text 2 and MinGW | Good day!
Can anyone share their experience how to attach MinGW-compiler to Sublime?
I found a config in the internet, but when I run compiled program popping bugs with missing files from "../MinGW/bin/".
Config:
{
"cmd": ["mingw32-g++.exe", "-o", "$file_base_name", "$file_name"],
"path": "c:\\Program Files\\MinGW\\bin\\"
}
Thanks! | c++ | windows | mingw | sublimetext | sublimetext2 | null | open | Sublime Text 2 and MinGW
===
Good day!
Can anyone share their experience how to attach MinGW-compiler to Sublime?
I found a config in the internet, but when I run compiled program popping bugs with missing files from "../MinGW/bin/".
Config:
{
"cmd": ["mingw32-g++.exe", "-o", "$file_base_name", "$file_name"],
"path": "c:\\Program Files\\MinGW\\bin\\"
}
Thanks! | 0 |
11,627,979 | 07/24/2012 09:31:50 | 648,889 | 03/07/2011 21:50:16 | 41 | 0 | Loading local audio .caf files, which object to use? iOS | The aim of this particular feature is to be able to display and play local voice recordings from a table view. The code for loading local caf files is as follows:
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadFileInformation];
}
- (void)loadFileInformation
{
items = [[NSMutableArray alloc] init];
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
for (int i = 0; i < [directoryContent count]; i++) [items addObject:[directoryContent objectAtIndex:i]];
[self.tableView reloadData];
}
With delegate method for playing a particular file as follows:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
avAudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[[items objectAtIndex:indexPath.row] filePathURL] error:nil];
avAudioPlayer.delegate = (id)self;
[avAudioPlayer prepareToPlay];
[avAudioPlayer play];
}
However when this method is called I get an error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString filePathURL]: unrecognized selector sent to instance 0x239420'
I'm just wondering if someone could point me in the correct direction! When the contents of the local directory are stored in the array `directoryContent`, what object is each element of? `NSData`?
Many thanks in advance | iphone | ios | tableview | avaudioplayer | caf | null | open | Loading local audio .caf files, which object to use? iOS
===
The aim of this particular feature is to be able to display and play local voice recordings from a table view. The code for loading local caf files is as follows:
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadFileInformation];
}
- (void)loadFileInformation
{
items = [[NSMutableArray alloc] init];
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
for (int i = 0; i < [directoryContent count]; i++) [items addObject:[directoryContent objectAtIndex:i]];
[self.tableView reloadData];
}
With delegate method for playing a particular file as follows:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
avAudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[[items objectAtIndex:indexPath.row] filePathURL] error:nil];
avAudioPlayer.delegate = (id)self;
[avAudioPlayer prepareToPlay];
[avAudioPlayer play];
}
However when this method is called I get an error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString filePathURL]: unrecognized selector sent to instance 0x239420'
I'm just wondering if someone could point me in the correct direction! When the contents of the local directory are stored in the array `directoryContent`, what object is each element of? `NSData`?
Many thanks in advance | 0 |
11,627,981 | 07/24/2012 09:31:52 | 1,417,201 | 05/25/2012 10:48:05 | 13 | 0 | Searching the element using predicate condition | How could I find a framework element in VisualTree by a predicate?
Something like that :
public static FrameworkElement FindChild(FrameworkElement root, Predicate<> predicate)
{
...
}
I'm goint to use it something like that:
Button btn = FindChild(MainForm, element => element is Button);
Thanks for help in advance! | c# | wpf | enumeration | visualtreehelper | null | null | open | Searching the element using predicate condition
===
How could I find a framework element in VisualTree by a predicate?
Something like that :
public static FrameworkElement FindChild(FrameworkElement root, Predicate<> predicate)
{
...
}
I'm goint to use it something like that:
Button btn = FindChild(MainForm, element => element is Button);
Thanks for help in advance! | 0 |
11,627,982 | 07/24/2012 09:31:56 | 1,548,154 | 07/24/2012 09:16:23 | 1 | 0 | Oracle DB : get the query that triggered a particular update | I would like to monitor some field in my database ; when an SQL query updates that field with a certain value, I would like to log the query that triggered the update.
How can I do that ?
Thank you in advance! | oracle | oracle11g | null | null | null | null | open | Oracle DB : get the query that triggered a particular update
===
I would like to monitor some field in my database ; when an SQL query updates that field with a certain value, I would like to log the query that triggered the update.
How can I do that ?
Thank you in advance! | 0 |
11,627,984 | 07/24/2012 09:32:01 | 609,387 | 02/09/2011 07:59:02 | 1,373 | 83 | Getting error while generating the .apk file if proguard is ON | I am using proguard to obfuscate the code.
I am getting the following error in console
Proguard returned with error code 1. See console
Warning: org.apache.cordova.CameraLauncher: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.CameraLauncher: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.CordovaWebView: can't find referenced method 'WebView(android.content.Context,android.util.AttributeSet,int,boolean)' in class android.webkit.WebView
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced method 'android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebView,java.lang.String)' in class android.webkit.WebViewClient
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.FileUtils: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.FileUtils: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: there were 9 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Warning: there were 2 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
My **project.properties** file is here
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=~/Desktop/Android/android-sdk-macosx/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-10
My **proguard-project.txt** is here
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
How to solve this?
| android | phonegap | proguard | null | null | null | open | Getting error while generating the .apk file if proguard is ON
===
I am using proguard to obfuscate the code.
I am getting the following error in console
Proguard returned with error code 1. See console
Warning: org.apache.cordova.CameraLauncher: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.CameraLauncher: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.CordovaWebView: can't find referenced method 'WebView(android.content.Context,android.util.AttributeSet,int,boolean)' in class android.webkit.WebView
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced method 'android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebView,java.lang.String)' in class android.webkit.WebViewClient
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.FileUtils: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.FileUtils: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: there were 9 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Warning: there were 2 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
My **project.properties** file is here
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=~/Desktop/Android/android-sdk-macosx/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-10
My **proguard-project.txt** is here
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
How to solve this?
| 0 |
11,627,986 | 07/24/2012 09:32:09 | 1,506,541 | 07/06/2012 11:09:32 | 1 | 4 | jboss 7 as deploy error ClassNotFoundException, LinkageError | Hello i try to deploy war file on jboss as 7. I know that deploying working couse i deploy other war file with no errors but this war is much more complicated and get's some errors. Belowa is error in eclipse from server
11:11:12,564 INFO [org.jboss.as.server.deployment] (pool-1-thread-11) Content added at location D:\liferay-portal-6.1.0-ce-ga1\jboss-7.0.2\standalone\data\content\3a\6447fca9f6c08a7f92ef5e09bca1f993a21a77\content
11:11:12,566 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "dts.war"
11:11:14,401 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry iText-toolbox.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,401 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry iText-toolbox-2.1.2.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,401 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry bcmail-jdk14-138.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,402 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry bcprov-jdk14-138.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,505 INFO [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to dts.war
11:11:14,554 WARN [org.jboss.modules] (MSC service thread 1-8) Failed to define class org.richfaces.skin.SkinBean in Module "deployment.dts.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/richfaces/skin/SkinBean (Module "deployment.dts.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.Module.loadModuleClass(Module.java:590) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103) [jboss-modules.jar:1.0.2.GA]
at org.jboss.as.web.deployment.jsf.JsfManagedBeanProcessor.deploy(JsfManagedBeanProcessor.java:104)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_15]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_15]
Caused by: java.lang.NoClassDefFoundError: org/richfaces/skin/Skin
at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_15]
at java.lang.ClassLoader.defineClass(ClassLoader.java:621) [:1.6.0_15]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) [:1.6.0_15]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397) [jboss-modules.jar:1.0.2.GA]
... 14 more
Caused by: java.lang.ClassNotFoundException: org.richfaces.skin.Skin from [Module "deployment.dts.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103) [jboss-modules.jar:1.0.2.GA]
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [:1.6.0_15]
... 18 more
11:11:14,556 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."dts.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."dts.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "dts.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_15]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_15]
Caused by: java.lang.LinkageError: Failed to link org/richfaces/skin/SkinBean (Module "deployment.dts.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)
at org.jboss.modules.Module.loadModuleClass(Module.java:590)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
at org.jboss.as.web.deployment.jsf.JsfManagedBeanProcessor.deploy(JsfManagedBeanProcessor.java:104)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/richfaces/skin/Skin
at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_15]
at java.lang.ClassLoader.defineClass(ClassLoader.java:621) [:1.6.0_15]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) [:1.6.0_15]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)
... 14 more
Caused by: java.lang.ClassNotFoundException: org.richfaces.skin.Skin from [Module "deployment.dts.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [:1.6.0_15]
... 18 more
11:11:14,558 INFO [org.jboss.as.server.controller] (pool-1-thread-11) Deployment of "dts.war" was rolled back with failure message {"Failed services" => {"jboss.deployment.unit.\"dts.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"dts.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"dts.war\""}}
11:11:14,559 INFO [org.jboss.as.controller] (pool-1-thread-11) Service status report
Services which failed to start:
service jboss.deployment.unit."dts.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."dts.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "dts.war"
11:11:16,271 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) Stopped deployment dts.war in 1711ms
How u can see, i have two issue i try to fix ClassNotFoundException by modify MANIFEST.MF and jboss-deployment-structure.xml wich code i put below
jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclusions>
</exclusions>
<dependencies>
</dependencies>
<resources>
<resource-root path="D:\Workspace Liferay\DTS_TRUNK\code\dts\dts-web\target\dts\WEB-INF\lib\richfaces-impl-3.3.3.Final" />
</resources>
</deployment>
</jboss-deployment-structure>
MANIFEST.MF
Manifest-Version: 1.0
Class-Path: D:\dts-web\WEB-INF\lib\richfaces-impl-3.3.3.Final.jar
But this not working. What am i doing wrong ? I also don't know how to solve other issue LinkageError. MAybe anyone can help me? Thanks in advance
| deployment | jboss | null | null | null | null | open | jboss 7 as deploy error ClassNotFoundException, LinkageError
===
Hello i try to deploy war file on jboss as 7. I know that deploying working couse i deploy other war file with no errors but this war is much more complicated and get's some errors. Belowa is error in eclipse from server
11:11:12,564 INFO [org.jboss.as.server.deployment] (pool-1-thread-11) Content added at location D:\liferay-portal-6.1.0-ce-ga1\jboss-7.0.2\standalone\data\content\3a\6447fca9f6c08a7f92ef5e09bca1f993a21a77\content
11:11:12,566 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "dts.war"
11:11:14,401 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry iText-toolbox.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,401 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry iText-toolbox-2.1.2.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,401 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry bcmail-jdk14-138.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,402 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) Class Path entry bcprov-jdk14-138.jar in "/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.war/WEB-INF/lib/itext-2.1.2.jar" does not point to a valid jar for a Class-Path reference.
11:11:14,505 INFO [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to dts.war
11:11:14,554 WARN [org.jboss.modules] (MSC service thread 1-8) Failed to define class org.richfaces.skin.SkinBean in Module "deployment.dts.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/richfaces/skin/SkinBean (Module "deployment.dts.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.Module.loadModuleClass(Module.java:590) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103) [jboss-modules.jar:1.0.2.GA]
at org.jboss.as.web.deployment.jsf.JsfManagedBeanProcessor.deploy(JsfManagedBeanProcessor.java:104)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_15]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_15]
Caused by: java.lang.NoClassDefFoundError: org/richfaces/skin/Skin
at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_15]
at java.lang.ClassLoader.defineClass(ClassLoader.java:621) [:1.6.0_15]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) [:1.6.0_15]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397) [jboss-modules.jar:1.0.2.GA]
... 14 more
Caused by: java.lang.ClassNotFoundException: org.richfaces.skin.Skin from [Module "deployment.dts.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310) [jboss-modules.jar:1.0.2.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103) [jboss-modules.jar:1.0.2.GA]
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [:1.6.0_15]
... 18 more
11:11:14,556 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."dts.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."dts.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "dts.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_15]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_15]
Caused by: java.lang.LinkageError: Failed to link org/richfaces/skin/SkinBean (Module "deployment.dts.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)
at org.jboss.modules.Module.loadModuleClass(Module.java:590)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
at org.jboss.as.web.deployment.jsf.JsfManagedBeanProcessor.deploy(JsfManagedBeanProcessor.java:104)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/richfaces/skin/Skin
at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_15]
at java.lang.ClassLoader.defineClass(ClassLoader.java:621) [:1.6.0_15]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) [:1.6.0_15]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)
... 14 more
Caused by: java.lang.ClassNotFoundException: org.richfaces.skin.Skin from [Module "deployment.dts.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [:1.6.0_15]
... 18 more
11:11:14,558 INFO [org.jboss.as.server.controller] (pool-1-thread-11) Deployment of "dts.war" was rolled back with failure message {"Failed services" => {"jboss.deployment.unit.\"dts.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"dts.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"dts.war\""}}
11:11:14,559 INFO [org.jboss.as.controller] (pool-1-thread-11) Service status report
Services which failed to start:
service jboss.deployment.unit."dts.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."dts.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "dts.war"
11:11:16,271 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) Stopped deployment dts.war in 1711ms
How u can see, i have two issue i try to fix ClassNotFoundException by modify MANIFEST.MF and jboss-deployment-structure.xml wich code i put below
jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclusions>
</exclusions>
<dependencies>
</dependencies>
<resources>
<resource-root path="D:\Workspace Liferay\DTS_TRUNK\code\dts\dts-web\target\dts\WEB-INF\lib\richfaces-impl-3.3.3.Final" />
</resources>
</deployment>
</jboss-deployment-structure>
MANIFEST.MF
Manifest-Version: 1.0
Class-Path: D:\dts-web\WEB-INF\lib\richfaces-impl-3.3.3.Final.jar
But this not working. What am i doing wrong ? I also don't know how to solve other issue LinkageError. MAybe anyone can help me? Thanks in advance
| 0 |
11,627,987 | 07/24/2012 09:32:12 | 360,211 | 06/07/2010 08:50:27 | 1,527 | 59 | Creating a service installer that reinstalls over the top | I have a service and a VS installer/setup project.
The installer installs/registers and uninstalls/unregisters the windows service fine.
In order to install without uninstalling I have `RemovePreviousVersions` set to True and I increment the version on the setup project properties and it prompts to also change the `ProjectCode`. All of this allows me to run the installer over the top of the previous one.
However during the install when it tries to register the service it complains that the service is already registered "Error 1001. The specified service already exists"
Should I test for this in my installer and not register the service again? This feels wrong because I expected it to uninstall the older version before installing the new version.
What bugs me is that when I right click the project and select "Install" from inside VS, it does all of this exactly correct without even having to increment versions etc. | visual-studio-2010 | windows-services | setup-project | null | null | null | open | Creating a service installer that reinstalls over the top
===
I have a service and a VS installer/setup project.
The installer installs/registers and uninstalls/unregisters the windows service fine.
In order to install without uninstalling I have `RemovePreviousVersions` set to True and I increment the version on the setup project properties and it prompts to also change the `ProjectCode`. All of this allows me to run the installer over the top of the previous one.
However during the install when it tries to register the service it complains that the service is already registered "Error 1001. The specified service already exists"
Should I test for this in my installer and not register the service again? This feels wrong because I expected it to uninstall the older version before installing the new version.
What bugs me is that when I right click the project and select "Install" from inside VS, it does all of this exactly correct without even having to increment versions etc. | 0 |
11,627,606 | 07/24/2012 09:08:39 | 1,487,722 | 06/28/2012 06:59:40 | 1 | 0 | Show 750+ images on annotation bubbles dynamically | I want to display more than 750+ images on annotation bubbles(small in size).All images are coming from flickr & picasa.When i click on particular annotation then only webservice should call for that particular annotation and show its image.
I have written code in didselectAnnotion like this
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
profileIconView = [[UIImageView alloc]initWithFrame:CGRectMake(18.5f, 10.0f, 37.0f, 30.0f)];
NSString *Link = [[locationDataArrayBoth objectAtIndex:annotationclick]objectForKey:@"smallphoto"];
// //Start download image from url
UIImage *img1 = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:Link]]];
// NSLog(@"Annotation Click %d",[locationDataArrayBoth count]);
// NSLog(@"image %@",img1);
profileIconView.image=img1;
}
How to give this to leftcallout property of annotation...
Please help | iphone | ios | ios5 | mkmapview | null | null | open | Show 750+ images on annotation bubbles dynamically
===
I want to display more than 750+ images on annotation bubbles(small in size).All images are coming from flickr & picasa.When i click on particular annotation then only webservice should call for that particular annotation and show its image.
I have written code in didselectAnnotion like this
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
profileIconView = [[UIImageView alloc]initWithFrame:CGRectMake(18.5f, 10.0f, 37.0f, 30.0f)];
NSString *Link = [[locationDataArrayBoth objectAtIndex:annotationclick]objectForKey:@"smallphoto"];
// //Start download image from url
UIImage *img1 = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:Link]]];
// NSLog(@"Annotation Click %d",[locationDataArrayBoth count]);
// NSLog(@"image %@",img1);
profileIconView.image=img1;
}
How to give this to leftcallout property of annotation...
Please help | 0 |
11,627,607 | 07/24/2012 09:08:40 | 674,133 | 03/24/2011 01:11:38 | 29 | 4 | Can Solr handle data import from tables like table1,table2,....tableN? | I have an mysql db, and the data tables named according to the sharding rule, which means the name has a same prefix,e.g: the_table_,and has a number for suffix, so the table name will be the_table_1,the_table_2,the_table_3.When we want to select a row, we have to find the table suffix from sql select mod(primary_key_id, 64)+1, the sharding rule, and the 64 is a base number, which means we have 64 tables.
Now we want to use Solr to index the data in the tables,but solr data-config.xml can not support sql query with dynamic name,So is there any suggestion to fix this problem? | solr | data-import | null | null | null | null | open | Can Solr handle data import from tables like table1,table2,....tableN?
===
I have an mysql db, and the data tables named according to the sharding rule, which means the name has a same prefix,e.g: the_table_,and has a number for suffix, so the table name will be the_table_1,the_table_2,the_table_3.When we want to select a row, we have to find the table suffix from sql select mod(primary_key_id, 64)+1, the sharding rule, and the 64 is a base number, which means we have 64 tables.
Now we want to use Solr to index the data in the tables,but solr data-config.xml can not support sql query with dynamic name,So is there any suggestion to fix this problem? | 0 |
11,298,442 | 07/02/2012 17:34:39 | 612,275 | 02/10/2011 23:44:13 | 253 | 8 | Rails 3 cannot serve assets in production from apache server | Using Rails 3.2.2 and ruby 1.9.2 and I am not able to serve assets in production. Not really experienced in configuring servers for webapps.
I have the following code in applictation.html.erb,
<a href="/"><img src="/assets/topbar.png" border="0" alt="My LOGO"></a>
I put topbar.png in app/assets/images/. It works as expected in development mode, shows up when the png is there, does not show up if I delete the png.
It does not show up in production. We have done the following, so far. The app does run, but it does not show the above asset.
<VirtualHost *:8081>
ServerName dev.mycompany.com:8081
DocumentRoot /var/www/vhosts/dev.mycompany.com/webapps/
# PassengerAppRoot /var/www/vhosts/dev.mycompany.com/webapps/testapp/public
# PassengerLogLevel 3
RackBaseURI /myRailsTest
<Directory /var/www/vhosts/dev.mycompany.com/webapps/myRailsTest>
AllowOverride all
Allow from all
Options -MultiViews
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode on
</IfModule>
</Directory>
</VirtualHost>
Do I have to do something more to configure the apache server? I'm reading this: http://guides.rubyonrails.org/asset_pipeline.html, but finding it pretty dense for a newbie.
What can I try? One thing I read is: "You should use app/assets for files that must undergo some pre-processing before they are served. In production, Rails precompiles these files to public/assets by default." But actually, I can't see that it is doing that for me. Is that the problem? Thanks!
| ruby-on-rails | assets | production | null | null | null | open | Rails 3 cannot serve assets in production from apache server
===
Using Rails 3.2.2 and ruby 1.9.2 and I am not able to serve assets in production. Not really experienced in configuring servers for webapps.
I have the following code in applictation.html.erb,
<a href="/"><img src="/assets/topbar.png" border="0" alt="My LOGO"></a>
I put topbar.png in app/assets/images/. It works as expected in development mode, shows up when the png is there, does not show up if I delete the png.
It does not show up in production. We have done the following, so far. The app does run, but it does not show the above asset.
<VirtualHost *:8081>
ServerName dev.mycompany.com:8081
DocumentRoot /var/www/vhosts/dev.mycompany.com/webapps/
# PassengerAppRoot /var/www/vhosts/dev.mycompany.com/webapps/testapp/public
# PassengerLogLevel 3
RackBaseURI /myRailsTest
<Directory /var/www/vhosts/dev.mycompany.com/webapps/myRailsTest>
AllowOverride all
Allow from all
Options -MultiViews
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode on
</IfModule>
</Directory>
</VirtualHost>
Do I have to do something more to configure the apache server? I'm reading this: http://guides.rubyonrails.org/asset_pipeline.html, but finding it pretty dense for a newbie.
What can I try? One thing I read is: "You should use app/assets for files that must undergo some pre-processing before they are served. In production, Rails precompiles these files to public/assets by default." But actually, I can't see that it is doing that for me. Is that the problem? Thanks!
| 0 |
11,298,443 | 07/02/2012 17:34:40 | 846,835 | 07/15/2011 16:41:00 | 48 | 0 | if conditional based on output in batch? | I'd like to redirect my program to a certain set of commands if the cmd window outputs: "Can't find ref_eng...", how can i accomplish this? In the codes below, at the 2nd line containing the For, is the location where the cmd.exe can output "can't find ref_eng" if !refLogPath! doesnt exist. At this point, I'd like to redirect my program elsewhere...
<!logPath! (
For /F "tokens=*" %%R in (!refLogPath!) DO (
if %ERRORLEVEL% NEQ 0 (
ECHO Check certain lines of code
)
set logLine=
set /p logLine=
set refLogLine=%%R
REM Check line by line of log against refLog
REM assume ALL times have been replaced with: "xx:xx:xx"
REM if corresponding lines mismatch
if NOT "!logLine!"=="!refLogLine!" (
Echo.
Echo line below is Incorrect:
set lnCorrect=false
REM output to command line: can be put into .log/.txt later
REM output ANY and ALL incorrect line in log file
ECHO !logLine!
)
)
) | redirect | if-statement | batch | for-loop | output | null | open | if conditional based on output in batch?
===
I'd like to redirect my program to a certain set of commands if the cmd window outputs: "Can't find ref_eng...", how can i accomplish this? In the codes below, at the 2nd line containing the For, is the location where the cmd.exe can output "can't find ref_eng" if !refLogPath! doesnt exist. At this point, I'd like to redirect my program elsewhere...
<!logPath! (
For /F "tokens=*" %%R in (!refLogPath!) DO (
if %ERRORLEVEL% NEQ 0 (
ECHO Check certain lines of code
)
set logLine=
set /p logLine=
set refLogLine=%%R
REM Check line by line of log against refLog
REM assume ALL times have been replaced with: "xx:xx:xx"
REM if corresponding lines mismatch
if NOT "!logLine!"=="!refLogLine!" (
Echo.
Echo line below is Incorrect:
set lnCorrect=false
REM output to command line: can be put into .log/.txt later
REM output ANY and ALL incorrect line in log file
ECHO !logLine!
)
)
) | 0 |
11,298,449 | 07/02/2012 17:35:08 | 1,187,140 | 02/03/2012 09:17:50 | 439 | 27 | Using OpenGL Shader on a QGraphicsView | I am trying to use an OpenGL Shader on a QGrapicsView.
My graphic card is a NVidia GeForce GT 425M. I made my experiments on a Ubuntu 12.04 with the NVidia driver 295.40.
I Create a QMainWindow containing two QGraphicsView, each graphics view are displaying the same scene. On One of the Graphics View, I setup an OpenGL View port.
The OpenGL View Port is a QGLWidget I had overloaded with the loading of the vertex and fragment shader programs.
Look at my QMainWindow constructor :
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
m_scene = new QGraphicsScene(this);
ui->gvShaded->setScene(m_scene);
ui->gvUnshaded->setScene(m_scene);
m_glWidget = new QGLScene();
ui->gvShaded->setViewport(m_glWidget);
m_glWidget->updateGL();
if(m_glWidget->context()->isValid())
{
qDebug()<<"GL Context is valid";
}else
{
qWarning()<<"GL Context is not valid";
}
qDebug() << "Opengl Version : " << m_glWidget->context()->format().openGLVersionFlags();
QBrush brush(QLinearGradient(0,0,20,0));
brush.setColor(Qt::blue);
QGraphicsRectItem* rect = m_scene->addRect(0,0,20,20,QPen(Qt::black), brush);
ui->gvShaded->ensureVisible(rect);
ui->gvUnshaded->ensureVisible(rect);
}
As you can see I instantiate the object QGLScene which is :
class QGLScene : public QGLWidget
{
public:
QGLScene(QWidget* _parent=0);
protected :
virtual void initializeGL();
};
My GLWidget Construction is :
QGLScene::QGLScene(QWidget *_parent)
:QGLWidget(QGLFormat(QGL::DepthBuffer), _parent)
{
}
And definition of initializeGL is :
void QGLScene::initializeGL()
{
qDebug() << __PRETTY_FUNCTION__;
QGLShader fragmentShader(QGLShader::Fragment, context(), this);
QGLShader vertexShader(QGLShader::Vertex, context(), this);
QGLShaderProgram pgm(context(), this);
if(vertexShader.compileSourceFile("./vertexShader.glsl"))
{
if(fragmentShader.compileSourceFile("./fragmentShader.glsl"))
{
pgm.addShader(&fragmentShader);
pgm.addShader(&vertexShader);
pgm.link();
pgm.bind();
qDebug() << "Shader bien chargé : "<< pgm.log();
}else
{
qDebug() << "Problem when loading fragment shader :";
qDebug() << fragmentShader.log();
qDebug() << QString(fragmentShader.sourceCode());
}
}else
{
qDebug() << "Problem when loading vertex shader :";
qDebug() << vertexShader.log();
qDebug() << QString(vertexShader.sourceCode());
}
}
My shaders are very useless shaders :
Vertex :
#version 150
uniform mat4 viewMatrix, projMatrix;
in vec4 position;
in vec3 color;
out vec3 Color;
void main()
{
Color = color;
gl_Position = projMatrix * viewMatrix * position ;
}
Fragment :
#version 150
in vec3 Color;
out vec4 outputF;
void main()
{
outputF = vec4(1.0, 0, 0, 1.);
}
So I attempt to have my Shaded Graphics view as a big red square because I think I enforced the pixels to be red (in my fragment shader).
I have no shader compilation error, but my two scene are the same.
Of course, the program pass into the initializeGL function (I can read the __PRETTY_FUNCTION__).
Does some one have an explanation ?
| qt | opengl | glsl | qgraphicsview | null | null | open | Using OpenGL Shader on a QGraphicsView
===
I am trying to use an OpenGL Shader on a QGrapicsView.
My graphic card is a NVidia GeForce GT 425M. I made my experiments on a Ubuntu 12.04 with the NVidia driver 295.40.
I Create a QMainWindow containing two QGraphicsView, each graphics view are displaying the same scene. On One of the Graphics View, I setup an OpenGL View port.
The OpenGL View Port is a QGLWidget I had overloaded with the loading of the vertex and fragment shader programs.
Look at my QMainWindow constructor :
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
m_scene = new QGraphicsScene(this);
ui->gvShaded->setScene(m_scene);
ui->gvUnshaded->setScene(m_scene);
m_glWidget = new QGLScene();
ui->gvShaded->setViewport(m_glWidget);
m_glWidget->updateGL();
if(m_glWidget->context()->isValid())
{
qDebug()<<"GL Context is valid";
}else
{
qWarning()<<"GL Context is not valid";
}
qDebug() << "Opengl Version : " << m_glWidget->context()->format().openGLVersionFlags();
QBrush brush(QLinearGradient(0,0,20,0));
brush.setColor(Qt::blue);
QGraphicsRectItem* rect = m_scene->addRect(0,0,20,20,QPen(Qt::black), brush);
ui->gvShaded->ensureVisible(rect);
ui->gvUnshaded->ensureVisible(rect);
}
As you can see I instantiate the object QGLScene which is :
class QGLScene : public QGLWidget
{
public:
QGLScene(QWidget* _parent=0);
protected :
virtual void initializeGL();
};
My GLWidget Construction is :
QGLScene::QGLScene(QWidget *_parent)
:QGLWidget(QGLFormat(QGL::DepthBuffer), _parent)
{
}
And definition of initializeGL is :
void QGLScene::initializeGL()
{
qDebug() << __PRETTY_FUNCTION__;
QGLShader fragmentShader(QGLShader::Fragment, context(), this);
QGLShader vertexShader(QGLShader::Vertex, context(), this);
QGLShaderProgram pgm(context(), this);
if(vertexShader.compileSourceFile("./vertexShader.glsl"))
{
if(fragmentShader.compileSourceFile("./fragmentShader.glsl"))
{
pgm.addShader(&fragmentShader);
pgm.addShader(&vertexShader);
pgm.link();
pgm.bind();
qDebug() << "Shader bien chargé : "<< pgm.log();
}else
{
qDebug() << "Problem when loading fragment shader :";
qDebug() << fragmentShader.log();
qDebug() << QString(fragmentShader.sourceCode());
}
}else
{
qDebug() << "Problem when loading vertex shader :";
qDebug() << vertexShader.log();
qDebug() << QString(vertexShader.sourceCode());
}
}
My shaders are very useless shaders :
Vertex :
#version 150
uniform mat4 viewMatrix, projMatrix;
in vec4 position;
in vec3 color;
out vec3 Color;
void main()
{
Color = color;
gl_Position = projMatrix * viewMatrix * position ;
}
Fragment :
#version 150
in vec3 Color;
out vec4 outputF;
void main()
{
outputF = vec4(1.0, 0, 0, 1.);
}
So I attempt to have my Shaded Graphics view as a big red square because I think I enforced the pixels to be red (in my fragment shader).
I have no shader compilation error, but my two scene are the same.
Of course, the program pass into the initializeGL function (I can read the __PRETTY_FUNCTION__).
Does some one have an explanation ?
| 0 |
11,298,450 | 07/02/2012 17:35:08 | 1,473,723 | 06/22/2012 02:23:41 | 4 | 0 | Running C++ Source code files with a condition | I am writing a program and i would like to know how to run a source code file only when a specific condition is met for example running one only if a user input is one | visual-c++ | c++11 | null | null | null | 07/02/2012 17:54:04 | not a real question | Running C++ Source code files with a condition
===
I am writing a program and i would like to know how to run a source code file only when a specific condition is met for example running one only if a user input is one | 1 |
11,298,451 | 07/02/2012 17:35:18 | 459,041 | 09/27/2010 01:00:48 | 1,055 | 38 | Precomputing Client-side Javascript Execution | Suppose you were to build a highly functional single-page client-side application that listens to URL changes in order to navigate around the application.
Suppose then, that when a user (or search engine bot) loads a page by its url, instead of delivering the static javascript file and hits the api as normal, we'd like to precompute everything server-side and delivery the DOM along with the js state.
I am wondering if there are existing tools or techniques for persisting such an execution of state to the client.
I know that I could execute the script in something like phantom JS and output the DOM elements, but then event handlers, controllers and the js memory state would not be attached properly. I could sniff our user agent and only send the precomputed content to bots, but I am afraid google would punish for this, and we also lose the speed benefits of having sent everything precomputed in the first place. | javascript | ajax | phantomjs | null | null | null | open | Precomputing Client-side Javascript Execution
===
Suppose you were to build a highly functional single-page client-side application that listens to URL changes in order to navigate around the application.
Suppose then, that when a user (or search engine bot) loads a page by its url, instead of delivering the static javascript file and hits the api as normal, we'd like to precompute everything server-side and delivery the DOM along with the js state.
I am wondering if there are existing tools or techniques for persisting such an execution of state to the client.
I know that I could execute the script in something like phantom JS and output the DOM elements, but then event handlers, controllers and the js memory state would not be attached properly. I could sniff our user agent and only send the precomputed content to bots, but I am afraid google would punish for this, and we also lose the speed benefits of having sent everything precomputed in the first place. | 0 |
11,297,751 | 07/02/2012 16:39:54 | 1,140,828 | 01/10/2012 12:28:59 | 198 | 4 | 'Simple' Jquery Page Peel function not working | I have this seemingly simple Jquery page peel function, but I've tried everthing, I just cannot get it to work. I also tried in in jsfiddle here's my example: [http://jsfiddle.net/xgDzX/5/][1]
Here is the original tutorial: [http://www.smple.com/pagePeel/][2]
Note: I went the non-flash route...
Any help would be so much appreciated, this thing has been keeping me busy for the last 3 hours
Thanks
[1]: http://jsfiddle.net/xgDzX/5/
[2]: http://www.smple.com/pagePeel/ | jquery | null | null | null | null | null | open | 'Simple' Jquery Page Peel function not working
===
I have this seemingly simple Jquery page peel function, but I've tried everthing, I just cannot get it to work. I also tried in in jsfiddle here's my example: [http://jsfiddle.net/xgDzX/5/][1]
Here is the original tutorial: [http://www.smple.com/pagePeel/][2]
Note: I went the non-flash route...
Any help would be so much appreciated, this thing has been keeping me busy for the last 3 hours
Thanks
[1]: http://jsfiddle.net/xgDzX/5/
[2]: http://www.smple.com/pagePeel/ | 0 |
11,226,402 | 06/27/2012 12:37:43 | 206,265 | 11/08/2009 14:47:31 | 465 | 35 | optgroup with Combo Box control | Is it possible to render `<optgroup>` tags within select by native or ExtLib Combo box control?
I want to use native solution, so getComponent() or validators will work. That disqualifies inline html with jQuery/dojo, i think. | xpages | null | null | null | null | null | open | optgroup with Combo Box control
===
Is it possible to render `<optgroup>` tags within select by native or ExtLib Combo box control?
I want to use native solution, so getComponent() or validators will work. That disqualifies inline html with jQuery/dojo, i think. | 0 |
11,226,964 | 06/27/2012 13:08:08 | 724,188 | 04/25/2011 18:42:59 | 40 | 3 | f.select and f.text_field on one object in Rails? | Is it possible to have a number of options e.g. f.select or the user can type in anything e.g f.text_field on one object?
Thanks in advance. | ruby-on-rails | forms | models | null | null | null | open | f.select and f.text_field on one object in Rails?
===
Is it possible to have a number of options e.g. f.select or the user can type in anything e.g f.text_field on one object?
Thanks in advance. | 0 |
11,226,884 | 06/27/2012 13:04:24 | 909,003 | 08/24/2011 06:21:02 | 473 | 12 | ListView Rowlayout in a own coded Chat | **What I'm trying to do**
----------
I'm trying to create a chat which has to diffrent row's. For every row I made a own layout file, but the problem is that the layoutfile of one row dosn't fit the screen.
**Question**
----------
What do I need to change in the row layout that it fits like it should. You'll find the code and also a printscreen of what I'm trying.
![enter image description here][1]
**Code**
----------
ListAdapter
public class ChatListAdapter extends BaseAdapter {
private ArrayList<String> ContentList;
private ArrayList<Integer> ChatUserList;
private static LayoutInflater inflater = null;
public ChatListAdapter(Activity activity, ArrayList<String> _ContentList,
ArrayList<Integer> _ChatUserList) {
ContentList = _ContentList;
ChatUserList = _ChatUserList;
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return ContentList.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
TextView tv_text;
TextView tv_date;
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
if (ChatUserList.get(position) == 1) {
// I'm RECIVER -> Message is left align
vi = inflater.inflate(R.layout.rowlayout_leftalign, null);
tv_text = (TextView) vi.findViewById(R.id.tv_chat_leftalign);
tv_date = (TextView) vi.findViewById(R.id.tv_chat_leftalign_date);
} else {
// I'm SENDER -> Message is right align
vi = inflater.inflate(R.layout.rowlayout_rightalign, null);
tv_text = (TextView) vi.findViewById(R.id.tv_chat_rightalign);
tv_date = (TextView) vi.findViewById(R.id.tv_chat_rightalign_date);
}
tv_date.setText(sdf.format(new Date()));
tv_text.setText(ContentList.get(position));
tv_text.setMaxWidth(((Chat.display.getWidth() / 4) * 3));
return vi;
}
RowLayout XML Left (Blue bubbles)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent" >
<RelativeLayout
android:id="@+id/ly_rf_row_r"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginBottom="2.5dp"
android:layout_marginTop="2.5dp"
android:background="@drawable/shape_rightalign"
android:paddingBottom="2.5dp"
android:paddingTop="2.5dp" >
<TextView
android:id="@+id/tv_chat_rightalign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="right"
android:paddingBottom="2dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/tv_chat_rightalign_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-3dp"
android:layout_marginLeft="-3dp"
android:layout_toLeftOf="@id/tv_chat_rightalign"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textColor="@android:color/black"
android:textSize="8.5dp" />
</RelativeLayout>
</RelativeLayout>
RowLayout XML right (red bubbles)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent" >
<RelativeLayout
android:id="@+id/ly_rf_row_l"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginBottom="2.5dp"
android:layout_marginTop="2.5dp"
android:background="@drawable/shape_leftalign"
android:paddingBottom="2.5dp"
android:paddingTop="2.5dp" >
<TextView
android:id="@+id/tv_chat_leftalign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="left"
android:paddingBottom="2dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/tv_chat_leftalign_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-3dp"
android:layout_marginLeft="-3dp"
android:layout_toRightOf="@id/tv_chat_leftalign"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textColor="@android:color/black"
android:textSize="8.5dp" />
</RelativeLayout>
</RelativeLayout>
[1]: http://i.stack.imgur.com/r6Vb3.png | android | android-layout | chat | null | null | null | open | ListView Rowlayout in a own coded Chat
===
**What I'm trying to do**
----------
I'm trying to create a chat which has to diffrent row's. For every row I made a own layout file, but the problem is that the layoutfile of one row dosn't fit the screen.
**Question**
----------
What do I need to change in the row layout that it fits like it should. You'll find the code and also a printscreen of what I'm trying.
![enter image description here][1]
**Code**
----------
ListAdapter
public class ChatListAdapter extends BaseAdapter {
private ArrayList<String> ContentList;
private ArrayList<Integer> ChatUserList;
private static LayoutInflater inflater = null;
public ChatListAdapter(Activity activity, ArrayList<String> _ContentList,
ArrayList<Integer> _ChatUserList) {
ContentList = _ContentList;
ChatUserList = _ChatUserList;
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return ContentList.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
TextView tv_text;
TextView tv_date;
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
if (ChatUserList.get(position) == 1) {
// I'm RECIVER -> Message is left align
vi = inflater.inflate(R.layout.rowlayout_leftalign, null);
tv_text = (TextView) vi.findViewById(R.id.tv_chat_leftalign);
tv_date = (TextView) vi.findViewById(R.id.tv_chat_leftalign_date);
} else {
// I'm SENDER -> Message is right align
vi = inflater.inflate(R.layout.rowlayout_rightalign, null);
tv_text = (TextView) vi.findViewById(R.id.tv_chat_rightalign);
tv_date = (TextView) vi.findViewById(R.id.tv_chat_rightalign_date);
}
tv_date.setText(sdf.format(new Date()));
tv_text.setText(ContentList.get(position));
tv_text.setMaxWidth(((Chat.display.getWidth() / 4) * 3));
return vi;
}
RowLayout XML Left (Blue bubbles)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent" >
<RelativeLayout
android:id="@+id/ly_rf_row_r"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginBottom="2.5dp"
android:layout_marginTop="2.5dp"
android:background="@drawable/shape_rightalign"
android:paddingBottom="2.5dp"
android:paddingTop="2.5dp" >
<TextView
android:id="@+id/tv_chat_rightalign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="right"
android:paddingBottom="2dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/tv_chat_rightalign_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-3dp"
android:layout_marginLeft="-3dp"
android:layout_toLeftOf="@id/tv_chat_rightalign"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textColor="@android:color/black"
android:textSize="8.5dp" />
</RelativeLayout>
</RelativeLayout>
RowLayout XML right (red bubbles)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent" >
<RelativeLayout
android:id="@+id/ly_rf_row_l"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginBottom="2.5dp"
android:layout_marginTop="2.5dp"
android:background="@drawable/shape_leftalign"
android:paddingBottom="2.5dp"
android:paddingTop="2.5dp" >
<TextView
android:id="@+id/tv_chat_leftalign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="left"
android:paddingBottom="2dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/tv_chat_leftalign_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-3dp"
android:layout_marginLeft="-3dp"
android:layout_toRightOf="@id/tv_chat_leftalign"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textColor="@android:color/black"
android:textSize="8.5dp" />
</RelativeLayout>
</RelativeLayout>
[1]: http://i.stack.imgur.com/r6Vb3.png | 0 |
11,226,972 | 06/27/2012 13:08:22 | 928,408 | 09/05/2011 07:22:21 | 11 | 0 | Need assistance with posting a test result from soapUI using Groovy script to Rest API | I am really new to soapUI and Groovy. I want to post a result from my test case to a test mgmt api. I can't get it to work and maybe you can find whats wrong.
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.ContentType.URLENC
// Variables
def result = 1
def testcase_id = 263
def testrun_id = 21;
def key = '******'
def http_string = 'http://<server>/index.php?/miniapi/add_result_for_case/' + tr_id + '/' + tc_id + '&key=' + key
def http = new HTTPBuilder(http_string)
def map
// Getting test result
for ( testCaseResult in testRunner.getResults() ){
testStepResult = testCaseResult.getStatus()
if ( testStepResult.toString() == 'FAILED' ){
result = 0
break
}
}
// Trying to make a post to API with result
map.put('Accept', 'application/json');
map.put('Content-Type','application/x-www-form-urlencoded');
http.setHeaders(map)
def postBody = [status_id = '1'];
http.post(path: '/', body: postBody)
I am trying to use this information about the API to get it to work.
http://docs.gurock.com/testrail-api/reference-results
So, can anyone see what I done wrong?
| groovy | soapui | null | null | null | null | open | Need assistance with posting a test result from soapUI using Groovy script to Rest API
===
I am really new to soapUI and Groovy. I want to post a result from my test case to a test mgmt api. I can't get it to work and maybe you can find whats wrong.
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.ContentType.URLENC
// Variables
def result = 1
def testcase_id = 263
def testrun_id = 21;
def key = '******'
def http_string = 'http://<server>/index.php?/miniapi/add_result_for_case/' + tr_id + '/' + tc_id + '&key=' + key
def http = new HTTPBuilder(http_string)
def map
// Getting test result
for ( testCaseResult in testRunner.getResults() ){
testStepResult = testCaseResult.getStatus()
if ( testStepResult.toString() == 'FAILED' ){
result = 0
break
}
}
// Trying to make a post to API with result
map.put('Accept', 'application/json');
map.put('Content-Type','application/x-www-form-urlencoded');
http.setHeaders(map)
def postBody = [status_id = '1'];
http.post(path: '/', body: postBody)
I am trying to use this information about the API to get it to work.
http://docs.gurock.com/testrail-api/reference-results
So, can anyone see what I done wrong?
| 0 |
11,226,978 | 06/27/2012 13:08:37 | 1,485,599 | 06/27/2012 12:16:32 | 1 | 0 | Google Apps Script getactiverange() getactivecell() getrow() always return cell A1 after submit from panel | I have some scripting which always worked fine, and recently copied this script into a new clean spreadsheet. See code below. It uses UiApp and builds a vertical panel with radio buttons and a submit button to allow the user to pick a row color. The code for the menu that calls ColorStatus() is not included.
The problem is in the handler function called function "b". Suddenly, I can never get the correct active range or cell or row or column. The user chooses a radio button (color), clicks submit, and the submit calls the function "b". The vertical panel closes and the function b code tries to identify the current row and color it based on the radio button selection. However, using getActiveRange() or getRow() always point to cell A1, and will only colorize the first row of the spreadsheet.
Does it have something to do with calling those while the uiApp is still open? It had always worked fine until I copied the apps script into a new, empty project and tried it on a new sheet!
function ColorStatus() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
var app = UiApp.createApplication().setTitle('Set Status');
var RadioReject = app.createRadioButton("group", "Rejected").setName('RadioReject').setId('RadioReject');
var RadioReceived= app.createRadioButton("group", "Received").setName('RadioReceived').setId('RadioReceived');
var RadioLoaded = app.createRadioButton("group", "Loaded").setName('RadioLoaded').setId('RadioLoaded');
var RadioReset = app.createRadioButton("group", "Reset Status (White)").setName('RadioReset').setId('RadioReset');
var RadioCancelled = app.createRadioButton("group", "Cancel (Gray)").setName('RadioCancelled').setId('RadioCancelled');
//A label will be used to give feedback on the value of the checkBox
var infoLabel = app.createLabel('Check the box and click submit').setId('infoLabel');
// Create a vertical panel..
var panel = app.createVerticalPanel();
//handlers
var handler = app.createServerChangeHandler('radio1');
handler.addCallbackElement(panel);
RadioReject.addClickHandler(handler);
var handler2 = app.createServerChangeHandler('radio2');
handler2.addCallbackElement(panel);
RadioReceived.addClickHandler(handler2);
// ...3 other similiar handlers created
//put everything in the UI
panel.add(RadioReject);
panel.add(RadioReceived);
// Create a button and click handler; pass in the grid object as a callback element and the handler as a click handler
// Identify the function b as the server click handler
var button = app.createButton('submit');
var handler = app.createServerClickHandler('b');
handler.addCallbackElement(panel);
button.addClickHandler(handler);
// Add the button to the panel and the panel to the application, then display the application app in the Spreadsheet doc
panel.add(button);
app.add(panel);
doc.show(app);
}
function radio1(e){ //reject
var app = UiApp.getActiveApplication();
app.getElementById('RadioReceived').setValue(false);
app.getElementById('RadioLoaded').setValue(false);
app.getElementById('RadioReset').setValue(false);
app.getElementById('RadioCancelled').setValue(false);
return app;
}
function radio2(e){ //received
var app = UiApp.getActiveApplication();
app.getElementById('RadioReject').setValue(false);
app.getElementById('RadioLoaded').setValue(false);
app.getElementById('RadioReset').setValue(false);
app.getElementById('RadioCancelled').setValue(false);
return app;
}
// etc... 3 other similiar radio functions follow
// Here is the problematic function that changes backgrounds in the Spreadsheet
function b(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getActiveSheet();
Logger.log("test"); // can't get this to work either, by the way.
// ****** PROBLEM OCCURS AT ANY OF THE NEXT TWO STATEMENTS, WHICH RETURN "A1" AND "1" RESPECTIVELY, NO MATTER WHERE THE CURSOR IS IN THE SPREADSHEET. EVERYTHING ELSE WORKS FINE.
var RangeRows =s.getActiveRange();
var thisRow = RangeRows.getRow();
//*******
var numRows = RangeRows.getNumRows();
var lastCol = s.getLastColumn();
//last parameter in the following should be dynamic.
var rngHighlight = s.getRange(thisRow,1,numRows,26);
Browser.msgBox(rngHighlight.getA1Notation());
var sColor ='FFFFFF';
for (p in e.parameter) {
if (p.substr(0,5)=='Radio')
{
if (p=='RadioReject' && e.parameter.RadioReject=='true')
{sColor='#F75D59';}
else {
if (p=='RadioReceived' && e.parameter.RadioReceived=='true')
{sColor='#00FA9A';}
else {
if (p=='RadioLoaded' && e.parameter.RadioLoaded=='true')
{sColor='#FFFF00';}
else {
if (p=='RadioCancelled' && e.parameter.RadioCancelled=='true')
{sColor='#D0D0D0';}
}
}
}
}
}
rngHighlight.setBackgroundColor(sColor);
// Clean up - get the UiApp object, close it, and return
var app = UiApp.getActiveApplication();
app.close();
// The following line is REQUIRED for the widget to actually close.
return app;
}
| google | script | reference | cell | apps | null | open | Google Apps Script getactiverange() getactivecell() getrow() always return cell A1 after submit from panel
===
I have some scripting which always worked fine, and recently copied this script into a new clean spreadsheet. See code below. It uses UiApp and builds a vertical panel with radio buttons and a submit button to allow the user to pick a row color. The code for the menu that calls ColorStatus() is not included.
The problem is in the handler function called function "b". Suddenly, I can never get the correct active range or cell or row or column. The user chooses a radio button (color), clicks submit, and the submit calls the function "b". The vertical panel closes and the function b code tries to identify the current row and color it based on the radio button selection. However, using getActiveRange() or getRow() always point to cell A1, and will only colorize the first row of the spreadsheet.
Does it have something to do with calling those while the uiApp is still open? It had always worked fine until I copied the apps script into a new, empty project and tried it on a new sheet!
function ColorStatus() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
var app = UiApp.createApplication().setTitle('Set Status');
var RadioReject = app.createRadioButton("group", "Rejected").setName('RadioReject').setId('RadioReject');
var RadioReceived= app.createRadioButton("group", "Received").setName('RadioReceived').setId('RadioReceived');
var RadioLoaded = app.createRadioButton("group", "Loaded").setName('RadioLoaded').setId('RadioLoaded');
var RadioReset = app.createRadioButton("group", "Reset Status (White)").setName('RadioReset').setId('RadioReset');
var RadioCancelled = app.createRadioButton("group", "Cancel (Gray)").setName('RadioCancelled').setId('RadioCancelled');
//A label will be used to give feedback on the value of the checkBox
var infoLabel = app.createLabel('Check the box and click submit').setId('infoLabel');
// Create a vertical panel..
var panel = app.createVerticalPanel();
//handlers
var handler = app.createServerChangeHandler('radio1');
handler.addCallbackElement(panel);
RadioReject.addClickHandler(handler);
var handler2 = app.createServerChangeHandler('radio2');
handler2.addCallbackElement(panel);
RadioReceived.addClickHandler(handler2);
// ...3 other similiar handlers created
//put everything in the UI
panel.add(RadioReject);
panel.add(RadioReceived);
// Create a button and click handler; pass in the grid object as a callback element and the handler as a click handler
// Identify the function b as the server click handler
var button = app.createButton('submit');
var handler = app.createServerClickHandler('b');
handler.addCallbackElement(panel);
button.addClickHandler(handler);
// Add the button to the panel and the panel to the application, then display the application app in the Spreadsheet doc
panel.add(button);
app.add(panel);
doc.show(app);
}
function radio1(e){ //reject
var app = UiApp.getActiveApplication();
app.getElementById('RadioReceived').setValue(false);
app.getElementById('RadioLoaded').setValue(false);
app.getElementById('RadioReset').setValue(false);
app.getElementById('RadioCancelled').setValue(false);
return app;
}
function radio2(e){ //received
var app = UiApp.getActiveApplication();
app.getElementById('RadioReject').setValue(false);
app.getElementById('RadioLoaded').setValue(false);
app.getElementById('RadioReset').setValue(false);
app.getElementById('RadioCancelled').setValue(false);
return app;
}
// etc... 3 other similiar radio functions follow
// Here is the problematic function that changes backgrounds in the Spreadsheet
function b(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getActiveSheet();
Logger.log("test"); // can't get this to work either, by the way.
// ****** PROBLEM OCCURS AT ANY OF THE NEXT TWO STATEMENTS, WHICH RETURN "A1" AND "1" RESPECTIVELY, NO MATTER WHERE THE CURSOR IS IN THE SPREADSHEET. EVERYTHING ELSE WORKS FINE.
var RangeRows =s.getActiveRange();
var thisRow = RangeRows.getRow();
//*******
var numRows = RangeRows.getNumRows();
var lastCol = s.getLastColumn();
//last parameter in the following should be dynamic.
var rngHighlight = s.getRange(thisRow,1,numRows,26);
Browser.msgBox(rngHighlight.getA1Notation());
var sColor ='FFFFFF';
for (p in e.parameter) {
if (p.substr(0,5)=='Radio')
{
if (p=='RadioReject' && e.parameter.RadioReject=='true')
{sColor='#F75D59';}
else {
if (p=='RadioReceived' && e.parameter.RadioReceived=='true')
{sColor='#00FA9A';}
else {
if (p=='RadioLoaded' && e.parameter.RadioLoaded=='true')
{sColor='#FFFF00';}
else {
if (p=='RadioCancelled' && e.parameter.RadioCancelled=='true')
{sColor='#D0D0D0';}
}
}
}
}
}
rngHighlight.setBackgroundColor(sColor);
// Clean up - get the UiApp object, close it, and return
var app = UiApp.getActiveApplication();
app.close();
// The following line is REQUIRED for the widget to actually close.
return app;
}
| 0 |
11,226,987 | 06/27/2012 13:08:56 | 915,457 | 08/27/2011 12:22:33 | 50 | 2 | There was no endpoint listening at .. Unable to connect to the remote server | Hi all actually it was working last week but I don't know whats happened and now its not working.
The problem is I have two solutions in different machines. The first one has 2 projects one is WCF service project and the other one is wpf project which uses this localhost service and works fine. however when other machine wants to connect the server which is not localhost it gives this error.
There was an error downloading '(address):8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/_vti_bin/ListData.svc/$metadata'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it(address):8732
Metadata contains a reference that cannot be resolved: '(address):8732/Design_Time_Addresses/WcfServiceLibrary1/Service1'.
There was no endpoint listening at (address):8732/Design_Time_Addresses/WcfServiceLibrary1/Service1 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it (address):8732
If the service is defined in the current solution, try building the solution and adding the service reference again.
Ive pinged my address and it sends and receives data
I turned off the windows firewall
and my app.config is like this
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_IService11" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="ServiceReference1.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService11"
contract="ServiceReference2.IService1" name="WSHttpBinding_IService11">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
| .net | wcf | service | servicereference | null | null | open | There was no endpoint listening at .. Unable to connect to the remote server
===
Hi all actually it was working last week but I don't know whats happened and now its not working.
The problem is I have two solutions in different machines. The first one has 2 projects one is WCF service project and the other one is wpf project which uses this localhost service and works fine. however when other machine wants to connect the server which is not localhost it gives this error.
There was an error downloading '(address):8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/_vti_bin/ListData.svc/$metadata'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it(address):8732
Metadata contains a reference that cannot be resolved: '(address):8732/Design_Time_Addresses/WcfServiceLibrary1/Service1'.
There was no endpoint listening at (address):8732/Design_Time_Addresses/WcfServiceLibrary1/Service1 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it (address):8732
If the service is defined in the current solution, try building the solution and adding the service reference again.
Ive pinged my address and it sends and receives data
I turned off the windows firewall
and my app.config is like this
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_IService11" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="ServiceReference1.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService11"
contract="ServiceReference2.IService1" name="WSHttpBinding_IService11">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
| 0 |
11,226,992 | 06/27/2012 13:09:05 | 1,485,608 | 06/27/2012 12:19:52 | 1 | 0 | VBA - If Range Includes Value Then Array(i) = 1, Loop, Sum | I am new to VBA but have previous experience with PHP programming logic and various stats programming syntax. I am trying to write a code to search through a series of cell ranges for a specific value-- if that value exists in the range I want it to insert a 1 into an array, and if it doesn't to insert a 0.
My data look something like:
**Item R1 R2**
1121 1 3
1121 2
1121
1121 3 2
1121 3
1122 4 5
1122 3 5
1122 5
1122 4
1122 5
My end goal is to be able to sum the values in the array and count the total number of items with each rating. For example, in the sample above I would want to be able to produce:
> Number of Items with Rating of 1 = 1
>
> Number of Items with Rating of 2 = 1
>
> Number of Items with Rating of 3 = 2
>
> And so on.
The code I wrote was:
Sub Items()
Dim myArray() As Variant
Dim i As Integer
Dim k As Integer
i = 0
k = 0
R5 = Range("G(2+k):H(6+k)")
mycount = Application.WorksheetFunction.Sum(myArray)
Sheets("Operational").Select
For Each R5 In Range("G2:H206")
ReDim myArray(0 To i)
myArray(i) = Cell.Value
i = i + 1
k = k + 4
R5.Select
If R5.Value = "1" Then
myArray(i) = 1
Else
myArray(i) = 0
End If
Next
End Sub
I have 5 rows for each item so I thought I could approach this as a repeating, consistent loop. However I get an error when I try to run it - "Application-defined or object-defined error."
I know this is probably not the best way and I am so new to this I don't know where to start in troubleshooting. Any help would be much appreciated.
Also if anyone has a good reference for VBA structure/code or a beginner's tutorial, let me know! I haven't had much luck in finding any good references. | vba | excel-vba | null | null | null | null | open | VBA - If Range Includes Value Then Array(i) = 1, Loop, Sum
===
I am new to VBA but have previous experience with PHP programming logic and various stats programming syntax. I am trying to write a code to search through a series of cell ranges for a specific value-- if that value exists in the range I want it to insert a 1 into an array, and if it doesn't to insert a 0.
My data look something like:
**Item R1 R2**
1121 1 3
1121 2
1121
1121 3 2
1121 3
1122 4 5
1122 3 5
1122 5
1122 4
1122 5
My end goal is to be able to sum the values in the array and count the total number of items with each rating. For example, in the sample above I would want to be able to produce:
> Number of Items with Rating of 1 = 1
>
> Number of Items with Rating of 2 = 1
>
> Number of Items with Rating of 3 = 2
>
> And so on.
The code I wrote was:
Sub Items()
Dim myArray() As Variant
Dim i As Integer
Dim k As Integer
i = 0
k = 0
R5 = Range("G(2+k):H(6+k)")
mycount = Application.WorksheetFunction.Sum(myArray)
Sheets("Operational").Select
For Each R5 In Range("G2:H206")
ReDim myArray(0 To i)
myArray(i) = Cell.Value
i = i + 1
k = k + 4
R5.Select
If R5.Value = "1" Then
myArray(i) = 1
Else
myArray(i) = 0
End If
Next
End Sub
I have 5 rows for each item so I thought I could approach this as a repeating, consistent loop. However I get an error when I try to run it - "Application-defined or object-defined error."
I know this is probably not the best way and I am so new to this I don't know where to start in troubleshooting. Any help would be much appreciated.
Also if anyone has a good reference for VBA structure/code or a beginner's tutorial, let me know! I haven't had much luck in finding any good references. | 0 |
11,349,676 | 07/05/2012 17:44:01 | 187,750 | 10/10/2009 18:40:07 | 1,013 | 32 | jQuery Store $(window).outerWidth() prior to resize event | I need to do some offset calculations and can't make use of the actual $(window).outerWidth(); value itself because on `resize` of `window` I need to resize another element after calculating the offset between the width before and after the resize event. I need to access this stored variable from within the resize callback. How can I do it.
// This is resolving fine
$(window).on( 'resize', masonry());
// And then the function
update_masonry = function () {
var new_width = $(window).outerWidth();
var old_width = ???
} | javascript | jquery | resize | null | null | null | open | jQuery Store $(window).outerWidth() prior to resize event
===
I need to do some offset calculations and can't make use of the actual $(window).outerWidth(); value itself because on `resize` of `window` I need to resize another element after calculating the offset between the width before and after the resize event. I need to access this stored variable from within the resize callback. How can I do it.
// This is resolving fine
$(window).on( 'resize', masonry());
// And then the function
update_masonry = function () {
var new_width = $(window).outerWidth();
var old_width = ???
} | 0 |
11,349,677 | 07/05/2012 17:44:02 | 562,073 | 12/01/2010 06:00:38 | 672 | 49 | Urban Airship Push Notifications not working with Production Certificate | I am developing an iOS App with Push Notifications. I am able to successfully test the push notifications using the Developer APN Certificate but it does not work with the Production APN Certificate.
I have ensured that the profiles in the iOS Developer Portal (adhoc / distribution) are generated after Push Notification is enabled for the APP ID and have taken care to use the correct UA_KEY and UA_SECRET in AppDelegate.m.
Can anybody please provide insights on as to what could be the possible reason(s) why Push notifications are failing using Production Certificate but working fine with Development Certificate. | iphone | push-notification | apple-push-notifications | urbanairship.com | null | null | open | Urban Airship Push Notifications not working with Production Certificate
===
I am developing an iOS App with Push Notifications. I am able to successfully test the push notifications using the Developer APN Certificate but it does not work with the Production APN Certificate.
I have ensured that the profiles in the iOS Developer Portal (adhoc / distribution) are generated after Push Notification is enabled for the APP ID and have taken care to use the correct UA_KEY and UA_SECRET in AppDelegate.m.
Can anybody please provide insights on as to what could be the possible reason(s) why Push notifications are failing using Production Certificate but working fine with Development Certificate. | 0 |
11,349,678 | 07/05/2012 17:44:02 | 865,939 | 07/27/2011 17:03:15 | 155 | 0 | onload doesn't work on Chrome | I am trying to run a Javascript function when page finish loading. I tried the following:
<body onload="alert('s')">
This code works on Firefox but for some reason not in chrome. Anything that I'm missing here?
I don't have anything in the page. I've just created a new webform ASPX page and put the above code in it. | javascript | null | null | null | null | null | open | onload doesn't work on Chrome
===
I am trying to run a Javascript function when page finish loading. I tried the following:
<body onload="alert('s')">
This code works on Firefox but for some reason not in chrome. Anything that I'm missing here?
I don't have anything in the page. I've just created a new webform ASPX page and put the above code in it. | 0 |
11,349,695 | 07/05/2012 17:45:21 | 1,419,758 | 05/27/2012 04:18:07 | 6 | 0 | SVN - Backing up Subversion? | I had a website developed by an offshore development team. I am not a technical person myself so I have a bit of fear that the developers may not have given me the full code. Perhaps it is still depending on their servers for some of the pieces. Two questions:
1. Is there a way to rest assured that I have everything to run the website independently of them?
2. I have several files called entries that have a dir followed by two urls pointing to their own servers that begin with svn.theirdomainname.com/. Should this be a cause for concern or is this something that was only used when in development mode and which is on my own server now?
Thank you in advance for taking the time to read my questions. | svn | null | null | null | null | null | open | SVN - Backing up Subversion?
===
I had a website developed by an offshore development team. I am not a technical person myself so I have a bit of fear that the developers may not have given me the full code. Perhaps it is still depending on their servers for some of the pieces. Two questions:
1. Is there a way to rest assured that I have everything to run the website independently of them?
2. I have several files called entries that have a dir followed by two urls pointing to their own servers that begin with svn.theirdomainname.com/. Should this be a cause for concern or is this something that was only used when in development mode and which is on my own server now?
Thank you in advance for taking the time to read my questions. | 0 |
11,349,662 | 07/05/2012 17:43:11 | 784,277 | 06/04/2011 21:05:33 | 103 | 1 | Reach into a javascript array object | If I console log test
I get
[{
property_1: "a",
property_2: "b",
}]
How can I console log just property_1 ?
| javascript | arrays | object | null | null | null | open | Reach into a javascript array object
===
If I console log test
I get
[{
property_1: "a",
property_2: "b",
}]
How can I console log just property_1 ?
| 0 |
11,349,702 | 07/05/2012 17:45:44 | 173,432 | 09/14/2009 22:45:13 | 2,130 | 31 | How does global.asax function in server farm? | I'm confused as to how the global.asax file would run in a server farm. Does each server have its own instance running or is it a shared instance.
For example in my global.asax in the Application_Start event I initialize a singleton object that collects stats and updates a database table containing the stats. Which of the following happens?
**Scenario One**
- Server 1 -> (Stat = 10) -> Updates database with 10
- Server 2 -> (Stat = 8) -> Updates database with 8
- Server 3 -> (Stat = 25) -> Updates database with 25
- Server 4 -> (Stat = 5) -> Updates database with 5
It the first example each server would update the database with it's own collection
**Scenario Two**
- Server 1 -> (Stat = 10) -> Updates database with 10
- Server 2 -> (Stat = 10) -> Updates database with 10
- Server 3 -> (Stat = 10) -> Updates database with 10
- Server 4 -> (Stat = 10) -> Updates database with 10
It the above example the servers have access to the same collection. Is this possible?
| global-asax | webfarm | server-farm | null | null | null | open | How does global.asax function in server farm?
===
I'm confused as to how the global.asax file would run in a server farm. Does each server have its own instance running or is it a shared instance.
For example in my global.asax in the Application_Start event I initialize a singleton object that collects stats and updates a database table containing the stats. Which of the following happens?
**Scenario One**
- Server 1 -> (Stat = 10) -> Updates database with 10
- Server 2 -> (Stat = 8) -> Updates database with 8
- Server 3 -> (Stat = 25) -> Updates database with 25
- Server 4 -> (Stat = 5) -> Updates database with 5
It the first example each server would update the database with it's own collection
**Scenario Two**
- Server 1 -> (Stat = 10) -> Updates database with 10
- Server 2 -> (Stat = 10) -> Updates database with 10
- Server 3 -> (Stat = 10) -> Updates database with 10
- Server 4 -> (Stat = 10) -> Updates database with 10
It the above example the servers have access to the same collection. Is this possible?
| 0 |
11,349,706 | 07/05/2012 17:46:08 | 1,257,962 | 03/08/2012 20:40:03 | 1 | 0 | Interaction between view controllers | I've been having problems to make a good architectured program, let me explain:
1)My AppDelegate has the normal indication: self.window.rootViewController = self.viewController;
2) viewController is the delegate of a UITextView (which has its own .h and .m files).
3) When you click on the selected text (viewController handles this activity), a popover shows up with a tableView inside. The tableViewController of that table view initializes and gets its cells values depending on information given by viewController processes
4) When you click on a row of the tableView, a navigator pushes to a new tableView. The new tableViewController initializes and its cells get values depending on information given by the first tableViewController
5) When you click on a row of this second tableView, the popover should disappear and the UITextView text has to get values depending on the information given by the last tableViewController
I have had no problem with showing the popover from the text selected and the tableView inside of it. I have neither had problems with navigating to the other table view. The problems are:
1) In order to pass information to the first table view, I had to create a method inside the first view controller InitWithNib:bundle:Info, where Info is the viewController process result and the method returns the default InitWithNib method, in order to send the information to that ViewController. I don't know if that is correct or I should try to run the processes directly in the tableViewController.
2) Same as the first problem: in the second tableViewController I created a InitWithNib:bundle:Info method to send the information needed to fill the cells, using the information given by processes run in the first table view controller. I don't know if thats the correct way or reflects a bad architectured program.
3) I could change the text depending on the information given by the last tableViewController using global variables, but I know thats a bad practice and reflects bad architectured program.
Please suggest me a good architecture to solve this using good practices, I've been researching for 3 days and have found no good answers,
thanks in advance,
Laureano Bonilla | viewcontroller | null | null | null | null | null | open | Interaction between view controllers
===
I've been having problems to make a good architectured program, let me explain:
1)My AppDelegate has the normal indication: self.window.rootViewController = self.viewController;
2) viewController is the delegate of a UITextView (which has its own .h and .m files).
3) When you click on the selected text (viewController handles this activity), a popover shows up with a tableView inside. The tableViewController of that table view initializes and gets its cells values depending on information given by viewController processes
4) When you click on a row of the tableView, a navigator pushes to a new tableView. The new tableViewController initializes and its cells get values depending on information given by the first tableViewController
5) When you click on a row of this second tableView, the popover should disappear and the UITextView text has to get values depending on the information given by the last tableViewController
I have had no problem with showing the popover from the text selected and the tableView inside of it. I have neither had problems with navigating to the other table view. The problems are:
1) In order to pass information to the first table view, I had to create a method inside the first view controller InitWithNib:bundle:Info, where Info is the viewController process result and the method returns the default InitWithNib method, in order to send the information to that ViewController. I don't know if that is correct or I should try to run the processes directly in the tableViewController.
2) Same as the first problem: in the second tableViewController I created a InitWithNib:bundle:Info method to send the information needed to fill the cells, using the information given by processes run in the first table view controller. I don't know if thats the correct way or reflects a bad architectured program.
3) I could change the text depending on the information given by the last tableViewController using global variables, but I know thats a bad practice and reflects bad architectured program.
Please suggest me a good architecture to solve this using good practices, I've been researching for 3 days and have found no good answers,
thanks in advance,
Laureano Bonilla | 0 |
11,349,707 | 07/05/2012 17:46:08 | 1,445,057 | 06/08/2012 16:57:35 | 6 | 0 | In Android how to convert Facebook and Twitter posts date into same fomat? | I have two date one is from facebook and second is from twitter how can i convert them into same format.
Below are the dates which I am getting
Facebook Date= 2012-07-05T13:17:13+0000
Twitter Date= Thu Jul 05 22:15:04 GMT+05:30 2012
How can we convert both of two like: 05-Jul-2012 11:54:30
please help me to solve this out..
Thanks
| java | android | null | null | null | null | open | In Android how to convert Facebook and Twitter posts date into same fomat?
===
I have two date one is from facebook and second is from twitter how can i convert them into same format.
Below are the dates which I am getting
Facebook Date= 2012-07-05T13:17:13+0000
Twitter Date= Thu Jul 05 22:15:04 GMT+05:30 2012
How can we convert both of two like: 05-Jul-2012 11:54:30
please help me to solve this out..
Thanks
| 0 |
11,349,708 | 07/05/2012 17:46:17 | 26,932 | 10/10/2008 19:00:21 | 3,472 | 154 | Get Parent and then Child objects conditionally | I have a list of objects with the following basic structure:
class Person
{
public int ID {get; set;}
public bool ShowChildren {get; set;}
public int ParentID {get; set;}
...many other properties...
}
I need to return a list of Person parent classes that are orderd by their ID. If the ShowChildren flag is enabled, also return the children under their parent, ordered by their ID.
This is only one level deep, IE children won't have children.
I can write a linq statement to give me all of the parents, but I'm stuck on how to also include the sorted children when the parent's flag is enabled.
var People = PersonList
.where(x => x.ParentID == 0)
.Orderby(x => x.ID)
.ToList(); | linq | c#-4.0 | linq-to-objects | null | null | null | open | Get Parent and then Child objects conditionally
===
I have a list of objects with the following basic structure:
class Person
{
public int ID {get; set;}
public bool ShowChildren {get; set;}
public int ParentID {get; set;}
...many other properties...
}
I need to return a list of Person parent classes that are orderd by their ID. If the ShowChildren flag is enabled, also return the children under their parent, ordered by their ID.
This is only one level deep, IE children won't have children.
I can write a linq statement to give me all of the parents, but I'm stuck on how to also include the sorted children when the parent's flag is enabled.
var People = PersonList
.where(x => x.ParentID == 0)
.Orderby(x => x.ID)
.ToList(); | 0 |
11,349,709 | 07/05/2012 17:46:17 | 1,504,773 | 07/05/2012 17:35:48 | 1 | 0 | Scraper Google App Engine for Steam | So basically, at the moment, we are trying to write a basic HTML 5 page that, when you press a button, returns whether the user, on Steam, is in-game, offline, or online. We have looked at the Steam API, and to find this information, it requires the person's 64 bit ID (steamID64) and we, on the website, are only given the username. In order to find their 64 bit id, we have tried to scrape off of a website (steamidconverter.com) to get the user's 64 bit id from their username. We tried doing this through the javascript, but of course we ran into the cross domain block, not allowing us to access that data from our google App Engine website.
I have experience in Python, so I attempted to figure out how to get the HTML from that website (in the form of steamidconverter.com/(personsusername)) with Python. That was a success in scraping, thanks to another post on Stack Overflow.
BUT, I have no idea how to get that data back to the javascript and get it to do the rest of the work. I am stumped and really need help. This is all on google App Engine. All it is at the moment, is a button that runs a simple javascript that attempts to use JQuery to get the contents of the page back, but fails. I don't know how to integrate the two!
Please Help! | jquery | python | html5 | steam-web-api | null | null | open | Scraper Google App Engine for Steam
===
So basically, at the moment, we are trying to write a basic HTML 5 page that, when you press a button, returns whether the user, on Steam, is in-game, offline, or online. We have looked at the Steam API, and to find this information, it requires the person's 64 bit ID (steamID64) and we, on the website, are only given the username. In order to find their 64 bit id, we have tried to scrape off of a website (steamidconverter.com) to get the user's 64 bit id from their username. We tried doing this through the javascript, but of course we ran into the cross domain block, not allowing us to access that data from our google App Engine website.
I have experience in Python, so I attempted to figure out how to get the HTML from that website (in the form of steamidconverter.com/(personsusername)) with Python. That was a success in scraping, thanks to another post on Stack Overflow.
BUT, I have no idea how to get that data back to the javascript and get it to do the rest of the work. I am stumped and really need help. This is all on google App Engine. All it is at the moment, is a button that runs a simple javascript that attempts to use JQuery to get the contents of the page back, but fails. I don't know how to integrate the two!
Please Help! | 0 |
11,349,712 | 07/05/2012 17:46:25 | 1,504,723 | 07/05/2012 17:07:08 | 1 | 0 | jsTree removing node isn't actually removing it | hope you can help with a jsTree issue i'm having... only recently started to use it so still finding my feet.
I'm using a two jsTrees on the same page, (Available objects on the left and Included objects on the right) and i have several buttons in the middle that let users move objects from the left tree to the right tree and vice versa. I'm not using the dnd plugin and don't intend for users to be able to drag and drop between trees. My data structure is only two levels deep, parents and children/multiple children.
The other thing to mention is when i move a node from one tree to another, it is removed from that tree and created in the other tree.
So then problem i'm having is, i can select a node in the left tree (either a parent or one of its children) and i can move it to the right tree after clicking the button. If the node i selected is the parent, it moves the parent and all children. If the node i selected is the only child, it moves both the parent and the child. Lets stick with this scenario for this example. I do this by the following:
//Check to see if the parent exists in the right tree, if it doesn't create it
I've left this function call out for now but can post later if required
//Assuming the parent doesn't exist, create the parent in the right tree
$("#treeInc").jstree("create", null, false, { attr: { id: parent.id }, data: $(parent).children("a").text() }, false, true);
//Create the child in the right tree belonging to the parent node
$("#treeInc").jstree("create", $("#" + parent.id), "inside", { attr: { id: child.id }, data: $(child).children("a").text() }, false, true);
//Remove the parent and child from the left tree
$("#treeAvail").jstree("remove", $('#' + child.id));
$("#treeAvail").jstree("remove", $('#' + parent.id));
Now this all works great but the problem i have is when i try to move the nodes back to the left tree the parent always seems to exist in the data even thought is should have been removed. This means that i dont actually call the code to create the parent but only the child and it ends up hanging around on its own with no parent in sight.
So my logic is to first check to see if the parent exists by basically looking for the parent id in the nodes belonging to the right tree. I've done this several different ways so far and each time i fail.
I have called the 'get_json' function of the left tree to loop through the nodes but it exists in there.
I loop round the array that i initially loaded the left tree from but that has all the nodes in from the initial load and never seems to change.
I've tried to use 'delete_node' instead of remove but that makes no difference.
So what am i doing wrong? If i remove a node from a jsTree, in terms of data, how could i check that tree to see that it has gone?
Please help, its driving me mad!!!
My actual tree data comes from a web service but for this example, the below json array will do.
availDataCache = [
{ attr: { id: "A_R1" }
, data: "Report 1"
, state: "open"
, children: [{ attr: { id: "A_PSA1" }, data: "Param Set A"}]
}
, { attr: { id: "A_R2" }
, data: "Report 2"
, state: "open"
, children : [
{ attr: { id: "A_PSA2" }, data: "Param Set A" }
,{ attr: { id: "A_PSB1" }, data: "Param Set B" }
]
}
];
$("#treeAvail").jstree({
"json_data": {
"data": availDataCache
},
"core": {
"animation": 0
},
"plugins": ["themes", "json_data", "ui", "core", "crrm"]
});
$("#treeInc").jstree({
"json_data": {
"data": incDataCache
},
"core": {
"animation": 0
},
"plugins": ["themes", "json_data", "ui", "core", "crrm"]
});
| jquery-plugins | jstree | null | null | null | null | open | jsTree removing node isn't actually removing it
===
hope you can help with a jsTree issue i'm having... only recently started to use it so still finding my feet.
I'm using a two jsTrees on the same page, (Available objects on the left and Included objects on the right) and i have several buttons in the middle that let users move objects from the left tree to the right tree and vice versa. I'm not using the dnd plugin and don't intend for users to be able to drag and drop between trees. My data structure is only two levels deep, parents and children/multiple children.
The other thing to mention is when i move a node from one tree to another, it is removed from that tree and created in the other tree.
So then problem i'm having is, i can select a node in the left tree (either a parent or one of its children) and i can move it to the right tree after clicking the button. If the node i selected is the parent, it moves the parent and all children. If the node i selected is the only child, it moves both the parent and the child. Lets stick with this scenario for this example. I do this by the following:
//Check to see if the parent exists in the right tree, if it doesn't create it
I've left this function call out for now but can post later if required
//Assuming the parent doesn't exist, create the parent in the right tree
$("#treeInc").jstree("create", null, false, { attr: { id: parent.id }, data: $(parent).children("a").text() }, false, true);
//Create the child in the right tree belonging to the parent node
$("#treeInc").jstree("create", $("#" + parent.id), "inside", { attr: { id: child.id }, data: $(child).children("a").text() }, false, true);
//Remove the parent and child from the left tree
$("#treeAvail").jstree("remove", $('#' + child.id));
$("#treeAvail").jstree("remove", $('#' + parent.id));
Now this all works great but the problem i have is when i try to move the nodes back to the left tree the parent always seems to exist in the data even thought is should have been removed. This means that i dont actually call the code to create the parent but only the child and it ends up hanging around on its own with no parent in sight.
So my logic is to first check to see if the parent exists by basically looking for the parent id in the nodes belonging to the right tree. I've done this several different ways so far and each time i fail.
I have called the 'get_json' function of the left tree to loop through the nodes but it exists in there.
I loop round the array that i initially loaded the left tree from but that has all the nodes in from the initial load and never seems to change.
I've tried to use 'delete_node' instead of remove but that makes no difference.
So what am i doing wrong? If i remove a node from a jsTree, in terms of data, how could i check that tree to see that it has gone?
Please help, its driving me mad!!!
My actual tree data comes from a web service but for this example, the below json array will do.
availDataCache = [
{ attr: { id: "A_R1" }
, data: "Report 1"
, state: "open"
, children: [{ attr: { id: "A_PSA1" }, data: "Param Set A"}]
}
, { attr: { id: "A_R2" }
, data: "Report 2"
, state: "open"
, children : [
{ attr: { id: "A_PSA2" }, data: "Param Set A" }
,{ attr: { id: "A_PSB1" }, data: "Param Set B" }
]
}
];
$("#treeAvail").jstree({
"json_data": {
"data": availDataCache
},
"core": {
"animation": 0
},
"plugins": ["themes", "json_data", "ui", "core", "crrm"]
});
$("#treeInc").jstree({
"json_data": {
"data": incDataCache
},
"core": {
"animation": 0
},
"plugins": ["themes", "json_data", "ui", "core", "crrm"]
});
| 0 |
11,430,237 | 07/11/2012 10:05:55 | 1,498,009 | 07/03/2012 07:20:21 | 1 | 0 | form validation with dynamic choice list | I have a problem when I'm trying to validate my form. In this form I have 2 choice lists, one to select the name of a Company et one to select the employees. When I select a company, I use an AJAX request, which call a query_builder to display only employees of this company in the choice list. When I submit the form, the validator generate the error "This value is not valid" for the employee list. When I delete my call to the query_builder, everything works fine. Here is my code :
class Person
{
/**
* @ORM\Column(name="Pers_LastName", type="string")
*/
private $lastname;
/**
* @ORM\ManyToOne(targetEntity="Test\DatabaseBundle\Entity\Company" , inversedBy="contacts")
* @ORM\JoinColumn(name="pers_companyid", referencedColumnName="comp_companyid")
*/
private $company;}
class Company
{
/**
* @ORM\Id
* @ORM\Column(name="comp_companyid")
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @ORM\Column(name="Comp_Name", type="string")
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="Test\DatabaseBundle\Entity\Person", mappedBy="company")
*/
protected $contacts;}
my forms :
class CommLinkType extends AbstractType
{
private $companyid;
public function __construct($compid){
$this -> companyid = $compid;
}
public function buildForm(FormBuilder $builder, array $options)
{
$id = $this->companyid;
$builder -> add('company','text')
-> add('person','entity', array('class' => 'Test\DatabaseBundle\Entity\Person',
'query_builder' => function(\Test\DatabaseBundle\Entity\PersonRepository $sr) use ($id){
return $sr->ContactSelection($id); },
'property' => 'FirstName'))
-> add('companyid','integer', array('required' => false));
}}
and here is the function in my controller:
public function ModifierAction($commid){
$comm = $this -> getDoctrine() -> getEntityManager() -> getRepository('Test\DatabaseBundle\Entity\Communication') -> find($commid);
$comm -> getCommLink() -> setCompanyId($comm->getCommLink() -> getCompany() -> getId());
$form = $this -> createForm(new ModificationCommunicationType(), $comm);
$request = $this -> get('request');
if($request -> getMethod() == 'POST'){
$form -> bindRequest($request);
$formhandler = new CommunicationHandler($form, $request, $comm);
if($form->isValid()){
$client = $formhandler -> connection();
$param = $formhandler -> getData();
$param2 = $formhandler -> getData2();
$modif = new \SoapVar($param, XSD_ANYTYPE, "communication", "http://tempuri.org/type");
$parametre = array("entityname"=>"communication", "records" => $modif);
$client -> update($parametre);
$modif = new \SoapVar($param2, XSD_ANYTYPE, "comm_link", "http://tempuri.org/type");
$parametre = array("entityname"=>"comm_link", "records" => $modif);
$client -> update($parametre);
return $this -> redirect( $this -> generateUrl('TestDatabaseBundle_homepage2', array('id' => $commid)));
}}
return $this -> render('TestDatabaseBundle:Default:formulaire.html.twig',
array('form' => $form -> createview()));
}
It seems that the validator take the default value of company and store the list of its employyes and when I change the company (and so the employee list change) the validator doesn't valid because every current employees are not in the previous list.
I would be happy to see any information or solution you can give | ajax | forms | validation | dynamic | xmlhttprequest | null | open | form validation with dynamic choice list
===
I have a problem when I'm trying to validate my form. In this form I have 2 choice lists, one to select the name of a Company et one to select the employees. When I select a company, I use an AJAX request, which call a query_builder to display only employees of this company in the choice list. When I submit the form, the validator generate the error "This value is not valid" for the employee list. When I delete my call to the query_builder, everything works fine. Here is my code :
class Person
{
/**
* @ORM\Column(name="Pers_LastName", type="string")
*/
private $lastname;
/**
* @ORM\ManyToOne(targetEntity="Test\DatabaseBundle\Entity\Company" , inversedBy="contacts")
* @ORM\JoinColumn(name="pers_companyid", referencedColumnName="comp_companyid")
*/
private $company;}
class Company
{
/**
* @ORM\Id
* @ORM\Column(name="comp_companyid")
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @ORM\Column(name="Comp_Name", type="string")
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="Test\DatabaseBundle\Entity\Person", mappedBy="company")
*/
protected $contacts;}
my forms :
class CommLinkType extends AbstractType
{
private $companyid;
public function __construct($compid){
$this -> companyid = $compid;
}
public function buildForm(FormBuilder $builder, array $options)
{
$id = $this->companyid;
$builder -> add('company','text')
-> add('person','entity', array('class' => 'Test\DatabaseBundle\Entity\Person',
'query_builder' => function(\Test\DatabaseBundle\Entity\PersonRepository $sr) use ($id){
return $sr->ContactSelection($id); },
'property' => 'FirstName'))
-> add('companyid','integer', array('required' => false));
}}
and here is the function in my controller:
public function ModifierAction($commid){
$comm = $this -> getDoctrine() -> getEntityManager() -> getRepository('Test\DatabaseBundle\Entity\Communication') -> find($commid);
$comm -> getCommLink() -> setCompanyId($comm->getCommLink() -> getCompany() -> getId());
$form = $this -> createForm(new ModificationCommunicationType(), $comm);
$request = $this -> get('request');
if($request -> getMethod() == 'POST'){
$form -> bindRequest($request);
$formhandler = new CommunicationHandler($form, $request, $comm);
if($form->isValid()){
$client = $formhandler -> connection();
$param = $formhandler -> getData();
$param2 = $formhandler -> getData2();
$modif = new \SoapVar($param, XSD_ANYTYPE, "communication", "http://tempuri.org/type");
$parametre = array("entityname"=>"communication", "records" => $modif);
$client -> update($parametre);
$modif = new \SoapVar($param2, XSD_ANYTYPE, "comm_link", "http://tempuri.org/type");
$parametre = array("entityname"=>"comm_link", "records" => $modif);
$client -> update($parametre);
return $this -> redirect( $this -> generateUrl('TestDatabaseBundle_homepage2', array('id' => $commid)));
}}
return $this -> render('TestDatabaseBundle:Default:formulaire.html.twig',
array('form' => $form -> createview()));
}
It seems that the validator take the default value of company and store the list of its employyes and when I change the company (and so the employee list change) the validator doesn't valid because every current employees are not in the previous list.
I would be happy to see any information or solution you can give | 0 |
11,430,239 | 07/11/2012 10:06:00 | 1,423,895 | 05/29/2012 14:07:50 | 1 | 0 | OleDbDataReader does not see data in the cell(.xlsx) | Have a really weird problem with reading xlsx file(I'm using OleDbDataReader).
I have a column there that consist of the following data:
- 50595855
- 59528522
- C_213154
- 23141411
The problem is that when I read this column the reader shows me that the third row is empty. The column format in Excel is set to 'General'. But when I set the format to 'Text', everything works fine and reader sees the data in that row.
So just for a sake of experiment, I prefixed first two rows with letter and made it look like following :
- C_50595855
- C_59528522
- C_213154
- 23141411
And the reader reads everything without problem even when the column format is set to 'General'.
So Excel apparently somehow analyses data in the column before loading it, and it gets confused when first cells of the column look like numeric and some of the rest are texts..
It is really weird to me as either there is data in the cell or there isn't.
Anyone have any ideas why this is happening?
Any help will be much appreciated.
Regards,
Igor | xlsx | oledbdatareader | null | null | null | null | open | OleDbDataReader does not see data in the cell(.xlsx)
===
Have a really weird problem with reading xlsx file(I'm using OleDbDataReader).
I have a column there that consist of the following data:
- 50595855
- 59528522
- C_213154
- 23141411
The problem is that when I read this column the reader shows me that the third row is empty. The column format in Excel is set to 'General'. But when I set the format to 'Text', everything works fine and reader sees the data in that row.
So just for a sake of experiment, I prefixed first two rows with letter and made it look like following :
- C_50595855
- C_59528522
- C_213154
- 23141411
And the reader reads everything without problem even when the column format is set to 'General'.
So Excel apparently somehow analyses data in the column before loading it, and it gets confused when first cells of the column look like numeric and some of the rest are texts..
It is really weird to me as either there is data in the cell or there isn't.
Anyone have any ideas why this is happening?
Any help will be much appreciated.
Regards,
Igor | 0 |
11,430,244 | 07/11/2012 10:06:09 | 746,459 | 05/10/2011 08:38:42 | 49 | 1 | Two utterly different JAXB annotated classes, same @XmlElement name. Possible? | We have an existing document tree. We want to wrap some of the elements inside this tree up within a <language> element.
Depending on where in the tree we are, the <language> element will hold very different content.
So I have a DocumentPromptLanguage class and a DocumentRouterLanguage class. They have different parents and different children but it makes sense that in XML they are both called <language>.
Is this possible without adapters or must the XML representation disambiguate by element name? | java | xml | jaxb | null | null | null | open | Two utterly different JAXB annotated classes, same @XmlElement name. Possible?
===
We have an existing document tree. We want to wrap some of the elements inside this tree up within a <language> element.
Depending on where in the tree we are, the <language> element will hold very different content.
So I have a DocumentPromptLanguage class and a DocumentRouterLanguage class. They have different parents and different children but it makes sense that in XML they are both called <language>.
Is this possible without adapters or must the XML representation disambiguate by element name? | 0 |
11,430,252 | 07/11/2012 10:06:25 | 1,513,096 | 07/09/2012 20:44:58 | 3 | 0 | changing the color of a part of text in stylus css? | i want to change the color of only one word in string of text using stylus i.e.
#copy
h1 Our new site will be ready soon..
the stylus code is
h1
font-weight bold
color white
i just want to change the color of the first letter in the h1 phrase "Our" into yellow
how could i achieve that in stylus, thanks :) | css | node.js | stylus | null | null | null | open | changing the color of a part of text in stylus css?
===
i want to change the color of only one word in string of text using stylus i.e.
#copy
h1 Our new site will be ready soon..
the stylus code is
h1
font-weight bold
color white
i just want to change the color of the first letter in the h1 phrase "Our" into yellow
how could i achieve that in stylus, thanks :) | 0 |
11,430,253 | 07/11/2012 10:06:26 | 1,497,597 | 07/03/2012 03:12:37 | 1 | 4 | How set icon for dialog in android | i customize a dialog in android.
i known set title for dialog is:
dialog.setTitle("O message");
Now i want set a icon in from of title.
how do i must code?
can you help me this problem?
thanks all. | android | null | null | null | null | null | open | How set icon for dialog in android
===
i customize a dialog in android.
i known set title for dialog is:
dialog.setTitle("O message");
Now i want set a icon in from of title.
how do i must code?
can you help me this problem?
thanks all. | 0 |
11,430,254 | 07/11/2012 10:06:30 | 1,410,652 | 05/22/2012 15:52:54 | 21 | 2 | iTextSharp: Put blank space before a table | I'm using iTextSharp to render an html page in a PDF file.
Rendering is ok but i can't find a way to put some blank space before every table.
Now the text before the table is too close.
Is there an attribute I can add to the stylesheet?
Thank you | c# | itextsharp | null | null | null | null | open | iTextSharp: Put blank space before a table
===
I'm using iTextSharp to render an html page in a PDF file.
Rendering is ok but i can't find a way to put some blank space before every table.
Now the text before the table is too close.
Is there an attribute I can add to the stylesheet?
Thank you | 0 |
11,430,262 | 07/11/2012 10:06:58 | 1,517,382 | 06/15/2012 05:47:23 | 1 | 0 | Spring Security RememberMe cookie automatically removing | <pre>
After Signup I am performing autoLogin as follow.<br>After that i want to create Spring Security RememberMe cookies it is creating successfully<br>but, once my browser closed and start again i opened my web page<br> at that time the cookie is removing
<b>***My Code***</b>
<code>
private void autoLogin(final Member member,
final HttpServletRequest request, final HttpServletResponse response) {
final Collection<GrantedAuthority> authorities =
new ArrayList<GrantedAuthority>();
authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
final UsernamePasswordAuthenticationToken authentication =
new UsernamePasswordAuthenticationToken(member.getEmail(),
member.getPassword(), authorities);
SecurityContextHolder.getContext().setAuthentication(authentication);
final CustomUserDetails customUserDetails =
new CustomUserDetails();
final TokenBasedRememberMeServices rememberMe =
new TokenBasedRememberMeServices("nykeysecret", customUserDetails);
rememberMe.onLoginSuccess(request, response, authentication);
} | spring-security | null | null | null | null | 07/16/2012 15:43:51 | too localized | Spring Security RememberMe cookie automatically removing
===
<pre>
After Signup I am performing autoLogin as follow.<br>After that i want to create Spring Security RememberMe cookies it is creating successfully<br>but, once my browser closed and start again i opened my web page<br> at that time the cookie is removing
<b>***My Code***</b>
<code>
private void autoLogin(final Member member,
final HttpServletRequest request, final HttpServletResponse response) {
final Collection<GrantedAuthority> authorities =
new ArrayList<GrantedAuthority>();
authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
final UsernamePasswordAuthenticationToken authentication =
new UsernamePasswordAuthenticationToken(member.getEmail(),
member.getPassword(), authorities);
SecurityContextHolder.getContext().setAuthentication(authentication);
final CustomUserDetails customUserDetails =
new CustomUserDetails();
final TokenBasedRememberMeServices rememberMe =
new TokenBasedRememberMeServices("nykeysecret", customUserDetails);
rememberMe.onLoginSuccess(request, response, authentication);
} | 3 |
11,430,247 | 07/11/2012 10:06:15 | 373,361 | 06/22/2010 15:43:09 | 339 | 1 | Gnome - Determine keyboard layout | I was wondering how it might be possible to determine the currently used keyboard layout in a gnome session, when the user switches keyboard layouts via an applet. As of now I do not care, what programming language or libraries (gtk,x,...) I have to use for it.
I asked a similar question before on:
http://askubuntu.com/questions/155879/how-to-get-current-gnome-keyboard-layout-from-terminal
Unfortunatelly nobody could solve the issue, which is why I wanted to ask you. How do you determine the current keyboard layout in your programms/scripts.
Thanks
ftiaronsem | linux | keyboard | gnome | null | null | null | open | Gnome - Determine keyboard layout
===
I was wondering how it might be possible to determine the currently used keyboard layout in a gnome session, when the user switches keyboard layouts via an applet. As of now I do not care, what programming language or libraries (gtk,x,...) I have to use for it.
I asked a similar question before on:
http://askubuntu.com/questions/155879/how-to-get-current-gnome-keyboard-layout-from-terminal
Unfortunatelly nobody could solve the issue, which is why I wanted to ask you. How do you determine the current keyboard layout in your programms/scripts.
Thanks
ftiaronsem | 0 |
11,430,248 | 07/11/2012 10:06:17 | 1,382,234 | 05/08/2012 13:51:13 | 45 | 2 | Getting response from servlet. ExtJs | I have a extJs form with fileupload and servlet. After uploading file i want to get response from servlet.
i do this `System.out.println("{success:true, error:'error'}");`
But in firebug in POST i dont see anything. This code works in case wiht jsp but not servlet. So how to send parametrs from servlet? | java | javascript | servlets | extjs | null | null | open | Getting response from servlet. ExtJs
===
I have a extJs form with fileupload and servlet. After uploading file i want to get response from servlet.
i do this `System.out.println("{success:true, error:'error'}");`
But in firebug in POST i dont see anything. This code works in case wiht jsp but not servlet. So how to send parametrs from servlet? | 0 |
11,430,265 | 07/11/2012 10:07:09 | 505,854 | 11/12/2010 14:33:00 | 92 | 8 | Titanium tableview scrollend event in version 2.1 returns contentOffset position y as 0? | I'm creating a tableview with pull to refresh for iPhone. I have added an event listener for 'scrollEnd' to get the contentOffset.y. It working fine and return the point value for titanium sdk version 1.8.0, but returns always 0 on pull down the tableview and positive values for pull up the tableview in version 2.1.0
How the get the negative value on pulling down the tableview in titanium sdk version 2.1.0?? | iphone | events | titanium | listener | tableview | null | open | Titanium tableview scrollend event in version 2.1 returns contentOffset position y as 0?
===
I'm creating a tableview with pull to refresh for iPhone. I have added an event listener for 'scrollEnd' to get the contentOffset.y. It working fine and return the point value for titanium sdk version 1.8.0, but returns always 0 on pull down the tableview and positive values for pull up the tableview in version 2.1.0
How the get the negative value on pulling down the tableview in titanium sdk version 2.1.0?? | 0 |
11,430,267 | 07/11/2012 10:07:17 | 1,467,249 | 06/19/2012 18:18:03 | 11 | 0 | Read text file in C | I want to read a text file input in this form:
This file in these lines
-------------------------------------------------------
10101010-10010100-101010 1
01010011010-011011000101 1
10101---1011001101110101 1
1001111001--010100101010 1
-------------------------------------------------------
I want to store all these lines in the array of string of 0 and 1 that I will decode to the other structure. The rule is that the '-' means either 0 or 1, the last 1 in each line is ignored. Could anyone please help me with any ideas of read this file by C? Cheers. | c | null | null | null | null | 07/11/2012 10:15:51 | too localized | Read text file in C
===
I want to read a text file input in this form:
This file in these lines
-------------------------------------------------------
10101010-10010100-101010 1
01010011010-011011000101 1
10101---1011001101110101 1
1001111001--010100101010 1
-------------------------------------------------------
I want to store all these lines in the array of string of 0 and 1 that I will decode to the other structure. The rule is that the '-' means either 0 or 1, the last 1 in each line is ignored. Could anyone please help me with any ideas of read this file by C? Cheers. | 3 |
11,734,318 | 07/31/2012 06:25:19 | 878,244 | 08/04/2011 09:18:45 | 147 | 25 | Is there a way of getting variables from a prime class inside declared class? | for example -
class wow
{
public $foo = 5;
public __construct()
{
$sub_class = new sub();
}
}
class sub()
{
public function __construct()
{
echo $this->foo;
}
}
$wow = new wow();
Is there a way of doing this? | php | oop | variables | null | null | null | open | Is there a way of getting variables from a prime class inside declared class?
===
for example -
class wow
{
public $foo = 5;
public __construct()
{
$sub_class = new sub();
}
}
class sub()
{
public function __construct()
{
echo $this->foo;
}
}
$wow = new wow();
Is there a way of doing this? | 0 |
11,734,324 | 07/31/2012 06:25:52 | 1,016,284 | 10/27/2011 10:26:05 | 30 | 1 | Handle lots of images in C# application | I'm trying to create a card game in C# and for this I have alot of images that I need to load. They're all jpg images and there are about 7000 of them.
I would like to make sure that if you download the game, the images will not be easily accessible, meaning that they should not just be JPG images in a sub folder of the application. So I thought about imbedding them in a DLL file.
But how do I do this? And how do I handle this efficiently? Is there a tecnique to this sort of thing, or is another method preferable?
- Xenoxsis | c# | image | dll | resources | null | null | open | Handle lots of images in C# application
===
I'm trying to create a card game in C# and for this I have alot of images that I need to load. They're all jpg images and there are about 7000 of them.
I would like to make sure that if you download the game, the images will not be easily accessible, meaning that they should not just be JPG images in a sub folder of the application. So I thought about imbedding them in a DLL file.
But how do I do this? And how do I handle this efficiently? Is there a tecnique to this sort of thing, or is another method preferable?
- Xenoxsis | 0 |
11,734,325 | 07/31/2012 06:25:55 | 1,546,332 | 07/23/2012 15:59:38 | 1 | 0 | DirectShow mpeg4 demux | I am using XNA and trying to display mp4 videos in my windows only app using this filter: http://www.gdcl.co.uk/mpeg4/. I have a working graph in GraphEdt and a semi-functional graph in my code. The video loads and plays audio but the video is all jumbled up. When I use the remote graph to view it running in my code it is identical to the graph made by graphedt.
Can someone help me with this or tell me a better way to display Mp4's in my app. (Also I need help with the SampleGrabber, which is as I understand it the only way to get a "windowless" movie in your app)
int hr;
var graphBuilder = (IGraphBuilder)new FilterGraph();
this.m_rot = new DsROTEntry(graphBuilder);
var builder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
hr = builder.SetFiltergraph(graphBuilder);
DsError.ThrowExceptionForHR(hr);
IBaseFilter sourceFilter = null;
hr = graphBuilder.AddSourceFilter(videoFile, videoFile, out sourceFilter);
DsError.ThrowExceptionForHR(hr);
Guid m_guid = new Guid("025BE2E4-1787-4da4-A585-C5B2B9EEB57C");
Type m_comtype = Type.GetTypeFromCLSID(m_guid);
IBaseFilter demuxFilter = (IBaseFilter)Activator.CreateInstance(m_comtype);
graphBuilder.AddFilter(demuxFilter, "GDCL Mpeg-4 Demultiplexor");
IBaseFilter defaultRenderer = (IBaseFilter)new VideoRendererDefault();
hr = graphBuilder.AddFilter(defaultRenderer, "Default Renderer");
DsError.ThrowExceptionForHR(hr);
IPin sourceFilterOutputPin = DsFindPin.ByDirection(sourceFilter, PinDirection.Output, 0);
IPin demuxFilterPinIn = DsFindPin.ByDirection(demuxFilter, PinDirection.Input, 0);
hr = graphBuilder.Connect(sourceFilterOutputPin, demuxFilterPinIn);
DsError.ThrowExceptionForHR(hr);
hr = builder.RenderStream(null, MediaType.Video, sourceFilter, null, defaultRenderer);
DsError.ThrowExceptionForHR(hr);
hr = builder.RenderStream(null, MediaType.Audio, sourceFilter, null, null);
DsError.ThrowExceptionForHR(hr);
| c# | xna | directshow | mp4 | mpeg-4 | null | open | DirectShow mpeg4 demux
===
I am using XNA and trying to display mp4 videos in my windows only app using this filter: http://www.gdcl.co.uk/mpeg4/. I have a working graph in GraphEdt and a semi-functional graph in my code. The video loads and plays audio but the video is all jumbled up. When I use the remote graph to view it running in my code it is identical to the graph made by graphedt.
Can someone help me with this or tell me a better way to display Mp4's in my app. (Also I need help with the SampleGrabber, which is as I understand it the only way to get a "windowless" movie in your app)
int hr;
var graphBuilder = (IGraphBuilder)new FilterGraph();
this.m_rot = new DsROTEntry(graphBuilder);
var builder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
hr = builder.SetFiltergraph(graphBuilder);
DsError.ThrowExceptionForHR(hr);
IBaseFilter sourceFilter = null;
hr = graphBuilder.AddSourceFilter(videoFile, videoFile, out sourceFilter);
DsError.ThrowExceptionForHR(hr);
Guid m_guid = new Guid("025BE2E4-1787-4da4-A585-C5B2B9EEB57C");
Type m_comtype = Type.GetTypeFromCLSID(m_guid);
IBaseFilter demuxFilter = (IBaseFilter)Activator.CreateInstance(m_comtype);
graphBuilder.AddFilter(demuxFilter, "GDCL Mpeg-4 Demultiplexor");
IBaseFilter defaultRenderer = (IBaseFilter)new VideoRendererDefault();
hr = graphBuilder.AddFilter(defaultRenderer, "Default Renderer");
DsError.ThrowExceptionForHR(hr);
IPin sourceFilterOutputPin = DsFindPin.ByDirection(sourceFilter, PinDirection.Output, 0);
IPin demuxFilterPinIn = DsFindPin.ByDirection(demuxFilter, PinDirection.Input, 0);
hr = graphBuilder.Connect(sourceFilterOutputPin, demuxFilterPinIn);
DsError.ThrowExceptionForHR(hr);
hr = builder.RenderStream(null, MediaType.Video, sourceFilter, null, defaultRenderer);
DsError.ThrowExceptionForHR(hr);
hr = builder.RenderStream(null, MediaType.Audio, sourceFilter, null, null);
DsError.ThrowExceptionForHR(hr);
| 0 |
11,734,332 | 07/31/2012 06:26:13 | 944,100 | 09/14/2011 07:55:13 | 70 | 0 | iOS disk space is not enough when i download some files in IOS | I have an app for download some files to the path of Cache.
when the IOS disk space is not enough ,what will be happen? it can be crash!!!?
Thanks in advance!
| ios | crash | null | null | null | null | open | iOS disk space is not enough when i download some files in IOS
===
I have an app for download some files to the path of Cache.
when the IOS disk space is not enough ,what will be happen? it can be crash!!!?
Thanks in advance!
| 0 |
11,734,333 | 07/31/2012 06:26:14 | 1,298,632 | 03/28/2012 15:46:03 | 52 | 0 | implement form filling and printing on web | I am developing a intranet using IIS and .Net technology.
My site should fill some forms (contracts) (MSWord doc) from saved data (database) and print for them by client.
My server and clients are at same palace, so printer can attached to server and reachable by clients
My plan is,
1-prepare forms in msword
2-add some Bookmarks for fields
3-store above files in server (IIS)
4-install msword on IIS computer
5-on server side page using Ole automation, open file in invisible mode
6-replace bookmarks and print to server default printer
some people advise me don't use oleAutomation On IIS ! http://support.microsoft.com/kb/257757
How implement form filling and printing on web env.
Any suggestions
Thanks | forms | iis | printing | null | null | null | open | implement form filling and printing on web
===
I am developing a intranet using IIS and .Net technology.
My site should fill some forms (contracts) (MSWord doc) from saved data (database) and print for them by client.
My server and clients are at same palace, so printer can attached to server and reachable by clients
My plan is,
1-prepare forms in msword
2-add some Bookmarks for fields
3-store above files in server (IIS)
4-install msword on IIS computer
5-on server side page using Ole automation, open file in invisible mode
6-replace bookmarks and print to server default printer
some people advise me don't use oleAutomation On IIS ! http://support.microsoft.com/kb/257757
How implement form filling and printing on web env.
Any suggestions
Thanks | 0 |
11,734,334 | 07/31/2012 06:26:17 | 1,050,804 | 11/17/2011 01:05:12 | 14 | 0 | how GTalk send file work? | Do you know how send file work for GTalk, is there any Network Behavior Analysis article on it? E.g. clientA send file to clientB, how to identify this file in the network level?
Thanks :) | p2p | libjingle | talk | null | null | null | open | how GTalk send file work?
===
Do you know how send file work for GTalk, is there any Network Behavior Analysis article on it? E.g. clientA send file to clientB, how to identify this file in the network level?
Thanks :) | 0 |
11,734,337 | 07/31/2012 06:26:41 | 1,564,853 | 07/31/2012 06:19:20 | 1 | 0 | How to create xml file of particular division from url in php? | I want to create xml file of particular division from url in php.
How to do this. any idea?
i am new in php. | php | jquery | html | ajax | web-services | 07/31/2012 21:46:45 | not a real question | How to create xml file of particular division from url in php?
===
I want to create xml file of particular division from url in php.
How to do this. any idea?
i am new in php. | 1 |
11,734,339 | 07/31/2012 06:26:49 | 408,349 | 08/02/2010 06:12:40 | 499 | 25 | How to store a value only for a certain period in tomcat/java | I want to store some values only for certain period of time in a collection in tomcat java web application.
The scenario is :
- `value1` is added first
- `value2` is added 1 minute after `value1`
- `value3` is added just after `value2` is added
- `value4` is added 2 minute after `value1` is added
This values should be available only for 5 minute time after they added. After 5 minute they should be removed from the list.
Every value expires after 5 minute time (after they added) regardless of their last access time.
I have already started to implement this by using a `ConcurrentHashMap` and `ScheduledExecutor`.
I could not find a proper in-built cache mechanism for this requirement and if a cache is used it will not remove/expire the values from the list if values are accessed more frequently.
I appreciate if someone can give me a direction or reference to any existing implementation. | java | caching | tomcat | tomcat7 | null | 08/01/2012 14:16:11 | not constructive | How to store a value only for a certain period in tomcat/java
===
I want to store some values only for certain period of time in a collection in tomcat java web application.
The scenario is :
- `value1` is added first
- `value2` is added 1 minute after `value1`
- `value3` is added just after `value2` is added
- `value4` is added 2 minute after `value1` is added
This values should be available only for 5 minute time after they added. After 5 minute they should be removed from the list.
Every value expires after 5 minute time (after they added) regardless of their last access time.
I have already started to implement this by using a `ConcurrentHashMap` and `ScheduledExecutor`.
I could not find a proper in-built cache mechanism for this requirement and if a cache is used it will not remove/expire the values from the list if values are accessed more frequently.
I appreciate if someone can give me a direction or reference to any existing implementation. | 4 |
11,567,664 | 07/19/2012 19:08:18 | 1,215,243 | 02/17/2012 02:22:20 | 6 | 0 | Google maps sample reading data | I am looking at the google map sample
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/examples/simple_example.html
It seems to be reading the data from:
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/data.json
Running through firefox with firebug, a var data.photos gets filled with the data.
Can someone explain how this is happening?
I must be missing something in the code.
thanks | javascript | google-maps | data | null | null | null | open | Google maps sample reading data
===
I am looking at the google map sample
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/examples/simple_example.html
It seems to be reading the data from:
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/data.json
Running through firefox with firebug, a var data.photos gets filled with the data.
Can someone explain how this is happening?
I must be missing something in the code.
thanks | 0 |
11,567,665 | 07/19/2012 19:08:29 | 1,356,735 | 04/25/2012 16:18:55 | 145 | 15 | how to write query based on specific task | I have the following tables:
- BoughtItems(UserID,ItemID,StoreID,Quantity,Price)
- Stores(StoreID, Name, Address)
Let's assume that it will be no more then five items for each user in `BoughtItems` table.
I want to have all the clients from some StoreID and all items that were purchased. Here's result table schema: `UserID|Item1ID|Item2ID|Item3ID|Item4ID|Item5ID`
Is it possible to do with a single query? | sql-server | database | null | null | null | null | open | how to write query based on specific task
===
I have the following tables:
- BoughtItems(UserID,ItemID,StoreID,Quantity,Price)
- Stores(StoreID, Name, Address)
Let's assume that it will be no more then five items for each user in `BoughtItems` table.
I want to have all the clients from some StoreID and all items that were purchased. Here's result table schema: `UserID|Item1ID|Item2ID|Item3ID|Item4ID|Item5ID`
Is it possible to do with a single query? | 0 |
11,567,666 | 07/19/2012 19:08:31 | 951,141 | 09/18/2011 10:50:28 | 20 | 0 | Count number of rows in a many-to-many relationship (SQLAlchemy) | I have a many-to-many relationship between say blog entries and tags. Now I want to know how many entries a specific tag has.
Imagine the following models (simplified):
rel_entries_tags = Table('rel_entries_tags', Base.metadata,
Column('entry_id', Integer, ForeignKey('entries.id')),
Column('tag_id', Integer, ForeignKey('tags.id'))
)
class Entry(Base):
__tablename__ = 'entries'
id = Column(Integer, primary_key=True)
title = Column(String(80))
text = Column(Text)
tags = relationship('Tag', secondary=rel_entries_tags, backref=backref('entries'))
def __init__(self, title, text):
self.title = title
self.text = text
self.tags = tags
class Tag(Base):
__tablename__ = 'tags'
id = Column(Integer, primary_key=True)
name = Column(String(80), unique=True, nullable=False)
def __init__(self, name):
self.name = name
My approach to count the amount of entries for a tag is `len(db_session.query(Tag).get(1).entries)`. The problem is that when it gets `db_session.query(Tag).get(1).entries` SQLAlchemy selects all the entries with all their columns for a tag, however, I want only the amount of the entries, not the entries themselves. Is there a more optimal approach for this problem?
Thanks. | python | sqlalchemy | null | null | null | null | open | Count number of rows in a many-to-many relationship (SQLAlchemy)
===
I have a many-to-many relationship between say blog entries and tags. Now I want to know how many entries a specific tag has.
Imagine the following models (simplified):
rel_entries_tags = Table('rel_entries_tags', Base.metadata,
Column('entry_id', Integer, ForeignKey('entries.id')),
Column('tag_id', Integer, ForeignKey('tags.id'))
)
class Entry(Base):
__tablename__ = 'entries'
id = Column(Integer, primary_key=True)
title = Column(String(80))
text = Column(Text)
tags = relationship('Tag', secondary=rel_entries_tags, backref=backref('entries'))
def __init__(self, title, text):
self.title = title
self.text = text
self.tags = tags
class Tag(Base):
__tablename__ = 'tags'
id = Column(Integer, primary_key=True)
name = Column(String(80), unique=True, nullable=False)
def __init__(self, name):
self.name = name
My approach to count the amount of entries for a tag is `len(db_session.query(Tag).get(1).entries)`. The problem is that when it gets `db_session.query(Tag).get(1).entries` SQLAlchemy selects all the entries with all their columns for a tag, however, I want only the amount of the entries, not the entries themselves. Is there a more optimal approach for this problem?
Thanks. | 0 |
11,567,668 | 07/19/2012 19:08:41 | 1,317,804 | 04/06/2012 15:55:33 | 1 | 0 | SVG to Canvas with d3.js | Has anyone tried using a svg to canvas library when creating d3.js visualizations? I've tried to use canvg.js to convert svg to canvas from within an android 2.3 application webview, but when I call:
svg.selectAll(".axis")
.data(d3.range(angle.domain()[1]))
.enter().append("g")
.attr("class", "axis")
.attr("transform", function(d) { return "rotate(" + angle(d) * 180 / Math.PI + ")"; })
.call(d3.svg.axis()
.scale(radius.copy().range([-5, -outerRadius]))
.ticks(5)
.orient("left"))
.append("text")
.attr("y",
function (d) {
if (window.innerWidth < 455){
console.log("innerWidth less than 455: ",window.innerWidth);
return -(window.innerHeight * .33);
}
else{
console.log("innerWidth greater than 455: ",window.innerWidth);
return -(window.innerHeight * .33);
}
})
.attr("dy", ".71em")
.attr("text-anchor", "middle")
.text(function(d, i) { return capitalMeta[i]; })
.attr("style","font-size:12px;");
I get the error: Uncaught TypeError: Cannot call method 'setProperty' of null http://mbostock.github.com/d3/d3.js?2.5.0:1707
Would some sort of headless browser application, or a server side js parser work? Has anyone encountered this before?
| node.js | d3.js | null | null | null | null | open | SVG to Canvas with d3.js
===
Has anyone tried using a svg to canvas library when creating d3.js visualizations? I've tried to use canvg.js to convert svg to canvas from within an android 2.3 application webview, but when I call:
svg.selectAll(".axis")
.data(d3.range(angle.domain()[1]))
.enter().append("g")
.attr("class", "axis")
.attr("transform", function(d) { return "rotate(" + angle(d) * 180 / Math.PI + ")"; })
.call(d3.svg.axis()
.scale(radius.copy().range([-5, -outerRadius]))
.ticks(5)
.orient("left"))
.append("text")
.attr("y",
function (d) {
if (window.innerWidth < 455){
console.log("innerWidth less than 455: ",window.innerWidth);
return -(window.innerHeight * .33);
}
else{
console.log("innerWidth greater than 455: ",window.innerWidth);
return -(window.innerHeight * .33);
}
})
.attr("dy", ".71em")
.attr("text-anchor", "middle")
.text(function(d, i) { return capitalMeta[i]; })
.attr("style","font-size:12px;");
I get the error: Uncaught TypeError: Cannot call method 'setProperty' of null http://mbostock.github.com/d3/d3.js?2.5.0:1707
Would some sort of headless browser application, or a server side js parser work? Has anyone encountered this before?
| 0 |
11,567,674 | 07/19/2012 19:09:02 | 369,762 | 06/17/2010 20:24:02 | 24 | 1 | error in converting js code to jQueryMobile | I have a javascript/jquery code http://jsfiddle.net/9773D/ for timer.
I am trying to port it to jQuery Mobile code but I am confused about the pageinit,bind,live etc window events.
In the code i see that the error is because some elements in the tick() function are not loaded in DOM before it has been invoked in the code. Can someone help me in correcting my code.
Thanks,
| jquery | jquery-mobile | timer | null | null | null | open | error in converting js code to jQueryMobile
===
I have a javascript/jquery code http://jsfiddle.net/9773D/ for timer.
I am trying to port it to jQuery Mobile code but I am confused about the pageinit,bind,live etc window events.
In the code i see that the error is because some elements in the tick() function are not loaded in DOM before it has been invoked in the code. Can someone help me in correcting my code.
Thanks,
| 0 |
11,567,678 | 07/19/2012 19:09:10 | 1,175,065 | 01/28/2012 10:43:08 | 306 | 1 | Which mode is cross-compatible with JSP | I am designing my website in `jsp`. i am using `Apache tomcat` server to run my website. My website is running and rendering perfectly in `Firefox` and `Chrome`. However in `Internet Explorer` it is abnormally behaving.<br>
In Internet Explorer some modes are present to view the web. My question is that which `mode` is cross compatible and highly acceptable across the web developers for designing web pages with `jsp`? | internet-explorer | jsp | firefox | google-chrome | tomcat | null | open | Which mode is cross-compatible with JSP
===
I am designing my website in `jsp`. i am using `Apache tomcat` server to run my website. My website is running and rendering perfectly in `Firefox` and `Chrome`. However in `Internet Explorer` it is abnormally behaving.<br>
In Internet Explorer some modes are present to view the web. My question is that which `mode` is cross compatible and highly acceptable across the web developers for designing web pages with `jsp`? | 0 |
11,567,363 | 07/19/2012 18:48:19 | 1,255,620 | 03/07/2012 20:08:56 | 30 | 0 | Disable and Enable dropdown in IE6 using jQuery | I am using
selectElement.attr('disabled', 'disabled');
to disable a dropdown in IE6, and using
selectElement.removeAttr('disabled');
to re-enable it. But it remains disabled and greyed out. Anyone has any ideas?
Thanks | jquery | internet-explorer | internet-explorer-6 | html-select | null | null | open | Disable and Enable dropdown in IE6 using jQuery
===
I am using
selectElement.attr('disabled', 'disabled');
to disable a dropdown in IE6, and using
selectElement.removeAttr('disabled');
to re-enable it. But it remains disabled and greyed out. Anyone has any ideas?
Thanks | 0 |
11,567,684 | 07/19/2012 19:09:38 | 1,466,779 | 06/19/2012 14:56:39 | 1 | 0 | jQuery first click not working due to variable scope | I am trying to extract the video ID that is contained within the URL of a YouTube video and then store that ID in a variable that I can reference in creating an iframe to embed the YouTube video.
Below is my code:
$(".result").live("click", function(){
var result_number = 0;
youtubequery = "https://gdata.youtube.com/feeds/api/videos?category=Music&q=thesongstitle&v=2&alt=json&max-results=5";
youtubeid = "";
$.getJSON(youtubequery, function(vid_data) {
$.each(vid_data.feed.entry, function(e, vid) {
if(e == result_number){
youtubeid = vid.id.$t.substring(27);
}
});
});
iframehtml = "<iframe height='300' width='400' src='http://www.youtube.com/embed/" + youtubeid + "?autoplay=1' frameborder='0' allowfullscreen></iframe>";
$("#youtube_vid").html(iframehtml);
});
When I click on a div of the class "result" the first time the YouTube ID is not included in the iframe html stored in the variable iframehtml. But, when I click it the second time, everything works as expected.
Does anyone know what could be causing this?
I was able to get it to work when I included the creation of the iframehtml variable and the line that puts the html in #youtube_vid, but due to the functionality of my site I cannot code it that way.
| jquery | variables | scope | click | each | null | open | jQuery first click not working due to variable scope
===
I am trying to extract the video ID that is contained within the URL of a YouTube video and then store that ID in a variable that I can reference in creating an iframe to embed the YouTube video.
Below is my code:
$(".result").live("click", function(){
var result_number = 0;
youtubequery = "https://gdata.youtube.com/feeds/api/videos?category=Music&q=thesongstitle&v=2&alt=json&max-results=5";
youtubeid = "";
$.getJSON(youtubequery, function(vid_data) {
$.each(vid_data.feed.entry, function(e, vid) {
if(e == result_number){
youtubeid = vid.id.$t.substring(27);
}
});
});
iframehtml = "<iframe height='300' width='400' src='http://www.youtube.com/embed/" + youtubeid + "?autoplay=1' frameborder='0' allowfullscreen></iframe>";
$("#youtube_vid").html(iframehtml);
});
When I click on a div of the class "result" the first time the YouTube ID is not included in the iframe html stored in the variable iframehtml. But, when I click it the second time, everything works as expected.
Does anyone know what could be causing this?
I was able to get it to work when I included the creation of the iframehtml variable and the line that puts the html in #youtube_vid, but due to the functionality of my site I cannot code it that way.
| 0 |
11,567,288 | 07/19/2012 18:42:38 | 1,295,035 | 03/27/2012 08:54:54 | 1 | 0 | start cuda (use of libraries or API s) | <p>I want to start CUDA in C++ and I familiar with C++ , Qt and C#. </p>
<p> But i want to know it's better to use from CUDA libraries -at high level- or CUDA API s -at the lower level- ? </p>
Is it more better that I'm starting from API and dont use of CUDA driver ?
(I start on "*cuda by example*" for its concepts in parallel)
| cuda | null | null | null | null | null | open | start cuda (use of libraries or API s)
===
<p>I want to start CUDA in C++ and I familiar with C++ , Qt and C#. </p>
<p> But i want to know it's better to use from CUDA libraries -at high level- or CUDA API s -at the lower level- ? </p>
Is it more better that I'm starting from API and dont use of CUDA driver ?
(I start on "*cuda by example*" for its concepts in parallel)
| 0 |
11,401,237 | 07/09/2012 18:51:41 | 1,512,844 | 07/09/2012 18:39:38 | 1 | 0 | google api javascript client Drive Api and access to Spreadsheets | if Google Drive API will be supported by access to Spreadsheet API
Or it's will be new Spreadsheet API like we have
https://developers.google.com/apis-explorer/#p/
Similar to developers.google.com/google-apps/spreadsheets/
https://code.google.com/p/google-api-javascript-client/ | google-api | google-drive-sdk | google-spreadsheet-api | null | null | null | open | google api javascript client Drive Api and access to Spreadsheets
===
if Google Drive API will be supported by access to Spreadsheet API
Or it's will be new Spreadsheet API like we have
https://developers.google.com/apis-explorer/#p/
Similar to developers.google.com/google-apps/spreadsheets/
https://code.google.com/p/google-api-javascript-client/ | 0 |
11,401,279 | 07/09/2012 18:54:21 | 530,933 | 12/05/2010 02:55:47 | 1,151 | 134 | clicking/tapping between buffers for AudioQueue | As you can see from the code, within my callback I extract out the audio data and place it into NSData data, then send that off to another class to upload that to the server. This all works, meaning the server receives and plays the audio data. HOWEVER there is a clicking or tapping noise between the buffers. I am hoping someone might show me what is causing that and how it can be fixed.
I have read other related postings however they all seemed to refer to only using 1 buffer and that adding more was the fix but I am using 3 buffers and have tried adjusting that number which did not fix it
AQRecorder.mm
#include "AQRecorder.h"
RestClient * restClient;
NSData* data;
// ____________________________________________________________________________________
// Determine the size, in bytes, of a buffer necessary to represent the supplied number
// of seconds of audio data.
int AQRecorder::ComputeRecordBufferSize(const AudioStreamBasicDescription *format, float seconds)
{
int packets, frames, bytes = 0;
try {
frames = (int)ceil(seconds * format->mSampleRate);
if (format->mBytesPerFrame > 0)
bytes = frames * format->mBytesPerFrame;
else {
UInt32 maxPacketSize;
if (format->mBytesPerPacket > 0)
maxPacketSize = format->mBytesPerPacket; // constant packet size
else {
UInt32 propertySize = sizeof(maxPacketSize);
XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_MaximumOutputPacketSize, &maxPacketSize,
&propertySize), "couldn't get queue's maximum output packet size");
}
if (format->mFramesPerPacket > 0)
packets = frames / format->mFramesPerPacket;
else
packets = frames; // worst-case scenario: 1 frame in a packet
if (packets == 0) // sanity check
packets = 1;
bytes = packets * maxPacketSize;
}
} catch (CAXException e) {
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
return 0;
}
return bytes;
}
// ____________________________________________________________________________________
// AudioQueue callback function, called when an input buffers has been filled.
void AQRecorder::MyInputBufferHandler( void * inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer,
const AudioTimeStamp * inStartTime,
UInt32 inNumPackets,
const AudioStreamPacketDescription* inPacketDesc)
{
AQRecorder *aqr = (AQRecorder *)inUserData;
try {
if (inNumPackets > 0) {
// write packets to file
// XThrowIfError(AudioFileWritePackets(aqr->mRecordFile, FALSE, inBuffer->mAudioDataByteSize,
// inPacketDesc, aqr->mRecordPacket, &inNumPackets, inBuffer->mAudioData),
// "AudioFileWritePackets failed");
aqr->mRecordPacket += inNumPackets;
// int numBytes = inBuffer->mAudioDataByteSize;
// SInt8 *testBuffer = (SInt8*)inBuffer->mAudioData;
//
// for (int i=0; i < numBytes; i++)
// {
// SInt8 currentData = testBuffer[i];
// printf("Current data in testbuffer is %d", currentData);
//
// NSData * temp = [NSData dataWithBytes:currentData length:sizeof(currentData)];
// }
data=[[NSData dataWithBytes:inBuffer->mAudioData length:inBuffer->mAudioDataByteSize]retain];
[restClient uploadAudioData:data url:nil];
}
// if we're not stopping, re-enqueue the buffer so that it gets filled again
if (aqr->IsRunning())
XThrowIfError(AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL), "AudioQueueEnqueueBuffer failed");
} catch (CAXException e) {
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
}
}
AQRecorder::AQRecorder()
{
mIsRunning = false;
mRecordPacket = 0;
data = [[NSData alloc]init];
restClient = [[RestClient sharedManager]retain];
}
AQRecorder::~AQRecorder()
{
AudioQueueDispose(mQueue, TRUE);
AudioFileClose(mRecordFile);
if (mFileName){
CFRelease(mFileName);
}
[restClient release];
[data release];
}
// ____________________________________________________________________________________
// Copy a queue's encoder's magic cookie to an audio file.
void AQRecorder::CopyEncoderCookieToFile()
{
UInt32 propertySize;
// get the magic cookie, if any, from the converter
OSStatus err = AudioQueueGetPropertySize(mQueue, kAudioQueueProperty_MagicCookie, &propertySize);
// we can get a noErr result and also a propertySize == 0
// -- if the file format does support magic cookies, but this file doesn't have one.
if (err == noErr && propertySize > 0) {
Byte *magicCookie = new Byte[propertySize];
UInt32 magicCookieSize;
XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_MagicCookie, magicCookie, &propertySize), "get audio converter's magic cookie");
magicCookieSize = propertySize; // the converter lies and tell us the wrong size
// now set the magic cookie on the output file
UInt32 willEatTheCookie = false;
// the converter wants to give us one; will the file take it?
err = AudioFileGetPropertyInfo(mRecordFile, kAudioFilePropertyMagicCookieData, NULL, &willEatTheCookie);
if (err == noErr && willEatTheCookie) {
err = AudioFileSetProperty(mRecordFile, kAudioFilePropertyMagicCookieData, magicCookieSize, magicCookie);
XThrowIfError(err, "set audio file's magic cookie");
}
delete[] magicCookie;
}
}
void AQRecorder::SetupAudioFormat(UInt32 inFormatID)
{
memset(&mRecordFormat, 0, sizeof(mRecordFormat));
UInt32 size = sizeof(mRecordFormat.mSampleRate);
XThrowIfError(AudioSessionGetProperty( kAudioSessionProperty_CurrentHardwareSampleRate,
&size,
&mRecordFormat.mSampleRate), "couldn't get hardware sample rate");
//override samplearate to 8k from device sample rate
mRecordFormat.mSampleRate = 8000.0;
size = sizeof(mRecordFormat.mChannelsPerFrame);
XThrowIfError(AudioSessionGetProperty( kAudioSessionProperty_CurrentHardwareInputNumberChannels,
&size,
&mRecordFormat.mChannelsPerFrame), "couldn't get input channel count");
// mRecordFormat.mChannelsPerFrame = 1;
mRecordFormat.mFormatID = inFormatID;
if (inFormatID == kAudioFormatLinearPCM)
{
// if we want pcm, default to signed 16-bit little-endian
mRecordFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
mRecordFormat.mBitsPerChannel = 16;
mRecordFormat.mBytesPerPacket = mRecordFormat.mBytesPerFrame = (mRecordFormat.mBitsPerChannel / 8) * mRecordFormat.mChannelsPerFrame;
mRecordFormat.mFramesPerPacket = 1;
}
if (inFormatID == kAudioFormatULaw) {
NSLog(@"is ulaw");
mRecordFormat.mSampleRate = 8000.0;
mRecordFormat.mFormatFlags = 0;
mRecordFormat.mFramesPerPacket = 1;
mRecordFormat.mChannelsPerFrame = 1;
mRecordFormat.mBitsPerChannel = 8;
mRecordFormat.mBytesPerPacket = 1;
mRecordFormat.mBytesPerFrame = 1;
}
}
NSString * GetDocumentDirectory(void)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
return basePath;
}
void AQRecorder::StartRecord(CFStringRef inRecordFile)
{
int i, bufferByteSize;
UInt32 size;
CFURLRef url;
try {
mFileName = CFStringCreateCopy(kCFAllocatorDefault, inRecordFile);
// specify the recording format
SetupAudioFormat(kAudioFormatULaw /*kAudioFormatLinearPCM*/);
// create the queue
XThrowIfError(AudioQueueNewInput(
&mRecordFormat,
MyInputBufferHandler,
this /* userData */,
NULL /* run loop */, NULL /* run loop mode */,
0 /* flags */, &mQueue), "AudioQueueNewInput failed");
// get the record format back from the queue's audio converter --
// the file may require a more specific stream description than was necessary to create the encoder.
mRecordPacket = 0;
size = sizeof(mRecordFormat);
XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_StreamDescription,
&mRecordFormat, &size), "couldn't get queue's format");
NSString *basePath = GetDocumentDirectory();
NSString *recordFile = [basePath /*NSTemporaryDirectory()*/ stringByAppendingPathComponent: (NSString*)inRecordFile];
url = CFURLCreateWithString(kCFAllocatorDefault, (CFStringRef)recordFile, NULL);
// create the audio file
XThrowIfError(AudioFileCreateWithURL(url, kAudioFileCAFType, &mRecordFormat, kAudioFileFlags_EraseFile,
&mRecordFile), "AudioFileCreateWithURL failed");
CFRelease(url);
// copy the cookie first to give the file object as much info as we can about the data going in
// not necessary for pcm, but required for some compressed audio
CopyEncoderCookieToFile();
// allocate and enqueue buffers
bufferByteSize = ComputeRecordBufferSize(&mRecordFormat, kBufferDurationSeconds); // enough bytes for half a second
for (i = 0; i < kNumberRecordBuffers; ++i) {
XThrowIfError(AudioQueueAllocateBuffer(mQueue, bufferByteSize, &mBuffers[i]),
"AudioQueueAllocateBuffer failed");
XThrowIfError(AudioQueueEnqueueBuffer(mQueue, mBuffers[i], 0, NULL),
"AudioQueueEnqueueBuffer failed");
}
// start the queue
mIsRunning = true;
XThrowIfError(AudioQueueStart(mQueue, NULL), "AudioQueueStart failed");
}
catch (CAXException &e) {
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
}
catch (...) {
fprintf(stderr, "An unknown error occurred\n");
}
}
void AQRecorder::StopRecord()
{
// end recording
mIsRunning = false;
// XThrowIfError(AudioQueueReset(mQueue), "AudioQueueStop failed");
XThrowIfError(AudioQueueStop(mQueue, true), "AudioQueueStop failed");
// a codec may update its cookie at the end of an encoding session, so reapply it to the file now
CopyEncoderCookieToFile();
if (mFileName)
{
CFRelease(mFileName);
mFileName = NULL;
}
AudioQueueDispose(mQueue, true);
AudioFileClose(mRecordFile);
}
| ios | audio | audioqueue | null | null | null | open | clicking/tapping between buffers for AudioQueue
===
As you can see from the code, within my callback I extract out the audio data and place it into NSData data, then send that off to another class to upload that to the server. This all works, meaning the server receives and plays the audio data. HOWEVER there is a clicking or tapping noise between the buffers. I am hoping someone might show me what is causing that and how it can be fixed.
I have read other related postings however they all seemed to refer to only using 1 buffer and that adding more was the fix but I am using 3 buffers and have tried adjusting that number which did not fix it
AQRecorder.mm
#include "AQRecorder.h"
RestClient * restClient;
NSData* data;
// ____________________________________________________________________________________
// Determine the size, in bytes, of a buffer necessary to represent the supplied number
// of seconds of audio data.
int AQRecorder::ComputeRecordBufferSize(const AudioStreamBasicDescription *format, float seconds)
{
int packets, frames, bytes = 0;
try {
frames = (int)ceil(seconds * format->mSampleRate);
if (format->mBytesPerFrame > 0)
bytes = frames * format->mBytesPerFrame;
else {
UInt32 maxPacketSize;
if (format->mBytesPerPacket > 0)
maxPacketSize = format->mBytesPerPacket; // constant packet size
else {
UInt32 propertySize = sizeof(maxPacketSize);
XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_MaximumOutputPacketSize, &maxPacketSize,
&propertySize), "couldn't get queue's maximum output packet size");
}
if (format->mFramesPerPacket > 0)
packets = frames / format->mFramesPerPacket;
else
packets = frames; // worst-case scenario: 1 frame in a packet
if (packets == 0) // sanity check
packets = 1;
bytes = packets * maxPacketSize;
}
} catch (CAXException e) {
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
return 0;
}
return bytes;
}
// ____________________________________________________________________________________
// AudioQueue callback function, called when an input buffers has been filled.
void AQRecorder::MyInputBufferHandler( void * inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer,
const AudioTimeStamp * inStartTime,
UInt32 inNumPackets,
const AudioStreamPacketDescription* inPacketDesc)
{
AQRecorder *aqr = (AQRecorder *)inUserData;
try {
if (inNumPackets > 0) {
// write packets to file
// XThrowIfError(AudioFileWritePackets(aqr->mRecordFile, FALSE, inBuffer->mAudioDataByteSize,
// inPacketDesc, aqr->mRecordPacket, &inNumPackets, inBuffer->mAudioData),
// "AudioFileWritePackets failed");
aqr->mRecordPacket += inNumPackets;
// int numBytes = inBuffer->mAudioDataByteSize;
// SInt8 *testBuffer = (SInt8*)inBuffer->mAudioData;
//
// for (int i=0; i < numBytes; i++)
// {
// SInt8 currentData = testBuffer[i];
// printf("Current data in testbuffer is %d", currentData);
//
// NSData * temp = [NSData dataWithBytes:currentData length:sizeof(currentData)];
// }
data=[[NSData dataWithBytes:inBuffer->mAudioData length:inBuffer->mAudioDataByteSize]retain];
[restClient uploadAudioData:data url:nil];
}
// if we're not stopping, re-enqueue the buffer so that it gets filled again
if (aqr->IsRunning())
XThrowIfError(AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL), "AudioQueueEnqueueBuffer failed");
} catch (CAXException e) {
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
}
}
AQRecorder::AQRecorder()
{
mIsRunning = false;
mRecordPacket = 0;
data = [[NSData alloc]init];
restClient = [[RestClient sharedManager]retain];
}
AQRecorder::~AQRecorder()
{
AudioQueueDispose(mQueue, TRUE);
AudioFileClose(mRecordFile);
if (mFileName){
CFRelease(mFileName);
}
[restClient release];
[data release];
}
// ____________________________________________________________________________________
// Copy a queue's encoder's magic cookie to an audio file.
void AQRecorder::CopyEncoderCookieToFile()
{
UInt32 propertySize;
// get the magic cookie, if any, from the converter
OSStatus err = AudioQueueGetPropertySize(mQueue, kAudioQueueProperty_MagicCookie, &propertySize);
// we can get a noErr result and also a propertySize == 0
// -- if the file format does support magic cookies, but this file doesn't have one.
if (err == noErr && propertySize > 0) {
Byte *magicCookie = new Byte[propertySize];
UInt32 magicCookieSize;
XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_MagicCookie, magicCookie, &propertySize), "get audio converter's magic cookie");
magicCookieSize = propertySize; // the converter lies and tell us the wrong size
// now set the magic cookie on the output file
UInt32 willEatTheCookie = false;
// the converter wants to give us one; will the file take it?
err = AudioFileGetPropertyInfo(mRecordFile, kAudioFilePropertyMagicCookieData, NULL, &willEatTheCookie);
if (err == noErr && willEatTheCookie) {
err = AudioFileSetProperty(mRecordFile, kAudioFilePropertyMagicCookieData, magicCookieSize, magicCookie);
XThrowIfError(err, "set audio file's magic cookie");
}
delete[] magicCookie;
}
}
void AQRecorder::SetupAudioFormat(UInt32 inFormatID)
{
memset(&mRecordFormat, 0, sizeof(mRecordFormat));
UInt32 size = sizeof(mRecordFormat.mSampleRate);
XThrowIfError(AudioSessionGetProperty( kAudioSessionProperty_CurrentHardwareSampleRate,
&size,
&mRecordFormat.mSampleRate), "couldn't get hardware sample rate");
//override samplearate to 8k from device sample rate
mRecordFormat.mSampleRate = 8000.0;
size = sizeof(mRecordFormat.mChannelsPerFrame);
XThrowIfError(AudioSessionGetProperty( kAudioSessionProperty_CurrentHardwareInputNumberChannels,
&size,
&mRecordFormat.mChannelsPerFrame), "couldn't get input channel count");
// mRecordFormat.mChannelsPerFrame = 1;
mRecordFormat.mFormatID = inFormatID;
if (inFormatID == kAudioFormatLinearPCM)
{
// if we want pcm, default to signed 16-bit little-endian
mRecordFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
mRecordFormat.mBitsPerChannel = 16;
mRecordFormat.mBytesPerPacket = mRecordFormat.mBytesPerFrame = (mRecordFormat.mBitsPerChannel / 8) * mRecordFormat.mChannelsPerFrame;
mRecordFormat.mFramesPerPacket = 1;
}
if (inFormatID == kAudioFormatULaw) {
NSLog(@"is ulaw");
mRecordFormat.mSampleRate = 8000.0;
mRecordFormat.mFormatFlags = 0;
mRecordFormat.mFramesPerPacket = 1;
mRecordFormat.mChannelsPerFrame = 1;
mRecordFormat.mBitsPerChannel = 8;
mRecordFormat.mBytesPerPacket = 1;
mRecordFormat.mBytesPerFrame = 1;
}
}
NSString * GetDocumentDirectory(void)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
return basePath;
}
void AQRecorder::StartRecord(CFStringRef inRecordFile)
{
int i, bufferByteSize;
UInt32 size;
CFURLRef url;
try {
mFileName = CFStringCreateCopy(kCFAllocatorDefault, inRecordFile);
// specify the recording format
SetupAudioFormat(kAudioFormatULaw /*kAudioFormatLinearPCM*/);
// create the queue
XThrowIfError(AudioQueueNewInput(
&mRecordFormat,
MyInputBufferHandler,
this /* userData */,
NULL /* run loop */, NULL /* run loop mode */,
0 /* flags */, &mQueue), "AudioQueueNewInput failed");
// get the record format back from the queue's audio converter --
// the file may require a more specific stream description than was necessary to create the encoder.
mRecordPacket = 0;
size = sizeof(mRecordFormat);
XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_StreamDescription,
&mRecordFormat, &size), "couldn't get queue's format");
NSString *basePath = GetDocumentDirectory();
NSString *recordFile = [basePath /*NSTemporaryDirectory()*/ stringByAppendingPathComponent: (NSString*)inRecordFile];
url = CFURLCreateWithString(kCFAllocatorDefault, (CFStringRef)recordFile, NULL);
// create the audio file
XThrowIfError(AudioFileCreateWithURL(url, kAudioFileCAFType, &mRecordFormat, kAudioFileFlags_EraseFile,
&mRecordFile), "AudioFileCreateWithURL failed");
CFRelease(url);
// copy the cookie first to give the file object as much info as we can about the data going in
// not necessary for pcm, but required for some compressed audio
CopyEncoderCookieToFile();
// allocate and enqueue buffers
bufferByteSize = ComputeRecordBufferSize(&mRecordFormat, kBufferDurationSeconds); // enough bytes for half a second
for (i = 0; i < kNumberRecordBuffers; ++i) {
XThrowIfError(AudioQueueAllocateBuffer(mQueue, bufferByteSize, &mBuffers[i]),
"AudioQueueAllocateBuffer failed");
XThrowIfError(AudioQueueEnqueueBuffer(mQueue, mBuffers[i], 0, NULL),
"AudioQueueEnqueueBuffer failed");
}
// start the queue
mIsRunning = true;
XThrowIfError(AudioQueueStart(mQueue, NULL), "AudioQueueStart failed");
}
catch (CAXException &e) {
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
}
catch (...) {
fprintf(stderr, "An unknown error occurred\n");
}
}
void AQRecorder::StopRecord()
{
// end recording
mIsRunning = false;
// XThrowIfError(AudioQueueReset(mQueue), "AudioQueueStop failed");
XThrowIfError(AudioQueueStop(mQueue, true), "AudioQueueStop failed");
// a codec may update its cookie at the end of an encoding session, so reapply it to the file now
CopyEncoderCookieToFile();
if (mFileName)
{
CFRelease(mFileName);
mFileName = NULL;
}
AudioQueueDispose(mQueue, true);
AudioFileClose(mRecordFile);
}
| 0 |
11,401,280 | 07/09/2012 18:54:23 | 1,512,873 | 07/09/2012 18:51:26 | 1 | 0 | Schemas of Recoverable,Cascading Rollback and Strictness | What are these entities means that in databases can anyone explain me ? I need some examples because of i cannot understand meanings with only reading some articles | database | strict | null | null | null | null | open | Schemas of Recoverable,Cascading Rollback and Strictness
===
What are these entities means that in databases can anyone explain me ? I need some examples because of i cannot understand meanings with only reading some articles | 0 |
11,401,281 | 07/09/2012 18:54:25 | 1,394,513 | 05/14/2012 19:12:50 | 35 | 0 | N-D interpolation for equally-spaced data | I'm trying to copy the Scipy Cookbook function:
from scipy import ogrid, sin, mgrid, ndimage, array
x,y = ogrid[-1:1:5j,-1:1:5j]
fvals = sin(x)*sin(y)
newx,newy = mgrid[-1:1:100j,-1:1:100j]
x0 = x[0,0]
y0 = y[0,0]
dx = x[1,0] - x0
dy = y[0,1] - y0
ivals = (newx - x0)/dx
jvals = (newy - y0)/dy
coords = array([ivals, jvals])
newf = ndimage.map_coordinates(fvals, coords)
by using my own function that has to work for many scenarios
import scipy
import numpy as np
"""N-D interpolation for equally-spaced data"""
x = np.c_[plist['modx']]
y = np.transpose(np.c_[plist['mody']])
pdb.set_trace()
#newx,newy = np.meshgrid(plist['newx'],plist['newy'])
newx,newy = scipy.mgrid[plist['modx'][0]:plist['modx'][-1]:plist['remapto'],
plist['mody'][0]:plist['mody'][-1]:plist['remapto']]
x0 = x[0,0]
y0 = y[0,0]
dx = x[1,0] - x0
dy = y[0,1] - y0
ivals = (newx - x0)/dx
jvals = (newy - y0)/dy
coords = scipy.array([ivals, jvals])
for i in np.arange(ivals.shape[0]):
nvals[i] = scipy.ndimage.map_coordinates(ivals[i], coords)
return nvals
I'm having difficulty getting this code to work properly. The problem areas are:
1.) Recreating this line: newx,newy = mgrid[-1:1:100j,-1:1:100j]. In my case I have a dictionary with the grid in vector form. I've tried to recreate this line using np.meshgrid but then I get an error on line coords = scipy.array([ivals, jvals]). I'm looking for some help in recreating this Cookbook function and making it more dynamic.
any help is greatly appreciated.
/M
| numpy | scipy | null | null | null | null | open | N-D interpolation for equally-spaced data
===
I'm trying to copy the Scipy Cookbook function:
from scipy import ogrid, sin, mgrid, ndimage, array
x,y = ogrid[-1:1:5j,-1:1:5j]
fvals = sin(x)*sin(y)
newx,newy = mgrid[-1:1:100j,-1:1:100j]
x0 = x[0,0]
y0 = y[0,0]
dx = x[1,0] - x0
dy = y[0,1] - y0
ivals = (newx - x0)/dx
jvals = (newy - y0)/dy
coords = array([ivals, jvals])
newf = ndimage.map_coordinates(fvals, coords)
by using my own function that has to work for many scenarios
import scipy
import numpy as np
"""N-D interpolation for equally-spaced data"""
x = np.c_[plist['modx']]
y = np.transpose(np.c_[plist['mody']])
pdb.set_trace()
#newx,newy = np.meshgrid(plist['newx'],plist['newy'])
newx,newy = scipy.mgrid[plist['modx'][0]:plist['modx'][-1]:plist['remapto'],
plist['mody'][0]:plist['mody'][-1]:plist['remapto']]
x0 = x[0,0]
y0 = y[0,0]
dx = x[1,0] - x0
dy = y[0,1] - y0
ivals = (newx - x0)/dx
jvals = (newy - y0)/dy
coords = scipy.array([ivals, jvals])
for i in np.arange(ivals.shape[0]):
nvals[i] = scipy.ndimage.map_coordinates(ivals[i], coords)
return nvals
I'm having difficulty getting this code to work properly. The problem areas are:
1.) Recreating this line: newx,newy = mgrid[-1:1:100j,-1:1:100j]. In my case I have a dictionary with the grid in vector form. I've tried to recreate this line using np.meshgrid but then I get an error on line coords = scipy.array([ivals, jvals]). I'm looking for some help in recreating this Cookbook function and making it more dynamic.
any help is greatly appreciated.
/M
| 0 |
11,401,229 | 07/09/2012 18:51:11 | 999,820 | 10/17/2011 19:08:29 | 915 | 65 | How to use SELECT DISTINCT with RANDOM() function in PostgreSQL? | I am trying to run a SQL query to get four random items. As the table `product_filter` has more than one touple in `product` i have to use `DISTINCT` in the `SELECT`, so i get this error:
**for SELECT DISTINCT, ORDER BY expressions must appear in select list**
But if i put `RANDOM()` in my `SELECT` it will void the `DISTINCT` result.
Someone know how to use `DISTINCT` with the `RANDOM()` function? Below is my query.
select DISTINCT
p.cod,
p.title
from product_filter pf
join product p on pf.cod_product = p.cod
join filters f on pf.cod_filter = f.cod
where
p.visible = 't'
LIMIT 4
order by RANDOM() | sql | postgresql | select | null | null | null | open | How to use SELECT DISTINCT with RANDOM() function in PostgreSQL?
===
I am trying to run a SQL query to get four random items. As the table `product_filter` has more than one touple in `product` i have to use `DISTINCT` in the `SELECT`, so i get this error:
**for SELECT DISTINCT, ORDER BY expressions must appear in select list**
But if i put `RANDOM()` in my `SELECT` it will void the `DISTINCT` result.
Someone know how to use `DISTINCT` with the `RANDOM()` function? Below is my query.
select DISTINCT
p.cod,
p.title
from product_filter pf
join product p on pf.cod_product = p.cod
join filters f on pf.cod_filter = f.cod
where
p.visible = 't'
LIMIT 4
order by RANDOM() | 0 |
11,334,449 | 07/04/2012 19:20:34 | 421,178 | 08/15/2010 20:39:21 | 1,006 | 47 | I'm having second thoughts about what this Clone method is supposed to do |
It is supposed to copy an AnimatedSprite. I'm having second thoughts that it has the unfortunate side effect of changing the *this object.
How would I implement this feature without the side effect?
public:
AnimatedSprite& AnimatedSprite::Clone(const AnimatedSprite& animatedSprite) {
return (*this = animatedSprite);
}
protected:
AnimatedSprite& AnimatedSprite::operator=(const AnimatedSprite& rhs) {
if(this == &rhs) return *this;
destroy_bitmap(this->_frameImage);
this->_frameImage = create_bitmap(rhs._frameImage->w, rhs._frameImage->h);
clear_bitmap(this->_frameImage);
this->_frameDimensions = rhs._frameDimensions;
this->CalcCenterFrame();
this->_frameRate = rhs._frameRate;
if(rhs._animation != nullptr) {
delete this->_animation;
this->_animation = new a2de::AnimationHandler(*rhs._animation);
} else {
delete this->_animation;
this->_animation = nullptr;
}
return *this;
} | c++ | clone | assignment-operator | null | null | null | open | I'm having second thoughts about what this Clone method is supposed to do
===
It is supposed to copy an AnimatedSprite. I'm having second thoughts that it has the unfortunate side effect of changing the *this object.
How would I implement this feature without the side effect?
public:
AnimatedSprite& AnimatedSprite::Clone(const AnimatedSprite& animatedSprite) {
return (*this = animatedSprite);
}
protected:
AnimatedSprite& AnimatedSprite::operator=(const AnimatedSprite& rhs) {
if(this == &rhs) return *this;
destroy_bitmap(this->_frameImage);
this->_frameImage = create_bitmap(rhs._frameImage->w, rhs._frameImage->h);
clear_bitmap(this->_frameImage);
this->_frameDimensions = rhs._frameDimensions;
this->CalcCenterFrame();
this->_frameRate = rhs._frameRate;
if(rhs._animation != nullptr) {
delete this->_animation;
this->_animation = new a2de::AnimationHandler(*rhs._animation);
} else {
delete this->_animation;
this->_animation = nullptr;
}
return *this;
} | 0 |
11,334,450 | 07/04/2012 19:20:45 | 1,502,020 | 07/04/2012 15:53:41 | 1 | 0 | Python: split list of strings to a list of lists of strings by length with a nested comprehensions | I've got a list of strings and I'm trying to make a list of lists of strings by string length.
i.e.
['a', 'b', 'ab', 'abc']
becomes
[['a', 'b'], ['ab'], ['abc']]
I've accomplished this like so:
lst = ['a', 'b', 'ab', 'abc']
lsts = []
for num in set(len(i) for i in lst):
lsts.append([w for w in lst if len(w) == num])
I'm fine with that code, but I'm trying to wrap my head around comprehensions. I want to use nested comprehensions to do the same thing, but I can't figure out how. | python | nested | comprehension | null | null | null | open | Python: split list of strings to a list of lists of strings by length with a nested comprehensions
===
I've got a list of strings and I'm trying to make a list of lists of strings by string length.
i.e.
['a', 'b', 'ab', 'abc']
becomes
[['a', 'b'], ['ab'], ['abc']]
I've accomplished this like so:
lst = ['a', 'b', 'ab', 'abc']
lsts = []
for num in set(len(i) for i in lst):
lsts.append([w for w in lst if len(w) == num])
I'm fine with that code, but I'm trying to wrap my head around comprehensions. I want to use nested comprehensions to do the same thing, but I can't figure out how. | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.