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,410,858 | 07/10/2012 09:59:39 | 947,965 | 09/16/2011 00:50:22 | 40 | 0 | check login credentials | i have a login form that when i get to the page it gives me automatacally the alert message, and i didnt put yet the user and password info when i go to the page, the message that gives me is "User and password dont match". Here is the page that makes the verification of the login form, hope for someone see what is wrong:
<?
session_start();
include "config.php";
if(isset($_SESSION["login_user"]) AND isset($_SESSION['pass_user'])){
$login_user = $_SESSION["login_user"];
$pass_user = $_SESSION["pass_user"];
$sql = mysql_query("SELECT * FROM adm WHERE login = '$login_user'");
$cont = mysql_num_rows($sql);
while($linha = mysql_fetch_array($sql)){
$pass_db = $linha['pass'];
}
if($cont == 0){
unset($_SESSION["login_user"]);
unset($_SESSION["pass_user"]);
echo "
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=login.php'>
<script type=\"text/javascript\">
alert(\"Name of user dont match.\");
</script>";
}
if($pass_db != $pass_user){//check pass
unset($_SESSION["login_user"]);
unset($_SESSION["pass_user"]);
echo "
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=login.php'>
<script type=\"text/javascript\">
alert(\"Password dont match.\");
</script>";
}
}else{
echo "
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=login.php'>
<script type=\"text/javascript\">
alert(\"User and password dont match.\");
</script>";
}
?> | php | mysql | null | null | null | null | open | check login credentials
===
i have a login form that when i get to the page it gives me automatacally the alert message, and i didnt put yet the user and password info when i go to the page, the message that gives me is "User and password dont match". Here is the page that makes the verification of the login form, hope for someone see what is wrong:
<?
session_start();
include "config.php";
if(isset($_SESSION["login_user"]) AND isset($_SESSION['pass_user'])){
$login_user = $_SESSION["login_user"];
$pass_user = $_SESSION["pass_user"];
$sql = mysql_query("SELECT * FROM adm WHERE login = '$login_user'");
$cont = mysql_num_rows($sql);
while($linha = mysql_fetch_array($sql)){
$pass_db = $linha['pass'];
}
if($cont == 0){
unset($_SESSION["login_user"]);
unset($_SESSION["pass_user"]);
echo "
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=login.php'>
<script type=\"text/javascript\">
alert(\"Name of user dont match.\");
</script>";
}
if($pass_db != $pass_user){//check pass
unset($_SESSION["login_user"]);
unset($_SESSION["pass_user"]);
echo "
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=login.php'>
<script type=\"text/javascript\">
alert(\"Password dont match.\");
</script>";
}
}else{
echo "
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=login.php'>
<script type=\"text/javascript\">
alert(\"User and password dont match.\");
</script>";
}
?> | 0 |
11,410,859 | 07/10/2012 09:59:41 | 134,966 | 07/08/2009 13:59:48 | 127 | 5 | how to determine whether C# class depends on environment | I'm trying to find heuristics for determining whether a given C# class has a dependency on the runtime environment. One idea so far: Is it disposable?.
Any other ideas? :) | c# | null | null | null | null | 07/10/2012 13:30:58 | not a real question | how to determine whether C# class depends on environment
===
I'm trying to find heuristics for determining whether a given C# class has a dependency on the runtime environment. One idea so far: Is it disposable?.
Any other ideas? :) | 1 |
11,567,883 | 07/19/2012 19:24:49 | 1,536,000 | 07/18/2012 20:09:41 | 5 | 2 | How to Align text horizontally inside VB.Net Combo Box | I cannot find a property that would allow me to align text inside vb.net combo box. Text Boxes have TextAlign Property, but Combo Box does not have that. Is there another property that is used by Combo Box? Or is there another way to do it?
Thanks | vb.net | combobox | null | null | null | null | open | How to Align text horizontally inside VB.Net Combo Box
===
I cannot find a property that would allow me to align text inside vb.net combo box. Text Boxes have TextAlign Property, but Combo Box does not have that. Is there another property that is used by Combo Box? Or is there another way to do it?
Thanks | 0 |
11,567,885 | 07/19/2012 19:24:53 | 1,408,762 | 05/21/2012 20:30:53 | 22 | 0 | How do I launch CKeditor plugin on event or manually? | So I'm using setData to prepopulate CKeditor content area with some info that is to be send together with what user inputs:
CKEDITOR.on( 'instanceReady', function( ev ) {
CKEDITOR.instances.ckeditor99.setData( messageTemplate1, function() {
this.checkDirty(); // true
});
});
Before the content in "mesageTemplate1" is set to CKeditor content area I apply some JavaScript to clean it. After this I use JS again to remove the div that contained the information that i've just inserted into CKeditor content area. After the removal I want to laucn a custom CKeditor plugin to work on that content in CKeditor. It is important for this plugin to be launched after the used div removal because plugin targets ID's and if both divs are present (somewhere on the page and in ckeditor) plugin targets the one that is not in the CKeditor content area first therefor leaving the one in the ck area untouched.
This is the plugin (it blocks editing to certain content areas) I've got from a member of stack in my previous question:
/*
Plugin that prevents editing of elements with the "non-editable" class as well as elements outside of blocks with "editable" class.
*/
//* ************************** NOTES *************************** NOTES ****************************
/*
The "lastSelectedElement" variable is used to store the last element selected.
This plugin uses the "elementspath" plugin which shows all elements in the DOM
parent tree relative to the current selection in the editing area.
When the selection changes, "elementsPathUpdate" is fired,
we key on this and loop through the elements in the tree checking the classes assigned to each element.
Three outcomes are possible.
1) The non-editable class is found:
Looping stops, the current action is cancelled and the cursor is moved to the previous selection.
The "selectionChange" hook is fired to set the reverted selection throughout the instance.
2) The editable class is found during looping, the "in_editable_area" flag is set to true.
3) Neither the editable or the non-editable classes are found (user clicked outside your main container).
The "in_editable_area" flag remains set to false.
If the "in_editable_area" flag is false, the current action is cancelled and the cursor is moved to the previous location.
The "selectionChange" hook is fired to set the reverted selection throughout the instance.
If the "in_editable_area" flag is true,
the "lastSelectedElement" is updated to the currently selected element and the plugin returns true.
---------------
If you don't want the elements path to be displayed at the bottom of the editor window,
you can hide it with CSS rather than disabling the "elementspath" plugin.
The elementspath plugin creates and is left active because we are keying on changes to the path in our plugin.
#cke_path_content
{
visibility: hidden !important;
}
---------------
CSS Classes and ID that the plugin keys on. Use defaults or update variables to use your preferred classes and ID:
var starting_element_id = ID of known editable element that always occurs in the instance.
Don't use elements like <table>, <tr>, <br /> that don't contain HTML text.
Default value = cwjdsjcs_editable_id
var editable_class = class of editable containers.
Should be applied to all top level elements that contain editable elements.
Default = cwjdsjcs_editable
var non_editable_class = class of non-editable elements within editable containers
Apply to elements where all child elements are non-editable.
Default = cwjdsjcs_not_editable
*/
//* ************************** END NOTES *************************** END NOTES ****************************
// Register the plugin with the editor.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.plugins.html
CKEDITOR.plugins.add( 'cwjdsjcsconfineselection',
{
requires : [ 'elementspath' ],
// The plugin initialization logic goes inside this method.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.pluginDefinition.html#init
init: function( editor )
{
editor.on( 'instanceReady', function( instance_ready_data )
{
// Create variable that will hold the last allowed selection (for use when a non-editable selection is made)
var lastSelectedElement;
editor.cwjdsjcs_just_updated = false;
// This section starts things off right by selecting a known editable element.
// *** Enter the ID of the element that should have initial focus *** IMPORTANT *** IMPORTANT ***
var starting_element_id = "cwjdsjcs_editable_id";
var resInitialRange = new CKEDITOR.dom.range( editor.document );
resInitialRange.selectNodeContents( editor.document.getById( starting_element_id ) );
resInitialRange.collapse();
var selectionObject = new CKEDITOR.dom.selection( editor.document );
editor.document.focus();
selectionObject.selectRanges( [ resInitialRange ] );
var sel = editor.getSelection();
var firstElement = sel.getStartElement();
var currentPath = new CKEDITOR.dom.elementPath( firstElement );
// Set path for known editable element, fire "selectionChange" hook to update selection throughout instance.
editor._.selectionPreviousPath = currentPath;
editor.fire( 'selectionChange', { selection : sel, path : currentPath, element : firstElement } );
}); // *** END - editor.on( 'instanceReady', function( e )
// When a new element is selected by the user, check if it's ok for them to edit it,
// if not move cursor back to last know editable selection
editor.on( 'elementsPathUpdate', function( resPath )
{
// When we fire the "selectionChange" hook at the end of this code block, the "elementsPathUpdate" hook fires.
// No need to check because we just updated the selection, so bypass processing.
if( editor.cwjdsjcs_just_updated == true )
{
editor.cwjdsjcs_just_updated = false;
return true;
}
var elementsList = editor._.elementsPath.list;
var in_editable_area = false;
var non_editable_class = "cwjdsjcs_not_editable";
var editable_class = "cwjdsjcs_editable";
for(var w=0;w<elementsList.length;w++){
var currentElement = elementsList[w];
// Sometimes a non content element is selected, catch them and return selection to editable area.
if(w == 0)
{
// Could change to switch.
if( currentElement.getName() == "tbody" )
{
in_editable_area = false;
break;
}
if( currentElement.getName() == "tr" )
{
in_editable_area = false;
break;
}
}
// If selection is inside a non-editable element, break from loop and reset selection.
if( currentElement.hasClass(non_editable_class) )
{
in_editable_area = false;
break;
}
if( currentElement.hasClass(editable_class) ) {
in_editable_area = true;
}
console.log(currentElement);
console.log(currentElement.getName());
}
// if selection is within an editable element, exit the plugin, otherwise reset selection.
if( in_editable_area ) {
lastSelectedElement = elementsList[0];
return true;
}
var resRange = new CKEDITOR.dom.range( editor.document );
resRange.selectNodeContents( lastSelectedElement );
resRange.collapse();
editor.getSelection().selectRanges( [ resRange ] );
//resRange.endContainer.$.scrollIntoView();
// Open dialog window:
// It tells user they selected a non-editable area and cursor has been returned to previous selection
currentEditorName = editor.name;
openResDefaultDialog(currentEditorName);
try
{
var sel = editor.getSelection();
var firstElement = sel.getStartElement();
var currentPath = new CKEDITOR.dom.elementPath( firstElement );
editor.cwjdsjcs_just_updated = true;
editor._.selectionPreviousPath = currentPath;
editor.fire( 'selectionChange', { selection : sel, path : currentPath, element : firstElement } );
}
catch (e)
{}
});
} // *** END - init: function( editor )
}); // ************************************************************************************* END - CKEDITOR.plugins.add
This is the div that is being set to CKeditor content area:
<table id="messageTemplate1" class="message cwjdsjcs_editable">
<tbody>
<tr>
<td class="cwjdsjcs_not_editable" contenteditable="false">
</td>
<td id="cwjdsjcs_editable_id">
</td>
</tr>
<tr class="cwjdsjcs_not_editable" contenteditable="false">
<td colspan="2">
<!-- Begin Original Content -->
<table class="hide" style="font-size: 12px; display:none;">
<tbody>
<tr class="hide">
<td>
Application sent by <strong><a href="http://www.globalcastingcenter.com/talent/jack-bolton">Matt Faro</a></strong> for Audition: <a href="http://www.globalcastingcenter.com:80/CustomContentRetrieve.aspx?ID=4185493">Actors Needed</a>
</td>
</tr>
<tr class="hide">
<td>
Reply to applicant directly: [email protected] or visit full profile: http://www.globalcastingcenter.com/talent/jack-bolton
</td>
</tr>
</tbody>
</table>
<table class="hide" style="font-size: 12px; display:none;">
<tbody>
<tr class="hide">
<td><strong>Short Profile Summary:</strong></td>
</tr>
</tbody>
</table>
<table class="hide" style="font-size: 12px; display:none;">
<tbody>
<tr class="hide">
<td>
<a href="http://www.globalcastingcenter.com/talent/jack-bolton"><img alt="" src="http://globalcastingcenter.com/talent_images/4164035_258551_foto.png?Action=thumbnail&Width=144&Height=215" /></a>
</td>
</tr>
</tbody>
</table>
<table style="font-size: 12px; display:none;" class="hide">
<tbody>
<tr class="hide">
<td><strong>Areas:</strong></td>
<td>Actor,Extra</td>
</tr>
<tr class="hide">
<td><strong>Country:</strong></td>
<td>WORLDWIDE,Any</td>
</tr>
<tr class="hide">
<td><strong>Age:</strong></td>
<td>26</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
I've pasted a lot of stuff here but it all boils down to the question if and how I can launch ckeditor plugin manually or best after the removal event is completed. I also do ask if theres any more reasonable solution to my problem. Maybe plugin launching timing is not the case.
Thanks | javascript | plugins | event-handling | callback | ckeditor | null | open | How do I launch CKeditor plugin on event or manually?
===
So I'm using setData to prepopulate CKeditor content area with some info that is to be send together with what user inputs:
CKEDITOR.on( 'instanceReady', function( ev ) {
CKEDITOR.instances.ckeditor99.setData( messageTemplate1, function() {
this.checkDirty(); // true
});
});
Before the content in "mesageTemplate1" is set to CKeditor content area I apply some JavaScript to clean it. After this I use JS again to remove the div that contained the information that i've just inserted into CKeditor content area. After the removal I want to laucn a custom CKeditor plugin to work on that content in CKeditor. It is important for this plugin to be launched after the used div removal because plugin targets ID's and if both divs are present (somewhere on the page and in ckeditor) plugin targets the one that is not in the CKeditor content area first therefor leaving the one in the ck area untouched.
This is the plugin (it blocks editing to certain content areas) I've got from a member of stack in my previous question:
/*
Plugin that prevents editing of elements with the "non-editable" class as well as elements outside of blocks with "editable" class.
*/
//* ************************** NOTES *************************** NOTES ****************************
/*
The "lastSelectedElement" variable is used to store the last element selected.
This plugin uses the "elementspath" plugin which shows all elements in the DOM
parent tree relative to the current selection in the editing area.
When the selection changes, "elementsPathUpdate" is fired,
we key on this and loop through the elements in the tree checking the classes assigned to each element.
Three outcomes are possible.
1) The non-editable class is found:
Looping stops, the current action is cancelled and the cursor is moved to the previous selection.
The "selectionChange" hook is fired to set the reverted selection throughout the instance.
2) The editable class is found during looping, the "in_editable_area" flag is set to true.
3) Neither the editable or the non-editable classes are found (user clicked outside your main container).
The "in_editable_area" flag remains set to false.
If the "in_editable_area" flag is false, the current action is cancelled and the cursor is moved to the previous location.
The "selectionChange" hook is fired to set the reverted selection throughout the instance.
If the "in_editable_area" flag is true,
the "lastSelectedElement" is updated to the currently selected element and the plugin returns true.
---------------
If you don't want the elements path to be displayed at the bottom of the editor window,
you can hide it with CSS rather than disabling the "elementspath" plugin.
The elementspath plugin creates and is left active because we are keying on changes to the path in our plugin.
#cke_path_content
{
visibility: hidden !important;
}
---------------
CSS Classes and ID that the plugin keys on. Use defaults or update variables to use your preferred classes and ID:
var starting_element_id = ID of known editable element that always occurs in the instance.
Don't use elements like <table>, <tr>, <br /> that don't contain HTML text.
Default value = cwjdsjcs_editable_id
var editable_class = class of editable containers.
Should be applied to all top level elements that contain editable elements.
Default = cwjdsjcs_editable
var non_editable_class = class of non-editable elements within editable containers
Apply to elements where all child elements are non-editable.
Default = cwjdsjcs_not_editable
*/
//* ************************** END NOTES *************************** END NOTES ****************************
// Register the plugin with the editor.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.plugins.html
CKEDITOR.plugins.add( 'cwjdsjcsconfineselection',
{
requires : [ 'elementspath' ],
// The plugin initialization logic goes inside this method.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.pluginDefinition.html#init
init: function( editor )
{
editor.on( 'instanceReady', function( instance_ready_data )
{
// Create variable that will hold the last allowed selection (for use when a non-editable selection is made)
var lastSelectedElement;
editor.cwjdsjcs_just_updated = false;
// This section starts things off right by selecting a known editable element.
// *** Enter the ID of the element that should have initial focus *** IMPORTANT *** IMPORTANT ***
var starting_element_id = "cwjdsjcs_editable_id";
var resInitialRange = new CKEDITOR.dom.range( editor.document );
resInitialRange.selectNodeContents( editor.document.getById( starting_element_id ) );
resInitialRange.collapse();
var selectionObject = new CKEDITOR.dom.selection( editor.document );
editor.document.focus();
selectionObject.selectRanges( [ resInitialRange ] );
var sel = editor.getSelection();
var firstElement = sel.getStartElement();
var currentPath = new CKEDITOR.dom.elementPath( firstElement );
// Set path for known editable element, fire "selectionChange" hook to update selection throughout instance.
editor._.selectionPreviousPath = currentPath;
editor.fire( 'selectionChange', { selection : sel, path : currentPath, element : firstElement } );
}); // *** END - editor.on( 'instanceReady', function( e )
// When a new element is selected by the user, check if it's ok for them to edit it,
// if not move cursor back to last know editable selection
editor.on( 'elementsPathUpdate', function( resPath )
{
// When we fire the "selectionChange" hook at the end of this code block, the "elementsPathUpdate" hook fires.
// No need to check because we just updated the selection, so bypass processing.
if( editor.cwjdsjcs_just_updated == true )
{
editor.cwjdsjcs_just_updated = false;
return true;
}
var elementsList = editor._.elementsPath.list;
var in_editable_area = false;
var non_editable_class = "cwjdsjcs_not_editable";
var editable_class = "cwjdsjcs_editable";
for(var w=0;w<elementsList.length;w++){
var currentElement = elementsList[w];
// Sometimes a non content element is selected, catch them and return selection to editable area.
if(w == 0)
{
// Could change to switch.
if( currentElement.getName() == "tbody" )
{
in_editable_area = false;
break;
}
if( currentElement.getName() == "tr" )
{
in_editable_area = false;
break;
}
}
// If selection is inside a non-editable element, break from loop and reset selection.
if( currentElement.hasClass(non_editable_class) )
{
in_editable_area = false;
break;
}
if( currentElement.hasClass(editable_class) ) {
in_editable_area = true;
}
console.log(currentElement);
console.log(currentElement.getName());
}
// if selection is within an editable element, exit the plugin, otherwise reset selection.
if( in_editable_area ) {
lastSelectedElement = elementsList[0];
return true;
}
var resRange = new CKEDITOR.dom.range( editor.document );
resRange.selectNodeContents( lastSelectedElement );
resRange.collapse();
editor.getSelection().selectRanges( [ resRange ] );
//resRange.endContainer.$.scrollIntoView();
// Open dialog window:
// It tells user they selected a non-editable area and cursor has been returned to previous selection
currentEditorName = editor.name;
openResDefaultDialog(currentEditorName);
try
{
var sel = editor.getSelection();
var firstElement = sel.getStartElement();
var currentPath = new CKEDITOR.dom.elementPath( firstElement );
editor.cwjdsjcs_just_updated = true;
editor._.selectionPreviousPath = currentPath;
editor.fire( 'selectionChange', { selection : sel, path : currentPath, element : firstElement } );
}
catch (e)
{}
});
} // *** END - init: function( editor )
}); // ************************************************************************************* END - CKEDITOR.plugins.add
This is the div that is being set to CKeditor content area:
<table id="messageTemplate1" class="message cwjdsjcs_editable">
<tbody>
<tr>
<td class="cwjdsjcs_not_editable" contenteditable="false">
</td>
<td id="cwjdsjcs_editable_id">
</td>
</tr>
<tr class="cwjdsjcs_not_editable" contenteditable="false">
<td colspan="2">
<!-- Begin Original Content -->
<table class="hide" style="font-size: 12px; display:none;">
<tbody>
<tr class="hide">
<td>
Application sent by <strong><a href="http://www.globalcastingcenter.com/talent/jack-bolton">Matt Faro</a></strong> for Audition: <a href="http://www.globalcastingcenter.com:80/CustomContentRetrieve.aspx?ID=4185493">Actors Needed</a>
</td>
</tr>
<tr class="hide">
<td>
Reply to applicant directly: [email protected] or visit full profile: http://www.globalcastingcenter.com/talent/jack-bolton
</td>
</tr>
</tbody>
</table>
<table class="hide" style="font-size: 12px; display:none;">
<tbody>
<tr class="hide">
<td><strong>Short Profile Summary:</strong></td>
</tr>
</tbody>
</table>
<table class="hide" style="font-size: 12px; display:none;">
<tbody>
<tr class="hide">
<td>
<a href="http://www.globalcastingcenter.com/talent/jack-bolton"><img alt="" src="http://globalcastingcenter.com/talent_images/4164035_258551_foto.png?Action=thumbnail&Width=144&Height=215" /></a>
</td>
</tr>
</tbody>
</table>
<table style="font-size: 12px; display:none;" class="hide">
<tbody>
<tr class="hide">
<td><strong>Areas:</strong></td>
<td>Actor,Extra</td>
</tr>
<tr class="hide">
<td><strong>Country:</strong></td>
<td>WORLDWIDE,Any</td>
</tr>
<tr class="hide">
<td><strong>Age:</strong></td>
<td>26</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
I've pasted a lot of stuff here but it all boils down to the question if and how I can launch ckeditor plugin manually or best after the removal event is completed. I also do ask if theres any more reasonable solution to my problem. Maybe plugin launching timing is not the case.
Thanks | 0 |
11,567,880 | 07/19/2012 19:24:43 | 731,755 | 04/29/2011 20:44:02 | 107 | 2 | Oracle Daily count/average over a year | I'm pulling two pieces of information over a specific time period, but I would like to fetch the daily average of one tag and the daily count of another tag. I'm not sure how to do daily averages over a specific time period, can anyone provide some advice? Below were my first ideas on how to handle this however to change every date would be annoying. Any help is appreciated thanks
SELECT COUNT(distinct chargeno), to_char(chargetime, 'mmddyyyy') AS chargeend
FROM batch_index WHERE plant=1 AND chargetime>to_date('2012-06-18:00:00:00','yyyy-mm-dd:hh24:mi:ss')
AND chargetime<to_date('2012-07-19:00:00:00','yyyy-mm-dd:hh24:mi:ss')
group by chargetime;
---
SELECT SUM(cv.val)*0.0005 FROM Charge_Value cv, batch_index bi WHERE cv.ValueID =97
AND bi.chargetime >=to_date('2012-07-18:00:00:00','yyyy-mm-dd:hh24:mi:ss')
AND bi.chargetime<=to_date('2012-07-19:00:00:00','yyyy-mm-dd:hh24:mi:ss')
AND bi.chargeno = cv.chargeno AND bi.typ=1
| oracle | query | count | average | null | null | open | Oracle Daily count/average over a year
===
I'm pulling two pieces of information over a specific time period, but I would like to fetch the daily average of one tag and the daily count of another tag. I'm not sure how to do daily averages over a specific time period, can anyone provide some advice? Below were my first ideas on how to handle this however to change every date would be annoying. Any help is appreciated thanks
SELECT COUNT(distinct chargeno), to_char(chargetime, 'mmddyyyy') AS chargeend
FROM batch_index WHERE plant=1 AND chargetime>to_date('2012-06-18:00:00:00','yyyy-mm-dd:hh24:mi:ss')
AND chargetime<to_date('2012-07-19:00:00:00','yyyy-mm-dd:hh24:mi:ss')
group by chargetime;
---
SELECT SUM(cv.val)*0.0005 FROM Charge_Value cv, batch_index bi WHERE cv.ValueID =97
AND bi.chargetime >=to_date('2012-07-18:00:00:00','yyyy-mm-dd:hh24:mi:ss')
AND bi.chargetime<=to_date('2012-07-19:00:00:00','yyyy-mm-dd:hh24:mi:ss')
AND bi.chargeno = cv.chargeno AND bi.typ=1
| 0 |
11,567,887 | 07/19/2012 19:25:06 | 1,185,432 | 02/02/2012 15:05:28 | 157 | 17 | Advanced JMS redelivery in WebLogic 12c | I've played with WebLogic 12c server trying to figure out how to configure JMS redelivery feature today. I had found two interesting parameters in console: `Redelivery Delay Override` and `Redelivery Limit` in the `Delivery failure` section from queue properties. This parameters works great, but this is not everything what I want. It would be great to set this parameters from a sender application (different values for different cases). In Oracle documentation I've read that parameters from console overrides similar message properties that were set by a sender. Obviously, there should be two properties responsible for redelivery limit and redelivery delay that I can set for message. Then I've discovered that I can send JMS messages from WebLogic server console and it allowed me to set the `Redelivery Limit` property, which lead to additional `JMS_BEA_RedeliveryLimit` property was added to message. I've tried to add this property from my message sender java application and it worked nice. But currently I can not figure out what property I should use to set redelivery delay. Did I miss something obvious? Also WebLogic server use linear delay algorithm which is not ideal for us. I want to know if I can somehow customise this algorithm and make it exponential, for example.
Thanks in advance. | java | java-ee | jms | weblogic | weblogic12c | null | open | Advanced JMS redelivery in WebLogic 12c
===
I've played with WebLogic 12c server trying to figure out how to configure JMS redelivery feature today. I had found two interesting parameters in console: `Redelivery Delay Override` and `Redelivery Limit` in the `Delivery failure` section from queue properties. This parameters works great, but this is not everything what I want. It would be great to set this parameters from a sender application (different values for different cases). In Oracle documentation I've read that parameters from console overrides similar message properties that were set by a sender. Obviously, there should be two properties responsible for redelivery limit and redelivery delay that I can set for message. Then I've discovered that I can send JMS messages from WebLogic server console and it allowed me to set the `Redelivery Limit` property, which lead to additional `JMS_BEA_RedeliveryLimit` property was added to message. I've tried to add this property from my message sender java application and it worked nice. But currently I can not figure out what property I should use to set redelivery delay. Did I miss something obvious? Also WebLogic server use linear delay algorithm which is not ideal for us. I want to know if I can somehow customise this algorithm and make it exponential, for example.
Thanks in advance. | 0 |
11,567,895 | 07/19/2012 19:25:24 | 1,538,863 | 07/19/2012 18:59:28 | 1 | 0 | Async WCF Service with multiple async calls inside | I have a web service in WCF that consume some external web services, so what I want to do is make this service asynchronous in order to release the thread, wait for the completion of all the external services, and then return the result to the client.
#With Framework 4.0#
public class MyService : IMyService
{
public IAsyncResult BeginDoWork(int count, AsyncCallback callback, object serviceState)
{
var proxyOne = new Gateway.BackendOperation.BackendOperationOneSoapClient();
var proxyTwo = new Gateway.BackendOperationTwo.OperationTwoSoapClient();
var taskOne = Task<int>.Factory.FromAsync(proxyOne.BeginGetNumber, proxyOne.EndGetNumber, 10, serviceState);
var taskTwo = Task<int>.Factory.FromAsync(proxyTwo.BeginGetNumber, proxyTwo.EndGetNumber, 10, serviceState);
var tasks = new Queue<Task<int>>();
tasks.Enqueue(taskOne);
tasks.Enqueue(taskTwo);
return Task.Factory.ContinueWhenAll(tasks.ToArray(), innerTasks =>
{
var tcs = new TaskCompletionSource<int>(serviceState);
int sum = 0;
foreach (var innerTask in innerTasks)
{
if (innerTask.IsFaulted)
{
tcs.SetException(innerTask.Exception);
callback(tcs.Task);
return;
}
if (innerTask.IsCompleted)
{
sum = innerTask.Result;
}
}
tcs.SetResult(sum);
callback(tcs.Task);
});
}
public int EndDoWork(IAsyncResult result)
{
try
{
return ((Task<int>)result).Result;
}
catch (AggregateException ex)
{
throw ex.InnerException;
}
}
}
My questions here are:
1. This code is using three threads: one that is instanced in the
BeginDoWork, another one that is instanced when the code enter
inside the anonymous method ContinueWhenAll, and the last one when
the callback is executed, in this case EndDoWork. Is that correct or
I’m doing something wrong on the calls? Should I use any
synchronization context? Note: The synchronization context is null
on the main thread.
2. What happen if I “share” information between
threads, for instance, the callback function? Will that cause a
performance issue or the anonymous method is like a closure where I
can share data?
#With Framework 4.5 and Async and Await#
Now with Framework 4.5, the code seems too much simple than before:
public async Task<int> DoWorkAsync(int count)
{
var proxyOne = new Backend.ServiceOne.ServiceOneClient();
var proxyTwo = new Backend.ServiceTwo.ServiceTwoClient();
var doWorkOne = proxyOne.DoWorkAsync(count);
var doWorkTwo = proxyTwo.DoWorkAsync(count);
var result = await Task.WhenAll(doWorkOne, doWorkTwo);
return doWorkOne.Result + doWorkTwo.Result;
}
But in this case when I debug the application, I always see that the code is executed on the same thread. So my questions here are:
3.. When I’m waiting for the “awaitable” code, is that thread released and goes back to the thread pool to execute more requests?
3.1. If So, I suppose that when I get a result from the await Task, the execution completes on the same thread that the call before. Is that possible? What happen if that thread is processing another request?
3.2 If Not, how can I release the thread to send it back to the thread pool with Asycn and Await pattern?
Thank you! | wcf | asynchronous | task-parallel-library | async-await | null | null | open | Async WCF Service with multiple async calls inside
===
I have a web service in WCF that consume some external web services, so what I want to do is make this service asynchronous in order to release the thread, wait for the completion of all the external services, and then return the result to the client.
#With Framework 4.0#
public class MyService : IMyService
{
public IAsyncResult BeginDoWork(int count, AsyncCallback callback, object serviceState)
{
var proxyOne = new Gateway.BackendOperation.BackendOperationOneSoapClient();
var proxyTwo = new Gateway.BackendOperationTwo.OperationTwoSoapClient();
var taskOne = Task<int>.Factory.FromAsync(proxyOne.BeginGetNumber, proxyOne.EndGetNumber, 10, serviceState);
var taskTwo = Task<int>.Factory.FromAsync(proxyTwo.BeginGetNumber, proxyTwo.EndGetNumber, 10, serviceState);
var tasks = new Queue<Task<int>>();
tasks.Enqueue(taskOne);
tasks.Enqueue(taskTwo);
return Task.Factory.ContinueWhenAll(tasks.ToArray(), innerTasks =>
{
var tcs = new TaskCompletionSource<int>(serviceState);
int sum = 0;
foreach (var innerTask in innerTasks)
{
if (innerTask.IsFaulted)
{
tcs.SetException(innerTask.Exception);
callback(tcs.Task);
return;
}
if (innerTask.IsCompleted)
{
sum = innerTask.Result;
}
}
tcs.SetResult(sum);
callback(tcs.Task);
});
}
public int EndDoWork(IAsyncResult result)
{
try
{
return ((Task<int>)result).Result;
}
catch (AggregateException ex)
{
throw ex.InnerException;
}
}
}
My questions here are:
1. This code is using three threads: one that is instanced in the
BeginDoWork, another one that is instanced when the code enter
inside the anonymous method ContinueWhenAll, and the last one when
the callback is executed, in this case EndDoWork. Is that correct or
I’m doing something wrong on the calls? Should I use any
synchronization context? Note: The synchronization context is null
on the main thread.
2. What happen if I “share” information between
threads, for instance, the callback function? Will that cause a
performance issue or the anonymous method is like a closure where I
can share data?
#With Framework 4.5 and Async and Await#
Now with Framework 4.5, the code seems too much simple than before:
public async Task<int> DoWorkAsync(int count)
{
var proxyOne = new Backend.ServiceOne.ServiceOneClient();
var proxyTwo = new Backend.ServiceTwo.ServiceTwoClient();
var doWorkOne = proxyOne.DoWorkAsync(count);
var doWorkTwo = proxyTwo.DoWorkAsync(count);
var result = await Task.WhenAll(doWorkOne, doWorkTwo);
return doWorkOne.Result + doWorkTwo.Result;
}
But in this case when I debug the application, I always see that the code is executed on the same thread. So my questions here are:
3.. When I’m waiting for the “awaitable” code, is that thread released and goes back to the thread pool to execute more requests?
3.1. If So, I suppose that when I get a result from the await Task, the execution completes on the same thread that the call before. Is that possible? What happen if that thread is processing another request?
3.2 If Not, how can I release the thread to send it back to the thread pool with Asycn and Await pattern?
Thank you! | 0 |
11,693,219 | 07/27/2012 18:02:57 | 110,426 | 05/21/2009 09:57:58 | 173 | 9 | Macro expanssion and stringification: How to get the marco name ( not its value ) stringified using another macro? | Out of interest:
Please go through
#define _ACD 5, 5, 5, 30
#define DEFAULT_NETWORK_TOKEN_KEY_CLASS _ACD
#define DEFAULT_NETWORK_TOKEN_KEY { DEFAULT_NETWORK_TOKEN_KEY_CLASS }
Using DEFAULT_NETWORK_TOKEN_KEY_CLASS macro only, how to get _ACD stringified in a const unsigned char [].
const uint8 startMsg[] = ?? DEFAULT_NETWORK_TOKEN_KEY_CLASS ;
What will be the correct macro expansion for getting _ACD here.
In context of http://stackoverflow.com/questions/11689825/how-to-stringify-macro-having-array-as-define-a-macro-5-7-7-97 | c | macros | null | null | null | null | open | Macro expanssion and stringification: How to get the marco name ( not its value ) stringified using another macro?
===
Out of interest:
Please go through
#define _ACD 5, 5, 5, 30
#define DEFAULT_NETWORK_TOKEN_KEY_CLASS _ACD
#define DEFAULT_NETWORK_TOKEN_KEY { DEFAULT_NETWORK_TOKEN_KEY_CLASS }
Using DEFAULT_NETWORK_TOKEN_KEY_CLASS macro only, how to get _ACD stringified in a const unsigned char [].
const uint8 startMsg[] = ?? DEFAULT_NETWORK_TOKEN_KEY_CLASS ;
What will be the correct macro expansion for getting _ACD here.
In context of http://stackoverflow.com/questions/11689825/how-to-stringify-macro-having-array-as-define-a-macro-5-7-7-97 | 0 |
11,693,220 | 07/27/2012 18:02:59 | 367,543 | 06/15/2010 17:45:32 | 773 | 30 | Techniques to update a postgresql database | The goal is to build a concise SQL script to alter/update tables since changes have been made to the schema between any two points in time.
For example, I develop on one machine and on Day "A" I used the dump & restore utilities to install a database on a production machine. Then on Day "B" after making some changes on my development machine and testing them, I need to get those changes to my schema onto my production server.
Short of writing every single command I make to my schema (some of which may be experimental and undone), what is a good way to manage upgrading a schema from point A to point B (or point B to point F for that matter)?
| postgresql | null | null | null | null | null | open | Techniques to update a postgresql database
===
The goal is to build a concise SQL script to alter/update tables since changes have been made to the schema between any two points in time.
For example, I develop on one machine and on Day "A" I used the dump & restore utilities to install a database on a production machine. Then on Day "B" after making some changes on my development machine and testing them, I need to get those changes to my schema onto my production server.
Short of writing every single command I make to my schema (some of which may be experimental and undone), what is a good way to manage upgrading a schema from point A to point B (or point B to point F for that matter)?
| 0 |
11,693,224 | 07/27/2012 18:03:13 | 1,529,005 | 07/16/2012 13:17:50 | 74 | 0 | How to sum matrix which had been already rearranged | I have some matrix :
A = [ 1 2 3 4 5 6;
1 2 3 4 5 6]
B = [ 6 5 4 3 2 1;
6 5 4 3 2 1]
C = [ 1 2 3 4 5 6;
1 2 3 4 5 6]
what is code to make this following matrix:
Result = [1 2 9 9 10 11 5 5 5 6;
1 2 9 9 10 11 5 5 5 6]
Note : Actually the above matrix is sum of 3 matrix above which had been already rearranged like as the following matrix. #sum is sum which is based on column.
1 2 3 4 5 6
1 2 3 4 5 6
6 5 4 3 2 1
6 5 4 3 2 1
1 2 3 4 5 6
1 2 3 4 5 6
And. I sum first row by first row, and second row by second row.
| matlab | null | null | null | null | null | open | How to sum matrix which had been already rearranged
===
I have some matrix :
A = [ 1 2 3 4 5 6;
1 2 3 4 5 6]
B = [ 6 5 4 3 2 1;
6 5 4 3 2 1]
C = [ 1 2 3 4 5 6;
1 2 3 4 5 6]
what is code to make this following matrix:
Result = [1 2 9 9 10 11 5 5 5 6;
1 2 9 9 10 11 5 5 5 6]
Note : Actually the above matrix is sum of 3 matrix above which had been already rearranged like as the following matrix. #sum is sum which is based on column.
1 2 3 4 5 6
1 2 3 4 5 6
6 5 4 3 2 1
6 5 4 3 2 1
1 2 3 4 5 6
1 2 3 4 5 6
And. I sum first row by first row, and second row by second row.
| 0 |
11,693,225 | 07/27/2012 18:03:15 | 447,607 | 09/14/2010 17:19:50 | 46 | 5 | Simple teradata stored procedure | The web seems a bit short on working examples for something that should be quite common. A plain Jane example of "Get me some records". This is my first ever Stored proc and all I want is to see some records. Why is that so flipping hard? ;-) I figure that if I can get one example that works, I can tune it from there into something I can really use. This is taken from another example I found on the web. Doesn't compile because CURSOR declaration is a syntax error of some sort.
CREATE PROCEDURE "SCHEMA"."GETRESULTSET (
IN "p1" VARCHAR(30))
DYNAMIC RESULT SETS 1
BEGIN
DECLARE CURSOR cur1 WITH RETURN ONLY TO CLIENT FOR
SELECT partitioninfo FROM SCHEMA.SessionInfo where username = p1;
OPEN cur1;
END;
Anyway, sure could use a clue. I saw an example where the CURSOR was declared separately from the SQL but then there wasn't an example that showed how to get the variable into the SQL when it was declared as a VARCHAR. The example I am working off of was pretty old but it's the best I could find. | stored-procedures | resultset | cursors | teradata | null | null | open | Simple teradata stored procedure
===
The web seems a bit short on working examples for something that should be quite common. A plain Jane example of "Get me some records". This is my first ever Stored proc and all I want is to see some records. Why is that so flipping hard? ;-) I figure that if I can get one example that works, I can tune it from there into something I can really use. This is taken from another example I found on the web. Doesn't compile because CURSOR declaration is a syntax error of some sort.
CREATE PROCEDURE "SCHEMA"."GETRESULTSET (
IN "p1" VARCHAR(30))
DYNAMIC RESULT SETS 1
BEGIN
DECLARE CURSOR cur1 WITH RETURN ONLY TO CLIENT FOR
SELECT partitioninfo FROM SCHEMA.SessionInfo where username = p1;
OPEN cur1;
END;
Anyway, sure could use a clue. I saw an example where the CURSOR was declared separately from the SQL but then there wasn't an example that showed how to get the variable into the SQL when it was declared as a VARCHAR. The example I am working off of was pretty old but it's the best I could find. | 0 |
11,693,226 | 07/27/2012 18:03:19 | 67,153 | 02/16/2009 23:43:45 | 11,844 | 510 | prevent caching when pressing BACK buttons | When u press back in CHROME, it seems it caches the source code (as opposed to the DOM in FF, but that is just observation, not some thing I know).
Some times I need to prevent such caching, for example when u r in a checkout process, redirects to paypal etc...
How do I do it? | http | caching | web | browser-history | null | null | open | prevent caching when pressing BACK buttons
===
When u press back in CHROME, it seems it caches the source code (as opposed to the DOM in FF, but that is just observation, not some thing I know).
Some times I need to prevent such caching, for example when u r in a checkout process, redirects to paypal etc...
How do I do it? | 0 |
11,693,235 | 07/27/2012 18:03:38 | 80,002 | 03/19/2009 12:22:39 | 3,573 | 36 | Java: Using java.util.concurrent to process files in a directory in parallel | I am trying to figure out how to use the types from the `java.util.concurrent` package to parallelize processing of all the files in a directory.
I am familiar with the multiprocessing package in Python, which is very simple to use, so ideally I am looking for something similar:
public interface FictionalFunctor<T>{
void handle(T arg);
}
public class FictionalThreadPool {
public FictionalThreadPool(int threadCount){
...
}
public <T> FictionalThreadPoolMapResult<T> map(FictionalFunctor<T> functor, List<T> args){
// Executes the given functor on each and every arg from args in parallel. Returns, when
// all the parallel branches return.
// FictionalThreadPoolMapResult allows to abort the whole mapping process, at the least.
}
}
dir = getDirectoryToProcess();
pool = new FictionalThreadPool(10); // 10 threads in the pool
pool.map(new FictionalFunctor<File>(){
@Override
public void handle(File file){
// process the file
}
}, dir.listFiles());
I have a feeling that the types in `java.util.concurrent` allow me to do something similar, but I have absolutely no idea where to start.
Any ideas?
Thanks. | java | multithreading | java.util.concurrent | null | null | null | open | Java: Using java.util.concurrent to process files in a directory in parallel
===
I am trying to figure out how to use the types from the `java.util.concurrent` package to parallelize processing of all the files in a directory.
I am familiar with the multiprocessing package in Python, which is very simple to use, so ideally I am looking for something similar:
public interface FictionalFunctor<T>{
void handle(T arg);
}
public class FictionalThreadPool {
public FictionalThreadPool(int threadCount){
...
}
public <T> FictionalThreadPoolMapResult<T> map(FictionalFunctor<T> functor, List<T> args){
// Executes the given functor on each and every arg from args in parallel. Returns, when
// all the parallel branches return.
// FictionalThreadPoolMapResult allows to abort the whole mapping process, at the least.
}
}
dir = getDirectoryToProcess();
pool = new FictionalThreadPool(10); // 10 threads in the pool
pool.map(new FictionalFunctor<File>(){
@Override
public void handle(File file){
// process the file
}
}, dir.listFiles());
I have a feeling that the types in `java.util.concurrent` allow me to do something similar, but I have absolutely no idea where to start.
Any ideas?
Thanks. | 0 |
11,693,247 | 07/27/2012 18:04:15 | 1,424,754 | 05/29/2012 21:46:39 | 486 | 21 | Access Report Detail Format - Default Values and Referencing | This question is mainly for curiosity, but also, in the description, I had intended to highlight an infrequently documented behavior of Access.
###Background###
When creating an Access report, we can use the On Format method of the detail section to modify values or properties per-record. For example, assume we want to hide a field label when the value is empty:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (IsNull(Me.SomeField) Or Me.SomeField = "") Then
Me.SomeFieldLabel.Visible = False
Else
Me.SomeFieldLabel.Visible = True
End If
End Sub
What I did not realize about this until today is that the assignment `.Visible = False ` does not modify the **instance** of the label in the Detail section, but rather is modifying the **definition** of the label on the report.
This can be demonstrated with the following modifiction to the code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (IsNull(Me.SomeField) Or Me.SomeField = "") Then
Me.SomeFieldLabel.Visible = False
End If
End Sub
Assuming the label is initially visible (in form Designer), the event produces somewhat unexpected behavior: the label will remain visible until the first empty record; after that, it will remain hidden for all other records - I had originally expected that at each call of `Detail_Format` the controls where starting with their default definitions.
###Question###
Is there any way to reference the particular instance of a control within the `Detail_Format` event?
In this simple case of visible true/false, this is easily handled by just a simple if-then-else, but I can imagine more advanced scenarios where one might want to leave the default values in tact. | ms-access | ms-access-2007 | access-vba | null | null | null | open | Access Report Detail Format - Default Values and Referencing
===
This question is mainly for curiosity, but also, in the description, I had intended to highlight an infrequently documented behavior of Access.
###Background###
When creating an Access report, we can use the On Format method of the detail section to modify values or properties per-record. For example, assume we want to hide a field label when the value is empty:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (IsNull(Me.SomeField) Or Me.SomeField = "") Then
Me.SomeFieldLabel.Visible = False
Else
Me.SomeFieldLabel.Visible = True
End If
End Sub
What I did not realize about this until today is that the assignment `.Visible = False ` does not modify the **instance** of the label in the Detail section, but rather is modifying the **definition** of the label on the report.
This can be demonstrated with the following modifiction to the code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (IsNull(Me.SomeField) Or Me.SomeField = "") Then
Me.SomeFieldLabel.Visible = False
End If
End Sub
Assuming the label is initially visible (in form Designer), the event produces somewhat unexpected behavior: the label will remain visible until the first empty record; after that, it will remain hidden for all other records - I had originally expected that at each call of `Detail_Format` the controls where starting with their default definitions.
###Question###
Is there any way to reference the particular instance of a control within the `Detail_Format` event?
In this simple case of visible true/false, this is easily handled by just a simple if-then-else, but I can imagine more advanced scenarios where one might want to leave the default values in tact. | 0 |
11,693,248 | 07/27/2012 18:04:15 | 1,095,495 | 12/13/2011 10:13:12 | 554 | 15 | Firebug command editor disabled | The command editor on the console tab is simply disabled.
http://i.imgur.com/DTq42.png
I have reset all the settings and it still does not recover itself.
Also I have enabled all the panels.
What can I do to re-enable it? | javascript | editor | firebug | null | null | null | open | Firebug command editor disabled
===
The command editor on the console tab is simply disabled.
http://i.imgur.com/DTq42.png
I have reset all the settings and it still does not recover itself.
Also I have enabled all the panels.
What can I do to re-enable it? | 0 |
11,693,251 | 07/27/2012 18:04:19 | 1,558,391 | 07/27/2012 17:44:57 | 1 | 0 | upload and display excel sheet using asp.net with same format | i have got an assignment to upload and read the excel file using asp.net
keeping all the format same as it is in excel.(colour,font,size, indentation,padding etc)
expecting a favourable reply | asp.net | .net | sql | xml | excel | 07/28/2012 01:23:02 | not constructive | upload and display excel sheet using asp.net with same format
===
i have got an assignment to upload and read the excel file using asp.net
keeping all the format same as it is in excel.(colour,font,size, indentation,padding etc)
expecting a favourable reply | 4 |
11,693,252 | 07/27/2012 18:04:24 | 1,529,039 | 07/16/2012 13:30:18 | 4 | 0 | Salesforce: Birthday Apex Scheduler Questions | I have written an Apex Scheduler class to send an email when a colleagues Birthday is 2 days away. I have created a contact with a birthday 2 days away. The contact's birthday is the July 29, 2012. Today's date is July 27, 2012.
I'm stuck. I don't get an error message or anything. I have scheduled the class to run today at 12. I didn't get an email (either telling me it was someone's birthday (success) or an error message from Salesforce telling me my code could not run (failure)
To trouble shoot, I also tried if (contact.Next_Birthday__c = : system.Today().addDays(2)) for the email method and got an incompatible types error. Next_Birthday__c is a date field, so I'm unsure of why the types are incompatible or why this SOQL statement doesn't work.
Any advice would be appreciated. Here is my code.
global class BirthdayNameOptions implements Schedulable{
global void execute (SchedulableContext ctx)
{
sendBirthdayEmail();
}
public void sendBirthdayEmail()
{
for(Contact con : [SELECT Name FROM Contact WHERE Next_Birthday__c = : system.Today().addDays(2)])
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId('00XJ0000000M31w');
mail.setTargetObjectId('005J0000000');
mail.setSaveAsActivity(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail });
}
}
} | java | salesforce | apex-code | scheduler | null | null | open | Salesforce: Birthday Apex Scheduler Questions
===
I have written an Apex Scheduler class to send an email when a colleagues Birthday is 2 days away. I have created a contact with a birthday 2 days away. The contact's birthday is the July 29, 2012. Today's date is July 27, 2012.
I'm stuck. I don't get an error message or anything. I have scheduled the class to run today at 12. I didn't get an email (either telling me it was someone's birthday (success) or an error message from Salesforce telling me my code could not run (failure)
To trouble shoot, I also tried if (contact.Next_Birthday__c = : system.Today().addDays(2)) for the email method and got an incompatible types error. Next_Birthday__c is a date field, so I'm unsure of why the types are incompatible or why this SOQL statement doesn't work.
Any advice would be appreciated. Here is my code.
global class BirthdayNameOptions implements Schedulable{
global void execute (SchedulableContext ctx)
{
sendBirthdayEmail();
}
public void sendBirthdayEmail()
{
for(Contact con : [SELECT Name FROM Contact WHERE Next_Birthday__c = : system.Today().addDays(2)])
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId('00XJ0000000M31w');
mail.setTargetObjectId('005J0000000');
mail.setSaveAsActivity(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail });
}
}
} | 0 |
11,693,253 | 07/27/2012 18:04:52 | 36,545 | 11/11/2008 12:34:10 | 2,365 | 46 | iFrame busting kills all links on site | I have this script below, which does prevent an iFrame from busting out, but it also kills every link on my page. How do I prevent the script from disabling all my links?
<script type="text/javascript">
// prevent iframe busting.
var prevent_bust = 0
window.onbeforeunload = function() { prevent_bust++ }
setInterval(function() {
if (prevent_bust > 0) {
prevent_bust -= 2
// 204 header response prevents redirect
window.top.location = '/204-response'
}
}, 1)
</script> | iframe | null | null | null | null | null | open | iFrame busting kills all links on site
===
I have this script below, which does prevent an iFrame from busting out, but it also kills every link on my page. How do I prevent the script from disabling all my links?
<script type="text/javascript">
// prevent iframe busting.
var prevent_bust = 0
window.onbeforeunload = function() { prevent_bust++ }
setInterval(function() {
if (prevent_bust > 0) {
prevent_bust -= 2
// 204 header response prevents redirect
window.top.location = '/204-response'
}
}, 1)
</script> | 0 |
11,350,511 | 07/05/2012 18:40:02 | 1,207,798 | 02/13/2012 21:29:37 | 100 | 5 | Lightweight and extensible C compiler front-end | is there anyone that knows if there is a lightweight C compiler front-end? I really just need lexing + parsing + semantic checks I need to do code generation and static analysis on that. Thanks in advance
Alberto | c | parsing | compiler | null | null | null | open | Lightweight and extensible C compiler front-end
===
is there anyone that knows if there is a lightweight C compiler front-end? I really just need lexing + parsing + semantic checks I need to do code generation and static analysis on that. Thanks in advance
Alberto | 0 |
11,350,551 | 07/05/2012 18:42:19 | 1,339,987 | 04/17/2012 23:31:48 | 1,666 | 88 | IMAP for Hotmail equivalent | We need to build a client for Hotmail, which doesn't support IMAP. To my understanding you have to use exchange w/ POP3 but POP3 doesn't support moving mail from one folder to another. We need the features:
* be able to read mail without marking it as "read"
* be able to delete mail
* be able to move mail out of inbox to another folder and mark as read
Any way to get this to work?
| java | imap | pop3 | hotmail | email-client | null | open | IMAP for Hotmail equivalent
===
We need to build a client for Hotmail, which doesn't support IMAP. To my understanding you have to use exchange w/ POP3 but POP3 doesn't support moving mail from one folder to another. We need the features:
* be able to read mail without marking it as "read"
* be able to delete mail
* be able to move mail out of inbox to another folder and mark as read
Any way to get this to work?
| 0 |
11,350,562 | 07/05/2012 18:43:06 | 416,797 | 08/11/2010 02:38:34 | 91 | 1 | ASP.NET MVC ActionLink keep "old" route arguments | My two links to filter:
@Html.ActionLink("Customer 1", "Index", new { customer = 1 })
@Html.ActionLink("Project A", "Index", new { project = "A" })
My Controller with filtering:
public ViewResult Index(int? customer, int? project) {
var query = ...
if (customer != null) {
query = query.Where(o => o.CustomerID == customer);
}
if (project != null) {
query = query.Where(o => o.ProjectID == project);
}
return View(query.ToList());
}
I can now filter on either customer or project but not on both at the same time!
If I click Customer 1, `url = Object?customer=1`
If I click Project A, `url = Object?project=a`
I would like to be able to first click Customer 1 and then Project A and get `url = Object?customer=1&project=a`
Is this possible or should I do it in another way?
Thanks! | asp.net-mvc | null | null | null | null | null | open | ASP.NET MVC ActionLink keep "old" route arguments
===
My two links to filter:
@Html.ActionLink("Customer 1", "Index", new { customer = 1 })
@Html.ActionLink("Project A", "Index", new { project = "A" })
My Controller with filtering:
public ViewResult Index(int? customer, int? project) {
var query = ...
if (customer != null) {
query = query.Where(o => o.CustomerID == customer);
}
if (project != null) {
query = query.Where(o => o.ProjectID == project);
}
return View(query.ToList());
}
I can now filter on either customer or project but not on both at the same time!
If I click Customer 1, `url = Object?customer=1`
If I click Project A, `url = Object?project=a`
I would like to be able to first click Customer 1 and then Project A and get `url = Object?customer=1&project=a`
Is this possible or should I do it in another way?
Thanks! | 0 |
11,350,563 | 07/05/2012 18:43:10 | 1,504,787 | 04/04/2011 02:07:49 | 1 | 0 | Delphi RTTI: Get property's class | Using Delphi 2010 and RTTI, I know how to get the class type of an object and how to get/set the value and type of an object's properties, but how do you determine which class in the inheritance chain a property came from? I want to use the properties of a base class differently than the main class.
Consider this code:
TClassBase = class(TObject)
published
property A: Integer;
end;
TClassDescendant = class(TClassBase)
published
property B: Integer;
end;
procedure CheckProperties(Obj: TObject);
var
ctx: TRttiContext;
objType: TRttiType;
Prop: TRttiProperty;
begin
ctx := TRttiContext.Create;
objType := ctx.GetType(Obj.ClassInfo);
for Prop in objType.GetProperties do begin
if Prop.GetClassType is TClassBase then
// do something special with base class properties
else
// standard functionality on all other properties
end;
end;
The problem is there is no GetClassType for the properties. ClassType just returns TRttiInstancePropertyEx instead of the name of the class to which the property belongs. | properties | delphi-2010 | rtti | null | null | null | open | Delphi RTTI: Get property's class
===
Using Delphi 2010 and RTTI, I know how to get the class type of an object and how to get/set the value and type of an object's properties, but how do you determine which class in the inheritance chain a property came from? I want to use the properties of a base class differently than the main class.
Consider this code:
TClassBase = class(TObject)
published
property A: Integer;
end;
TClassDescendant = class(TClassBase)
published
property B: Integer;
end;
procedure CheckProperties(Obj: TObject);
var
ctx: TRttiContext;
objType: TRttiType;
Prop: TRttiProperty;
begin
ctx := TRttiContext.Create;
objType := ctx.GetType(Obj.ClassInfo);
for Prop in objType.GetProperties do begin
if Prop.GetClassType is TClassBase then
// do something special with base class properties
else
// standard functionality on all other properties
end;
end;
The problem is there is no GetClassType for the properties. ClassType just returns TRttiInstancePropertyEx instead of the name of the class to which the property belongs. | 0 |
11,350,568 | 07/05/2012 18:43:34 | 1,244,374 | 03/02/2012 05:37:06 | 61 | 1 | Cron jobs running, but not executing / in a frozen state | I have never seen this problem before, and I am pretty confused. I have 3 cron jobs that execute PHP code through CakePHP's console system. All 3 jobs have been running for months with no problems, and continue to run. The weird problem is that the output from these cron jobs is always the same thing, yet when I run the code manually it is the correct updated output. I log the output of each job into txt files, so that I can review the timestamps and outputs.
Here is the output of one of the jobs from the txt file (that ran July 5th 12:30):
Welcome to CakePHP v2.1.2 Console
---------------------------------------------------------------
App : app
Path: /var/www/html/app/
---------------------------------------------------------------
- Calculating stats
- 79 players calculated
---------------------------------------------------------------
CalculateStats complete!
Shell took 9.4434700012207 seconds
And here is the output when I run the shell manually:
Welcome to CakePHP v2.1.2 Console
---------------------------------------------------------------
App : app
Path: /var/www/html/app/
---------------------------------------------------------------
- Calculating stats
- 188 players calculated
---------------------------------------------------------------
CalculateStats complete!
Shell took 6.4958961009979 seconds
When the job runs again (every 4 hours), the output will be the same as the 1st example. It's as if the job is stuck in a frozen state and I am not too sure how to fix it.
I've disabled caching, checked PATH and made sure there is a trailing newline in the crontab. All jobs (and myself) are also ran as the root user. For reference, here is my crontab.
0 0-23/4 * * * /var/www/html/lib/Cake/Console/cake -app /var/www/html/app/ calculate_stats > /root/calculate_stats.txt
30 0-23/4 * * * /var/www/html/lib/Cake/Console/cake -app /var/www/html/app/ aggregate_votes > /root/aggregate_votes.txt
0 15 * * 3 /var/www/html/lib/Cake/Console/cake -app /var/www/html/app/ game_sprint_reset > /root/game_sprint_reset.txt
Any ideas? | php | shell | cakephp | cron | crontab | null | open | Cron jobs running, but not executing / in a frozen state
===
I have never seen this problem before, and I am pretty confused. I have 3 cron jobs that execute PHP code through CakePHP's console system. All 3 jobs have been running for months with no problems, and continue to run. The weird problem is that the output from these cron jobs is always the same thing, yet when I run the code manually it is the correct updated output. I log the output of each job into txt files, so that I can review the timestamps and outputs.
Here is the output of one of the jobs from the txt file (that ran July 5th 12:30):
Welcome to CakePHP v2.1.2 Console
---------------------------------------------------------------
App : app
Path: /var/www/html/app/
---------------------------------------------------------------
- Calculating stats
- 79 players calculated
---------------------------------------------------------------
CalculateStats complete!
Shell took 9.4434700012207 seconds
And here is the output when I run the shell manually:
Welcome to CakePHP v2.1.2 Console
---------------------------------------------------------------
App : app
Path: /var/www/html/app/
---------------------------------------------------------------
- Calculating stats
- 188 players calculated
---------------------------------------------------------------
CalculateStats complete!
Shell took 6.4958961009979 seconds
When the job runs again (every 4 hours), the output will be the same as the 1st example. It's as if the job is stuck in a frozen state and I am not too sure how to fix it.
I've disabled caching, checked PATH and made sure there is a trailing newline in the crontab. All jobs (and myself) are also ran as the root user. For reference, here is my crontab.
0 0-23/4 * * * /var/www/html/lib/Cake/Console/cake -app /var/www/html/app/ calculate_stats > /root/calculate_stats.txt
30 0-23/4 * * * /var/www/html/lib/Cake/Console/cake -app /var/www/html/app/ aggregate_votes > /root/aggregate_votes.txt
0 15 * * 3 /var/www/html/lib/Cake/Console/cake -app /var/www/html/app/ game_sprint_reset > /root/game_sprint_reset.txt
Any ideas? | 0 |
11,542,210 | 07/18/2012 13:11:11 | 1,276,153 | 03/17/2012 19:37:07 | 27 | 0 | TableView & MapView same Detail View | I have a table view that load the data from an xml in a array and show it, every cell point to the same detail view repopulated.
In the same view i have a hidden map view, the map view show the same array of the table in the map, every annotation have a disclosure button that point to the same detail view of the table, but i don't understand how i can pass the data from the map view to the detail view...
for the disclosure button i use this code
-(IBAction)showDetails:(id)sender{
DettMercatiViewController *dettMercatiViewController = [[DettMercatiViewController alloc] initWithNibName:@"DettMercatiViewController" bundle:nil];
dettMercatiViewController.mieiMercati = [table objectAtIndex:????];
[self.navigationController pushViewController:dettMercatiViewController animated:YES];
[dettMercatiViewController release];
}
table is the name of the nsmutablearray created from the xml but i don't know what objectIndex use... any idea? | xcode | uitableview | uimapview | null | null | null | open | TableView & MapView same Detail View
===
I have a table view that load the data from an xml in a array and show it, every cell point to the same detail view repopulated.
In the same view i have a hidden map view, the map view show the same array of the table in the map, every annotation have a disclosure button that point to the same detail view of the table, but i don't understand how i can pass the data from the map view to the detail view...
for the disclosure button i use this code
-(IBAction)showDetails:(id)sender{
DettMercatiViewController *dettMercatiViewController = [[DettMercatiViewController alloc] initWithNibName:@"DettMercatiViewController" bundle:nil];
dettMercatiViewController.mieiMercati = [table objectAtIndex:????];
[self.navigationController pushViewController:dettMercatiViewController animated:YES];
[dettMercatiViewController release];
}
table is the name of the nsmutablearray created from the xml but i don't know what objectIndex use... any idea? | 0 |
11,542,244 | 07/18/2012 13:12:49 | 1,075,949 | 12/01/2011 17:08:54 | 48 | 12 | Rails/Mongoid update_attributes ignoring persisted nested attributes validations | I've got a Mongoid "Node" model that "has_many" addresses (Address class).
I'm using a nested form to manage addresses and I'm able to create, update, destroy node's addresses successfully.
The problem is with Address validators : When validation fails on a new Address, update_attibutes fails and errors are displayed. But when trying to update an existing address with a invalid value, Address validators are triggered and fails (checked through log), but Node's update_attributes returns true and no error is displayed (the address keeps it's value unchanged).
When trying to update an existing address with invalid value and create a new invalid address at the same time to force update_attributes to fail, my form fails because of the new address, but there's no error on the existing address and it's (valid) value is restored.
Is there a different behavior between new and persisted nested attributes validation ?
Here's the header of my Node class :
<!-- language: ruby -->
class Node
# INCLUSIONS
include Mongoid::Document
include Mongoid::Timestamps
# RELATIONS
belongs_to :organization
has_and_belongs_to_many :platforms
has_many :addresses
accepts_nested_attributes_for :addresses, allow_destroy: true, reject_if: :all_blank
Address class (class methods skipped) (note that there are overloaded getters & setters but they doesn't seem to be the cause) :
<!-- language: ruby -->
class Address
# INCLUSIONS
include Mongoid::Document
include Mongoid::Timestamps
# RELATIONS
belongs_to :node
# FIELDS
field :address, type: String
field :nat, type: String
field :description
# VALIDATIONS
validates :address, :node,
presence: true
# Validates address and nat validity
validate do
[:address, :nat].each do |field|
errors.add(field, :invalid) unless self[field].blank? || self.class.valid_hex?(self[field])
end
end
# INSTANCE METHODS
# Address getter
def address
return self.class.hex_to_ip(self[:address]).to_s if self.class.valid_hex? self[:address]
self[:address]
end
# Address setter
def address= value
self[:address] = self.class.valid_ip?(value) ? self.class.ip_to_hex(value) : value
end
# NAT address getter
def nat
return self.class.hex_to_ip(self[:nat]).to_s if self.class.valid_hex? self[:nat]
self[:nat]
end
# NAT Address setter
def nat= value
self[:nat] = self.class.valid_ip?(value) ? self.class.ip_to_hex(value) : value
end
update method of NodesController :
<!-- language: ruby -->
def update
@node = platform.nodes.find_by name: params[:id]
if @node.update_attributes params[:node]
flash[:success] = t_flash :update_success, @node
redirect_to platforms_platform_node_path(organization, platform, @node)
else
flash.now[:error] = t_flash :update_error, @node, count: @node.errors.count
render :form
end
end
I've tried adding [validates_associated :addresses][1] in Node class but it doesn't change anything (and it doesn't seem to be necessary since new addresses are validated without this).
I've also tried replacing getters & setters with after_initialize/before_save callbacks and I had the same problem.
Rails v3.2.6 / Mongoid v3.0.1
[1]: http://guides.rubyonrails.org/active_record_validations_callbacks.html#validates_associated | ruby-on-rails | ruby-on-rails-3 | mongoid | null | null | null | open | Rails/Mongoid update_attributes ignoring persisted nested attributes validations
===
I've got a Mongoid "Node" model that "has_many" addresses (Address class).
I'm using a nested form to manage addresses and I'm able to create, update, destroy node's addresses successfully.
The problem is with Address validators : When validation fails on a new Address, update_attibutes fails and errors are displayed. But when trying to update an existing address with a invalid value, Address validators are triggered and fails (checked through log), but Node's update_attributes returns true and no error is displayed (the address keeps it's value unchanged).
When trying to update an existing address with invalid value and create a new invalid address at the same time to force update_attributes to fail, my form fails because of the new address, but there's no error on the existing address and it's (valid) value is restored.
Is there a different behavior between new and persisted nested attributes validation ?
Here's the header of my Node class :
<!-- language: ruby -->
class Node
# INCLUSIONS
include Mongoid::Document
include Mongoid::Timestamps
# RELATIONS
belongs_to :organization
has_and_belongs_to_many :platforms
has_many :addresses
accepts_nested_attributes_for :addresses, allow_destroy: true, reject_if: :all_blank
Address class (class methods skipped) (note that there are overloaded getters & setters but they doesn't seem to be the cause) :
<!-- language: ruby -->
class Address
# INCLUSIONS
include Mongoid::Document
include Mongoid::Timestamps
# RELATIONS
belongs_to :node
# FIELDS
field :address, type: String
field :nat, type: String
field :description
# VALIDATIONS
validates :address, :node,
presence: true
# Validates address and nat validity
validate do
[:address, :nat].each do |field|
errors.add(field, :invalid) unless self[field].blank? || self.class.valid_hex?(self[field])
end
end
# INSTANCE METHODS
# Address getter
def address
return self.class.hex_to_ip(self[:address]).to_s if self.class.valid_hex? self[:address]
self[:address]
end
# Address setter
def address= value
self[:address] = self.class.valid_ip?(value) ? self.class.ip_to_hex(value) : value
end
# NAT address getter
def nat
return self.class.hex_to_ip(self[:nat]).to_s if self.class.valid_hex? self[:nat]
self[:nat]
end
# NAT Address setter
def nat= value
self[:nat] = self.class.valid_ip?(value) ? self.class.ip_to_hex(value) : value
end
update method of NodesController :
<!-- language: ruby -->
def update
@node = platform.nodes.find_by name: params[:id]
if @node.update_attributes params[:node]
flash[:success] = t_flash :update_success, @node
redirect_to platforms_platform_node_path(organization, platform, @node)
else
flash.now[:error] = t_flash :update_error, @node, count: @node.errors.count
render :form
end
end
I've tried adding [validates_associated :addresses][1] in Node class but it doesn't change anything (and it doesn't seem to be necessary since new addresses are validated without this).
I've also tried replacing getters & setters with after_initialize/before_save callbacks and I had the same problem.
Rails v3.2.6 / Mongoid v3.0.1
[1]: http://guides.rubyonrails.org/active_record_validations_callbacks.html#validates_associated | 0 |
11,542,247 | 07/18/2012 13:13:03 | 1,099,339 | 12/15/2011 07:27:40 | 604 | 52 | access token google | I am trying to get access token from the google
as defined here https://developers.google.com/accounts/docs/OAuth2WebServer
but the problem is I am not sure how to get the client secret here to get the token
I tried getting token from the account manager but the token it returns doesn't get me info
it's really confusing can any one help me which would be a better approach to get this token
| android | google | null | null | null | null | open | access token google
===
I am trying to get access token from the google
as defined here https://developers.google.com/accounts/docs/OAuth2WebServer
but the problem is I am not sure how to get the client secret here to get the token
I tried getting token from the account manager but the token it returns doesn't get me info
it's really confusing can any one help me which would be a better approach to get this token
| 0 |
11,472,373 | 07/13/2012 14:20:38 | 319,633 | 04/18/2010 10:35:33 | 443 | 23 | url rewrite not working | I know this may have been already asked but could not find a solution that helped me yet. I have rewrite rules defined as follows:
<rewrite>
<rules>
<rule name="Handler for SignalR" stopProcessing="true">
<match url="^signalr/(.*)" />
<action type="Rewrite" url="http://localhost:81/signalr/{R:1}" logRewrittenUrl="true" />
</rule>
<rule name="Reverse Proxy to API" stopProcessing="true">
<match url="^api/(.*)" />
<action type="Rewrite" url="http://localhost:81/api/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
so basically 2 almost identical rules except for the type of match in front (I know I could make them into a single one but bear with me). Problem is that one of them is working fine (the api one, the second) and the other is not (meaning a get the usual 404). I tried inverting the order, but that's not the problem. Of course if I go to the rewritten URL manually I can get the normal output so the other page works, it's the rewriting that seems to be off... but only for the signalR one.
Any ideas? | url-rewriting | iis-7.5 | null | null | null | null | open | url rewrite not working
===
I know this may have been already asked but could not find a solution that helped me yet. I have rewrite rules defined as follows:
<rewrite>
<rules>
<rule name="Handler for SignalR" stopProcessing="true">
<match url="^signalr/(.*)" />
<action type="Rewrite" url="http://localhost:81/signalr/{R:1}" logRewrittenUrl="true" />
</rule>
<rule name="Reverse Proxy to API" stopProcessing="true">
<match url="^api/(.*)" />
<action type="Rewrite" url="http://localhost:81/api/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
so basically 2 almost identical rules except for the type of match in front (I know I could make them into a single one but bear with me). Problem is that one of them is working fine (the api one, the second) and the other is not (meaning a get the usual 404). I tried inverting the order, but that's not the problem. Of course if I go to the rewritten URL manually I can get the normal output so the other page works, it's the rewriting that seems to be off... but only for the signalR one.
Any ideas? | 0 |
11,472,384 | 07/13/2012 14:21:22 | 1,282,657 | 03/21/2012 06:30:27 | 34 | 0 | Create button click function not working in mvc3? | Hi guys i have a table where i have a add new project link ...when i click on that it takes me to a create page where i have textboxes for inserting new record and a button to create..but i click on create button its not working can any one help me where am i doing wrong here is my code
this is my create.aspx page
<%: ViewBag.Title="Create" %>
<fieldset>
<legend>Projects</legend>
<div class="editor-label">
<%: Html.LabelFor(model => model.projectName)%>
</div>
<div class="editor-field">
<%:Html.EditorFor(model => model.projectName)%>
<%: Html.ValidationMessageFor(model => model.projectName)%>
</div>
<div class="editor-label">
<%:Html.LabelFor(model => model.Description)%>
</div>
<div class="editor-field">
<%:Html.EditorFor(model => model.Description)%>
<%:Html.ValidationMessageFor(model => model.Description)%>
</div>
<div class="editor-label">
<%:Html.LabelFor(model=>model.status) %>
</div>
<div class="editor-field">
<%:Html.EditorFor(model=>model.status) %>
<%:Html.ValidationMessageFor(model=>model.status) %>
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
and this is my controller funtion
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(ProjectModel model)
{
var modelList = new List<ProjectModel>();
using (SqlConnection conn = new SqlConnection("Data Source=LMIT-0039;Initial Catalog=BugTracker;Integrated Security=True"))
{
conn.Open();
SqlCommand insertcommande = new SqlCommand("Sp_AddNewProject", conn);
insertcommande.CommandType = CommandType.StoredProcedure;
insertcommande.Parameters.Add("@ProjectName", SqlDbType.VarChar).Value = model.projectName;
insertcommande.Parameters.Add("@Description", SqlDbType.VarChar).Value = model.Description;
insertcommande.Parameters.Add("@Status", SqlDbType.VarChar).Value = model.status;
insertcommande.ExecuteNonQuery();
}
return View( modelList);
}
when i click on create button in aspx page it should go to create method in my controller .....what am i doing wrong here.........
| asp.net-mvc-3 | c#-4.0 | null | null | null | null | open | Create button click function not working in mvc3?
===
Hi guys i have a table where i have a add new project link ...when i click on that it takes me to a create page where i have textboxes for inserting new record and a button to create..but i click on create button its not working can any one help me where am i doing wrong here is my code
this is my create.aspx page
<%: ViewBag.Title="Create" %>
<fieldset>
<legend>Projects</legend>
<div class="editor-label">
<%: Html.LabelFor(model => model.projectName)%>
</div>
<div class="editor-field">
<%:Html.EditorFor(model => model.projectName)%>
<%: Html.ValidationMessageFor(model => model.projectName)%>
</div>
<div class="editor-label">
<%:Html.LabelFor(model => model.Description)%>
</div>
<div class="editor-field">
<%:Html.EditorFor(model => model.Description)%>
<%:Html.ValidationMessageFor(model => model.Description)%>
</div>
<div class="editor-label">
<%:Html.LabelFor(model=>model.status) %>
</div>
<div class="editor-field">
<%:Html.EditorFor(model=>model.status) %>
<%:Html.ValidationMessageFor(model=>model.status) %>
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
and this is my controller funtion
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(ProjectModel model)
{
var modelList = new List<ProjectModel>();
using (SqlConnection conn = new SqlConnection("Data Source=LMIT-0039;Initial Catalog=BugTracker;Integrated Security=True"))
{
conn.Open();
SqlCommand insertcommande = new SqlCommand("Sp_AddNewProject", conn);
insertcommande.CommandType = CommandType.StoredProcedure;
insertcommande.Parameters.Add("@ProjectName", SqlDbType.VarChar).Value = model.projectName;
insertcommande.Parameters.Add("@Description", SqlDbType.VarChar).Value = model.Description;
insertcommande.Parameters.Add("@Status", SqlDbType.VarChar).Value = model.status;
insertcommande.ExecuteNonQuery();
}
return View( modelList);
}
when i click on create button in aspx page it should go to create method in my controller .....what am i doing wrong here.........
| 0 |
11,472,331 | 07/13/2012 14:18:16 | 1,162,136 | 01/21/2012 10:07:14 | 35 | 2 | Chrome extension inject javascript before body finish loading | I'm triyng to create a Chrome extension that block a script before it is executed.
The script tag is in body tag and not in head.
Is it possible to do so?
in manifest.json I have set content_scripts like this:
"content_scripts": [
{
"run_at": "document_start",
"matches": ["http://website.it/*"],
"js": ["dojob.js"]
}]
And my script is this one:
var cont = 0;
document.addEventListener("DOMNodeInserted", function(event){
if(cont==0){
alert(document.getElementsByTagName("script")[0].src);
document.getElementsByTagName("script")[0].src = "";
cont++;
}
});
But the script still runs...
How cant I make it work?
| dom | google-chrome-extension | null | null | null | null | open | Chrome extension inject javascript before body finish loading
===
I'm triyng to create a Chrome extension that block a script before it is executed.
The script tag is in body tag and not in head.
Is it possible to do so?
in manifest.json I have set content_scripts like this:
"content_scripts": [
{
"run_at": "document_start",
"matches": ["http://website.it/*"],
"js": ["dojob.js"]
}]
And my script is this one:
var cont = 0;
document.addEventListener("DOMNodeInserted", function(event){
if(cont==0){
alert(document.getElementsByTagName("script")[0].src);
document.getElementsByTagName("script")[0].src = "";
cont++;
}
});
But the script still runs...
How cant I make it work?
| 0 |
11,373,344 | 07/07/2012 07:57:25 | 382,906 | 07/04/2010 01:40:57 | 2,807 | 68 | Twitter Bootstrap and gmaps4rails | I have the following view code and it dynamically adjusts its size for mobile phone as well as the desktop. However the map doesn't change size. Is there a way to make it so that the map changes size dynamically to fit on the phone/tablet/desktop using bootstrap? (see below)
.row
.span6.offset3
.well
= gmaps4rails(@maps_json)
![enter image description here][1]
[1]: http://i.stack.imgur.com/k02jK.png | ruby-on-rails | gmaps4rails | bootstrap | null | null | null | open | Twitter Bootstrap and gmaps4rails
===
I have the following view code and it dynamically adjusts its size for mobile phone as well as the desktop. However the map doesn't change size. Is there a way to make it so that the map changes size dynamically to fit on the phone/tablet/desktop using bootstrap? (see below)
.row
.span6.offset3
.well
= gmaps4rails(@maps_json)
![enter image description here][1]
[1]: http://i.stack.imgur.com/k02jK.png | 0 |
11,373,354 | 07/07/2012 07:58:30 | 1,508,417 | 07/07/2012 07:42:25 | 1 | 0 | I've stored form names in a data base. now i want to load forms by using those names | I've stored form names in a data base. now i want to load forms by using those names.
this is my table
frmID, Item_Name, formName
this is my code.
upto "Assembly asm = typeof(Form).Assembly;" code is working properly.
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
//TreeNode node = treeView1.SelectedNode;
string item = Convert.ToString(treeView1.SelectedNode);
int index = item.IndexOf(" ");
if (index > 0)
item = item.Substring(index + 1);
//MessageBox.Show(item);
var selectedFRM = from Menu in dbdata.Menus
where Menu.Item_Name == item
select Menu;
foreach (var pick in selectedFRM.Take(1))
{
string sel = pick.Form_Name;
Assembly asm = typeof(Form).Assembly;
Type type = asm.GetType(sel);
string df = Convert.ToString(type);
MessageBox.Show(df);
AssemblyName assemName = asm.GetName();
MessageBox.Show(assemName.Name);
try
{
Form frmChk = (Form)Activator.CreateInstance(type);
frmChk.Show();
}
catch (Exception)
{
MessageBox.Show("Error in loading form");
}
// MessageBox.Show(sel);
} | c# | null | null | null | null | null | open | I've stored form names in a data base. now i want to load forms by using those names
===
I've stored form names in a data base. now i want to load forms by using those names.
this is my table
frmID, Item_Name, formName
this is my code.
upto "Assembly asm = typeof(Form).Assembly;" code is working properly.
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
//TreeNode node = treeView1.SelectedNode;
string item = Convert.ToString(treeView1.SelectedNode);
int index = item.IndexOf(" ");
if (index > 0)
item = item.Substring(index + 1);
//MessageBox.Show(item);
var selectedFRM = from Menu in dbdata.Menus
where Menu.Item_Name == item
select Menu;
foreach (var pick in selectedFRM.Take(1))
{
string sel = pick.Form_Name;
Assembly asm = typeof(Form).Assembly;
Type type = asm.GetType(sel);
string df = Convert.ToString(type);
MessageBox.Show(df);
AssemblyName assemName = asm.GetName();
MessageBox.Show(assemName.Name);
try
{
Form frmChk = (Form)Activator.CreateInstance(type);
frmChk.Show();
}
catch (Exception)
{
MessageBox.Show("Error in loading form");
}
// MessageBox.Show(sel);
} | 0 |
11,373,356 | 07/07/2012 07:58:50 | 1,370,370 | 05/02/2012 15:03:42 | 175 | 18 | How to multiple join tables? | I have 2 tables.
workers and experience
In table workers there is row worker_parent (because one worker can be responsible for other).
No I must connect tables like that:
SELECT w1.* FROM workers w1 LEFT JOIN workers w2 ON (w2.id = w1.worker_parent)
And that's ok. But I have to order by experience of w2 and I try to add table experience but it's connect to w1 and not to w2.
My question is how to add table experience (which has row worker_id) to w2 and order by experience AND SELECT data from w1.
This is my try.
SELECT w1.* FROM workers w1 LEFT JOIN workers w2 ON (w2.id = w1.worker_parent) LEFT JOIN experience e ON (w2.id = e.worker_id) ORDER BY e.experience DESC
Thank's for help
| mysql | null | null | null | null | null | open | How to multiple join tables?
===
I have 2 tables.
workers and experience
In table workers there is row worker_parent (because one worker can be responsible for other).
No I must connect tables like that:
SELECT w1.* FROM workers w1 LEFT JOIN workers w2 ON (w2.id = w1.worker_parent)
And that's ok. But I have to order by experience of w2 and I try to add table experience but it's connect to w1 and not to w2.
My question is how to add table experience (which has row worker_id) to w2 and order by experience AND SELECT data from w1.
This is my try.
SELECT w1.* FROM workers w1 LEFT JOIN workers w2 ON (w2.id = w1.worker_parent) LEFT JOIN experience e ON (w2.id = e.worker_id) ORDER BY e.experience DESC
Thank's for help
| 0 |
11,373,357 | 07/07/2012 07:58:56 | 1,462,299 | 06/17/2012 19:49:55 | 56 | 1 | AudioManager and system volume change receiver | I've followed instructions on [this page][1] until "Preparing your code for Android 2.2 without restricting it to Android 2.2". Anyway, I guess it should be working at this point but it's not. I've registered a receiver in manifest:
<receiver android:name="RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
created a class for RemoteControlReceiver declaration:
public class RemoteControlReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "onReceive", Toast.LENGTH_SHORT).show();
}
}
and finally boostrapped it in the starting activity.
private AudioManager _audioManager;
private ComponentName _componentName;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
_componentName = new ComponentName(getPackageName(), RemoteControlReceiver.class.getName());
}
@Override
protected void onResume() {
super.onResume();
_audioManager.registerMediaButtonEventReceiver(_componentName);
_audioManager.requestAudioFocus(new OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
Toast.makeText(getApplicationContext(), "onFocusChanged", Toast.LENGTH_SHORT).show();
}
}, AudioManager.STREAM_MUSIC, 0);
}
Could you point out what am I missing here ? I have an assumption that in order to receive thodse messages I my activity has to play any media stuff. I gonna test it right away.
P.S. As you see I've even added some uneccessary code - don't pay attention to requestAudioFocus.
Thanks for any suggestions.
[1]: http://android-developers.blogspot.com/2010/06/allowing-applications-to-play-nicer.html
| android | null | null | null | null | null | open | AudioManager and system volume change receiver
===
I've followed instructions on [this page][1] until "Preparing your code for Android 2.2 without restricting it to Android 2.2". Anyway, I guess it should be working at this point but it's not. I've registered a receiver in manifest:
<receiver android:name="RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
created a class for RemoteControlReceiver declaration:
public class RemoteControlReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "onReceive", Toast.LENGTH_SHORT).show();
}
}
and finally boostrapped it in the starting activity.
private AudioManager _audioManager;
private ComponentName _componentName;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
_componentName = new ComponentName(getPackageName(), RemoteControlReceiver.class.getName());
}
@Override
protected void onResume() {
super.onResume();
_audioManager.registerMediaButtonEventReceiver(_componentName);
_audioManager.requestAudioFocus(new OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
Toast.makeText(getApplicationContext(), "onFocusChanged", Toast.LENGTH_SHORT).show();
}
}, AudioManager.STREAM_MUSIC, 0);
}
Could you point out what am I missing here ? I have an assumption that in order to receive thodse messages I my activity has to play any media stuff. I gonna test it right away.
P.S. As you see I've even added some uneccessary code - don't pay attention to requestAudioFocus.
Thanks for any suggestions.
[1]: http://android-developers.blogspot.com/2010/06/allowing-applications-to-play-nicer.html
| 0 |
11,373,359 | 07/07/2012 07:59:17 | 1,477,998 | 06/24/2012 11:30:56 | 3 | 0 | Manage Session in Desktop Client | I am trying to create a desktop application which requires Session management.. so How can I manage my session in java for a Desktop Client ....
I have Idea of Servlets & HttpSession and but how can i use @Context ApplicationContext to create a session . | java | session | desktop-application | null | null | null | open | Manage Session in Desktop Client
===
I am trying to create a desktop application which requires Session management.. so How can I manage my session in java for a Desktop Client ....
I have Idea of Servlets & HttpSession and but how can i use @Context ApplicationContext to create a session . | 0 |
11,373,361 | 07/07/2012 07:59:30 | 367,346 | 06/15/2010 14:19:06 | 1 | 1 | Multiple Forms Submit | I have 4 forms on a page. I know that forms cannot be nested.
`<form id="form1"></form>`
`<form id="form2"></form>`
`<form id="form3"></form>`
`<form id="form4"></form>`
presented in that order.
Form 1 and Form 4 post to same php page for processing.
Form 1 have 1 input field
Form 4 have multiple fields, checkboxes and selects.
What is the best approach for both form 1 or form 4 sending the combined fields of both forms?
I've tried jQuery, works great for text input and checkbox, but can't get it to work with Select.
Tried combining form 1 and form 4 and using css to repositioning form 1, but can't get the layout right.
Is there something simpler to do this? | php | javascript | jquery | html | null | null | open | Multiple Forms Submit
===
I have 4 forms on a page. I know that forms cannot be nested.
`<form id="form1"></form>`
`<form id="form2"></form>`
`<form id="form3"></form>`
`<form id="form4"></form>`
presented in that order.
Form 1 and Form 4 post to same php page for processing.
Form 1 have 1 input field
Form 4 have multiple fields, checkboxes and selects.
What is the best approach for both form 1 or form 4 sending the combined fields of both forms?
I've tried jQuery, works great for text input and checkbox, but can't get it to work with Select.
Tried combining form 1 and form 4 and using css to repositioning form 1, but can't get the layout right.
Is there something simpler to do this? | 0 |
11,373,362 | 07/07/2012 07:59:50 | 881,635 | 08/06/2011 05:19:01 | 3,458 | 150 | Android PullTo Refresh the ScrollView | I know that pullToRefresh like functionality is available in the iPhone and for the Android we have to manage it manualy.
I got some example the having pullToRefresh but it works on the ListView only.
In My case i want to implement for the Scrollview. Something like PullToRefresh available in DrawFree app in Google Play.
Please see below image:
![enter image description here][1]
So, How to implement it?
Any Example to implement it would be really appreciated.
Thanks in advance.
[1]: http://i.stack.imgur.com/UVVfB.png | android | android-layout | android-widget | scrollview | null | null | open | Android PullTo Refresh the ScrollView
===
I know that pullToRefresh like functionality is available in the iPhone and for the Android we have to manage it manualy.
I got some example the having pullToRefresh but it works on the ListView only.
In My case i want to implement for the Scrollview. Something like PullToRefresh available in DrawFree app in Google Play.
Please see below image:
![enter image description here][1]
So, How to implement it?
Any Example to implement it would be really appreciated.
Thanks in advance.
[1]: http://i.stack.imgur.com/UVVfB.png | 0 |
11,373,363 | 07/07/2012 07:59:59 | 1,468,624 | 06/20/2012 08:46:54 | 8 | 0 | How can i install gearman php extension on Windows OS? | Please anybody help me out in installing gearman php extension on windows xp. I have xampp 1.7.7 installed on my system and i have installed Cygwin, libevent-1.4.14b-stable and gearmand on my system. Please let me know what more is needed to install gearman-1.0.2 php extension. As when i run the gearman-1.0.2 on cygwin terminal throwing error of | php | windows | operating-system | extension | gearman | null | open | How can i install gearman php extension on Windows OS?
===
Please anybody help me out in installing gearman php extension on windows xp. I have xampp 1.7.7 installed on my system and i have installed Cygwin, libevent-1.4.14b-stable and gearmand on my system. Please let me know what more is needed to install gearman-1.0.2 php extension. As when i run the gearman-1.0.2 on cygwin terminal throwing error of | 0 |
11,373,245 | 07/07/2012 07:44:35 | 1,490,727 | 06/29/2012 08:53:54 | 9 | 0 | Switch places on div with CSS? | Im building my site with CSS Media Queries for mobile and needs to switch places on 3 divs.
This is how it looks like now : [http://jsfiddle.net/snowman/3kZW2/][1]
And this is what I need : [http://jsfiddle.net/snowman/7S7e9/][2]
Is this possible with just changing the css of version 1?
[1]: http://jsfiddle.net/snowman/3kZW2/
[2]: http://jsfiddle.net/snowman/7S7e9/ | html | css | null | null | null | null | open | Switch places on div with CSS?
===
Im building my site with CSS Media Queries for mobile and needs to switch places on 3 divs.
This is how it looks like now : [http://jsfiddle.net/snowman/3kZW2/][1]
And this is what I need : [http://jsfiddle.net/snowman/7S7e9/][2]
Is this possible with just changing the css of version 1?
[1]: http://jsfiddle.net/snowman/3kZW2/
[2]: http://jsfiddle.net/snowman/7S7e9/ | 0 |
11,373,246 | 07/07/2012 07:44:49 | 1,508,416 | 07/07/2012 07:41:20 | 1 | 0 | Support for sql 2008 on wso2 stratos Live | Just wandering when the plan is to support Sql server 2008 on stratos Live ?? | sql-server | sql-server-2008-r2 | wso2 | null | null | null | open | Support for sql 2008 on wso2 stratos Live
===
Just wandering when the plan is to support Sql server 2008 on stratos Live ?? | 0 |
11,410,795 | 07/10/2012 09:56:18 | 1,099,168 | 12/15/2011 05:00:00 | 650 | 26 | RadioButton onchecked() cant get the result | this is weird. cant get values return.
looks everything is fine. cant figure out the problem.
application force closes on Agree button clicked.
cant get values back from i_am.isChecked() all other radio buttons
protected void onCreate(Bundle savedInstanceState) {
final RadioButton i_am,practic,read_terms;
i_am=(RadioButton)findViewById(R.id.first);
practice=(RadioButton)findViewById(R.id.second);
read_terms=(RadioButton)findViewById(R.id.third);
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.termandconditionxml);
Button agree_button=(Button)findViewById(R.id.Agree);
agree_button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(checker())
{
Toast.makeText(getApplicationContext(), "done all cliked",Toast.LENGTH_LONG).show();
}
else
{
// TODO Auto-generated method stub
new AlertDialog.Builder(Termsandcondition.this)
.setTitle("Error")
.setMessage("Please verify ")
.setPositiveButton("OK",null).show();
}
}
private boolean checker() {
// TODO Auto-generated method stub
System.out.println("iamanhcp"+i_am.isChecked());
if(i_am.isChecked())
{
System.out.println("iahcp"+i_am.isChecked());
if(practice.isChecked())
{
System.out.println("iama"+practice.isChecked());
if(read_terms.isChecked())
{
System.out.println("iama"+read_terms.isChecked());
return true;
}
}
}
return false;
}
});
}//oncreate end | android | radio-button | ischecked | null | null | null | open | RadioButton onchecked() cant get the result
===
this is weird. cant get values return.
looks everything is fine. cant figure out the problem.
application force closes on Agree button clicked.
cant get values back from i_am.isChecked() all other radio buttons
protected void onCreate(Bundle savedInstanceState) {
final RadioButton i_am,practic,read_terms;
i_am=(RadioButton)findViewById(R.id.first);
practice=(RadioButton)findViewById(R.id.second);
read_terms=(RadioButton)findViewById(R.id.third);
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.termandconditionxml);
Button agree_button=(Button)findViewById(R.id.Agree);
agree_button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(checker())
{
Toast.makeText(getApplicationContext(), "done all cliked",Toast.LENGTH_LONG).show();
}
else
{
// TODO Auto-generated method stub
new AlertDialog.Builder(Termsandcondition.this)
.setTitle("Error")
.setMessage("Please verify ")
.setPositiveButton("OK",null).show();
}
}
private boolean checker() {
// TODO Auto-generated method stub
System.out.println("iamanhcp"+i_am.isChecked());
if(i_am.isChecked())
{
System.out.println("iahcp"+i_am.isChecked());
if(practice.isChecked())
{
System.out.println("iama"+practice.isChecked());
if(read_terms.isChecked())
{
System.out.println("iama"+read_terms.isChecked());
return true;
}
}
}
return false;
}
});
}//oncreate end | 0 |
11,410,860 | 07/10/2012 09:59:45 | 727,074 | 04/27/2011 10:52:56 | 855 | 38 | JavaScript library to simulate Internet Explorer JavaScript environment? | This is not a duplicate of the [JS library to simulate Internet Explorer?](http://stackoverflow.com/questions/10569512/js-library-to-simulate-internet-explorer) question about simulating Internet Explorer's CSS support; this is about JavaScript functions.
#Does a JavaScript library exist which can simulate an environment like Internet Explorer's, whereas JavaScript functions are concerned?
Basically, it would remove/overwrite the functions not supported by older versions of IE (like indexOf, etc.) or at least force any call to them to be ignored somehow.
*Effectively, what I'm looking for is something almost like the opposite of [Underscore.js](http://underscorejs.org/) and which theoretically could even be used to test (in non-IE browsers) that Underscore.js is doing what it's meant to do.*
----------
###The use case I'm imagining:
Using this script to simulate an IE7 environment in [Phantom.js](http://phantomjs.org/)'s WebKit browser for automated (by Jenkins) JavaScript unit-testing with Jasmine / QUnit / etc (undecided). | javascript | internet-explorer | javascript-library | underscore.js | phantomjs | null | open | JavaScript library to simulate Internet Explorer JavaScript environment?
===
This is not a duplicate of the [JS library to simulate Internet Explorer?](http://stackoverflow.com/questions/10569512/js-library-to-simulate-internet-explorer) question about simulating Internet Explorer's CSS support; this is about JavaScript functions.
#Does a JavaScript library exist which can simulate an environment like Internet Explorer's, whereas JavaScript functions are concerned?
Basically, it would remove/overwrite the functions not supported by older versions of IE (like indexOf, etc.) or at least force any call to them to be ignored somehow.
*Effectively, what I'm looking for is something almost like the opposite of [Underscore.js](http://underscorejs.org/) and which theoretically could even be used to test (in non-IE browsers) that Underscore.js is doing what it's meant to do.*
----------
###The use case I'm imagining:
Using this script to simulate an IE7 environment in [Phantom.js](http://phantomjs.org/)'s WebKit browser for automated (by Jenkins) JavaScript unit-testing with Jasmine / QUnit / etc (undecided). | 0 |
11,410,864 | 07/10/2012 09:59:53 | 1,460,625 | 06/16/2012 12:42:59 | 3 | 0 | Extracting a table with Html Agility Pack | I am trying to extract a table from a webpage using Html Agility Pack. So far I have managed to do a little of progress with it. This is my code so far
Dim web As New HtmlAgilityPack.HtmlWeb()
Dim htmlDoc As HtmlAgilityPack.HtmlDocument = web.Load("--Website url--")
Dim html As String = htmlDoc.DocumentNode.OuterHtml
Dim tabletag = htmlDoc.DocumentNode.SelectNodes("//table")
Basically I need to find a table that appears after this html line
<caption>
Search Results
</caption>
Any Idea whether I'm going the right way, or should I do something else ??
thank you | html | vb.net | web-scraping | html-agility-pack | null | null | open | Extracting a table with Html Agility Pack
===
I am trying to extract a table from a webpage using Html Agility Pack. So far I have managed to do a little of progress with it. This is my code so far
Dim web As New HtmlAgilityPack.HtmlWeb()
Dim htmlDoc As HtmlAgilityPack.HtmlDocument = web.Load("--Website url--")
Dim html As String = htmlDoc.DocumentNode.OuterHtml
Dim tabletag = htmlDoc.DocumentNode.SelectNodes("//table")
Basically I need to find a table that appears after this html line
<caption>
Search Results
</caption>
Any Idea whether I'm going the right way, or should I do something else ??
thank you | 0 |
11,410,865 | 07/10/2012 09:59:59 | 1,374,693 | 05/04/2012 10:16:22 | 21 | 2 | dropjava loadjava |
I am trying to execute dropjava command to drop a jar file in the database. but it is giving me the following error:
ORA-29537: class or resource cannot be created or dropped directly
what is the problem?
| oracle | null | null | null | null | null | open | dropjava loadjava
===
I am trying to execute dropjava command to drop a jar file in the database. but it is giving me the following error:
ORA-29537: class or resource cannot be created or dropped directly
what is the problem?
| 0 |
11,410,867 | 07/10/2012 10:00:01 | 1,103,874 | 12/17/2011 20:20:55 | 20 | 0 | XCode universal App | I have a universal iOS app for iPad and iPhone. I created a class with a xib and its for the iPad. How do I design it for the iPhone now? Create another xib for iPhone? If so, how and where do I tell the app to load the xib for the iPhone when needed, because right now it loads the iPad xib and everything is too big of course.
Thanks in advance | ios | xcode | xib | null | null | null | open | XCode universal App
===
I have a universal iOS app for iPad and iPhone. I created a class with a xib and its for the iPad. How do I design it for the iPhone now? Create another xib for iPhone? If so, how and where do I tell the app to load the xib for the iPhone when needed, because right now it loads the iPad xib and everything is too big of course.
Thanks in advance | 0 |
11,410,877 | 07/10/2012 10:00:44 | 1,514,382 | 07/10/2012 09:51:07 | 1 | 0 | rewrite rule htacces not found | I want to rewrite my url from php extention to html.and if that file was not
found then it should redirect to some custome page(404.php).
I have written rule like this:
RewriteEngine on
RewriteRule ^$ front/index.php?query=$1 [NC,L,QSA]
RewriteRule (.*)\.(html) ?page=$1 [L,NC,QSA]
ErrorDocument 404 /expertLocal/?page=404
using this i am facing problem like this. http://somedomain.com/expertLocal/contact.html
it will work file coz i have contact.php page . if i will write
somedomain.com/expertLocal/contactxyz.php then it redirect to 404.php page but if
i will write http://somedomain.com/expertLocal/contactxyz.html in address bar then it
will give warnings instead of 404.php page.
This is because i ahve used my own framework and in this structure , requested file is first redirect to controller index file and then included requested file there.
include(FRONT_CONTROLLER_PATH . $page . '.php'); like this.
Can you please help me out?
Thanks in advance..
--
| .htaccess | mod-rewrite | errordocument | null | null | null | open | rewrite rule htacces not found
===
I want to rewrite my url from php extention to html.and if that file was not
found then it should redirect to some custome page(404.php).
I have written rule like this:
RewriteEngine on
RewriteRule ^$ front/index.php?query=$1 [NC,L,QSA]
RewriteRule (.*)\.(html) ?page=$1 [L,NC,QSA]
ErrorDocument 404 /expertLocal/?page=404
using this i am facing problem like this. http://somedomain.com/expertLocal/contact.html
it will work file coz i have contact.php page . if i will write
somedomain.com/expertLocal/contactxyz.php then it redirect to 404.php page but if
i will write http://somedomain.com/expertLocal/contactxyz.html in address bar then it
will give warnings instead of 404.php page.
This is because i ahve used my own framework and in this structure , requested file is first redirect to controller index file and then included requested file there.
include(FRONT_CONTROLLER_PATH . $page . '.php'); like this.
Can you please help me out?
Thanks in advance..
--
| 0 |
11,410,883 | 07/10/2012 10:01:06 | 204,659 | 11/06/2009 09:42:52 | 13 | 0 | Is it possible to load multiple texture files using three.js .obj file format loader? | I have .obj files each with several texture files. Does three.js comes out of the box with loading multiple textures for .obj files? Is there some example code for it? | textures | three.js | null | null | null | null | open | Is it possible to load multiple texture files using three.js .obj file format loader?
===
I have .obj files each with several texture files. Does three.js comes out of the box with loading multiple textures for .obj files? Is there some example code for it? | 0 |
11,410,884 | 07/10/2012 10:01:11 | 1,514,387 | 07/10/2012 09:52:50 | 1 | 0 | Divisibilty of binomial coefficient(nCk) with prime number(P) for large n and k | In mathematics, binomial coefficients are a family of positive integers that occur as coefficients in the binomial theorem. \tbinom nk denotes the number of ways of choosing k objects from n different objects.
However when n and k are too large, we often save them after modulo operation by a prime number P. Please calculate how many binomial coefficients of n become to 0 after modulo by P.
Input
The first of input is an integer T , the number of test cases.
Each of the following T lines contains 2 integers, n and prime P.
Output
For each test case, output a line contains the number of \tbinom nks (0<=k<=n) each of which after modulo operation by P is 0.
Sample Input
3
2 2
3 2
4 3
Sample Output
1
0
1
Since the constraints are very big,dynamic programming will not work.All i want is an idea | c++ | python | null | null | null | null | open | Divisibilty of binomial coefficient(nCk) with prime number(P) for large n and k
===
In mathematics, binomial coefficients are a family of positive integers that occur as coefficients in the binomial theorem. \tbinom nk denotes the number of ways of choosing k objects from n different objects.
However when n and k are too large, we often save them after modulo operation by a prime number P. Please calculate how many binomial coefficients of n become to 0 after modulo by P.
Input
The first of input is an integer T , the number of test cases.
Each of the following T lines contains 2 integers, n and prime P.
Output
For each test case, output a line contains the number of \tbinom nks (0<=k<=n) each of which after modulo operation by P is 0.
Sample Input
3
2 2
3 2
4 3
Sample Output
1
0
1
Since the constraints are very big,dynamic programming will not work.All i want is an idea | 0 |
11,571,845 | 07/20/2012 02:00:10 | 539,529 | 12/12/2010 12:31:20 | 214 | 9 | How can I include form elements from other objects? | I'm working a very simple forum software to help get my feet wet with ruby on rails. What I am trying to do is add a text area for the post content when a user creates a new topic, but every time I try to add it in the topic form, I get the following error:
NoMethodError in Topics#new
Showing /Users/Ken/dev/forums/app/views/topics/_form.html.erb where line #11 raised:
undefined method `merge' for :content:Symbol
Here's my new topic form:
<%= form_for @topic do |f| %>
<%= f.error_messages %>
<% if params[:forum] %>
<%= f.hidden_field :forum_id, :value => params[:forum] %>
<% end %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.text_area :post, :content %>
</p>
<p><%= f.submit "Create" %></p>
<% end %>
Here's my Topic model:
class Topic < ActiveRecord::Base
attr_accessible :name, :last_poster_id, :last_post_at
belongs_to :forum
has_many :posts, :dependent => :destroy
end
Here's my Post model:
class Post < ActiveRecord::Base
attr_accessible :content
belongs_to :topic
end
How can I get the text area working correctly in the topic form? Do I need to add it to the topic model in order to access it, and if so, how can I do that? | ruby-on-rails | ruby | null | null | null | null | open | How can I include form elements from other objects?
===
I'm working a very simple forum software to help get my feet wet with ruby on rails. What I am trying to do is add a text area for the post content when a user creates a new topic, but every time I try to add it in the topic form, I get the following error:
NoMethodError in Topics#new
Showing /Users/Ken/dev/forums/app/views/topics/_form.html.erb where line #11 raised:
undefined method `merge' for :content:Symbol
Here's my new topic form:
<%= form_for @topic do |f| %>
<%= f.error_messages %>
<% if params[:forum] %>
<%= f.hidden_field :forum_id, :value => params[:forum] %>
<% end %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.text_area :post, :content %>
</p>
<p><%= f.submit "Create" %></p>
<% end %>
Here's my Topic model:
class Topic < ActiveRecord::Base
attr_accessible :name, :last_poster_id, :last_post_at
belongs_to :forum
has_many :posts, :dependent => :destroy
end
Here's my Post model:
class Post < ActiveRecord::Base
attr_accessible :content
belongs_to :topic
end
How can I get the text area working correctly in the topic form? Do I need to add it to the topic model in order to access it, and if so, how can I do that? | 0 |
11,571,847 | 07/20/2012 02:00:31 | 1,302,430 | 03/30/2012 04:52:43 | 57 | 1 | PHP/MySQL - Using json encoded data instead of multiple columns in database | I was wondering if using some sort of serialized data whether it be json encoded or serialized etc. was better than using multiple columns in a mysql database.
Example:
If I have a "users" table, some columns would usually be: id, fullname, username, email, password etc.
But what if I used json data instead of having all these columns. Could I use just a 2 columns in my db table (id, data). So I could do something like this in php:
json_encode(array('username' => $_POST['username'], 'password' => md5($_POST['password'])));
And then insert it into a table with a column of "data" which would hold the json encoded array.
Later on in the script, I could just retrieve the 'data' column and use `json_decode($stuff_from_db, true)`
I'm sorry if this is a dumb question, I'm not really very knowledgeable about mysql and how it scales etc. But I would like to know if this would be a good or bad idea.
Thanks
| php | mysql | database | json-encode | null | null | open | PHP/MySQL - Using json encoded data instead of multiple columns in database
===
I was wondering if using some sort of serialized data whether it be json encoded or serialized etc. was better than using multiple columns in a mysql database.
Example:
If I have a "users" table, some columns would usually be: id, fullname, username, email, password etc.
But what if I used json data instead of having all these columns. Could I use just a 2 columns in my db table (id, data). So I could do something like this in php:
json_encode(array('username' => $_POST['username'], 'password' => md5($_POST['password'])));
And then insert it into a table with a column of "data" which would hold the json encoded array.
Later on in the script, I could just retrieve the 'data' column and use `json_decode($stuff_from_db, true)`
I'm sorry if this is a dumb question, I'm not really very knowledgeable about mysql and how it scales etc. But I would like to know if this would be a good or bad idea.
Thanks
| 0 |
11,571,849 | 07/20/2012 02:01:00 | 387,099 | 07/08/2010 19:42:51 | 1,512 | 66 | oAuth 2 server side vs client side | I'm trying to wrap my head around oauth2 and am comparing the server and client side flows. To me the server side flow sounds much more simpler - the user authorizes once and then everything remains on the server (converting the code to an access token, requests to the remote api, etc).
So, why would someone want to use the client-side flow?
One possible answer to that might be to reduce server traffic. Does anyone have any evidence that client-side reduces a significant amount of traffic from the server? | language-agnostic | oauth-2.0 | null | null | null | null | open | oAuth 2 server side vs client side
===
I'm trying to wrap my head around oauth2 and am comparing the server and client side flows. To me the server side flow sounds much more simpler - the user authorizes once and then everything remains on the server (converting the code to an access token, requests to the remote api, etc).
So, why would someone want to use the client-side flow?
One possible answer to that might be to reduce server traffic. Does anyone have any evidence that client-side reduces a significant amount of traffic from the server? | 0 |
11,571,852 | 07/20/2012 02:01:15 | 65,281 | 02/11/2009 20:41:11 | 36 | 2 | ListFragment Not Rendering and getView() in Adapter Not Being Called | From what I can gather it appears that this might be because my ListView is not being displayed, I've verified that getCount is returning a value not zero, but I can't see what I'm doing wrong.
Everything loads and acts like it's working but the ListView never appears, I put a background color on the fragment reference in mixed.xml and it is there and taking up the full screen, but when I set a background color on my ListView it does not appear, it's like it's not being rendered at all.
More odd, getView is not being called in my adapter, and this is all working code from regular activities that I ported to fragments.
I've tried calling notifyDataSetChanged which didn't changed anything, debugging shows the adapter is filled with data and getCount is indeed returning an accurate count greater than 0.
Thanks for any help, I'm stuck.
Project is open and can be viewed here http://code.google.com/p/shack-droid/source/browse/#svn%2FTrunk but I'm also including the pertinent code here.
This is the ListFragment:
public class FragmentTopicView extends ListFragment implements ShackGestureEvent {
private ArrayList<ShackPost> posts;
private String storyID = null;
private String errorText = "";
private Integer currentPage = 1;
private Integer storyPages = 1;
private String loadStoryID = null;
private Boolean threadLoaded = true;
private Hashtable<String, String> postCounts = null;
private AdapterLimerifficTopic tva;
public FragmentTopicView() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.topics, null);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final ShackGestureListener listener = Helper.setGestureEnabledContentView(R.layout.topics, getActivity());
if (listener != null) {
listener.addListener(this);
}
if (savedInstanceState == null) {
// get the list of topics
GetChattyAsyncTask chatty = new GetChattyAsyncTask(getActivity());
chatty.execute();
}
ListView lv = getListView();
lv.setOnScrollListener(new OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// start loading the next page
if (threadLoaded && firstVisibleItem + visibleItemCount >= totalItemCount && currentPage + 1 <= storyPages) {
// get the list of topics
currentPage++;
GetChattyAsyncTask chatty = new GetChattyAsyncTask(getActivity());
chatty.execute();
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
});
}
class GetChattyAsyncTask extends AsyncTask<String, Void, Void> {
protected ProgressDialog dialog;
protected Context c;
public GetChattyAsyncTask(Context context) {
this.c = context;
}
@Override
protected Void doInBackground(String... params) {
threadLoaded = false;
try {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
final String feedURL = prefs.getString("shackFeedURL", getString(R.string.default_api));
final URL url;
if (loadStoryID != null) {
if (currentPage > 1)
url = new URL(feedURL + "/" + loadStoryID + "." + currentPage.toString() + ".xml");
else
url = new URL(feedURL + "/" + loadStoryID + ".xml");
}
else {
if (currentPage > 1)
url = new URL(feedURL + "/" + storyID + "." + currentPage.toString() + ".xml");
else
url = new URL(feedURL + "/index.xml");
}
// Get a SAXParser from the SAXPArserFactory.
final SAXParserFactory spf = SAXParserFactory.newInstance();
final SAXParser sp = spf.newSAXParser();
// Get the XMLReader of the SAXParser we created.
final XMLReader xr = sp.getXMLReader();
// Create a new ContentHandler and apply it to the XML-Reader
SaxHandlerTopicView saxHandler = new SaxHandlerTopicView(c, "topic");
xr.setContentHandler(saxHandler);
// Parse the xml-data from our URL.
xr.parse(new InputSource(HttpHelper.HttpRequestWithGzip(url.toString(), c)));
// Our ExampleHandler now provides the parsed data to us.
if (posts == null) {
posts = saxHandler.GetParsedPosts();
}
else {
ArrayList<ShackPost> newPosts = saxHandler.GetParsedPosts();
newPosts.removeAll(posts);
posts.addAll(posts.size(), newPosts);
}
storyID = saxHandler.getStoryID();
storyPages = saxHandler.getStoryPageCount();
if (storyPages == 0) // XML returns a 0 for stories with only
// one page
storyPages = 1;
}
catch (Exception ex) {
// TODO: implement error handling
}
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
if (currentPage == 1)
dialog = ProgressDialog.show(getActivity(), null, "Loading Chatty", true, true);
else
SetLoaderVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
ShowData();
SetLoaderVisibility(View.GONE);
try {
dialog.dismiss();
}
catch (Exception e) {
}
}
}
private void ShowData() {
if (posts != null) {
Hashtable<String, String> tempHash = null;
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
final String login = prefs.getString("shackLogin", "");
final int fontSize = Integer.parseInt(prefs.getString("fontSize", "12"));
try {
postCounts = GetPostCache();
}
catch (Exception ex) {
}
if (postCounts != null)
tempHash = new Hashtable<String, String>(postCounts);
if (tva == null) {
tva = new AdapterLimerifficTopic(getActivity(), R.layout.lime_topic_row, posts, login, fontSize, tempHash);
setListAdapter(tva);
}
else {
tva.SetPosts(posts);
tva.notifyDataSetChanged();
}
final ListView lv = getListView();
lv.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
menu.setHeaderTitle("Options");
menu.add(0, 1, 0, "Copy Post Url to Clipboard");
menu.add(0, 2, 0, "Watch Thread");
menu.add(0, 3, 0, "Thread Expires In?");
menu.add(0, 4, 0, "Shacker's Chatty Profile");
}
});
// update the reply counts for the listing of topics
try {
UpdatePostCache();
}
catch (Exception e) {
}
}
else {
if (errorText.length() > 0) {
try {
new AlertDialog.Builder(getActivity()).setTitle("Error").setPositiveButton("OK", null).setMessage(errorText).show();
}
catch (Exception ex) {
// could not create a alert for the error for one reason
// or another
Log.e("ShackDroid", "Unable to create error alert ActivityTopicView:468");
}
}
}
threadLoaded = true;
}
}
Here's my FragmentActivity:
public class FragmentActivityTopic extends FragmentActivity {
@Override
protected void onCreate(Bundle arg) {
// TODO Auto-generated method stub
super.onCreate(arg);
setContentView(R.layout.mixed);
}
}
This is the Adapter I'm using, and as mentioned above getView is not being called:
public class AdapterLimerifficTopic extends BaseAdapter {
// private Context context;
private List<ShackPost> topicList;
private final int rowResouceID;
private final String shackLogin;
private final Typeface face;
private final int fontSize;
private final Hashtable<String, String> postCache;
private final String showAuthor;
private final Resources r;
private int totalNewPosts = 0;
LayoutInflater inflate;// = LayoutInflater.from(context);
public AdapterLimerifficTopic(Context context, int rowResouceID, List<ShackPost> topicList, String shackLogin, int fontSize, Hashtable<String, String> postCache) {
this.topicList = topicList;
this.rowResouceID = rowResouceID;
this.shackLogin = shackLogin;
this.fontSize = fontSize;
this.postCache = postCache;
this.r = context.getResources();
face = Typeface.createFromAsset(context.getAssets(), "fonts/arial.ttf");
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
showAuthor = prefs.getString("showAuthor", "count");
inflate = LayoutInflater.from(context);
}
public void SetPosts(List<ShackPost> posts)
{
topicList = posts;
}
@Override
public int getCount() {
return topicList.size();
}
@Override
public Object getItem(int position) {
return topicList.get(position);
}
@Override
public long getItemId(int position) {
// return position;
final ShackPost post = topicList.get(position);
return Long.parseLong(post.getPostID());
}
static class ViewHolder {
TextView posterName;
TextView datePosted;
TextView replyCount;
TextView newPosts;
TextView postText;
TextView viewCat;
RelativeLayout topicRow;
ImageView postTimer;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TextView tmp;
// final View v;
ViewHolder holder;
final ShackPost post = topicList.get(position);
if (convertView == null) {
convertView = inflate.inflate(rowResouceID, parent, false);
holder = new ViewHolder();
holder.posterName = (TextView) convertView.findViewById(R.id.TextViewLimeAuthor);
holder.datePosted = (TextView) convertView.findViewById(R.id.TextViewLimePostDate);
holder.replyCount = (TextView) convertView.findViewById(R.id.TextViewLimePosts);
holder.newPosts = (TextView) convertView.findViewById(R.id.TextViewLimeNewPosts);
holder.postText = (TextView) convertView.findViewById(R.id.TextViewLimePostText);
holder.viewCat = (TextView) convertView.findViewById(R.id.TextViewLimeModTag);
// holder.topicRow = (RelativeLayout) convertView.findViewById(R.id.TopicRow);
// holder.postTimer = (ImageView) convertView.findViewById(R.id.ImageViewTopicTimer);
// holder.posterName.setTypeface(face);
// holder.datePosted.setTypeface(face);
// holder.replyCount.setTypeface(face);
// holder.newPosts.setTypeface(face);
holder.postText.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
// holder.postText.setTypeface(face);
convertView.setTag(holder);
}
else {
holder = (ViewHolder) convertView.getTag();
}
// holder.postTimer.setImageResource(Helper.GetTimeLeftDrawable(post.getPostDate()));
//
holder.posterName.setText(post.getPosterName());
//
// if (shackLogin.equalsIgnoreCase(post.getPosterName()))
// holder.posterName.setTextColor(Color.parseColor("#00BFF3"));
// else
// holder.posterName.setTextColor(Color.parseColor("#ffba00"));
//
holder.datePosted.setText(Helper.FormatShackDateToTimePassed(post.getPostDate()));
holder.replyCount.setText(post.getReplyCount());
//
// if (showAuthor.equalsIgnoreCase("count") && post.getIsAuthorInThread())
// holder.replyCount.setTextColor(Color.parseColor("#0099CC"));
// else
// holder.replyCount.setTextColor(Color.parseColor("#FFFFFF"));
// clipped code
holder.postText.setText(preview);
// if (showAuthor.equalsIgnoreCase("topic") && post.getIsAuthorInThread()) {
// final Drawable d = r.getDrawable(R.drawable.background_gradient_blue);
// holder.topicRow.setBackgroundDrawable(d);
// }
// else
// holder.topicRow.setBackgroundDrawable(null);
// TODO: clean this up a little / also replicated in ShackDroidThread ick
final String postCat = post.getPostCategory();
holder.viewCat.setVisibility(View.VISIBLE);
if (postCat.equals("offtopic")) {
holder.viewCat.setText("offtopic");
holder.viewCat.setBackgroundColor(Color.parseColor("#444444"));
}
else if (postCat.equals("nws")) {
holder.viewCat.setText("nws");
holder.viewCat.setBackgroundColor(Color.parseColor("#CC0000"));
}
else if (postCat.equals("political")) {
holder.viewCat.setText("political");
holder.viewCat.setBackgroundColor(Color.parseColor("#FF8800"));
}
else if (postCat.equals("stupid")) {
holder.viewCat.setText("stupid");
holder.viewCat.setBackgroundColor(Color.parseColor("#669900"));
}
else if (postCat.equals("informative")) {
holder.viewCat.setText("interesting");
holder.viewCat.setBackgroundColor(Color.parseColor("#0099CC"));
}
else
holder.viewCat.setVisibility(View.GONE);
return convertView;
}
public int getTotalNewPosts() {
return totalNewPosts;
}
}
And related XML:
mixed.xml (this is the layout for the fragments, only the one for now)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/LinearLayoutMixed">
<fragment
android:id="@+id/MixedThreads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.stonedonkey.shackdroid.FragmentTopicView"
>
</fragment>
</LinearLayout>
Topics.xml (this contains the ListView as well as a sliding tray and some other stuff.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/TopicLoader"
android:divider="#333333"
android:dividerHeight="1dip"
android:textColor="#FFFFFF"
/>
<RelativeLayout
android:id="@+id/TopicLoader"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:visibility="gone"
android:layout_marginTop="5dip" >
<TextView
android:id="@+id/TextViewTopicLoaderText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Loading"
>
</TextView>
<ImageView
android:id="@+id/ImageViewTopicLoader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/TextViewTopicLoaderText"
android:src="@drawable/ic_action_refresh"
android:layout_alignBottom="@+id/TextViewTopicLoaderText"
/>
</RelativeLayout>
<SlidingDrawer
android:id="@+id/SlidingDrawer01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/TopicLoader"
android:animateOnClick="true"
android:content="@+id/bookMarkParent"
android:handle="@+id/TextViewTrayHandle"
android:orientation="vertical"
android:paddingTop="200dip"
android:visibility="gone" >
<TextView
android:id="@+id/TextViewTrayHandle"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:background="@drawable/darkgrey_gradient"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical" >
</TextView>
<RelativeLayout
android:id="@id/bookMarkParent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/ListViewWatchedThreads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#333333"
android:dividerHeight="1dip"
android:textColor="#FFFFFF" >
</ListView>
</RelativeLayout>
</SlidingDrawer>
</RelativeLayout>
and finally lime_topic_row which is my custom row layout for the ListView in the above layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FF0000" >
<TextView
android:id="@+id/TextViewLimeModTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dip"
android:textColor="#000000"
android:padding="2dip"
android:textSize="10dip"
/>
<TextView
android:id="@+id/TextViewLimePostText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="20dip"
android:padding="10dip"
android:layout_below="@+id/TextViewLimeModTag"
android:textColor="#FFFFFF" />
<TextView
android:id="@+id/TextViewLimeAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TextViewLimePostText"
android:paddingBottom="10dip"
android:paddingLeft="10dip"
android:textColor="#0099CC" />
<TextView
android:id="@+id/TextViewPosted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TextViewLimePostText"
android:layout_toRightOf="@+id/TextViewLimeAuthor"
android:paddingBottom="10dip"
android:text=" posted " />
<TextView
android:id="@+id/TextViewLimePostDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TextViewLimePostText"
android:layout_toRightOf="@+id/TextViewPosted"
android:paddingBottom="10dip"
android:paddingRight="10dip"
android:textColor="#FF8800" />
<TextView
android:id="@+id/TextViewLimePosts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/TextViewLimePostDate"
android:layout_marginRight="3dip"
android:layout_below="@+id/TextViewLimePostText"
android:layout_marginBottom="15dip"
android:layout_toLeftOf="@+id/TextViewLimeNewPosts"
android:background="#BBBBBB"
android:padding="3dip"
android:minWidth="25dip"
android:gravity="center"
android:textColor="#000000" />
<TextView
android:id="@+id/TextViewLimeNewPosts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/TextViewLimePostDate"
android:layout_below="@+id/TextViewLimePostText"
android:layout_marginBottom="15dip"
android:layout_marginRight="10dip"
android:background="#669900"
android:padding="3dip"
android:minWidth="25dip"
android:gravity="center"
android:layout_alignParentRight="true"
android:textColor="#000000" />
</RelativeLayout>
| android | android-fragments | listadapter | android-listfragment | null | null | open | ListFragment Not Rendering and getView() in Adapter Not Being Called
===
From what I can gather it appears that this might be because my ListView is not being displayed, I've verified that getCount is returning a value not zero, but I can't see what I'm doing wrong.
Everything loads and acts like it's working but the ListView never appears, I put a background color on the fragment reference in mixed.xml and it is there and taking up the full screen, but when I set a background color on my ListView it does not appear, it's like it's not being rendered at all.
More odd, getView is not being called in my adapter, and this is all working code from regular activities that I ported to fragments.
I've tried calling notifyDataSetChanged which didn't changed anything, debugging shows the adapter is filled with data and getCount is indeed returning an accurate count greater than 0.
Thanks for any help, I'm stuck.
Project is open and can be viewed here http://code.google.com/p/shack-droid/source/browse/#svn%2FTrunk but I'm also including the pertinent code here.
This is the ListFragment:
public class FragmentTopicView extends ListFragment implements ShackGestureEvent {
private ArrayList<ShackPost> posts;
private String storyID = null;
private String errorText = "";
private Integer currentPage = 1;
private Integer storyPages = 1;
private String loadStoryID = null;
private Boolean threadLoaded = true;
private Hashtable<String, String> postCounts = null;
private AdapterLimerifficTopic tva;
public FragmentTopicView() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.topics, null);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final ShackGestureListener listener = Helper.setGestureEnabledContentView(R.layout.topics, getActivity());
if (listener != null) {
listener.addListener(this);
}
if (savedInstanceState == null) {
// get the list of topics
GetChattyAsyncTask chatty = new GetChattyAsyncTask(getActivity());
chatty.execute();
}
ListView lv = getListView();
lv.setOnScrollListener(new OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// start loading the next page
if (threadLoaded && firstVisibleItem + visibleItemCount >= totalItemCount && currentPage + 1 <= storyPages) {
// get the list of topics
currentPage++;
GetChattyAsyncTask chatty = new GetChattyAsyncTask(getActivity());
chatty.execute();
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
});
}
class GetChattyAsyncTask extends AsyncTask<String, Void, Void> {
protected ProgressDialog dialog;
protected Context c;
public GetChattyAsyncTask(Context context) {
this.c = context;
}
@Override
protected Void doInBackground(String... params) {
threadLoaded = false;
try {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
final String feedURL = prefs.getString("shackFeedURL", getString(R.string.default_api));
final URL url;
if (loadStoryID != null) {
if (currentPage > 1)
url = new URL(feedURL + "/" + loadStoryID + "." + currentPage.toString() + ".xml");
else
url = new URL(feedURL + "/" + loadStoryID + ".xml");
}
else {
if (currentPage > 1)
url = new URL(feedURL + "/" + storyID + "." + currentPage.toString() + ".xml");
else
url = new URL(feedURL + "/index.xml");
}
// Get a SAXParser from the SAXPArserFactory.
final SAXParserFactory spf = SAXParserFactory.newInstance();
final SAXParser sp = spf.newSAXParser();
// Get the XMLReader of the SAXParser we created.
final XMLReader xr = sp.getXMLReader();
// Create a new ContentHandler and apply it to the XML-Reader
SaxHandlerTopicView saxHandler = new SaxHandlerTopicView(c, "topic");
xr.setContentHandler(saxHandler);
// Parse the xml-data from our URL.
xr.parse(new InputSource(HttpHelper.HttpRequestWithGzip(url.toString(), c)));
// Our ExampleHandler now provides the parsed data to us.
if (posts == null) {
posts = saxHandler.GetParsedPosts();
}
else {
ArrayList<ShackPost> newPosts = saxHandler.GetParsedPosts();
newPosts.removeAll(posts);
posts.addAll(posts.size(), newPosts);
}
storyID = saxHandler.getStoryID();
storyPages = saxHandler.getStoryPageCount();
if (storyPages == 0) // XML returns a 0 for stories with only
// one page
storyPages = 1;
}
catch (Exception ex) {
// TODO: implement error handling
}
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
if (currentPage == 1)
dialog = ProgressDialog.show(getActivity(), null, "Loading Chatty", true, true);
else
SetLoaderVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
ShowData();
SetLoaderVisibility(View.GONE);
try {
dialog.dismiss();
}
catch (Exception e) {
}
}
}
private void ShowData() {
if (posts != null) {
Hashtable<String, String> tempHash = null;
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
final String login = prefs.getString("shackLogin", "");
final int fontSize = Integer.parseInt(prefs.getString("fontSize", "12"));
try {
postCounts = GetPostCache();
}
catch (Exception ex) {
}
if (postCounts != null)
tempHash = new Hashtable<String, String>(postCounts);
if (tva == null) {
tva = new AdapterLimerifficTopic(getActivity(), R.layout.lime_topic_row, posts, login, fontSize, tempHash);
setListAdapter(tva);
}
else {
tva.SetPosts(posts);
tva.notifyDataSetChanged();
}
final ListView lv = getListView();
lv.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
menu.setHeaderTitle("Options");
menu.add(0, 1, 0, "Copy Post Url to Clipboard");
menu.add(0, 2, 0, "Watch Thread");
menu.add(0, 3, 0, "Thread Expires In?");
menu.add(0, 4, 0, "Shacker's Chatty Profile");
}
});
// update the reply counts for the listing of topics
try {
UpdatePostCache();
}
catch (Exception e) {
}
}
else {
if (errorText.length() > 0) {
try {
new AlertDialog.Builder(getActivity()).setTitle("Error").setPositiveButton("OK", null).setMessage(errorText).show();
}
catch (Exception ex) {
// could not create a alert for the error for one reason
// or another
Log.e("ShackDroid", "Unable to create error alert ActivityTopicView:468");
}
}
}
threadLoaded = true;
}
}
Here's my FragmentActivity:
public class FragmentActivityTopic extends FragmentActivity {
@Override
protected void onCreate(Bundle arg) {
// TODO Auto-generated method stub
super.onCreate(arg);
setContentView(R.layout.mixed);
}
}
This is the Adapter I'm using, and as mentioned above getView is not being called:
public class AdapterLimerifficTopic extends BaseAdapter {
// private Context context;
private List<ShackPost> topicList;
private final int rowResouceID;
private final String shackLogin;
private final Typeface face;
private final int fontSize;
private final Hashtable<String, String> postCache;
private final String showAuthor;
private final Resources r;
private int totalNewPosts = 0;
LayoutInflater inflate;// = LayoutInflater.from(context);
public AdapterLimerifficTopic(Context context, int rowResouceID, List<ShackPost> topicList, String shackLogin, int fontSize, Hashtable<String, String> postCache) {
this.topicList = topicList;
this.rowResouceID = rowResouceID;
this.shackLogin = shackLogin;
this.fontSize = fontSize;
this.postCache = postCache;
this.r = context.getResources();
face = Typeface.createFromAsset(context.getAssets(), "fonts/arial.ttf");
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
showAuthor = prefs.getString("showAuthor", "count");
inflate = LayoutInflater.from(context);
}
public void SetPosts(List<ShackPost> posts)
{
topicList = posts;
}
@Override
public int getCount() {
return topicList.size();
}
@Override
public Object getItem(int position) {
return topicList.get(position);
}
@Override
public long getItemId(int position) {
// return position;
final ShackPost post = topicList.get(position);
return Long.parseLong(post.getPostID());
}
static class ViewHolder {
TextView posterName;
TextView datePosted;
TextView replyCount;
TextView newPosts;
TextView postText;
TextView viewCat;
RelativeLayout topicRow;
ImageView postTimer;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TextView tmp;
// final View v;
ViewHolder holder;
final ShackPost post = topicList.get(position);
if (convertView == null) {
convertView = inflate.inflate(rowResouceID, parent, false);
holder = new ViewHolder();
holder.posterName = (TextView) convertView.findViewById(R.id.TextViewLimeAuthor);
holder.datePosted = (TextView) convertView.findViewById(R.id.TextViewLimePostDate);
holder.replyCount = (TextView) convertView.findViewById(R.id.TextViewLimePosts);
holder.newPosts = (TextView) convertView.findViewById(R.id.TextViewLimeNewPosts);
holder.postText = (TextView) convertView.findViewById(R.id.TextViewLimePostText);
holder.viewCat = (TextView) convertView.findViewById(R.id.TextViewLimeModTag);
// holder.topicRow = (RelativeLayout) convertView.findViewById(R.id.TopicRow);
// holder.postTimer = (ImageView) convertView.findViewById(R.id.ImageViewTopicTimer);
// holder.posterName.setTypeface(face);
// holder.datePosted.setTypeface(face);
// holder.replyCount.setTypeface(face);
// holder.newPosts.setTypeface(face);
holder.postText.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
// holder.postText.setTypeface(face);
convertView.setTag(holder);
}
else {
holder = (ViewHolder) convertView.getTag();
}
// holder.postTimer.setImageResource(Helper.GetTimeLeftDrawable(post.getPostDate()));
//
holder.posterName.setText(post.getPosterName());
//
// if (shackLogin.equalsIgnoreCase(post.getPosterName()))
// holder.posterName.setTextColor(Color.parseColor("#00BFF3"));
// else
// holder.posterName.setTextColor(Color.parseColor("#ffba00"));
//
holder.datePosted.setText(Helper.FormatShackDateToTimePassed(post.getPostDate()));
holder.replyCount.setText(post.getReplyCount());
//
// if (showAuthor.equalsIgnoreCase("count") && post.getIsAuthorInThread())
// holder.replyCount.setTextColor(Color.parseColor("#0099CC"));
// else
// holder.replyCount.setTextColor(Color.parseColor("#FFFFFF"));
// clipped code
holder.postText.setText(preview);
// if (showAuthor.equalsIgnoreCase("topic") && post.getIsAuthorInThread()) {
// final Drawable d = r.getDrawable(R.drawable.background_gradient_blue);
// holder.topicRow.setBackgroundDrawable(d);
// }
// else
// holder.topicRow.setBackgroundDrawable(null);
// TODO: clean this up a little / also replicated in ShackDroidThread ick
final String postCat = post.getPostCategory();
holder.viewCat.setVisibility(View.VISIBLE);
if (postCat.equals("offtopic")) {
holder.viewCat.setText("offtopic");
holder.viewCat.setBackgroundColor(Color.parseColor("#444444"));
}
else if (postCat.equals("nws")) {
holder.viewCat.setText("nws");
holder.viewCat.setBackgroundColor(Color.parseColor("#CC0000"));
}
else if (postCat.equals("political")) {
holder.viewCat.setText("political");
holder.viewCat.setBackgroundColor(Color.parseColor("#FF8800"));
}
else if (postCat.equals("stupid")) {
holder.viewCat.setText("stupid");
holder.viewCat.setBackgroundColor(Color.parseColor("#669900"));
}
else if (postCat.equals("informative")) {
holder.viewCat.setText("interesting");
holder.viewCat.setBackgroundColor(Color.parseColor("#0099CC"));
}
else
holder.viewCat.setVisibility(View.GONE);
return convertView;
}
public int getTotalNewPosts() {
return totalNewPosts;
}
}
And related XML:
mixed.xml (this is the layout for the fragments, only the one for now)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/LinearLayoutMixed">
<fragment
android:id="@+id/MixedThreads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.stonedonkey.shackdroid.FragmentTopicView"
>
</fragment>
</LinearLayout>
Topics.xml (this contains the ListView as well as a sliding tray and some other stuff.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/TopicLoader"
android:divider="#333333"
android:dividerHeight="1dip"
android:textColor="#FFFFFF"
/>
<RelativeLayout
android:id="@+id/TopicLoader"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:visibility="gone"
android:layout_marginTop="5dip" >
<TextView
android:id="@+id/TextViewTopicLoaderText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Loading"
>
</TextView>
<ImageView
android:id="@+id/ImageViewTopicLoader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/TextViewTopicLoaderText"
android:src="@drawable/ic_action_refresh"
android:layout_alignBottom="@+id/TextViewTopicLoaderText"
/>
</RelativeLayout>
<SlidingDrawer
android:id="@+id/SlidingDrawer01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/TopicLoader"
android:animateOnClick="true"
android:content="@+id/bookMarkParent"
android:handle="@+id/TextViewTrayHandle"
android:orientation="vertical"
android:paddingTop="200dip"
android:visibility="gone" >
<TextView
android:id="@+id/TextViewTrayHandle"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:background="@drawable/darkgrey_gradient"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical" >
</TextView>
<RelativeLayout
android:id="@id/bookMarkParent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/ListViewWatchedThreads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#333333"
android:dividerHeight="1dip"
android:textColor="#FFFFFF" >
</ListView>
</RelativeLayout>
</SlidingDrawer>
</RelativeLayout>
and finally lime_topic_row which is my custom row layout for the ListView in the above layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FF0000" >
<TextView
android:id="@+id/TextViewLimeModTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dip"
android:textColor="#000000"
android:padding="2dip"
android:textSize="10dip"
/>
<TextView
android:id="@+id/TextViewLimePostText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="20dip"
android:padding="10dip"
android:layout_below="@+id/TextViewLimeModTag"
android:textColor="#FFFFFF" />
<TextView
android:id="@+id/TextViewLimeAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TextViewLimePostText"
android:paddingBottom="10dip"
android:paddingLeft="10dip"
android:textColor="#0099CC" />
<TextView
android:id="@+id/TextViewPosted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TextViewLimePostText"
android:layout_toRightOf="@+id/TextViewLimeAuthor"
android:paddingBottom="10dip"
android:text=" posted " />
<TextView
android:id="@+id/TextViewLimePostDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TextViewLimePostText"
android:layout_toRightOf="@+id/TextViewPosted"
android:paddingBottom="10dip"
android:paddingRight="10dip"
android:textColor="#FF8800" />
<TextView
android:id="@+id/TextViewLimePosts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/TextViewLimePostDate"
android:layout_marginRight="3dip"
android:layout_below="@+id/TextViewLimePostText"
android:layout_marginBottom="15dip"
android:layout_toLeftOf="@+id/TextViewLimeNewPosts"
android:background="#BBBBBB"
android:padding="3dip"
android:minWidth="25dip"
android:gravity="center"
android:textColor="#000000" />
<TextView
android:id="@+id/TextViewLimeNewPosts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/TextViewLimePostDate"
android:layout_below="@+id/TextViewLimePostText"
android:layout_marginBottom="15dip"
android:layout_marginRight="10dip"
android:background="#669900"
android:padding="3dip"
android:minWidth="25dip"
android:gravity="center"
android:layout_alignParentRight="true"
android:textColor="#000000" />
</RelativeLayout>
| 0 |
11,571,705 | 07/20/2012 01:39:02 | 523,507 | 11/29/2010 05:52:04 | 1,897 | 58 | android layout image fill width | I need to strech a background image for a layout in my app,
please note, the yellow background in my layout is not streched
![enter image description here][1]
how to accomplish this [yellow bar image filling parent]?
also please note that the blue layout is not the whole width of the screen, how to?
code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:id="@+id/myfragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#0000FF">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/titlebar" />
</LinearLayout>
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
</LinearLayout>
Thanks a lot!
[1]: http://i.stack.imgur.com/vydlH.png | android | android-layout | null | null | null | null | open | android layout image fill width
===
I need to strech a background image for a layout in my app,
please note, the yellow background in my layout is not streched
![enter image description here][1]
how to accomplish this [yellow bar image filling parent]?
also please note that the blue layout is not the whole width of the screen, how to?
code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:id="@+id/myfragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#0000FF">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/titlebar" />
</LinearLayout>
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
</LinearLayout>
Thanks a lot!
[1]: http://i.stack.imgur.com/vydlH.png | 0 |
11,571,422 | 07/20/2012 00:54:30 | 1,518,538 | 07/11/2012 17:13:54 | 1 | 0 | add font to jailbreak tweak | I am creating a non app store, jailbreak tweak and i would like to add a custom font to it.
I know how the whole UIAppFonts, fonts provided by application, thing works and how to check system fonts, but I don't know where to actually put the .ttf file.
I am assuming it is in the Resources folder except with it being a jailbreak tweak it doesn't have a designated Resources folder, how do i designate one that my app will know where to read it from?
Is there a way to load fonts by using "withContentsOfFile:"
any help is appreciated.
Thanks | objective-c | ios | resources | jailbreak | custom-font | null | open | add font to jailbreak tweak
===
I am creating a non app store, jailbreak tweak and i would like to add a custom font to it.
I know how the whole UIAppFonts, fonts provided by application, thing works and how to check system fonts, but I don't know where to actually put the .ttf file.
I am assuming it is in the Resources folder except with it being a jailbreak tweak it doesn't have a designated Resources folder, how do i designate one that my app will know where to read it from?
Is there a way to load fonts by using "withContentsOfFile:"
any help is appreciated.
Thanks | 0 |
11,571,863 | 07/20/2012 02:02:20 | 1,466,418 | 06/19/2012 12:31:14 | 28 | 1 | How to use Excel VBA to click a web CSS button? | I am creating a macro with Excel VBA that will submit an entry into an online database using information from an Excel spreadsheet. During this entry process, the macro needs to click on a CSS button. It isn't a form button, does not have an input type, no name, no id, and no source image except for a background image. I think my only hopes are either to click on the button based on the div class. Can anyone help?
The button is here :
<div class="v-captiontext">By Ankit</div>
<td class="v-tabsheet-tabitemcell v-tabsheet-tabitemcell-selected" style=""><div class="v- tabsheet-tabitem v-tabsheet-tabitem-selected"><div class="v-caption" style="width: 39px; "> <div class="v-captiontext">By LOT</div><div class="v-caption-clearelem"></div></div></div> </td>
| css | excel | excel-vba | null | null | null | open | How to use Excel VBA to click a web CSS button?
===
I am creating a macro with Excel VBA that will submit an entry into an online database using information from an Excel spreadsheet. During this entry process, the macro needs to click on a CSS button. It isn't a form button, does not have an input type, no name, no id, and no source image except for a background image. I think my only hopes are either to click on the button based on the div class. Can anyone help?
The button is here :
<div class="v-captiontext">By Ankit</div>
<td class="v-tabsheet-tabitemcell v-tabsheet-tabitemcell-selected" style=""><div class="v- tabsheet-tabitem v-tabsheet-tabitem-selected"><div class="v-caption" style="width: 39px; "> <div class="v-captiontext">By LOT</div><div class="v-caption-clearelem"></div></div></div> </td>
| 0 |
11,571,865 | 07/20/2012 02:02:37 | 1,155,683 | 01/18/2012 07:55:47 | 85 | 0 | HOw can i knows the "providers" column in symfony2 custom user provider | I am not able to find what are the other options for providers in symfony secirity
e,g
This link http://symfony.com/doc/current/cookbook/security/custom_provider.html
says that
security:
providers:
webservice:
id: webservice_user_provider
Now i know that id is the service id of the class which implements user providerinterface
But what is `webservice` here , how can i get it
and laso what is the diff between this code and code above
providers:
administrators:
entity: { class: AcmeUserBundle:User}
I am confused whether i need to use User as Entity there or UserManager which implements userproviderinterface there | php | symfony-2.0 | user | null | null | null | open | HOw can i knows the "providers" column in symfony2 custom user provider
===
I am not able to find what are the other options for providers in symfony secirity
e,g
This link http://symfony.com/doc/current/cookbook/security/custom_provider.html
says that
security:
providers:
webservice:
id: webservice_user_provider
Now i know that id is the service id of the class which implements user providerinterface
But what is `webservice` here , how can i get it
and laso what is the diff between this code and code above
providers:
administrators:
entity: { class: AcmeUserBundle:User}
I am confused whether i need to use User as Entity there or UserManager which implements userproviderinterface there | 0 |
11,350,570 | 07/05/2012 18:43:43 | 626,611 | 02/21/2011 12:55:48 | 17 | 0 | How to parse a json string alert | Hi how i can parse this json string: <code>{"Error":true, "data":["not available","somethinghere"]}</code>
but i get it from a software example:
<code>alert(ff.Result.value);</code>
i have that alert and the value of
<code>Result = {"Error":true, "data":["not available","somethinghere"]}</code>
i would like to parse and just show in a div this part "not available" without quotes. | javascript | html | json | null | null | null | open | How to parse a json string alert
===
Hi how i can parse this json string: <code>{"Error":true, "data":["not available","somethinghere"]}</code>
but i get it from a software example:
<code>alert(ff.Result.value);</code>
i have that alert and the value of
<code>Result = {"Error":true, "data":["not available","somethinghere"]}</code>
i would like to parse and just show in a div this part "not available" without quotes. | 0 |
11,350,572 | 07/05/2012 18:43:44 | 1,413,395 | 05/23/2012 18:53:38 | 374 | 30 | Debugging a sharp develop .dll assembly using an executable | I have a sharpdevelop project that resembles a COM interop .dll assembly, that I want to debug by starting the client executable. Attaching to this process when it's already running works fine, but when I want to run the project the IDE complains that the project is configured as .dll and no execution command is supplied. The message also says, that an execution command can be specified in the project options.
The appearantly only relevant form I could find in the 'Debug' tab, where I have filled in 'Start external program', 'Command line' and 'Working Directory' options.
But running the project still complains that no executable is set.
Does anyone know where/how to set this option? | c# | debugging | sharpdevelop | null | null | null | open | Debugging a sharp develop .dll assembly using an executable
===
I have a sharpdevelop project that resembles a COM interop .dll assembly, that I want to debug by starting the client executable. Attaching to this process when it's already running works fine, but when I want to run the project the IDE complains that the project is configured as .dll and no execution command is supplied. The message also says, that an execution command can be specified in the project options.
The appearantly only relevant form I could find in the 'Debug' tab, where I have filled in 'Start external program', 'Command line' and 'Working Directory' options.
But running the project still complains that no executable is set.
Does anyone know where/how to set this option? | 0 |
11,350,578 | 07/05/2012 18:44:09 | 1,104,766 | 12/18/2011 18:03:14 | 88 | 0 | Shopping Cart/Billing address logic | As some of you may know (if you read my 24932049023 previous questions :P) I'm working on a shopping site.
The payments will be processed by PayPal and I was wondering if I really need to have my user's Billing Address in that case. It's not like I have to verify their credit cart authenticity...
I know it's not much of a coding question but more of a logic one, I just have no experience in this kind of websites and I don't really know where/who to ask.
Thank you !! | paypal | logic | shopping-cart | payment | billing | null | open | Shopping Cart/Billing address logic
===
As some of you may know (if you read my 24932049023 previous questions :P) I'm working on a shopping site.
The payments will be processed by PayPal and I was wondering if I really need to have my user's Billing Address in that case. It's not like I have to verify their credit cart authenticity...
I know it's not much of a coding question but more of a logic one, I just have no experience in this kind of websites and I don't really know where/who to ask.
Thank you !! | 0 |
11,350,579 | 07/05/2012 18:44:10 | 1,267,204 | 03/13/2012 18:19:57 | 9 | 0 | Address list object with jquery | I would like to address this list with jquery.
<ul> <li id="unique_id"> Some Stuff </li> </ul>
Can someone tell me how I do this. This doesn't work.
$('ul li #unique_id').blink(); | jquery | html-lists | null | null | null | null | open | Address list object with jquery
===
I would like to address this list with jquery.
<ul> <li id="unique_id"> Some Stuff </li> </ul>
Can someone tell me how I do this. This doesn't work.
$('ul li #unique_id').blink(); | 0 |
11,350,580 | 07/05/2012 18:44:11 | 951,064 | 09/18/2011 08:59:39 | 601 | 29 | How to check if multi_curl is supported on PHP? | I have a piece of PHP code that uses cURL to do post requests, it uses the curl_multi_* functions for performance.
It all works fine on my hosted PHP server.
But it fails on my WAMPServer at 127.0.0.1. Single cURL requests work just fine on the WAMPServer, but `curl_multi_select()` only ever returns -1 until the script finally times out.
The code... is Example #1 on PHP.net's manual page on curl_multi_exec: http://www.php.net/manual/en/function.curl-multi-exec.php
Here's the snippet causing the infinite loop:
$active = null;
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
Tested with Vista's firewall disabled.
Does anybody know how to get curl_multi_* working on WAMPServer or is there any way to detect support for curl_multi_* from within the PHP script so I could make a fallback? | php | windows | curl | wampserver | curl-multi | null | open | How to check if multi_curl is supported on PHP?
===
I have a piece of PHP code that uses cURL to do post requests, it uses the curl_multi_* functions for performance.
It all works fine on my hosted PHP server.
But it fails on my WAMPServer at 127.0.0.1. Single cURL requests work just fine on the WAMPServer, but `curl_multi_select()` only ever returns -1 until the script finally times out.
The code... is Example #1 on PHP.net's manual page on curl_multi_exec: http://www.php.net/manual/en/function.curl-multi-exec.php
Here's the snippet causing the infinite loop:
$active = null;
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
Tested with Vista's firewall disabled.
Does anybody know how to get curl_multi_* working on WAMPServer or is there any way to detect support for curl_multi_* from within the PHP script so I could make a fallback? | 0 |
11,350,581 | 07/05/2012 18:44:11 | 1,395,769 | 05/15/2012 09:26:04 | 1 | 0 | Unable to use Custom control in Windows 8 Metro Apps | I'm trying to consume Custom Control in Windows 8 Metro Apps. It's working fine if I'm refering my custom control in other project within **same solution** but unable to successfully add reference of control to a different project in **different solution**.
Everytime I add reference to the control extension in my project, I always get this error "Insufficient memory to continue the program"
I've taken the help from this link but its not working on Windows 8 Release preview:
http://timheuer.com/blog/archive/2012/03/07/creating-custom-controls-for-metro-style-apps.aspx
Windows 8 Release Preview
Visual studio 2012 beta | visual-studio-2012 | null | null | null | null | null | open | Unable to use Custom control in Windows 8 Metro Apps
===
I'm trying to consume Custom Control in Windows 8 Metro Apps. It's working fine if I'm refering my custom control in other project within **same solution** but unable to successfully add reference of control to a different project in **different solution**.
Everytime I add reference to the control extension in my project, I always get this error "Insufficient memory to continue the program"
I've taken the help from this link but its not working on Windows 8 Release preview:
http://timheuer.com/blog/archive/2012/03/07/creating-custom-controls-for-metro-style-apps.aspx
Windows 8 Release Preview
Visual studio 2012 beta | 0 |
11,350,583 | 07/05/2012 18:44:37 | 1,364,962 | 04/30/2012 03:02:27 | 16 | 2 | Query to find how many students signed out | I need to write a query to find out how many students signed out after 1st period. We don't store a record if the student was present so I can't say if the student was present 1st period and has 6 absence records (we have 7 period days). All I have is the info in the schema below. I ahve a query that I wrote but its not working. Need some help on where to go from here.
Thanks
![enter image description here][1]
[1]: http://i.stack.imgur.com/A9cpk.png
Select student_id, Count(*) AS #ofPerAbsent
From Attend_Student_Detail
where School_Year='1112' and School_Number='0031'
and Absent_Date='2012-04-13' and Absent_Code IN ('ABU','ABX')
Group by Student_ID
Having count(*)<=6
ORDER BY #ofPerAbsent desc
| sql | tsql | null | null | null | null | open | Query to find how many students signed out
===
I need to write a query to find out how many students signed out after 1st period. We don't store a record if the student was present so I can't say if the student was present 1st period and has 6 absence records (we have 7 period days). All I have is the info in the schema below. I ahve a query that I wrote but its not working. Need some help on where to go from here.
Thanks
![enter image description here][1]
[1]: http://i.stack.imgur.com/A9cpk.png
Select student_id, Count(*) AS #ofPerAbsent
From Attend_Student_Detail
where School_Year='1112' and School_Number='0031'
and Absent_Date='2012-04-13' and Absent_Code IN ('ABU','ABX')
Group by Student_ID
Having count(*)<=6
ORDER BY #ofPerAbsent desc
| 0 |
11,348,617 | 07/05/2012 16:28:23 | 619,856 | 02/16/2011 14:50:52 | 44 | 2 | Example on consuming JSON in Play Framework views | I am trying to make the switch in a controller from sending JPA retrieved items as a List<Item> to the template engine to now send these as JSON.
I would prefer to use the flexJSON library for the task.
What I have is a Application controller with the method:
public static Result index() {
... Processing ...
flash("success", "Items have been processed");
return ok(index.render(Item.all()));
}
and a view index.scala.html like this one:
@(items: List[Item])
@import helper._
@main("Item list") {
<h1>@items.size() items(s)</h1>
<ul>
@for(item <- items) {
<li>
@item.title
</li>
}
</ul>
}
These to perfectly show an unnumbered list of all the processed items.
Now, if I changed the controller to using flexJSON like so:
public static Result getItems() {
List<Item> items = Item.all();
String s = new JSONSerializer().exclude("*.class", "description").serialize(items);
flash("success", "Messages have been processed");
return ok(index.render(s));
}
How would i program my template in order to consume that json string of items?
i tried to follow this blog on the matter, http://www.jamesward.com/2011/12/11/tutorial-play-framework-jpa-json-jquery-heroku, but fall short on how to consume the json in my template views... any code example would be greatly appreciated. | json | playframework | playframework-2.0 | flexjson | null | null | open | Example on consuming JSON in Play Framework views
===
I am trying to make the switch in a controller from sending JPA retrieved items as a List<Item> to the template engine to now send these as JSON.
I would prefer to use the flexJSON library for the task.
What I have is a Application controller with the method:
public static Result index() {
... Processing ...
flash("success", "Items have been processed");
return ok(index.render(Item.all()));
}
and a view index.scala.html like this one:
@(items: List[Item])
@import helper._
@main("Item list") {
<h1>@items.size() items(s)</h1>
<ul>
@for(item <- items) {
<li>
@item.title
</li>
}
</ul>
}
These to perfectly show an unnumbered list of all the processed items.
Now, if I changed the controller to using flexJSON like so:
public static Result getItems() {
List<Item> items = Item.all();
String s = new JSONSerializer().exclude("*.class", "description").serialize(items);
flash("success", "Messages have been processed");
return ok(index.render(s));
}
How would i program my template in order to consume that json string of items?
i tried to follow this blog on the matter, http://www.jamesward.com/2011/12/11/tutorial-play-framework-jpa-json-jquery-heroku, but fall short on how to consume the json in my template views... any code example would be greatly appreciated. | 0 |
11,350,505 | 07/05/2012 18:39:44 | 1,490,145 | 06/29/2012 02:42:01 | 21 | 0 | How to insert numbers rather than option type into a textbox | I need helping appending values into a textbox. What happens is that with the relevant piece of code below, the user can add an "Option Type" from a table row into the textbox. For example if the user clicks on the "Add" button and within that row the Option Type is "A-D", it adds "A-D" in the textbox. But I don't want it to add "A-D" into the textbox. I want it to add a number with the textbox instead except for "True or False" and "Yes or No" options, they can be inserted as they are. The numbers for each option type is as follows:
Option Type Number
A-C 3
A-D 4
A-E 5
A-F 6
...
A-Z 26
True or False True or False
Yes or No Yes or No
My question is how can insert the numbers for all letter option types (True or False and Yes or No remain the same) into the textbox?
Below is the relevant code where it inserts the option type from the table row into the textbox:
Table row and add button:
echo "<table border='1' id='resulttbl'>
<tr>
<th class='optiontypeth'>Option Type</th>
</tr>";
foreach ($searchResults as $key=>$question) {
echo '<td class="optiontypetd">'.htmlspecialchars($searchOption[$key]).'</td>';
echo "<td class='addtd'><button type='button' class='add' onclick=\"parent.addwindow('$searchOption[$key]');\">Add</button></td></tr>";
}
echo "</table>";
Below is the textbox the option types are currently inserted into:
<input type="text" name="gridValues" class="gridTxt maxRow" id="mainGridTxt" readonly="readonly" />
Below is the function where it currently inserts the option type into the textbox above:
function addwindow(gridValues) {
if(window.console) console.log();
if($(plusbutton_clicked).attr('id')=='mainPlusbutton') {
$('#mainGridTxt').val(questionText);
}
$.modal.close();
return false;
}
| php | javascript | null | null | null | null | open | How to insert numbers rather than option type into a textbox
===
I need helping appending values into a textbox. What happens is that with the relevant piece of code below, the user can add an "Option Type" from a table row into the textbox. For example if the user clicks on the "Add" button and within that row the Option Type is "A-D", it adds "A-D" in the textbox. But I don't want it to add "A-D" into the textbox. I want it to add a number with the textbox instead except for "True or False" and "Yes or No" options, they can be inserted as they are. The numbers for each option type is as follows:
Option Type Number
A-C 3
A-D 4
A-E 5
A-F 6
...
A-Z 26
True or False True or False
Yes or No Yes or No
My question is how can insert the numbers for all letter option types (True or False and Yes or No remain the same) into the textbox?
Below is the relevant code where it inserts the option type from the table row into the textbox:
Table row and add button:
echo "<table border='1' id='resulttbl'>
<tr>
<th class='optiontypeth'>Option Type</th>
</tr>";
foreach ($searchResults as $key=>$question) {
echo '<td class="optiontypetd">'.htmlspecialchars($searchOption[$key]).'</td>';
echo "<td class='addtd'><button type='button' class='add' onclick=\"parent.addwindow('$searchOption[$key]');\">Add</button></td></tr>";
}
echo "</table>";
Below is the textbox the option types are currently inserted into:
<input type="text" name="gridValues" class="gridTxt maxRow" id="mainGridTxt" readonly="readonly" />
Below is the function where it currently inserts the option type into the textbox above:
function addwindow(gridValues) {
if(window.console) console.log();
if($(plusbutton_clicked).attr('id')=='mainPlusbutton') {
$('#mainGridTxt').val(questionText);
}
$.modal.close();
return false;
}
| 0 |
11,350,424 | 07/05/2012 18:33:07 | 1,205,711 | 02/12/2012 21:50:31 | 18 | 1 | How to check if NSString contains a string with a specific format? | How can I detect if a certain NSString contains a string format like this for example:
I would like to check if a string is in a certain format. For example if I have the string format, `@"%d %d/%d %@"`, I would like my code to return YES if I compare it against `@"1 1/2 oz"`, and like wise would return NO if I compared it against `@"20 ml"`. | objective-c | cocoa-touch | ios5 | foundation | null | null | open | How to check if NSString contains a string with a specific format?
===
How can I detect if a certain NSString contains a string format like this for example:
I would like to check if a string is in a certain format. For example if I have the string format, `@"%d %d/%d %@"`, I would like my code to return YES if I compare it against `@"1 1/2 oz"`, and like wise would return NO if I compared it against `@"20 ml"`. | 0 |
11,350,426 | 07/05/2012 18:33:12 | 295,112 | 03/16/2010 20:09:53 | 7,166 | 407 | PHP not rendering HTML in emails | I have a Drupal web app that sends out emails when orders are placed. We have HTMLMail in place to format outgoing messages with a theme. Currently the header and footer are wrapped correctly as they should be with graphics, but the body text is showing raw HTML code.
Example:
<p>We have received your order and one of our representatives will review your information shortly. If you have any questions about this order please call us at (phone). Please reference your reservation number when calling. Here are the details of your order:</p><div class="item-list"><h3>Order Summary</h3><ul><li class="first"><span class="confirmation-label">Confirmation Number:</span>
And so on and so forth. In the mail template, simply doing an 'echo $body;' to print the message which should contain the above.
| php | drupal | null | null | null | null | open | PHP not rendering HTML in emails
===
I have a Drupal web app that sends out emails when orders are placed. We have HTMLMail in place to format outgoing messages with a theme. Currently the header and footer are wrapped correctly as they should be with graphics, but the body text is showing raw HTML code.
Example:
<p>We have received your order and one of our representatives will review your information shortly. If you have any questions about this order please call us at (phone). Please reference your reservation number when calling. Here are the details of your order:</p><div class="item-list"><h3>Order Summary</h3><ul><li class="first"><span class="confirmation-label">Confirmation Number:</span>
And so on and so forth. In the mail template, simply doing an 'echo $body;' to print the message which should contain the above.
| 0 |
11,500,002 | 07/16/2012 07:42:00 | 625,454 | 02/20/2011 17:45:27 | 491 | 0 | Where to put the Database related code in GRAILS | I have a following piece of code which connects to database and executes a query, I have a no clarity in placing of this code(Model/Service).
def value
def url = ConfigurationHolder.config.dataSource.url
def username = ConfigurationHolder.config.dataSource.username
def password = ConfigurationHolder.config.dataSource.password
def driver = ConfigurationHolder.config.dataSource.driverClassName
def sql = Sql.newInstance(url, username, password, driver)
sql.eachRow("select field_value from application_configuration where field_name=?", [field]) {
value=it.field_value
}
I have a class called ApplicationConfiguaration, I am querying on this domain.
I have two doubts
1) where to put the Database connection logic
2) where to put the query execution logic
| grails | grails-2.0 | null | null | null | null | open | Where to put the Database related code in GRAILS
===
I have a following piece of code which connects to database and executes a query, I have a no clarity in placing of this code(Model/Service).
def value
def url = ConfigurationHolder.config.dataSource.url
def username = ConfigurationHolder.config.dataSource.username
def password = ConfigurationHolder.config.dataSource.password
def driver = ConfigurationHolder.config.dataSource.driverClassName
def sql = Sql.newInstance(url, username, password, driver)
sql.eachRow("select field_value from application_configuration where field_name=?", [field]) {
value=it.field_value
}
I have a class called ApplicationConfiguaration, I am querying on this domain.
I have two doubts
1) where to put the Database connection logic
2) where to put the query execution logic
| 0 |
11,500,003 | 07/16/2012 07:42:17 | 965,020 | 09/26/2011 12:12:40 | 112 | 1 | Android ListView smooth navigation while images from SDCard | I saw a lot of implementations of smooth downloading images from web and showing them in listView with cache. Now I have the following situation: I'm storing images to SDCard and sometimes my listView shows them instead of images from web resource. In this case navigation in listView is not smooth. Do you know any good implementation of listView with image from sdCard? | android | listview | null | null | null | null | open | Android ListView smooth navigation while images from SDCard
===
I saw a lot of implementations of smooth downloading images from web and showing them in listView with cache. Now I have the following situation: I'm storing images to SDCard and sometimes my listView shows them instead of images from web resource. In this case navigation in listView is not smooth. Do you know any good implementation of listView with image from sdCard? | 0 |
11,500,005 | 07/16/2012 07:42:29 | 1,133,674 | 01/06/2012 05:23:35 | 173 | 16 | Batch processing in Rails | Rails query:
Detail.created_at_gt(15.days.ago.to_datetime).find_each do |d|
//Some code
end
Equivalent mysql query:
SELECT * FROM `details` WHERE (details.id >= 0) AND
(details.created_at > '2012-07-01 12:22:32')
ORDER BY details.id ASC LIMIT 1000
By using find_each in rails it is checking for details.id >= 0 and ordering details in
in ascending order.
Here, I want to avoid those two actions because in my case it is scanning whole table when
I have large data to process (i.e) indexing on created_at fails. So this is inefficient to do. Please anyone help.
| mysql | sql | ruby-on-rails | ruby | batch-processing | null | open | Batch processing in Rails
===
Rails query:
Detail.created_at_gt(15.days.ago.to_datetime).find_each do |d|
//Some code
end
Equivalent mysql query:
SELECT * FROM `details` WHERE (details.id >= 0) AND
(details.created_at > '2012-07-01 12:22:32')
ORDER BY details.id ASC LIMIT 1000
By using find_each in rails it is checking for details.id >= 0 and ordering details in
in ascending order.
Here, I want to avoid those two actions because in my case it is scanning whole table when
I have large data to process (i.e) indexing on created_at fails. So this is inefficient to do. Please anyone help.
| 0 |
11,500,018 | 07/16/2012 07:43:30 | 1,528,185 | 07/16/2012 07:38:54 | 1 | 0 | Google API Service Account | I'm trying to connect to the google doubeclick api through a service account (client email and p12 certificate), using the python client library as in the following example:
http://code.google.com/p/google-api-python-client/source/browse/samples/service_account/tasks.py
It's returning me an empty access_token:
In [9]: type(credentials.access_token)
Out[9]: <type 'NoneType'>
What is the significance of this? Is there something I am likely doing wrong? I have also tried accessing the tasks api as in the example (thinking that possibly the doubleclick api is not a supported scope) but same result.
| python | google-api | null | null | null | null | open | Google API Service Account
===
I'm trying to connect to the google doubeclick api through a service account (client email and p12 certificate), using the python client library as in the following example:
http://code.google.com/p/google-api-python-client/source/browse/samples/service_account/tasks.py
It's returning me an empty access_token:
In [9]: type(credentials.access_token)
Out[9]: <type 'NoneType'>
What is the significance of this? Is there something I am likely doing wrong? I have also tried accessing the tasks api as in the example (thinking that possibly the doubleclick api is not a supported scope) but same result.
| 0 |
11,500,015 | 07/16/2012 07:43:11 | 1,528,157 | 07/16/2012 07:23:38 | 1 | 0 | passing one Cell of datagrideview form form2 to textbox of in form1 | at first my English Language is not good.
I Have a Datagrideview in Form2 and texboxes in form1. I Want When I Click on One of Datagrideview rows , evry cell of datagrideview copy in texboxes of form1.
I tried cheng type of texboxes to 'puclic' then I wrote this in form2:
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
return;
Form1 fr1 = new Form1();
fr1.textBox1.Text = "123";
Form2.ActiveForm.Close();
}
but nothing copied in texbox1 of form1.
please Help me. | c# | visual-studio-2010 | null | null | null | null | open | passing one Cell of datagrideview form form2 to textbox of in form1
===
at first my English Language is not good.
I Have a Datagrideview in Form2 and texboxes in form1. I Want When I Click on One of Datagrideview rows , evry cell of datagrideview copy in texboxes of form1.
I tried cheng type of texboxes to 'puclic' then I wrote this in form2:
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
return;
Form1 fr1 = new Form1();
fr1.textBox1.Text = "123";
Form2.ActiveForm.Close();
}
but nothing copied in texbox1 of form1.
please Help me. | 0 |
11,499,989 | 07/16/2012 07:41:09 | 1,262,000 | 03/11/2012 08:06:43 | 49 | 2 | Java Generics Capture List<?> | I was looking at the Java Generics documentation and found this piece of code,
public class WildcardError {
void foo(List<?> l) {
//This give a compile time error
l.set(0,l.get(0));
}
}
I can understand that we are fetching an element from a "List? and trying to set it to another List?. So the compiler gives an error. My question is it makes sense when the 2 lists are different i.e. l.set(0, m.get(0)) here lists l and m are different. But in the above example, l and l are the same lists. Why isn't the compiler smart enough to see that? Is it hard to implement it?
| java | generics | null | null | null | null | open | Java Generics Capture List<?>
===
I was looking at the Java Generics documentation and found this piece of code,
public class WildcardError {
void foo(List<?> l) {
//This give a compile time error
l.set(0,l.get(0));
}
}
I can understand that we are fetching an element from a "List? and trying to set it to another List?. So the compiler gives an error. My question is it makes sense when the 2 lists are different i.e. l.set(0, m.get(0)) here lists l and m are different. But in the above example, l and l are the same lists. Why isn't the compiler smart enough to see that? Is it hard to implement it?
| 0 |
11,499,991 | 07/16/2012 07:41:19 | 1,479,894 | 06/25/2012 12:03:54 | 1 | 0 | Implementing timeouts in MS-DOS/FreeDOS applications | I'm writing an DOS Protected Mode application for FreeDOS in C. I need to write a timeout routine, that initiates a timeout variable and then when timeout variable becomes zero the application will know that a specified number of milliseconds(ms) has elapsed.
This, I think can be done via writing an ISR. The ISR will decrement the timeout variable each time ISR is called. The application continously checks whether timeout variable is zero or not.
Now my question is :
Is there any *reliable* way of implementing such timeout ISR. I read about 0x1C interrupt vector, but that provides a resolution of only 55ms. I need much more resolution. For e.g. of *1ms or even lower* if possible.
How can this be done? Any ideas or suggestions? | assembly | timeout | dos | ms-dos | null | null | open | Implementing timeouts in MS-DOS/FreeDOS applications
===
I'm writing an DOS Protected Mode application for FreeDOS in C. I need to write a timeout routine, that initiates a timeout variable and then when timeout variable becomes zero the application will know that a specified number of milliseconds(ms) has elapsed.
This, I think can be done via writing an ISR. The ISR will decrement the timeout variable each time ISR is called. The application continously checks whether timeout variable is zero or not.
Now my question is :
Is there any *reliable* way of implementing such timeout ISR. I read about 0x1C interrupt vector, but that provides a resolution of only 55ms. I need much more resolution. For e.g. of *1ms or even lower* if possible.
How can this be done? Any ideas or suggestions? | 0 |
11,499,994 | 07/16/2012 07:41:41 | 1,438,986 | 06/06/2012 06:30:21 | 6 | 0 | jsoup : get last index after select | my problem is that I have multiple "span" tags within a "p" tag.
I want only the html code within the innermost "span" tag.
Ex:
<span>
<span>
<span>
<span> <strong> lkfghsij</strong> hi how are u?
</span>
</span>
</span>
</span>
here i want only the "strong" tag and the text after it to be written into a file.
How do i go about this?
Regards,
Nitish | css-selectors | jsoup | null | null | null | null | open | jsoup : get last index after select
===
my problem is that I have multiple "span" tags within a "p" tag.
I want only the html code within the innermost "span" tag.
Ex:
<span>
<span>
<span>
<span> <strong> lkfghsij</strong> hi how are u?
</span>
</span>
</span>
</span>
here i want only the "strong" tag and the text after it to be written into a file.
How do i go about this?
Regards,
Nitish | 0 |
11,499,995 | 07/16/2012 07:41:45 | 936,632 | 09/09/2011 11:07:17 | 77 | 10 | How to implement authentication for REST API? | I'm creating a web based service that I want to expose as a REST API so that developers are able to create apps using it. I want developers to be able to create/manage user accounts and authenticate through API. How to handle this? OAuth or something else?
I'm using python,flask,mongodb for this. | python | api | authentication | rest | oauth | null | open | How to implement authentication for REST API?
===
I'm creating a web based service that I want to expose as a REST API so that developers are able to create apps using it. I want developers to be able to create/manage user accounts and authenticate through API. How to handle this? OAuth or something else?
I'm using python,flask,mongodb for this. | 0 |
11,499,998 | 07/16/2012 07:41:48 | 1,528,074 | 07/16/2012 06:33:25 | 1 | 0 | How can I use date_hierarchy and list_filter in my app? | I'm learning Django. I like date_hierarchy and list_filter in admin.
I want to know: How can I use date_hierarchy and list_filter in my app?
Thank you very much! | django-admin | django-views | null | null | null | null | open | How can I use date_hierarchy and list_filter in my app?
===
I'm learning Django. I like date_hierarchy and list_filter in admin.
I want to know: How can I use date_hierarchy and list_filter in my app?
Thank you very much! | 0 |
11,500,028 | 07/16/2012 07:44:36 | 768,392 | 05/24/2011 19:28:00 | 1,861 | 95 | appMobi / phonegap setting/deleting cookie click action required 2 times before working? | I can't figure out for the life of me whats up with this. I dunno if this is appMobi/phonegap centric, cause they have there own special ways of setting cookies, and handling them. But I have what seems to be a unique problem overall, and it only occurs in the process of actually writing a cookie for the first time. Or removing it if it exists which is kind of like writing it.
Anyway I have 2 functions that worked perfectly up til the point of introducing the cookies to them. But I need the cookies also as its part of a login check, and a handful of other things. So this is my issue.
I type my user/pass, hit login. get nothing. hit login again, works.
I hit logout after being logged in, nothing works. hit it again.. works..
These are ajax driven functions as well. Dunno if that has anything to do with it or not, but in both cases cookies are being written in one shape form or another and thats when the functions seem to break in respect to the fact that I need to click the buttons that trigger them twice to get the desired effect despite them being a single click action.
If I remove the cookie lines from my functions everything works normally again without problem, with exception that the cookies are required to actually use half the stuff I am building. Also its a lone cookie being written with a numeric value.
Ideas? | jquery | cookies | phonegap | appmobi | javascripe | null | open | appMobi / phonegap setting/deleting cookie click action required 2 times before working?
===
I can't figure out for the life of me whats up with this. I dunno if this is appMobi/phonegap centric, cause they have there own special ways of setting cookies, and handling them. But I have what seems to be a unique problem overall, and it only occurs in the process of actually writing a cookie for the first time. Or removing it if it exists which is kind of like writing it.
Anyway I have 2 functions that worked perfectly up til the point of introducing the cookies to them. But I need the cookies also as its part of a login check, and a handful of other things. So this is my issue.
I type my user/pass, hit login. get nothing. hit login again, works.
I hit logout after being logged in, nothing works. hit it again.. works..
These are ajax driven functions as well. Dunno if that has anything to do with it or not, but in both cases cookies are being written in one shape form or another and thats when the functions seem to break in respect to the fact that I need to click the buttons that trigger them twice to get the desired effect despite them being a single click action.
If I remove the cookie lines from my functions everything works normally again without problem, with exception that the cookies are required to actually use half the stuff I am building. Also its a lone cookie being written with a numeric value.
Ideas? | 0 |
11,350,606 | 07/05/2012 18:46:11 | 1,504,897 | 07/05/2012 18:36:25 | 1 | 0 | Batch Script to Rename Files | I have looked thoroughly to find a script that can do this, as I know the question has already been asked...but I understand very little about programming. I have 66 Folders, each containing 6 files that end in _0,_1,..._5. An example file name is DSC_7789 Panorama_cube_0. I need a script that I can run on each folder to replace _0 with _f, _1 with _r, _2 with _b, _3 with _l, _4 with _u, and _5 with _d. So DSC_7789 Panorama_cube_0 would then be changed to DSC_7789 Panorama_cube_f. I've actually done all of this myself once...it took an entire day. Could anyone possibly point me in the write direction? I'm assuming this would run in visual basic. Thanks! | script | batch-file | null | null | null | null | open | Batch Script to Rename Files
===
I have looked thoroughly to find a script that can do this, as I know the question has already been asked...but I understand very little about programming. I have 66 Folders, each containing 6 files that end in _0,_1,..._5. An example file name is DSC_7789 Panorama_cube_0. I need a script that I can run on each folder to replace _0 with _f, _1 with _r, _2 with _b, _3 with _l, _4 with _u, and _5 with _d. So DSC_7789 Panorama_cube_0 would then be changed to DSC_7789 Panorama_cube_f. I've actually done all of this myself once...it took an entire day. Could anyone possibly point me in the write direction? I'm assuming this would run in visual basic. Thanks! | 0 |
11,350,608 | 07/05/2012 18:46:18 | 1,273,230 | 03/16/2012 04:43:44 | 1 | 0 | Haskell sugar for "applyable" class adts containing functions ex. Isomorphisms | Specifically, inspired by J's conjucation operator (g&.f = (f inverse)(g)(f))
I need a way to augment functions with additional information. The obvious way is to use ADT. Something like:
data Isomorphism a b = ISO {FW (a -> b) , BW (b -> a)}
(FW f) `isoApp` x = f x
(BW g) `isoApp` x = g x
But the need for an application function really hurts code readability when most of the time you just want the forward function.
What would be very useful is a class:
class Applyable a b c | a b -> c where
apply :: a -> b -> c
(I think the b could be made implicit with existential quantifiers but I'm not comfortable enough to be sure I wouldn't get the signature wrong)
Now the apply would be made implicit so you could just write
f x
as you would any other function. Ex:
instance Applyable (a -> b) a b where
apply f x = f x
instance Applyable (Isomorphism a b) a b where
apply f x = (FW f) x
inverse (Iso f g) = Iso g f
then you could write something like:
conjugate :: (Applyable g b b) => g -> Iso a b -> b -> a
f `conjugate` g = (inverse f) . g . f
Ideally the type signature could be inferred
However, these semantics seem complicated, as you would also need to modify (.) to support Applyable rather than functions. Is there any way to simply trick the type system into treating Applyable datatypes as functions for all normal purposes?
Is there a fundamental reason that this is impossible / a bad idea?
| function | haskell | adt | isomorphism | null | null | open | Haskell sugar for "applyable" class adts containing functions ex. Isomorphisms
===
Specifically, inspired by J's conjucation operator (g&.f = (f inverse)(g)(f))
I need a way to augment functions with additional information. The obvious way is to use ADT. Something like:
data Isomorphism a b = ISO {FW (a -> b) , BW (b -> a)}
(FW f) `isoApp` x = f x
(BW g) `isoApp` x = g x
But the need for an application function really hurts code readability when most of the time you just want the forward function.
What would be very useful is a class:
class Applyable a b c | a b -> c where
apply :: a -> b -> c
(I think the b could be made implicit with existential quantifiers but I'm not comfortable enough to be sure I wouldn't get the signature wrong)
Now the apply would be made implicit so you could just write
f x
as you would any other function. Ex:
instance Applyable (a -> b) a b where
apply f x = f x
instance Applyable (Isomorphism a b) a b where
apply f x = (FW f) x
inverse (Iso f g) = Iso g f
then you could write something like:
conjugate :: (Applyable g b b) => g -> Iso a b -> b -> a
f `conjugate` g = (inverse f) . g . f
Ideally the type signature could be inferred
However, these semantics seem complicated, as you would also need to modify (.) to support Applyable rather than functions. Is there any way to simply trick the type system into treating Applyable datatypes as functions for all normal purposes?
Is there a fundamental reason that this is impossible / a bad idea?
| 0 |
11,350,612 | 07/05/2012 18:46:27 | 280,924 | 02/25/2010 05:21:15 | 1,219 | 21 | how can i find top 10 hashtags from stream of billion tweets | This was an interview question that someone asked me and I didn't really have a good answer. I was wondering if someone could possibly help me understand the solution to this:
"You have a stream of billion tweets coming in. How will you figure out the top 10 hashtags ? "
Thanks | language-agnostic | twitter | interview-questions | null | null | null | open | how can i find top 10 hashtags from stream of billion tweets
===
This was an interview question that someone asked me and I didn't really have a good answer. I was wondering if someone could possibly help me understand the solution to this:
"You have a stream of billion tweets coming in. How will you figure out the top 10 hashtags ? "
Thanks | 0 |
11,350,616 | 07/05/2012 18:46:42 | 1,504,848 | 07/05/2012 18:13:54 | 1 | 0 | Compatibility of Stemmers between NLTK and Lucene | I'm using Lucene in Java to index a corpus and extract stemmed wordlists from it. I stem using the EnglishAnalyzer. Then I hand the wordlist to Python to do some things with NLTK.
Is there a stemmer in NLTK that is fully compatible with the stemmer used by Lucene's EnglishAnalyzer?
I know I could also use PyLucene to circumvent this, but I would like to minimize dependencies. | lucene | nlp | nltk | stemming | null | null | open | Compatibility of Stemmers between NLTK and Lucene
===
I'm using Lucene in Java to index a corpus and extract stemmed wordlists from it. I stem using the EnglishAnalyzer. Then I hand the wordlist to Python to do some things with NLTK.
Is there a stemmer in NLTK that is fully compatible with the stemmer used by Lucene's EnglishAnalyzer?
I know I could also use PyLucene to circumvent this, but I would like to minimize dependencies. | 0 |
11,650,919 | 07/25/2012 13:32:32 | 1,536,042 | 07/18/2012 20:22:41 | 6 | 0 | Spring Web Flow... how to stop Form Validation on only one transition | Spring Web Flow... how to stop Form Validation on only one transition.
How to stop Form Validation on only one transition. With the following code I have form validation turn on and everything is working great but if the user clicks "cancel" I dont want to run the form validation. anyway around this?
<view-state id="helloworld" view="input.jsp" model="customer" popup="true">
<transition on="submit" to="preview" />
<transition on="cancel" to="thanks"/>
</view-state> | java | spring | spring-mvc | spring-webflow | null | null | open | Spring Web Flow... how to stop Form Validation on only one transition
===
Spring Web Flow... how to stop Form Validation on only one transition.
How to stop Form Validation on only one transition. With the following code I have form validation turn on and everything is working great but if the user clicks "cancel" I dont want to run the form validation. anyway around this?
<view-state id="helloworld" view="input.jsp" model="customer" popup="true">
<transition on="submit" to="preview" />
<transition on="cancel" to="thanks"/>
</view-state> | 0 |
11,650,938 | 07/25/2012 13:33:18 | 1,241,585 | 03/01/2012 00:59:48 | 8 | 1 | Knockout.js on Android 2 | I am using knockout.js to display list values, when I do not use input elements it is good but when I use input elements inside the 'foreach', it renders bad on Android 2.
I am initializing the view model in a script before the end body tag:
$(".pageId").bind('pageinit', function(){
ko.applyBindings(new MyViewModel());
});
I also tried with
$(".pageId").bind('pageshow',function(){
$("input").checkboxradio();
});
But I did not work on Android 2 either.
Is there a way to make the checkboxes/radio buttons/dropdows render correctly using knockout.js on Android 2? | knockout.js | null | null | null | null | null | open | Knockout.js on Android 2
===
I am using knockout.js to display list values, when I do not use input elements it is good but when I use input elements inside the 'foreach', it renders bad on Android 2.
I am initializing the view model in a script before the end body tag:
$(".pageId").bind('pageinit', function(){
ko.applyBindings(new MyViewModel());
});
I also tried with
$(".pageId").bind('pageshow',function(){
$("input").checkboxradio();
});
But I did not work on Android 2 either.
Is there a way to make the checkboxes/radio buttons/dropdows render correctly using knockout.js on Android 2? | 0 |
11,650,734 | 07/25/2012 13:23:25 | 436,493 | 12/15/2009 16:58:55 | 1,059 | 10 | Scale div elements to window size | I'm currently working on the [skeleton layout][1] for a new web application but have encountered a few problems most noticeably with CSS layouts and DIV.
1) Boxes 1 and 2 (column 1) do not line up with 3 (column 2) and 4 (column 3). How can I straighten this up?
2) I really like how the the interface [here][2] which automatically resizes when minimised to a certain size and scales up when the window is maximised. I've been trying to implement this into my layout but can't. It is unfortunate how the footer "sticks out". I would like everything to fit onto one page. How do I go about achieving this as in the abovementioned website?
Many thanks in advance.
[1]: http://jsfiddle.net/methuselah/zRrxf/
[2]: http://biblia.com/books/esv | css | div | null | null | null | null | open | Scale div elements to window size
===
I'm currently working on the [skeleton layout][1] for a new web application but have encountered a few problems most noticeably with CSS layouts and DIV.
1) Boxes 1 and 2 (column 1) do not line up with 3 (column 2) and 4 (column 3). How can I straighten this up?
2) I really like how the the interface [here][2] which automatically resizes when minimised to a certain size and scales up when the window is maximised. I've been trying to implement this into my layout but can't. It is unfortunate how the footer "sticks out". I would like everything to fit onto one page. How do I go about achieving this as in the abovementioned website?
Many thanks in advance.
[1]: http://jsfiddle.net/methuselah/zRrxf/
[2]: http://biblia.com/books/esv | 0 |
11,594,360 | 07/21/2012 17:29:50 | 1,542,957 | 07/21/2012 16:56:17 | 1 | 0 | PHP , MYSQL when inserting longblob in table row | I have a problem in my php . You see , I have a ads sites , where people add ads if they want to sell something , now , in the upload form of the site where people prepare their ad , I allow them to add 9 pictures of their product, each pictures with a maximum of 3 MB , if they add only 2 pictures it's all okay the ad will be added to the database , but if they add more than 2 pictures then nothing will be added inside the database .
Now , I guess this has something to do with the each row size limit of the database ? or something like that , can you guys help me suggesting what I should do? I am running Mysql InnoDB engine. Thank you so much :) | php | mysql | null | null | null | null | open | PHP , MYSQL when inserting longblob in table row
===
I have a problem in my php . You see , I have a ads sites , where people add ads if they want to sell something , now , in the upload form of the site where people prepare their ad , I allow them to add 9 pictures of their product, each pictures with a maximum of 3 MB , if they add only 2 pictures it's all okay the ad will be added to the database , but if they add more than 2 pictures then nothing will be added inside the database .
Now , I guess this has something to do with the each row size limit of the database ? or something like that , can you guys help me suggesting what I should do? I am running Mysql InnoDB engine. Thank you so much :) | 0 |
11,594,481 | 07/21/2012 17:42:48 | 546,084 | 12/17/2010 13:01:44 | 5,893 | 93 | Strictness of sequence | I'm using `sequence` to repeatedly sample from a probability distribution, doing something like this:
sampleMean :: MonadRandom m => Int -> m Float -> m Float
sampleMean n dist = do
xs <- sequence (replicate n dist)
return $ sum xs / fromInteger (length xs)
I noticed that the running time scales nonlinearly with `n`. In particular, once `n` exceeds a certain value it hits the memory limit, and the running time explodes.
I'm not certain, but I think this is because `sequence` is building up a long list of thunks which aren't getting evaluated until the call to `sum`.
Is there a way to make `sequence` behave strictly, or is there another function that acts like sequence, but is strict?
---
**Extra Info:** The argument `dist` in this case is a likelihood-weighted sampling function wrapped around a Bayes Net.
I can do 100,000 samples in about 5 seconds, but it's taking 60 seconds to do 400,000 samples, and I terminated the calculation after 5 minutes when trying to do 1,000,000 samples. | performance | haskell | strictness | null | null | null | open | Strictness of sequence
===
I'm using `sequence` to repeatedly sample from a probability distribution, doing something like this:
sampleMean :: MonadRandom m => Int -> m Float -> m Float
sampleMean n dist = do
xs <- sequence (replicate n dist)
return $ sum xs / fromInteger (length xs)
I noticed that the running time scales nonlinearly with `n`. In particular, once `n` exceeds a certain value it hits the memory limit, and the running time explodes.
I'm not certain, but I think this is because `sequence` is building up a long list of thunks which aren't getting evaluated until the call to `sum`.
Is there a way to make `sequence` behave strictly, or is there another function that acts like sequence, but is strict?
---
**Extra Info:** The argument `dist` in this case is a likelihood-weighted sampling function wrapped around a Bayes Net.
I can do 100,000 samples in about 5 seconds, but it's taking 60 seconds to do 400,000 samples, and I terminated the calculation after 5 minutes when trying to do 1,000,000 samples. | 0 |
11,594,493 | 07/21/2012 17:44:41 | 984,705 | 10/07/2011 20:49:04 | 6 | 0 | Onreadystatechange not not working after header redirection in Chrome | I have made a userscript for a forum that resizes images. It works great, except for after posting or editing where it redirects, where onreadystatechange does not fire in Google Chrome.
When viewing a thread (userscript working):
https://example.com/forums.php?action=viewtopic&topicid=205362
After editing/posting (userscript not working):
https://example.com/forums.php?action=viewtopic&topicid=205362&page=p4976670#4976670
The problem lies with this code:
document.onreadystatechange = function () {
if (document.readyState == "complete") {
//Call function
}};
I wait for all resources to be loaded, because the resizing is inconsistent otherwise on pages with many images.
The script works perfectly in Firefox with greasemonkey.
Any idea why onreadystatechange does not fire on chrome after redirect? Is there a better way to wait for resources to have been loaded?
Thanks in advance, and sorry if I forgot anything. | javascript | google-chrome | userscripts | null | null | null | open | Onreadystatechange not not working after header redirection in Chrome
===
I have made a userscript for a forum that resizes images. It works great, except for after posting or editing where it redirects, where onreadystatechange does not fire in Google Chrome.
When viewing a thread (userscript working):
https://example.com/forums.php?action=viewtopic&topicid=205362
After editing/posting (userscript not working):
https://example.com/forums.php?action=viewtopic&topicid=205362&page=p4976670#4976670
The problem lies with this code:
document.onreadystatechange = function () {
if (document.readyState == "complete") {
//Call function
}};
I wait for all resources to be loaded, because the resizing is inconsistent otherwise on pages with many images.
The script works perfectly in Firefox with greasemonkey.
Any idea why onreadystatechange does not fire on chrome after redirect? Is there a better way to wait for resources to have been loaded?
Thanks in advance, and sorry if I forgot anything. | 0 |
11,594,496 | 07/21/2012 17:45:14 | 721,631 | 04/23/2011 09:59:00 | 450 | 20 | metaprogramming for params | How can I update these very similar text fields in a less verbose way? The text fields below are named as given - I haven't edited them for this question.
def update
company = Company.find(current_user.client_id)
company.text11 = params[:content][:text11][:value]
company.text12 = params[:content][:text12][:value]
company.text13 = params[:content][:text13][:value]
# etc
company.save!
render text: ""
end
I've tried using `send` and `to_sym` but no luck so far... | ruby-on-rails | params | null | null | null | null | open | metaprogramming for params
===
How can I update these very similar text fields in a less verbose way? The text fields below are named as given - I haven't edited them for this question.
def update
company = Company.find(current_user.client_id)
company.text11 = params[:content][:text11][:value]
company.text12 = params[:content][:text12][:value]
company.text13 = params[:content][:text13][:value]
# etc
company.save!
render text: ""
end
I've tried using `send` and `to_sym` but no luck so far... | 0 |
11,594,499 | 07/21/2012 17:45:35 | 1,037,059 | 11/09/2011 06:41:12 | 105 | 0 | Why are virtual functions in C++ called 'virtual'? | So I am new to the concept of virtual functions in C++, and threads like [this][1] do a good job of selling this concept. Ok I am convinced.
But why are virtual functions called 'virtual'? I mean such functions are as 'concrete'
as usual functions / methods aren't they? If someone could explain the choice of the word
'virtual' for naming this concept, that would be great.
[1]: http://stackoverflow.com/questions/8824359/why-use-virtual-functions
| c++ | virtual | null | null | null | 07/21/2012 20:48:10 | not constructive | Why are virtual functions in C++ called 'virtual'?
===
So I am new to the concept of virtual functions in C++, and threads like [this][1] do a good job of selling this concept. Ok I am convinced.
But why are virtual functions called 'virtual'? I mean such functions are as 'concrete'
as usual functions / methods aren't they? If someone could explain the choice of the word
'virtual' for naming this concept, that would be great.
[1]: http://stackoverflow.com/questions/8824359/why-use-virtual-functions
| 4 |
11,594,502 | 07/21/2012 17:46:00 | 68,936 | 02/20/2009 14:30:36 | 661 | 24 | Better ComboBox Auto-complete | Winform's ComboBox's built-in autocomplete only matches the characters entered by the user in the combobox to the beginning of each word in the list. I would like to improve on the built-in autocomplete so that the characters match anywhere in each word of the list (i.e., if the user enters "ob", the combobox would show "Global" in the dropdown list).
Also, because I deal with a large list of items, I want to remove from the dropdown list the words that do not match the characters entered by the user. The autocomplete does that, but since I want to match to anywhere in the word, I turned off built-in autocomplete and was trying to do it all myself.
I tried to adjust the list of items for the combobox in the TextChanged event. However, whenever I adjust ComboBox.Items (or even just clear it, ComboBox.Items.Clear()), the cursor in the text box is moved to the beginning. Thus, if I try to enter "1" and then "2" and then "3", the resulting text in the text box is "321". This heretic behavior was also reported [here][1], though no solution to that particular issue was posted.
Is there a better way to accomplish my goal of matching to anywhere in the word? If not, how do I modify the list of items without moving the cursor in the edit box to the beginning? | winforms | autocomplete | combobox | null | null | null | open | Better ComboBox Auto-complete
===
Winform's ComboBox's built-in autocomplete only matches the characters entered by the user in the combobox to the beginning of each word in the list. I would like to improve on the built-in autocomplete so that the characters match anywhere in each word of the list (i.e., if the user enters "ob", the combobox would show "Global" in the dropdown list).
Also, because I deal with a large list of items, I want to remove from the dropdown list the words that do not match the characters entered by the user. The autocomplete does that, but since I want to match to anywhere in the word, I turned off built-in autocomplete and was trying to do it all myself.
I tried to adjust the list of items for the combobox in the TextChanged event. However, whenever I adjust ComboBox.Items (or even just clear it, ComboBox.Items.Clear()), the cursor in the text box is moved to the beginning. Thus, if I try to enter "1" and then "2" and then "3", the resulting text in the text box is "321". This heretic behavior was also reported [here][1], though no solution to that particular issue was posted.
Is there a better way to accomplish my goal of matching to anywhere in the word? If not, how do I modify the list of items without moving the cursor in the edit box to the beginning? | 0 |
11,472,361 | 07/13/2012 14:19:59 | 1,523,760 | 07/13/2012 14:01:03 | 1 | 0 | remaining words of string in php | I have a piece of code that shows the first 20 words on my webpage.
<code>
$arrtext = explode( ' ', stripslashes( str_replace('\n',chr(10),str_replace('\r',chr(13),$row['text']))), $config['length_story'] + 1);
$arrtext[ $config['length_story'] ] = '';
$row['headtext'] = trim(implode( ' ', $arrtext)) . '...';
</code]>
This works fine but I want to display the remaing text too without repeating the first 20 words how can I do this?
| php | string | words | null | null | null | open | remaining words of string in php
===
I have a piece of code that shows the first 20 words on my webpage.
<code>
$arrtext = explode( ' ', stripslashes( str_replace('\n',chr(10),str_replace('\r',chr(13),$row['text']))), $config['length_story'] + 1);
$arrtext[ $config['length_story'] ] = '';
$row['headtext'] = trim(implode( ' ', $arrtext)) . '...';
</code]>
This works fine but I want to display the remaing text too without repeating the first 20 words how can I do this?
| 0 |
11,472,362 | 07/13/2012 14:20:01 | 1,523,543 | 07/13/2012 12:34:00 | 1 | 0 | Unwanted branches in lcov by using the stdstring | I'm using cppunit and lcov for code-coverage.
It seems to work, but I get untaken branches that aren't.
This happens when I call:
string currentText;
currentText="";//This throws a untaken branch
currentText.clear;//This too
Why is it so?
And how is it prevented?
----------
Here is the complete lcov result:
Branch data Line data Source code
1 : : #include "StringOut.h"
2 : :
3 : 2 : StringOut::StringOut() {
4 [ + - ]: 2 : currentText="";
5 : 2 : }
6 : :
7 : 2 : StringOut::~StringOut() {
8 [ + - ]: 2 : currentText.clear();
9 [ - + ]: 4 : }
10 : :
11 : 4 : void StringOut::SetText(string Text) {
12 : 4 : currentText = Text;
13 : 4 : }
14 : :
15 : 5 : string StringOut::getText() {
16 : 5 : return currentText;
17 : : }
----------
This is the Class the should be code-coverage
StringOut.h:
<!-- language: lang-cpp -->
#ifndef STRINGOUT_H_
#define STRINGOUT_H_
#include <string>
#include <string.h>
using namespace std;
class StringOut {
public:
StringOut();
virtual ~StringOut();
void SetText(string Text);
string getText();
private:
string currentText;
};
#endif /* STRINGOUT_H_ */
StringOut.cpp:
<!-- language: cpp -->
#include "StringOut.h"
StringOut::StringOut() {
currentText="";
}
StringOut::~StringOut() {
currentText.clear();
}
void StringOut::SetText(string Text) {
currentText = Text;
}
string StringOut::getText() {
return currentText;
}
----------
The Test-Class
StringOut_test.h:
<!-- language: cpp -->
#ifndef StringOutTest_H
#define StringOutTest_H
#include "StringOut.h"
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestFixture.h>
using namespace std;
class StringOut_test;
class StringOut_test: public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE( StringOut_test );
CPPUNIT_TEST(SetTextTest);
CPPUNIT_TEST(GetTextTest);
CPPUNIT_TEST_SUITE_END();
public:
void setUp(void);
void tearDown(void);
protected:
void SetTextTest(void);
void GetTextTest(void);
private:
StringOut *myStringOut;
};
#endif
StringOut_test.h:
<!-- language: cpp -->
#include "StringOut_test.h"
CPPUNIT_TEST_SUITE_REGISTRATION (StringOut_test);
void StringOut_test::SetTextTest(void) {
myStringOut->SetText("TestString");
CPPUNIT_ASSERT(myStringOut->getText()!="");
CPPUNIT_ASSERT(myStringOut->getText()=="TestString");
}
void StringOut_test::setUp(void) {
myStringOut = new StringOut();
myStringOut->SetText("TestString");
CPPUNIT_ASSERT(myStringOut->getText()=="TestString");
}
void StringOut_test::tearDown(void) {
delete myStringOut;
}
void StringOut_test::GetTextTest(void) {
myStringOut->SetText("GetText");
CPPUNIT_ASSERT(myStringOut->getText()=="GetText");
}
----------
The Main that call the Test
SimpleTest.cpp
<!-- language: cpp -->
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/BriefTestProgressListener.h>
int main (int argc, char* argv[])
{
// Informiert Test-Listener ueber Testresultate
CPPUNIT_NS :: TestResult testresult;
// Listener zum Sammeln der Testergebnisse registrieren
CPPUNIT_NS :: TestResultCollector collectedresults;
testresult.addListener (&collectedresults);
// Listener zur Ausgabe der Ergebnisse einzelner Tests
CPPUNIT_NS :: BriefTestProgressListener progress;
testresult.addListener (&progress);
// Test-Suite ueber die Registry im Test-Runner einfuegen
CPPUNIT_NS :: TestRunner testrunner;
testrunner.addTest (CPPUNIT_NS :: TestFactoryRegistry :: getRegistry ().makeTest ());
testrunner.run (testresult);
// Resultate im Compiler-Format ausgeben
CPPUNIT_NS :: CompilerOutputter compileroutputter (&collectedresults, std::cerr);
compileroutputter.write ();
// Rueckmeldung, ob Tests erfolgreich waren
return collectedresults.wasSuccessful () ? 0 : 1;
}
----------
And at least the Makefile:
# Flags für C-Compiler
CXXFLAGS=-O0 -g -c
# Standard Includes für C++-Compiler
CXXINCS=-I"../src/" \
CPPUNIT_LIBPATH="/usr/lib"
###########################################################################################
# Standard Aufruf für C-Compiler
GCC_CALL = gcc $(CINCS) -c $(CFLAGS)
# Standard Aufruf für C++-Compiler
GXX_CALL = g++ $(CXXINCS) -c $(CXXFLAGS)
# Standard Pattern für C Files
.c.o:
$(GCC_CALL) $<
# Standard Pattern für C++ Files
.cpp.o:
$(GXX_CALL) $<
##################################################################
#
EXECUTABLE=SimpleTest
OBJECTS=StringOut.o SimpleTest.o StringOut_test.o
all : target
target: $(OBJECTS)
g++ -L$(CPPUNIT_LIBPATH) $(OBJECTS) -o $(EXECUTABLE) -lcppunit -fprofile-arcs
StringOut.o:
$(GXX_CALL) -ftest-coverage -fprofile-arcs -fno-elide-constructors "`cd ../..; pwd`"/SimpleTest/src/StringOut.cpp
SimpleTest.o:
$(GXX_CALL) ../src/SimpleTest.cpp
StringOut_test.o:
$(GXX_CALL) ../src/StringOut_test.cpp
lcov:run-tests
lcov -b . -d . -c -o ./ic.info
awk -ffilter.awk ic.info > ic1.info
mv ic1.info ic.info
genhtml -o out ./ic.info
run-tests:all
./$(EXECUTABLE) XML
cppcheck --xml "`cd ../..; pwd`"/SimpleTest/src/StringOut.cpp 2> cppcheck-result.xml
clean:
rm -f $(EXECUTABLE) *.o testresults.xml *.gcno *.gcda cppcheck-result.xml
----------
Thanks for any response. | branch | code-coverage | stdstring | gcov | lcov | null | open | Unwanted branches in lcov by using the stdstring
===
I'm using cppunit and lcov for code-coverage.
It seems to work, but I get untaken branches that aren't.
This happens when I call:
string currentText;
currentText="";//This throws a untaken branch
currentText.clear;//This too
Why is it so?
And how is it prevented?
----------
Here is the complete lcov result:
Branch data Line data Source code
1 : : #include "StringOut.h"
2 : :
3 : 2 : StringOut::StringOut() {
4 [ + - ]: 2 : currentText="";
5 : 2 : }
6 : :
7 : 2 : StringOut::~StringOut() {
8 [ + - ]: 2 : currentText.clear();
9 [ - + ]: 4 : }
10 : :
11 : 4 : void StringOut::SetText(string Text) {
12 : 4 : currentText = Text;
13 : 4 : }
14 : :
15 : 5 : string StringOut::getText() {
16 : 5 : return currentText;
17 : : }
----------
This is the Class the should be code-coverage
StringOut.h:
<!-- language: lang-cpp -->
#ifndef STRINGOUT_H_
#define STRINGOUT_H_
#include <string>
#include <string.h>
using namespace std;
class StringOut {
public:
StringOut();
virtual ~StringOut();
void SetText(string Text);
string getText();
private:
string currentText;
};
#endif /* STRINGOUT_H_ */
StringOut.cpp:
<!-- language: cpp -->
#include "StringOut.h"
StringOut::StringOut() {
currentText="";
}
StringOut::~StringOut() {
currentText.clear();
}
void StringOut::SetText(string Text) {
currentText = Text;
}
string StringOut::getText() {
return currentText;
}
----------
The Test-Class
StringOut_test.h:
<!-- language: cpp -->
#ifndef StringOutTest_H
#define StringOutTest_H
#include "StringOut.h"
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestFixture.h>
using namespace std;
class StringOut_test;
class StringOut_test: public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE( StringOut_test );
CPPUNIT_TEST(SetTextTest);
CPPUNIT_TEST(GetTextTest);
CPPUNIT_TEST_SUITE_END();
public:
void setUp(void);
void tearDown(void);
protected:
void SetTextTest(void);
void GetTextTest(void);
private:
StringOut *myStringOut;
};
#endif
StringOut_test.h:
<!-- language: cpp -->
#include "StringOut_test.h"
CPPUNIT_TEST_SUITE_REGISTRATION (StringOut_test);
void StringOut_test::SetTextTest(void) {
myStringOut->SetText("TestString");
CPPUNIT_ASSERT(myStringOut->getText()!="");
CPPUNIT_ASSERT(myStringOut->getText()=="TestString");
}
void StringOut_test::setUp(void) {
myStringOut = new StringOut();
myStringOut->SetText("TestString");
CPPUNIT_ASSERT(myStringOut->getText()=="TestString");
}
void StringOut_test::tearDown(void) {
delete myStringOut;
}
void StringOut_test::GetTextTest(void) {
myStringOut->SetText("GetText");
CPPUNIT_ASSERT(myStringOut->getText()=="GetText");
}
----------
The Main that call the Test
SimpleTest.cpp
<!-- language: cpp -->
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/BriefTestProgressListener.h>
int main (int argc, char* argv[])
{
// Informiert Test-Listener ueber Testresultate
CPPUNIT_NS :: TestResult testresult;
// Listener zum Sammeln der Testergebnisse registrieren
CPPUNIT_NS :: TestResultCollector collectedresults;
testresult.addListener (&collectedresults);
// Listener zur Ausgabe der Ergebnisse einzelner Tests
CPPUNIT_NS :: BriefTestProgressListener progress;
testresult.addListener (&progress);
// Test-Suite ueber die Registry im Test-Runner einfuegen
CPPUNIT_NS :: TestRunner testrunner;
testrunner.addTest (CPPUNIT_NS :: TestFactoryRegistry :: getRegistry ().makeTest ());
testrunner.run (testresult);
// Resultate im Compiler-Format ausgeben
CPPUNIT_NS :: CompilerOutputter compileroutputter (&collectedresults, std::cerr);
compileroutputter.write ();
// Rueckmeldung, ob Tests erfolgreich waren
return collectedresults.wasSuccessful () ? 0 : 1;
}
----------
And at least the Makefile:
# Flags für C-Compiler
CXXFLAGS=-O0 -g -c
# Standard Includes für C++-Compiler
CXXINCS=-I"../src/" \
CPPUNIT_LIBPATH="/usr/lib"
###########################################################################################
# Standard Aufruf für C-Compiler
GCC_CALL = gcc $(CINCS) -c $(CFLAGS)
# Standard Aufruf für C++-Compiler
GXX_CALL = g++ $(CXXINCS) -c $(CXXFLAGS)
# Standard Pattern für C Files
.c.o:
$(GCC_CALL) $<
# Standard Pattern für C++ Files
.cpp.o:
$(GXX_CALL) $<
##################################################################
#
EXECUTABLE=SimpleTest
OBJECTS=StringOut.o SimpleTest.o StringOut_test.o
all : target
target: $(OBJECTS)
g++ -L$(CPPUNIT_LIBPATH) $(OBJECTS) -o $(EXECUTABLE) -lcppunit -fprofile-arcs
StringOut.o:
$(GXX_CALL) -ftest-coverage -fprofile-arcs -fno-elide-constructors "`cd ../..; pwd`"/SimpleTest/src/StringOut.cpp
SimpleTest.o:
$(GXX_CALL) ../src/SimpleTest.cpp
StringOut_test.o:
$(GXX_CALL) ../src/StringOut_test.cpp
lcov:run-tests
lcov -b . -d . -c -o ./ic.info
awk -ffilter.awk ic.info > ic1.info
mv ic1.info ic.info
genhtml -o out ./ic.info
run-tests:all
./$(EXECUTABLE) XML
cppcheck --xml "`cd ../..; pwd`"/SimpleTest/src/StringOut.cpp 2> cppcheck-result.xml
clean:
rm -f $(EXECUTABLE) *.o testresults.xml *.gcno *.gcda cppcheck-result.xml
----------
Thanks for any response. | 0 |
11,472,363 | 07/13/2012 14:20:06 | 1,518,069 | 07/11/2012 14:22:34 | 1 | 0 | How to code for search box | Does anybody knows how to code for search box which only search the items inside a localhost website using javascript? | javascript | null | null | null | null | 07/13/2012 14:24:14 | not a real question | How to code for search box
===
Does anybody knows how to code for search box which only search the items inside a localhost website using javascript? | 1 |
11,472,401 | 07/13/2012 14:22:18 | 1,501,783 | 07/04/2012 13:59:42 | 28 | 2 | Looking for example using MediaFileUpload | Does anyone know where I can find complete sample code for uploading a local file and getting contents with MediaFileUpload?
I really need to see both the HTML form used to post and the code to accept it. I'm pulling my hair out and so far only getting partial answers.
Thanks!
| python | google-app-engine | google-drive-sdk | null | null | null | open | Looking for example using MediaFileUpload
===
Does anyone know where I can find complete sample code for uploading a local file and getting contents with MediaFileUpload?
I really need to see both the HTML form used to post and the code to accept it. I'm pulling my hair out and so far only getting partial answers.
Thanks!
| 0 |
11,464,425 | 07/13/2012 05:05:19 | 1,517,037 | 07/11/2012 07:44:56 | 28 | 1 | C Libgcrypt: Unable to check if number is prime using libgcrypt | I am using a libgcrypt funtion `gcry_prime_check` to test if the number `3` is a prime number. It turns out 3 is not a prime number according to my the function. What am i doing wrong?
Here is my code
#include <gcrypt.h>
#include <stdio.h>
int main(void)
{
gcry_mpi_t cript_prime;
gcry_error_t err;
char buffer[8] = {0};
char number[8] = {0};
printf("%s\n", gcry_check_version ( NULL ) );
gcry_control( GCRYCTL_INIT_SECMEM, 16384, 0 );
cript_prime = gcry_mpi_new(16);
strcpy(number,"3");
gcry_mpi_scan(&cript_prime,GCRYMPI_FMT_USG,number,sizeof(number),NULL);
gcry_mpi_print(GCRYMPI_FMT_USG,buffer,sizeof(buffer),NULL,cript_prime);
printf("The number tested is: %s\n",buffer);
err = gcry_prime_check(cript_prime,4);
if(err)
{
printf("%s\n",gcry_strerror(err));
}
gcry_mpi_release(cript_prime);
return 0;
}
Here is the output
1.4.4
The number tested is: 3
Number is not prime
Also, a link for a good tutorial on using libgcrypt would be a big bonus. Thanks | c | linux | testing | primes | libgcrypt | null | open | C Libgcrypt: Unable to check if number is prime using libgcrypt
===
I am using a libgcrypt funtion `gcry_prime_check` to test if the number `3` is a prime number. It turns out 3 is not a prime number according to my the function. What am i doing wrong?
Here is my code
#include <gcrypt.h>
#include <stdio.h>
int main(void)
{
gcry_mpi_t cript_prime;
gcry_error_t err;
char buffer[8] = {0};
char number[8] = {0};
printf("%s\n", gcry_check_version ( NULL ) );
gcry_control( GCRYCTL_INIT_SECMEM, 16384, 0 );
cript_prime = gcry_mpi_new(16);
strcpy(number,"3");
gcry_mpi_scan(&cript_prime,GCRYMPI_FMT_USG,number,sizeof(number),NULL);
gcry_mpi_print(GCRYMPI_FMT_USG,buffer,sizeof(buffer),NULL,cript_prime);
printf("The number tested is: %s\n",buffer);
err = gcry_prime_check(cript_prime,4);
if(err)
{
printf("%s\n",gcry_strerror(err));
}
gcry_mpi_release(cript_prime);
return 0;
}
Here is the output
1.4.4
The number tested is: 3
Number is not prime
Also, a link for a good tutorial on using libgcrypt would be a big bonus. Thanks | 0 |
11,471,973 | 07/13/2012 13:57:46 | 1,123,698 | 12/30/2011 23:41:34 | 6 | 2 | Make text control editable when clicked in flex3 | i have a text control that i want to make editable when clicked in flex 3.
is it possible? if not anybody had any idea how i can do something similar.
thank you in advance | text | flex3 | editable | null | null | null | open | Make text control editable when clicked in flex3
===
i have a text control that i want to make editable when clicked in flex 3.
is it possible? if not anybody had any idea how i can do something similar.
thank you in advance | 0 |
11,472,403 | 07/13/2012 14:22:21 | 1,453,825 | 06/13/2012 13:52:16 | 20 | 0 | How to modify property of radiobutton without using its id tag | I need to go threw a loop and check the proper radiobutton. I have multiple radio button name "rb" then with a color such as "rbGreen, rbRed, rbYellow..."
Here is my code behind<br/>
*listColors is a list of strings
Private Sub selectColor(color As String)
Dim i As Integer
For i = 0 To listColors.Count - 1
If listColors(i) = color Then
Dim rb As RadioButton = TryCast(Page.FindControl("rb" & color), RadioButton)
rb.Checked = True
End If
Next i
End Sub
While debugging, i got an error because rb is nothing... | asp.net | vb | null | null | null | null | open | How to modify property of radiobutton without using its id tag
===
I need to go threw a loop and check the proper radiobutton. I have multiple radio button name "rb" then with a color such as "rbGreen, rbRed, rbYellow..."
Here is my code behind<br/>
*listColors is a list of strings
Private Sub selectColor(color As String)
Dim i As Integer
For i = 0 To listColors.Count - 1
If listColors(i) = color Then
Dim rb As RadioButton = TryCast(Page.FindControl("rb" & color), RadioButton)
rb.Checked = True
End If
Next i
End Sub
While debugging, i got an error because rb is nothing... | 0 |
11,734,566 | 07/31/2012 06:46:17 | 87,557 | 04/06/2009 10:26:41 | 170 | 13 | SQL Server 2008 unattended installation needs reboot | In my setup application (custom-made), I am installing SQL Server 2008 with an unattended installation script fed in from the command line. After the SQL Server installer keeps me waiting for a few minutes (which it should, when everything is alright), it silently terminates without installing anything. This happened on a PC where I had tested the setup tens (if not hundreds) of times and this happened just this one time.
When I checked the logs, I saw that it required a reboot. Is there any way short of parsing the logs to find out if this is the case? Also, is there any way to skip the reboot check? An answer to [this question][1] mentions a /SKIPRULES parameter, but I found no such thing on MSDN.
[1]: http://stackoverflow.com/questions/176857/installation-problem-sql-server-2008 | sql | installer | installation | null | null | null | open | SQL Server 2008 unattended installation needs reboot
===
In my setup application (custom-made), I am installing SQL Server 2008 with an unattended installation script fed in from the command line. After the SQL Server installer keeps me waiting for a few minutes (which it should, when everything is alright), it silently terminates without installing anything. This happened on a PC where I had tested the setup tens (if not hundreds) of times and this happened just this one time.
When I checked the logs, I saw that it required a reboot. Is there any way short of parsing the logs to find out if this is the case? Also, is there any way to skip the reboot check? An answer to [this question][1] mentions a /SKIPRULES parameter, but I found no such thing on MSDN.
[1]: http://stackoverflow.com/questions/176857/installation-problem-sql-server-2008 | 0 |
11,734,571 | 07/31/2012 06:46:29 | 1,116,825 | 12/26/2011 22:17:44 | 23 | 6 | app won't run on device & meta | I'm searched both here and at apple's devforums and followed all suggestions and am still stuck.
Basically, my app runs in the Simulator but won't run when switched to the device (an iPod touch). No errors - I get a 'finished running' message from Xcode.
The trick is that another of my apps does run on the device. Hmm.
Incidentally (this is the 'meta' part) this bug is very confusing. I haven't a clue where to look/what to read. It makes me think that there's a document somewhere that I've missed. Any ideas about solving these types of bugs in general?
| ios | xcode | null | null | null | null | open | app won't run on device & meta
===
I'm searched both here and at apple's devforums and followed all suggestions and am still stuck.
Basically, my app runs in the Simulator but won't run when switched to the device (an iPod touch). No errors - I get a 'finished running' message from Xcode.
The trick is that another of my apps does run on the device. Hmm.
Incidentally (this is the 'meta' part) this bug is very confusing. I haven't a clue where to look/what to read. It makes me think that there's a document somewhere that I've missed. Any ideas about solving these types of bugs in general?
| 0 |
11,734,574 | 07/31/2012 06:46:59 | 5,865 | 09/11/2008 14:35:14 | 2,108 | 63 | Hide columns when serializing via toArray() | I have a simple problem where I often return CRUD type Ajax requests with array serialized versions of Doctrine 1.2 models. I'd love to be able to simply return the toArray() method after the execute() result, however, this will display data about my models that I don't wish to expose. A simple example is on my user model the password and salt get displayed. While I realize those are already hashed values, it's something I'd rather not return as a JSON response.
I've poured over the Doctrine 1.2 manual, but did not find anything that offered the type of functionality I'm looking for. I realize I can iterate over the result to manually unset() the columns I wish to hide, but I'm hoping a more native solution is out there that I've overlooked. | php | orm | doctrine | crud | doctrine-1.2 | null | open | Hide columns when serializing via toArray()
===
I have a simple problem where I often return CRUD type Ajax requests with array serialized versions of Doctrine 1.2 models. I'd love to be able to simply return the toArray() method after the execute() result, however, this will display data about my models that I don't wish to expose. A simple example is on my user model the password and salt get displayed. While I realize those are already hashed values, it's something I'd rather not return as a JSON response.
I've poured over the Doctrine 1.2 manual, but did not find anything that offered the type of functionality I'm looking for. I realize I can iterate over the result to manually unset() the columns I wish to hide, but I'm hoping a more native solution is out there that I've overlooked. | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.