Hi,
How to alert variable name, not a value of variable?
var color = 'red';
alert(color); // Will alert 'red'
alert(/* magic */); // Will alert 'color'
dear experts,
This question is an extension of this question I asked.
I have a std::vector vec_B.which stores instances of class Foo. The order of elements in this vector changes in the code.
Now, I want to access the value of the current "last element" or current 'nth' element of the vector. If I use the code below to get the last element using getLastFoo() method, it doesn't return the correct value.
For example, to begin with the last element of the vector has Foo.getNumber() = 9. After sorting it in descending order of num, for the last element, Foo.getNumber() = 0.
But with the code below, it still returns 9.. that means it is still pointing to the original element that was the last element.
What change should I make to the code below so that "lastFoo" points to the correct last element?
class Foo {
public:
Foo(int i);
~Foo(){};
int getNum();
private:
int num;
};
Foo:Foo(int i){
num = i;
}
int Foo::getNum(){
return num;
}
class B {
public:
Foo* getLastFoo();
B();
~B(){};
private:
vector<Foo> vec_B;
};
B::B(){
int i;
for (i = 0; i< 10; i++){
vec_B.push_back(Foo(i));
}
// Do some random changes to the vector vec_B so that elements are reordered. For
// example rearrange elements in decreasing order of 'num'
//...
}
Foo* B::getLastFoo(){
&vec_B.back();
};
int main(){
B b;
Foo* lastFoo;
lastFoo = b.getLastFoo()
cout<<lastFoo->getNumber();
return 0;
}
Hi folks,
Quick question. I want to change the color of an int based on the value being positive or negative, using css if possible.
Any ideas??
Thanks again!
I have a dictionary collection as bleow:
mydic.addvalue(key1, val1)
mydic.addvalue(key2, val1)
mydic.addvalue(key3, val1)
mydic.addvalue(key4, val2)
mydic.addvalue(key5, val2)
From the above dictionary I want to delete all the entries where value == "val1", so that the result would have only following entry:
mydic.addvalue(key4, val2)
mydic.addvalue(key5, val2)
My VB source code is on VS2008 and targeted for 3.5
Hi!
How do i go about passing the value of width ,height,resize received as parameter to window.open using javascript?
Thanks
Example
function poponload(mywidth,myheight,resizeVal)
{
testwindow = window.open ("http://www.yahoo.com", "mywindow","location=1,status=1,scrollbars=1,width=+mywidth+,height=myheight,resizeVal");
testwindow.moveTo(0,0);
}
<body onload="javascript: poponload(200, 500,yes)">
Hi, I have defined my class:
public class Host
{
public string Name;
}
then a strongly-typed dictionary:
Dictionary<string, Host> HostsTable;
then I try to compare a value:
if (HostsTable.Values.Where(s => s.Name == "myhostname") != null) { doSomething }
and the problem is, nothing is found, even I'm sure the item is on the list. What I'm doing wrong ?
I want to read pattern for JST formatDate also from resource bundle but this naive approach does not working, what I'm doing wrong ?
in com/company/MyPortlet.properties is this key:
company.date.format = yyyy-MM-dd HH:mm:ss
In page I have:
<fmt:setBundle basename="com.company.MyPortlet"/>
<fmt:formatDate value="${date}" pattern="${company.date.format}" />
$("input[id^='exc-flwup-<%=Model.Date%>']").click(function() {
$(this).val('');
});
I am using this to clear the input field..when i click on the input box its doign clear but.. on form submit if i ccheck at controler side I am still seeing this value there?
do I need to do anyting else here to make null inputbox?
Hi
I am trying to generate a CSV file from DB Query as source one of my column is having datatype nvarchar(50) with values as "01050007029604301001"
After the export when the csv file is viewed using Excel the value appears as
"1.0500E18" .
How can i stop this .
Please suggest
Hi, im traversing through the registry, taking the values of the keys and storing them as strings. I have discovered there are many different types. Some of these types are causing my filestream writer to fail. Is it possible to convert all of the below into a string form. The actual data value is not important, just the ability to differentiate between different values.
DWORD
ExpandString
Binary (is this just the same as byte[] ?)
MultiString
Using LINQ 2SQL , How can i call a stored procedure which returns either 1 or 0 when being executed.My procedure has 3 input params.I want to know the return value from procedure in my code too.
I would like to print the selected values of all selects using jQuery.
I did it like this, but I feel that there is a nicer way to write the same.
Am I right ?
$("select").each(function() {
alert(this.options[this.selectedIndex].value);
});
Hi, i am using a dropdown in php which asks for user_category before creating the user. Upon selection of the category further text boxes are to be created dynamically depending upon the selection. I know how to get the selected value from $_POST but here i need it befor form submission.Pls help
if ($_SESSION['user_email']!=$_SESSION['ship_user_email'])
{
$to= $_SESSION['ship_user_email'];
mail($to,$subject,$mail_html,$headers);
}
there is problem in comparing values of both session. value is different but code not working.
I have following statement in one of the oracle SP:
OPEN CUR_NUM FOR
SELECT RTRIM(LTRIM(num)) as num
FROM USER WHERE USER_ID = v_user_id;
When the above does not return anything the SP result just has no column name in it. But I'd like the cursor to still have num column with some default value like NOTHING when no data is found.
Is this doable ?
I need help because I want to create a gameover screen that display score. However, there's an error that prevent me from transferring the score from theplayclass.as to thegameoverclass.as. Are there ways to pass a value to another movieclip without causing any errors.
I refer the source code from this website : http://www.emanueleferonato.com/2008/12/17/designing-the-structure-of-a-flash-game-as3-version/
Here's the error
C:\Users\xxx\Downloads\Migrate\test\theplayclass.as, Line 54, Column 41 1067: Implicit coercion of a value of type theplayclass to an unrelated type main.
main.as
package
{
import flash.display.MovieClip;
import flash.events.Event;
public class main extends MovieClip
{
public var playClass:theplayclass;
public var gameOverClass:thegameoverclass;
public function main()
{
showWin();
}
public function showWin()
{
playClass = new theplayclass(this);
addChild(playClass);
}
public function showGameOver()
{
gameOverClass = new thegameoverclass(this);
addChild(gameOverClass);
removeChild(playClass);
playClass = null;
}
}
}
theplayclass.as
package
{
import flash.display.MovieClip;
import flash.events.*;
public class theplayclass extends MovieClip
{
private var mainClass:main;
var gameScore:Number;
var gameOverScore:thegameoverclass;
public function theplayclass(passedClass:main)
{
mainClass = passedClass;
scoreText.text ="0";
gameScore = 0;
win.addEventListener(MouseEvent.CLICK, showwinFunction);
next.addEventListener(MouseEvent.CLICK, showgameoverFunction);
addEventListener(Event.ADDED_TO_STAGE, addToStage);
addEventListener(Event.ENTER_FRAME, changeScore);
}
public function addToStage(e:Event):void
{
this.x = 0;
this.y = 0;
}
private function showwinFunction(e:MouseEvent):void
{
gameScore+=50;
}
private function changeScore(e:Event):void
{
scoreText.text =""+gameScore;
}
public function showgameoverFunction(e:MouseEvent)
{
mainClass.showGameOver();
gameOverScore = new thegameoverclass(this);
gameOverScore.setTextScore(gameScore);
}
}
}
thegameoverclass.as
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.*;
public class thegameoverclass extends MovieClip
{
var mainClass:main;
var scorePoints:Number;
public function thegameoverclass(passedClass:main)
{
mainClass = passedClass;
finalScore.text = "test";
}
public function setTextScore(textToSet:Number)
{
finalScore.text = ""+scorePoints;
}
}
}
Actually I'm working with BufferedImages, that provide me pixel values in int type.
Do you know a Java object to represent an image that the pixel value in double or float type?
I want to be able to find the old value of a asp.net control (textbox, checkbox etc) without relying on events (e.g. OnTextChange event). Something like "someTextboxControl.OldText" would be perfect! I imagine that it is stored in the viewstate and need to somehow get at it via a custom control. Any ideas?
i have an html page where i have a table of items (one item per row) where each item is a html link that says "Add" and there is a textbox next to each link with a number in it.
the text link and the textbox are in the same td inside the row of the table.
how do i, using jquery, capture the value from the textbox that is to the right of the link i click on.
Hi,
Can you please tell me if there is any DOM API which search for an element with given attribute name and attribute value:
Something like:
doc.findElementByAttribute("myAttribute", "aValue");
Thank you.
Good Morning,
Say I have an insert statement:
Insert INTO tblTest (fieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo','null')
This statement doesn't seem to want to insert a null value into the database... I have also tried to insert the word "nothing".
Has anyone any ideas how to make this work? I am using SQL server 2005.
I have the code that reflects enum (DictionaryType) option to Guid in very straight-forward way
if (dictionaryType == DictionaryType.RegionType)
return Consts.DictionaryTypeId.RegionType;
if (dictionaryType == DictionaryType.Nationality)
return Consts.DictionaryTypeId.Nationality;
Please, suggest me the best way to reflect Enum option to static readonly guid value.
Thank you in advance
Is there a way to use jdt ASTParser to get the value of a String field declared in a java file. Actually what I need is to resolve any possible dependencies from other classes e.g.
public String str = "somethig"+SomeTherClass.SOMETHING_ELSE.