text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I have an import-from-excel script as part of a CMS that previously ran without issue.
My shared-hosting provider has recently upgraded their infrastructure, including PHP from 5.1 to 5.2.6, and the script now returns "Uninitialized string offset: -XXX in /path/scriptname.php on line 27" (XXX being a decreasing number... | [
0.027814308181405067,
0.30730098485946655,
0.6322616338729858,
-0.30382251739501953,
-0.22999343276023865,
0.19731760025024414,
0.2216917872428894,
-0.07781311869621277,
-0.06759633123874664,
-0.6252352595329285,
0.16480013728141785,
0.6110274195671082,
-0.12286907434463501,
-0.12496980279... | |
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24);
}
```
It finally implodes with a "Fatal error: Allowed memory size of 47185920 bytes exhausted (tried to allocate 71 bytes) in /path/scriptname.php on line 133".
There's nothing useful in Apache error logs... | [
-0.17542533576488495,
0.27174365520477295,
0.6744039058685303,
-0.08837927877902985,
0.0995185449719429,
-0.04332837462425232,
0.8999716639518738,
-0.13123342394828796,
0.038166485726833344,
-0.34124693274497986,
0.012548303231596947,
0.5684821605682373,
-0.02929345890879631,
0.28749310970... | |
tmp directory (since resolved), but am pretty sure it's not that (?).
EDIT: As it turned out that the answer was to do with the version of the parser being incompatible in some way with PHP 5.2.6, I thought it might be of use to someone that the parser in question is [Spreadsheet Excel Reader](http://sourceforge.net/p... | [
0.3135230541229248,
-0.13886962831020355,
0.3434089124202728,
-0.126481831073761,
-0.06457670032978058,
0.1327117383480072,
0.16040603816509247,
-0.15985973179340363,
-0.37404727935791016,
-0.11615364998579025,
-0.12264728546142578,
0.6465431451797485,
-0.5395922660827637,
-0.1493190228939... | |
I'm currently passing the pid on the command line to the child, but is there a way to do this in the Win32 API? Alternatively, can someone alleviate my fear that the pid I'm passing might belong to another process after some time if the parent has died?
Notice that if the parent process terminates it is very possible a... | [
0.21532291173934937,
0.13945220410823822,
0.23943018913269043,
0.1183130145072937,
0.26291152834892273,
-0.09696195274591446,
0.11477405577898026,
0.0734005719423294,
-0.05960820987820625,
-0.5187788605690002,
-0.0007518387865275145,
0.25054723024368286,
-0.028151001781225204,
0.5157849788... | |
it and use that. | [
0.3735273480415344,
0.27068984508514404,
-0.1694885641336441,
0.16259600222110748,
-0.01279202289879322,
0.09044865518808365,
-0.06848026067018509,
-0.11350090056657791,
0.3387799561023712,
-0.5518182516098022,
0.3090674877166748,
0.6455061435699463,
0.1891709715127945,
0.1544598639011383,... | |
I would like to access a class everywhere in my application, how can I do this?
To make it more clear, I have a class somewhere that use some code. I have an other class that use the same code. I do not want to duplicate so I would like to call the same code in both place by using something. In php I would just includ... | [
0.1763005554676056,
0.2192743718624115,
-0.007513989694416523,
0.18600349128246307,
-0.1823945939540863,
-0.08735523372888565,
0.20953814685344696,
0.34180060029029846,
-0.4236583411693573,
-0.7011252641677856,
0.23207540810108185,
0.48658284544944763,
-0.3083793520927429,
0.20289796590805... | |
containing the class. Once you have reference the needed assembly, you can refer to the class of choice either by it's fully qualified Type name, or by importing the namespace that contains the class. (**Concrete instance or Static access** to that class)
Or
You can have a **Singleton class** to use it everywhere but... | [
0.1374819427728653,
-0.10395493358373642,
-0.1149936392903328,
0.11367961764335632,
-0.28708702325820923,
-0.15688319504261017,
0.002258781110867858,
-0.017824525013566017,
-0.1414661705493927,
-0.6940010190010071,
-0.2933405041694641,
0.29472827911376953,
-0.41461554169654846,
0.392589509... | |
I have some System.Diagnotics.Processes to run. I'd like to call the close method on them automatically. Apparently the "using" keyword does this for me.
Is this the way to use the using keyword?
```
foreach(string command in S) // command is something like "c:\a.exe"
{
try
{
using(p = Process.Start(c... | [
0.27312618494033813,
0.2911646366119385,
0.18312792479991913,
-0.29861247539520264,
0.22142846882343292,
0.007684710435569286,
0.19943149387836456,
-0.1478365659713745,
-0.2509921193122864,
-0.6694498062133789,
-0.07624954730272293,
0.4752509295940399,
-0.03953738510608673,
0.2160083800554... | |
catch (Exception e)
{
// notify of process failure
}
}
```
I'd like to start multiple processes to run concurrently.
```
using(p = Process.Start(command))
```
This will compile, as the `Process` class implements `IDisposable`, however you actually want to call the `Close` method.
Logic would have... | [
0.26110148429870605,
0.07431548833847046,
0.25664764642715454,
-0.04994363337755203,
0.15783573687076569,
-0.3243636190891266,
0.06324156373739243,
-0.1880805641412735,
-0.3274015486240387,
-0.36860695481300354,
0.13879132270812988,
0.5502902269363403,
-0.30302584171295166,
0.1123127639293... | |
releases the underlying native win32 process handle, and clears some member variables. This (releasing external resources) is *exactly* what the IDisposable pattern is supposed to do.
**However** I'm not sure if this is what you want to achieve here.
Releasing the underlying handles simply says to windows 'I am no lo... | [
0.25072893500328064,
-0.14698070287704468,
0.055229347199201584,
0.12831036746501923,
0.03869349882006645,
-0.49494117498397827,
0.28205180168151855,
0.15703138709068298,
-0.2570470869541168,
-0.5647215247154236,
-0.3594170808792114,
0.5776290893554688,
-0.4496266841888428,
0.1188913211226... | |
kill processes as they can't clean up after themselves, and may leave behind corrupt files, and so on.
If you want to wait for them to quit on their own, you could use `p.WaitForExit()` - however this will only work if you're waiting for one process at a time. If you want to wait for them all concurrently, it gets tri... | [
0.8310889601707458,
-0.3322996199131012,
-0.058273009955883026,
0.1845189929008484,
0.07016968727111816,
-0.06967556476593018,
-0.04645251855254173,
-0.07852007448673248,
-0.36198365688323975,
-0.37142083048820496,
0.03637061268091202,
0.40366771817207336,
-0.581498384475708,
0.27848619222... | |
those threads, but this is also the wrong way to do it.
You instead have to use p/invoke to access the native win32 `WaitForMultipleObjects` function.
Here's a sample (which I've tested, and actually works)
```
[System.Runtime.InteropServices.DllImport( "kernel32.dll" )]
static extern uint WaitForMultipleObjects( ui... | [
0.23357068002223969,
-0.19436033070087433,
0.4599018692970276,
-0.2476573884487152,
0.38615965843200684,
0.3243543803691864,
0.3314073383808136,
-0.21192601323127747,
-0.3527529537677765,
-0.5809127688407898,
-0.30710750818252563,
0.41890278458595276,
-0.2828767001628876,
0.401539921760559... | |
4'" ) };
// all started asynchronously in the background
var handles = procs.Select( p => p.Handle ).ToArray();
WaitForMultipleObjects( (uint)handles.Length, handles, true, uint.MaxValue ); // uint.maxvalue waits forever
}
``` | [
0.13521036505699158,
-0.25899338722229004,
1.1019119024276733,
-0.14025364816188812,
0.40666529536247253,
0.2727673053741455,
0.385175496339798,
-0.09671053290367126,
-0.4091302156448364,
-0.4389575123786926,
-0.4381487965583801,
0.4781600832939148,
-0.062104482203722,
0.4265783727169037,
... | |
While working on a C# app I just noticed that in several places static initializers have dependencies on each other like this:
```
static private List<int> a = new List<int>() { 0 };
static private List<int> b = new List<int>() { a[0] };
```
Without doing anything special that worked. Is that just luck? Does C# have... | [
0.025860391557216644,
0.15029357373714447,
0.11394128948450089,
-0.12806999683380127,
-0.16102081537246704,
0.28901582956314087,
0.5303277969360352,
-0.26457586884498596,
-0.46321481466293335,
-0.43729618191719055,
-0.15457215905189514,
0.4677220582962036,
-0.5625031590461731,
-0.018982173... | |
run the same (the test suit failed across the board and I didn't look further).
It seems to depend on the sequence of lines. This code works:
```
static private List<int> a = new List<int>() { 1 };
static private List<int> b = new List<int>() { a[0] };
```
while this code does not work (it throws a `NullReferenceExc... | [
0.05640050396323204,
-0.15540024638175964,
0.342347115278244,
-0.11408250778913498,
-0.06920350342988968,
-0.2381410002708435,
0.5170589089393616,
-0.4313443601131439,
-0.3494724929332733,
-0.3876214027404785,
0.01901933364570141,
0.6093374490737915,
-0.5784432888031006,
0.0793264284729957... | |
{
public static List<int> a = new List<int>() { B.b[0] };
}
public class B {
public static List<int> b = new List<int>() { A.a[0] };
}
```
and try to access them with this code:
```
try { Console.WriteLine(B.b); } catch (Exception e) { Console.WriteLine(e.InnerException.Message.); }
try { Console.WriteLine(A... | [
-0.13331766426563263,
-0.01485330332070589,
0.39591753482818604,
-0.17912016808986664,
0.16578535735607147,
0.062097616493701935,
0.3259114623069763,
-0.3691386282444,
-0.15595923364162445,
-0.49809741973876953,
-0.4180213510990143,
0.4103471636772156,
-0.496888667345047,
0.193025961518287... | |
constructor `A` and lefts field `a` with the default value (null). Since `a` is `null`, `b` can not also be initialized properly.
If we do not have cyclical dependencies, everything works fine.
---
EDIT: Just in case you didn't read the comments, [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet) provides ... | [
0.00928261037915945,
-0.00501242745667696,
0.04924117773771286,
-0.09193555265665054,
-0.1895405799150467,
0.015980826690793037,
0.24705374240875244,
-0.16074633598327637,
-0.41523104906082153,
-0.14913439750671387,
-0.17102256417274475,
0.2623048722743988,
-0.3345692753791809,
0.051060989... | |
I'm having problems structuring classes in the Model part of an MVC pattern in my Python app. No matter how I turn things, I keep running into circular imports. Here's what I have:
**Model/\_\_init\_\_p.y**
* should hold all Model class names so
I can do a "from Model import User"
e.g. from a Controller or a unit
tes... | [
0.05285850912332535,
-0.04416552558541298,
0.31982409954071045,
-0.054427698254585266,
-0.07691384106874466,
0.11242032051086426,
0.0596478208899498,
-0.32538604736328125,
-0.1849440485239029,
-0.5588024258613586,
0.1979103833436966,
0.5313243269920349,
-0.14102134108543396,
0.225830465555... | |
queries
* should inherit from base class common to all Model classes to share functionality (database persistency methods, parameter validation code etc.)
I have yet to see a real world Python app employing MVC, so my approach is probably un-Pythonic (and possibly a language-agnostic mess on top of that...) - any sugg... | [
0.24964965879917145,
0.24864338338375092,
0.231748566031456,
0.19835788011550903,
-0.37876924872398376,
0.17274263501167297,
0.4624059200286865,
-0.18584561347961426,
-0.169039785861969,
-0.389208048582077,
-0.06568491458892822,
0.520560622215271,
-0.4983406662940979,
0.01302366703748703,
... | |
an API (maybe object-oriented) to some physical persistence layer (such as DB-API 2.0). The Model classes, like User, use the Database layer to load and save their state. There is no reason for the Database.py class to import all the Model classes, and in fact you wouldn't want that because you'd have to modify Databas... | [
0.22534815967082977,
-0.14087878167629242,
0.03191079944372177,
0.2230139821767807,
-0.09457343071699142,
-0.09370148181915283,
0.12376461923122406,
-0.012447614222764969,
-0.1436365842819214,
-0.5640214681625366,
0.08798685669898987,
0.27691105008125305,
-0.46517565846443176,
0.2419604957... | |
In ASP.NET, I have an XML file (within my project) that I would like to deserialize. FileStream objects do not allow you to open a file via URL.
What is the easiest way to open the file so that I can deserialize it?
There is an inconsistency in your specification. You say Database.py needs to import all Model classes... | [
0.3834582269191742,
-0.1183202862739563,
0.21608152985572815,
0.04226985201239586,
-0.2846730947494507,
-0.1537260115146637,
0.09224793314933777,
-0.11450040340423584,
-0.3132472634315491,
-0.7931350469589233,
0.04049249365925789,
0.25992292165756226,
-0.30057692527770996,
0.23627854883670... | |
The Model classes, like User, use the Database layer to load and save their state. There is no reason for the Database.py class to import all the Model classes, and in fact you wouldn't want that because you'd have to modify Database.py each time you created a new Model class - which is a code smell. | [
0.29309964179992676,
-0.06674949079751968,
-0.02214762568473816,
0.2686983644962311,
-0.2212580293416977,
-0.22469046711921692,
0.07658067345619202,
0.1328883320093155,
0.08980929851531982,
-0.7067292332649231,
0.14493879675865173,
0.3037967383861542,
-0.34848934412002563,
0.41473418474197... | |
There's a lot of interest these days in Erlang as a language for writing parallel programs on multicore. I've heard people argue that Erlang's message-passing model is easier to program than the dominant shared-memory models such as threads.
Conversely, in the high-performance computing community the dominant paralle... | [
0.2066827118396759,
0.11588705331087112,
0.01467584166675806,
0.28345170617103577,
-0.37265026569366455,
-0.09331684559583664,
-0.13412639498710632,
0.3267214596271515,
-0.6488101482391357,
-0.5374453663825989,
0.09604088962078094,
0.22954696416854858,
-0.5237885117530823,
0.21706531941890... | |
in the perception of message-passing vs. shared memory in the IT and HPC worlds? Is it due to some fundamental difference in how Erlang and MPI implement message passing that makes Erlang-style message-passing much easier than MPI? Or is there some other reason?
I agree with all previous answers, but I think a key poin... | [
-0.17627568542957306,
0.022524671629071236,
-0.08047907054424286,
0.3761538565158844,
-0.27005377411842346,
-0.05395819619297981,
-0.2242094725370407,
0.05249369144439697,
-0.4558734595775604,
-0.5826210975646973,
0.11060106009244919,
0.8412653803825378,
-0.2621932327747345,
-0.29517808556... | |
form of global database that all threads can get to. It is designed for applications that do not move a whole lot of data around, and that is not supposed to explode out to a 100k separate nodes that need coordination.
MPI is based on local memory and message passing, and is intended for problems where moving data aro... | [
-0.12304390966892242,
-0.22964252531528473,
0.21336360275745392,
0.4229569435119629,
-0.07454778999090195,
-0.1380917727947235,
-0.027827799320220947,
-0.1614055335521698,
-0.62850421667099,
-0.7000905871391296,
0.07203666865825653,
-0.060133304446935654,
-0.6797166466712952,
0.09155948460... | |
to be explicitly distributed with balancing in mind. Essentially, MPI can be viewed as a grudging admittance that shared memory does not scale. And it is targeting high-performance computation spread across 100k processors or more.
Erlang is not trying to achieve the highest possible performance, rather to decompose ... | [
0.1098909080028534,
-0.3253798484802246,
0.14081646502017975,
0.3026720881462097,
-0.11386562138795853,
-0.0837872102856636,
-0.12228039652109146,
-0.32318994402885437,
-0.6849611401557922,
-0.6145932674407959,
0.20231571793556213,
-0.004177422728389502,
-0.7203418016433716,
-0.03294330090... | |
extent inherently harder) problem set. | [
-0.05437017232179642,
-0.08488072454929352,
0.46772170066833496,
0.22939330339431763,
-0.18102942407131195,
-0.1452288180589676,
0.2547191381454468,
-0.5090752243995667,
-0.08144980669021606,
-0.6355081796646118,
-0.544526994228363,
0.9418314695358276,
0.07309151440858841,
-0.0046643102541... | |
What's a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time?
Here's an implementation that uses a *lockfile* and echoes a PID into it. This serves as a protection if the process is killed before removing the *pidfile*:
```
LOCKFILE=/tmp/lock.txt
if [ -e ${LOCKFILE} ] &... | [
0.5582325458526611,
-0.004976479336619377,
0.31014156341552734,
-0.1404564380645752,
0.39582717418670654,
-0.24107807874679565,
0.4311828911304474,
-0.42193078994750977,
-0.15151742100715637,
-0.2714647650718689,
0.03531855717301369,
0.7094494104385376,
-0.3107201159000397,
0.1195170879364... | |
-0` which doesn't deliver any signal but just checks if a process with the given PID exists. Also the call to `trap` will ensure that the *lockfile* is removed even when your process is killed (except `kill -9`). | [
0.29880669713020325,
-0.13693279027938843,
0.3148422837257385,
0.12333711236715317,
0.13797010481357574,
-0.04163985326886177,
0.17523372173309326,
-0.239554762840271,
-0.15619057416915894,
-0.08559714257717133,
-0.33014151453971863,
0.3482595384120941,
-0.7126708030700684,
0.2966417968273... | |
Assuming I have three tables :
TableA (key, value)
TableB (key, value)
TableC (key, value)
and I want to return a value for all keys. If the key exists in TableC return that value else if the key exists in B return that value else return the value from table A
The best I have come up with so far is
```
SELECT key,Va... | [
-0.3050246238708496,
0.028030812740325928,
0.3006916642189026,
-0.3162935972213745,
0.06762072443962097,
0.2009468823671341,
-0.0036673475988209248,
-0.540626585483551,
0.17008323967456818,
-0.8416064381599426,
0.1239200010895729,
0.7608150839805603,
-0.12205637246370316,
-0.37895524501800... | |
more concrete example. Consider TableA as a standard work schedule where the key is a date and the value is the assigned shift. Table B is a statutory holiday calendar that overrides the standard work week. Table C is an exception schedule that is used to override the other two schedules when someone is asked to come i... | [
0.4564743638038635,
-0.05625331774353981,
0.3119674324989319,
-0.06225050240755081,
0.03827008605003357,
-0.1321191042661667,
-0.0987953394651413,
-0.11906104534864426,
-0.5604856014251709,
-0.3142063319683075,
-0.051902029663324356,
0.12234006077051163,
-0.21923299133777618,
0.06465402990... | |
Server 2005 - changes may be needed for your SQL dialect.
First, some DDL to set the stage:
```
CREATE TABLE [dbo].[StandardSchedule](
[scheduledate] [datetime] NOT NULL,
[shift] [varchar](25) NOT NULL,
CONSTRAINT [PK_StandardSchedule] PRIMARY KEY CLUSTERED
( [scheduledate] ASC ));
CREATE TABLE [dbo].[Holi... | [
-0.5367615818977356,
-0.10966431349515915,
0.7218813896179199,
-0.14091157913208008,
-0.4933886229991913,
-0.14898668229579926,
0.670422375202179,
-0.13436630368232727,
-0.08361219614744186,
-0.3884727656841278,
-0.2385799139738083,
0.29297545552253723,
-0.3278616964817047,
0.1606907695531... | |
('2008.01.08', 'ExceptionShift2');
INSERT INTO ExceptionSchedule VALUES ('2008.01.10', 'ExceptionShift3');
INSERT INTO HolidaySchedule VALUES ('2008.01.01', 'HolidayShift1');
INSERT INTO HolidaySchedule VALUES ('2008.01.06', 'HolidayShift2');
INSERT INTO HolidaySchedule VALUES ('2008.01.09', 'HolidayShift3');
INSERT IN... | [
-0.3851913511753082,
0.2772739827632904,
0.6075736880302429,
0.3213694393634796,
0.12142921984195709,
0.3326210081577301,
0.21803265810012817,
-0.3313269317150116,
-0.1277392953634262,
-0.431172251701355,
-0.48479560017585754,
0.08379723131656647,
0.020229343324899673,
0.2118569016456604,
... | |
s.scheduledate = h.holidaydate
FULL OUTER JOIN exceptionschedule e ON h.holidaydate = e.exceptiondate
FULL OUTER JOIN exceptionschedule e2 ON s.scheduledate = e2.exceptiondate
ORDER BY shiftdate
``` | [
0.12075440585613251,
-0.1150793582201004,
0.5655156970024109,
0.022784963250160217,
0.181062251329422,
-0.18093444406986237,
0.39142173528671265,
0.007698914967477322,
-0.41952452063560486,
-0.5191761255264282,
-0.604602575302124,
-0.09894789010286331,
-0.3828457295894623,
0.24895963072776... | |
Is it possible to do something like this?
```
var pattern = /some regex segment/ + /* comment here */
/another segment/;
```
Or do I have to use new `RegExp()` syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.
Here is how to create a regular express... | [
0.25385937094688416,
-0.21583950519561768,
0.3344595730304718,
0.06008155271410942,
-0.10839296132326126,
-0.05419791862368584,
0.2921038866043091,
-0.22746144235134125,
-0.13122111558914185,
-0.36111879348754883,
-0.18133386969566345,
0.6350967884063721,
-0.4029502868652344,
-0.1025324389... | |
segment_part + /* that was defined just now */
"another segment");
```
If you have two regular expression literals, you can in fact concatenate them using this technique:
```
var regex1 = /foo/g;
var regex2 = /bar/y;
var flags = (regex1.flags + regex2.flags).split("").sort().join("").replace(/(.)(?=.*\... | [
0.06459388881921768,
-0.23346345126628876,
0.5308483242988586,
-0.2378666251897812,
-0.11455295979976654,
0.24599197506904602,
0.1294032335281372,
-0.30678170919418335,
-0.19533443450927734,
-0.2962760627269745,
-0.2456931471824646,
0.4173722565174103,
-0.2507348656654358,
0.06359982490539... | |
I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE statement, if possible.
A little hacky but should work:
```
SELECT DATENAME(month, DATEADD(month, @mydate-1, CAST('2008-0... | [
0.13766169548034668,
0.16957786679267883,
0.4819357097148895,
0.02363981306552887,
0.10357438772916794,
0.2250537872314453,
0.002607763046398759,
0.43341532349586487,
-0.36388248205184937,
-0.2952916920185089,
0.16408878564834595,
-0.20991553366184235,
0.23160266876220703,
0.31732806563377... | |
I run into similar codes like this all the time in aspx pages:
```
<asp:CheckBox Runat="server" ID="myid" Checked='<%# DataBinder.Eval(Container.DataItem, "column").Equals(1) %>'>
```
I was wondering what other objects I have access to inside of that <%# %> tag. How come DataBinder.Eval() and Container.DataItem are ... | [
0.08537472039461136,
-0.0360351987183094,
0.39732638001441956,
0.06907198578119278,
-0.2519938349723816,
-0.018238157033920288,
0.2521088719367981,
-0.15428248047828674,
-0.47132447361946106,
-0.6062149405479431,
-0.23781780898571014,
0.16867168247699738,
-0.2663491368293762,
0.16099019348... | |
etc. So you can actually access it in code behind within your ItemDataBound events as *e.Item* (e normally being the event arguments parameter name).
*DataBinder* is also accessible in code behind by using *System.Web.UI.DataBinder*.
On a side note, casting the Container.DataItem is preferred over using Eval. Eval us... | [
0.2870802879333496,
-0.20277580618858337,
0.34449049830436707,
0.12317587435245514,
-0.4401859641075134,
-0.11521445214748383,
0.02135888673365116,
0.010023137554526329,
-0.37293127179145813,
-0.5200949311256409,
-0.1370607316493988,
0.34371283650398254,
0.024335864931344986,
0.17328421771... | |
What is the largest heap you have personally used in a managed environment such as Java or .NET? What were some of the performance issues you ran into, and did you end up getting a diminishing returns the larger the heap was?
I work on a 64-bit .Net system that typically uses 9-12 GB, and sometimes as much as 20GB. I h... | [
0.05296579748392105,
-0.06342200934886932,
-0.27045491337776184,
0.13938435912132263,
-0.2479637712240219,
-0.12163519859313965,
-0.03573757782578468,
0.21078762412071228,
-0.5689961910247803,
-0.6895759701728821,
0.03968600556254387,
0.282958984375,
-0.29621225595474243,
0.001642458722926... | |
that freed up 3GB+. Even then, there was no noticeable impact on performance. The system is running on a 16-core server with 32GB RAM, which probably helps... | [
-0.0015508155338466167,
0.1717355102300644,
0.45019927620887756,
0.06597556173801422,
-0.17296987771987915,
-0.024839429184794426,
0.2675854563713074,
-0.019588155671954155,
-0.3561696410179138,
-0.4593839943408966,
0.02077723853290081,
0.3788415789604187,
-0.13408440351486206,
0.143222913... | |
Does there exist a parser that generates an AST/parse tree at runtime? Kind of like a library that would accept a string of EBNF grammar or something analogous and spit out a data structure?
* I'm aware of antlr, jlex and their ilk. They generate source code which could do this. (like to skip the compile step)
* I'm ... | [
0.46345216035842896,
0.24673962593078613,
-0.05470157414674759,
0.21484744548797607,
-0.44940391182899475,
-0.20291753113269806,
0.5656118988990784,
0.19462262094020844,
-0.3687334954738617,
-0.4227495789527893,
-0.042908988893032074,
0.6109380722045898,
-0.07187448441982269,
-0.3629661798... | |
is hardcoded)
* I'm not aware of anything in python or ruby, although a compiler compiler might very well be effective in such a language...
Now I'm aware of parser combinators. (thanks, Jonas) And some libraries (thanks eliben)
incidentally, I also noticed [Parsing Expression Grammars](http://en.wikipedia.org/wiki/P... | [
0.13144658505916595,
0.37340274453163147,
-0.14733147621154785,
0.12576182186603546,
-0.4969266951084137,
-0.149073988199234,
0.5556211471557617,
0.23194947838783264,
-0.28778114914894104,
-0.43935590982437134,
-0.32058125734329224,
0.3897590637207031,
-0.5098738670349121,
-0.1650645136833... | |
the [parsec documentation](http://legacy.cs.uu.nl/daan/download/parsec/parsec.html):
> Combinator parsers are written and used within the same programming language as the rest of the program. There is no gap between the grammar formalism (Yacc) and the actual programming language used (C)
>
>
> Parsers are first-cla... | [
-0.004554022569209337,
0.37173640727996826,
0.09761406481266022,
0.1336154192686081,
-0.32440507411956787,
0.026386942714452744,
0.22667406499385834,
-0.20526432991027832,
-0.19449317455291748,
-0.4373650848865509,
-0.5545617341995239,
0.6028206944465637,
-0.46145734190940857,
-0.318560779... | |
I have a function that is declared and defined in a header file. This is a problem all by itself. When that function is not inlined, every translation unit that uses that header gets a copy of the function, and when they are linked together there are duplicated. I "fixed" that by making the function inline, but I'm afr... | [
0.4427112936973572,
0.12153986841440201,
0.14481204748153687,
0.032897572964429855,
-0.12898394465446472,
-0.3244580924510956,
0.26103055477142334,
0.18844182789325714,
-0.0968262329697609,
-0.18139532208442688,
0.13268478214740753,
0.6122021079063416,
-0.5143412351608276,
0.47769665718078... | |
inside this function? How many copies do I end up with?
I guess you're missing something, here.
static function?
----------------
Declaring a function static will make it "hidden" in its compilation unit.
> A name having namespace scope (3.3.6) has internal linkage if it is the name of
>
>
> — a variable, function... | [
0.11564464122056961,
-0.12667147815227509,
0.28740230202674866,
-0.13274693489074707,
-0.06980875134468079,
-0.1357397586107254,
0.35521939396858215,
0.055258046835660934,
-0.4214719831943512,
-0.04504850134253502,
-0.10749245434999466,
0.4882899820804596,
-0.7214995622634888,
0.4310696721... | |
function in a header, then all the compilation units including this header will have their own copy of the function.
The thing is, if there are static variables inside that function, each compilation unit including this header will also have their own, personal version.
inline function?
----------------
Declaring it... | [
0.1828131079673767,
-0.09672542661428452,
0.3708363175392151,
-0.008978418074548244,
-0.4209006428718567,
-0.005845595151185989,
0.19188836216926575,
-0.05198786407709122,
0.08349654823541641,
-0.3303370773792267,
0.09669165313243866,
0.552595853805542,
-0.7277293801307678,
-0.028183011338... | |
that inline substitution of the function body at the point of call is to be preferred to the usual function call mechanism. An implementation is not required to perform this inline substitution at the point of call; however, even if this inline substitution is omitted, the other rules for inline functions defined by 7.... | [
0.12276506423950195,
-0.06427755206823349,
0.3181535005569458,
0.03267090767621994,
-0.22019833326339722,
-0.06722038239240646,
0.14914728701114655,
-0.15253782272338867,
-0.04544759914278984,
-0.25946828722953796,
-0.022189240902662277,
0.7139876484870911,
-0.5894898176193237,
-0.07750243... | |
reason).
For static variables declared inside, the standard specifically says there one, and only one of them:
> A static local variable in an extern inline function always refers to the same object.
>
>
> 7.1.2/4 - C++98/C++14 (n3797)
(functions are by default extern, so, unless you specifically mark your functio... | [
-0.22741800546646118,
-0.25760629773139954,
0.5791274905204773,
-0.036109331995248795,
-0.0385882668197155,
-0.3392077088356018,
0.43831464648246765,
-0.055762775242328644,
-0.25613030791282654,
-0.1743575483560562,
-0.2752571403980255,
0.5589492917060852,
-0.7110286355018616,
0.1086268052... | |
static storage duration (i.e. it is global, but its construction and destruction obey to specific rules).
static + inline?
----------------
Mixing inline and static will then have the consequences you described (even if the function is inlined, the static variable inside won't be, and you'll end with as much static v... | [
0.13495826721191406,
-0.3049030601978302,
0.37501955032348633,
0.1869480013847351,
-0.43008217215538025,
-0.03430343419313431,
0.06480003893375397,
-0.002038148697465658,
-0.48021990060806274,
-0.1487526297569275,
0.1407136172056198,
0.6430438756942749,
-0.22679400444030762,
0.147067964076... | |
These are the results:
>
>
> When the function is merely "inline", there is only one copy of the static variable.
>
>
> When the function is "static inline", there are as many copies as there are translation units.
>
>
> The real question is now whether things are supposed to be this way, or if this is an idiosyn... | [
0.25273847579956055,
0.08822121471166611,
0.17329318821430206,
-0.1579948216676712,
0.007247668690979481,
-0.1261053830385208,
0.2500464618206024,
-0.1075725108385086,
-0.10737323760986328,
-0.48458167910575867,
-0.009771945886313915,
1.0022969245910645,
-0.4756879508495331,
0.212790682911... | |
meaning that only the function it is declared inside can reach it.
Inlining the function won't change anything:
```
inline void doSomething()
{
static int value ;
}
```
There will be only one hidden global variable. The fact the compiler will try to inline the code won't change the fact there is only one global ... | [
0.17061153054237366,
-0.041524726897478104,
0.4705398380756378,
-0.11401260644197464,
0.06900359690189362,
0.0792229175567627,
0.2953404188156128,
-0.13267339766025543,
-0.28109368681907654,
-0.41250985860824585,
-0.17075075209140778,
0.79100102186203,
-0.6200155019760132,
0.16590932011604... | |
private copy of global hidden variable, thus as much variables as there are compilation units including the header.
Adding "inline" to a "static" function with a "static" variable inside:
```
inline static void doSomething()
{
static int value ;
}
```
has the same result than not adding this "inline" keyword, as... | [
0.12023668736219406,
-0.12405696511268616,
0.37249258160591125,
-0.04862992465496063,
-0.13187220692634583,
-0.028276070952415466,
0.3207206428050995,
-0.18247006833553314,
0.04289665445685387,
-0.29904988408088684,
-0.03757495433092117,
0.9727604389190674,
-0.6059099435806274,
0.094674021... | |
What are some useful Oracle optimizations one can use for an Application that mostly writes (updates) to an Oracle database?
The general usage pattern here is not web-serving or logging, as is most cases, but instead to persist complex state of a system, so the only times reading is needed is when the system starts u... | [
0.3751298487186432,
0.1263769567012787,
0.26565834879875183,
0.34282419085502625,
-0.03078540228307247,
-0.03428221121430397,
0.31028714776039124,
-0.05166570097208023,
-0.12823781371116638,
-0.5240710377693176,
0.3312174081802368,
0.758140504360199,
-0.14182931184768677,
-0.19042725861072... | |
best method of identifying bottlenecks.
In particular:
* lookout for redo waits. The redo log is critical in maintaining a high write rate
* Use bind variables
* Use bulk operations wherever possible.
* Watch for index contention where multiple processes insert records into a single table having an index on a sequenc... | [
-0.023206045851111412,
0.16543890535831451,
0.145619735121727,
0.1545829176902771,
0.39643022418022156,
-0.23584581911563873,
0.2210247665643692,
-0.1040106937289238,
-0.5039677023887634,
-0.8001724481582642,
-0.13874831795692444,
0.5253347158432007,
-0.06362398713827133,
-0.10726068168878... | |
I have a ListBox with a bunch of images in it (done through a datatemplate). The images are created by setting the items source:
```
<Image x:Name="ItemImage" Source="{Binding ImageUrl}"/>
```
and then they are cleared by using the listbox's Items.Clear() method. New Images are added by using the Items.Add method o... | [
0.33934375643730164,
-0.04219206050038338,
0.8319544196128845,
0.0795038715004921,
-0.0818503275513649,
0.3502195179462433,
0.11758972704410553,
-0.14057093858718872,
-0.4228825271129608,
-0.8268367648124695,
0.0026023578830063343,
0.21130141615867615,
-0.15914158523082733,
0.1479527801275... | |
memory that all these images are using?
**EDIT**: One thing I forgot to mention, the images (which are about 4-5k each in size) are being loaded over the network. Is caching somehow responsible for this? Displaying 12 Images chews up about 10 Megs of memory, which is about 100X filesize.
Monitoring of the system healt... | [
0.3725699186325073,
-0.03146359696984291,
0.40404877066612244,
0.21538743376731873,
-0.17239873111248016,
0.03989028185606003,
0.5133085250854492,
-0.1299462467432022,
-0.5824015736579895,
-0.7647371888160706,
0.04637317359447479,
0.5114495754241943,
-0.11676273494958878,
-0.22197784483432... | |
into a single table having an index on a sequence-derived column | [
-0.3249680995941162,
0.08191533386707306,
0.3614201545715332,
0.04285530373454094,
0.11907622963190079,
0.27132245898246765,
-0.18619920313358307,
-0.17263440787792206,
-0.23710079491138458,
-0.5166743397712708,
-0.3656977713108063,
-0.47614243626594543,
-0.4109819531440735,
0.357199966907... | |
I'm using the [zlib.NET](http://www.componentace.com/zlib_.NET.htm) library to try and inflate files that are compressed by zlib (on a Linux box, perhaps). Here's what I'm doing:
```
zlib.ZInputStream zinput =
new zlib.ZInputStream(File.Open(path, FileMode.Open, FileAccess.Read));
while (stopByte != (data = zinpu... | [
0.1440543681383133,
0.025613294914364815,
0.5240808725357056,
-0.16620275378227234,
0.02250666916370392,
-0.24435435235500336,
0.244972363114357,
-0.07262743264436722,
-0.1992177665233612,
-0.7324051260948181,
-0.0359288714826107,
0.7243431210517883,
-0.42228496074676514,
0.224714726209640... | |
I use ListBox to show Images.
However I found if the Listbox contain more than 1000 Image Items, It is really slow if I want to zoom the thumbnails.
I asked the qestion in
[In a WPF ListBox with more than 1000 Image Items the Zoom Images become slow](https://stackoverflow.com/questions/181845/in-a-wpf-listbox-with-more... | [
0.3143511414527893,
-0.0778234452009201,
0.5588477253913879,
0.08510366827249527,
-0.29161375761032104,
-0.05195104330778122,
0.43234652280807495,
-0.21942578256130219,
-0.18530499935150146,
-0.6402284502983093,
0.348039835691452,
0.4301794171333313,
-0.2853555381298065,
0.0186760686337947... | |
can load another 100 images while users do not know it(without pause when change page).
How do I write such a custom listbox?
Read my response [here](https://stackoverflow.com/questions/181845/in-a-wpf-listbox-with-more-than-1000-image-items-the-zoom-images-become-slow#186187). You need to implement a VirtualizingWrap... | [
0.35446614027023315,
-0.41492941975593567,
0.7085431814193726,
0.2932574450969696,
-0.09090923517942429,
-0.3560734987258911,
0.31899383664131165,
-0.13431714475154877,
-0.564134418964386,
-0.7482026815414429,
-0.1579681634902954,
0.5410237312316895,
-0.12868095934391022,
-0.01202764548361... | |
What is the best way to initialize a private, static data member in C++? I tried this in my header file, but it gives me weird linker errors:
```
class foo
{
private:
static int i;
};
int foo::i = 0;
```
I'm guessing this is because I can't initialize a private member from outside the class. So what's t... | [
-0.0924156904220581,
0.03386228159070015,
0.009440266527235508,
-0.07845725864171982,
-0.08741232752799988,
-0.21297301352024078,
-0.046340178698301315,
-0.13175496459007263,
-0.11417355388402939,
-0.1956247091293335,
-0.260367214679718,
0.3785305917263031,
-0.4305298626422882,
0.198682188... | |
int i;
};
```
But the initialization should be in source file.
File: foo.cpp
```
int foo::i = 0;
```
If the initialization is in the header file then each file that includes the header file will have a definition of the static member. Thus during the link phase you will get linker errors as the code to initiali... | [
-0.1890539973974228,
0.14227372407913208,
0.25132498145103455,
-0.26075950264930725,
-0.04982875660061836,
-0.023925727233290672,
0.24895228445529938,
-0.2369135320186615,
-0.11449822783470154,
-0.23263244330883026,
-0.3223206102848053,
0.3812749683856964,
-0.5818784236907959,
0.1828896850... | |
[since C++20], `char16_t`, `char32_t`, `wchar_t`, `short`, `int`, `long`, `long long`, or any implementation-defined extended integer types, including any signed, unsigned, and cv-qualified variants.*). You can then declare and initialize the member variable directly inside the class declaration in the header file:
``... | [
0.12882548570632935,
0.06114579364657402,
0.2800045907497406,
-0.4183761477470398,
0.13082128763198853,
-0.031596601009368896,
-0.10978425294160843,
-0.11535648256540298,
0.00857937429100275,
0.012393799610435963,
-0.39984261989593506,
0.5719924569129944,
-0.4347258508205414,
0.24678206443... | |
I am starting my first independent for profit venture. I am having a hard time deciding what language to use. I want to write my app in Perl, but I don't think it will be simple enough to compile. If I don't write it in Perl I will write it in C++.
The application will have many features, including [wxwidgets](http://... | [
0.5136867761611938,
0.2688731551170349,
0.31058770418167114,
0.020927755162119865,
-0.062134597450494766,
0.050953496247529984,
0.1855531483888626,
-0.11949349194765091,
-0.05614904686808586,
-0.6017051935195923,
-0.07209987193346024,
0.5497404336929321,
-0.3090243339538574,
-0.06378072500... | |
should I use C++ over Perl?
---
Edit:
Some of my project specifications.
* Multi Platform. I am expecting 50% or more of my users to own macs, with Most of the rest being Windows users. If possible I also want to support Linux since It is my everyday operating system.
* Since it's multi Platform I need a unified GUI... | [
0.26438236236572266,
0.1592005044221878,
0.329405814409256,
0.24840840697288513,
0.034616537392139435,
-0.1825045943260193,
0.1603536605834961,
0.032972902059555054,
-0.31958168745040894,
-0.7676662802696228,
-0.0483764111995697,
0.85837721824646,
-0.29247039556503296,
-0.18525585532188416... | |
properties of the audio files; things like tempo, patterns, and so on.
* I would like but don't require SDL/OpenGL support.
Everything else is pretty mundane. Some different classes and containers. A few custom GUI controls.
Why not use a hybrid of both? It's generally the way a lot of development is going these days.... | [
0.47191721200942993,
-0.017309056594967842,
0.17100407183170319,
0.21755391359329224,
-0.23618188500404358,
-0.158280611038208,
-0.0936068445444107,
0.028013229370117188,
-0.21884721517562866,
-0.6170498728752136,
0.08139803260564804,
0.9614676833152771,
-0.22085535526275635,
-0.0115027902... | |
Using the Qt Visual studio integration, adding a new Qt class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be identical.
On the other hand when adding a UI class, the uic.exe generate... | [
0.3944481313228607,
-0.3736567199230194,
0.19189777970314026,
0.11333104223012924,
-0.043687187135219574,
-0.15381716191768646,
0.04465346410870552,
-0.14915351569652557,
-0.02463275007903576,
-0.9161646962165833,
-0.18789830803871155,
0.7423093914985657,
-0.5277878642082214,
0.25286039710... | |
are needed because the moc output is generated from user-defined source code. So the moc output might be different between debug and release builds if the preprocessed class source differs between debug and release (for example, a signal that exists only in the debug build).
This doesn't apply to the uic-generated fil... | [
0.4293114244937897,
0.1524181216955185,
0.3344747722148895,
-0.08265805244445801,
0.29190126061439514,
-0.21475672721862793,
0.02067996747791767,
-0.3372530937194824,
-0.15979275107383728,
-0.5517405867576599,
-0.5448417067527771,
0.6902817487716675,
-0.34588757157325745,
-0.07570644468069... | |
I have a production server running with the following flag: -**XX:+HeapDumpOnOutOfMemoryError**
Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful information from it.
Any ideas?
If you ... | [
0.33405032753944397,
0.3406289517879486,
-0.12733285129070282,
-0.055425725877285004,
-0.3338830769062042,
-0.07439315319061279,
0.13600146770477295,
0.12918415665626526,
-0.2464534044265747,
-0.5881842970848083,
0.1594567745923996,
0.2528377175331116,
-0.09245820343494415,
0.0996112972497... | |
SELECT toString(firstName) FROM com.yourcompany.somepackage.User
Totally brilliant. | [
0.02699955552816391,
-0.16009075939655304,
0.15886515378952026,
0.005485258065164089,
0.1737324446439743,
-0.11103099584579468,
-0.19733209908008575,
0.4347343146800995,
-0.12323217839002609,
-0.37110355496406555,
-0.09958039224147797,
0.2722858786582947,
-0.030600614845752716,
0.142836228... | |
How can I delete the contents of a local folder in Python?
The current project is for Windows, but I would like to see \*nix also.
```
import os, shutil
folder = '/path/to/folder'
for filename in os.listdir(folder):
file_path = os.path.join(folder, filename)
try:
if os.path.isfile(file_path) or os.path... | [
-0.12049516290426254,
-0.1355503797531128,
0.4960518181324005,
-0.040998924523591995,
0.08473510295152664,
-0.03290840610861778,
0.4035182297229767,
-0.0010761003941297531,
-0.511158287525177,
-0.8773109912872314,
-0.22026824951171875,
0.6672090888023376,
-0.39792710542678833,
0.2078306078... | |
print('Failed to delete %s. Reason: %s' % (file_path, e))
``` | [
-0.1301688700914383,
0.32100242376327515,
0.21432490646839142,
-0.15504039824008942,
0.48038917779922485,
0.13691487908363342,
0.48114243149757385,
-0.040836986154317856,
-0.056179482489824295,
-0.3882066607475281,
-0.4831170439720154,
0.5007978677749634,
-0.20436722040176392,
0.3750345408... | |
*Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost any database which has a JDBC driver that can detect foreign-key associations.*
---
Querying PostgreSQL data dictionary for foreign-keys and relationship between tables is very straightforward, but how can I use that info... | [
0.38165992498397827,
0.15852874517440796,
0.5157594680786133,
0.04340353608131409,
-0.22058306634426117,
-0.21150308847427368,
0.2764213979244232,
0.29581502079963684,
-0.27548331022262573,
-0.7910882234573364,
0.27323561906814575,
0.5406963229179382,
-0.40904197096824646,
-0.0128707569092... | |
cool/useful tool. Of course, you'll need something to generate the dot files for graphviz. I've used [SchemaSpy](http://schemaspy.sourceforge.net/) once or twice in the past, and it works pretty well, provided you have the relationships defined in the database. | [
0.5540991425514221,
-0.31052300333976746,
0.2493760585784912,
0.19464173913002014,
0.008739114739000797,
-0.3558269441127777,
-0.012046941556036472,
0.6367579102516174,
-0.2568581998348236,
-0.6536874771118164,
0.4238891899585724,
0.6046847105026245,
0.003302559722214937,
-0.07340293377637... | |
I use log4net in just about every code project. I was wondering what other generally useful code projects are available?
* [Rhino.Mocks](http://ayende.com/projects/rhino-mocks.aspx)
* [NUnit](http://nunit.org)
* [NHibernate](http://www.hibernate.org/343.html)
* [Spring.NET](http://www.springframework.net/)
* [Castle](h... | [
0.3399036228656769,
0.0010705533204600215,
-0.20030078291893005,
-0.09286213666200638,
-0.6584460139274597,
0.18696320056915283,
0.476779580116272,
-0.1912539005279541,
-0.2561187148094177,
-0.4885059893131256,
-0.03373508155345917,
0.12278533726930618,
0.1387614905834198,
-0.0536846145987... | |
I have a simple "accordion" type page containing a list of H3 headers and DIV content boxes (each H3 is followed by a DIV). On this page I start with all DIVs hidden. When a H3 is clicked the DIV directly below (after) is revealed with jQuery's ["slideDown"](http://jquery.com/api/#slideDown) function while all other DI... | [
0.016148388385772705,
0.20584765076637268,
0.8650966882705688,
-0.3975805938243866,
-0.46309971809387207,
0.07614041864871979,
0.056826233863830566,
-0.21148709952831268,
-0.13684353232383728,
-0.8212231397628784,
-0.21211230754852295,
0.3643645942211151,
-0.3577812612056732,
-0.0394698679... | |
disabled).
I am thinking it is impossible because the inline style will always take precedence over any other style declaration.
Is there another solution?
**Solution**
[Sugendran's solution](https://stackoverflow.com/questions/186035/is-it-possible-to-print-a-div-that-is-hidden-by-jquerys-slideup-function#186189) ... | [
-0.1938054859638214,
0.0038078015204519033,
0.30720576643943787,
0.08180747181177139,
0.035808153450489044,
-0.07906927913427353,
0.5567631125450134,
-0.16989661753177643,
-0.4703558385372162,
-0.37656712532043457,
-0.23666653037071228,
0.7370765209197998,
-0.26074787974357605,
-0.31047609... | |
solution](https://stackoverflow.com/questions/186035/is-it-possible-to-print-a-div-that-is-hidden-by-jquerys-slideup-function#186036) works fine, but is overkill when the !important declaration works.
You can use the !important clause in CSS. This will override the inline style.
So if you setup a print media styleshee... | [
-0.3415398895740509,
-0.06813956797122955,
0.4663643538951874,
0.2270287275314331,
0.5069282650947571,
-0.2841358482837677,
0.3535417914390564,
-0.3313726782798767,
-0.31199395656585693,
-0.44004058837890625,
-0.29227951169013977,
0.4723506569862366,
-0.41347530484199524,
-0.13434259593486... | |
I was developing a web page, where I was laying out a board for a Chess-like game, along with a couple of piece trays. It's all done using HTML (with jQuery for dynamic updating as the game is played). Somewhere I'd got the notion that using absolute positioning of elements within a page was considered a bad practice, ... | [
0.40077027678489685,
0.08306895196437836,
0.22600382566452026,
0.06211521849036217,
0.1122453436255455,
0.045171432197093964,
-0.31144851446151733,
0.011096619069576263,
-0.36399662494659424,
-0.6919208765029907,
0.15617921948432922,
-0.009557154960930347,
-0.012320362962782383,
-0.0145045... | |
relative positioning is preferable over absolute? Are there any guidelines or rules of thumb that you apply when deciding which approach to take?
For a chess like game such as you are developing, there is nothing inherently wrong with using absolute positioning. As you said, relative positioning and normal flow layout ... | [
-0.3239542245864868,
-0.30534493923187256,
0.40872254967689514,
0.10258586704730988,
0.024928415194153786,
-0.1893225461244583,
-0.1295500099658966,
0.16102942824363708,
0.13537661731243134,
-0.7219547629356384,
0.1552017778158188,
0.5498135089874268,
-0.10089650005102158,
-0.2747479677200... | |
that, a lesser known benefit of absolute positioning is that it allows localized absolute positioning *within* the nearest "positioned" parent element.
*Note:* A "positioned" element can be any of the following: relative, fixed, absolute, or sticky.
To explain:
```
<div id="parentDIV" style="position:relative">
... | [
-0.03653821349143982,
-0.18859732151031494,
0.7827877402305603,
0.18579040467739105,
0.12594854831695557,
0.24529241025447845,
-0.009004921652376652,
-0.06520532071590424,
0.03801789507269859,
-0.6424269676208496,
-0.13894502818584442,
0.2152772843837738,
0.27373358607292175,
0.16433665156... | |
answer your question (relative positioning being preferred over absolute): I don't believe there is a correct answer, it depends on what you are needing to build. However in general positioning (absolute or relative) versus default flow layout, my approach is as described above. | [
0.3325539231300354,
0.11509938538074493,
0.2449236661195755,
0.028354870155453682,
0.24149101972579956,
0.09479366987943649,
0.275117963552475,
-0.1367887556552887,
0.28516820073127747,
-0.5052886009216309,
0.041369035840034485,
0.7274406552314758,
0.11218259483575821,
-0.1876315474510193,... | |
I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible?
As in other Unixes, it's a feature of the filesystem. Either the filesystem supports it for ALL files or it doesn't. Unlike Win32, you don't have to do anything special to make it happe... | [
0.17691224813461304,
-0.014178350567817688,
0.5356016755104065,
0.033261001110076904,
0.08160685747861862,
-0.3922284245491028,
0.23004500567913055,
0.041758909821510315,
-0.4590815305709839,
-1.0259240865707397,
-0.34488239884376526,
0.49232417345046997,
-0.29848045110702515,
0.2246228009... | |
of the currently supported filesystems feature sparse file support. | [
-0.28278106451034546,
0.24293678998947144,
0.13207456469535828,
0.16091667115688324,
0.4649956524372101,
-0.26864445209503174,
0.020844828337430954,
0.3469585180282593,
-0.35200855135917664,
-0.6581928730010986,
-0.5466944575309753,
0.13519024848937988,
-0.4280255138874054,
0.3994455635547... | |
In a vxWorks Real-Time process, you can pass environment variables as one of the parameter of the **main** routine.
How do you use the environment variables in the kernel context?
Call this directly from the VxWorks shell:
```
putenv "<VARIABLE NAME>=<VALUE>"
```
replace with your environment variable name and with... | [
0.40134432911872864,
-0.3457912504673004,
0.11150635033845901,
0.03077062778174877,
0.026799574494361877,
-0.017144717276096344,
0.1011904701590538,
0.05976675823330879,
-0.09766697883605957,
-0.7311624884605408,
-0.1568966656923294,
0.7690841555595398,
-0.4207117557525635,
-0.043365754187... | |
He're an interesting problem that looks for the most Pythonic solution. Suppose I have a list of mappings `{'id': id, 'url': url}`. Some `id`s in the list are duplicate, and I want to create a new list, with all the duplicates removed. I came up with the following function:
```
def unique_mapping(map):
d = {}
... | [
0.15951229631900787,
0.19909648597240448,
0.13818325102329254,
0.44152870774269104,
0.12172456085681915,
0.11296867579221725,
-0.011707430705428123,
-0.14764773845672607,
-0.4128725230693817,
-0.7465457320213318,
-0.0960017740726471,
0.15932492911815643,
-0.6881787180900574,
0.380462199449... | |
more efficient way ?
Your example can be rewritten slightly to construct the first dictionary using a generator expression and to remove necessity of construction of another mappings. Just reuse the old ones:
```
def unique_mapping(mappings):
return dict((m['id'], m) for m in mappings).values()
```
Although this... | [
-0.053860049694776535,
0.015186341479420662,
0.18731023371219635,
0.06383273750543594,
0.001848494866862893,
0.0785268098115921,
0.19692732393741608,
-0.3559178113937378,
-0.07299289107322693,
-0.9561866521835327,
0.07390589267015457,
0.7287114858627319,
-0.36076995730400085,
-0.1870974749... | |
I suggest the solution above. In other case, this function preserves order and treats first-encountered ids with priority:
```
def unique_mapping(mappings):
addedIds = set()
for m in mappings:
mId = m['id']
if mId not in addedIds:
addedIds.add(mId)
yield m
```
You migh... | [
-0.21659627556800842,
-0.3576964735984802,
0.395474374294281,
-0.35882019996643066,
-0.03635343164205551,
-0.24278581142425537,
-0.17575034499168396,
-0.36757275462150574,
-0.06778939813375473,
-0.6292944550514221,
-0.35486695170402527,
0.6498860716819763,
-0.3317018747329712,
0.1528215557... | |
I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subsequent queries are lightning fast.
Has anyone experienced this issue... | [
-0.0856202095746994,
0.47607719898223877,
0.207644984126091,
0.08897528052330017,
-0.031514257192611694,
-0.0455138236284256,
0.789958119392395,
0.27710720896720886,
-0.41768187284469604,
-0.4006830155849457,
0.12726642191410065,
0.40531063079833984,
-0.023478832095861435,
0.18134531378746... | |
running on a server without Internet access**
<http://support.microsoft.com/default.aspx/kb/915850> | [
0.14356152713298798,
-0.23428018391132355,
-0.1439381241798401,
0.14837683737277985,
0.16933654248714447,
0.022349916398525238,
0.430688738822937,
0.2963235080242157,
0.02170582488179207,
-0.34428298473358154,
-0.4430466294288635,
0.0954839214682579,
-0.32269009947776794,
0.204118564724922... | |
I am using Windows 2003. I have mapped a web application into a virtual directory. This is built on framework 1.1 When i try to browse to the default page i get a error as
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error de... | [
0.07611452043056488,
0.163388192653656,
0.5608912110328674,
-0.22920741140842438,
0.2684231996536255,
-0.17714454233646393,
0.5599277019500732,
-0.3433227837085724,
-0.4068002998828888,
-0.8995676040649414,
-0.1673336625099182,
0.5203247666358948,
-0.5780312418937683,
-0.04663417860865593,... | |
assembly 'Interop.MSDASC' could not be loaded.
LaTeX was originally designed as a reasonably flexible system on which a few standard classes were distributed — that were themselves rather *in*flexible.
In the current state of affairs, if you want a custom layout, you need to write a few amount of supporting code yours... | [
0.4253651797771454,
-0.3684301972389221,
0.1032957136631012,
0.003253205679357052,
-0.23872528970241547,
0.13054415583610535,
0.2204151153564453,
-0.07393709570169449,
-0.5058582425117493,
-0.6431775093078613,
-0.021235467866063118,
0.04213113337755203,
-0.6486647725105286,
-0.032102473080... | |
and what to build on top of. That catalogue you give as an example would, in my opinion, be reasonably easy to do in LaTeX; it's just a bunch of boxes.
You could write something like
```
\newcommand\catalogueEntry[4]{%
\parbox[t]{0.23\linewidth}{\textbf{#1}}%
\hfill
\parbox[t]{0.23\linewidth}{\includegraphics{#... | [
0.11647315323352814,
-0.03481361269950867,
0.4417824447154999,
-0.038112204521894455,
-0.012186193838715553,
-0.1961856186389923,
-0.24369877576828003,
0.17237117886543274,
-0.23526713252067566,
-0.4964607357978821,
-0.3267088830471039,
0.5998846292495728,
-0.16140857338905334,
-0.13533125... | |
your markup from its presentation on the page, it's not too hard to get your information represented in whichever form you wish. But getting started is a little tricky, I have to admit; the learning curve for LaTeX programming can be rather steep. | [
0.5827915668487549,
0.0781237855553627,
-0.1066252738237381,
0.3264247179031372,
0.18563179671764374,
0.03322898596525192,
-0.23198215663433075,
0.22458365559577942,
-0.008622240275144577,
-0.46935588121414185,
0.01394671481102705,
0.5651451349258423,
0.36133113503456116,
-0.13016122579574... | |
In the company where I work we have major releases twice every year. Extensive testing (automated and manual) is done the weeks before.
The automated tests produce logfiles, the results of the manual tests are written down in test plans (Word documents). As you can imagine this results in a lot of different files to b... | [
1.0028489828109741,
0.364642471075058,
-0.0646248310804367,
-0.06096741557121277,
0.10856295377016068,
-0.35722750425338745,
0.006395797245204449,
-0.04111906513571739,
-0.21776632964611053,
-0.270658940076828,
-0.09009955078363419,
0.5162463784217834,
0.1497287005186081,
0.097538456320762... | |
How is the ratio developers / testers?
You could use combination of a bug tracker (JIRA, Mantis, Bugzilla) and test case management tool like [testlink](http://testlink.org/wordpress/) | [
0.7487555742263794,
-0.088248610496521,
0.04991424083709717,
0.3983575105667114,
-0.02237960696220398,
0.11904808133840561,
0.025615829974412918,
-0.11022568494081497,
0.025152968242764473,
-0.5032283663749695,
0.1331242471933365,
0.8374900221824646,
-0.07512577623128891,
-0.21661144495010... | |
Everything I read about better PHP coding practices keeps saying don't use `require_once` because of speed.
Why is this?
What is the proper/better way to do the same thing as `require_once`? If it matters, I'm using PHP 5.
`require_once` and `include_once` both require that the system keeps a log of what's already be... | [
0.7623791098594666,
0.22136758267879486,
0.09254350513219833,
0.06105020269751549,
-0.08158376067876816,
-0.1619759202003479,
0.38353651762008667,
-0.2312506139278412,
-0.4328862726688385,
-0.8206440806388855,
0.18714164197444916,
0.7009327411651611,
-0.012113434262573719,
-0.0704313740134... | |
do the work yourself in a lighter fashion. For simple apps, just making sure you've only included it once *should* suffice but if you're still getting redefine errors, you could something like this:
```
if (!defined('MyIncludeName')) {
require('MyIncludeName');
define('MyIncludeName', 1);
}
```
I'll personal... | [
0.5673785209655762,
0.159538134932518,
0.4635700285434723,
0.0262166578322649,
0.037309497594833374,
-0.3194165527820587,
0.3637735843658447,
-0.45490404963493347,
-0.0165141262114048,
-0.5516042113304138,
-0.2915412187576294,
0.6687901020050049,
-0.1509546935558319,
-0.3388873040676117,
... | |
0.18587779998779 0.046600103378296
require_once 1.2219581604004 3.2908599376678
```
10-100× slower with `require_once` and it's curious that `require_once` is seemingly slower in `hhvm`. Again, this is only relevant to your code if you're running `*_once` thousands of times.
---
```
<?php // test.php
$... | [
0.27352389693260193,
-0.13829222321510315,
0.7031309604644775,
-0.24505221843719482,
0.2525885999202728,
-0.08378934115171432,
0.47462770342826843,
-0.8541329503059387,
-0.05839840695261955,
-0.6377061009407043,
-0.24903011322021484,
0.5664708018302917,
-0.281553715467453,
0.04297444224357... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.