a difficult one..
using classes of primitive types in java, like Integer, Float, Long, etc, write a code fragment using a method to double the value of a variable passed as an argument
My goal is to write this:
println "this should be 3: ($1+2)" //this is invalid groovy, it won't run
Yet this is valid in ruby. Is there a way I can put statements that will eval inside a string or must I use complete variables names? I am basically looking for the Ruby equivalent of:
puts "this shoud be 3: #{1+2}" #this is valid ruby
I need to supply a binary license file to a java program. What is the best way to do this? The data will change all the time so I don't want to have to write a file and then read it back every time.
The Data is coming from a PHP page
I always use If statement (In C#) as (1. Alternative);
if (IsSuccessed == true)
{
//
}
I know that there is no need to write "== true" as (2. Alternative));
if (IsSuccessed)
{
//
}
But, I use it because it is more readable and cause no performance issue. Of course, this is my choice and I know many software developers prefer first alternative. What is the best usage, and Why?
I was told by some person that just as .NET started inspired from Java, so is WPF as ".. Microsoft NEVER innovates...".
I can't find anywhere anything remotely close to WPF.
Do you know any particular technology, earlier than WPF, from which Microsoft could have been inspired to write WPF?
Here's what I'm doing now:
mysock = urllib.urlopen('http://localhost/image.jpg')
fileToSave = mysock.read()
oFile = open(r"C:\image.jpg",'wb')
oFile.write(fileToSave)
oFile.close
f=file('image.jpg','rb')
ftp.storbinary('STOR '+os.path.basename('image.jpg'),f)
os.remove('image.jpg')
Writing files to disk and then imediately deleting them seems like extra work on the system that should be avoided. Can I upload an object in memory to FTP using Python?
Hi,
I wanna to have query:
Select cars.* from cars where cars.code in
(
select carCode from articles where
numberofrecords with this car (it is not a column) >1
and Accepted=1
order by date
)
How to write it?
I am attempting to write a regular expression to process a string of key value(s) pairs formatted like so
KEY/VALUE KEY/VALUE VALUE KEY/VALUE
A key can have multiple values separated by a space.
I want to match a keys values together, so the result on the above string would be
VALUE
VALUE VALUE
VALUE
I currently have the following as my regex
[A-Z0-9]+/([A-Z0-9 ]+)(?:(?!^[A-Z0-9]+/))
but this returns
VALUE KEY
as the first result.
Hey, take this as a challange, my informatics professor made it in less than 10 rows, it work perfectly and its very efficient. I'd like to "surprise" him giving a better/shorted version of it. Ofcourse i wouldn't take the credits, hah, u can trust in me.
It's a simple anagras finder! If you can.. write it in c++! thanks!
I want to show some bold and some simple word within the same sentence.If I use the textbox
then every word will be simple, not some bold and some simple so I want a control's text
property in that I can write some bold and some simple word within the same statement
I want to write a function that accepts any container holding strings. Something like this:
template <typename Container> void foo(Container<string>& stuff);
But this isn't the right syntax. What's the right syntax?
Is there any pitfalls when using char*'s to write cross platform code that does memory access?
I'm working on a play memory allocator to better understand how to debug memmory issues. I have come to believe char*'s are preferable because of the ability to do pointer arithmetic and derefernce them over void*'s, is that true? Do the following assumptions always hold true on different common platforms?
sizeof(char) == 1
sizeof(char*) == sizeof(void*)
sizeof(char*) == sizeof(size_t)
I have a NAnt script like below:
<target name="Init" unless="${target::has-executed('Init')}">
What I want is to convert it into MSBuild script. What I can't do is to write MSBuild script to run a target only when it hasn't run like the above script.
Please help.
I have a table with anniversary dates. I want a query that returns me rows of anniversaries coming up in the next 10 days. For instance:
birthdate
---------
1965-10-10
1982-05-25
SELECT birthdate FROM Anniversaries WHERE mystical_magical_mumbo_jumbo <= 10
+------------+
| birthdate |
+------------+
| 1982-05-25 |
+------------+
1 row in set (0.01 sec)
I'd like to keep the query in the form x <= 10, because I'll use that number 10 in other parts of the query, and if I set it to a variable, I can change it once everywhere by changing the variable, and not have to re-write the query.
Let's assume someone has to write a solution to a problem and I have to test his solution with some tests. Is it possible (maybe with reflections or something) his program to pass all my tests, but to have nothing in common with the real solution to the problem?
hi guys, can anyone help me how to write code for checking spellings in android?
or can anyone provide me the sites which will be useful to me.
thanks in advance
any help will be appreciated.
Is it possible to actually use the type passed as a template for control flow? I'd like to write a function that uses templates, which in turn calls another function based on the type passed:
template <class T> void test_function (T var)
{
//Do stuff
if (T == char) {
bar (var);
} else {
foo (var);
}
//Do even more stuff
}
If not, I'll have to fallback to enums...
i have the Code:Block ide in window.
my compiler is in linux machine that is GCC.
can i write the code in window & compile in linux with the Code:Block ide.
if i can , then how ?
if not, is there any alternative to do that.
thanks in advance for all suggestion.
Hi, I hv 3 java web-apps running in jetty and i want one of them to be accessed only through localhost. I dont want to write filter. Can it be done by modifying some jetty configuration?
Hello, I just want to write some few simple lines to a text file in C++, but I want them to be encoded in UTF-8. What is the easiest and simple way to do so?
Thanks
Is there an analogous form of the following code:
if(month == 4,6,9,11)
{
do something;
}
Or must it be:
if(month == 4 || month == 6 etc...)
{
do something;
}
I am trying to write an if statement that checks if this month has more than 31 days.
I have a windows form simply like this: 1) a button when clicked will perform an operation taking a long time to complete, 2) a label showing how much percentage of the progress is going on.
In the long operation I mentioned, I write the code to update the Text property of the label but it doesn't work!
Please help me to show the progress status correctly.
I want to write an application that allow user to count down the time. The time will be displayed using label. I want to update the label every second, how can I do it? or which API is suitable for me to do this? thz in advance.
I am using ofstream() to write data into file, i want to program to perform such a way that it should be keep on writting the string into the file as soon as the value gets assingned to string variable, and it should be writting before calling the close() for the buffer and while the program runs itself.
can anyone help me to do that in c++.........