What is the simplest and least obtrusive way to indicate to the compiler, whether by means of compiler options, #defines, typedefs, or templates, that every time I say T, I really mean T const? I would prefer not to make use of an external preprocessor. Since I don't use the mutable keyword, that would be acceptable to repurpose to indicate mutable state.
Potential (suboptimal) solutions so far:
// I presume redefinition of keywords is implementation-defined or illegal.
#define int int const
#define ptr * const
int i(0);
int ptr j(&i);
typedef int const Int;
typedef int const* const Intp;
Int i(0);
Intp j(&i);
template<class T>
struct C { typedef T const type; typedef T const* const ptr; };
C<int>::type i(0);
C<int>::ptr j(&i);
Is there a method to detect the value of a image rgb that is blury?
I simply want to store the blury value of my image in a variable called blury value? Is there a dedicated function?
%image1 which is rgb is stored in variable img1
img1 = imread('102.jpg');
% conversion to grayscale stored in img1_grey variable
img1_grey = rgb2gray(img1);
blury_value = function_matlab(img1)
Hi guys!
I have a little problem in my code. The variables don't want to change their values. Can you say why?
Here is my code:
vector<coordinate> rocks(N);
double angle;
double x, y;
// other code
while (x > 1.0 || x < -1.0 || y > 1.0 || y < -1.0) {
angle = rand() * 2.0 * M_PI;
cout << angle << endl;
cout << rocks[i - 1].x << endl;
cout << rocks[i - 1].y << endl;
x = rocks[i-1].x + r0 * cos(angle);
y = rocks[i-1].y + r0 * sin(angle);
cout << x << endl;
cout << y << endl << endl;
}
// other code
And the result on the console is:
6.65627e+09
0.99347
0.984713
1.09347
0.984713
1.16964e+09
0.99347
0.984713
1.09347
0.984713
As you see the values of x, y variables doesn't change and this while be an infinity loop. What's the problem? What do you think?
While i execute this code it shownt the following error
Cannot select a node here: the context item is an atomic value,so that i can't sum up the fundunits
what is the problem ? why i can't able to sum up
<xsl:variable name="VAR_FUNDNAME" select="distinct-values(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFO[CLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN/FUNDNAME)"/>
<xsl:for-each select="$VAR_FUNDNAME">
<xsl:variable name="VAR_CURFUNDNAME" select="."/>
<myvar><xsl:value-of select="$VAR_CURFUNDNAME"/></myvar>
<xsl:if test="(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFOCLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN[FUNDNAME=string($VAR_CURFUNDNAME)][UNITTYPE='Acc'])"/>
<ASSETVALUATIONDATE><xsl:value-of select="min(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFO[CLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN[FUNDNAME=string($VAR_CURFUNDNAME)][UNITTYPE='Acc']/string(ASSETVALUATIONDATE))"/></ASSETVALUATIONDATE>
<PLANNUMBER></PLANNUMBER>
<FUNDNAME><xsl:value-of select="$VAR_CURFUNDNAME"/></FUNDNAME>
<FUNDUNITS><xsl:value-of select="string(sum(/SJPDATA/WEALTHSTAT[DOCUMENTTYPE=$MYDCTTYPE]/CLIENTINFO[CLIENTID=$MYCLIENT]/ancestor::*/PORTFOLIO/PENSIONS[CLIENTREF=$MYCLIENTTYPE][GROUPING=$MYGROUPINGVALUE]/PENSIONBREAKDOWN[FUNDNAME=string($VAR_CURFUNDNAME)][UNITTYPE='Acc']/FUNDUNITS))"/></FUNDUNITS>
</xsl:for-each>
I have a drop down list with known values. What I'm trying to do is set the drop down list to a particular value that I know exists using jQuery. Using regular JavaScript, I would do something like:
ddl = document.getElementById("ID of element goes here");
ddl.value = 2; // 2 being the value I want to set it to.
However, I need to do this with jQuery because I'm using a CSS class for my selector (stupid ASP.NET client ids...).
Here are a few things I've tried:
$("._statusDDL").val(2); // doesn't find 2 as a value
$("._statusDDL").children("option").val(2) // also failed.
How can I do it with jQuery?
How can I get the selected value of a dropdown box using jQuery?
I tried using
var value = $('#dropDownId').val(); and
var value = $('select#dropDownId option:selected').val();
but both returns an empty string.
So what would be nice is if you could do something like the following (not necessarily with this format, just the general idea):
data Minor = MinorA | MinorB
data Major = Minor | MajorB
isMinor :: Major -> Bool
isMinor Minor = True
isMinor _ = False
So isMinor MinorA would report True (instead of an error.)
At the moment you might do something like:
data Major = MinorA | MinorB | MajorB
isMinor :: Major -> Bool
isMinor MinorA = True
isMinor MinorB = True
isMinor _ = False
It's not terrible or anything, but it doesn't expand nicely (as in if Minor when up to MinorZ this would be terribly clunky). To avoid that problem you can wrap Minor:
data Minor = MinorA | MinorB
data Major = MajorA Minor | MajorB
isMinor :: Major -> Bool
isMinor (MajorA _) = True
isMinor _ = False
But now you have to make sure to wrap your Minors to use them as a Major... again not terrible; just doesn't really express the semantics I'd like very well (i.e. Major can be any Minor or MajorB). The first (legal) example is "Major can be MinorA..." but doesn't have any knowledge of Minor and the second is "Major can be MajorA that takes a Minor..."
p.s. No, this isn't really about anything concrete.
Hi All
i have HTML string value and i want to get one attribute(id) value from that html String value
can u help me how to do it??
String msHTMLFile = "<ABBR class='HighlightClass' id='highlight40001' style=\"BACKGROUND-COLOR: yellow\" >Fetal/Neonatal Morbidity and Mortality</ABBR>";
result should come - highlight40001;
Hi everyone,
In my JSP I have a dropdownlist and a submit button when clicking the submit button I loose the value already selected in my list.
I am using the jstl because i need to construct other table corresponding the value selected in my list.For that I must call a submit button but the problem; it reset the value selected
I want to know if there is a way to save the value selected in my list even I click a submit button.
I work with JSP and eclipse environment.
Think you for your help.
I am checking to see if element1, element 2 or element 3 exists and then add them to finalData if they exist. However
if one of those dont exist or are not true then I just want to add the elements whose bool value is true! Below is my code
bool hasElement1 = (
from Playlist in loaded.Descendants("Node")
select Playlist.Descendants("Element1").Any()
).Single();
bool hasElement2 = (
from Playlist in loaded.Descendants("Node")
select Playlist.Descendants("Element2").Any()
).Single();
bool hasElement3 = (
from Playlist in loaded.Descendants("Node")
select Playlist.Descendants("Element2").Any()
).Single();
var finalData = from x in loaded.Descendants("Node")
select new
{
Element1 = x.Descendants("Element1").First().Value,
Element2 = x.Descendants("Element2").First().Value,
Element3 = x.Descendants("Element3").First().Value,
};
Hi,
I have classes as below.
public interface ITest <T>
{
public T MethodHere();
}
public class test1 implements ITest<String>
{
String MethodHere(){
return "Bla";
}
}
public class test2 implements ITest<Integer>
{
Integer MethodHere(){
return Integer.valueOf(2);
}
}
public class ITestFactory {
public static ITest getInstance(int type) {
if(type == 1) return new test1();
else if(type == 2) return new test2();
}
}
There is a warning in the factory class that ITest is used as raw type. What modification should I do to get rid of it?
Thanks
Nayn
A lot of tech interviews asks these "kinds" of questions, so I thought I'd make a list for myself and others:
(1) Linked Lists
(2) Strings
(3) Trees
(4) Bitwise Manips
(6) Recursion (I hate these ones, I can never get these, any tips?)
i am passing the textbox1.text values into a query and sometimes into a string
sometimes i say this:
dim combor1 as string
combor1 = comboReason1.Text
how do i know when i should put combor1=comboreason1.value ??
also why do i need to set focus for a control to reference its property? that doesn't make sense to me
also when i set combor4 = comboReason4.Value and the .value is null, then i get an error about invalid use of null
please help!
in R , when i use "print", i can see all the values, but how can i save this as a vector
for example, in for loop,
for (i in 1:10), i want the value of A , when i= 1,2,3,4..... but if i use the x=A, it only have the final value of A which is the value when i = 10. so , how can i save the vaule in print(A)
Below are the options that i have in my code
<label id="subn">
<select name="subs" id="subs">
<option value="nothing">Choose a Subject</option>
<option value="General Question">General Question</option>
<option value="MemberShip Area">MemberShip Area</option>
<option value="Others">Others</option>
</select>
</label>
and i want to create a javascript that well check if the user select a subject other than the first below what i tried using
if (document.getElementsByTagName('option') == "nothing"){
document.getElementById("subn").innerHTML = "Subject is Required!";
document.getElementById("subs").focus();
return false;
}
class first
{
private int? firstID;
}
class second
{
private int secondID;
private int secondField;
}
public override Expression<Func<first, bool>> FirstFilter()
{
Contex db = new Contex();
List<second> list = (from p in db.second select p).ToList();
return b => list.Select(p => p.secondID).Contains(b.firstID);
}
and i have error: cannot convert from 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.IEnumerable' i have tried many diferent ways, but i just don't know how can i fix it.
Hello all
I have a table in a MySQL database. I am given a value that occurs as a cell value in that table but I do not know which cell is it i.e. the row and column of that cell. What is the most efficient way to find the column to which that value belongs? Thanks in advance.
Hi
while I am performing the edit function .. i have a textarea where i type some text and submit
<tr align="left">
<td class="table_label">Reason </td>
<td><textarea cols="17" class="text_box_login_14_width_150" size="5" name="txtReason" id="txtReason"></textarea></td>
</tr>
when i submit i must receive the value in the edit form
<td>
<textarea id="txtReason" name="txtReason" value="<?= $row['dReason']?>"></textarea>
</td>
but i dont receive the value for text area how to receive the value
I am trying to model a sales situation where you can sell to a person or to a business with a contact person. I cannot figure out the proper way to do this.
It seems like 2 tables would be incorrect. But how do I model a Customer table that can be a business or a person? Would I just have a boolean for "business" and an additional "business_name" field that would default to Null. But then I have to do an if/then on the columns and that seems like poor design.
Any advice, direction, or links is appreciated.