text stringlengths 0 30.5k | title stringclasses 1
value | embeddings sequencelengths 768 768 |
|---|---|---|
I have an absolutely positioned `div` containing several children, one of which is a relatively positioned `div`. When I use a `percentage-based width` on the child `div`, it collapses to `0 width` on IE7, but not on Firefox or Safari.
If I use `pixel width`, it works. If the parent is relatively positioned, the perce... | [
0.36346691846847534,
0.13352739810943604,
0.38462021946907043,
-0.09144695103168488,
0.03362520784139633,
0.2223886251449585,
0.15952709317207336,
0.04703124985098839,
0.16300109028816223,
-0.9281088709831238,
-0.14638856053352356,
0.44247904419898987,
-0.10123006999492645,
-0.034093007445... | |
pixels or as a percentage. In Internet Explorer 7, the parent `div` needs a defined `width` for child percentage `div`s to work correctly. | [
0.15191926062107086,
-0.25587400794029236,
0.6354948878288269,
0.020723257213830948,
-0.0793287456035614,
0.21894772350788116,
-0.1288432627916336,
0.17382661998271942,
0.1672404408454895,
-0.7667054533958435,
-0.317180335521698,
0.36258769035339355,
0.08587139844894409,
0.2893849313259125... | |
Given a specific `DateTime` value, how do I display relative time, like:
* `2 hours ago`
* `3 days ago`
* `a month ago`
Jeff, [your code](https://stackoverflow.com/questions/11/how-do-i-calculate-relative-time/12#12) is nice but could be clearer with constants (as suggested in Code Complete).
```csharp
const int SECO... | [
0.24956881999969482,
-0.28400707244873047,
0.42697280645370483,
-0.10366053879261017,
0.26754510402679443,
0.18187139928340912,
0.29238608479499817,
-0.19562628865242004,
-0.29250016808509827,
-0.6917046904563904,
0.006741516292095184,
0.0965135395526886,
-0.013536662794649601,
0.218175485... | |
"a minute ago";
if (delta < 45 * MINUTE)
return ts.Minutes + " minutes ago";
if (delta < 90 * MINUTE)
return "an hour ago";
if (delta < 24 * HOUR)
return ts.Hours + " hours ago";
if (delta < 48 * HOUR)
return "yesterday";
if (delta < 30 * DAY)
return ts.Days + " days ago";
if (delta < 12 * MONTH)
{
in... | [
0.07253585755825043,
-0.07856756448745728,
0.476757287979126,
-0.11133746802806854,
0.3970925509929657,
0.3570560812950134,
0.104275643825531,
-0.2949689030647278,
-0.5174269676208496,
-0.6097415685653687,
-0.2055000513792038,
0.05089900642633438,
0.2416483759880066,
0.6006153225898743,
... | |
: years + " years ago";
}
``` | [
0.14279472827911377,
0.205266073346138,
0.1523635983467102,
-0.20425456762313843,
0.4491024613380432,
0.002300682943314314,
-0.1355222463607788,
0.21907761693000793,
-0.34782448410987854,
-0.19284705817699432,
-0.1489245742559433,
0.1278957575559616,
-0.008299010805785656,
0.71591150760650... | |
I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface.
How does one go about writing 'hooks' into their code so that plugins can attach to specific events?
You could use an Observer pattern. A simple functional way to accomplish t... | [
0.4421554505825043,
-0.005190020892769098,
0.4554086923599243,
-0.20815224945545197,
-0.07669562101364136,
-0.21639741957187653,
0.3228580951690674,
-0.03867804631590843,
-0.46694716811180115,
-0.5472612380981445,
0.0938263088464737,
0.47780320048332214,
-0.4415806829929352,
0.011794770136... | |
trigger_error("Insufficient arguments", E_USER_ERROR);
// Hook name should always be first argument
$hook_name = array_shift($args);
if(!isset($listeners[$hook_name]))
return; // No plugins have registered this hook
foreach($listeners[$hook_name] as $func) {
$args = $func($args);
... | [
0.07736250013113022,
0.02419062703847885,
0.5367022752761841,
-0.5781400203704834,
-0.24278901517391205,
0.13852280378341675,
0.09308016300201416,
-0.6947160363197327,
-0.057684529572725296,
-0.24940721690654755,
-0.16502289474010468,
0.7794996500015259,
-0.6423627734184265,
-0.08870970457... | |
5);
}
function my_plugin_func2($args) {
return str_replace('sample', 'CRAZY', $args[0]);
}
/////////////////////////
/** Sample Application **/
$a = 1;
$b = 2;
list($a, $b) = hook('a_b', $a, $b);
$str = "This is my sample application\n";
$str .= "$a + $b = ".($a+$b)."\n";
$str .= "$a * $b = ".($a*$b)."\n";
... | [
0.3754497468471527,
-0.0014767521061003208,
0.4796118438243866,
0.046504996716976166,
0.5728389024734497,
-0.2168828696012497,
0.3094688653945923,
-0.3971203565597534,
-0.18876153230667114,
0.22605222463607788,
-0.13674379885196686,
0.2720741033554077,
-0.7520964741706848,
0.12527422606945... | |
is writing the actual documentation which lists what arguments get passed to each hook.
This is just one method of accomplishing a plugin system in PHP. There are better alternatives, I suggest you check out the WordPress Documentation for more information. | [
0.5995470881462097,
0.017877129837870598,
-0.1137194111943245,
0.19938625395298004,
-0.04159931093454361,
-0.11741789430379868,
-0.16675151884555817,
-0.10620588809251785,
0.0985155925154686,
-0.3959710896015167,
0.3599050045013428,
0.7480803728103638,
-0.16251768171787262,
-0.344789922237... | |
I have a `DataTable` with a `Name` column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the *order by* clause.
```
var names =
(from DataRow dr in dataTable.Rows
orderby (string)dr["Name"]
select (string)dr["Name"]).Distinct();
```
Why does the `... | [
-0.016385691240429878,
0.16897258162498474,
0.4828588366508484,
0.02279658056795597,
-0.10589967668056488,
-0.024910246953368187,
-0.26169976592063904,
-0.3539438843727112,
-0.20900700986385345,
-0.5196703672409058,
-0.13767559826374054,
0.3121918737888336,
-0.42758598923683167,
0.40025031... | |
require
3. Finally, create an ordered list, from `x2` into `x3`, sorting by whatever you desire | [
-0.025671212002635002,
0.15197773277759552,
0.1261376589536667,
-0.01233804039657116,
-0.07477953284978867,
0.006084283348172903,
-0.1126895323395729,
-0.4853145480155945,
-0.21397222578525543,
-0.48161306977272034,
-0.39210954308509827,
0.17122229933738708,
-0.6176410913467407,
-0.2428212... | |
I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux).
I have implemented `QueryPerformanceCounter` by giving the uSeconds since the process start up:
```
BOOL QueryPerformanceCounter(LARGE_INTEGER* performanceCount)
{
gettimeofday(&... | [
0.3094436824321747,
-0.32023996114730835,
1.0692250728607178,
-0.19456009566783905,
0.12836454808712006,
-0.27462708950042725,
0.28511935472488403,
-0.38131383061408997,
0.024111630395054817,
-0.9511324763298035,
-0.24335724115371704,
0.8270329833030701,
-0.0969851091504097,
0.402014166116... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 11