Is there a catchall function somewhere that works well for sanitizing user input for sql injection and XSS attacks, while still allowing certain types of html tags?
How can I convert a integer to it's byte representation. I want to take an integer and return a vector that has contains 1's and 0's of the integers byte representation.
I'm having a heck of a time trying to do this myself so I'd thought I would ask to see if there was a built in library function that could help.
Thanks!
Hi all,
I'm trying to setup a simple logging framework in my shell scripts. For this I'd like to define a "log" function callable as
log "LEVEL" $message
Where the message is a variable to which I have previously redirected the outputs of executed commands. My trouble is that I get errors with the following
{message=command 2&3 1&3 3&-} &3
log "INFO" $message
There's something wrong isn't there?
TIA
In Javascript, I have a variable that is set to a block of text from a WYSIWYG editor.
I want to use JQUERY's EACH() to find span's with the class XXXX.
$( "span.foods" ).each( function() {});
But I want it to search in the variable I have, lets call if lookHere
Is this possible?
I want to cut Postgres to its minimal size for purpose of including just database function with my application. I'm using Portable Postgres found on internet.
Any suggestions what I can delete from Postgres installation which is not needed for normal database use?
i am using sleep function in ansi-c that gives a resolution up-to milliseconds but not exactly i faced uncertain delays, people suggest me to use windows media timer,
i want to know the comparison between both is they enough reliable to use in real time system or to use some thing else,
thanx in Advance.
i know this connects to my original question but i put it here so it is seen by people afresh.
after passing each line of the code into a string,
how can i count the following things:
--the number of standalone functions and member functions per class
--the number of lines per function?
I am new to programming and this might be an obvious question, though i cannot for life of me figure out why my program is not returning as a double.
I am suppose to write a stocks program that takes in shares of stock, whole dollar portion of price and the fraction portion. And the fraction portion is to be inputted as two int values, and include a function definition with 3 int values.The function returns the price as a double.
#include <iostream>
using namespace std;
int price(int, int, int);
int main()
{
int dollars, numerator, denominator, price1, shares;
char ans;
do
{
cout<<"Enter the stock price and the number of shares.\n";
cout<<"Enter the price and integers: Dollars, numerator, denominator\n";
cin>>dollars>>numerator>>denominator;
cout<<"Enter the number of shares held\n";
cin>>shares;
cout<<shares;
price1 = price(dollars,numerator,denominator);
cout<<" shares of stock with market price of ";
cout<< dollars << " " << numerator<<'/'<<denominator<<endl;
cout<<"have a value of " << shares * price1<<endl;
cout<<"Enter either Y/y to continue";
cin>>ans;
}while (ans == 'Y' || ans == 'y');
system("pause");
return 0;
}
int price(int dollars, int numerator, int denominator)
{
return dollars + numerator/static_cast<double>(denominator);
}
Traits classes can be defined to check if a C++ class has a member variable, function or a type (see here).
Curiously, the ConceptTraits do not include traits to check if a C++ class defines a default constructor or given constructor?
Can traits be used to check the constructor presence?
If yes, how?
If not, why it is not possible?
Hi everyone, I'm trying to find an elegant way in Coffeescript to merge an array of arrays, so that [[1,2,3],[4,5,6],[7,8,9]] == [1,2,3,4,5,6,7,8,9].
As you might imagine, I need this because I'm generating arrays from a function in a "for in" construct and need to concatenate the resulting nested array:
result = (generate_array(x) for x in arr)
Is there an elegant way to handle this? Thanks for any pointers!
I have this code
$("#window").dialog({
resizable: true,
height: 180,
title: titles,
width: 500,
modal: false,
buttons: {
"OK": function () {
$(this).dialog("close");
}
}
});
i am able to get the popup perfectly but the problem I am getting here is..
On the top of the Dialog box I have 'X' I am not able to see that X on dialog popup's but when I resize my window I can able to see..
what I am doing wrong in this?
Thanks for your all help
i have seen this in php (symfony):
public function executeShow(sfWebRequest $request)
{
// logic
}
i didnt know that you could declare a datatype in php?
have i missed something?
could someone explain this.
thanks
What I'd like is for this class
class Car {
public function __construct(Engine $engine, Make $make, Model $model)
{
// stuff
}
}
Get an array that has the types needed to construct this car (Engine, Make, Model) in the order they are needed for the constructor. I'm using this for a Dependency Injection-esque thing I'm making.
Hey,
Is it possible to use jQuery on a new Window javascript object?
Example:
win = new Window();
jQuery(win).ready(function(){
do jQuery stuff on the new window here??
});
Is something like this possible?
It seems that JMenuItems don't automatically resize any image icon that's assigned to them, and from what I can tell, there isn't a property that makes them automatically do that, either.
Is anyone aware of a way that I can programatically resize the Icon for a JMenuItem? It seems like the Icon object is lacking functionality as it is, unless there's some other function that can actually deal with Icon objects.
How does Safari Reader work in Apple Safari 5? How do I enable Safari Reader on my site. How do I tell it what content on my page is an article to trigger this function?
I'm currently using the following code for thread-safe access of a variable.
int gnVariable;
void getVariableValue(int *pnValue)
{
acquireLock(); //Acquires the protection mechanism
*pnValue = gnVariable;
releaseLock(); //Releasing the protection mechanism
}
I would like to change my API signature to a more user-friendly
int getVariableValue(void);
How should I rewrite the function - such that the users of the API don't have to bother about the locking/unlocking details?
I'm trying to generate some sql files in my java application.
The application will not execute any sql statements, just generate a file with sql statements and save it.
I'd like to use the java.sql.PreparedStatement to create my statements so that i don't have to validate every string etc. with my own methods.
Is there a way to use the PreparedStatement without the calling java.sql.Connection.prepareStatement(String) function, because I don't have a java.sql.Connection?
I have a lot of div boxes with nested div .titles, with a button inside. Is there a way in jQuery to select the parent of the button?
Something like:
$("#button").click(function(){
$("this.parent").css({'border-bottom' : 'none'});
});
Or am I going to have to rename all of my title classes to unique classes?
I'm accessing an array by reference inside a foreach loop, but the unset() function doesn't seem to be working:
foreach ( $this->result['list'] as &$row ) {
if ($this_row_is_boring) {
unset($row);
}
}
print_r($this->result['list']); // Includes rows I thought I unset
Ideas? Thanks!
hello, i am trying to get the headers of an ajax request i made through jquery
$.get(url,
function(response, textStatus, headers ) {
console.log("Response: %o", response);
console.log("TextStatus: %o", textStatus);
console.log("Request: %o", headers);
}
);
this does not seem to be working however:
the response and textstatus are printing, but the "headers" object seems to be undefined
i simply want to check if it is what i expect (content type='excel', etc) or if the response type is html, i can assume the page i was calling is an error
Here's the code:
this.Form.find("input[type=checkbox]").click(function(event) {
if ($(this).is(":checked")) {
console.log("checked");
}
else {
console.log("unchecked");
}
});
If the checkbox is not checked, and I click with the mouse, I get "checked". If I trigger it programmatically like $("#someCheckbox").click(), I get "unchecked". How to make the two behave the same way?
Someone has suggested to me that the built in C# Math.Sqrt function in .NET 4.0 caches its results, so that if I call Math.Sqrt(50) over and over again, it's not actually doing a sqrt, but just pulling the answer from a cache. Can anyone verify or deny this claim? If it's true then I have a bunch of needless caching going on in my code.