Hi,
it looks very basic thing but i could not figure it out.
var email = $("input#email").val();
how can i check if that email variable has @ letter ?
Thanks
Say I have a pool of enumerables that I want to group by an attribute:
cars = Car.all.group_by(&:color)
Then I want to iterate over those cars like so:
cars.inject([]) do |stack, (color, cars)|
stack << cars.each do |car|
...
end
end
What is the term for the block variable extension (between the parentheses)?
Hello,
is it possible to specify that a NSMutableArray can only contain a certain type of objects.
For example, if I want to store only this kind of objects :
@interface MyObject : NSObject {
UInt8 value;
}
In order to be able to use the instance variable like this :
- (void)myMethod:(NSMutableArray *)myArray{
for (id myObject in myArray){
[self otherMethod:myObject.value];
}
}
because I'm getting this error :
request for member 'value' in something not a structure or union
Thank you for your help
I've some sorted lists with variable number of elements. I wold like to merge the lists into one big list which contains all other lists in same order, without duplicates.
Example:
1. XS,M,L,XL
2. S,M,XXL
3. XXS,XS,S,L
Result:
XXS,XS,S,M,L,XL,XXL
The function should notify, if there are elements which have ambiguous positions. Here, it would be XXL and I need to specify its position after XL.
How to loop through a select statement results to have a formatted text?
for example the select is like:
select name from table
and we want a variable @names like this:
"name1,name2,name3"
Database is SQL Server 2005
Hi!
Can anyone please help me?:(
I'm desperrate cause I have to finish this script as soon as possible!
The problem is:
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\FlashChat_v607\chat\inc\common.php on line 155
Notice: Undefined variable: step in C:\wamp\www\FlashChat_v607\chat\inc\common.php on line 94
and this is the link where you can find the code:
http://www5.zippyshare.com/v/3592861/file.html
hello, what is the name and sintacsys of construcion ((..)) in example below?
for ((i=1;i<10;i++)) do echo $i; done
it has strange variable i
where are other constructons for numeric cycling in shell?
I am trying to open Vim with different configuration options depending on the executable file name. I intend to create a number of symbolic links to vim and I'd like to do something like this in my .vimrc
if execname == "vim2"
" configuration here
endif
Is there a variable in Vim that holds the name of the executable file being run? Alternatively, is there another way I can have different configurations without having to keep more than one .vimrc file?
I am trying to code a shopping cart using Flex 4. I am at the design process and I need to figure out which design pattern to use. I am thinking of using the Singleton pattern. I will have a Product Value Object where I'll save each product's values and the I'll push each product to an array variable in my Singleton class.
Is my logic OK? Is there a better way?
Thanks in advance
I want to take my .htaccess file and add a second rule for another vanity URL as I already have one declaring the page. So how would I write it so I can go to my page, and the next vanity being a variable for a profile?
Ex:// mywebsite.com/page/profile
Here is my current .htaccess file.
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z0-9-]+)$ index.php?p=$1 [L]
RewriteRule ^([a-zA-Z0-9-]+)/$ index.php?p=$1 [L]
I observed that size of long is always equal to the WORD size of any given CPU architecture. Is it true for all architectures? I am looking for a portable way to represent a WORD sized variable in C.
Hi,
I'm puzzled by some behaviour I'm seeing when copying a float array member into
another variable - please help!
For example
data_entry[1] = 9.6850069951
new_value = data_entry[1]
<comment> #print both
9.6850069951
9.6850663300
I'm aware of the problem of binary storage of floats but I thought
with a direct copy of memory we would end up with the same value.
Any ideas? I need better precision than this!
thanks in advance
Stuart
For a simple simulation in C, I need to generate exponential random variables. I remember reading somewhere (but I can't find it now, and I don't remember why) that using the rand() function to generate random integers in a fixed range would generate non-uniformly distributed integers. Because of this, I'm wondering if this code might have a similar problem:
//generate u ~ U[0,1]
u = ( (double)rand() / ((double)(RAND_MAX));
//inverse of exponential CDF to get exponential random variable
expon = -log(1-u) * mean;
Thank you!
I have a Datagrid , 2 textBoxes and 4 buttons whenever I change positions or add a new controls , It gives errors form my grid variable saying it is not in current context . I am creating a window Application and using WinForms
I have a function in C++ that takes in an std::istream as the input:
class Foo {
Foo(std::istream &);
}
Using SWIG, I've bound it to Ruby, but Ruby's $stdin variable is fundamentally different from anything like the stream classes in C++, so I'm not sure how to either 1) expose the C++ class to Ruby in a way that I can use $stdin, or 2) convert $stdin into something the C++ class can understand.
Anyone have experience with binding iostreams in C++ to Ruby?
Thanks.
Hi, I'm working on a hash function which gets a string as input.
Right now I'm doing a loop and inside the hash (an int variable) is being multiplied by a value and then the ASCII code for the current character is added to the mix.
hash = hash * seed + string[i]
But sometimes, if the string is big enough there is an integer overflow there, what can I do to avoid it while maintaining the same hash structure? Maybe a bit operation included inside the loop?
Hi,
I'm trying to use a filter in vba like this:
Private Sub Form_Load()
Me.Filter = "[Alvo] = " & AlvoAtual
Me.FilterOn = True
Me.Requery
End Sub
where AlvoAtual is global variable, but nothin happens. When I change the AlvoAtual for a specifc value nothin happens too. Like this:
Private Sub Form_Load()
Me.Filter = "[Alvo] = 'AAAA'"
Me.FilterOn = True
Me.Requery
End Sub
Someone knows the problem?
Thank you.
I have an html textarea that is of fixed width, but variable height. I would like to set overflow:scroll and be able to show a vertical scrollbar, but not a horizontal one. I am not able to use overflow:auto due to other things specific to my situation.
I know there is no way using CSS 2 to show only vertical but not horizontal scrollbars. Is there anything I can do with javascript to hide the horizontal scrollbar?
Is there any considerations to determine which is better practice for creating an object with private members?
var object = new function () {
var private = "private variable";
return {
method : function () {
..dosomething with private;
}
}
}
VS
var object = function () {
...
}();
Basically what is the difference between using NEW here, and just invoking the function immediately after we define it?
I need to see the contents of a std::map variable while debugging. However, if i click on it in the Autos/Locals Tab, I see implementation specific stuff, instead of the keys and its contents which I want to look at. Is there a work-around i'm missing ?
I'm writing a little client using Ruby and Savon. The interface changed significantly from version 0.7 to 0.8.x. All my calls don't work anymore :-(.
How can I pass on a local member variable.
Please see the example, @userName and @userPassword are not defined within the block.
begin
@response = @authentication_svc.request :wsdl, "AuthenticateUser" do
http.headers["SOAPAction"] = "AuthenticateUser"
soap.body = "#{@userName}#{@passwd}"
end
rescue Savon::SOAP::Fault = e
@last_soap_error = e.message
end
Hello Colleagues,
I want to output single quote around $ID variable in the below xsl:value-of xsl statment.
<xsl:value-of select="concat('process[@Ref=',$ID,']')"></xsl:value-of>
currently it prints
process@Ref=87799989
Please let me know how can i achieve this.
Thanks in advance,
Keshav
I think I encountered something extraordinary strange in VS 2008.
All the array values are 0x00, but why it is displayed 0x00000008 at the start of the variable?
I have a variable in Python containing a floating point number (e.g. num = 24654.123), and I'd like to determine the number's precision and scale values (in the Oracle sense), so 123.45678 should give me (8,5), 12.76 should give me (4,2), etc.
I was first thinking about using the string representation (via str or repr), but those fail for large numbers:
>>> num = 1234567890.0987654321
>>> str(num) = 1234567890.1
>>> repr(num) = 1234567890.0987654