PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 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 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,417,902 | 03/24/2011 10:42:05 | 662,198 | 03/16/2011 09:29:39 | 60 | 2 | How to execute a query in datatable. | The query consists of selected columns, filter criteria, grouping, aggregate function and expressions. | c# | null | null | null | null | 03/24/2011 10:49:21 | not a real question | How to execute a query in datatable.
===
The query consists of selected columns, filter criteria, grouping, aggregate function and expressions. | 1 |
1,171,360 | 07/23/2009 12:16:12 | 105,165 | 05/12/2009 05:50:17 | 11 | 0 | removing and appending a node | I want to remove below span elements from the div (<div id='foo'>) and append newly created nodes instead each of them.
I am using a loop to traverse all the childerns of the div, and for each node found i am removing it with removeChild and append an newly created node.
I am getting o/p as
<div id='foo'>
<SPAN>new text</SPAN>
</div>
I want the o/p as follows
<div id='foo'>
<SPAN>new text</SPAN>
<SPAN>new text</SPAN>
<SPAN>new text</SPAN>
</div>
Code for the problem is as follows
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<div id='foo'>
<SPAN>welcome to the world of translation.</SPAN>
<SPAN>Thank you for using it</SPAN>
<SPAN>visit again</SPAN>
</div>
<table border="0" cellspacing="5" cellpadding="0" class="lipi-header-logo-menu">
<tr>
<td align="left">
<SPAN>Hello</SPAN>
</td>
<td align="left">
World is not enough
</td>
</tr>
</table>
<div><a href="aa" id="id">this is a test</a></div>
<script>
var element = document.getElementById('foo');
seg = document.createElement('SPAN');
root_1_SPAN_1_text = document.createTextNode('new text');
seg.appendChild(root_1_SPAN_1_text);
if (element.hasChildNodes())
{
var children = element.childNodes;
for (var i = 0; i < children.length; i++)
{
if(children[i].nodeName=="#text")
{
continue;
}
element.removeChild(children[i]);
element.appendChild(seg);
};
};
</script>
</BODY>
</HTML>
Thanks in advance
| node | null | null | null | null | null | open | removing and appending a node
===
I want to remove below span elements from the div (<div id='foo'>) and append newly created nodes instead each of them.
I am using a loop to traverse all the childerns of the div, and for each node found i am removing it with removeChild and append an newly created node.
I am getting o/p as
<div id='foo'>
<SPAN>new text</SPAN>
</div>
I want the o/p as follows
<div id='foo'>
<SPAN>new text</SPAN>
<SPAN>new text</SPAN>
<SPAN>new text</SPAN>
</div>
Code for the problem is as follows
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<div id='foo'>
<SPAN>welcome to the world of translation.</SPAN>
<SPAN>Thank you for using it</SPAN>
<SPAN>visit again</SPAN>
</div>
<table border="0" cellspacing="5" cellpadding="0" class="lipi-header-logo-menu">
<tr>
<td align="left">
<SPAN>Hello</SPAN>
</td>
<td align="left">
World is not enough
</td>
</tr>
</table>
<div><a href="aa" id="id">this is a test</a></div>
<script>
var element = document.getElementById('foo');
seg = document.createElement('SPAN');
root_1_SPAN_1_text = document.createTextNode('new text');
seg.appendChild(root_1_SPAN_1_text);
if (element.hasChildNodes())
{
var children = element.childNodes;
for (var i = 0; i < children.length; i++)
{
if(children[i].nodeName=="#text")
{
continue;
}
element.removeChild(children[i]);
element.appendChild(seg);
};
};
</script>
</BODY>
</HTML>
Thanks in advance
| 0 |
11,290,584 | 07/02/2012 08:58:20 | 1,456,012 | 06/14/2012 10:52:59 | 10 | 0 | WebView send parametrs to server | I need to take and send to the server, these parameters (http_X_wap Profile, Http_Referer, IMEI, MSISDN), how do I do? | android | android-webview | null | null | null | 07/02/2012 14:50:16 | not a real question | WebView send parametrs to server
===
I need to take and send to the server, these parameters (http_X_wap Profile, Http_Referer, IMEI, MSISDN), how do I do? | 1 |
6,468,116 | 06/23/2011 13:55:44 | 743,802 | 05/08/2011 10:44:50 | 8 | 0 | Elusive count variable | Short version:
`$count` in the code below seems to be 0 even when it shouldn't, why?
Long version:
The other day my boss said "X has made a program to store schematics in, and released the source code. put this on our intranet" So i got around to figure everything out. The source was about 25 different .php-files and a picture describing database tables and relations. Is the error related to the piece of code below or does it have to do with something else?
Maybe I'm just tired from a long week and just don't see it.
Code:
<?php
/**
* new_series.php
*
* Generates all the forms for creating a new series and machinenumbers.
* One form for selecting what drawinglists the serie should contain.
* One form for selecting what drawing the serie should contain and select
* a serienumber.
* One form for selecting machinnumbers.
* One form for listing all drawings with all information and number of
* copies that should be printed.
* This is where the function to automaticly print all drawings should be called
* when that function is availible.
*
* @author Emil Abrahamsson <emil@gavle.to>
*/
if(isset($_REQUEST['list_drw'])){
$info;
for($i=0;$i<20;$i++){
if(isset($_REQUEST['info'.$i]))
$info[$i]=$_REQUEST['info'.$i];
}
$sql1='SELECT * FROM '.TABLE_PREFIX.'drawinglist WHERE
machinetype="'.$_REQUEST['machinetype'].'"';
$result1=mysql_query($sql1,$dbh) or die('sql1: '.mysql_error($dbh));
$drwlists;
$j=0;
while($row1=@mysql_fetch_array($result1,MYSQL_ASSOC)){
foreach($info as $inf){
if($row1['info']==$inf){
$drwlists[$j]=$row1;
$j++;
}
}
}
echo('
<div class="text">
<form name="list_drw" id="list_drw" action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<fieldset style="border:1px solid #783151;width: 355px;height:60px;">
<legend>Ange serienummer och antal:</legend>
<table>
<tr>
<td><label for="series">Serie:</label></td>
<td><input type="text" name="series" id="series" /></td>
<td><label for="quantity">Antal:</label></td>
<td><input type="text" name="quantity" id="quantity" /></td>
</tr>
</table>
</fieldset>
');
$counter=0;
foreach($drwlists as $list){
echo('
<table class="info" width="100%" style="border-bottom:2px solid">
<tr>
<td>Maskintyp: '.$list['machinetype'].'</td>
<td>Info: '.$list['info'].'</td>
<td>Datum: '.$list['date'].'</td>
</tr>
</table>
<table width="100%" style="border-collapse:collapse;text-align:center;" border="1">
<tr>
<td style="width:20px;"> </td>
<td style="width:40px;"><label>Ritningsnr</label></td>
<td style="width:15px;"><label>Pos</label></td>
<td style="width:15px;"><label>Rev</label></td>
<td style="width:150px;"><label>Benämning</label></td>
<td style="width:20px;"><label>St/m</label></td>
<td style="width:100px;"><label>Anmärkning</label></td>
</tr>
');
$sql2='SELECT * FROM '.TABLE_PREFIX.'drawinglist_row WHERE
drawinglistID='.$list['drawinglistID'];
$result2=@mysql_query($sql2,$dbh) or die('sql2: '.mysql_error($dbh));
while($row2=@mysql_fetch_array($result2,MYSQL_ASSOC)){
$sql3='SELECT * FROM '.TABLE_PREFIX.'drawings WHERE drawingID="'.$row2['drawingID'].'"
ORDER BY review DESC';
$result3=@mysql_query($sql3,$dbh) or die('sql3: '.mysql_error($dbh));
$row3=@mysql_fetch_array($result3,MYSQL_ASSOC);
echo('
<tr>
<td><input type="checkbox" name="drwlist_rowID[]" id="drwlist_rowID[]"
value="'.$row2['drawinglist_rowID'].'" checked="checked"></td>
<td>'.$row2['drawingID'].'</td>
<td>'.$row2['pos'].'</td>
<td>'.$row3['review'].'</td>
<td>'.$row3['designation'].'</td>
<td>'.$row2['stm'].'</td>
<td>'.$row2['observation'].'</td>
</tr>
');
}
echo('
</table>
');
}
echo('
<table width="100%">
<tr>
<td align="right"><input type="submit" name="new_series" id="new_series"
value="Nästa" /></td>
</tr>
</table>
</form>
</div>
');
}else if(isset($_REQUEST['new_series'])){
//echo('NEW SERIES IS SET');
$count=count($drwlist_rowID);
for($i=0;$i<$_REQUEST['quantity'];$i++){
$sql='INSERT INTO '.TABLE_PREFIX.'series VALUES("'.$_REQUEST['series'].'",'.$_REQUEST['quantity'].', '.($i+1).')';
echo($sql.'</br></br>');
$result=@mysql_query($sql,$dbh) or die('sql: '.mysql_error($dbh));
echo($count);
for($j=0;$j<$count;$j++){
echo($j);
$sql2='INSERT INTO '.TABLE_PREFIX.'machinelist VALUES("'.$drwlist_rowID[$j].'", "'.$_REQUEST['series'].'", '.($i+1).')';
echo($sql2.'</br>');
$result2=@mysql_query($sql2,$dbh) or die('sql2: '.mysql_error($dbh));
}
}
echo('
<div class="text">
<form name="new_series" id="new_series" action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<input type="hidden" name="series" id="series" value="'.$_REQUEST['series'].'" />
<input type="hidden" name="quantity" id="copies" value="'.$_REQUEST['quantity'].'" />
<fieldset style="border:1px solid #783151;width: 200px;">
<legend>Ange maskinnummer:</legend>
<table>
<tr>
<td>Serie</td>
<td>Löpnummer</td>
<td>Antal</td>
<td>Maskinnummer</td>
</tr>
');
for($i=0;$i<$_REQUEST['quantity'];$i++){
echo('
<tr>
<td>'.$_REQUEST['series'].'</td>
<td><input type="hidden" name="number[]" id="number[]" value="'.($i+1).'"
/>'.($i+1).'</td>
<td>'.$_REQUEST['quantity'].'</td>
<td><input type="text" name="machinenr[]" id="machinenr[]" /></td>
</tr>
');
}
echo('
<tr>
<td colspan="4" align="right"><input type="submit" name="create" id="create"
value="Skapa" /></td>
</table>
</form>
</div>
');
}else if(isset($_REQUEST['create'])){
$count=count($machinenr);
for($i=0;$i<$count;$i++){
if($machinenr[$i]!=''){
$sql='INSERT INTO '.TABLE_PREFIX.'machine VALUES ("'.$machinenr[$i].'",
"'.$_REQUEST['series'].'", '.$_REQUEST['quantity'].', '.$number[$i].')';
$result=@mysql_query($sql,$dbh) or die('sql: '.mysql_error($dbh));
}
}
$sql2 = 'SELECT drawinglist_rowID FROM '.TABLE_PREFIX.'machinelist WHERE
series="'.$_REQUEST['series'].'" GROUP BY drawinglist_rowID';
$result2=@mysql_query($sql2,$dbh) or die('sql2: '.mysql_error($dbh));
echo($sql2.'<br>');
$sql3='SELECT * FROM '.TABLE_PREFIX.'drawinglist_row WHERE drawinglist_rowID='.@mysql_result($result2,0,'drawinglist_rowID');
echo($sql3.'<br>');
$result3=@mysql_query($sql3,$dbh) or die('sql3: '.mysql_error($dbh));
$sql4='SELECT machinetype FROM '.TABLE_PREFIX.'drawinglist WHERE
drawinglistID='.@mysql_result($result3,0,'drawinglistID');
$result4=@mysql_query($sql4,$dbh) or die('sql4: '.mysql_error($dbh));
echo('
<div class="text">
<form name="print_drw" id="print_drw action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<table class="info" width="100%" style="border-bottom:2px solid">
<tr>
<td>Maskintyp: '.@mysql_result($result4,0,'machinetype').'</td>
</tr>
</table>
<table width="100%" style="border-collapse:collapse;text-align:center;" border="1">
<tr>
<td style="width:40px;"><label>Ritningsnr</label></td>
<td style="width:15px;"><label>Pos</label></td>
<td style="width:15px;"><label>Rev</label></td>
<td style="width:150px;"><label>Benämning</label></td>
<td style="width:20px;"><label>St/m</label></td>
<td style="width:100px;"><label>Anmärkning</label></td>
<td style="width:40px;"><label>PDF</label></td>
<td style="width:50px;"><label>Utskr. ant.</label></td>
</tr>
');
while($row2=@mysql_fetch_array($result2,MYSQL_ASSOC)){
$sql5='SELECT * FROM '.TABLE_PREFIX.'drawinglist_row WHERE
drawinglist_rowID='.$row2['drawinglist_rowID'];
$result5=@mysql_query($sql5,$dbh) or die('sql5: '.mysql_error($dbh));
$row5=@mysql_fetch_array($result5,MYSQL_ASSOC);
$sql6='SELECT designation, review FROM '.TABLE_PREFIX.'drawings WHERE
drawingID="'.$row5['drawingID'].'" ORDER BY review DESC';
$result6=@mysql_query($sql6, $dbh) or die('sql6: '.mysql_error($dbh));
$row6=@mysql_fetch_array($result6,MYSQL_ASSOC);
$type=substr(preg_replace("/[^0-9]/", '', $row5['drawingID']),0,1);
$no;
switch($type){
case '1':
case '2':
$no=4;
break;
case '3':
case '4'
:$no=3;
break;
}
echo('
<tr>
<td>'.$row5['drawingID'].'</td>
<td>'.$row5['pos'].'</td>
<td>'.$row6['review'].'</td>
<td>'.$row6['designation'].'</td>
<td>'.$row5['stm'].'</td>
<td>'.$row5['observation'].'</td>
<td>
');
$url= DRW_PATH.$row5['drawingID'].strtolower($row6['review']).'.pdf';
if(file_exists($url))
echo('<a href="'.$url.'" target="_blank">PDF</a><input type="hidden" name="url[]"
id="url[]" value="'.$url.'" />');
echo('
</td>
<td><input type="text" name="copies[]" id="copies[]" size="2" style="text-
align:center;" value="'.$no.'"/></td>
</tr>
');
}
/* Not functional yet */
/*
echo('
</table>
<table width="100%">
<tr>
<td align="right"><input type="submit" name="print" id="print" value="Skriv ut"
/></td>
</tr>
</table>
</form>
</div>
');
*/
echo('
</table>
</form>
</div>
');
}else{
$sql1='SELECT info FROM '.TABLE_PREFIX.'drawinglist WHERE
machinetype="'.$_REQUEST['machinetype'].'" GROUP BY info';
$result1=@mysql_query($sql1,$dbh) or die ('sql1: '.mysql_error($dbh));
echo('
<div class="text">
<form name="new_serie" id="new_serie" action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<input type="hidden" name="machinetype" id="machinetype"
value="'.$_REQUEST['machinetype'].'" />
<table>
<tr>
<td colspan="2" class="machinetype">'.$_REQUEST['machinetype'].'</td>
</tr>
');
$j=0;
while($row1=@mysql_fetch_array($result1,MYSQL_ASSOC)){
echo('
<tr>
<td><font style="font-family:Verdana, sans-serif;font-size:14px;color:#000000;line-
height:25px;">'.$row1['info'].'</font></td>
<td><input type="checkbox" name="info'.$j.'" id="info'.$j.'" value="'.$row1['info'].'"
/></td>
</tr>
');
$j++;
}
echo('
<tr>
<td colspan="2" align="right"><input type="submit" name="list_drw" id="list_drw"
value="Nästa" /></td>
</tr>
</table>
</form>
</div>
');
}
?> | php | mysql | forms | null | null | null | open | Elusive count variable
===
Short version:
`$count` in the code below seems to be 0 even when it shouldn't, why?
Long version:
The other day my boss said "X has made a program to store schematics in, and released the source code. put this on our intranet" So i got around to figure everything out. The source was about 25 different .php-files and a picture describing database tables and relations. Is the error related to the piece of code below or does it have to do with something else?
Maybe I'm just tired from a long week and just don't see it.
Code:
<?php
/**
* new_series.php
*
* Generates all the forms for creating a new series and machinenumbers.
* One form for selecting what drawinglists the serie should contain.
* One form for selecting what drawing the serie should contain and select
* a serienumber.
* One form for selecting machinnumbers.
* One form for listing all drawings with all information and number of
* copies that should be printed.
* This is where the function to automaticly print all drawings should be called
* when that function is availible.
*
* @author Emil Abrahamsson <emil@gavle.to>
*/
if(isset($_REQUEST['list_drw'])){
$info;
for($i=0;$i<20;$i++){
if(isset($_REQUEST['info'.$i]))
$info[$i]=$_REQUEST['info'.$i];
}
$sql1='SELECT * FROM '.TABLE_PREFIX.'drawinglist WHERE
machinetype="'.$_REQUEST['machinetype'].'"';
$result1=mysql_query($sql1,$dbh) or die('sql1: '.mysql_error($dbh));
$drwlists;
$j=0;
while($row1=@mysql_fetch_array($result1,MYSQL_ASSOC)){
foreach($info as $inf){
if($row1['info']==$inf){
$drwlists[$j]=$row1;
$j++;
}
}
}
echo('
<div class="text">
<form name="list_drw" id="list_drw" action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<fieldset style="border:1px solid #783151;width: 355px;height:60px;">
<legend>Ange serienummer och antal:</legend>
<table>
<tr>
<td><label for="series">Serie:</label></td>
<td><input type="text" name="series" id="series" /></td>
<td><label for="quantity">Antal:</label></td>
<td><input type="text" name="quantity" id="quantity" /></td>
</tr>
</table>
</fieldset>
');
$counter=0;
foreach($drwlists as $list){
echo('
<table class="info" width="100%" style="border-bottom:2px solid">
<tr>
<td>Maskintyp: '.$list['machinetype'].'</td>
<td>Info: '.$list['info'].'</td>
<td>Datum: '.$list['date'].'</td>
</tr>
</table>
<table width="100%" style="border-collapse:collapse;text-align:center;" border="1">
<tr>
<td style="width:20px;"> </td>
<td style="width:40px;"><label>Ritningsnr</label></td>
<td style="width:15px;"><label>Pos</label></td>
<td style="width:15px;"><label>Rev</label></td>
<td style="width:150px;"><label>Benämning</label></td>
<td style="width:20px;"><label>St/m</label></td>
<td style="width:100px;"><label>Anmärkning</label></td>
</tr>
');
$sql2='SELECT * FROM '.TABLE_PREFIX.'drawinglist_row WHERE
drawinglistID='.$list['drawinglistID'];
$result2=@mysql_query($sql2,$dbh) or die('sql2: '.mysql_error($dbh));
while($row2=@mysql_fetch_array($result2,MYSQL_ASSOC)){
$sql3='SELECT * FROM '.TABLE_PREFIX.'drawings WHERE drawingID="'.$row2['drawingID'].'"
ORDER BY review DESC';
$result3=@mysql_query($sql3,$dbh) or die('sql3: '.mysql_error($dbh));
$row3=@mysql_fetch_array($result3,MYSQL_ASSOC);
echo('
<tr>
<td><input type="checkbox" name="drwlist_rowID[]" id="drwlist_rowID[]"
value="'.$row2['drawinglist_rowID'].'" checked="checked"></td>
<td>'.$row2['drawingID'].'</td>
<td>'.$row2['pos'].'</td>
<td>'.$row3['review'].'</td>
<td>'.$row3['designation'].'</td>
<td>'.$row2['stm'].'</td>
<td>'.$row2['observation'].'</td>
</tr>
');
}
echo('
</table>
');
}
echo('
<table width="100%">
<tr>
<td align="right"><input type="submit" name="new_series" id="new_series"
value="Nästa" /></td>
</tr>
</table>
</form>
</div>
');
}else if(isset($_REQUEST['new_series'])){
//echo('NEW SERIES IS SET');
$count=count($drwlist_rowID);
for($i=0;$i<$_REQUEST['quantity'];$i++){
$sql='INSERT INTO '.TABLE_PREFIX.'series VALUES("'.$_REQUEST['series'].'",'.$_REQUEST['quantity'].', '.($i+1).')';
echo($sql.'</br></br>');
$result=@mysql_query($sql,$dbh) or die('sql: '.mysql_error($dbh));
echo($count);
for($j=0;$j<$count;$j++){
echo($j);
$sql2='INSERT INTO '.TABLE_PREFIX.'machinelist VALUES("'.$drwlist_rowID[$j].'", "'.$_REQUEST['series'].'", '.($i+1).')';
echo($sql2.'</br>');
$result2=@mysql_query($sql2,$dbh) or die('sql2: '.mysql_error($dbh));
}
}
echo('
<div class="text">
<form name="new_series" id="new_series" action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<input type="hidden" name="series" id="series" value="'.$_REQUEST['series'].'" />
<input type="hidden" name="quantity" id="copies" value="'.$_REQUEST['quantity'].'" />
<fieldset style="border:1px solid #783151;width: 200px;">
<legend>Ange maskinnummer:</legend>
<table>
<tr>
<td>Serie</td>
<td>Löpnummer</td>
<td>Antal</td>
<td>Maskinnummer</td>
</tr>
');
for($i=0;$i<$_REQUEST['quantity'];$i++){
echo('
<tr>
<td>'.$_REQUEST['series'].'</td>
<td><input type="hidden" name="number[]" id="number[]" value="'.($i+1).'"
/>'.($i+1).'</td>
<td>'.$_REQUEST['quantity'].'</td>
<td><input type="text" name="machinenr[]" id="machinenr[]" /></td>
</tr>
');
}
echo('
<tr>
<td colspan="4" align="right"><input type="submit" name="create" id="create"
value="Skapa" /></td>
</table>
</form>
</div>
');
}else if(isset($_REQUEST['create'])){
$count=count($machinenr);
for($i=0;$i<$count;$i++){
if($machinenr[$i]!=''){
$sql='INSERT INTO '.TABLE_PREFIX.'machine VALUES ("'.$machinenr[$i].'",
"'.$_REQUEST['series'].'", '.$_REQUEST['quantity'].', '.$number[$i].')';
$result=@mysql_query($sql,$dbh) or die('sql: '.mysql_error($dbh));
}
}
$sql2 = 'SELECT drawinglist_rowID FROM '.TABLE_PREFIX.'machinelist WHERE
series="'.$_REQUEST['series'].'" GROUP BY drawinglist_rowID';
$result2=@mysql_query($sql2,$dbh) or die('sql2: '.mysql_error($dbh));
echo($sql2.'<br>');
$sql3='SELECT * FROM '.TABLE_PREFIX.'drawinglist_row WHERE drawinglist_rowID='.@mysql_result($result2,0,'drawinglist_rowID');
echo($sql3.'<br>');
$result3=@mysql_query($sql3,$dbh) or die('sql3: '.mysql_error($dbh));
$sql4='SELECT machinetype FROM '.TABLE_PREFIX.'drawinglist WHERE
drawinglistID='.@mysql_result($result3,0,'drawinglistID');
$result4=@mysql_query($sql4,$dbh) or die('sql4: '.mysql_error($dbh));
echo('
<div class="text">
<form name="print_drw" id="print_drw action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<table class="info" width="100%" style="border-bottom:2px solid">
<tr>
<td>Maskintyp: '.@mysql_result($result4,0,'machinetype').'</td>
</tr>
</table>
<table width="100%" style="border-collapse:collapse;text-align:center;" border="1">
<tr>
<td style="width:40px;"><label>Ritningsnr</label></td>
<td style="width:15px;"><label>Pos</label></td>
<td style="width:15px;"><label>Rev</label></td>
<td style="width:150px;"><label>Benämning</label></td>
<td style="width:20px;"><label>St/m</label></td>
<td style="width:100px;"><label>Anmärkning</label></td>
<td style="width:40px;"><label>PDF</label></td>
<td style="width:50px;"><label>Utskr. ant.</label></td>
</tr>
');
while($row2=@mysql_fetch_array($result2,MYSQL_ASSOC)){
$sql5='SELECT * FROM '.TABLE_PREFIX.'drawinglist_row WHERE
drawinglist_rowID='.$row2['drawinglist_rowID'];
$result5=@mysql_query($sql5,$dbh) or die('sql5: '.mysql_error($dbh));
$row5=@mysql_fetch_array($result5,MYSQL_ASSOC);
$sql6='SELECT designation, review FROM '.TABLE_PREFIX.'drawings WHERE
drawingID="'.$row5['drawingID'].'" ORDER BY review DESC';
$result6=@mysql_query($sql6, $dbh) or die('sql6: '.mysql_error($dbh));
$row6=@mysql_fetch_array($result6,MYSQL_ASSOC);
$type=substr(preg_replace("/[^0-9]/", '', $row5['drawingID']),0,1);
$no;
switch($type){
case '1':
case '2':
$no=4;
break;
case '3':
case '4'
:$no=3;
break;
}
echo('
<tr>
<td>'.$row5['drawingID'].'</td>
<td>'.$row5['pos'].'</td>
<td>'.$row6['review'].'</td>
<td>'.$row6['designation'].'</td>
<td>'.$row5['stm'].'</td>
<td>'.$row5['observation'].'</td>
<td>
');
$url= DRW_PATH.$row5['drawingID'].strtolower($row6['review']).'.pdf';
if(file_exists($url))
echo('<a href="'.$url.'" target="_blank">PDF</a><input type="hidden" name="url[]"
id="url[]" value="'.$url.'" />');
echo('
</td>
<td><input type="text" name="copies[]" id="copies[]" size="2" style="text-
align:center;" value="'.$no.'"/></td>
</tr>
');
}
/* Not functional yet */
/*
echo('
</table>
<table width="100%">
<tr>
<td align="right"><input type="submit" name="print" id="print" value="Skriv ut"
/></td>
</tr>
</table>
</form>
</div>
');
*/
echo('
</table>
</form>
</div>
');
}else{
$sql1='SELECT info FROM '.TABLE_PREFIX.'drawinglist WHERE
machinetype="'.$_REQUEST['machinetype'].'" GROUP BY info';
$result1=@mysql_query($sql1,$dbh) or die ('sql1: '.mysql_error($dbh));
echo('
<div class="text">
<form name="new_serie" id="new_serie" action="index.php" method="post">
<input type="hidden" name="page" id="page" value="new_series" />
<input type="hidden" name="machinetype" id="machinetype"
value="'.$_REQUEST['machinetype'].'" />
<table>
<tr>
<td colspan="2" class="machinetype">'.$_REQUEST['machinetype'].'</td>
</tr>
');
$j=0;
while($row1=@mysql_fetch_array($result1,MYSQL_ASSOC)){
echo('
<tr>
<td><font style="font-family:Verdana, sans-serif;font-size:14px;color:#000000;line-
height:25px;">'.$row1['info'].'</font></td>
<td><input type="checkbox" name="info'.$j.'" id="info'.$j.'" value="'.$row1['info'].'"
/></td>
</tr>
');
$j++;
}
echo('
<tr>
<td colspan="2" align="right"><input type="submit" name="list_drw" id="list_drw"
value="Nästa" /></td>
</tr>
</table>
</form>
</div>
');
}
?> | 0 |
7,440,910 | 09/16/2011 06:23:22 | 659,998 | 03/15/2011 05:29:31 | 41 | 3 | Reactive Extensions (Rx) in windows Phone Mango | what is meant by Reactive Extensions(Rx). How its helps me to develop applications in windows phone mango?? Is it q framework or helper library? What is the role of this (Rx) in effective application development in WP. Mango. Can any one please suggest me some links to learn the technique, | c# | windows-phone-7 | system.reactive | null | null | 09/16/2011 13:54:33 | not constructive | Reactive Extensions (Rx) in windows Phone Mango
===
what is meant by Reactive Extensions(Rx). How its helps me to develop applications in windows phone mango?? Is it q framework or helper library? What is the role of this (Rx) in effective application development in WP. Mango. Can any one please suggest me some links to learn the technique, | 4 |
10,212,505 | 04/18/2012 15:18:15 | 1,082,764 | 12/06/2011 03:31:49 | 190 | 0 | What site can i compile and test C code online like codepad. Requirement:must be able to use 'scanf' properly | I am a student and want to test my amerature C code online at any computer. There is a fantastic website www.codepad.org that i use. My only problem is that it wont let me input things using scanf and it wont let me -lm. Is there a website that allows these things? | c | null | null | null | null | 04/19/2012 15:26:39 | not constructive | What site can i compile and test C code online like codepad. Requirement:must be able to use 'scanf' properly
===
I am a student and want to test my amerature C code online at any computer. There is a fantastic website www.codepad.org that i use. My only problem is that it wont let me input things using scanf and it wont let me -lm. Is there a website that allows these things? | 4 |
11,032,307 | 06/14/2012 11:40:43 | 1,037,747 | 11/09/2011 13:30:49 | 49 | 0 | Repeated values in x axis in dotnet higchart controls | I m facing problem with dotnet highcharts controls the problem is the values in x axis are repeating i.e. 0 0 1 1 2 2 3 3 4 4 5 5. Please help
below is my code.
Javascript code
<div id='ContentAvailabilty_container'></div>
<script type='text/javascript'>
var ContentAvailabilty;
$(document).ready(function() {
ContentAvailabilty = new Highcharts.Chart({
chart: { renderTo:'ContentAvailabilty_container', type: 'bar' },
legend: { enabled: false, layout: 'horizontal' },
plotOptions: { bar: { borderWidth: 0 } },
title: { text: 'Content Availabilty' },
xAxis: { categories: ['#Rest of Published', '#Published Queue', '#Rest of Unpublished', '#Unpublished Queue', '#New Approved'] },
yAxis: { labels: { formatter: function() { return Highcharts.numberFormat(this.value, 0); } }, min: 0, title: { text: '' } },
series: [{ data: [5, 0, 0, 0, 0] }]
});
});
</script>
DOT NET CODE
DotNet.Highcharts.Highcharts currentReport = new DotNet.Highcharts.Highcharts("ContentAvailabilty");
currentReport.InitChart(new Chart { Type = ChartTypes.Bar });
currentReport.SetTitle(new Title { Text = "Content Availabilty" });
currentReport.SetXAxis(new XAxis
{
Categories = new[] { "#Rest of Published", "#Published", "#Rest of Unpublished", "#Unpublished", "#Approved" }
});
currentReport.SetYAxis(new YAxis
{
Title = new XAxisTitle { Text = "" }
, Labels = new XAxisLabels { Formatter = "function() { return Highcharts.numberFormat(this.value, 0); }" }//function to convert 4k to 4000
,Min=0
});
currentReport.SetLegend(new Legend { Enabled = false });
currentReport.SetPlotOptions(new PlotOptions { Bar = new PlotOptionsBar { BorderWidth=0} });
currentReport.SetSeries(new Series[] {
new Series{
Data = new Data( new object[]{ RestofPublished, publishedQueue, Rest_of_UnPublished, UnPublished_Queue, newApproved } )
}
});
ReportContainerLabel.Text = string.Empty;
ReportContainerLabel.Text = currentReport.ToHtmlString(); | c# | highcharts | null | null | null | null | open | Repeated values in x axis in dotnet higchart controls
===
I m facing problem with dotnet highcharts controls the problem is the values in x axis are repeating i.e. 0 0 1 1 2 2 3 3 4 4 5 5. Please help
below is my code.
Javascript code
<div id='ContentAvailabilty_container'></div>
<script type='text/javascript'>
var ContentAvailabilty;
$(document).ready(function() {
ContentAvailabilty = new Highcharts.Chart({
chart: { renderTo:'ContentAvailabilty_container', type: 'bar' },
legend: { enabled: false, layout: 'horizontal' },
plotOptions: { bar: { borderWidth: 0 } },
title: { text: 'Content Availabilty' },
xAxis: { categories: ['#Rest of Published', '#Published Queue', '#Rest of Unpublished', '#Unpublished Queue', '#New Approved'] },
yAxis: { labels: { formatter: function() { return Highcharts.numberFormat(this.value, 0); } }, min: 0, title: { text: '' } },
series: [{ data: [5, 0, 0, 0, 0] }]
});
});
</script>
DOT NET CODE
DotNet.Highcharts.Highcharts currentReport = new DotNet.Highcharts.Highcharts("ContentAvailabilty");
currentReport.InitChart(new Chart { Type = ChartTypes.Bar });
currentReport.SetTitle(new Title { Text = "Content Availabilty" });
currentReport.SetXAxis(new XAxis
{
Categories = new[] { "#Rest of Published", "#Published", "#Rest of Unpublished", "#Unpublished", "#Approved" }
});
currentReport.SetYAxis(new YAxis
{
Title = new XAxisTitle { Text = "" }
, Labels = new XAxisLabels { Formatter = "function() { return Highcharts.numberFormat(this.value, 0); }" }//function to convert 4k to 4000
,Min=0
});
currentReport.SetLegend(new Legend { Enabled = false });
currentReport.SetPlotOptions(new PlotOptions { Bar = new PlotOptionsBar { BorderWidth=0} });
currentReport.SetSeries(new Series[] {
new Series{
Data = new Data( new object[]{ RestofPublished, publishedQueue, Rest_of_UnPublished, UnPublished_Queue, newApproved } )
}
});
ReportContainerLabel.Text = string.Empty;
ReportContainerLabel.Text = currentReport.ToHtmlString(); | 0 |
5,967,506 | 05/11/2011 16:22:03 | 436,111 | 08/31/2010 15:52:59 | 30 | 0 | Output Parameters used with update CASCADE issue, when using data adapters. | I've manually created some data adapters – using the auto-generated ones is not viable due to version incompatibilities, for a dataset made of a number of tables with the usual mixture of PK, FK constraints. Most of its working pretty smoothly so far, but after modifying the adapters to use DB sequences for the PKs (instead of the temporary one assigned to the rows in the dataset) when updating the DB with new ‘added’ rows, I’ve been hitting problems.
I added the sequences into the insert statements and changed PK parameter to output parameters, so that it would update the dataset row and thus update all the child rows as well (with the UPDATE CASCADE rule). The problem is that the child rows, that, before the update had a row state of added, are changed to a state of modified (I don’t agree this should even be happening, surely an added row should stay as added even if it’s modified!). Thus when we get round to updating the child table with the child rows, it fails as its expecting rows with the added state.
What’s the cleanest way I could get around this problem? Potential solutions I can think of:
- Turning off UPDATE CASCADE and updating each child row manually after, updating the parents PK and changing each row back to added, after modifying it.
- Creating a copy of the all the added rows in all tables of the dataset before starting updates and then updating the main copy after each tables updates marking all the correct rows back to added.
Any better ideas?
| update | cascade | dataadapter | output-parameter | rowstate | null | open | Output Parameters used with update CASCADE issue, when using data adapters.
===
I've manually created some data adapters – using the auto-generated ones is not viable due to version incompatibilities, for a dataset made of a number of tables with the usual mixture of PK, FK constraints. Most of its working pretty smoothly so far, but after modifying the adapters to use DB sequences for the PKs (instead of the temporary one assigned to the rows in the dataset) when updating the DB with new ‘added’ rows, I’ve been hitting problems.
I added the sequences into the insert statements and changed PK parameter to output parameters, so that it would update the dataset row and thus update all the child rows as well (with the UPDATE CASCADE rule). The problem is that the child rows, that, before the update had a row state of added, are changed to a state of modified (I don’t agree this should even be happening, surely an added row should stay as added even if it’s modified!). Thus when we get round to updating the child table with the child rows, it fails as its expecting rows with the added state.
What’s the cleanest way I could get around this problem? Potential solutions I can think of:
- Turning off UPDATE CASCADE and updating each child row manually after, updating the parents PK and changing each row back to added, after modifying it.
- Creating a copy of the all the added rows in all tables of the dataset before starting updates and then updating the main copy after each tables updates marking all the correct rows back to added.
Any better ideas?
| 0 |
7,621,465 | 10/01/2011 16:24:02 | 962,750 | 09/24/2011 15:28:44 | 1 | 0 | A function that returns first and then last name | I need to create an m-file in matlab that contains the following function:
function lcf = lastCommaFirst(name)
The value returned by lastCommaFirst is a string consisting of the last name, followed by a comma and a space, followed by the first name. Any help with this question would be really appreciated, thanks.
| matlab | null | null | null | null | 10/01/2011 23:43:56 | not a real question | A function that returns first and then last name
===
I need to create an m-file in matlab that contains the following function:
function lcf = lastCommaFirst(name)
The value returned by lastCommaFirst is a string consisting of the last name, followed by a comma and a space, followed by the first name. Any help with this question would be really appreciated, thanks.
| 1 |
8,665,155 | 12/29/2011 07:37:16 | 329,494 | 04/30/2010 05:49:38 | 310 | 5 | Development Enviroment Setup Advice Needed For Virtualizing | This question was closed at Super Users, so I will try here.
I am looking to setup a system, and this is not about what to get, or what to buy, this is about what to use as a host as I want to virtual the different environments and need other developers input.
The type of development I will be doing will be DB development, prototyping, heavy app, and some ETL type of application.
In these VM I will also setup small data marts to test the different processes that are created.
I was thinking of going with a linux host with 12 gig, 7i processor and also 1.5 gig (3 500 gig drives) raid 0 to help spread the disk io. The reasons for Linux is that it is lightweight I could allocated more memory to the VM rather than having a host like Windows consume it.
Do you think this type of setup would be good to dev on? Would the VM be fast or slow? How would read write be?
I would allocate 2 processors and 4-6 gigs of ram for the vm I am deving on. I would be running 1 VM at a time.
Any opinions? advice?
If you are going to close this here also, please have the courtesy to at least point me to a place I can get an answer. I really through the SuperUser place would have been it, but guess I was wrong.
Thanks.
| database | linux | virtualbox | development | null | 05/04/2012 13:27:02 | off topic | Development Enviroment Setup Advice Needed For Virtualizing
===
This question was closed at Super Users, so I will try here.
I am looking to setup a system, and this is not about what to get, or what to buy, this is about what to use as a host as I want to virtual the different environments and need other developers input.
The type of development I will be doing will be DB development, prototyping, heavy app, and some ETL type of application.
In these VM I will also setup small data marts to test the different processes that are created.
I was thinking of going with a linux host with 12 gig, 7i processor and also 1.5 gig (3 500 gig drives) raid 0 to help spread the disk io. The reasons for Linux is that it is lightweight I could allocated more memory to the VM rather than having a host like Windows consume it.
Do you think this type of setup would be good to dev on? Would the VM be fast or slow? How would read write be?
I would allocate 2 processors and 4-6 gigs of ram for the vm I am deving on. I would be running 1 VM at a time.
Any opinions? advice?
If you are going to close this here also, please have the courtesy to at least point me to a place I can get an answer. I really through the SuperUser place would have been it, but guess I was wrong.
Thanks.
| 2 |
11,238,016 | 06/28/2012 04:19:16 | 1,481,333 | 06/26/2012 00:02:10 | 3 | 0 | I am getting the following errors when I debug my code.The debug might be that Mutate is taking the value of Classroom1 | # Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
File "/Users/maninder/git/TrialScheduler/TrialScheduler/main.py", line 27, in Loop
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
File "/Users/maninder/git/TrialScheduler/TrialScheduler/main.py", line 27, in Loop
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
File "/Users/maninder/git/TrialScheduler/TrialScheduler/main.py", line 27, in Loop #
from CProfessor import Professor
from CCourse import Course
from CClassroom import Classroom
import copy
def Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize):
for i in range(0, loopsize):
Mutated = Classroom()
#Mutated = Classroom1.CopyOfClassroom(Mutated)
Mutated = copy.deepcopy(Classroom1)#Modification
Mutated.Mutate()
HardConstraintClassroomMet = Classroom1.ComputeHardConstraint()
HardConstraintMutatedMet = Mutated.ComputeHardConstraint()
if HardConstraintClassroomMet == False and HardConstraintMutatedMet == False:
h_count + 1
t_count + 1
Classroom1.Mutate()
continue
if Mutated.FitnessValue() > Classroom1.FitnessValue():
m_count + 1
t_count + 1
Classroom1 = Mutated
if Classroom1.ComputeHardConstraint() == False:
l_count + 1
temp = l_count*loopsize
print "Unable to meet hard consraints in %d" % temp
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
Professor0 = Professor(ProfessorId = 0, PreferedStartTime = 8, PreferedEndTime = 11)
Professor1 = Professor(ProfessorId = 1, PreferedStartTime = 10, PreferedEndTime = 13.75)
Professor2 = Professor(ProfessorId = 2, PreferedStartTime = 4, PreferedEndTime = 7.75)
# intializing Courses
Course0 = Course(CourseId = 0, ProfessorId = 0, CourseSlot = 0, CourseType ="UnderGraduate")
Course1 = Course(CourseId = 1, ProfessorId = 4, CourseSlot = 1) # we decided to leave this
coursetype to be emmpty and it is set none in the Course class
Course2 = Course(CourseId = 2, ProfessorId = 1, CourseSlot = 2, CourseType ="UnderGraduate")
Course3 = Course(CourseId = 3, ProfessorId = 4, CourseSlot = 3)
Course4 = Course(CourseId = 4, ProfessorId = 1, CourseSlot = 4, CourseType ="UnderGraduate")
Course5 = Course(CourseId = 5, ProfessorId = 4, CourseSlot = 5)
Course6 = Course(CourseId = 6, ProfessorId = 2, CourseSlot = 6, CourseType ="Graduate")
Course7 = Course(CourseId = 7, ProfessorId = 2, CourseSlot = 7, CourseType ="UnderGraduate")
# intializing
Classroom1 = Classroom(FirstCourseStartTime = 8, LastCourseEndTime = 7.75)
# Add all courses to Classroom1
Classroom1.AddCourse(Course0)
Classroom1.AddCourse(Course1)
Classroom1.AddCourse(Course2)
Classroom1.AddCourse(Course3)
Classroom1.AddCourse(Course4)
Classroom1.AddCourse(Course5)
Classroom1.AddCourse(Course6)
Classroom1.AddCourse(Course7)
# Add Professors to the classroom.
Classroom1.AddProfessor(Professor0)
Classroom1.AddProfessor(Professor1)
Classroom1.AddProfessor(Professor2)
m_count = 0 # mutations caused by grea
h_count = 0
t_count = 0
l_count = 0
loopsize = 10000
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
"""
Printing out the results:
"""
print '\n'
print "Mutation caused by greater fitness value %d" % m_count
print "Mutation caused by Hard Constraint Violations %d" % h_count
print "Number of Mutations before Converging" % t_count
Classroom1.PrintClassroom()
| python | null | null | null | null | 07/15/2012 09:18:15 | not a real question | I am getting the following errors when I debug my code.The debug might be that Mutate is taking the value of Classroom1
===
# Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
File "/Users/maninder/git/TrialScheduler/TrialScheduler/main.py", line 27, in Loop
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
File "/Users/maninder/git/TrialScheduler/TrialScheduler/main.py", line 27, in Loop
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
File "/Users/maninder/git/TrialScheduler/TrialScheduler/main.py", line 27, in Loop #
from CProfessor import Professor
from CCourse import Course
from CClassroom import Classroom
import copy
def Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize):
for i in range(0, loopsize):
Mutated = Classroom()
#Mutated = Classroom1.CopyOfClassroom(Mutated)
Mutated = copy.deepcopy(Classroom1)#Modification
Mutated.Mutate()
HardConstraintClassroomMet = Classroom1.ComputeHardConstraint()
HardConstraintMutatedMet = Mutated.ComputeHardConstraint()
if HardConstraintClassroomMet == False and HardConstraintMutatedMet == False:
h_count + 1
t_count + 1
Classroom1.Mutate()
continue
if Mutated.FitnessValue() > Classroom1.FitnessValue():
m_count + 1
t_count + 1
Classroom1 = Mutated
if Classroom1.ComputeHardConstraint() == False:
l_count + 1
temp = l_count*loopsize
print "Unable to meet hard consraints in %d" % temp
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
Professor0 = Professor(ProfessorId = 0, PreferedStartTime = 8, PreferedEndTime = 11)
Professor1 = Professor(ProfessorId = 1, PreferedStartTime = 10, PreferedEndTime = 13.75)
Professor2 = Professor(ProfessorId = 2, PreferedStartTime = 4, PreferedEndTime = 7.75)
# intializing Courses
Course0 = Course(CourseId = 0, ProfessorId = 0, CourseSlot = 0, CourseType ="UnderGraduate")
Course1 = Course(CourseId = 1, ProfessorId = 4, CourseSlot = 1) # we decided to leave this
coursetype to be emmpty and it is set none in the Course class
Course2 = Course(CourseId = 2, ProfessorId = 1, CourseSlot = 2, CourseType ="UnderGraduate")
Course3 = Course(CourseId = 3, ProfessorId = 4, CourseSlot = 3)
Course4 = Course(CourseId = 4, ProfessorId = 1, CourseSlot = 4, CourseType ="UnderGraduate")
Course5 = Course(CourseId = 5, ProfessorId = 4, CourseSlot = 5)
Course6 = Course(CourseId = 6, ProfessorId = 2, CourseSlot = 6, CourseType ="Graduate")
Course7 = Course(CourseId = 7, ProfessorId = 2, CourseSlot = 7, CourseType ="UnderGraduate")
# intializing
Classroom1 = Classroom(FirstCourseStartTime = 8, LastCourseEndTime = 7.75)
# Add all courses to Classroom1
Classroom1.AddCourse(Course0)
Classroom1.AddCourse(Course1)
Classroom1.AddCourse(Course2)
Classroom1.AddCourse(Course3)
Classroom1.AddCourse(Course4)
Classroom1.AddCourse(Course5)
Classroom1.AddCourse(Course6)
Classroom1.AddCourse(Course7)
# Add Professors to the classroom.
Classroom1.AddProfessor(Professor0)
Classroom1.AddProfessor(Professor1)
Classroom1.AddProfessor(Professor2)
m_count = 0 # mutations caused by grea
h_count = 0
t_count = 0
l_count = 0
loopsize = 10000
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
"""
Printing out the results:
"""
print '\n'
print "Mutation caused by greater fitness value %d" % m_count
print "Mutation caused by Hard Constraint Violations %d" % h_count
print "Number of Mutations before Converging" % t_count
Classroom1.PrintClassroom()
| 1 |
9,423,674 | 02/24/2012 00:33:12 | 620,722 | 02/17/2011 03:48:01 | 90 | 1 | Store procedures vs Linq2Entities | I have recently moved into a team leader position in a company that has some very old skool developers. I'm trying so hard to convince them to use LINQ2Entities and over using tools like codesmith to generate stored procedures and DAL layers. It appears that I'm not getting through. Does anyone know of any ways to prove my point?
Thanks Again,
Frustrated Josh | c# | stored-procedures | linq-to-entities | methodology | null | 02/24/2012 01:46:11 | not constructive | Store procedures vs Linq2Entities
===
I have recently moved into a team leader position in a company that has some very old skool developers. I'm trying so hard to convince them to use LINQ2Entities and over using tools like codesmith to generate stored procedures and DAL layers. It appears that I'm not getting through. Does anyone know of any ways to prove my point?
Thanks Again,
Frustrated Josh | 4 |
10,637,698 | 05/17/2012 14:30:10 | 1,377,207 | 05/05/2012 18:27:43 | 86 | 3 | Postpone execution of try-catch | Is it possible to postpone the execution of try-catch that is triggered on button click.
I am tired of trying out various ways in doing this.None successful.
Lets say i have a button.On button click field change listener,these try catch statements are executed.
ButtonField showInputButton = new ButtonField(" Search ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
showInputButton.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
Dialog.alert(TextField1.getText());
//Here there are some code snippets for jumping to another form
try
{
//Some statements that filter data from database
}
catch( Exception e )
{
System.out.println( e.getMessage() );
e.printStackTrace();
}
}
}
);
add(showInputButton);
Its not that i do not want these statements to be executed at all.But i rather want them to be executed after some actions previous to that try-catch block are encountered.
Is something of this sort possible.Please guide.
| java | null | null | null | null | null | open | Postpone execution of try-catch
===
Is it possible to postpone the execution of try-catch that is triggered on button click.
I am tired of trying out various ways in doing this.None successful.
Lets say i have a button.On button click field change listener,these try catch statements are executed.
ButtonField showInputButton = new ButtonField(" Search ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
showInputButton.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
Dialog.alert(TextField1.getText());
//Here there are some code snippets for jumping to another form
try
{
//Some statements that filter data from database
}
catch( Exception e )
{
System.out.println( e.getMessage() );
e.printStackTrace();
}
}
}
);
add(showInputButton);
Its not that i do not want these statements to be executed at all.But i rather want them to be executed after some actions previous to that try-catch block are encountered.
Is something of this sort possible.Please guide.
| 0 |
6,479,448 | 06/25/2011 17:37:44 | 213,532 | 11/18/2009 06:55:15 | 712 | 26 | Customer Ratings on Apple Appstore ? | I don't know whats wrong with Apple Customer Ratings system on Appstore.
Recently I have uploaded two apps on appstore. And still there are no ratings/reviews on apps. Infact I observed there are 1000s of downloads has been made in last 2 days.
To verify this 1 of my friend also added his comment with rating yesterday on 1 of my App. But his comment also not visible, still there are zero customer reviews in both Apps.
Can anyone update me regarding this issue ?
| iphone | upload | download | app-store | rating | 06/26/2011 20:22:24 | off topic | Customer Ratings on Apple Appstore ?
===
I don't know whats wrong with Apple Customer Ratings system on Appstore.
Recently I have uploaded two apps on appstore. And still there are no ratings/reviews on apps. Infact I observed there are 1000s of downloads has been made in last 2 days.
To verify this 1 of my friend also added his comment with rating yesterday on 1 of my App. But his comment also not visible, still there are zero customer reviews in both Apps.
Can anyone update me regarding this issue ?
| 2 |
6,110,361 | 05/24/2011 12:26:19 | 378,080 | 06/28/2010 13:54:49 | 20 | 1 | vector::operator[] overhead | Apparently, after profiling my (scientific computation) C++ code, 25% (!) of the time is spent with calls to `vector::operator[]`. True, my code spends all of its time reading and writing in `vector<float>`s (and a few `vector<int>`s too), but still, I'd like to know if there's supposed to be some significant overhead of `operator[]` compared to C-style arrays?
(I've seen another related question on SO, but regarding `[]` vs `at()` -- but apparently even `[]` is too slow for me?!)
Thanks,
Antony | c++ | stdvector | null | null | null | null | open | vector::operator[] overhead
===
Apparently, after profiling my (scientific computation) C++ code, 25% (!) of the time is spent with calls to `vector::operator[]`. True, my code spends all of its time reading and writing in `vector<float>`s (and a few `vector<int>`s too), but still, I'd like to know if there's supposed to be some significant overhead of `operator[]` compared to C-style arrays?
(I've seen another related question on SO, but regarding `[]` vs `at()` -- but apparently even `[]` is too slow for me?!)
Thanks,
Antony | 0 |
6,321,170 | 06/12/2011 09:18:15 | 15,485 | 09/17/2008 09:50:14 | 999 | 19 | C++, is there any advantage to using pow(x,2) instead of x*x, with x double? | is there any advantage to using this code
double x;
double square = pow(x,2);
instead of this?
double x;
double square = x*x;
I prefer x*x and looking at my implementation (Microsoft) I find no advantages in pow because x*x is simpler than pow for the particular square case.
Is there any particular case where pow is superior?
Thank you.
Alessandro | c++ | math | floating-point | null | null | null | open | C++, is there any advantage to using pow(x,2) instead of x*x, with x double?
===
is there any advantage to using this code
double x;
double square = pow(x,2);
instead of this?
double x;
double square = x*x;
I prefer x*x and looking at my implementation (Microsoft) I find no advantages in pow because x*x is simpler than pow for the particular square case.
Is there any particular case where pow is superior?
Thank you.
Alessandro | 0 |
11,348,654 | 07/05/2012 16:31:07 | 1,261,203 | 03/10/2012 15:59:05 | 110 | 11 | choose hosting based on website statistics | I have Google Analytics data of a Website that is currently running on a small server that is also hosting several other sites, and the Website is pretty slow so we want to host it somewhere else, but i need some way of calculating which hosting method is the best and cheapest (vServer/dedicated Server/cloudhosting).
I need something like KPI's for Webhosting to choose the appropriate method based on pageviews/user average, pageviews/user peak, traffic etc.
I did some research myself, also got a book on "Computer Systems Performance Evaluation and Prediction" but i still cant find anything helpful...
I was wondering if any of you guys did this before and could help me, i dont want the entire solution but just point me in the right direction ^^
Thanks in advance,
and sorry for my bad english
| performance | webserver | hosting | null | null | 07/07/2012 11:13:45 | off topic | choose hosting based on website statistics
===
I have Google Analytics data of a Website that is currently running on a small server that is also hosting several other sites, and the Website is pretty slow so we want to host it somewhere else, but i need some way of calculating which hosting method is the best and cheapest (vServer/dedicated Server/cloudhosting).
I need something like KPI's for Webhosting to choose the appropriate method based on pageviews/user average, pageviews/user peak, traffic etc.
I did some research myself, also got a book on "Computer Systems Performance Evaluation and Prediction" but i still cant find anything helpful...
I was wondering if any of you guys did this before and could help me, i dont want the entire solution but just point me in the right direction ^^
Thanks in advance,
and sorry for my bad english
| 2 |
7,820,162 | 10/19/2011 10:51:34 | 887,651 | 08/10/2011 10:03:05 | 225 | 0 | Remove div using JQuery | I have this html code:
<div id="note_list">
<div class="note">
Text 1
<a href="">X</a>
</div>
<div class="note">
Text 2
<a href="">X</a>
</div>
<div class="note">
Text 3
<a href="">X</a>
</div>
<div class="note">
Text 4
<a href="">X</a>
</div>
<div class="note">
Text 5
<a href="">X</a>
</div>
</div>
now I would like to use Jquery to DELETE a div AFTER the 'X' clicking, is it possible?
first X closes:
<div class="note">
Text 1
<a href="">X</a>
</div>
etc etc.
Can I remove a div without using id="" ?
Thank you!
| javascript | jquery | null | null | null | null | open | Remove div using JQuery
===
I have this html code:
<div id="note_list">
<div class="note">
Text 1
<a href="">X</a>
</div>
<div class="note">
Text 2
<a href="">X</a>
</div>
<div class="note">
Text 3
<a href="">X</a>
</div>
<div class="note">
Text 4
<a href="">X</a>
</div>
<div class="note">
Text 5
<a href="">X</a>
</div>
</div>
now I would like to use Jquery to DELETE a div AFTER the 'X' clicking, is it possible?
first X closes:
<div class="note">
Text 1
<a href="">X</a>
</div>
etc etc.
Can I remove a div without using id="" ?
Thank you!
| 0 |
9,179,070 | 02/07/2012 15:36:01 | 1,000,723 | 10/18/2011 08:46:25 | 8 | 0 | jquery datatables check box value | i am using IgnitedDatatables wrapper to present a data in a table form. From the example I manage to do a range filtering using a slider from jquery ui, however I would like to do a filtering based on check box value, but i don't have any idea to pass the check box value to the ajax processing page.
Below is the code for the range filter using a slider:
ajax.php:
`<?php`
`require_once('Datatables.php');`
$datatables = new Datatables('mysqli');
// MYSQL configuration
$config = array(
'username' => 'root',
'password' => 'xxxxx',
'database' => 'mydb',
'hostname' => 'localhost');
$datatables->connect($config);
$datatables
->select('column1,column2,column3,column4')
->from('mytable');
if(isset($_POST['min_length']) && $_POST['min_length'] != '')
$datatables->where('column1 >=', $_POST['min_length']);
if(isset($_POST['max_length']) && $_POST['max_length'] != '')
$datatables->where('column1 <=', $_POST['max_length']);
echo $datatables->generate();
?>
example.html:
<script type="text/javascript" charset="utf-8">
$(document).ready(function()
{
var oTable = $('#example').dataTable
({
"oLanguage" :{ "sSearch" : "Search Global:"
},
'bServerSide' : true,
'sAjaxSource' : 'ajax.php',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
'fnServerData': function(sSource, aoData, fnCallback)
{
aoData.push( { "name": "min_length", "value": $( "#min_length" ).val() },
{ "name": "max_length", "value": $( "#max_length" ).val() },
);
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
},
});
//Slider Range for pVal
$( "#slider-range" ).slider({
step: 0.1,
range: true,
min: -8,
max: 8,
values: [ -8, 8 ],
slide: function( event, ui ) {
$( "#min_length" ).val(ui.values[ 0 ]);
$( "#max_length" ).val(ui.values[ 1 ]);
},
stop: function(event, ui) {
oTable.fnDraw();
}
});
$( "#min_length" ).val( $( "#slider-range" ).slider( "values", 0 ));
$( "#max_length" ).val( $( "#slider-range" ).slider( "values", 1 ));
</script>
<body id="dt_example">
</head>
<div id="container">
<h1>RRL DGE DB - Advanced Browsing</h1>
<table width="200" border="0" cellspacing="0" cellpadding="0" id="slider">
<div class="demo1">
<div class="demo" style='width:250px;'>
<p>
<tr>
<td><label for="amount">Min:</label><input type="text" id="min_length" style="border:0; color:#f6931f; font-weight:bold" disabled=disabled/><br></td>
<td><label for="amount">Max:</label><input type="text" id="max_length" style="border:0; color:#f6931f; font-weight:bold;" disabled=disabled/></td>
<td>   </td>
<td width="200">                        <div id="slider-range"></div></td>
</div>
</tr>
</p>
</div><!-- End demo -->
</table>
<BR>
<table border="0" cellpadding="4" cellspacing="0" class="display" id="example">
<thead>
<tr>
<th width="10%">column1</th>
<th width="55%">column2</th>
<th width="10%">column3</th>
<th width="10%">column4</th>
<th width="15%">column5</th>
</tr>
</thead>
<tbody>
<tr>
<td>loading...</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
The question is how can I do the same range filtering using checkbox instead of slider? What I need is to send either 0 or 1 value to the ajax.php so that I allow user to select column with 0 or more than 1 results. I am very new php/jquery ui. Any help is highly appreciated.
Thanks! | jquery | checkbox | datatables | null | null | null | open | jquery datatables check box value
===
i am using IgnitedDatatables wrapper to present a data in a table form. From the example I manage to do a range filtering using a slider from jquery ui, however I would like to do a filtering based on check box value, but i don't have any idea to pass the check box value to the ajax processing page.
Below is the code for the range filter using a slider:
ajax.php:
`<?php`
`require_once('Datatables.php');`
$datatables = new Datatables('mysqli');
// MYSQL configuration
$config = array(
'username' => 'root',
'password' => 'xxxxx',
'database' => 'mydb',
'hostname' => 'localhost');
$datatables->connect($config);
$datatables
->select('column1,column2,column3,column4')
->from('mytable');
if(isset($_POST['min_length']) && $_POST['min_length'] != '')
$datatables->where('column1 >=', $_POST['min_length']);
if(isset($_POST['max_length']) && $_POST['max_length'] != '')
$datatables->where('column1 <=', $_POST['max_length']);
echo $datatables->generate();
?>
example.html:
<script type="text/javascript" charset="utf-8">
$(document).ready(function()
{
var oTable = $('#example').dataTable
({
"oLanguage" :{ "sSearch" : "Search Global:"
},
'bServerSide' : true,
'sAjaxSource' : 'ajax.php',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
'fnServerData': function(sSource, aoData, fnCallback)
{
aoData.push( { "name": "min_length", "value": $( "#min_length" ).val() },
{ "name": "max_length", "value": $( "#max_length" ).val() },
);
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
},
});
//Slider Range for pVal
$( "#slider-range" ).slider({
step: 0.1,
range: true,
min: -8,
max: 8,
values: [ -8, 8 ],
slide: function( event, ui ) {
$( "#min_length" ).val(ui.values[ 0 ]);
$( "#max_length" ).val(ui.values[ 1 ]);
},
stop: function(event, ui) {
oTable.fnDraw();
}
});
$( "#min_length" ).val( $( "#slider-range" ).slider( "values", 0 ));
$( "#max_length" ).val( $( "#slider-range" ).slider( "values", 1 ));
</script>
<body id="dt_example">
</head>
<div id="container">
<h1>RRL DGE DB - Advanced Browsing</h1>
<table width="200" border="0" cellspacing="0" cellpadding="0" id="slider">
<div class="demo1">
<div class="demo" style='width:250px;'>
<p>
<tr>
<td><label for="amount">Min:</label><input type="text" id="min_length" style="border:0; color:#f6931f; font-weight:bold" disabled=disabled/><br></td>
<td><label for="amount">Max:</label><input type="text" id="max_length" style="border:0; color:#f6931f; font-weight:bold;" disabled=disabled/></td>
<td>   </td>
<td width="200">                        <div id="slider-range"></div></td>
</div>
</tr>
</p>
</div><!-- End demo -->
</table>
<BR>
<table border="0" cellpadding="4" cellspacing="0" class="display" id="example">
<thead>
<tr>
<th width="10%">column1</th>
<th width="55%">column2</th>
<th width="10%">column3</th>
<th width="10%">column4</th>
<th width="15%">column5</th>
</tr>
</thead>
<tbody>
<tr>
<td>loading...</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
The question is how can I do the same range filtering using checkbox instead of slider? What I need is to send either 0 or 1 value to the ajax.php so that I allow user to select column with 0 or more than 1 results. I am very new php/jquery ui. Any help is highly appreciated.
Thanks! | 0 |
177,596 | 10/07/2008 08:28:24 | 25,734 | 10/07/2008 08:28:24 | 1 | 0 | What language to learn now? | I have been programming on my free time for a couple of years now and im fluent in PHP, know some Python and programmed in Visual Basic .NET (this was the first language i learn't).
But now i want to get cracking with something else, something cross-platform and not on the internet as i find the idea of another layer of applications to run an application on the internet rather amusing.
I was thinking of either Java or C++, is this the way to go? | php | new-language | what-to-do-next | null | null | 03/01/2012 19:23:01 | not constructive | What language to learn now?
===
I have been programming on my free time for a couple of years now and im fluent in PHP, know some Python and programmed in Visual Basic .NET (this was the first language i learn't).
But now i want to get cracking with something else, something cross-platform and not on the internet as i find the idea of another layer of applications to run an application on the internet rather amusing.
I was thinking of either Java or C++, is this the way to go? | 4 |
4,378,937 | 12/07/2010 16:23:19 | 533,932 | 12/07/2010 16:23:19 | 1 | 0 | NullPointerExcpetion in android but not in java! | I’m writing an app for pairwise gene sequence alignment in android and for some reason it runs fine in a normal JVM, but not in android. Only in Android do I get a “nullPointerException” for the following code:
x and y are integers that I resolve as global variables and fill with the length of the two sequences like so:
x= sequence1.getText().toString().length()-1;
y= sequence2.getText().toString().length()-1;
for(int a = 1; a <= y; a++){
//System.out.println(" ");
for(int b = 1; b <= x; b++){
matrix[a][b] = new MatrixNode(0, 0, 0, null);
if(seq1.charAt(b-1) == seq2.charAt(a-1)){
score = matrix[a-1][b-1].returnScore() + match;
if(isSW == true && score < 0){score = 0;}
pathX = b-1;
pathY = a-1;
outcome = "MATCH";
matrix[a][b].setScore(score, pathX, pathY, outcome);
}
else{
int scoreUp = matrix[a-1][b].returnScore() + gap;
int scoreLeft = matrix[a][b-1].returnScore() + gap;
int scoreDia = matrix[a-1][b-1].returnScore() + mismatch;
if(scoreUp > scoreLeft && scoreUp > scoreDia){
if(isSW == true && scoreUp < 0){scoreUp = 0;}
pathX = b;
pathY = a-1;
outcome = "GAP";
matrix[a][b].setScore(scoreUp, pathX, pathY, outcome);
}
else if(scoreLeft > scoreUp && scoreLeft > scoreDia){
if(isSW == true && scoreLeft < 0){scoreLeft = 0;}
pathX = b-1;
pathY = a;
outcome = "GAP";
matrix[a][b].setScore(scoreLeft, pathX, pathY, outcome);
}
else if(scoreDia > scoreUp && scoreDia > scoreLeft){
if(isSW == true && scoreDia < 0){scoreLeft = 0;}
pathX = b-1;
pathY = a-1;
outcome = "MISS";
matrix[a][b].setScore(scoreDia, pathX, pathY, outcome);
}
}
}
}
}
Like I said, it runs fine in any JVM(BlueJ, JCreator..) but crashes my android app... Any help would be appreciated! | java | android | null | null | null | 12/19/2011 13:36:11 | not a real question | NullPointerExcpetion in android but not in java!
===
I’m writing an app for pairwise gene sequence alignment in android and for some reason it runs fine in a normal JVM, but not in android. Only in Android do I get a “nullPointerException” for the following code:
x and y are integers that I resolve as global variables and fill with the length of the two sequences like so:
x= sequence1.getText().toString().length()-1;
y= sequence2.getText().toString().length()-1;
for(int a = 1; a <= y; a++){
//System.out.println(" ");
for(int b = 1; b <= x; b++){
matrix[a][b] = new MatrixNode(0, 0, 0, null);
if(seq1.charAt(b-1) == seq2.charAt(a-1)){
score = matrix[a-1][b-1].returnScore() + match;
if(isSW == true && score < 0){score = 0;}
pathX = b-1;
pathY = a-1;
outcome = "MATCH";
matrix[a][b].setScore(score, pathX, pathY, outcome);
}
else{
int scoreUp = matrix[a-1][b].returnScore() + gap;
int scoreLeft = matrix[a][b-1].returnScore() + gap;
int scoreDia = matrix[a-1][b-1].returnScore() + mismatch;
if(scoreUp > scoreLeft && scoreUp > scoreDia){
if(isSW == true && scoreUp < 0){scoreUp = 0;}
pathX = b;
pathY = a-1;
outcome = "GAP";
matrix[a][b].setScore(scoreUp, pathX, pathY, outcome);
}
else if(scoreLeft > scoreUp && scoreLeft > scoreDia){
if(isSW == true && scoreLeft < 0){scoreLeft = 0;}
pathX = b-1;
pathY = a;
outcome = "GAP";
matrix[a][b].setScore(scoreLeft, pathX, pathY, outcome);
}
else if(scoreDia > scoreUp && scoreDia > scoreLeft){
if(isSW == true && scoreDia < 0){scoreLeft = 0;}
pathX = b-1;
pathY = a-1;
outcome = "MISS";
matrix[a][b].setScore(scoreDia, pathX, pathY, outcome);
}
}
}
}
}
Like I said, it runs fine in any JVM(BlueJ, JCreator..) but crashes my android app... Any help would be appreciated! | 1 |
9,974,632 | 04/02/2012 10:21:01 | 1,266,601 | 03/13/2012 13:39:26 | 18 | 0 | Autocomplete in rails format data and display in a beatiful way | I use rails 3.2.2 and autocomplete, I m selecting customer by name and formating it in a following way
format.json { render :json => @customers.map{ |c| "#{c.name}:#{c.phone1}:#{c.email}" } }
so, i need to parse json properly an display in a way i want for example
I want write name in <h3> but make phone smaller and bold ,display it in different color.
How i can achive that?
<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 1; top: 416px; left: 0px; display: none; width: 419px;">
<li class="ui-menu-item" role="menuitem">
<a class="ui-corner-all" tabindex="-1">Adele Brekke:1-244-712-4421 x313:christophe@kuhlmanborer.net</a>
</li>
<li class="ui-menu-item" role="menuitem">
<a class="ui-corner-all" tabindex="-1">Madeline O'Conner Sr.:486-349-1046 x6765:kareem@hills.net</a>
</li>
</ul>
Thanks | ruby-on-rails | ruby-on-rails-3 | jquery-ui | null | null | null | open | Autocomplete in rails format data and display in a beatiful way
===
I use rails 3.2.2 and autocomplete, I m selecting customer by name and formating it in a following way
format.json { render :json => @customers.map{ |c| "#{c.name}:#{c.phone1}:#{c.email}" } }
so, i need to parse json properly an display in a way i want for example
I want write name in <h3> but make phone smaller and bold ,display it in different color.
How i can achive that?
<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 1; top: 416px; left: 0px; display: none; width: 419px;">
<li class="ui-menu-item" role="menuitem">
<a class="ui-corner-all" tabindex="-1">Adele Brekke:1-244-712-4421 x313:christophe@kuhlmanborer.net</a>
</li>
<li class="ui-menu-item" role="menuitem">
<a class="ui-corner-all" tabindex="-1">Madeline O'Conner Sr.:486-349-1046 x6765:kareem@hills.net</a>
</li>
</ul>
Thanks | 0 |
4,913,430 | 02/06/2011 12:57:47 | 414,969 | 08/09/2010 10:38:30 | 30 | 2 | Virtual list view sorting on winforms | I have a winforms **virtualized** Listview that i want to be able to sort .
I implemented a sorter class that derives from **IComparer<T>** .
Now, every time i want to sort my listview i do the following :
public void SortMyVirtualListView()
{
this.VirtualListSize = 0; // set virtual size to 0
_myInnerList.Sort(_myComparer); // sort the inner listlistview items source)
this.VirtualListSize = _myInnerList.Count; // re-set the virtual size to items count
}
What i want to make sure is - Is this really how you reset the virtual listview items after a sort? Do I really have to set the virtual list size to 0 and then reset it to the new size ?
It seems like i cannot omit the part about setting the VirtualListSize to zero and then,after re-sorting the underlying list, set the VirtualListSize back to its original value (<em>this.VirtualListSize = _myInnerList.Count</em>).
I could not find any kind of a satisfying code for an optimized (and **sortable**) virtual list view for winforms . | c# | winforms | listview | null | null | null | open | Virtual list view sorting on winforms
===
I have a winforms **virtualized** Listview that i want to be able to sort .
I implemented a sorter class that derives from **IComparer<T>** .
Now, every time i want to sort my listview i do the following :
public void SortMyVirtualListView()
{
this.VirtualListSize = 0; // set virtual size to 0
_myInnerList.Sort(_myComparer); // sort the inner listlistview items source)
this.VirtualListSize = _myInnerList.Count; // re-set the virtual size to items count
}
What i want to make sure is - Is this really how you reset the virtual listview items after a sort? Do I really have to set the virtual list size to 0 and then reset it to the new size ?
It seems like i cannot omit the part about setting the VirtualListSize to zero and then,after re-sorting the underlying list, set the VirtualListSize back to its original value (<em>this.VirtualListSize = _myInnerList.Count</em>).
I could not find any kind of a satisfying code for an optimized (and **sortable**) virtual list view for winforms . | 0 |
1,645,005 | 10/29/2009 16:38:28 | 47,161 | 12/17/2008 18:07:56 | 4,220 | 254 | Open source PDF renderer for .net | Is there an open source .net library that can render PDFs to images (for server-side processing)? I know of PdfSharp, AFAIK it can only create and process PDFs, not render them. | .net | pdf | null | null | null | null | open | Open source PDF renderer for .net
===
Is there an open source .net library that can render PDFs to images (for server-side processing)? I know of PdfSharp, AFAIK it can only create and process PDFs, not render them. | 0 |
9,405,881 | 02/23/2012 01:32:34 | 994,521 | 10/13/2011 23:53:17 | 1 | 0 | Webservice Modification to add more logic to change the the Managers details for users | It is SharePoint 2007 environment. I cant recreate other web service/solution as this web-service is currently be used in Infopath. i need to amend this web-service only.
This web service uses SharePoint Object Model to get the current user details.
I am not a developer so any input will be much appreciated.
I need to add logic under web method GetExecutiveGeneralManagerDetails() the logic should be if you are Regional employee then your EGM Will be the person contains words "Regional General Manager" in their title.
Any Help will be much appreciated. Thanks in Advance.
Code :
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.DirectoryServices;
using Microsoft.SharePoint;
using System.Xml;
using System.Configuration;
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Diagnostics;
[WebService(Namespace = "ORG.MOSS")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class UserActiveDirectory : System.Web.Services.WebService
{
private static object _lockObject = new object();
private const string c_strADUserName = "Domain\\oracleimport";
private const string c_strADPassword = "**********";
public UserActiveDirectory()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public XmlNode GetManagerDetails()
{
XmlDocument xmlDocument = new XmlDocument();
XmlElement xmlPropertyData = xmlDocument.CreateElement("PropertyData");
XmlElement xmlDisplayName = xmlDocument.CreateElement("DisplayName");
XmlElement xmlUsername = xmlDocument.CreateElement("Username");
try
{
if (!IsRegionalEmployee())
{
using (SPSite objSite = SPContext.Current.Site)
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPUser objCurrentUser = objWeb.CurrentUser;
string strAccountUsername = objCurrentUser.LoginName.Substring(objCurrentUser.LoginName.IndexOf(@"\") + 1);
_trace("GetManagerDetails", "Processing non-regional employee {0} [{1}]", objCurrentUser.Name, strAccountUsername);
using (DirectoryEntry objDirectoryEntry = RetrieveActiveDirectoryUserByAccountName(strAccountUsername))
{
if (objDirectoryEntry != null)
{
if (objDirectoryEntry.Properties["manager"].Value != null)
{
_trace("GetManagerDetails", " Manager property: {0}", objDirectoryEntry.Properties["manager"].Value);
using (DirectoryEntry objManagerEntry = RetrieveActiveDirectoryUserByAccountPath(objDirectoryEntry.Properties["manager"].Value.ToString()))
{
if (objManagerEntry != null)
{
_trace("GetManagerDetails", " Found manager: {0}", objManagerEntry.Properties["sAMAccountName"].Value.ToString());
xmlDisplayName.InnerText = objManagerEntry.Properties["displayName"].Value.ToString();
xmlUsername.InnerText = objManagerEntry.Properties["sAMAccountName"].Value.ToString();
objManagerEntry.Close();
}
}
}
objDirectoryEntry.Close();
}
}
objWeb.Close();
}
objSite.Close();
}
}
}
catch (Exception ex)
{
_trace("GetManagerDetails", "!!Exception: {0}{1}{2}" + ex.Message + ex.GetType().Name, Environment.NewLine, ex.StackTrace);
throw;
}
xmlDocument.AppendChild(xmlPropertyData);
xmlPropertyData.AppendChild(xmlDisplayName);
xmlPropertyData.AppendChild(xmlUsername);
return xmlDocument;
}
[WebMethod]
public XmlNode GetExecutiveGeneralManagerDetails()
{
XmlDocument xmlDocument = new XmlDocument();
XmlElement xmlPropertyData = xmlDocument.CreateElement("PropertyData");
XmlElement xmlDisplayName = xmlDocument.CreateElement("DisplayName");
XmlElement xmlUsername = xmlDocument.CreateElement("Username");
bool blnContinueLoop = true;
using (SPSite objSite = SPContext.Current.Site)
{
using (SPWeb objWeb = objSite.OpenWeb())
{
string userAc = objWeb.CurrentUser.LoginName.Split('\\')[1];
using (DirectoryEntry deUser = RetrieveActiveDirectoryUserByAccountName(userAc))
{
if (deUser != null)
{
bool isUserCorpComms = ( _prop(deUser, "department") == "Corporate Communications" );
DirectoryEntry tmp = deUser; //placeholder for recursing up the org chart
string mgrTitle = _getManagerTitle(tmp);
//if your manager is "Managing Director" then they are the EGM
if (mgrTitle == "Managing Director")
{
DirectoryEntry tmpMgr = _getManager(tmp);
xmlDisplayName.InnerText = _prop(tmpMgr, "displayName");
xmlUsername.InnerText = _prop(tmpMgr, "sAMAccountName");
}
else
{
while (mgrTitle != "Managing Director" )
{
tmp = _getManager(tmp);
if (tmp == null) break;
mgrTitle = _getManagerTitle(tmp);
}
xmlDisplayName.InnerText = _prop(tmp, "displayName");
xmlUsername.InnerText = _prop(tmp, "sAMAccountName");
}
deUser.Close();
}
}
objWeb.Close();
}
objSite.Close();
}
xmlDocument.AppendChild(xmlPropertyData);
xmlPropertyData.AppendChild(xmlDisplayName);
xmlPropertyData.AppendChild(xmlUsername);
return xmlDocument;
}
[WebMethod]
public bool IsRegionalEmployee()
{
bool blnResult = false;
using (SPSite objSite = SPContext.Current.Site)
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPUser objCurrentUser = objWeb.CurrentUser;
string strAccountUsername = objCurrentUser.LoginName.Substring(objCurrentUser.LoginName.IndexOf(@"\") + 1);
using (DirectoryEntry objDirectoryEntry = RetrieveActiveDirectoryUserByAccountName(strAccountUsername))
{
if (objDirectoryEntry != null)
{
if (objDirectoryEntry.Properties["physicalDeliveryOfficeName"].Value != null && objDirectoryEntry.Properties["physicalDeliveryOfficeName"].Value.ToString() != "TA Sydney Office" &&
objDirectoryEntry.Properties["department"].Value != null && (objDirectoryEntry.Properties["department"].Value.ToString().StartsWith("International (Eastern)") || objDirectoryEntry.Properties["department"].Value.ToString().StartsWith("International (Western)")))
{
_trace("IsRegionalEmployee", "Found regional employee {0} [{1}]", objCurrentUser.Name, strAccountUsername);
blnResult = true;
}
objDirectoryEntry.Close();
}
}
objWeb.Close();
}
objSite.Close();
}
return blnResult;
}
private DirectoryEntry RetrieveActiveDirectoryUserByAccountName(string strAccountUsername)
{
DirectoryEntry objDirectoryEntry = null;
using (DirectoryEntry objDirectoryRoot = new DirectoryEntry("LDAP://office.local.pri/DC=office,DC=local,DC=pri", c_strADUserName, c_strADPassword))
{
using (DirectorySearcher objDirectorySearcher = new DirectorySearcher(objDirectoryRoot))
{
objDirectorySearcher.Filter = "(&(objectClass=user)(objectCategory=person)(sAMAccountName=" + strAccountUsername + "))";
objDirectorySearcher.SearchScope = SearchScope.Subtree;
objDirectorySearcher.PageSize = 1000;
SearchResultCollection colSearchResults = objDirectorySearcher.FindAll();
foreach (SearchResult objSearchResult in colSearchResults)
{
objDirectoryEntry = objSearchResult.GetDirectoryEntry();
break;
}
}
objDirectoryRoot.Close();
}
return objDirectoryEntry;
}
private DirectoryEntry RetrieveActiveDirectoryUserByAccountPath(string strAccountPath)
{
DirectoryEntry objDirectoryEntry = new DirectoryEntry("LDAP://" + strAccountPath.Replace("/", @"\2f"), c_strADUserName, c_strADPassword);
return objDirectoryEntry;
}
#region Helpers
private bool _isTracing
{
get
{
bool ret = false;
bool.TryParse(ConfigurationSettings.AppSettings["UserActiveDirectoryWebservice.Tracing.Enabled"] ?? "False", out ret);
return ret;
}
}
private string _tracePath
{
get { return ConfigurationManager.AppSettings["UserActiveDirectoryWebservice.Tracing.Path"] ?? @"C:\InetPub\LogFiles\UserActiveDirectoryWebservice"; }
}
private void _ensureTracePath()
{
lock (_lockObject)
{
WindowsImpersonationContext wctx = null;
try
{
wctx = WindowsIdentity.Impersonate(IntPtr.Zero); //app pool identity
if (Application["TA.MOSS.UserActiveDirectory::_ensureTracePath()"] != null)
return;
if (!Directory.Exists(_tracePath))
{
//adding access for everyone here didn't work too well
//better to inherit the access through the normal file system ACL inheritance mechanisms
//DirectorySecurity acl = new DirectorySecurity();
//acl.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.Write, AccessControlType.Allow)); //Everyone
Directory.CreateDirectory(_tracePath); //, acl);
}
/* - ACL update disabled; see note above
else
{
DirectorySecurity acl = Directory.GetAccessControl(_tracePath);
//get ACLs
AuthorizationRuleCollection rules = acl.GetAccessRules(true, true, typeof(SecurityIdentifier));
bool aclOK = false;
foreach (FileSystemAccessRule rule in rules)
{
if (((SecurityIdentifier)rule.IdentityReference).IsWellKnown(WellKnownSidType.WorldSid))
{
if ((rule.FileSystemRights & FileSystemRights.Write) != 0)
{
aclOK = true;
break;
}
}
}
if (!aclOK)
{
acl.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.Write, AccessControlType.Allow)); //Everyone
Directory.SetAccessControl(_tracePath, acl);
}
}
*/
//write an application-wide marker so we don't do this every time
Application["TA.MOSS.UserActiveDirectory::_ensureTracePath()"] = true;
}
catch (Exception ex)
{
try
{
if (!EventLog.SourceExists("UserActiveDirectory Web Service"))
EventLog.CreateEventSource("UserActiveDirectory Web Service", "Application");
EventLog.WriteEntry("UserActiveDirectory Web Service", "Failed to ensure Trace Path was accessible to the log writer [" + _tracePath + "]" + Environment.NewLine + "Tracing is disabled." + Environment.NewLine + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, EventLogEntryType.Error);
}
catch { } //if that failed there's really nothing left to do
}
finally
{
if (wctx != null)
{
wctx.Undo();
wctx.Dispose();
}
}
}
}
private void _trace(string method, string message, params object[] args)
{
if (!_isTracing) return;
//this should only happen once
_ensureTracePath();
//one file per Hour
WindowsImpersonationContext wctx = null;
try
{
wctx = WindowsIdentity.Impersonate(IntPtr.Zero);
lock (_lockObject)
{
string traceFileName = Path.Combine(_tracePath, "UserActiveDirectory Log " + DateTime.Now.ToString("yyyyMMdd-HH") + "00.log");
File.AppendAllText(traceFileName, DateTime.Now.ToString("yyyyMMdd HHmmss") + "\t" + method + "\t" + String.Format(message, args) + Environment.NewLine);
}
}
catch { } //a tracing fail must not fail the execution of the main thread
finally
{
if (wctx != null)
{
wctx.Undo();
wctx.Dispose();
}
}
}
private string _prop(DirectoryEntry de, string propertyName)
{
//does not return null, only empty string to make logic clearer
//there is no difference to us in this case between null & empty string
if (de==null || de.Properties[propertyName] == null || de.Properties[propertyName].Value == null) return String.Empty;
else return de.Properties[propertyName].Value.ToString();
}
private DirectoryEntry _getManager(DirectoryEntry user)
{
string mgrAc = _prop(user, "manager");
if (mgrAc == "") return null;
return RetrieveActiveDirectoryUserByAccountPath(mgrAc);
}
private string _getManagerTitle(DirectoryEntry user)
{
string mgrAc = _prop(user, "manager");
if (mgrAc == "") return "";
string mgrTitle = "";
using (DirectoryEntry deMgr = RetrieveActiveDirectoryUserByAccountPath(mgrAc))
{
mgrTitle = _prop(deMgr, "title");
deMgr.Close();
}
return mgrTitle;
}
#endregion
} | asp.net | web-services | sharepoint2007 | null | null | null | open | Webservice Modification to add more logic to change the the Managers details for users
===
It is SharePoint 2007 environment. I cant recreate other web service/solution as this web-service is currently be used in Infopath. i need to amend this web-service only.
This web service uses SharePoint Object Model to get the current user details.
I am not a developer so any input will be much appreciated.
I need to add logic under web method GetExecutiveGeneralManagerDetails() the logic should be if you are Regional employee then your EGM Will be the person contains words "Regional General Manager" in their title.
Any Help will be much appreciated. Thanks in Advance.
Code :
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.DirectoryServices;
using Microsoft.SharePoint;
using System.Xml;
using System.Configuration;
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Diagnostics;
[WebService(Namespace = "ORG.MOSS")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class UserActiveDirectory : System.Web.Services.WebService
{
private static object _lockObject = new object();
private const string c_strADUserName = "Domain\\oracleimport";
private const string c_strADPassword = "**********";
public UserActiveDirectory()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public XmlNode GetManagerDetails()
{
XmlDocument xmlDocument = new XmlDocument();
XmlElement xmlPropertyData = xmlDocument.CreateElement("PropertyData");
XmlElement xmlDisplayName = xmlDocument.CreateElement("DisplayName");
XmlElement xmlUsername = xmlDocument.CreateElement("Username");
try
{
if (!IsRegionalEmployee())
{
using (SPSite objSite = SPContext.Current.Site)
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPUser objCurrentUser = objWeb.CurrentUser;
string strAccountUsername = objCurrentUser.LoginName.Substring(objCurrentUser.LoginName.IndexOf(@"\") + 1);
_trace("GetManagerDetails", "Processing non-regional employee {0} [{1}]", objCurrentUser.Name, strAccountUsername);
using (DirectoryEntry objDirectoryEntry = RetrieveActiveDirectoryUserByAccountName(strAccountUsername))
{
if (objDirectoryEntry != null)
{
if (objDirectoryEntry.Properties["manager"].Value != null)
{
_trace("GetManagerDetails", " Manager property: {0}", objDirectoryEntry.Properties["manager"].Value);
using (DirectoryEntry objManagerEntry = RetrieveActiveDirectoryUserByAccountPath(objDirectoryEntry.Properties["manager"].Value.ToString()))
{
if (objManagerEntry != null)
{
_trace("GetManagerDetails", " Found manager: {0}", objManagerEntry.Properties["sAMAccountName"].Value.ToString());
xmlDisplayName.InnerText = objManagerEntry.Properties["displayName"].Value.ToString();
xmlUsername.InnerText = objManagerEntry.Properties["sAMAccountName"].Value.ToString();
objManagerEntry.Close();
}
}
}
objDirectoryEntry.Close();
}
}
objWeb.Close();
}
objSite.Close();
}
}
}
catch (Exception ex)
{
_trace("GetManagerDetails", "!!Exception: {0}{1}{2}" + ex.Message + ex.GetType().Name, Environment.NewLine, ex.StackTrace);
throw;
}
xmlDocument.AppendChild(xmlPropertyData);
xmlPropertyData.AppendChild(xmlDisplayName);
xmlPropertyData.AppendChild(xmlUsername);
return xmlDocument;
}
[WebMethod]
public XmlNode GetExecutiveGeneralManagerDetails()
{
XmlDocument xmlDocument = new XmlDocument();
XmlElement xmlPropertyData = xmlDocument.CreateElement("PropertyData");
XmlElement xmlDisplayName = xmlDocument.CreateElement("DisplayName");
XmlElement xmlUsername = xmlDocument.CreateElement("Username");
bool blnContinueLoop = true;
using (SPSite objSite = SPContext.Current.Site)
{
using (SPWeb objWeb = objSite.OpenWeb())
{
string userAc = objWeb.CurrentUser.LoginName.Split('\\')[1];
using (DirectoryEntry deUser = RetrieveActiveDirectoryUserByAccountName(userAc))
{
if (deUser != null)
{
bool isUserCorpComms = ( _prop(deUser, "department") == "Corporate Communications" );
DirectoryEntry tmp = deUser; //placeholder for recursing up the org chart
string mgrTitle = _getManagerTitle(tmp);
//if your manager is "Managing Director" then they are the EGM
if (mgrTitle == "Managing Director")
{
DirectoryEntry tmpMgr = _getManager(tmp);
xmlDisplayName.InnerText = _prop(tmpMgr, "displayName");
xmlUsername.InnerText = _prop(tmpMgr, "sAMAccountName");
}
else
{
while (mgrTitle != "Managing Director" )
{
tmp = _getManager(tmp);
if (tmp == null) break;
mgrTitle = _getManagerTitle(tmp);
}
xmlDisplayName.InnerText = _prop(tmp, "displayName");
xmlUsername.InnerText = _prop(tmp, "sAMAccountName");
}
deUser.Close();
}
}
objWeb.Close();
}
objSite.Close();
}
xmlDocument.AppendChild(xmlPropertyData);
xmlPropertyData.AppendChild(xmlDisplayName);
xmlPropertyData.AppendChild(xmlUsername);
return xmlDocument;
}
[WebMethod]
public bool IsRegionalEmployee()
{
bool blnResult = false;
using (SPSite objSite = SPContext.Current.Site)
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPUser objCurrentUser = objWeb.CurrentUser;
string strAccountUsername = objCurrentUser.LoginName.Substring(objCurrentUser.LoginName.IndexOf(@"\") + 1);
using (DirectoryEntry objDirectoryEntry = RetrieveActiveDirectoryUserByAccountName(strAccountUsername))
{
if (objDirectoryEntry != null)
{
if (objDirectoryEntry.Properties["physicalDeliveryOfficeName"].Value != null && objDirectoryEntry.Properties["physicalDeliveryOfficeName"].Value.ToString() != "TA Sydney Office" &&
objDirectoryEntry.Properties["department"].Value != null && (objDirectoryEntry.Properties["department"].Value.ToString().StartsWith("International (Eastern)") || objDirectoryEntry.Properties["department"].Value.ToString().StartsWith("International (Western)")))
{
_trace("IsRegionalEmployee", "Found regional employee {0} [{1}]", objCurrentUser.Name, strAccountUsername);
blnResult = true;
}
objDirectoryEntry.Close();
}
}
objWeb.Close();
}
objSite.Close();
}
return blnResult;
}
private DirectoryEntry RetrieveActiveDirectoryUserByAccountName(string strAccountUsername)
{
DirectoryEntry objDirectoryEntry = null;
using (DirectoryEntry objDirectoryRoot = new DirectoryEntry("LDAP://office.local.pri/DC=office,DC=local,DC=pri", c_strADUserName, c_strADPassword))
{
using (DirectorySearcher objDirectorySearcher = new DirectorySearcher(objDirectoryRoot))
{
objDirectorySearcher.Filter = "(&(objectClass=user)(objectCategory=person)(sAMAccountName=" + strAccountUsername + "))";
objDirectorySearcher.SearchScope = SearchScope.Subtree;
objDirectorySearcher.PageSize = 1000;
SearchResultCollection colSearchResults = objDirectorySearcher.FindAll();
foreach (SearchResult objSearchResult in colSearchResults)
{
objDirectoryEntry = objSearchResult.GetDirectoryEntry();
break;
}
}
objDirectoryRoot.Close();
}
return objDirectoryEntry;
}
private DirectoryEntry RetrieveActiveDirectoryUserByAccountPath(string strAccountPath)
{
DirectoryEntry objDirectoryEntry = new DirectoryEntry("LDAP://" + strAccountPath.Replace("/", @"\2f"), c_strADUserName, c_strADPassword);
return objDirectoryEntry;
}
#region Helpers
private bool _isTracing
{
get
{
bool ret = false;
bool.TryParse(ConfigurationSettings.AppSettings["UserActiveDirectoryWebservice.Tracing.Enabled"] ?? "False", out ret);
return ret;
}
}
private string _tracePath
{
get { return ConfigurationManager.AppSettings["UserActiveDirectoryWebservice.Tracing.Path"] ?? @"C:\InetPub\LogFiles\UserActiveDirectoryWebservice"; }
}
private void _ensureTracePath()
{
lock (_lockObject)
{
WindowsImpersonationContext wctx = null;
try
{
wctx = WindowsIdentity.Impersonate(IntPtr.Zero); //app pool identity
if (Application["TA.MOSS.UserActiveDirectory::_ensureTracePath()"] != null)
return;
if (!Directory.Exists(_tracePath))
{
//adding access for everyone here didn't work too well
//better to inherit the access through the normal file system ACL inheritance mechanisms
//DirectorySecurity acl = new DirectorySecurity();
//acl.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.Write, AccessControlType.Allow)); //Everyone
Directory.CreateDirectory(_tracePath); //, acl);
}
/* - ACL update disabled; see note above
else
{
DirectorySecurity acl = Directory.GetAccessControl(_tracePath);
//get ACLs
AuthorizationRuleCollection rules = acl.GetAccessRules(true, true, typeof(SecurityIdentifier));
bool aclOK = false;
foreach (FileSystemAccessRule rule in rules)
{
if (((SecurityIdentifier)rule.IdentityReference).IsWellKnown(WellKnownSidType.WorldSid))
{
if ((rule.FileSystemRights & FileSystemRights.Write) != 0)
{
aclOK = true;
break;
}
}
}
if (!aclOK)
{
acl.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.Write, AccessControlType.Allow)); //Everyone
Directory.SetAccessControl(_tracePath, acl);
}
}
*/
//write an application-wide marker so we don't do this every time
Application["TA.MOSS.UserActiveDirectory::_ensureTracePath()"] = true;
}
catch (Exception ex)
{
try
{
if (!EventLog.SourceExists("UserActiveDirectory Web Service"))
EventLog.CreateEventSource("UserActiveDirectory Web Service", "Application");
EventLog.WriteEntry("UserActiveDirectory Web Service", "Failed to ensure Trace Path was accessible to the log writer [" + _tracePath + "]" + Environment.NewLine + "Tracing is disabled." + Environment.NewLine + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, EventLogEntryType.Error);
}
catch { } //if that failed there's really nothing left to do
}
finally
{
if (wctx != null)
{
wctx.Undo();
wctx.Dispose();
}
}
}
}
private void _trace(string method, string message, params object[] args)
{
if (!_isTracing) return;
//this should only happen once
_ensureTracePath();
//one file per Hour
WindowsImpersonationContext wctx = null;
try
{
wctx = WindowsIdentity.Impersonate(IntPtr.Zero);
lock (_lockObject)
{
string traceFileName = Path.Combine(_tracePath, "UserActiveDirectory Log " + DateTime.Now.ToString("yyyyMMdd-HH") + "00.log");
File.AppendAllText(traceFileName, DateTime.Now.ToString("yyyyMMdd HHmmss") + "\t" + method + "\t" + String.Format(message, args) + Environment.NewLine);
}
}
catch { } //a tracing fail must not fail the execution of the main thread
finally
{
if (wctx != null)
{
wctx.Undo();
wctx.Dispose();
}
}
}
private string _prop(DirectoryEntry de, string propertyName)
{
//does not return null, only empty string to make logic clearer
//there is no difference to us in this case between null & empty string
if (de==null || de.Properties[propertyName] == null || de.Properties[propertyName].Value == null) return String.Empty;
else return de.Properties[propertyName].Value.ToString();
}
private DirectoryEntry _getManager(DirectoryEntry user)
{
string mgrAc = _prop(user, "manager");
if (mgrAc == "") return null;
return RetrieveActiveDirectoryUserByAccountPath(mgrAc);
}
private string _getManagerTitle(DirectoryEntry user)
{
string mgrAc = _prop(user, "manager");
if (mgrAc == "") return "";
string mgrTitle = "";
using (DirectoryEntry deMgr = RetrieveActiveDirectoryUserByAccountPath(mgrAc))
{
mgrTitle = _prop(deMgr, "title");
deMgr.Close();
}
return mgrTitle;
}
#endregion
} | 0 |
10,286,459 | 04/23/2012 18:53:02 | 482,176 | 10/20/2010 19:21:58 | 370 | 18 | Multiple package manager | Is there a pitfall of using multiple package managers? Could I use Redhat's yum with Debian's aptitude at the same time?
I came across [this article][1] and this infographic -
![2011 Linux Distro comparison result][2]
I was inclined to choose Debian, but a quick VM install showed that the Kernel is not upgraded to 3.2 in the stable repo yet. So I am planning to move to Archlinux, but the infographic rates it low on package availablity and I was wondering if I could install .deb or .rpm files from the Fedora or Ubuntu repositories.
[1]: http://tuxradar.com/content/best-distro-2011
[2]: http://i.stack.imgur.com/Cygfh.png | linux | yum | package-managers | aptitude | distro | 04/24/2012 08:41:51 | off topic | Multiple package manager
===
Is there a pitfall of using multiple package managers? Could I use Redhat's yum with Debian's aptitude at the same time?
I came across [this article][1] and this infographic -
![2011 Linux Distro comparison result][2]
I was inclined to choose Debian, but a quick VM install showed that the Kernel is not upgraded to 3.2 in the stable repo yet. So I am planning to move to Archlinux, but the infographic rates it low on package availablity and I was wondering if I could install .deb or .rpm files from the Fedora or Ubuntu repositories.
[1]: http://tuxradar.com/content/best-distro-2011
[2]: http://i.stack.imgur.com/Cygfh.png | 2 |
8,612,243 | 12/23/2011 04:27:40 | 565,033 | 01/06/2011 06:16:37 | 18 | 0 | Ruby on Rails server won't start: dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info | Environment (Mac OS X 10.7.2 - Lion):
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10]
$ rails -v
Rails 3.1.3
$ mysql -v
Server version: 5.1.44
I try running the following but I'm greeted with the same error every time even after applying fixes from all over the web:
$ rails server
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Users/pressplay/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Users/pressplay/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Trace/BPT trap: 5
Failed attempts at fixing include:
sudo install_name_tool -change libmysqlclient.16.dylib /Applications/MAMP/Library/lib/mysql/libmysqlclient.16.dylib ~/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
sudo ln -s /Applications/MAMP/Library/lib/mysql/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib | mysql | ruby-on-rails | ruby | osx-lion | null | null | open | Ruby on Rails server won't start: dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
===
Environment (Mac OS X 10.7.2 - Lion):
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10]
$ rails -v
Rails 3.1.3
$ mysql -v
Server version: 5.1.44
I try running the following but I'm greeted with the same error every time even after applying fixes from all over the web:
$ rails server
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Users/pressplay/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Users/pressplay/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Trace/BPT trap: 5
Failed attempts at fixing include:
sudo install_name_tool -change libmysqlclient.16.dylib /Applications/MAMP/Library/lib/mysql/libmysqlclient.16.dylib ~/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
sudo ln -s /Applications/MAMP/Library/lib/mysql/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib | 0 |
3,538,156 | 08/21/2010 16:16:28 | 40,002 | 11/23/2008 01:27:37 | 3,856 | 138 | FileIO in Every Language! | This has to be a common question that all programmers have from time to time.
How do I read a line from a text file? Then the next question is always how do i write it back.
Of course most of you use a high level framework in day to day programming (which are fine to use in answers) but sometimes it's nice to know how to do it at a low level too.
I myself know how to do it in `C`, `C++` and `Objective-C`, but it sure would be handy to see how it's done in all of the popular languages, if only to help us make a better decision about what language to do our file io in. In particular I think it would be interesting to see how its done in the string manipulation languages, like: `python`, `ruby` and of course `perl`.
So I figure here we can create a ***community resource*** that we can all ***star*** to our profiles and refer to when we need to do **file I/O** in some new language. Not to mention the exposure we will all get to languages that we don't deal with on a day to day basis.
**This is how you need to answer:**
1. Create a new text file called "**fileio.txt**"
2. Write the first line "hello" to the text file.
3. Write the second line "world" to the text file.
4. Read the second line "world" into an input string.
5. Print the input string to the console.
No particular limit on the language.
`C`, `C++`, `C#`, `Java`, `Objective-C` are all great.
If you know how to do it in `Prolog`, `Haskell`, `Fortran`, `Lisp`, or `Basic` then please go right ahead =) | programming-languages | file-io | null | null | null | 08/23/2010 01:36:22 | not a real question | FileIO in Every Language!
===
This has to be a common question that all programmers have from time to time.
How do I read a line from a text file? Then the next question is always how do i write it back.
Of course most of you use a high level framework in day to day programming (which are fine to use in answers) but sometimes it's nice to know how to do it at a low level too.
I myself know how to do it in `C`, `C++` and `Objective-C`, but it sure would be handy to see how it's done in all of the popular languages, if only to help us make a better decision about what language to do our file io in. In particular I think it would be interesting to see how its done in the string manipulation languages, like: `python`, `ruby` and of course `perl`.
So I figure here we can create a ***community resource*** that we can all ***star*** to our profiles and refer to when we need to do **file I/O** in some new language. Not to mention the exposure we will all get to languages that we don't deal with on a day to day basis.
**This is how you need to answer:**
1. Create a new text file called "**fileio.txt**"
2. Write the first line "hello" to the text file.
3. Write the second line "world" to the text file.
4. Read the second line "world" into an input string.
5. Print the input string to the console.
No particular limit on the language.
`C`, `C++`, `C#`, `Java`, `Objective-C` are all great.
If you know how to do it in `Prolog`, `Haskell`, `Fortran`, `Lisp`, or `Basic` then please go right ahead =) | 1 |
3,152,529 | 06/30/2010 19:07:17 | 40,521 | 11/25/2008 05:29:48 | 1,054 | 31 | LINQ 2 SQL : Loading more than one result sets to a variable when executing a stored procedure from LIN2 SQL. | In LINQ 2 SQL,I am executing a stored procedure like
datacontext.StoredProcedureName(parameter1,paramter2)
My sotored procedure is returning 2 different resultsets.How can i catch it and parse over it to grab the values from it
VB.NET am working with | sql | linq-to-sql | stored-procedures | null | null | null | open | LINQ 2 SQL : Loading more than one result sets to a variable when executing a stored procedure from LIN2 SQL.
===
In LINQ 2 SQL,I am executing a stored procedure like
datacontext.StoredProcedureName(parameter1,paramter2)
My sotored procedure is returning 2 different resultsets.How can i catch it and parse over it to grab the values from it
VB.NET am working with | 0 |
6,011,626 | 05/15/2011 22:15:16 | 754,837 | 05/15/2011 20:41:57 | 1 | 0 | android socket with htc phone | If i'm applying android application on my htc mobile and i want to send my location to my server python code !! how can this do i made this method in my android application which is maps view and some overlayitems
enter code here
public void connect(View view){
try{
clientSocket= new Socket("10.0.2.2",54633);
Text.append( "\n created a socket");
}catch(Exception e){
System.out.println("Error");
}
}
and same id and port in my python code but do i have to enter the htc ip address or what ?!!
Also how to be able to send the location | android | htc | null | null | null | 05/16/2011 05:26:34 | not a real question | android socket with htc phone
===
If i'm applying android application on my htc mobile and i want to send my location to my server python code !! how can this do i made this method in my android application which is maps view and some overlayitems
enter code here
public void connect(View view){
try{
clientSocket= new Socket("10.0.2.2",54633);
Text.append( "\n created a socket");
}catch(Exception e){
System.out.println("Error");
}
}
and same id and port in my python code but do i have to enter the htc ip address or what ?!!
Also how to be able to send the location | 1 |
7,563,682 | 09/27/2011 02:48:50 | 590,967 | 01/26/2011 16:58:02 | 336 | 9 | Camera don't work on phonegap when files in server? | I wrote a client for my server based on jquery mobile.I just cannot figure out how to transfer photos to my server because when I use GET method to post base64 strings,server just appears URI is too long.
So I tried to move the webpages and scripts to server and left a local file to redirect to server page.But right now,I can take photos but there seems have no callback when I finished.
Here is what I did
var imgTakePhotoStatusBase64="Wyk+HjAxHTAyNzg3MDUdODQwHTAxOR0wMDAwMDAwMDAwMDAwMDAdRkRFQh0wMDAwMDAwHTA0MB0dMS8xHTUwLjVMQh1OHVcgMzR0aCBTdHJlZXQdQXVzdGluHVRYHSAeMDYdMTBaR0QwMDQdMTFaUmVjaXBpZW50IENvbXBhbnkgTmFtZR0xMlo5MDEyNjM3OTA2HTE0WioqVEVTVCBMQUJFTCAtIERPIE5PVCBTSElQKiodMjNaTh0yMlocWR0yMFogHDAdMjZaNjEzMxwdHgQ=";
function TextStatus(){
var s=window.prompt("","请输入广播的内容");
if(s!=null&&s!=""){
SetStaus(s);
}
}
$("#pageTakePhotoStatus").live("pageshow", function() {
TakePhotoStatus()
});
function TakePhotoStatus(){
imageData="";
navigator.camera.getPicture(onTakePhotoStatusSuccess, onTakePhotoStatusFail, { quality: 75 });
}
function onTakePhotoStatusSuccess(imageData) {
var image = document.getElementById('imgTakePhotoStatus');
image.src = "data:image/jpeg;base64," + imageData;
imgTakePhotoStatusBase64=imageData;
}
function onTakePhotoStatusFail(message) {
alert('获取照片失败,因为: ' + message);
}
function TakePhotoStatusOk(){
try
{
var myDate = new Date();
var r=myDate.getTime();
var path="uploads.share/"+r+"/"+r+".jpg";
doMethod("ImageUploadByBase64String","{'str':'"+e(imgTakePhotoStatusBase64)+"','path':'"+e(path)+"'}",null,
function(result){
doMethod("PublishPhotoes","{'located':'false','path':'"+e(path)+"','text':'"+e("描述:"+$("#txaTakePhotoStatusDes").val())+"'}",null,
function(r){
alert("您的照片已经发布");
history.back();
});
});
}catch(err)
{
alert(err.description);
}
}
But `onTakePhotoStatusSuccess` don't when I taken a photo.When I run it in local,It is just fine. | jquery-mobile | phonegap | null | null | null | null | open | Camera don't work on phonegap when files in server?
===
I wrote a client for my server based on jquery mobile.I just cannot figure out how to transfer photos to my server because when I use GET method to post base64 strings,server just appears URI is too long.
So I tried to move the webpages and scripts to server and left a local file to redirect to server page.But right now,I can take photos but there seems have no callback when I finished.
Here is what I did
var imgTakePhotoStatusBase64="Wyk+HjAxHTAyNzg3MDUdODQwHTAxOR0wMDAwMDAwMDAwMDAwMDAdRkRFQh0wMDAwMDAwHTA0MB0dMS8xHTUwLjVMQh1OHVcgMzR0aCBTdHJlZXQdQXVzdGluHVRYHSAeMDYdMTBaR0QwMDQdMTFaUmVjaXBpZW50IENvbXBhbnkgTmFtZR0xMlo5MDEyNjM3OTA2HTE0WioqVEVTVCBMQUJFTCAtIERPIE5PVCBTSElQKiodMjNaTh0yMlocWR0yMFogHDAdMjZaNjEzMxwdHgQ=";
function TextStatus(){
var s=window.prompt("","请输入广播的内容");
if(s!=null&&s!=""){
SetStaus(s);
}
}
$("#pageTakePhotoStatus").live("pageshow", function() {
TakePhotoStatus()
});
function TakePhotoStatus(){
imageData="";
navigator.camera.getPicture(onTakePhotoStatusSuccess, onTakePhotoStatusFail, { quality: 75 });
}
function onTakePhotoStatusSuccess(imageData) {
var image = document.getElementById('imgTakePhotoStatus');
image.src = "data:image/jpeg;base64," + imageData;
imgTakePhotoStatusBase64=imageData;
}
function onTakePhotoStatusFail(message) {
alert('获取照片失败,因为: ' + message);
}
function TakePhotoStatusOk(){
try
{
var myDate = new Date();
var r=myDate.getTime();
var path="uploads.share/"+r+"/"+r+".jpg";
doMethod("ImageUploadByBase64String","{'str':'"+e(imgTakePhotoStatusBase64)+"','path':'"+e(path)+"'}",null,
function(result){
doMethod("PublishPhotoes","{'located':'false','path':'"+e(path)+"','text':'"+e("描述:"+$("#txaTakePhotoStatusDes").val())+"'}",null,
function(r){
alert("您的照片已经发布");
history.back();
});
});
}catch(err)
{
alert(err.description);
}
}
But `onTakePhotoStatusSuccess` don't when I taken a photo.When I run it in local,It is just fine. | 0 |
8,977,911 | 01/23/2012 20:10:17 | 1,109,048 | 12/21/2011 03:12:22 | 34 | 0 | How to use four 'if/elsif' statements | I have this block of code
<?php
// if first occurence is .png get $png1 needle from haystack
if (preg_match('#cid:([^"@]*).png@([^"]*)#', $html_part))
$find = '#cid:([^"@]*).png@([^"]*)#';
$replace1 = $png1;
$html_part = preg_replace($find, $replace, $html_part);
// if first occurence is .jpg get $jpg1 needle from haystack
else if (preg_match('#cid:([^"@]*).jpg@([^"]*)#', $html_part))
$find = '#cid:([^"@]*).jpg@([^"]*)#';
$replace1 = $jpg1;
$html_part = preg_replace($find, $replace, $html_part);
// if first occurence is .gif then get $gif1 needle from haystack
elseif (preg_match('#cid:([^"@]*).gif@([^"]*)#', $html_part))
$find = '#cid:([^"@]*).gif@([^"]*)#';
$replace = $gif1;
$html_part = preg_replace($find, $replace, $html_part);
// if first occurence is .bmp then get $bmp1 needle from haystack
else {
$find = '#cid:([^"@]*).bmp@([^"]*)#';
$replace = $bmp1;
$html_part = preg_replace($find, $replace, $html_part);
?>
But it doesn't process correctly when i run it, which i believe the elseif/else if statements only support up to 3 (if, elseif, else). How to fix this? Thanks. | php | if-statement | null | null | null | 03/28/2012 17:49:25 | too localized | How to use four 'if/elsif' statements
===
I have this block of code
<?php
// if first occurence is .png get $png1 needle from haystack
if (preg_match('#cid:([^"@]*).png@([^"]*)#', $html_part))
$find = '#cid:([^"@]*).png@([^"]*)#';
$replace1 = $png1;
$html_part = preg_replace($find, $replace, $html_part);
// if first occurence is .jpg get $jpg1 needle from haystack
else if (preg_match('#cid:([^"@]*).jpg@([^"]*)#', $html_part))
$find = '#cid:([^"@]*).jpg@([^"]*)#';
$replace1 = $jpg1;
$html_part = preg_replace($find, $replace, $html_part);
// if first occurence is .gif then get $gif1 needle from haystack
elseif (preg_match('#cid:([^"@]*).gif@([^"]*)#', $html_part))
$find = '#cid:([^"@]*).gif@([^"]*)#';
$replace = $gif1;
$html_part = preg_replace($find, $replace, $html_part);
// if first occurence is .bmp then get $bmp1 needle from haystack
else {
$find = '#cid:([^"@]*).bmp@([^"]*)#';
$replace = $bmp1;
$html_part = preg_replace($find, $replace, $html_part);
?>
But it doesn't process correctly when i run it, which i believe the elseif/else if statements only support up to 3 (if, elseif, else). How to fix this? Thanks. | 3 |
10,373,122 | 04/29/2012 14:53:42 | 1,364,258 | 04/29/2012 14:39:21 | 1 | 0 | Accessing reports in OBIEE from a Java Program | I am developing an Java application using Netbeans which will fetch reports from the BI server and display it to the client using the Java application. Can anyone suggest me appropriate steps to do this and also how to begin with it. | java | business-intelligence | oracle-adf | obiee | bi-publisher | null | open | Accessing reports in OBIEE from a Java Program
===
I am developing an Java application using Netbeans which will fetch reports from the BI server and display it to the client using the Java application. Can anyone suggest me appropriate steps to do this and also how to begin with it. | 0 |
10,903,544 | 06/05/2012 19:21:19 | 848,117 | 03/19/2011 20:40:08 | 679 | 43 | jQuery replace multiple elements using class | I want to replace all the `spans` with a `div`.
When I run this code only one element gets replaced.
How to change this code so that the script affects all the `spans`?
*I have tried to use clone(), but it didn't work.*
$flexBox = $("<div></div>");
$(".overlayBox").replaceWith($flexBox);
<span class="overlayBox"></span>
<span class="overlayBox"></span>
<span class="overlayBox"></span> | jquery | null | null | null | null | null | open | jQuery replace multiple elements using class
===
I want to replace all the `spans` with a `div`.
When I run this code only one element gets replaced.
How to change this code so that the script affects all the `spans`?
*I have tried to use clone(), but it didn't work.*
$flexBox = $("<div></div>");
$(".overlayBox").replaceWith($flexBox);
<span class="overlayBox"></span>
<span class="overlayBox"></span>
<span class="overlayBox"></span> | 0 |
11,051,825 | 06/15/2012 13:43:19 | 1,013,512 | 10/25/2011 20:37:53 | 301 | 1 | Get rows that are in between 2 dates? | I have in my db (mysql) a startdate and an enddate field, if I get todays date via php before my query, is there a way to only select rows that todays date falls in between their start date and end date? | php | mysql | null | null | null | 06/18/2012 17:29:06 | not a real question | Get rows that are in between 2 dates?
===
I have in my db (mysql) a startdate and an enddate field, if I get todays date via php before my query, is there a way to only select rows that todays date falls in between their start date and end date? | 1 |
6,432,873 | 06/21/2011 22:40:32 | 226,157 | 12/07/2009 06:38:59 | 88 | 8 | iPhone App- Smart Calling card recharge through paypal will be rejected by App Store? because of not using inApp | I have to develop an iPhone application in which user can recharge their calling card. I prefer to go for paypal because of low charge. My doubt is Will Apple accept this? because the recharge is not going to improve the application functionality, just it will increase the balance of the user in that particular account to make more phone calls.
Please someone help me out. If its possible to send the same query to apple, please say me the url or email id where I have to post this query to get back the results soon. | iphone | app-store | in-app-purchase | appstore-approval | null | 06/22/2011 00:34:26 | off topic | iPhone App- Smart Calling card recharge through paypal will be rejected by App Store? because of not using inApp
===
I have to develop an iPhone application in which user can recharge their calling card. I prefer to go for paypal because of low charge. My doubt is Will Apple accept this? because the recharge is not going to improve the application functionality, just it will increase the balance of the user in that particular account to make more phone calls.
Please someone help me out. If its possible to send the same query to apple, please say me the url or email id where I have to post this query to get back the results soon. | 2 |
11,667,456 | 07/26/2012 10:34:31 | 1,554,316 | 07/26/2012 10:27:36 | 1 | 0 | facebook page name change | http://www.facebook.com/INRU.BY.RUPALI.INDEEP
I have changed my company name from INRU TO PRALI And i am the sole owner now, so i want to change the page url name from http://www.facebook.com/INRU.BY.RUPALI.INDEEP to PRALII BY RUPALI.D.LAKRA.Please help its really important as i have to get my visiting cards done and facebook platform is the one i chose to launch my business!!! please help!! | facebook | page | name | null | null | 07/27/2012 02:26:52 | off topic | facebook page name change
===
http://www.facebook.com/INRU.BY.RUPALI.INDEEP
I have changed my company name from INRU TO PRALI And i am the sole owner now, so i want to change the page url name from http://www.facebook.com/INRU.BY.RUPALI.INDEEP to PRALII BY RUPALI.D.LAKRA.Please help its really important as i have to get my visiting cards done and facebook platform is the one i chose to launch my business!!! please help!! | 2 |
11,467,364 | 07/13/2012 09:05:33 | 1,388,095 | 05/10/2012 20:44:04 | 6 | 0 | Authentication denied trying to set up linux user for SFTP access and no SSH | I am trying to set-up a user to have SFTP access to a server directory (/var/www/home) with no access outside of these folders.
I followed http://blog.swiftbyte.com/linux/allowing-sftp-access-while-chrooting-the-user-and-denying-shell-access, which was an excellent tutorial, but when I try to SFTP in using FileZilla, I get an authentication denied message.
Does anyone have any insight into why this may be happening and what I can do to resolve?
Thanks! | linux | ssh | sftp | null | null | 07/15/2012 11:42:44 | off topic | Authentication denied trying to set up linux user for SFTP access and no SSH
===
I am trying to set-up a user to have SFTP access to a server directory (/var/www/home) with no access outside of these folders.
I followed http://blog.swiftbyte.com/linux/allowing-sftp-access-while-chrooting-the-user-and-denying-shell-access, which was an excellent tutorial, but when I try to SFTP in using FileZilla, I get an authentication denied message.
Does anyone have any insight into why this may be happening and what I can do to resolve?
Thanks! | 2 |
4,991,929 | 12/06/2010 13:55:35 | 176,336 | 09/20/2009 23:01:09 | 102 | 11 | Websites for mobile browsers: CSS and meta tags | Some sites do not work in mobile browsers. Often this is caused by specific CSS attributes or missing HTML meta tags.
For example the HTML tag `<meta name="viewport"...>` is required for correct scaling of the page. Or the CSS attribute `overflow: scroll;` in a `div` on the page does not work on iPad as expected.
What specific Tags/Attributes does a HTML developer need to understand and use when enabling a page for mobile browsers? | mobile | css | html | ipad | null | null | open | Websites for mobile browsers: CSS and meta tags
===
Some sites do not work in mobile browsers. Often this is caused by specific CSS attributes or missing HTML meta tags.
For example the HTML tag `<meta name="viewport"...>` is required for correct scaling of the page. Or the CSS attribute `overflow: scroll;` in a `div` on the page does not work on iPad as expected.
What specific Tags/Attributes does a HTML developer need to understand and use when enabling a page for mobile browsers? | 0 |
10,011,762 | 04/04/2012 13:08:44 | 1,312,881 | 04/04/2012 12:48:44 | 1 | 0 | Typhoeus Hydra run out of memory | I wrote a script that checks urls from file (using ruby gem Typhoeus). I don't know why when I run my code the memory usage grow. Usually after 10000 urls script crashes.
Is there any solution for it ? Thanks in advance for your help.
My code:
require 'rubygems'
require 'typhoeus'
def run file
log = Logger.new('log')
hydra = Typhoeus::Hydra.new(:max_concurrency => 30)
hydra.disable_memoization
File.open(file).each do |url|
begin
request = Typhoeus::Request.new(url.strip, :method => :get, :follow_location => true)
request.on_complete do |resp|
check_website(url, resp.body)
end
puts "queuing #{ url }"
hydra.queue(request)
request.destroy
rescue Exception => e
log.error e
end
end
hydra.run
end
| ruby | hydra | typhoeus | null | null | null | open | Typhoeus Hydra run out of memory
===
I wrote a script that checks urls from file (using ruby gem Typhoeus). I don't know why when I run my code the memory usage grow. Usually after 10000 urls script crashes.
Is there any solution for it ? Thanks in advance for your help.
My code:
require 'rubygems'
require 'typhoeus'
def run file
log = Logger.new('log')
hydra = Typhoeus::Hydra.new(:max_concurrency => 30)
hydra.disable_memoization
File.open(file).each do |url|
begin
request = Typhoeus::Request.new(url.strip, :method => :get, :follow_location => true)
request.on_complete do |resp|
check_website(url, resp.body)
end
puts "queuing #{ url }"
hydra.queue(request)
request.destroy
rescue Exception => e
log.error e
end
end
hydra.run
end
| 0 |
4,205,484 | 11/17/2010 14:39:45 | 30,889 | 10/23/2008 17:23:22 | 211 | 5 | Distributed Transaction Error Only Through Code | I and trying to perform a query against a linked server (SQL Server 2008 linked to Sybase) and select it into a temp table. Is works perfectly though a query window in SQL Management Studio, but when I do it through code (C#) it fails with the error "The operation could not be performed because OLE DB provider "ASEOLEDB" for linked server "MYLINKEDSERVER" was unable to begin a distributed transaction. I am not using a transaction in code with my DbConnection.
This query looks like this:
SELECT *
INTO #temptable
FROM OPENQUERY([MYLINKEDSERVER], 'SELECT * from table')
| c# | .net | transactions | linked-server | null | null | open | Distributed Transaction Error Only Through Code
===
I and trying to perform a query against a linked server (SQL Server 2008 linked to Sybase) and select it into a temp table. Is works perfectly though a query window in SQL Management Studio, but when I do it through code (C#) it fails with the error "The operation could not be performed because OLE DB provider "ASEOLEDB" for linked server "MYLINKEDSERVER" was unable to begin a distributed transaction. I am not using a transaction in code with my DbConnection.
This query looks like this:
SELECT *
INTO #temptable
FROM OPENQUERY([MYLINKEDSERVER], 'SELECT * from table')
| 0 |
2,380,680 | 03/04/2010 15:59:07 | 44,160 | 12/07/2008 23:29:13 | 608 | 6 | Graduate degree help changing career to Graphics Engineer? | I've been out of school for 2 years and have always enjoy computer graphics. I'm currently an IT programmer and would like to make the change into computer graphics. I'm currently working on a side project which is an iPhone game using opengl. I wanting to know peoples opinion on what might be the best route into making the change. I'm thinking I have 3 choices:
1. Keep developing my own side projects, developing a nice portfolio and learn as much as I can learning about opengl, computer graphics and such.
2. Go back to university and pursue a graduate degree in computer science with a focus on computer graphics. The particular university in mind does research in Augmented Reality which would interest me.
3. Go back to university and just take all the graphics courses I can( they offer about 2 a semester ) and still develop my side projects( just won't be as productive since school will take some of my time ).
My thought process is that sometimes, companies will say that a graduate degree can supplement some experience. Well, I have zero experience in professional computer graphics so maybe a graduate degree could supplement some of that experience. | graphics | career-development | null | null | null | 01/19/2012 07:53:11 | off topic | Graduate degree help changing career to Graphics Engineer?
===
I've been out of school for 2 years and have always enjoy computer graphics. I'm currently an IT programmer and would like to make the change into computer graphics. I'm currently working on a side project which is an iPhone game using opengl. I wanting to know peoples opinion on what might be the best route into making the change. I'm thinking I have 3 choices:
1. Keep developing my own side projects, developing a nice portfolio and learn as much as I can learning about opengl, computer graphics and such.
2. Go back to university and pursue a graduate degree in computer science with a focus on computer graphics. The particular university in mind does research in Augmented Reality which would interest me.
3. Go back to university and just take all the graphics courses I can( they offer about 2 a semester ) and still develop my side projects( just won't be as productive since school will take some of my time ).
My thought process is that sometimes, companies will say that a graduate degree can supplement some experience. Well, I have zero experience in professional computer graphics so maybe a graduate degree could supplement some of that experience. | 2 |
3,948,584 | 10/16/2010 10:51:59 | 385,172 | 07/07/2010 05:22:35 | 574 | 31 | Developing an Online Webcam Video Survilance System in .NET (Real Time Video Streaming Issues) | This semester I'm working on an application that is joining two projects in two different courses in my Software Engineering degree.
SWE 490: Component Based Software Engineering
SWE 344: IP and Client Server programing
Here's what's my application about :
**Client Side (Desktop Based)**: main function is to capture webcam videos and stream them the server.
**Server Side (Web Based)**: Receive streamed videos from clients and display them on the website in real time.
**Description of the application :**
The users will be able to monitor their Webcams remotely by streaming their webcams output to a remote server that is accessible via the web. The system will also serve as a motion detection system (if activated by the user) to notify the users via email if any motion has been detected on their webcams. In addition the system also allows users to schedule recordings and watch them online through live streaming.
I'm preparing a proposal for the project and I've made some initial plans for the system structure that is represented below :
**Client Side Components (Desktop) :**
![Client Side Components][1]
**Server Side Components (Server) :**
![alt text][2]
**My Questions :**
My main issues are with the real time video streaming (sending and receiving components) as this is a new topic for me.
I know I can program a socket and send the captured videos as a stream of bytes to the main server to be received on another socket, but what **I'm concerned about is how am i going display the received stream on the web browser at the server side**.
My situation is similar to [**this question**][3] except that it's for video streaming and not image streaming.
**I've been reading some articles and it seems like it can be done using Silverlight and I'm hoping someone can point me to the right direction.**
**Your opinions on the project in general will be much appreciated too.**
[1]: http://i.stack.imgur.com/tFD09.png
[2]: http://i.stack.imgur.com/QcleN.png
[3]: http://stackoverflow.com/questions/3359789/video-capturing-uploading-processing-streaming-back-net-c | c# | .net | asp.net-mvc | sockets | video-streaming | null | open | Developing an Online Webcam Video Survilance System in .NET (Real Time Video Streaming Issues)
===
This semester I'm working on an application that is joining two projects in two different courses in my Software Engineering degree.
SWE 490: Component Based Software Engineering
SWE 344: IP and Client Server programing
Here's what's my application about :
**Client Side (Desktop Based)**: main function is to capture webcam videos and stream them the server.
**Server Side (Web Based)**: Receive streamed videos from clients and display them on the website in real time.
**Description of the application :**
The users will be able to monitor their Webcams remotely by streaming their webcams output to a remote server that is accessible via the web. The system will also serve as a motion detection system (if activated by the user) to notify the users via email if any motion has been detected on their webcams. In addition the system also allows users to schedule recordings and watch them online through live streaming.
I'm preparing a proposal for the project and I've made some initial plans for the system structure that is represented below :
**Client Side Components (Desktop) :**
![Client Side Components][1]
**Server Side Components (Server) :**
![alt text][2]
**My Questions :**
My main issues are with the real time video streaming (sending and receiving components) as this is a new topic for me.
I know I can program a socket and send the captured videos as a stream of bytes to the main server to be received on another socket, but what **I'm concerned about is how am i going display the received stream on the web browser at the server side**.
My situation is similar to [**this question**][3] except that it's for video streaming and not image streaming.
**I've been reading some articles and it seems like it can be done using Silverlight and I'm hoping someone can point me to the right direction.**
**Your opinions on the project in general will be much appreciated too.**
[1]: http://i.stack.imgur.com/tFD09.png
[2]: http://i.stack.imgur.com/QcleN.png
[3]: http://stackoverflow.com/questions/3359789/video-capturing-uploading-processing-streaming-back-net-c | 0 |
131,989 | 09/25/2008 07:43:52 | 22,029 | 09/25/2008 07:43:52 | 1 | 0 | How do I get a list of all subdomains of a domain? | I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative Nameserver with the following option:
dig @ns1.foo.bar some_domain.com axfr
But this never works. Has anyone a better idea/approach
| subdomain | nameserver | dig | null | null | 07/13/2011 01:18:29 | off topic | How do I get a list of all subdomains of a domain?
===
I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative Nameserver with the following option:
dig @ns1.foo.bar some_domain.com axfr
But this never works. Has anyone a better idea/approach
| 2 |
4,105,010 | 11/05/2010 10:20:08 | 158,263 | 08/18/2009 08:16:09 | 257 | 7 | What are video journals similar to "Coders at Work"? | There is a lot of material in the internet about computer science, software development, hardware etc. This usually comes in a form of a [blogs][1], [rss's][2]
or [books][3].
What about **journal videos interviews** similar to [sixty-symbols][5] in physics or to ["Coders at Work"][6] and ["Founders at Work"][7] books?
What do you watch?
[1]: http://stackoverflow.com/questions/78955/what-are-the-best-programming-and-development-related-blogs-closed
[2]: http://stackoverflow.com/questions/5119/what-are-the-best-rss-feeds-for-programmers-developers
[3]: http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read
[4]: http://channel9.msdn.com/
[5]: http://www.youtube.com/user/sixtysymbols
[6]: http://www.codersatwork.com/
[7]: http://www.foundersatwork.com/ | language-agnostic | video | resources | null | null | 11/08/2010 01:56:25 | off topic | What are video journals similar to "Coders at Work"?
===
There is a lot of material in the internet about computer science, software development, hardware etc. This usually comes in a form of a [blogs][1], [rss's][2]
or [books][3].
What about **journal videos interviews** similar to [sixty-symbols][5] in physics or to ["Coders at Work"][6] and ["Founders at Work"][7] books?
What do you watch?
[1]: http://stackoverflow.com/questions/78955/what-are-the-best-programming-and-development-related-blogs-closed
[2]: http://stackoverflow.com/questions/5119/what-are-the-best-rss-feeds-for-programmers-developers
[3]: http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read
[4]: http://channel9.msdn.com/
[5]: http://www.youtube.com/user/sixtysymbols
[6]: http://www.codersatwork.com/
[7]: http://www.foundersatwork.com/ | 2 |
8,838,488 | 01/12/2012 16:23:50 | 890,290 | 08/11/2011 16:06:14 | 11 | 0 | Making a Choice on Migrating Oracle PLSQL to Java Classes / EJB | Wondering what could be decision points/factor in deciding on the option of Converting the PLSQL in the Java Class/EJB's.
There is sizeable amount of business logic impletemented into the PLSQL where the front end was powerbusider.
Now to make the application web enabled , application is being migrated to Java/J2EE with Struts Framework.
Is is necessary to migrate the PLSQL too along with the user interface , specially when the RDBMS continues to be on Oracle and there is expertise available on PLSQL.
What factors to take into consideration in making a choice.
Pramod. | java | oracle | plsql | ejb | powerbuilder | 01/13/2012 08:12:56 | not constructive | Making a Choice on Migrating Oracle PLSQL to Java Classes / EJB
===
Wondering what could be decision points/factor in deciding on the option of Converting the PLSQL in the Java Class/EJB's.
There is sizeable amount of business logic impletemented into the PLSQL where the front end was powerbusider.
Now to make the application web enabled , application is being migrated to Java/J2EE with Struts Framework.
Is is necessary to migrate the PLSQL too along with the user interface , specially when the RDBMS continues to be on Oracle and there is expertise available on PLSQL.
What factors to take into consideration in making a choice.
Pramod. | 4 |
11,274,992 | 06/30/2012 14:45:49 | 1,493,139 | 06/30/2012 14:38:28 | 1 | 0 | Editing uploaded file through html | Our teacher asked us to submit an assignment (Should be submitted through an online site). There, she gave us a link where we can upload the file. I submitted the file and found out that I uploaded the wrong file. With that, I found out that you can only submit the assignment once. Is there a possible way to remove that uploaded file using html and submit the other one in exchange? (I have no idea how to do html codes, really :/) thanks!!! | html | upload | edit | null | null | 07/02/2012 14:02:14 | not a real question | Editing uploaded file through html
===
Our teacher asked us to submit an assignment (Should be submitted through an online site). There, she gave us a link where we can upload the file. I submitted the file and found out that I uploaded the wrong file. With that, I found out that you can only submit the assignment once. Is there a possible way to remove that uploaded file using html and submit the other one in exchange? (I have no idea how to do html codes, really :/) thanks!!! | 1 |
6,474,782 | 06/24/2011 23:38:49 | 766,908 | 05/24/2011 00:18:31 | 17 | 0 | Lucene Indexing stuck after ~1million files (nrm file getting larger and larger...) | Does anyone know why this is happening? I'm doing basic indexing + SAX parsing of XML files and adding each path as a new field in the document. I got to like 1.5million files and its stuck on this one file for 30 minutes and the .nrm (normalizing file??) gets larger and larger.
I don't know why this is happening, my IndexWriter is of the form:
writer = new IndexWriter(dir, new StandardAnalyzer(Version.LUCENE_30), IndexWriter.MaxFieldLength.UNLIMITED)
Is this not optimal to use for large indices? Why is it frozen on this one file? I've ran it multiple times with over 1 million XML files and its persistently getting stuck on different XML files (not just this one in particular--whose structure is fine).
Thanks and cheers! I appreciate the help as always... | java | lucene | indexing | null | null | null | open | Lucene Indexing stuck after ~1million files (nrm file getting larger and larger...)
===
Does anyone know why this is happening? I'm doing basic indexing + SAX parsing of XML files and adding each path as a new field in the document. I got to like 1.5million files and its stuck on this one file for 30 minutes and the .nrm (normalizing file??) gets larger and larger.
I don't know why this is happening, my IndexWriter is of the form:
writer = new IndexWriter(dir, new StandardAnalyzer(Version.LUCENE_30), IndexWriter.MaxFieldLength.UNLIMITED)
Is this not optimal to use for large indices? Why is it frozen on this one file? I've ran it multiple times with over 1 million XML files and its persistently getting stuck on different XML files (not just this one in particular--whose structure is fine).
Thanks and cheers! I appreciate the help as always... | 0 |
2,386,756 | 03/05/2010 12:45:41 | 261,135 | 01/28/2010 16:03:34 | 3 | 0 | Hudson cyclic dependencies | Is there a method of checking for cyclic dependencies between jobs in Hudson? It is simple to observe if A->B->A but if A->B->C->D->A then its almost impossible manually. Is there a plugin to do this? I think it is key functionality because such a loop between build triggers can slowly kill a server. | hudson | hudson-plugins | null | null | null | null | open | Hudson cyclic dependencies
===
Is there a method of checking for cyclic dependencies between jobs in Hudson? It is simple to observe if A->B->A but if A->B->C->D->A then its almost impossible manually. Is there a plugin to do this? I think it is key functionality because such a loop between build triggers can slowly kill a server. | 0 |
4,761,822 | 01/21/2011 17:25:20 | 584,136 | 01/21/2011 07:53:27 | 6 | 0 | Help with PHP SESSION |
I want a session variable 'SC' (queried from the DB) after a user logs in, and display it in a text field.
<input value=" echo "SC" > - BASICALLY
I tried php session in w3schools, but its something different...
I just want to retrieve a data from a mysql table and display it when certain users log in.
any ideas??
thnx. in advanced! | php | mysql-query | session-variables | php-session | session-start | 01/22/2011 09:38:55 | not a real question | Help with PHP SESSION
===
I want a session variable 'SC' (queried from the DB) after a user logs in, and display it in a text field.
<input value=" echo "SC" > - BASICALLY
I tried php session in w3schools, but its something different...
I just want to retrieve a data from a mysql table and display it when certain users log in.
any ideas??
thnx. in advanced! | 1 |
1,204,942 | 07/30/2009 07:16:33 | 76,509 | 03/11/2009 05:45:04 | 464 | 3 | Can I get file path from Swing to explorer | I read
[FileTreeDragSource][1]
[1]: http://www.java2s.com/Code/Java/Swing-JFC/FileTreeDragSource.htm
Can I get file path from Swing to explorer.
Not explorer -> Swing!!
Swing -> explorer
I wanna get path with explorer | swing | java | file | null | null | null | open | Can I get file path from Swing to explorer
===
I read
[FileTreeDragSource][1]
[1]: http://www.java2s.com/Code/Java/Swing-JFC/FileTreeDragSource.htm
Can I get file path from Swing to explorer.
Not explorer -> Swing!!
Swing -> explorer
I wanna get path with explorer | 0 |
5,412,746 | 03/23/2011 23:00:39 | 587,009 | 01/24/2011 04:50:19 | 56 | 9 | android fragment onRestoreInstanceState | Am I missing something or do fragments not have a onRestoreInstanceState method? If not, how do I go about attaining something similar? | android | save | state | fragment | null | null | open | android fragment onRestoreInstanceState
===
Am I missing something or do fragments not have a onRestoreInstanceState method? If not, how do I go about attaining something similar? | 0 |
7,116,106 | 08/19/2011 01:44:11 | 537,353 | 12/10/2010 03:23:00 | 339 | 31 | Questions of BuildConfig | I'm a newbie of Grails Plugin.
1. what's the different of compile and build step?
2. where's the doc of plugins node,
3. what's the mean of export?
4. how can I force to auto install another plugin? If I install a plugin in my plugin, can It be used in the main app which installed my plugin?
Thanks | grails | grails-plugin | null | null | null | 08/19/2011 15:10:28 | not a real question | Questions of BuildConfig
===
I'm a newbie of Grails Plugin.
1. what's the different of compile and build step?
2. where's the doc of plugins node,
3. what's the mean of export?
4. how can I force to auto install another plugin? If I install a plugin in my plugin, can It be used in the main app which installed my plugin?
Thanks | 1 |
3,511,715 | 08/18/2010 11:49:56 | 423,928 | 08/18/2010 11:43:29 | 1 | 0 | File system scalability options | We have a NTFS volume used for storing large number of files(currently at 500GB and growing). Currently the same is accessed via a file share by a single application. We are looking at options to scale out the file server for access by multiple applications. The other applications would only be reading files and not performing any updates. What are the options available in designing such a file server so that it doesnt become a single point of failure and provides scalability, replication and availability? Some people have suggested moving the files to the database and thus achieve all of these. Are there any better options? Thanks in advance | file | scalability | null | null | null | null | open | File system scalability options
===
We have a NTFS volume used for storing large number of files(currently at 500GB and growing). Currently the same is accessed via a file share by a single application. We are looking at options to scale out the file server for access by multiple applications. The other applications would only be reading files and not performing any updates. What are the options available in designing such a file server so that it doesnt become a single point of failure and provides scalability, replication and availability? Some people have suggested moving the files to the database and thus achieve all of these. Are there any better options? Thanks in advance | 0 |
8,110,430 | 11/13/2011 08:09:50 | 50,979 | 01/02/2009 17:52:44 | 1,782 | 65 | How right was esr about open-source outcompeting closed-source? | esr predicted that open source would beat closed source, in [The Cathedral and the Bazaar](http://catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s11.html):
> the closed-source world cannot win an evolutionary arms race with open-source communities that can put orders of magnitude more skilled time into a problem.
While it's not dead yet (e.g. Google, Facebook, Apple, Adobe, Oracle), how much progress has open source made?
It's difficult to tell, because the landscape has itself shifted towards SaaS, mobile devices and consumer-oriented software.
It seems that software tools for developers have been largely replaced, though tools like Fogbugz and IntelliJ IDEA remain closed source (and even ThoughtWorks has some); and libraries seem even more vulnerable. | open-source | closed-source | null | null | null | 11/13/2011 09:19:33 | off topic | How right was esr about open-source outcompeting closed-source?
===
esr predicted that open source would beat closed source, in [The Cathedral and the Bazaar](http://catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s11.html):
> the closed-source world cannot win an evolutionary arms race with open-source communities that can put orders of magnitude more skilled time into a problem.
While it's not dead yet (e.g. Google, Facebook, Apple, Adobe, Oracle), how much progress has open source made?
It's difficult to tell, because the landscape has itself shifted towards SaaS, mobile devices and consumer-oriented software.
It seems that software tools for developers have been largely replaced, though tools like Fogbugz and IntelliJ IDEA remain closed source (and even ThoughtWorks has some); and libraries seem even more vulnerable. | 2 |
10,861,432 | 06/02/2012 10:07:23 | 25,459 | 10/06/2008 11:35:01 | 678 | 48 | How should i define something constantlike in Erlang | I have a module which does some non constrained minimization. I'd like to keep its' interface as simple as possible, so the best choice would be to reduce it to a single function something like: min_of( F ).
But as soon as it is brutal computation, i would have to deal with at least two constants: precision of minimization algorithm and maximum number of iterations, so it would not hang itself if target function doesn't have local minimum at all.
Anyways, the next best choice is: min_of( F, Iterations, Eps ). It's ok, but I don't like it. I would like to still have another min_of( F ) defined something like this:
min_of( F ) ->
min_of( F, 10000, 0.0001).
But without magic numbers.
I'm new to Erlang, so I don't know how to deal with this properly. Should i define a macros, a variable or maybe a function returning a constant? Or even something else? I found Erlang quite expressive, so this question seems to be more of a good practice, than technical question. | erlang | magic-numbers | null | null | null | null | open | How should i define something constantlike in Erlang
===
I have a module which does some non constrained minimization. I'd like to keep its' interface as simple as possible, so the best choice would be to reduce it to a single function something like: min_of( F ).
But as soon as it is brutal computation, i would have to deal with at least two constants: precision of minimization algorithm and maximum number of iterations, so it would not hang itself if target function doesn't have local minimum at all.
Anyways, the next best choice is: min_of( F, Iterations, Eps ). It's ok, but I don't like it. I would like to still have another min_of( F ) defined something like this:
min_of( F ) ->
min_of( F, 10000, 0.0001).
But without magic numbers.
I'm new to Erlang, so I don't know how to deal with this properly. Should i define a macros, a variable or maybe a function returning a constant? Or even something else? I found Erlang quite expressive, so this question seems to be more of a good practice, than technical question. | 0 |
9,867,718 | 03/26/2012 06:42:20 | 932,779 | 09/07/2011 13:14:35 | 9 | 0 | A good book for learning html5 | Which is a good book for learning html5. I am not just looking for basics. I want to learn about the topics in-depth at a time so that I don't have to come back again once i complete the basics. i am looking for something that is for both beginner and intermediate level programmer.
P.S. i am looking for something other than the HTML5 specifications and w3schools. | html5 | null | null | null | null | 03/26/2012 12:26:47 | not constructive | A good book for learning html5
===
Which is a good book for learning html5. I am not just looking for basics. I want to learn about the topics in-depth at a time so that I don't have to come back again once i complete the basics. i am looking for something that is for both beginner and intermediate level programmer.
P.S. i am looking for something other than the HTML5 specifications and w3schools. | 4 |
10,606,223 | 05/15/2012 17:55:17 | 744,184 | 05/08/2011 19:58:28 | 47 | 1 | How to use git as a distributed vcs with cms? | what is the best git workflow for web development team who use cms? Let me explain the situation.
In our last project we moved to git for version control.
First we tried distributed version control, where each member had each own git repo and pushed/pulled to a bare repo. However, since we used Drupal (*but Druapl not the only cms that does it*) we relied on modules. When creating a layout of a page Drupal(module) will generate it's own HTML, which is sent to DB.
SO the problem arisez when we push source code of the template to bare repo, the other developer can pull it but the changes of the db stay in the local db. At some point we gave up this style of workflow and started to work one a sigle server.
And on a next project we simply started to work on one server and tried to create as many templates as possible, so that those templates would over ride modules attempts to creste it's own HTML which would be sent to DB. **But my question is, did any of you have this problem and how did you solve it?**
This problem, it seems, to be specific to web development simply because of the DB.
I think this question is a generic one and not really specific to git or Druapl, it's more of a version-control-workflow with cms problem. | database | git | content-management-system | workflow | null | 06/15/2012 15:00:27 | off topic | How to use git as a distributed vcs with cms?
===
what is the best git workflow for web development team who use cms? Let me explain the situation.
In our last project we moved to git for version control.
First we tried distributed version control, where each member had each own git repo and pushed/pulled to a bare repo. However, since we used Drupal (*but Druapl not the only cms that does it*) we relied on modules. When creating a layout of a page Drupal(module) will generate it's own HTML, which is sent to DB.
SO the problem arisez when we push source code of the template to bare repo, the other developer can pull it but the changes of the db stay in the local db. At some point we gave up this style of workflow and started to work one a sigle server.
And on a next project we simply started to work on one server and tried to create as many templates as possible, so that those templates would over ride modules attempts to creste it's own HTML which would be sent to DB. **But my question is, did any of you have this problem and how did you solve it?**
This problem, it seems, to be specific to web development simply because of the DB.
I think this question is a generic one and not really specific to git or Druapl, it's more of a version-control-workflow with cms problem. | 2 |
6,108,785 | 05/24/2011 10:05:29 | 672,081 | 03/22/2011 22:26:37 | 36 | 2 | Php - echo MySql column names and values | What I need is to have a list name => value to be able to make MySql queries. My proble is, I can access MySql records, but I also need to access to the table column names, what should I change in my code?
Thanks
$query = "SELECT * FROM test_table";
$result = mysql_query($query) or die("Erro!: " . mysql_error());
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
if(is_array($row)) {
foreach ($row as $col => $val) {
echo $col." = ".$val."<br>";
}
}
} | php | null | null | null | null | null | open | Php - echo MySql column names and values
===
What I need is to have a list name => value to be able to make MySql queries. My proble is, I can access MySql records, but I also need to access to the table column names, what should I change in my code?
Thanks
$query = "SELECT * FROM test_table";
$result = mysql_query($query) or die("Erro!: " . mysql_error());
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
if(is_array($row)) {
foreach ($row as $col => $val) {
echo $col." = ".$val."<br>";
}
}
} | 0 |
9,625,553 | 03/08/2012 21:50:01 | 1,162,691 | 05/09/2011 21:46:19 | 409 | 4 | Can the iOS enterprise app development program be used to distribute apps to other companies but not via the app store? | If a company has an iOS app that it wants to distribute to its customers, but it doesn't want that app to be submitted to the app store and subject to the App Store submission criteria, then can it use the Enterprise app development program to do that? - or is the enterprise program strictly for app development and distribution within a company?
| ios | appstore | null | null | null | 03/08/2012 23:10:59 | off topic | Can the iOS enterprise app development program be used to distribute apps to other companies but not via the app store?
===
If a company has an iOS app that it wants to distribute to its customers, but it doesn't want that app to be submitted to the app store and subject to the App Store submission criteria, then can it use the Enterprise app development program to do that? - or is the enterprise program strictly for app development and distribution within a company?
| 2 |
7,381,531 | 09/11/2011 21:55:01 | 728,897 | 04/28/2011 08:42:27 | 21 | 1 | RoundCube Smtp Connection Failed | I'm trying to setup RoundCube on One.Com using their imap and smtp servers. Imap works just fine, I can login, fetch my mail, etc. The problem is, I can't send emails from it.. When I try to do so, it gives me this error: `SMTP Error (-1): Connection to server failed`. I've tried every single setting combination in the main.inc.php config file, but I keep getting the same error.. I've used these setting to setup an account in Thunderbird, and everything works just fine.. :s Really confused about all of this.. | smtp | roundcube | null | null | null | 11/20/2011 01:10:35 | off topic | RoundCube Smtp Connection Failed
===
I'm trying to setup RoundCube on One.Com using their imap and smtp servers. Imap works just fine, I can login, fetch my mail, etc. The problem is, I can't send emails from it.. When I try to do so, it gives me this error: `SMTP Error (-1): Connection to server failed`. I've tried every single setting combination in the main.inc.php config file, but I keep getting the same error.. I've used these setting to setup an account in Thunderbird, and everything works just fine.. :s Really confused about all of this.. | 2 |
2,165,657 | 01/29/2010 22:31:55 | 32,154 | 10/28/2008 18:38:10 | 845 | 30 | RoR: Mailing Lists? | Are there any gems or plugins out there that make managing mailing lists (just for updates and announcements; not marketing... ie, MailChimp is overkill) easy to administer?
Or is that just something that most Rails developers just build from scratch?
Just curious. | mailing-list | ruby-on-rails | null | null | null | null | open | RoR: Mailing Lists?
===
Are there any gems or plugins out there that make managing mailing lists (just for updates and announcements; not marketing... ie, MailChimp is overkill) easy to administer?
Or is that just something that most Rails developers just build from scratch?
Just curious. | 0 |
11,596,874 | 07/22/2012 00:26:46 | 1,418,562 | 05/26/2012 03:23:13 | 1 | 0 | check if user is signed in facebook on my blog | i'm looking for a ready made solution or something easy to implement on my site/blog, when a user is not logged in facebook, the like button says "login to like", what I want to do is not to put the like button on the page if the user is not logged in facebook, basicly,
1. check if user is logged in facebook
2. display like button if he is, hide it (or not run it entirely) if user is not,
This is possible right?
Best Regards | php | facebook | facebook-graph-api | facebook-like | null | null | open | check if user is signed in facebook on my blog
===
i'm looking for a ready made solution or something easy to implement on my site/blog, when a user is not logged in facebook, the like button says "login to like", what I want to do is not to put the like button on the page if the user is not logged in facebook, basicly,
1. check if user is logged in facebook
2. display like button if he is, hide it (or not run it entirely) if user is not,
This is possible right?
Best Regards | 0 |
7,393,049 | 09/12/2011 19:40:41 | 916,138 | 08/28/2011 05:13:27 | 6 | 0 | WPF Application and WPF Browser Application | I have Prepared a little Phonebook using WPF Application. Now I want to run this application using browser IE and Firefox and Chrome etc.
Update me ! How can I run this on different browser .
| c# | wpf | null | null | null | 09/20/2011 19:09:36 | not a real question | WPF Application and WPF Browser Application
===
I have Prepared a little Phonebook using WPF Application. Now I want to run this application using browser IE and Firefox and Chrome etc.
Update me ! How can I run this on different browser .
| 1 |
4,969,538 | 02/11/2011 13:29:03 | 46,768 | 12/16/2008 18:26:48 | 1,990 | 67 | Using OAuth to secure services that use SSO | This is a conceptual challenge that I'm trying to wrap my mind around. Let's say I have an SSO (single sign on) service and two separate web services that use it. Let's say that the SSO login happens via OAuth, just like Login with Facebook. (Correct me if I'm wrong that they're not just requesting an OAuth access token for the site in question.)
The question is then, how should the two web services expose their own APIs to third parties? Given that we've drunken the OAuth kool aid, it seems logical that the third parties should be considered OAuth consumers and they should request that the user approves an access token for them. Accepting that the question is, should the the web services handle all this OAuth stuff themselves, having the third parties register as OAuth consumers with them and only using the SSO to login the user? Or, should the web services hand all responsibility off to the SSO service? For signed requests, the web service would check the validity of the access token via the SSO's API and then process it as normal.
I see pluses and minuses to both approaches. On one hand, the first option places fewer demands on the SSO and each web service can handle the authorization for their APIs their own way. On the other hand, having the SSO handle things means that the third parties can get access tokens that are valid across all the services, just like how users can login across all of them. This can enable a better user interface, as otherwise the third party might have to keep asking the user for authorization as it needs to use different web services of the system, despite the separation between the different web services being invisible to the user. Of course, then either the SSO needs to have some sort of shared permission rules or each web service will still need to enforce its own rules. Also, the SSO would probably have to take some sort of text or HTML from the web services to display when asking the user to authorize the third party service.
Any suggestions? Are there any existing, publicly documented systems that do this well? Am I just over-complicating the whole thing? | api | authentication | oauth | authorization | sso | null | open | Using OAuth to secure services that use SSO
===
This is a conceptual challenge that I'm trying to wrap my mind around. Let's say I have an SSO (single sign on) service and two separate web services that use it. Let's say that the SSO login happens via OAuth, just like Login with Facebook. (Correct me if I'm wrong that they're not just requesting an OAuth access token for the site in question.)
The question is then, how should the two web services expose their own APIs to third parties? Given that we've drunken the OAuth kool aid, it seems logical that the third parties should be considered OAuth consumers and they should request that the user approves an access token for them. Accepting that the question is, should the the web services handle all this OAuth stuff themselves, having the third parties register as OAuth consumers with them and only using the SSO to login the user? Or, should the web services hand all responsibility off to the SSO service? For signed requests, the web service would check the validity of the access token via the SSO's API and then process it as normal.
I see pluses and minuses to both approaches. On one hand, the first option places fewer demands on the SSO and each web service can handle the authorization for their APIs their own way. On the other hand, having the SSO handle things means that the third parties can get access tokens that are valid across all the services, just like how users can login across all of them. This can enable a better user interface, as otherwise the third party might have to keep asking the user for authorization as it needs to use different web services of the system, despite the separation between the different web services being invisible to the user. Of course, then either the SSO needs to have some sort of shared permission rules or each web service will still need to enforce its own rules. Also, the SSO would probably have to take some sort of text or HTML from the web services to display when asking the user to authorize the third party service.
Any suggestions? Are there any existing, publicly documented systems that do this well? Am I just over-complicating the whole thing? | 0 |
8,594,887 | 12/21/2011 18:56:46 | 1,032,752 | 11/06/2011 20:40:22 | 15 | 0 | Escape PHP variable in sed command from Ruby script | I have a Ruby script that generates a sed command to replace some PHP code. The command is later executed via SSH.
`command = "sed -i \"s*#{find_what}*#{replace_with}*\" #{file} "`
The replace_with string will contain multiple lines of PHP code so the following escaping needs to take place:
command.gsub!(/\n/, '\\\n ') # Handle new-line escaping
command.gsub!(/&/, '\\\&') # Handle RegEx variable escaping
command.gsub!(/(\$[a-zA-Z0-9_]+)/) { |s| s.gsub!(/\$/, '\\$') } # Handle bash variable escaping
The command after escaping looks like this:
`sed -i "s*require_once('file.php');*\n require_once(\$www_dir . \$path . '/file.php');\n *" /var/www/something.php`
When executing this command manually everything works as expected. However if I execute the command via `Kernel.system` all the PHP variables are stripped out in the replacement string. Something.php ends up looking like this:
`require_once( . . '/file.php');`
Any ideas would be appreciated.
Thanks. | php | ruby | bash | sed | escaping | null | open | Escape PHP variable in sed command from Ruby script
===
I have a Ruby script that generates a sed command to replace some PHP code. The command is later executed via SSH.
`command = "sed -i \"s*#{find_what}*#{replace_with}*\" #{file} "`
The replace_with string will contain multiple lines of PHP code so the following escaping needs to take place:
command.gsub!(/\n/, '\\\n ') # Handle new-line escaping
command.gsub!(/&/, '\\\&') # Handle RegEx variable escaping
command.gsub!(/(\$[a-zA-Z0-9_]+)/) { |s| s.gsub!(/\$/, '\\$') } # Handle bash variable escaping
The command after escaping looks like this:
`sed -i "s*require_once('file.php');*\n require_once(\$www_dir . \$path . '/file.php');\n *" /var/www/something.php`
When executing this command manually everything works as expected. However if I execute the command via `Kernel.system` all the PHP variables are stripped out in the replacement string. Something.php ends up looking like this:
`require_once( . . '/file.php');`
Any ideas would be appreciated.
Thanks. | 0 |
11,391,080 | 07/09/2012 07:59:07 | 1,137,277 | 01/08/2012 16:22:16 | 10 | 0 | Using nokogiri to parse XML and create records with multiple attributes | Feels like I'm missing something pretty obvious here but can't see it.
I have an XML file and are using the Nokogiri gem.
The XML looks like this (imagine if you will an infinite amount of 'variants'):
<?xml version="1.0" encoding="UTF-8"?>
<products>
<variant>
<sku type="string">123abc</sku>
<inventory-quantity type="integer">68</inventory-quantity>
</variant>
<variant>
<sku type="string">321cba</sku>
<inventory-quantity type="integer">22</inventory-quantity>
</variant>
</products>
I want to loop over the variants and create a corresponding record for each that contains the 'sku' and 'inventory-quantity' attributes.
This is what I've got so far, but instead of creating individual records, in the above case it creates two records and inserts the complete array or NodeSet that Nokogiri returns into each records attribute. So this:
doc = Nokogiri::XML(File.open("#{Rails.root}/public/new.xml"))
variant = doc.xpath("//variant")
variant.each do |product|
sku = product.xpath("//sku").text
quan = product.xpath("//inventory-quantity").text
Productmapping.create(:sku => sku, :product_quantity => quan)
end
creates this...
sku inventory-quantity
123abc321cba 6822
123abc321cba 6822
Where I actually want:
sku inventory-quantity
123ab 68
321cba 22
It looks like it's because the xpath locator returns all occurrences into an array and I'm calling that array and inserting it for each record.
Thanks!
| ruby-on-rails | xml | activerecord | nokogiri | null | null | open | Using nokogiri to parse XML and create records with multiple attributes
===
Feels like I'm missing something pretty obvious here but can't see it.
I have an XML file and are using the Nokogiri gem.
The XML looks like this (imagine if you will an infinite amount of 'variants'):
<?xml version="1.0" encoding="UTF-8"?>
<products>
<variant>
<sku type="string">123abc</sku>
<inventory-quantity type="integer">68</inventory-quantity>
</variant>
<variant>
<sku type="string">321cba</sku>
<inventory-quantity type="integer">22</inventory-quantity>
</variant>
</products>
I want to loop over the variants and create a corresponding record for each that contains the 'sku' and 'inventory-quantity' attributes.
This is what I've got so far, but instead of creating individual records, in the above case it creates two records and inserts the complete array or NodeSet that Nokogiri returns into each records attribute. So this:
doc = Nokogiri::XML(File.open("#{Rails.root}/public/new.xml"))
variant = doc.xpath("//variant")
variant.each do |product|
sku = product.xpath("//sku").text
quan = product.xpath("//inventory-quantity").text
Productmapping.create(:sku => sku, :product_quantity => quan)
end
creates this...
sku inventory-quantity
123abc321cba 6822
123abc321cba 6822
Where I actually want:
sku inventory-quantity
123ab 68
321cba 22
It looks like it's because the xpath locator returns all occurrences into an array and I'm calling that array and inserting it for each record.
Thanks!
| 0 |
7,324,502 | 09/06/2011 18:34:56 | 936,651 | 08/17/2011 11:43:35 | 22 | 0 | GUID VS Auto Increment. (In comfortably wise) | A while a go, my sysadmin restored my database by mistake to a much earlier point.
Adter 3 hours we noticed this fact and during this time 80 new rows (**auto increment** with foreign keys dependency) was created.
So in this point we had 80 different customers with the same ids in two tables that needed to be merged.
I dont remember how but we got over this but it took a long time.
Now, I am designing a new database and my first conclusion is to use GUID even though this use case is rare.
My question:
How do you get along with such long string as your ID?
I mean, when 2 programmers are talking about a customer, it is possible to say:
*"Hey. We have a problem with client 874454".*
But how do you keep it as simple with GUID, This is really a problem that can cause some trouble and dis-communications.
Thanks
| database | guid | auto-increment | null | null | null | open | GUID VS Auto Increment. (In comfortably wise)
===
A while a go, my sysadmin restored my database by mistake to a much earlier point.
Adter 3 hours we noticed this fact and during this time 80 new rows (**auto increment** with foreign keys dependency) was created.
So in this point we had 80 different customers with the same ids in two tables that needed to be merged.
I dont remember how but we got over this but it took a long time.
Now, I am designing a new database and my first conclusion is to use GUID even though this use case is rare.
My question:
How do you get along with such long string as your ID?
I mean, when 2 programmers are talking about a customer, it is possible to say:
*"Hey. We have a problem with client 874454".*
But how do you keep it as simple with GUID, This is really a problem that can cause some trouble and dis-communications.
Thanks
| 0 |
11,178,703 | 06/24/2012 15:32:58 | 1,478,264 | 06/24/2012 15:28:43 | 1 | 0 | How to edit help->welcome menu to my own feature in eclipse | I want to edit the submenu welcome in help menu to a new feature in eclipse.But i can't find how to.I'm chinese,my english not good. Thanks first~~~ | eclipse | eclipse-plugin | eclipse-rcp | null | null | 06/25/2012 11:07:15 | not a real question | How to edit help->welcome menu to my own feature in eclipse
===
I want to edit the submenu welcome in help menu to a new feature in eclipse.But i can't find how to.I'm chinese,my english not good. Thanks first~~~ | 1 |
8,651,362 | 12/28/2011 02:53:30 | 988,631 | 10/11/2011 00:47:47 | 18 | 0 | Eclipse Debugging with Galaxy Nexus | I am not sure what I am doing wrong but when i setup my nexus to debug with eclipse I get a error in the console saying "[2011-12-27 21:48:31 - DeviceMonitor] Failed to start monitoring 0146BF5417006010" then i run adb devices through android platform-tools/adb.exe and my device shows up as "offline".
i Have tried the following
1. removed all drivers, re installed with device disconnected.
2. USB debugging is on.
3. re installed drives while device is connected
4. rolled back drivers in device manager.
on a side note i did have this working previously with my droid and droid 3
any help would be appreciated.
thanks
| android | eclipse | adb | adt | null | 01/03/2012 21:17:41 | too localized | Eclipse Debugging with Galaxy Nexus
===
I am not sure what I am doing wrong but when i setup my nexus to debug with eclipse I get a error in the console saying "[2011-12-27 21:48:31 - DeviceMonitor] Failed to start monitoring 0146BF5417006010" then i run adb devices through android platform-tools/adb.exe and my device shows up as "offline".
i Have tried the following
1. removed all drivers, re installed with device disconnected.
2. USB debugging is on.
3. re installed drives while device is connected
4. rolled back drivers in device manager.
on a side note i did have this working previously with my droid and droid 3
any help would be appreciated.
thanks
| 3 |
10,848,652 | 06/01/2012 10:29:20 | 1,425,709 | 05/30/2012 09:49:06 | 15 | 0 | What can be MySql query? | I have 3 tables as `'tbl_userinfo'` , `'tbl_game'` , `'tbl_streaks'`.
I want to get logged in player's existing games details as names of other oponents , their chips (points) ,their FacebookID , streaks beteween logged in player and his opopnents.
My tabls structures are as follow ;
tbl_UserInfo DATATYPE
UserID Integer(PRIMARY KEY)
UserName Text
FacebookID Text
EmailID Text
Facebook_EmailID Text
Password Text
Chips Integer
DeviceType Text
tbl_Game DATA TYPE
GameID Integer(PRIMARY KEY)
Type Text
Player1 Integer
Player2 Integer
Player3 Integer
Player4 Integer
Player5 Integer
Complete Text(YES OR NO)
tbl_Streaks DATA TYPE
ID Integer(PRIMARY KEY)
GameID Integer
Player1 Integer
Player2 Integer
Streaks Integer
Player1,Player2,Player3,Player4,Player5 are the players identified by `UserID`
How can i do this ?
I am very confused.
Please help me.
Thanks | asp.net | mysql | database | null | null | 06/04/2012 14:08:57 | not a real question | What can be MySql query?
===
I have 3 tables as `'tbl_userinfo'` , `'tbl_game'` , `'tbl_streaks'`.
I want to get logged in player's existing games details as names of other oponents , their chips (points) ,their FacebookID , streaks beteween logged in player and his opopnents.
My tabls structures are as follow ;
tbl_UserInfo DATATYPE
UserID Integer(PRIMARY KEY)
UserName Text
FacebookID Text
EmailID Text
Facebook_EmailID Text
Password Text
Chips Integer
DeviceType Text
tbl_Game DATA TYPE
GameID Integer(PRIMARY KEY)
Type Text
Player1 Integer
Player2 Integer
Player3 Integer
Player4 Integer
Player5 Integer
Complete Text(YES OR NO)
tbl_Streaks DATA TYPE
ID Integer(PRIMARY KEY)
GameID Integer
Player1 Integer
Player2 Integer
Streaks Integer
Player1,Player2,Player3,Player4,Player5 are the players identified by `UserID`
How can i do this ?
I am very confused.
Please help me.
Thanks | 1 |
9,189,886 | 02/08/2012 08:31:02 | 1,196,629 | 02/08/2012 08:15:30 | 1 | 0 | planning localization of ecommerce application? | We have developed CMS type ecommerce application using jquery and webservice in asp.net 3.5.Now we have planned to make it multilingual.What could be the best strategy for making it multilingual.We have mostly used html controls rather than server type controls. Thanks in advance. | localization | internationalization | globalization | null | null | 02/08/2012 20:28:36 | not a real question | planning localization of ecommerce application?
===
We have developed CMS type ecommerce application using jquery and webservice in asp.net 3.5.Now we have planned to make it multilingual.What could be the best strategy for making it multilingual.We have mostly used html controls rather than server type controls. Thanks in advance. | 1 |
11,172,374 | 06/23/2012 19:32:50 | 554,327 | 12/26/2010 14:44:17 | 375 | 5 | Big Nerd Ranch answer, am I declaring this initializer correctly? | The assignment in the Big Nerd Ranch Guide says:
Silver Challenge: Another initializer
Create another initializer method for BNRItem.
This initializer is not the designated initializer of BNRItem.
It takes an NSString that identifies the itemName of the item and an
NSString that identifies the serialNumber.
I'm not sure I've implemented it correctly. Is this correct?
BNRItem.h
- (id)initWithItemName:(NSString *)name
valueInDollars:(int)value
serialNumber:(NSString *)aNumber;
// I added this for new initializer
- (id)initWithItemName:(NSString *)name serialNumber:(NSString *)aNumber;
BNRItem.m
- (id)initWithItemName:(NSString *)name valueInDollars:(int)value serialNumber:(NSString *)aNumber
{
self = [super init];
if (self)
{
[self setItemName:name];
[self setSerialNumber:aNumber];
[self setValueInDollars:value];
dateCreated = [[NSDate alloc] init];
}
return self;
}
// Added the implementation for the new initializer
- (id) initWithItemName:(NSString *)name serialNumber:(NSString *)aNumber
{
return [self initWithItemName:name valueInDollars:0 serialNumber:aNumber];
} | objective-c | ios | null | null | null | 06/24/2012 17:07:15 | too localized | Big Nerd Ranch answer, am I declaring this initializer correctly?
===
The assignment in the Big Nerd Ranch Guide says:
Silver Challenge: Another initializer
Create another initializer method for BNRItem.
This initializer is not the designated initializer of BNRItem.
It takes an NSString that identifies the itemName of the item and an
NSString that identifies the serialNumber.
I'm not sure I've implemented it correctly. Is this correct?
BNRItem.h
- (id)initWithItemName:(NSString *)name
valueInDollars:(int)value
serialNumber:(NSString *)aNumber;
// I added this for new initializer
- (id)initWithItemName:(NSString *)name serialNumber:(NSString *)aNumber;
BNRItem.m
- (id)initWithItemName:(NSString *)name valueInDollars:(int)value serialNumber:(NSString *)aNumber
{
self = [super init];
if (self)
{
[self setItemName:name];
[self setSerialNumber:aNumber];
[self setValueInDollars:value];
dateCreated = [[NSDate alloc] init];
}
return self;
}
// Added the implementation for the new initializer
- (id) initWithItemName:(NSString *)name serialNumber:(NSString *)aNumber
{
return [self initWithItemName:name valueInDollars:0 serialNumber:aNumber];
} | 3 |
4,071,208 | 11/01/2010 17:05:49 | 457,827 | 09/24/2010 23:03:21 | 205 | 1 | PHP: working with checkboxes | I have a form, and inside it there's a while() with checkboxes.
I wish to have so when you mark and then press submit, the message will remove.
Now, I have the checkboxes, and the submit button and so. Now all my checkboxes are like this:
<input class="cbPick" name="cbPick" type="checkbox" value="<?php echo $id; ?>">
How can i work with that in PHP? Should i do, $_POST["cbPick"] to know if its marked or not ?
And when i have more with these, how can i know which is which? | php | null | null | null | null | null | open | PHP: working with checkboxes
===
I have a form, and inside it there's a while() with checkboxes.
I wish to have so when you mark and then press submit, the message will remove.
Now, I have the checkboxes, and the submit button and so. Now all my checkboxes are like this:
<input class="cbPick" name="cbPick" type="checkbox" value="<?php echo $id; ?>">
How can i work with that in PHP? Should i do, $_POST["cbPick"] to know if its marked or not ?
And when i have more with these, how can i know which is which? | 0 |
8,816,738 | 01/11/2012 09:15:04 | 278,279 | 02/21/2010 20:35:00 | 207 | 5 | Paypal recurring payment account type | I need to create recurring payment using paypal API (CreateRecurringPaymentsProfile operation), can I use it with [stanard][1] account, or only [pro][2] required?
[1]: https://merchant.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=merchant/wp_standard
[2]: https://www.paypal.com/webapps/mpp/website-payments-pro | paypal | paypal-api | null | null | null | 01/12/2012 14:57:27 | off topic | Paypal recurring payment account type
===
I need to create recurring payment using paypal API (CreateRecurringPaymentsProfile operation), can I use it with [stanard][1] account, or only [pro][2] required?
[1]: https://merchant.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=merchant/wp_standard
[2]: https://www.paypal.com/webapps/mpp/website-payments-pro | 2 |
5,341,101 | 03/17/2011 15:18:24 | 592,835 | 01/27/2011 20:18:39 | 476 | 55 | System.Addin tutorial / books to read | Now Im considering about writing application extension framework. I have already read through tons of questions about Managed Extensibility Framework and Managed AddIn Framework on SO and have understand that I need MAF. It is critical for me to isolate plugins in separate domains.
Also I found tons of simple examples on the internet about the subject.
But Im not intend to learn the subject briefly. I need strength knowldge. Does anybody know books in wich described System.Addin creation technics of may be "brilliant" articles on the subject. Please share information.
Thanks in advance
| c# | .net | plugins | tutorials | add-in | 09/30/2011 12:17:15 | not constructive | System.Addin tutorial / books to read
===
Now Im considering about writing application extension framework. I have already read through tons of questions about Managed Extensibility Framework and Managed AddIn Framework on SO and have understand that I need MAF. It is critical for me to isolate plugins in separate domains.
Also I found tons of simple examples on the internet about the subject.
But Im not intend to learn the subject briefly. I need strength knowldge. Does anybody know books in wich described System.Addin creation technics of may be "brilliant" articles on the subject. Please share information.
Thanks in advance
| 4 |
5,340,508 | 03/17/2011 14:35:17 | 340,251 | 05/13/2010 12:35:40 | 259 | 12 | Exclude namespace declaration from result of XSL transform | I'm generating an XML document in parts using various transforms. In particular, I'm generating a header which contains all of the namespace declarations and is then prepended to the document. However, the transform doesn't know about this and thus sticks on another declaration. This wouldn't usually be a problem, but millions of these things are generated and stored in a database, so having lots of redundant declarations floating about is rather annoying.
How do I turn off the generation of the namespace declarations? I've seen the `exclude-result-prefixes` attribute, but the documentation for this states that declarations for used namespaces will be added anyway, which seems to render the option pointless. | xslt | xslt-1.0 | xalan | null | null | null | open | Exclude namespace declaration from result of XSL transform
===
I'm generating an XML document in parts using various transforms. In particular, I'm generating a header which contains all of the namespace declarations and is then prepended to the document. However, the transform doesn't know about this and thus sticks on another declaration. This wouldn't usually be a problem, but millions of these things are generated and stored in a database, so having lots of redundant declarations floating about is rather annoying.
How do I turn off the generation of the namespace declarations? I've seen the `exclude-result-prefixes` attribute, but the documentation for this states that declarations for used namespaces will be added anyway, which seems to render the option pointless. | 0 |
9,959,066 | 03/31/2012 19:40:55 | 1,290,390 | 03/24/2012 18:55:24 | 1 | 0 | Sorting the wheat from the Chaff: CMS | OK, a bit about me - in terms of "modern" web design I'm a complete newbie. My own background is in database design. By "modern" I mean anything beyond those old HTML editors like FrontPage. That sad I'm on a mission to update and learn about content management systems and I'm determined to build a site to address an idea I've had. I have explored (played with) Wordpress, Tikiwiki CMS groupware, etc so I get the concept of these sorts of offerings. I'm looking for a CMS that is as close as possible out of the box, to the functionality I'm after. From you guys I'd just appreciate some pointers to further reading if nothing else - but any specific recommendations would be great.
The site I want to create is basically a community discussion forum about "things of interest". I have a particular kind of "thing" in mind but that doesn't matter, it could be about anything: cars, celebrities etc. The point is a user should be able to post (to a "wall") one or more photos as a group (slideshow) along with a description. Then other users should be able to post comments (in a discussion thread style) about that that post. I need close control over the workflow of a user's post submission in order to capture particular metadata about the post, importantly a set of location coordinates. Then comes the potentially trickier bit. The CMS must be able to present to the user a search facility to find posts based on the geo metadata and other text within posts and present the results in either a list view or a map view. I'll need all the usual user management & login stuff incl. third party authentication e.g. Facebook.
The existing website closest to what I need that I've found so far is www.rightmove.co.uk, note my "things of interest" are NOT properties / real estate. I've read elsewhere that site's development ran to six figures but surely there must be (I'm hoping) some CMS out there that can do the job on a small scale (a few thousand users) for FREE!
Any pointers very much appreciated. | content-management-system | discussion | geo | null | null | 04/06/2012 10:58:14 | not a real question | Sorting the wheat from the Chaff: CMS
===
OK, a bit about me - in terms of "modern" web design I'm a complete newbie. My own background is in database design. By "modern" I mean anything beyond those old HTML editors like FrontPage. That sad I'm on a mission to update and learn about content management systems and I'm determined to build a site to address an idea I've had. I have explored (played with) Wordpress, Tikiwiki CMS groupware, etc so I get the concept of these sorts of offerings. I'm looking for a CMS that is as close as possible out of the box, to the functionality I'm after. From you guys I'd just appreciate some pointers to further reading if nothing else - but any specific recommendations would be great.
The site I want to create is basically a community discussion forum about "things of interest". I have a particular kind of "thing" in mind but that doesn't matter, it could be about anything: cars, celebrities etc. The point is a user should be able to post (to a "wall") one or more photos as a group (slideshow) along with a description. Then other users should be able to post comments (in a discussion thread style) about that that post. I need close control over the workflow of a user's post submission in order to capture particular metadata about the post, importantly a set of location coordinates. Then comes the potentially trickier bit. The CMS must be able to present to the user a search facility to find posts based on the geo metadata and other text within posts and present the results in either a list view or a map view. I'll need all the usual user management & login stuff incl. third party authentication e.g. Facebook.
The existing website closest to what I need that I've found so far is www.rightmove.co.uk, note my "things of interest" are NOT properties / real estate. I've read elsewhere that site's development ran to six figures but surely there must be (I'm hoping) some CMS out there that can do the job on a small scale (a few thousand users) for FREE!
Any pointers very much appreciated. | 1 |
2,588,157 | 04/06/2010 20:42:44 | 218,914 | 11/25/2009 20:17:28 | 20 | 1 | Creating text file from as2 | I'm trying to find a way to write to a text file from as2. I don't want to use any php or asp because my app needs to run without an internet connection. As3 has FileReference.save() and judging by the amount of searching I've done, as2 doesn't have that simple of a solution. Does anyone have a way even if its hacky to write to a txt file from as2? | as2 | flash | text-files | scripting | null | null | open | Creating text file from as2
===
I'm trying to find a way to write to a text file from as2. I don't want to use any php or asp because my app needs to run without an internet connection. As3 has FileReference.save() and judging by the amount of searching I've done, as2 doesn't have that simple of a solution. Does anyone have a way even if its hacky to write to a txt file from as2? | 0 |
3,759,156 | 09/21/2010 09:58:15 | 277,275 | 02/19/2010 20:05:13 | 1 | 0 | Symfony framework voting system | Can someone give me some links to a maybe guide or to a symfony plugin, for voting system.
Thanks. | symfony | voting | null | null | null | null | open | Symfony framework voting system
===
Can someone give me some links to a maybe guide or to a symfony plugin, for voting system.
Thanks. | 0 |
10,007,834 | 04/04/2012 08:51:34 | 1,312,348 | 04/04/2012 08:44:17 | 1 | 0 | Android Media Recorder start failed exception | I am having problem with media recorder in android. I am recording an audio which works well with LG P500 but the same code is not working on Samsung GT - S5360. I am getting error as start failed -22.
When debugging got cause as null in logcat.
Please suggest me some solution. Thanks for your help. | android | null | null | null | null | null | open | Android Media Recorder start failed exception
===
I am having problem with media recorder in android. I am recording an audio which works well with LG P500 but the same code is not working on Samsung GT - S5360. I am getting error as start failed -22.
When debugging got cause as null in logcat.
Please suggest me some solution. Thanks for your help. | 0 |
5,809,906 | 04/27/2011 20:07:36 | 565,778 | 01/06/2011 17:13:45 | 6 | 0 | Which fork of jquery-compatible WMD is the fork to pay attention to? | There seems to be little organization or effort to lead a stable or most up-to-date version of the jquery-compatible version of wmd.
https://github.com/openlibrary/wmd/network
The latest version of openlibrary branch is almost a year old and has several bugs and odd experiences for automated input.
There are many forks of openlibrary branch, but none of them seem to be a kind of fork meant for general public.
Is there something better than jquery wmd perhaps or is there a fork that is recommended to use? | jquery | wmd | wmd-editor | wmd-markdown | null | null | open | Which fork of jquery-compatible WMD is the fork to pay attention to?
===
There seems to be little organization or effort to lead a stable or most up-to-date version of the jquery-compatible version of wmd.
https://github.com/openlibrary/wmd/network
The latest version of openlibrary branch is almost a year old and has several bugs and odd experiences for automated input.
There are many forks of openlibrary branch, but none of them seem to be a kind of fork meant for general public.
Is there something better than jquery wmd perhaps or is there a fork that is recommended to use? | 0 |
3,107,326 | 06/24/2010 04:56:39 | 374,889 | 06/24/2010 04:56:39 | 1 | 0 | Detecting if the window is a key window in cocoa | I am making a application that the user will have to interact with one window and when they have that window configured the way they want it they switch to a different application then my application will begin to do other stuff which i will have defined in a method
say for an example program when the main window has focus it contains a label that says "i am focused" and when the person clicks on the desktop or another window/application then the label will read "i am not focused".
Thanks | cocoa | nswindow | null | null | null | null | open | Detecting if the window is a key window in cocoa
===
I am making a application that the user will have to interact with one window and when they have that window configured the way they want it they switch to a different application then my application will begin to do other stuff which i will have defined in a method
say for an example program when the main window has focus it contains a label that says "i am focused" and when the person clicks on the desktop or another window/application then the label will read "i am not focused".
Thanks | 0 |
6,499,755 | 06/27/2011 22:36:54 | 698,200 | 04/08/2011 07:46:50 | 17 | 1 | How do I make image view disappear from screen | I want to make image view disappear from screen.
I don't want to release it.
How can I do that?
| iphone | null | null | null | null | null | open | How do I make image view disappear from screen
===
I want to make image view disappear from screen.
I don't want to release it.
How can I do that?
| 0 |
9,308,486 | 02/16/2012 09:20:51 | 1,184,885 | 02/02/2012 10:51:36 | 1 | 0 | Questions on Magento mobile | 1. The mobile app must be invoking web services exposed by the server. Do the web service make use of the caching of collections, EAV structure, etc. as done by the Magento storefront?
2. Can I test the app locally on a simulator of a Samsung Galaxy tab?
3. Do I get the source code of the mobile app for free?
4. If I create an app in the designer, can I test it on an Android tablet emulator without publishing?
Thanks,
Yash | magento | mobile | e-commerce | null | null | 02/23/2012 17:23:39 | not a real question | Questions on Magento mobile
===
1. The mobile app must be invoking web services exposed by the server. Do the web service make use of the caching of collections, EAV structure, etc. as done by the Magento storefront?
2. Can I test the app locally on a simulator of a Samsung Galaxy tab?
3. Do I get the source code of the mobile app for free?
4. If I create an app in the designer, can I test it on an Android tablet emulator without publishing?
Thanks,
Yash | 1 |
4,402,900 | 12/09/2010 20:40:49 | 497,470 | 11/04/2010 17:11:04 | 400 | 23 | trouble turning this into a stored procedure | Declare @YearToGet int
Set @YearToGet = 2008
;With RawData As
(
Select 39503 As Booked
Union All Select 39509
Union All Select 39535
Union All Select 39620
Union All Select 39791
Union All Select 39838
Union All Select 39899
Union All Select 39134
Union All Select 39139
Union All Select 39139
Union All Select 39140
Union All Select 39146
Union All Select 39146
Union All Select 39146
)
, Numbers As
(
Select 0 As Value, Year(GetDate()) As [Year]
, Cast( DateDiff(d,0,GetDate()) as datetime ) As [Date]
, DateDiff(d,0,GetDate()) As [DateInt]
Union All
Select Value + 1, [Year] - 1
, DateAdd(yyyy, -1, [Date])
, DateDiff(d, 0, DateAdd(yyyy, -1, [Date]))
From Numbers
Where Value <= ( Year(GetDate()) - @YearToGet )
)
Select DIVISION, SDESCR, DYYYY
, SUM(APRICE) AS Sales
, SUM(PARTY) AS PAX
, SUM(NetAmount) AS NetSales
, SUM(InsAmount) AS InsSales
, SUM(CancelRevenue) AS CXSales
, SUM(OtherAmount) AS OtherSales
, SUM(CXVALUE) AS CXValue
From dbo.B101BookingsDetails As BD
Join Numbers As N
On Cast(N.[Year] As char(4)) = BD.DYYYY
Where BD.Booked = N.DateInt - 2
Group By DIVISION, SDESCR, DYYYY | sql | sql-server-2005 | null | null | null | 12/10/2010 03:38:47 | not a real question | trouble turning this into a stored procedure
===
Declare @YearToGet int
Set @YearToGet = 2008
;With RawData As
(
Select 39503 As Booked
Union All Select 39509
Union All Select 39535
Union All Select 39620
Union All Select 39791
Union All Select 39838
Union All Select 39899
Union All Select 39134
Union All Select 39139
Union All Select 39139
Union All Select 39140
Union All Select 39146
Union All Select 39146
Union All Select 39146
)
, Numbers As
(
Select 0 As Value, Year(GetDate()) As [Year]
, Cast( DateDiff(d,0,GetDate()) as datetime ) As [Date]
, DateDiff(d,0,GetDate()) As [DateInt]
Union All
Select Value + 1, [Year] - 1
, DateAdd(yyyy, -1, [Date])
, DateDiff(d, 0, DateAdd(yyyy, -1, [Date]))
From Numbers
Where Value <= ( Year(GetDate()) - @YearToGet )
)
Select DIVISION, SDESCR, DYYYY
, SUM(APRICE) AS Sales
, SUM(PARTY) AS PAX
, SUM(NetAmount) AS NetSales
, SUM(InsAmount) AS InsSales
, SUM(CancelRevenue) AS CXSales
, SUM(OtherAmount) AS OtherSales
, SUM(CXVALUE) AS CXValue
From dbo.B101BookingsDetails As BD
Join Numbers As N
On Cast(N.[Year] As char(4)) = BD.DYYYY
Where BD.Booked = N.DateInt - 2
Group By DIVISION, SDESCR, DYYYY | 1 |
37,133 | 08/31/2008 21:34:19 | 3,631 | 08/29/2008 16:06:08 | 91 | 10 | "Programming" for a 9 year old | I am looking for recommendations on a web site/software for providing an introduction to programming concepts for my 9 year old.
I remember using Logo/turtle graphics at a similar age and would love a simple self-contained web site that gave a number of step-by-step tutorials. There is some neat current generation Logo software out there, but the packages I looked at seemed more complex that I wanted for an absolute beginner.
Any experiences that have worked well? | children | null | null | null | null | 03/08/2012 23:07:44 | not constructive | "Programming" for a 9 year old
===
I am looking for recommendations on a web site/software for providing an introduction to programming concepts for my 9 year old.
I remember using Logo/turtle graphics at a similar age and would love a simple self-contained web site that gave a number of step-by-step tutorials. There is some neat current generation Logo software out there, but the packages I looked at seemed more complex that I wanted for an absolute beginner.
Any experiences that have worked well? | 4 |
2,042,773 | 01/11/2010 15:31:20 | 209,437 | 11/12/2009 09:27:49 | 11 | 1 | Make an SQL request more efficient and tidy? | I have the following SQL query:
SELECT Phrases.*
FROM Phrases
WHERE (((Phrases.phrase) Like "*ing aids*") AND ((Phrases.phrase) Not Like "*getting*") AND ((Phrases.phrase) Not Like "*contracting*")) AND ((Phrases.phrase) Not Like "*preventing*"); //(etc.)
Now, if I were using RegEx, I might bunch all the Nots into one big (getting|contracting|preventing), but I'm not sure how to do this in SQL.
Is there a way to render this query more legibly/elegantly? | sql | query | database | null | null | null | open | Make an SQL request more efficient and tidy?
===
I have the following SQL query:
SELECT Phrases.*
FROM Phrases
WHERE (((Phrases.phrase) Like "*ing aids*") AND ((Phrases.phrase) Not Like "*getting*") AND ((Phrases.phrase) Not Like "*contracting*")) AND ((Phrases.phrase) Not Like "*preventing*"); //(etc.)
Now, if I were using RegEx, I might bunch all the Nots into one big (getting|contracting|preventing), but I'm not sure how to do this in SQL.
Is there a way to render this query more legibly/elegantly? | 0 |
6,038,974 | 05/18/2011 01:35:23 | 84,201 | 03/29/2009 07:46:24 | 8,308 | 156 | What is the means of the term "One Web"? | What is the means of the term "One Web"?
Is it means to use same HTML code for all devices; PC, Tablets, Smartphones, Feature Phones?
If I'm right then will the whole code not heavy for all, for example all code which is only for Desktop will be loaded on mobile site too. which will decrease the performance of website on all platforms?
And even if we use Media queries it will not be optimize way because browsers will download every linked files to the page.
**Exception**
> Opera only downloads media assets
> inside the media query that is needed.
> Other mobile browsers do not work like
> this.
http://www.lukew.com/ff/entry.asp?1325 | css | performance | xhtml | mobile-web | w3c | 05/20/2011 13:58:47 | off topic | What is the means of the term "One Web"?
===
What is the means of the term "One Web"?
Is it means to use same HTML code for all devices; PC, Tablets, Smartphones, Feature Phones?
If I'm right then will the whole code not heavy for all, for example all code which is only for Desktop will be loaded on mobile site too. which will decrease the performance of website on all platforms?
And even if we use Media queries it will not be optimize way because browsers will download every linked files to the page.
**Exception**
> Opera only downloads media assets
> inside the media query that is needed.
> Other mobile browsers do not work like
> this.
http://www.lukew.com/ff/entry.asp?1325 | 2 |
11,190,178 | 06/25/2012 13:20:04 | 1,083,777 | 12/06/2011 15:18:25 | 179 | 8 | There is already an object named 'Applications' in the database | I got this error in my asp.net webapi service when I call method `Membership.ValidateUser(email, password);`.
I am using EF 4.3.1. DB created using this code
using (var db = DbFactory.Get())
{
Console.WriteLine("Creating new database...");
db.Database.Create();
Console.WriteLine("Initializing with initial objects...");
db.Database.Initialize(true);
}
I get this error only once on first start of my service.
Does anybody know why it happens?
| asp.net | sql-server-2008 | entity-framework | asp.net-mvc-4 | asp.net-web-api | null | open | There is already an object named 'Applications' in the database
===
I got this error in my asp.net webapi service when I call method `Membership.ValidateUser(email, password);`.
I am using EF 4.3.1. DB created using this code
using (var db = DbFactory.Get())
{
Console.WriteLine("Creating new database...");
db.Database.Create();
Console.WriteLine("Initializing with initial objects...");
db.Database.Initialize(true);
}
I get this error only once on first start of my service.
Does anybody know why it happens?
| 0 |
10,397,462 | 05/01/2012 12:10:21 | 1,307,238 | 04/02/2012 04:51:18 | 7 | 1 | How can i create multiple div tags in c#? | How can i create multiple div tags dynamically ? I am using place holder inside a repeater .
How can i do this in c#.net | c# | null | null | null | null | 05/01/2012 12:53:01 | not a real question | How can i create multiple div tags in c#?
===
How can i create multiple div tags dynamically ? I am using place holder inside a repeater .
How can i do this in c#.net | 1 |
5,567,800 | 04/06/2011 14:14:33 | 690,975 | 04/04/2011 11:15:30 | 6 | 0 | jquery event.preventdefault problem |
my event.preventdefault is not working actually i want when user click the add button it will ask to "enter the field first" if all the field are blank.for this i use the flag like this to prevent the data saved if all fields are blank as below: (also when i click the button it shows enter the field and after that it will go to ajax function even i applied event.preventdefault(); dnt knw exactly where im wrong )
thanx in advance.
here is my code:
<tr><td><button type="button" name="add">Add</button></td></tr> //this is my add button
$("#tabs").tabs();
$("button").button();
$("button").click(function(event) {
var flagg=0;
if( $("#patient_name").val() == "" )
{
flagg=1;
}
if(flagg == 1)
{
alert("enter the patient name!!");
event.preventDefault();
}
form_name = $(this).parents("form").attr('name');
var params = $("#" + form_name).serialize();
params=params.replace(/&/g,'~^~^^');
table_name = "patient_info";
button_name = "temp";
$.ajax({
type: "POST",
url: "ajax1.php",
data: "params=" + params + "&button_name=" + button_name,
success: function(msg){
//alert(msg);
if (msg == "true")
{
alert("Patient data sucessfully saved!");
window.location.replace("ivf2.php?id=" + $("#id").val());
}
else
{
//alert("Failed to save, please check and try again!");
}
}
});
});
| jquery | null | null | null | null | null | open | jquery event.preventdefault problem
===
my event.preventdefault is not working actually i want when user click the add button it will ask to "enter the field first" if all the field are blank.for this i use the flag like this to prevent the data saved if all fields are blank as below: (also when i click the button it shows enter the field and after that it will go to ajax function even i applied event.preventdefault(); dnt knw exactly where im wrong )
thanx in advance.
here is my code:
<tr><td><button type="button" name="add">Add</button></td></tr> //this is my add button
$("#tabs").tabs();
$("button").button();
$("button").click(function(event) {
var flagg=0;
if( $("#patient_name").val() == "" )
{
flagg=1;
}
if(flagg == 1)
{
alert("enter the patient name!!");
event.preventDefault();
}
form_name = $(this).parents("form").attr('name');
var params = $("#" + form_name).serialize();
params=params.replace(/&/g,'~^~^^');
table_name = "patient_info";
button_name = "temp";
$.ajax({
type: "POST",
url: "ajax1.php",
data: "params=" + params + "&button_name=" + button_name,
success: function(msg){
//alert(msg);
if (msg == "true")
{
alert("Patient data sucessfully saved!");
window.location.replace("ivf2.php?id=" + $("#id").val());
}
else
{
//alert("Failed to save, please check and try again!");
}
}
});
});
| 0 |
1,529,561 | 10/07/2009 05:01:01 | 83,446 | 03/27/2009 03:06:40 | 293 | 24 | Ruby Maths Function Memoization | I wrote some code that looks like this:
def get(x, y)
@cachedResults.set(x,y, Math.hypot(x, y)) if @cachedResults.get(x,y).nil?
@cachedResults.get(x,y)
end
Where @cachedResults contained a 2D Array class i wrote (in a few minutes) and the purpose of this function is to make sure that I never have to call Math.hypot twice for any given (x,y). [This could be optimised further using symmetry and other things but whatever]
So I called the function and let it run 160000 times; it ran in just over 15 seconds. Then, to see how much faster it was than the non Memoized version, i changed the code to this:
def get(x, y)
Math.hypot(x, y)
end
And, much to my surprise, it took just over 15 seconds to run again. The exact same time. So my question is, are the maths functions in ruby naturally Memoized? And, if so, to what extent is ruby Memoized?
(If not then why do you think I am getting this result consistently?) | ruby | memoization | math | function | null | null | open | Ruby Maths Function Memoization
===
I wrote some code that looks like this:
def get(x, y)
@cachedResults.set(x,y, Math.hypot(x, y)) if @cachedResults.get(x,y).nil?
@cachedResults.get(x,y)
end
Where @cachedResults contained a 2D Array class i wrote (in a few minutes) and the purpose of this function is to make sure that I never have to call Math.hypot twice for any given (x,y). [This could be optimised further using symmetry and other things but whatever]
So I called the function and let it run 160000 times; it ran in just over 15 seconds. Then, to see how much faster it was than the non Memoized version, i changed the code to this:
def get(x, y)
Math.hypot(x, y)
end
And, much to my surprise, it took just over 15 seconds to run again. The exact same time. So my question is, are the maths functions in ruby naturally Memoized? And, if so, to what extent is ruby Memoized?
(If not then why do you think I am getting this result consistently?) | 0 |
9,417,959 | 02/23/2012 17:23:38 | 1,007,712 | 10/21/2011 19:07:03 | 52 | 2 | Just need some suggestions on improving java | I have been coding in java for a while now .... i want to continue in java and improve my coding abilities. I want some suggestions on -
1. any websites, blogs, to keep track of latest happenings in java like new coding techniques, standards, new java features, new APIs, basically anything new about java ..... (just for example sake Androidpolice keeps track all that is happening in android)
2. I have used a couple of classes from google guava libraries. are there any other such libraries which are helpful ?
Any suggestions are appreciated. Just wanna improve my java knowledge
Thanks
| java | language-learning | null | null | null | 02/24/2012 14:27:27 | off topic | Just need some suggestions on improving java
===
I have been coding in java for a while now .... i want to continue in java and improve my coding abilities. I want some suggestions on -
1. any websites, blogs, to keep track of latest happenings in java like new coding techniques, standards, new java features, new APIs, basically anything new about java ..... (just for example sake Androidpolice keeps track all that is happening in android)
2. I have used a couple of classes from google guava libraries. are there any other such libraries which are helpful ?
Any suggestions are appreciated. Just wanna improve my java knowledge
Thanks
| 2 |
3,325,544 | 07/24/2010 14:56:19 | 153,893 | 08/10/2009 18:13:36 | 96 | 3 | facebook like page | I am trying to create a business "Like" page for my website something similar to [http://www.facebook.com/Cricinfo][1]
[http://www.facebook.com/google][2]
Please let me know.
[1]: http://www.facebook.com/Cricinfo
[2]: http://www.facebook.com/google | facebook | facebook-like | null | null | null | 07/24/2010 16:47:50 | not a real question | facebook like page
===
I am trying to create a business "Like" page for my website something similar to [http://www.facebook.com/Cricinfo][1]
[http://www.facebook.com/google][2]
Please let me know.
[1]: http://www.facebook.com/Cricinfo
[2]: http://www.facebook.com/google | 1 |
8,081,207 | 11/10/2011 14:39:55 | 27,754 | 10/14/2008 07:32:17 | 121 | 15 | jqplot - Stacked, Multiple Series | I'm using jqplot and specifically the examples from http://www.jqplot.com/tests/bar-charts.php to see if it can be used to show some data I have.
The first example chart in the link above show 3 bars for the month of May, and the last one shows a stacked bar. I'm wanting to combine these two ideas so that, for example, in May each of the 3 bars would be stacked with different values.
Does that make sense and any ideas on how I could go about doing it?
Thanks
Mark | jquery | jqplot | bar-chart | null | null | null | open | jqplot - Stacked, Multiple Series
===
I'm using jqplot and specifically the examples from http://www.jqplot.com/tests/bar-charts.php to see if it can be used to show some data I have.
The first example chart in the link above show 3 bars for the month of May, and the last one shows a stacked bar. I'm wanting to combine these two ideas so that, for example, in May each of the 3 bars would be stacked with different values.
Does that make sense and any ideas on how I could go about doing it?
Thanks
Mark | 0 |
9,752,682 | 03/17/2012 18:35:08 | 1,036,606 | 11/08/2011 22:47:31 | 67 | 2 | Creating a secure configuration file that contains passwords | I am developing an application that works with PostgreSQL and other database features that require a username and password to login to the remote server to store the data. The user has to be able to set the username and password which would then be stored in a configuration file on disk. The problem is that anybody can open the configuration file and read the credentials creating a serious security problem.
I have done some research on encrypting the whole configuration file and then de-crypting it when needed, but the problem is that a hacker could put the program though a debugger and easily find out the decryption key. What is the best method to keep configuration data secret on Windows using C/C++? | c++ | encryption | configuration | null | null | null | open | Creating a secure configuration file that contains passwords
===
I am developing an application that works with PostgreSQL and other database features that require a username and password to login to the remote server to store the data. The user has to be able to set the username and password which would then be stored in a configuration file on disk. The problem is that anybody can open the configuration file and read the credentials creating a serious security problem.
I have done some research on encrypting the whole configuration file and then de-crypting it when needed, but the problem is that a hacker could put the program though a debugger and easily find out the decryption key. What is the best method to keep configuration data secret on Windows using C/C++? | 0 |
10,468,291 | 05/06/2012 05:11:42 | 1,316,405 | 04/05/2012 22:23:24 | 49 | 1 | simplest way to make div fadeOut | It's probably because I haven't been getting enought sleep, but I just can't figure this out. I'm trying to make a page where you have multiple videos, and then there's a div on top that appears suddenly and fades as the video is loading, all of this onClick. I had it earlier today, but now it's not waorking. The part of the function is
$('#hh').animate({
opacity: 1
}, 0, function() {
myVideo.src = videos[numb];
myVideo.load();
myVideo.play();
$('#hh').animate({
'opacity': '0'
}, 200);
});
});
so, why isn't this working? | jquery | function | div | slider | fadeout | null | open | simplest way to make div fadeOut
===
It's probably because I haven't been getting enought sleep, but I just can't figure this out. I'm trying to make a page where you have multiple videos, and then there's a div on top that appears suddenly and fades as the video is loading, all of this onClick. I had it earlier today, but now it's not waorking. The part of the function is
$('#hh').animate({
opacity: 1
}, 0, function() {
myVideo.src = videos[numb];
myVideo.load();
myVideo.play();
$('#hh').animate({
'opacity': '0'
}, 200);
});
});
so, why isn't this working? | 0 |
320,611 | 11/26/2008 12:55:33 | 29,746 | 10/20/2008 19:55:27 | 485 | 86 | How many developers would use LGPL library code in their own projects? | I know many developers won't even touch LGPL but only use MIT or New BSD licensed libraries. But exactly HOW many?
I would use LGPL in my own projects, am I "alone" or "close to alone"...?
The platform I am most interested in knowing about it .Net developers...
As in; "How many percent of the world's .Net developers would use an LGPL licensed library"...? | open-source | lgpl | null | null | null | null | open | How many developers would use LGPL library code in their own projects?
===
I know many developers won't even touch LGPL but only use MIT or New BSD licensed libraries. But exactly HOW many?
I would use LGPL in my own projects, am I "alone" or "close to alone"...?
The platform I am most interested in knowing about it .Net developers...
As in; "How many percent of the world's .Net developers would use an LGPL licensed library"...? | 0 |
7,160,450 | 08/23/2011 11:40:21 | 118,584 | 06/06/2009 16:11:16 | 1,180 | 32 | Linq query on ISet collection | I have a Customer with a list of Contacts. This list is an ISet collection. I can't do a Linq wuery on it. Could you help me for this ?
Thanks,
public class Customer
{
public virtual Iesi.Collections.Generic.ISet<Contact> Contacts { get; set; }
}
Customer customer = session.Get(id);
customer.Contacts = // Error - customer.Contacts.Where(x => x.Id != contactId);
| linq | nhibernate | null | null | null | null | open | Linq query on ISet collection
===
I have a Customer with a list of Contacts. This list is an ISet collection. I can't do a Linq wuery on it. Could you help me for this ?
Thanks,
public class Customer
{
public virtual Iesi.Collections.Generic.ISet<Contact> Contacts { get; set; }
}
Customer customer = session.Get(id);
customer.Contacts = // Error - customer.Contacts.Where(x => x.Id != contactId);
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.