Ternary operator in C – stackoverflow.com
Why this program is giving unexpected numbers(ex: 2040866504, -786655336)?
#include <stdio.h> int main() { int test = 0; float fvalue = 3.111f;
printf("%d", test? fvalue : 0); …
Monday, 30 September 2013
A function on binary relations
A function on binary relations
Let $\rho$ is a function mapping every binary relation $f$ (on some set
$U$) into a function which maps binary relations into binary relations by
the formula
$$(\rho(f))(g) = f\circ g.$$
Is $\rho$:
upper adjoint in a Galois connection?
lower adjoint in a Galois connection?
meet-semilattice homomorphisms?
join-semilattice homomorphisms?
(The order assumed is the set-theoretic inclusion of binary relations.)
If it has adjoints, what these adjoints are?
Let $\rho$ is a function mapping every binary relation $f$ (on some set
$U$) into a function which maps binary relations into binary relations by
the formula
$$(\rho(f))(g) = f\circ g.$$
Is $\rho$:
upper adjoint in a Galois connection?
lower adjoint in a Galois connection?
meet-semilattice homomorphisms?
join-semilattice homomorphisms?
(The order assumed is the set-theoretic inclusion of binary relations.)
If it has adjoints, what these adjoints are?
Hadoop and Python: View Error
Hadoop and Python: View Error
I'm using Hadoop streaming to run some Python code. I have noticed that if
there is an error in my Python code (in mapper.py, for example), I won't
be notified about the error. Instead, the mapper program will fail to run,
and the job will be killed after a few seconds. Viewing the logs, the only
error I see is that mapper.py failed to run or was not found, which is
clearly not the case.
My question is, is there a specific log file I can check to see actual
errors that may exist in the mapper.py code? (For example, would tell me
if an import command failed)
Thank you!
I'm using Hadoop streaming to run some Python code. I have noticed that if
there is an error in my Python code (in mapper.py, for example), I won't
be notified about the error. Instead, the mapper program will fail to run,
and the job will be killed after a few seconds. Viewing the logs, the only
error I see is that mapper.py failed to run or was not found, which is
clearly not the case.
My question is, is there a specific log file I can check to see actual
errors that may exist in the mapper.py code? (For example, would tell me
if an import command failed)
Thank you!
adding new rows to table on clicking button in jquery
adding new rows to table on clicking button in jquery
I am pretty new to jquery..i have the following code. here i wants to get
new rows in the table on clicking add button.. but i cant get it.,
can someone tell me what mistake i ve done here?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Adding Next Rows </title>
<link rel="stylesheet" href="resources/css/jquery.ui.all.css">
<script src="resources/scripts/jquery.ui.effect.js"></script>
<script src="resources/scripts/jquery.ui.effect-explode.js"></script>
<style>
h3
{
color:#0000FF;
display:inline-block;
}
.pdzn_tbl1 th
{
background:#DFDFDF;
border:#D6D6D6 1px solid;
}
.pdzn_tbl1 td
{
border-right:#729111 1px solid;
border-bottom:#729111 1px solid;
padding-top: 5px;
}
</style>
</head>
<body>
<h3> Adding Next Rows </h3>
<script type="text/javascript">
function ajax()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert("Your browser does not support XMLHTTP!");
return;
}
}
var $ = jQuery.noConflict();
$("#addrows").click(function () {
if(document.getElementById("hiddenprice").value == "") {
imagecounter = 4;
} else {
imagecounter =
parseFloat(document.getElementById("hiddenprice").value) + 1;
}
//imagecounter=4;
var newImageDiv = $(document.createElement('div'))
.attr("id", 'add_div' + imagecounter);
/*onchange="return
fn_productname(this.value,\'prdname'+imagecounter+'\')"*/
newImageDiv.after().html('<table width="100%" cellpadding="0"
cellspacing="0" class="pdzn_tbl1" border="0">'+
'<tr>'+
'<td style="padding:5px;" >'+'<input type="text"
name="rollno<? $i ?>" />' + '</td>' + '<td
style="padding:5px;">'+ '<input type="text"
name="firstname<? $i ?>" />'+'</td>'+'<td
style="padding:5px;">'+'<input type="text"
name="lastname<? $i ?>"
/>'+'</td>'+'</tr>'+'</table>');
newImageDiv.appendTo("#addgroup");
$("tr:last").after(newImageDiv);
document.getElementById("hiddenprice").value = imagecounter;
imagecounter++;
});
</script>
<div class="common" style="width:1040px; -overflow-x:scroll; padding: 5px
5px 0 5px;">
<table id="maintable" width="50%" cellpadding="0" cellspacing="0"
class="pdzn_tbl1" border="#729111 1px solid" >
<tr> <th align="center"> Roll No </th>
<th align="center"> First Name </th>
<th align="center"> Last Name </th>
</tr>
<?php
$t_row=3;
for($i=1;$i<=$t_row;$i++)
{
?>
<tr id="rows">
<div style="padding-left: 5px">
<td style="padding:5px;" > <input type="text" name="rollno<? $i ?>" /> </td>
<td style="padding:5px;"> <input type="text" name="firstname<? $i ?>" />
</td>
<td style="padding:5px;"> <input type="text" name="lastname<? $i ?>" /> </td>
</tr>
</div>
<? } ?>
<div id="addgroup">
<div id="add_div1"> </div>
</div> <table>
<br />
<input type="button" name="add" value="+Add" id="addrows"
style="color:#3300FF; font-size:16px; " />
<input type="hidden" id="hiddenprice" name="hiddenprice"
value="3"/> </table>
</div>
</body>
</html>
thanks in advance..!!!!
I am pretty new to jquery..i have the following code. here i wants to get
new rows in the table on clicking add button.. but i cant get it.,
can someone tell me what mistake i ve done here?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Adding Next Rows </title>
<link rel="stylesheet" href="resources/css/jquery.ui.all.css">
<script src="resources/scripts/jquery.ui.effect.js"></script>
<script src="resources/scripts/jquery.ui.effect-explode.js"></script>
<style>
h3
{
color:#0000FF;
display:inline-block;
}
.pdzn_tbl1 th
{
background:#DFDFDF;
border:#D6D6D6 1px solid;
}
.pdzn_tbl1 td
{
border-right:#729111 1px solid;
border-bottom:#729111 1px solid;
padding-top: 5px;
}
</style>
</head>
<body>
<h3> Adding Next Rows </h3>
<script type="text/javascript">
function ajax()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert("Your browser does not support XMLHTTP!");
return;
}
}
var $ = jQuery.noConflict();
$("#addrows").click(function () {
if(document.getElementById("hiddenprice").value == "") {
imagecounter = 4;
} else {
imagecounter =
parseFloat(document.getElementById("hiddenprice").value) + 1;
}
//imagecounter=4;
var newImageDiv = $(document.createElement('div'))
.attr("id", 'add_div' + imagecounter);
/*onchange="return
fn_productname(this.value,\'prdname'+imagecounter+'\')"*/
newImageDiv.after().html('<table width="100%" cellpadding="0"
cellspacing="0" class="pdzn_tbl1" border="0">'+
'<tr>'+
'<td style="padding:5px;" >'+'<input type="text"
name="rollno<? $i ?>" />' + '</td>' + '<td
style="padding:5px;">'+ '<input type="text"
name="firstname<? $i ?>" />'+'</td>'+'<td
style="padding:5px;">'+'<input type="text"
name="lastname<? $i ?>"
/>'+'</td>'+'</tr>'+'</table>');
newImageDiv.appendTo("#addgroup");
$("tr:last").after(newImageDiv);
document.getElementById("hiddenprice").value = imagecounter;
imagecounter++;
});
</script>
<div class="common" style="width:1040px; -overflow-x:scroll; padding: 5px
5px 0 5px;">
<table id="maintable" width="50%" cellpadding="0" cellspacing="0"
class="pdzn_tbl1" border="#729111 1px solid" >
<tr> <th align="center"> Roll No </th>
<th align="center"> First Name </th>
<th align="center"> Last Name </th>
</tr>
<?php
$t_row=3;
for($i=1;$i<=$t_row;$i++)
{
?>
<tr id="rows">
<div style="padding-left: 5px">
<td style="padding:5px;" > <input type="text" name="rollno<? $i ?>" /> </td>
<td style="padding:5px;"> <input type="text" name="firstname<? $i ?>" />
</td>
<td style="padding:5px;"> <input type="text" name="lastname<? $i ?>" /> </td>
</tr>
</div>
<? } ?>
<div id="addgroup">
<div id="add_div1"> </div>
</div> <table>
<br />
<input type="button" name="add" value="+Add" id="addrows"
style="color:#3300FF; font-size:16px; " />
<input type="hidden" id="hiddenprice" name="hiddenprice"
value="3"/> </table>
</div>
</body>
</html>
thanks in advance..!!!!
Sunday, 29 September 2013
How to get the actual vAxis max value of Google Chart API?
How to get the actual vAxis max value of Google Chart API?
I have two LineChart, each has a rangeFilter (like the one here
https://code.google.com/apis/ajax/playground/?type=visualization#chartrangefilter_control)
I want to synchronize the scale of the two chart. That is, when one chart
changed the range of view, it will change vAxis max value to suite the
maximum data in that range, and I want the other chart change scale to the
same value.
I've no idea how I can get the vAxis.viewWindow.max in realtime. Any help
would be appreciated.
I have two LineChart, each has a rangeFilter (like the one here
https://code.google.com/apis/ajax/playground/?type=visualization#chartrangefilter_control)
I want to synchronize the scale of the two chart. That is, when one chart
changed the range of view, it will change vAxis max value to suite the
maximum data in that range, and I want the other chart change scale to the
same value.
I've no idea how I can get the vAxis.viewWindow.max in realtime. Any help
would be appreciated.
Fastest way to implement a sprite
Fastest way to implement a sprite
I'm using PyOpenGL to implement a small 2D game engine. I'm hesitating on
the way I implement a Sprite class.
I'm already keeping all the scene (tiled map) in a VBO, and all textures
are kept in the same big texture. All the sprite's images are also in this
texture. So I suppose that, for performance, I should include the sprite
in the VBO, let say from position sprite_start_position.
The first question is : since a sprite can have several stances (images),
is it better to :
setting only one entry in the VBO for the sprite, and modifying the
texture coords in this entry accordingly to the stance, using
glBufferSubData
setting as many entries in the VBO as there are stances, but drawing only
the current one with glDrawArrays
other ?
The second is the similar with sprite position. Must I :
change the position of the right entry in the VBO with glBufferSubData
use some glTranslate before glDrawArrays(GL_QUADS, sprite_start_position, 1)
other ?
I'm relatively new to OpenGL and I still feel a little lost in this API...
I'm using PyOpenGL to implement a small 2D game engine. I'm hesitating on
the way I implement a Sprite class.
I'm already keeping all the scene (tiled map) in a VBO, and all textures
are kept in the same big texture. All the sprite's images are also in this
texture. So I suppose that, for performance, I should include the sprite
in the VBO, let say from position sprite_start_position.
The first question is : since a sprite can have several stances (images),
is it better to :
setting only one entry in the VBO for the sprite, and modifying the
texture coords in this entry accordingly to the stance, using
glBufferSubData
setting as many entries in the VBO as there are stances, but drawing only
the current one with glDrawArrays
other ?
The second is the similar with sprite position. Must I :
change the position of the right entry in the VBO with glBufferSubData
use some glTranslate before glDrawArrays(GL_QUADS, sprite_start_position, 1)
other ?
I'm relatively new to OpenGL and I still feel a little lost in this API...
Char pointer giving me some really strange characters
Char pointer giving me some really strange characters
When I run the example code, the wordLength is 7 (hence the output 7). But
my char array gets some really weird characters in the end of it.
wordLength = word.length();
cout << wordLength;
char * wordchar = new char[wordLength]; //new char[7]; ??
for (int i = 0; i < word.length(); i++) //0-6 = 7
{
wordchar[i] = 'a';
}
cout << wordchar;
The output: 7 aaaaaaa²²²²¦¦¦¦¦ÂD╩2¦♀
Desired output is: aaaaaaa... What is the garbage behind it?? And how did
it end up there?
When I run the example code, the wordLength is 7 (hence the output 7). But
my char array gets some really weird characters in the end of it.
wordLength = word.length();
cout << wordLength;
char * wordchar = new char[wordLength]; //new char[7]; ??
for (int i = 0; i < word.length(); i++) //0-6 = 7
{
wordchar[i] = 'a';
}
cout << wordchar;
The output: 7 aaaaaaa²²²²¦¦¦¦¦ÂD╩2¦♀
Desired output is: aaaaaaa... What is the garbage behind it?? And how did
it end up there?
Subscribe to:
Posts (Atom)