It seems that every project has an "utility" module with various code snippets used throughout other files and which don't fit any particular pattern.
What utility classes, functions, and macros do you find most useful in your C/C++ projects? Please keep the entries small (under 100 lines) and give only one example per post.
Is it safe to read directory entries via readdir() or scandir() while files are being created/deleted in this directory? Should I prefer one over the other?
When I say "safe" I mean entries returned by these functions are valid and can be operated without crushing the program.
Thanks.
Can I share javascript libraries I've loaded in part of my website, with other components ?
For example, I'm loading a node of my drupal website into a lightbox (rel="lightmodal"), so it is not a frame.
I would like to have access from the content of the lightbox to qtip.js library (at the moment I'm using its functions but it doesn't find the library, so it doesn't work..)
thanks
I have a class defined called extBlock.
I then make an instance of that class with this
extBlock mainBlock = new extBlock(1, 1024);
I get this error:
error C2440: 'initializing' : cannot convert from 'extBlock *' to 'extBlock'
Can anyone help me with why I am getting this error.
I have seen examples online of declaring it like this with a pointer
extBlock *mainBlock = new extBlock(1, 1024);
But if I do it this way it does not let me call the functions of mainBlock
I'm using Masonry and Embedly plugin to display embedded content, I've put together an example in
jsfiddle.net/anir/pBtbb/3/
It appears the Masonry plugin loads first and it causes the overlapping problem (they only show correctly when you resize the result window) I've read that I could use callback functions or retrigger Masonry once embedly has finished rendering content, but I don't know how to do it. Can you help me? Is there any other solution to fix this?
Is there a built in equivalent to the .NET framework's DateAdd or AddMonths functions?
I'm looking for the easiest, cleanest way to add X month to a Javascript date.
I'd rather not handle the rolloing over of the year as done here.
or have to write my own function as done here.
Is there something built in that is as nice as the .NET Date.AddMonths function? Or something close?
Hello dear commmunity, good day!
I run a little site (now for several months ) that has users accessing big files, for
download as well for streaming to the browser.
It's fairly active, so assuming the worst, how bad is getting php to read the files that would be stored outside of the webroot and then getting it to echo it to a page dynamically for the browser to then read?
My question is: how bad is fread() etc in this context!?
zero
How can I find the (x,y) point of the center of the viewable area of the browser?
I am using jQuery, if there are any good jQuery helper functions for this.
How do I remove the numbers on the x-axis only not the y-axis?
Is it possible to shift the y-axis without shifting the functions? What I mean is, instead of having the y-axis at x = 0, could I have it at x = -5?
I have the web service and generated class for it. I can use this generated class in windows application as it described in Help. The question is: how can I use this generated class in the web project? (the analogous actions - creating object and use its functions -, as it was in windows app, are not worked)
I just wanted to develop a translation app in a Django projects which enables registered users with certain permissions to translate every single message it appears in latest version.
My question is, what character set should I use for database tables in this translation app? Looks like some european language characters cannot be stored in UTF-8?
I don't really understand the difference between the XPath functions name and local-name.
Could you give an example of a situation where they would differ?
Hi,
is there any good program for viewing functions / messages that are being executed on the .net framework in the background? i'm looking for something similar to what spy++ is doing, just for .NET only.
I have some weird behavior that i need to understand what causing it, and i don't think on any better alternative.
Thanks
Hello,
I am going through the process of trying to figure out how a library of code works. I would like some sort of tool that would analyze the program that I run off of the library and tells me what functions are called in what order by each thread. Does such a tool exist? What google terms would I use to find such a program?
Note: Using VS2008/Win7/C++
Hello,
Im writing app in haskell and I would like to export some functions and datatypes to other files and then be able to use them in my main file.
How to do this ?
thanks for help
I have a class A and another class that inherits from it, B. I am overriding a function that accepts an object of type A as a parameter, so I have to accept an A. However, I later call functions that only B has, so I want to return false and not proceed if the object passed is not of type B.
What is the best way to find out which type the object passed to my function is?
There are a number of tools available for synchronizing Tables, Indexes, Views, Stored Procedures and objects within a database. (We love RedGate here, and throw a lot of money their way).
However, I'm having a very difficult time finding tools that will help with Jobs, Logins and Linked Servers.
Do these things exist? Am I missing something obvious?
As part of my widget, I use an instance of the Camera object.
This is what I want to do. The user will click on my widget, I get an instance of the Camera(if it's not already stored), use it, then store it. If they click the widget again, I want to use that same instance that I used previously.
Is this possible?
i have put in my source code to show live twitter search result on my webpage.
Although it shows the search result but when i open the source code of my webpage it don't shows the tweets text in my source code.iT DYNAMICALLY LOADS IT I GUESS.
iS there a way out to fetch the content of div and write it with some functions like document.write or etc.
I'm iterating through a variable called content, it contains several HTMLLIElement objects.
How can i use jQuery's or JavaScript's functions with this object?, what I'm trying to do is the kind of validation written in the commented code.
$.each(content, function(index, value){
//if(!value.is(':hidden')){
console.log(index + ' : ' + value);
//}
});
What I'm getting is
Uncaught TypeError: Object # has no method 'is'
If I do value.getAttribute('style'); I get 'display: none;'
I've created a class that calls an object in the "__construct" how can i make this object available through out the class.
class SocialMedia { function __construct() { $object = "whatever"; } }
how can I access $object in the other funtions (which are static) from with in the class.
I've tried to use "$this-object" but I get an error "$this when not in object context" when I try to call it from my other static functions.
When I try to use "%~dp0" in batch files stored on remote servers, sometimes it takes a good 45 seconds for the path to resolve! I have a fast connection and doing other things with these remote servers is quick.
Is this normal? Is there any way around it? Any help would be greatly appreciated.