Hi all.
Problem: I have a pretty big structure with POD variables, and I need to copy around some fields, but not others. Too lazy to write down a member-by-member copy function.
Solution: move the copy-able fields to the base, assign the base. Like this:
struct A
{
int a, b, c;
};
struct B : public A
{
int d, e, f;
};
//And ...
I have a project which requires using user input to include files into a PHP script. The user input could be any relative URL (EX:/folder1/folder2/file.jpg, /folder1/folder2/)
Would the following be a fool-proof regexp to check if the input is sane:
if(preg_match('/^(\/[-_a-zA-Z0-9]+)+\/?$/D', $_GET['loc']))
{
//Location is good!
}...
I have a form wrapped in two separate div's in order to cause the upper portion of the form to be hidden until mouseover triggers a jQuery slideUP animation, revealing the second. Despite being a bit hack-ish, this works in all major browsers except IE7. Is there a way to make the lower portion of the form which is visible in the #top_m...
I have an html file that I need to take any tag and put an align='left' into it.
So given the line :
<td><img alt="" src="oooh.html_files/px" style="width: 20px; height: 1px;"/></td>
I need it to do :
<td align='left'><img alt="" src="oooh.html_files/px" style="width: 20px; height: 1px;"/></td>
If it already specifies an alig...
I'm using the following security(invisble captcha) for my site's form submission to prevent auto submission:
generate the result of md5 with a fixed salt on number x and render it
inside the form as a hidden field
generate 2 hidden fields a and b where a + b = x, a and b are
unencrypted
upon submission, use javascript to add another p...
I have a basic JsonResult method that is being called by a jQuery $.ajax call in my view.
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult DoWork(string param1)
{
// do something important
return Json();
}
So my question is, could this method be called/hacked and passed erroneous data? Let's say it wa...
I've tried jquery.pngFix.js and pngfix.js and neither seem to cater for all issues.
Any images that are anchored end up distorted with the former and the latter doesn't like positioned/repeating background images.
Unfortunately the design I'm working on calls for PNGs to be used in the way I have done, so I'm not really sure where to g...
Can we fetch fans of a particular page on Facebook? through PHP? if not is there any hack like, by becoming a fan of that page via PHP?
...
All index.php files on my website got hacked with the code injection in the body tag, see below. Does anyone know how they did it and if there is way to look for it how prevent it?
echo "<body><script language="javascript">try { function BwrLMVnkPmRbZYpfwLH(MLJOynjaY){var iMgpLZHO="",aVwbJg,oKONbIZB,gdGJUWTs,siAOty,hPaiwMZ,NxynbqCA,VxXq...
I'm writing a hack that sits in the system tray and corrects tablet pen input under very specific circumstances. I need to intercept only touch and pen input, test some conditions, and then translate the coordinates before the rest of the operating system sees the event. Is this possible? I'm willing to write a simple driver if I need to...
How could I call the constructor of a class with call_user_func_array
It is not possible to do :
$obj = new $class();
call_user_func_array(array($obj, '__construct'), $args);
because if the constructor has parameters, the new will fail.
Constraint : I do not control the classes that I have to instantiate, nor do I can modify them.
...
I have to build OEM versions of a COM library (DLL).
Does anyone know a tool (ressource hacker) which may replace some of my interface guids after build time?
I just want to build and test one DLL and generate the OEM versions afterwards.
...
Hi, I'm trying to position a button. I want it to be above the "Gå Videre" button on the page, it works in Safari and Chrome but not IE or FF.
#cartUpdate {
position:absolute;
width:160px;
height:30px;
left:580px;
bottom:50px;
}
And
{capture assign="cartUpdate"}
<div id="cartUpdate"><!--<input type="...
hello
I am working on a simple combinatorics part, and found that I need to recover position of two bits given position of other two bits in 4-bits srring.
for example, (0,1) maps to (2,3), (0,2) to (1,3), etc. for a total of six combinations.
My solution is to test bits using four nested ternary operators:
ab is a four bit string, wi...
So I just got my sorry ass hacked, the hack put some obscure string in almost every one of the php files on my website. How can I remove every instance that line occurs?
The code it added started with <?php so therefore I cannot simply replace it with blank, I need to delete it and move up the actual relevant code up one line as <?php c...
I have a C++ class I want to inspect. So, I would like to all methods print their parameters and the return, just before getting out.
The latter looks somewhat easy. If I do return() for everything, a macro
#define return(a) cout << (a) << endl; return (a)
would do it (might be wrong) if I padronize all returns to parenthesized (or w...
I want to extract the latitude and longitude of a set of about 50-100 pins in a Google maps web page. I don't control the page and I don't need to do it more than once so I'm looking for something quick and dirty. I've got FireFox with FireBug as well as Chrome and all I need is something that's easier than re typing all the numbers.
...
I have exhausted many options to implement the below design (link to page) in the ssrs parameter bar. Have learned painfully that it is not easy to customize design... Would someone perhaps have an ingenious hack? I really appreciate if someone can me implement the below design (image on another site) into ssrs.
http://www.freeimageh...
So, if you try to do a nested class like this:
//nestedtest.php
class nestedTest{
function test(){
class E extends Exception{}
throw new E;
}
}
You will get an error Fatal error: Class declarations may not be nested in [...]
but if you have a class in a separate file like so:
//nestedtest2.php
class neste...
Say we're writing a simple recursive function fib(n) that calculates the nth Fibonacci number. Now, we want the function to print that nth number. As the same function is being called repeatedly, there has to be a condition that allows only the root call to print. The question is: how to write this condition without passing any additiona...