Hello!
I'm developing a TypeTranslator class which has a method Type TranslateType(Type type).
This method gets a type of an interface and if there's a class of interface name without leading I it creates it, otherwise an exception is raised.
Here's some code to clearify what's written before:
class Program
{
interface IAnimal { }
class…
I don't really understand how scoping works in perl modules. This doesn't print anything. I would like it if running a.pl printed 1
b.pm
$f=1;
a.pl
use b;
print $f
In smarty is it possible or is there any kind of function to render a template and return the result?
for example:
$rendered_content = $smarty->render("content.html")
if the last 4 chars in my string(result) are " AND" or the last three chars are " OR" I would like to remove these from the string. So far I have am trying result.trimend and a few other methods but am unsure how to get it working.
Thanks
hi,
I wanted to have function which will accept as
foo(...)
{
}
usage of this would be
foo(1,2,3);
foo(1)
foo(1,2,3,4,5,5,6);
va_list can be used but again for that I have to pass foo(int count, ...), as this at run time i dont know how many argument i have.
any pointer would be appreciated
Thanks
I have a series of PHP statements that I only want to run if javaScript is enabled.
if($js_enabled == 'yes') {
//Run a series of PHP statements
}
My problem is that I want to create that $js_enabled variable with javaScript. Therefore, if javaScript is enabled, the variable will be created and the PHP statements will be run, but if…
I've been at this one for a bit now.
I've got a null pointer exception so im guessing somethings not been initialized.
AdminMessages.inbox1.setText(messageRsetArray[0]);
thats my code where its targetting. but i cant find what inside it hasnt been initiazed.
AdminMessages is a class which contains a JTextField called inbox1,…
Hi, I have the following piece of code from a book.
There is this function loadPrefs where the NSString *userTimeZone is being released before the end of the function.
Why? The string was not created with alloc and I assume that the stringForKey function returns an autoreleased NSString. Is this an error or am I missing…
hello
in c++ what is better programming
say i need to create new stl::map in each loop interation
what will be better as poiner instance of as static instance for example
for(int i=0;i<3;i++)
{
stl::map<int,int>* m = new stl::map<int,int>;
or ...
stl::map<int,int> m;
}
Is there significant cpu/memory overhead associated with using automatic arrays with g++/Intel on 64-bit x86 linux platform?
int function(int N) {
double array[N];
overhead compared to allocating array before hand (assuming function is called multiple times)
overhead compared to using new
overhead compared to using…
what is a best practice in cases such as this one:
try
{
// do something
}
catch (SpecificException ex)
{
Response.Redirect("~/InformUserAboutAn/InternalException/");
}
the warning i get is that ex is never used.
however all i need here is to inform the user, so i don't have a need for it.
do i just do:
try
{
…
I am pulling a list of invoices filtered by a starting and ending date, and further filtered by type of invoice from a SQL table. When I specify a range of 2013-07-01 through 2013-09-30 I am receiving 2 invoices per company when I expect 3. When I use the built in select top 1000 query in SSMS and add my date filters, all…
i need to create multiple javascript functions which have a static id inside, so the function itself knows what data to process.
Here is some code:
(function(){
function log(s){
if(console && console.log) console.log(s);
else alert(s);
}
var i = 10; while (i--){
window.setTimeout(function(){
…
for(var i=0; i<<%=Model.Mydatalist.Count%>;i++)
{
//then I need to pass i to Mydatalist like Model.Mydatalist[i]
}
//var myJSdata="<%Model.Mydatalist["&i&"]%>";
is not working.. as system see i (i's value) as a string, and will throw exception: cannot convert string to int.
I have an events table that has user_id, date ('2013-10-01'), time ('04:15:00'), and status_id; What I am looking to find is a solution similar to http://stackoverflow.com/questions/2665574/find-consecutive-rows-calculate-duration but I need I need two additional components:
1) Take date into consideration, so 10/1/2013…
The following jQuery Javascript code is included on an otherwise empty page.
$(function() {
for (var i = 0; i < 10; i++) {
element = $('<div>' + i + '</div>');
element.click(function() {
alert(i);
});
$('body').append(element);
}
});
The desired behavior is that this code…
Hi all,
I have a variable that's being changed all the time in the course of my application. Can I make an element change (contents, colour, whatever), when the variable changes?
Or do I have to change the element each time I change the variable. Ideally, the result would almost be like binding a change event to…
I'm writing a program to ask the user to enter a value between 5 and 21 (inclusive). If the number entered is not in this range, it prints, "Please try again". If the number is within the range, I need to take that number, and print the sum of all the numbers from 1 to the value entered. So if the user entered…
Main class has two variables that want to reach another class:
public class MyClassA extends Activity {
int i = 1;
Button b1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.i = 31;
…
1) Is UNCHECKED operator in effect only when expression inside UNCHECKED context uses an explicit cast ( such as byte b1=unchecked((byte)2000); ) and when conversion to particular type can happen implicitly? I’m assuming this since the following expression throws a compile time error:
byte…
Hi
I would like to know how do I add an error check to below mentioned code...I mean how do I check if this code return empty or not?? if this returns empty then I would give a message "Not Found"..
How do I do That??
google.load('search', '1');
var blogSearch;
function searchComplete() {…
I am trying to set up ANT build.
However when I invoke build command
helloworld_15/${NAME} does not exist.
BUILD FAILED (total time: 0 seconds)
Also the configure variables does not seems to be assigned.
However i have set them into /etc/envitonment
I tried echo…
I have a strange problem in C++. An address of a Boolean gets "destroyed" but it doesn't get touched. I know that there are beater way's to accomplish what I try to do, but I want to know what I do wrong.
I have a main class; this main class contains a vector of another…