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")
I want to call this guy
-(void)addFavorite:(NSString *)favoriteToAdd
at, @selector here
action:@selector([addFavorite favoriteToAdd:@"string"])];
But I keep getting syntax error no matter which way I write it.
Can someone point out the appropriate way to call this function? When it had no parameter and was "addFavorite," it worked fine.
I am transitioning to C++ from C. In C++, is there any use for the malloc function? Or can I just declare it with the "new" keyword. For example:
class Node
{
...
}
...
Node *node1 = malloc(sizeof(Node)); //malloc
Node *node2 = new Node; //new
Which one should I use?
How can I set a conditional breakpoint to a function's 3rd line in GDB?
I know I could give the file name + line number but this is not working for me.
I have to store the gdb commands as a script to repeat it later and I don't want to change the script every time the source file is changing.
I have been trying to get this array function to output (non-zero) minimum values in the 'FINAL DATA' AE column. Can you see a structural error in this formula?
=IF($C$4="All EMEA",
MIN(IF('FINAL DATA'!$2:$AE$250000<>0,
('FINAL DATA'!$J$2:$J$250000=$C$4)*('FINAL DATA'!$E$2:$E$250000=$E$4)*( 'FINAL DATA'!$AE$2:$AE$250000))),
MIN(IF('FINAL DATA'!$AE$2:$AE$250000<>0,
('FINAL DATA'!$K$2:$K$250000=$C$4)*('FINAL DATA'!$E$2:$E$250000=$E$4)*( 'FINAL DATA'!$AE$2:$AE$250000)))
)
I got an IFrame, in the onload event i set the height of the frame:
function resizeFrame() { $("#iframeID").height($("#iframeID").contents().find("body").outerHeight(true)); }
Problem is:
When the content of the frame is increasing without a postback (javascript or Async Postback with Ajax), a scrollbar appears.
I found a solution for Firefox:
document.getElementById("iframeID").contentWindow.addEventListener("overflow", resizeFrame, false);
But i can't find a solution for IE 7+8
Anyone got an idea?
Here are the GDI functions Chord() provided by MFC:
BOOL Chord( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4 );
BOOL Chord( LPCRECT lpRect, POINT ptStart, POINT ptEnd );
It seems to me that no such method is privided by GDI+ (the Graphics class), so how do I implement my own Chord function (with the exact same prototype) ?
By the way, I just don't understand why does MS just don't provide them.
Thanks.
is there a built in function to compute the overlap between two discrete intervals, e.g. the overlap between [10, 15] and [20, 38]? In that case the overlap is 0. If it's [10, 20], [15, 20], the overlap is 5.
thanks.
Hi there,
I have created a usercontrol to capture education details, it contains 5 textboxes and an functionto insert that values into my db. I have added the usercontrol 5 times to a page. I have a button on my aspx page which I want to be able to click and call the function to insert the values.
Can anyone suggest how I can do this?
Hi, I am writing a custom read function for one of the data types in my module. For eg, when I do read "(1 + 1)" :: Data, I want it to return Plus 1 1. My data declaration is data Data = Plus Int Int. Thanks
In NHibernate there is a merge function that does the following:
if there is a persistent instance with the same identifier currently associated with the session, copy the state of the given object onto the persistent instance
if there is no persistent instance currently associated with the session, try to load it from the database, or create a new persistent instance
the persistent instance is returned
Is this possible in EF? I mean this part : copy the state of the given object onto the persistent instance. And if i used ApplyCurrentValues it seemes to be as update behavior or not?
char
char* c[30];
c = (char*) malloc(30*sizeof(char) );
How does this give an incompatible declaration in built in function warning and and incompatible types in assignment error in the line where i have declared malloc . According to the syntax of malloc , i shouldnt have any error
function get_ibo_id() {
if($registerquery = $this->conn->query("SELECT ibo_id FROM fasttrack WHERE count <
8 && flag = 1 ")){
$this->increase_count();
while ($row = $registerquery->fetch_assoc()) {
return $row[ibo_id];
}
}
else return "No id";
}
it always enters the if block even if the condition is not satisfied... going crazy
How can I tell if a given javascript function will work across browsers? For instance, I want to use String.trim() and I see that it works in Firefox, but will it work in all the other major browsers? I imagine there is a good doc online somewhere, but I can't find it.
Windows XP, Python 2.5:
hash('http://stackoverflow.com') Result: 1934711907
Google App Engine (http://shell.appspot.com/):
hash('http://stackoverflow.com') Result: -5768830964305142685
Why is that? How can I have a hash function which will give me same results across different platforms (Windows, Linux, Mac)?
i have a slide up function and a slide down on my script, everything works. The problem is that the DIVs are collapse and not hidden how would i be able to hide the divs on page start up. i tried to set the DIV to hidden but no luck with that.
This is too basic I think, but how do both of these work?
return true; // 1
and
return (true); // 2
Similar: sizeof, exit
My guess:
If return was a function, 1 would be
erroneous.
So, return should be a unary
operator that can also take in
brackets... pretty much like unary
minus: -5 and -(5), both are
okay.
Is that what it is - a unary operator?
I want to write an emacs function that does the following -
1) Start a new shell named "abc".
2) Change the dir "/opt/abc"
3) In the dir run a shell command "python abc.py"
I have written the following fucntion -
(defun abc-server ()
(interactive)
(shell-command "cd /opt/abc/")
(shell-command "python abc.py"))
The problem with the above -
1) It doesnt start a new shell
2) It doesnt change the dir.
3) When the cmd executes, it opens a browser window, which completely blocks any usage of emacs.
I'm in love with the function in Eclipse "assign to field". Basically, when I have
getString();
and I type ctrl-2, Eclipse converts this into
String getString = getString();
Is this possible in VS 2010?
Is there any textbox comoponent(control) which is counting back from the maxlength?
I can write it but i would like to find a control which has this function.
Hi everyone,
do you know if there is an easy way to pass some arguments to a function called via
haxe.Timer.delay(func, delay);
By "easy" I mean without creating any custom timer.
Thanks.
Hi there,
I tried to pass a string value into a JavaScript function like below:
<%= "'" + prop.property_description + "'") %>)
But it does not seems to be the best option, is there a better way to do the above without concatenate the string values with "'"?
Thanks
Hi all, I have this functions and need to make it one function. The only difference is type of input variable sourceColumnValue. This variable can be String or Integer but the return value of function must be always Integer.
I know I need to use Generics but can't do it.
public Integer selectReturnInt(String tableName, String sourceColumnName, String sourceColumnValue, String targetColumnName) {
Integer returned = null;
String query = "SELECT "+targetColumnName+" FROM "+tableName+" WHERE "+sourceColumnName+"='"+sourceColumnValue+"' LIMIT 1";
try {
Connection connection = ConnectionManager.getInstance().open();
java.sql.Statement statement = connection.createStatement();
statement.execute(query.toString());
ResultSet rs = statement.getResultSet();
while(rs.next()){
returned = rs.getInt(targetColumnName);
}
rs.close();
statement.close();
ConnectionManager.getInstance().close(connection);
} catch (SQLException e) {
System.out.println("???????? ?? ???? ?? ???? ?????????!");
System.out.println(e);
}
return returned;
}
// SELECT (RETURN INTEGER)
public Integer selectIntReturnInt(String tableName, String sourceColumnName, Integer sourceColumnValue, String targetColumnName) {
Integer returned = null;
String query = "SELECT "+targetColumnName+" FROM "+tableName+" WHERE "+sourceColumnName+"='"+sourceColumnValue+"' LIMIT 1";
try {
Connection connection = ConnectionManager.getInstance().open();
java.sql.Statement statement = connection.createStatement();
statement.execute(query.toString());
ResultSet rs = statement.getResultSet();
while(rs.next()){
returned = rs.getInt(targetColumnName);
}
rs.close();
statement.close();
ConnectionManager.getInstance().close(connection);
} catch (SQLException e) {
System.out.println("???????? ?? ???? ?? ???? ?????????!");
System.out.println(e);
}
return returned;
}