text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
in other places in your code. | [
0.5107625126838684,
0.17823298275470734,
-0.2598411738872528,
0.07228612899780273,
0.048948418349027634,
-0.040676139295101166,
0.11385241895914078,
0.12211503833532333,
-0.1979704648256302,
-0.5609728097915649,
-0.23974710702896118,
0.3181544542312622,
-0.10005269944667816,
-0.26109102368... | |
I am using a `HttpWebRequest`, and am disposing of the response stream. Is there a correct method of disposing of the `HttpWebRequest`, as it does not contain a close or dispose method?
If the class had special disposal requirements, it would have implemented IDisposable. Since it doesn't implement IDisposable, you may... | [
0.09095113724470139,
-0.2845808267593384,
-0.035172607749700546,
0.20766858756542206,
-0.13990141451358795,
-0.356456458568573,
0.36438584327697754,
-0.31528154015541077,
0.05018186196684837,
-0.7131305932998657,
-0.1575397253036499,
0.38598063588142395,
-0.3346402049064636,
0.020249070599... | |
I'm having some trouble making a sequence. Basically I need to chop a sequence into a sequence of arrays. Seq.windowed almost does it but I don't want duplicate elements.
I can get what I want by reading everything into an array first but I'd rather use a sequence.
```
let array_chunk s (a:int[]) =
Array.init (a.... | [
0.1423620879650116,
-0.0931980237364769,
-0.049338433891534805,
-0.131228506565094,
-0.27315354347229004,
0.07354667782783508,
0.08370266109704971,
-0.20074592530727386,
-0.27315279841423035,
-0.570138692855835,
-0.05187897011637688,
0.4544289708137512,
-0.41652077436447144,
-0.15635158121... | |
n xs = seq {
let i = ref 0
let arr = ref <| Array.create n (Unchecked.defaultof<'a>)
for x in xs do
if !i = n then
yield !arr
arr := Array.create n (Unchecked.defaultof<'a>)
i := 0
(!arr).[!i] <- x | [
-0.1289781630039215,
0.043010298162698746,
0.39046239852905273,
-0.5677763819694519,
-0.20452535152435303,
0.4395179748535156,
0.3577888607978821,
-0.621607780456543,
-0.12528203427791595,
-0.2599976062774658,
-0.1681985706090927,
0.346539169549942,
-0.3769187033176422,
0.180344820022583,
... | |
i := !i + 1
if !i <> 0 then
yield (!arr).[0..!i-1] }
``` | [
-0.20227162539958954,
0.3633527457714081,
0.415466845035553,
-0.5128540992736816,
0.02247740514576435,
0.008368495851755142,
0.475956529378891,
-0.6711335778236389,
0.30070221424102783,
-0.33491766452789307,
-0.2182765007019043,
0.6745874285697937,
-0.3469659984111786,
0.319353848695755,
... | |
SAP announced [Blue Ruby](https://www.sdn.sap.com/irj/scn/wiki?path=/display/Research/BlueRuby), a version of Ruby that runs inside the ABAP Virtual Machine.
This seems to lend additional credibility to the Ruby language but, except for SAP developers, does this have any applicability to the rest of the Ruby community... | [
0.34357428550720215,
0.14232757687568665,
0.0637064278125763,
-0.11949113756418228,
-0.5094154477119446,
-0.19296307861804962,
0.3032418489456177,
0.42483019828796387,
-0.17089718580245972,
0.02886119671165943,
-0.232966348528862,
-0.22889208793640137,
-0.14633525907993317,
0.1288271546363... | |
MRI? I understand I might need JRuby if I want to integrate with Java libraries. Are there any other times I might need to look into an implementation besides the MRI or JRuby?
I notice that Blue Ruby is compiled. Is that a big benefit and would this be the first compiled version of Ruby?
Sorry - maybe too many que... | [
0.42304787039756775,
0.07301966100931168,
-0.11695181578397751,
0.04789108410477638,
-0.3050045669078827,
-0.2099084109067917,
0.08813668042421341,
0.13911275565624237,
-0.08702055364847183,
-0.6394857168197632,
0.2854436933994293,
0.44401127099990845,
-0.1440221220254898,
-0.0824685245752... | |
few alternative implementations. The reason for so many versions is partly because while Ruby itself has a lot of fans, MRI is often considered to be not quite as nice as the language it hosts.
This is a list of all the other Ruby implementations I know of:
* MRI
* JRuby for Java. Its speed advantage isn't as great ... | [
0.18309617042541504,
0.03339383751153946,
0.4524514973163605,
-0.11796551197767258,
-0.4876534640789032,
-0.2831042408943176,
0.5650694370269775,
0.08469440042972565,
0.14178751409053802,
-0.6901652216911316,
0.29509881138801575,
0.47690871357917786,
-0.28325021266937256,
0.016381207853555... | |
a new LLVM-based virtual machine for the next version, which looks to offer a major speed boost and will hopefully be portable to other LLVM target platforms.
* MagLev (still very much in development) for high-capacity Web apps. It will probably be a commercial product.
* Rubinius is a ground-up reimplementation meant ... | [
0.32277876138687134,
-0.2504975199699402,
0.6469296813011169,
0.29074347019195557,
-0.2440939098596573,
-0.29292067885398865,
0.3221091628074646,
0.45584243535995483,
-0.26645946502685547,
-0.5151436924934387,
-0.20688389241695404,
0.2541406452655792,
0.08647455275058746,
0.017755417153239... | |
than ABAP.
All of the current Ruby implementations are compiled to bytecode. Contrary to SAP's claims, as of Ruby 1.9, MRI itself includes a bytecode compiler, though the ability to save the compiled bytecode to disk disappeared somewhere in the process of merging the YARV virtual machine. JRuby is compiled into Java ... | [
0.1518537551164627,
0.048626482486724854,
0.5395841002464294,
-0.24655839800834656,
-0.5021907091140747,
-0.25619661808013916,
0.434969961643219,
-0.07383108884096146,
0.08664018660783768,
-0.3597628176212311,
-0.04420546814799309,
0.3996768891811371,
-0.3856598734855652,
0.106680840253829... | |
**Short question:**
Is there a simple way in LINQ to objects to get a distinct list of objects from a list based on a key property on the objects.
**Long question:**
I am trying to do a [`Distinct()`](http://www.hookedonlinq.com/DistinctOperator.ashx) operation on a list of **objects** that have a key as one of thei... | [
0.26908087730407715,
-0.17217466235160828,
0.2748631238937378,
0.0697733536362648,
-0.28236836194992065,
-0.018336357548832893,
0.0219355970621109,
-0.22882308065891266,
-0.13919828832149506,
-0.4976963996887207,
-0.08986678719520569,
0.46918246150016785,
-0.22742518782615662,
0.0064311833... | |
works [sic] I have duplicates of the
`GalleryImage` object. i thought it would be a simple matter to use `Distinct()` to get a distinct list.
This is the LINQ query I want to use :
```
var allImages = Galleries.SelectMany(x => x.Images);
var distinctImages = allImages.Distinct<GalleryImage>(new
... | [
0.4623224139213562,
0.11423930525779724,
0.6070027351379395,
-0.05870732665061951,
-0.24043698608875275,
0.06827345490455627,
0.14504125714302063,
-0.5082374215126038,
-0.26029253005981445,
-0.668270468711853,
0.18862269818782806,
0.44003480672836304,
-0.5183188915252686,
0.069158338010311... | |
there a concrete implementation of `EqualityComparer` somewhere that I'm missing?
I would have thought there would be an easy way to get 'distinct' objects from a set based on a key.
(There are two solutions here - see the end for the second one):
My [MiscUtil](http://pobox.com/~skeet/csharp/miscutil) library has a `... | [
-0.029155287891626358,
0.07359323650598526,
0.16062912344932556,
0.09482897818088531,
-0.4230011999607086,
0.29158538579940796,
-0.00008551790233468637,
-0.2962304353713989,
-0.07506869733333588,
-0.4557049572467804,
0.18876336514949799,
0.47899892926216125,
-0.4604020118713379,
0.20950609... | |
projection)
{
return new ProjectionEqualityComparer<TSource, TKey>(projection);
}
public static ProjectionEqualityComparer<TSource, TKey>
Create<TSource, TKey> (TSource ignored,
Func<TSource, TKey> projection)
{
return new ProjectionEqualityCompare... | [
-0.22193022072315216,
-0.183881014585495,
0.45387548208236694,
0.07016436010599136,
-0.02193351276218891,
0.5240137577056885,
-0.06611157208681107,
-0.17161229252815247,
-0.1585984081029892,
-0.56293123960495,
-0.16830509901046753,
0.49807611107826233,
-0.474226176738739,
0.435590118169784... | |
Create<TKey>(Func<TSource, TKey> projection)
{
return new ProjectionEqualityComparer<TSource, TKey>(projection);
}
}
public class ProjectionEqualityComparer<TSource, TKey>
: IEqualityComparer<TSource>
{
readonly Func<TSource, TKey> projection;
readonly IEqualityComparer<TKey> comparer;
... | [
-0.09048551321029663,
-0.08618796616792679,
0.28964829444885254,
0.054263368248939514,
-0.17028893530368805,
0.3450147807598114,
-0.00589425815269351,
-0.20564131438732147,
0.06045917049050331,
-0.7644525170326233,
-0.04756719246506691,
0.41285955905914307,
-0.3418353497982025,
0.351627826... | |
{
projection.ThrowIfNull("projection");
this.comparer = comparer ?? EqualityComparer<TKey>.Default;
this.projection = projection;
}
public bool Equals(TSource x, TSource y)
{
if (x == null && y == null)
{
return true;
} | [
-0.07806802541017532,
0.02815677784383297,
0.41809338331222534,
-0.3092547655105591,
-0.21391279995441437,
0.20421074330806732,
0.14317667484283447,
-0.19702209532260895,
0.11405400931835175,
-0.5115485191345215,
-0.11027849465608597,
0.3948514461517334,
-0.3260940611362457,
0.138060718774... | |
if (x == null || y == null)
{
return false;
}
return comparer.Equals(projection(x), projection(y));
}
public int GetHashCode(TSource obj)
{
if (obj == null)
{
throw new ArgumentNullException("obj"); | [
-0.3211342692375183,
0.019153987988829613,
0.4536416530609131,
-0.3018919825553894,
0.002798456232994795,
0.29910051822662354,
0.31929636001586914,
-0.27573516964912415,
0.08059155941009521,
-0.4674915075302124,
-0.4703354239463806,
0.45922359824180603,
-0.42299747467041016,
0.215623661875... | |
}
return comparer.GetHashCode(projection(obj));
}
}
```
**Second solution**
To do this just for Distinct, you can use the [`DistinctBy`](http://code.google.com/p/morelinq/source/browse/trunk/MoreLinq/DistinctBy.cs) extension in [MoreLINQ](http://code.google.com/p/morelinq/):
```
public static IEnume... | [
-0.6654820442199707,
-0.09417983144521713,
0.5549458265304565,
0.03023632802069187,
-0.10603111237287521,
0.2196120321750641,
-0.0253269262611866,
-0.03616969659924507,
-0.22012008726596832,
-0.6797860860824585,
-0.3590300977230072,
0.12885642051696777,
-0.105748251080513,
0.47358518838882... | |
Func<TSource, TKey> keySelector,
IEqualityComparer<TKey> comparer)
{
source.ThrowIfNull("source");
keySelector.ThrowIfNull("keySelector");
return DistinctByImpl(source, keySelector, comparer);
}
private static IEnumerable<TSource> DistinctByImpl<TSource, TKey>
(IEnu... | [
-0.6625687479972839,
-0.10661939531564713,
0.3106846511363983,
-0.08776741474866867,
-0.36767086386680603,
0.09037772566080093,
0.007747943047434092,
-0.15922071039676666,
-0.03760075569152832,
-0.22931474447250366,
-0.38389086723327637,
0.39565297961235046,
-0.10762657970190048,
0.2881771... | |
HashSet<TKey> knownKeys = new HashSet<TKey>(comparer);
foreach (TSource element in source)
{
if (knownKeys.Add(keySelector(element)))
{
yield return element;
}
}
}
```
In both cases, `ThrowIfNull` looks like this:
```
public static | [
-0.2077328860759735,
-0.3114217221736908,
0.10936932265758514,
-0.4456286132335663,
-0.12485520541667938,
-0.1336381435394287,
-0.08177705854177475,
-0.2418171912431717,
-0.006922162137925625,
-0.14316587150096893,
-0.38636472821235657,
0.5153728127479553,
-0.29318875074386597,
0.153290912... | |
void ThrowIfNull<T>(this T data, string name) where T : class
{
if (data == null)
{
throw new ArgumentNullException(name);
}
}
``` | [
0.15809188783168793,
-0.3089751899242401,
0.19499953091144562,
-0.37895578145980835,
-0.011276265606284142,
-0.008866807445883751,
0.11866109073162079,
-0.15808752179145813,
0.05274831876158714,
-0.36875802278518677,
-0.24540336430072784,
0.7213868498802185,
-0.3276502788066864,
0.28097575... | |
I am using sessionstate stored in stateserver in asp.net. I have a link on header that displays users login id.
Problem:
When session expires in stateserver my application still displays loginid and it throws an error when hits code that depends on value stored in session.
Looks like asp.net has no idea when session... | [
0.3677090108394623,
0.1002250611782074,
0.38236501812934875,
0.20071612298488617,
-0.049179915338754654,
-0.2597671449184418,
0.6467413306236267,
-0.08142663538455963,
-0.31657302379608154,
-0.9794050455093384,
0.18503254652023315,
0.5057059526443481,
0.0016417866572737694,
0.4007380604743... | |
Isn't asp.net suppose to keep session data saved in cookies synced with session in stateserver?
Could you please explain what would be best practice to handle this?
If you are using ASP.Net Webforms, you can consider the Load event of the page or control to check whether the session has expired. Here's the relevant co... | [
0.49645382165908813,
0.004512098152190447,
0.20275337994098663,
0.06381620466709137,
-0.06470108032226562,
-0.3534945547580719,
0.5004397034645081,
-0.1872704178094864,
-0.1820356398820877,
-0.525285005569458,
0.009338343515992165,
0.43823114037513733,
-0.11857260763645172,
0.0537315048277... | |
The first parameter to a C# extension method is the instance that the extension method was called on. I have adopted an idiom, without seeing it elsewhere, of calling that variable "self". I would not be surprised at all if others are using that as well. Here's an example:
```
public static void Print(this string sel... | [
-0.02549608051776886,
-0.01928139105439186,
0.28649845719337463,
-0.21045143902301788,
-0.26256999373435974,
-0.1935577392578125,
-0.09929857403039932,
-0.060781095176935196,
-0.045274022966623306,
-0.595396876335144,
0.0801861360669136,
0.8024647235870361,
-0.48436981439590454,
0.28659293... | |
any information. I think we all agree that *sometimes* there is a clear, meaningful name for the parameter, specific to its purpose, which is better than "self" or "@this". Some go further and say you can *always* come up with a more valuable name. So this is another valid point of view.
**What other idioms have you s... | [
0.3546896278858185,
0.0914686918258667,
0.1692732572555542,
0.36231666803359985,
-0.4108670651912689,
-0.154944509267807,
0.36613765358924866,
0.4121361970901489,
-0.06656810641288757,
-0.7907610535621643,
-0.00685590784996748,
0.552114725112915,
0.07337401807308197,
-0.12364187091588974,
... | |
I am seeing all these new languages for .NET and JVM. How does one begin to make one?
I can't find any good documentation on JVM or MSIL specifications.
**Edit**
I already know how to parse, I am more interested in how there are so many people making new languages that are based on those platforms.
You're kind of i... | [
0.31745463609695435,
0.12574101984500885,
-0.05353544279932976,
0.22157567739486694,
0.08767730742692947,
-0.09098532795906067,
0.3412494659423828,
0.8063786625862122,
-0.30046868324279785,
-0.5801988244056702,
-0.08023390918970108,
0.5980533361434937,
-0.023331718519330025,
-0.08451433479... | |
some links:
[Blog of the guy who is the brain behind IronPython](http://blogs.msdn.com/hugunin/archive/2007/04/30/a-dynamic-language-runtime-dlr.aspx)
[The home of the Dynamic Language Runtime](http://www.codeplex.com/dlr)
[An article about how IronPython was implemented](http://msdn.microsoft.com/en-us/magazine/cc... | [
-0.12346254289150238,
0.0753486305475235,
-0.1962393969297409,
-0.09050516039133072,
-0.26272737979888916,
0.00506636593490839,
0.49184930324554443,
0.2635987102985382,
-0.322247713804245,
-0.3610697388648987,
-0.4998791813850403,
0.23834718763828278,
-0.25166699290275574,
0.01800946146249... | |
I have a textbox on my website and I need to store whatever the user enters into my database, and retrieve it at a later time. I need to store it exactly as the user entered, including special characters, carriage returns, etc.
What process should I use in PHP to store this in my database field (which is a 'text' fiel... | [
0.4381953179836273,
0.3321681022644043,
0.5173881649971008,
0.0010136868804693222,
-0.059629395604133606,
-0.026293350383639336,
0.3005967438220978,
-0.009892823174595833,
0.011362866498529911,
-0.7508643269538879,
-0.009207661263644695,
0.4032784104347229,
-0.14274676144123077,
-0.0065718... | |
for something else (e.g. emails, PDF documents and so on). As [Assaf](https://stackoverflow.com/questions/716656/php-storing-text-in-mysql-database/716661#716661) already said: it's mandatory to avoid SQL injections by escaping the input or using parameterized insert-queries.
You should, no, let's say, **must** howeve... | [
0.595446765422821,
-0.026759009808301926,
0.1603332757949829,
0.11866531521081924,
0.059469886124134064,
-0.4584800601005554,
0.4685975909233093,
-0.3167684078216553,
-0.4138086438179016,
-0.38873565196990967,
-0.14194519817829132,
0.6031274795532227,
-0.37498539686203003,
-0.2210935205221... | |
which can be arbitrary complex depending on your needs (allowed tags e.g.). | [
0.5856519937515259,
0.06439043581485748,
0.05356011539697647,
0.32720300555229187,
0.3644779622554779,
-0.21979796886444092,
0.19167281687259674,
-0.3743108808994293,
-0.33617374300956726,
-0.4763847291469574,
-0.487704336643219,
0.28027254343032837,
-0.47042232751846313,
-0.09611577540636... | |
I'm binding an ASP.NET control to the result of a LINQ query. I'd like to HtmlEncode one of the properties of the contained objects before binding to the control, but I want to do it without altering the data because I do a DataContext.SubmitChanges() later on. How can this be done?
Code that won't work:
```
var ds =... | [
0.04148980975151062,
-0.23979587852954865,
0.8798145055770874,
0.07630077004432678,
-0.08307889848947525,
-0.20032000541687012,
0.4957505166530609,
-0.5398577451705933,
-0.16040153801441193,
-0.5183926224708557,
-0.24237321317195892,
0.1911652386188507,
-0.35392120480537415,
0.266115605831... | |
Hiii,
I have a Database design as:
```
Table File (FileID, Name, Details)
Table Attributes (AttID, AttName, AttType)
Table AttValues (FileID, AttID, AttValue)
```
Till the runtime, it is not known how many `Attributes` are in a `File` and of what names.
And I want to display after insertion at Frontend in a mann... | [
0.16758891940116882,
0.013038243167102337,
0.4867834448814392,
0.21008436381816864,
-0.3290444314479828,
-0.022311074659228325,
0.04405267536640167,
-0.1169525682926178,
0.020239029079675674,
-0.5713184475898743,
0.23086577653884888,
0.6252118945121765,
-0.2206869274377823,
0.0519107952713... | |
I just need to HtmlEncode it within the OnItemDataBound() event. | [
0.24945074319839478,
0.036305829882621765,
0.3551219701766968,
0.03691394254565239,
0.09104689955711365,
-0.5001667141914368,
0.31581082940101624,
0.3960750699043274,
0.11638364940881729,
-0.747960090637207,
0.05515036731958389,
0.15889623761177063,
0.02981242537498474,
0.08932241797447205... | |
I have been trying out both Linq to Sql and EF in my ASP.NET MVC application. After switching to EF I realized my XML/JSON serialization output has extra cruft.
XML:
```
<Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<EntityKey>
<EntitySetName>Persons</... | [
-0.3740859925746918,
0.2796119451522827,
0.47326961159706116,
0.07816623896360397,
0.12885093688964844,
0.044831782579422,
-0.02851325087249279,
-0.42708560824394226,
-0.04926431179046631,
-0.3983485698699951,
-0.08938917517662048,
0.5545065999031067,
0.04417872056365013,
0.118995845317840... | |
=> t.Id == testId);
```
You can shape the JSON result in your controller like this:
```
public JsonResult Person(int id)
{
var person = PersonRepository.FindByID(id);
var result = new { Id = person.Id, Name = person.Name };
return Json(result);
}
```
This will limit the DTO which is serialized to contain only... | [
-0.36731305718421936,
-0.5397699475288391,
0.06653552502393723,
0.27285823225975037,
-0.1775646209716797,
0.11371240764856339,
0.08057505637407303,
-0.2760148346424103,
-0.10636460036039352,
-0.6641159653663635,
-0.21717211604118347,
0.529632031917572,
-0.3066270351409912,
0.11547637730836... | |
instance:
The modified Action method may look like this:
```
public JsonResult Person(int id)
{
var person = PersonRepository.FindByID(id);
var dto = Mapper.Map<Person, PersonViewModel>(person);
return Json(dto);
}
```
The only other option I can think of is to use reflection to modify the DataMemberAttribute... | [
-0.35194140672683716,
-0.24630522727966309,
-0.22568705677986145,
-0.15769855678081512,
-0.25325992703437805,
0.1683959662914276,
0.3908117711544037,
-0.2394658625125885,
-0.09393002092838287,
-0.3997408151626587,
-0.11889795958995819,
0.7048782706260681,
-0.12503297626972198,
-0.116894848... | |
I'm looking to allow a user to enter a date and time to send out a mass email through PHP, although I'm thinking it might be best to use a \*nix command to trigger the PHP process. I'm wondering if there is a way on \*nix to do this without adding a cronjob to run every 15 minutes to check if there is a mass email to b... | [
0.5079275369644165,
0.1275678128004074,
0.47458186745643616,
0.14076843857765198,
-0.02892141602933407,
-0.06142637878656387,
0.16924336552619934,
0.29767751693725586,
-0.3599776327610016,
-0.6887004375457764,
0.24502937495708466,
0.35049566626548767,
0.06303252279758453,
0.137626826763153... | |
scheduled task that has an end date and is set to delete if it's not scheduled again.
You're looking for the [at](http://www.oreillynet.com/linux/cmd/cmd.csp?path=a/at) command.
> at [options] time [date]
>
>
> Execute commands at a specified time
> and optional date. The commands are
> read from standard input ... | [
0.1974078118801117,
-0.5674343705177307,
0.3812727630138397,
0.07938400655984879,
0.03446783497929573,
0.47639745473861694,
0.260637104511261,
0.059927962720394135,
-0.48075467348098755,
-0.559762716293335,
-0.15465585887432098,
0.4282900393009186,
-0.22106364369392395,
0.1945561170578003,... | |
or
> a special keyword (today or tomorrow).
> An increment can also be specified.
>
>
> The at command can always be issued by
> a privileged user. Other users must be
> listed in the file /etc/at.allow if it
> exists; otherwise, they must not be
> listed in /etc/at.deny. If neither
> file exists, only a privi... | [
0.28551211953163147,
-0.0876486524939537,
0.7579310536384583,
0.20570334792137146,
-0.26836591958999634,
-0.024356544017791748,
0.17510062456130981,
-0.2750198543071747,
-0.0868462547659874,
-0.5365355014801025,
-0.514049768447876,
0.9179744124412537,
-0.1523813009262085,
0.038754876703023... | |
> output at> mail joe <
> output at> Entered by pressing
> Ctrl-D job 1 at 2003-03-19 01:00
>
>
> The two commands could also be placed
> in a file and submitted as follows:
>
>
> $ at 1:00 am tomorrow <
> scriptfile | [
0.07980424910783768,
-0.15318888425827026,
0.47274041175842285,
-0.2791740596294403,
-0.36413076519966125,
0.05463995411992073,
0.22276879847049713,
-0.19541124999523163,
0.04959752783179283,
-0.7532567977905273,
-0.1942950189113617,
0.6669741272926331,
-0.23557300865650177,
-0.14111816883... | |
I'm implementing a event system: Various pieces of code will post events to a central place where they will be distributed to all listeners. The main problem with this approach: When an exception happens during event processing, I can't tell anymore who posted the event.
So my question is: Is there an efficient way to... | [
0.48027700185775757,
0.14033694565296173,
-0.020925763994455338,
-0.057451456785202026,
-0.21692073345184326,
-0.4386920928955078,
0.47676998376846313,
0.06247701868414879,
-0.3127613961696625,
-0.4396182894706726,
0.11384965479373932,
0.620542049407959,
-0.3196362257003784,
-0.11404764652... | |
if there was a way to cache this or whether I could just remember the topmost stack frame and work my way back in the rare case that I actually need this data.
```
import sys
def get_caller(ext=False):
""" Get the caller of the caller of this function. If the optional ext parameter is given, returns the line's text... | [
0.10417982935905457,
-0.27247416973114014,
0.8387362360954285,
-0.2605154812335968,
0.09794033318758011,
0.2877926528453827,
0.33632925152778625,
-0.28753846883773804,
0.047128576785326004,
-0.7016937136650085,
-0.3118290901184082,
0.48880255222320557,
-0.5390359163284302,
-0.1555967032909... | |
s[1]))
return s
def post_event(e):
caller=get_caller(True)
print "Event %r posted from %r"%(e, caller)
## Testing the functions.
def q():
post_event("baz")
post_event("foo")
print "Hello!"
q()
```
results in
```
Event 'foo' posted from ('getcaller.py', 20, 'post_event("foo")\n')
Hello!
Event 'b... | [
-0.22437870502471924,
-0.13046468794345856,
0.7196344137191772,
-0.4400360584259033,
0.06519003957509995,
0.21585817635059357,
0.38444480299949646,
-0.5687004327774048,
-0.02398323081433773,
-0.5051286220550537,
-0.5371617674827576,
0.8173831701278687,
-0.43495744466781616,
-0.122481383383... | |
Which is the maximum amount of memory one can achieve in .NET managed code? Does it depend on the actual architecture (32/64 bits)?
There are no hard, exact figure for .NET code.
If you run on 32 bit Windows; your *process* can address up to 2 GB, 3 GB if the /3GB switch is used on Windows Server 2003.
If you run a 6... | [
-0.0041042715311050415,
0.07389678061008453,
0.34504804015159607,
0.08242877572774887,
-0.024051059037446976,
0.13053689897060394,
0.04242302104830742,
-0.13779687881469727,
-0.642035722732544,
-0.5824851989746094,
-0.011001724749803543,
0.4924907088279724,
-0.06575679033994675,
0.25029817... | |
At the same time, .NET will try to allocate new memory in chunks; and if the address space is fragmented, that might mean that you cannot allocate more memory, even though some are available. | [
-0.03620924800634384,
-0.0645655021071434,
-0.01799658127129078,
0.305419921875,
-0.10017141699790955,
-0.11147287487983704,
0.09019219875335693,
0.12465689331293106,
-0.38174203038215637,
-0.6321067810058594,
-0.1714617758989334,
0.22489474713802338,
-0.054404132068157196,
0.3134665787220... | |
The joys of multimonitor programming are countless, I think there are about 5 blog posts on Coding Horror on the topic alone!
I often code in Windows on my main machine, and have my Mac laptop set up to the side. I use the Mac both to compile Mac builds but also as my "reference web browser". There's no KVM or anything... | [
0.7164655923843384,
0.238549143075943,
-0.12829332053661346,
0.025009825825691223,
-0.29770615696907043,
0.01216941885650158,
0.08493252098560333,
0.28204813599586487,
-0.1328715682029724,
-0.7889288067817688,
0.3370479941368103,
0.6681198477745056,
-0.38247057795524597,
0.1456946879625320... | |
the other.
Some googling suddenly shows that this is possible in some situations for sure:
[Synergy](http://symless.com/synergy/second-screen) and [Maxivista](http://www.maxivista.com/)
My question is whether any **programmers** have tried such a setup. We have unique needs especially with multiple text windows and ... | [
0.4633381962776184,
-0.20127475261688232,
0.20301459729671478,
0.3716021776199341,
0.140211284160614,
-0.022726930677890778,
0.03200579434633255,
-0.0010346623603254557,
-0.21299198269844055,
-0.5392757654190063,
0.031451515853405,
0.7415732145309448,
-0.18674500286579132,
0.07819475978612... | |
exist! It's kind of combination of a software KVM **and** VNC. But the VNC would need to break out the app windows and allow individual manipulation (like that maxivista commercial tool, which is Vista only).
Thanks for all the feedback. Looks like there's demand for a cool app if anyone has the drive to be first in t... | [
0.7508537173271179,
0.04466002434492111,
0.35116443037986755,
0.3492942154407501,
0.16557709872722626,
-0.3961169123649597,
0.3317568004131317,
0.15412768721580505,
-0.18732887506484985,
-0.5876104235649109,
-0.013286215253174305,
0.37505343556404114,
-0.28817638754844666,
0.37894949316978... | |
but actually run separately.
I personally use [Input Director](http://www.inputdirector.com/), as I found it more stable than Synergy. I have my laptop with an external monitor to the right, and my desktop to the left as an Input Director slave. My desktop runs a different O/S and is basically my guinea pig box for te... | [
0.43717706203460693,
0.14184582233428955,
-0.03629278764128685,
0.03969815745949745,
-0.27048900723457336,
0.2632245123386383,
-0.1438734084367752,
-0.0016676990780979395,
-0.17441454529762268,
-0.49982261657714844,
0.16845275461673737,
0.5114590525627136,
-0.06971777975559235,
-0.06245691... | |
very useful thing to have if you have a few physical boxes and monitors kicking around :) | [
0.2252824455499649,
0.26788637042045593,
0.1963067203760147,
0.4269385039806366,
0.3346763253211975,
-0.03784477710723877,
-0.02394820563495159,
0.16505369544029236,
-0.0811510905623436,
-0.353850781917572,
0.10008308291435242,
0.3940172493457794,
0.19699843227863312,
-0.0520106703042984,
... | |
Does anyone know why the following generates an error on VC9?
```
class Elem;
class ElemVec : public vector<Elem>
{
public:
void foo();
};
void ElemVec::foo()
{
BOOST_FOREACH(Elem& elem, *this)
{
// Do something with elem
}
return;
}
```
The error I get is:
```
error C2355: 'thi... | [
0.018924666568636894,
0.3241010010242462,
0.4709776043891907,
-0.09069434553384781,
0.20859594643115997,
0.027022061869502068,
0.39202743768692017,
-0.1406816840171814,
-0.337260365486145,
-0.49107494950294495,
-0.17188219726085663,
0.915141761302948,
-0.34857824444770813,
0.06490418314933... | |
*This)
{
// Do something with elem
}
return;
}
```
Which compiler/Boost version are you using? I can compile the following without any problem (VS2005/Boost 1.38):
```
#include <boost/foreach.hpp>
using namespace std;
struct xxx : std::vector<int>
{
void test()
{
BOOST_FOREACH(int... | [
0.2375202476978302,
0.08312611281871796,
0.3488145172595978,
-0.30412757396698,
-0.01856762357056141,
0.1670990139245987,
0.32515159249305725,
-0.4584120512008667,
0.09797149151563644,
-0.4668647050857544,
-0.29102593660354614,
0.6813794374465942,
-0.21967357397079468,
-0.20595793426036835... | |
return 0;
}
```
Search the Boost [bugbase](https://svn.boost.org/trac/boost/search?ticket=on) if you want more details. | [
-0.013453757390379906,
-0.042200200259685516,
0.1330338567495346,
0.04932742565870285,
0.06723085790872574,
-0.3019314706325531,
0.1936519891023636,
0.390394002199173,
-0.23275938630104065,
-0.316536009311676,
-0.43628835678100586,
0.7581799626350403,
-0.5339173674583435,
-0.00525744445621... | |
I have a server side button as
```
<asp:Button ID="btnSummary" runat="server" OnClick="btnSummary_Click" Text="Next" />
```
I want to attach the jQuery Click event using its ID and NOT using the alternative class attribute way.
I tried to attach the click event as:
```
$("#btnSummary").click(function()
{... | [
-0.07717220485210419,
-0.1306004673242569,
0.4852445721626282,
-0.24231308698654175,
-0.2122224122285843,
-0.018914632499217987,
0.11069372296333313,
-0.20722611248493195,
-0.26427707076072693,
-0.3982149064540863,
-0.013677623122930527,
0.5938838124275208,
-0.3952924609184265,
0.101228609... | |
to your asp:button, something like this:
```
<asp:Button ID="Button1" runat="server" ClientIDMode="Static" Text="Button" />
```
This will make the ID remain the same. It disables the autogenerated names for this control.
Here is the reference for this: <http://msdn.microsoft.com/en-us/library/system.web.ui.control.... | [
-0.06093868985772133,
-0.34552693367004395,
0.5238119959831238,
0.08376576751470566,
0.17425537109375,
0.15739530324935913,
0.07176755368709564,
0.016367243602871895,
-0.5739231705665588,
-0.6347429752349854,
-0.23534303903579712,
0.42898842692375183,
-0.3848230242729187,
0.014447729103267... | |
NET MVC 1.0.
I use
```
ViewData["DeptID"] = new SelectList(DeptID, "ID", "Name", course.DeptID);
```
where I am passing the selected value `DeptID` as forth parameter, but it doesn't work. When I debug, then the above selection list is correct with the selected value.
I use
```
<%= Html.DropDownList("DeptID", (S... | [
-0.021855870261788368,
-0.14394664764404297,
0.6670294404029846,
-0.5008295774459839,
-0.31365862488746643,
-0.19200384616851807,
0.3910055458545685,
-0.3185136318206787,
-0.05751027539372444,
-0.7730162739753723,
-0.21617397665977478,
0.8065877556800842,
-0.5264918804168701,
-0.0696489438... | |
The spate of questions regarding `BOOST_FOREACH` prompts me to ask users of the Boost library what (if anything) they are doing to prepare their code for portability to the proposed new C++ standard (aka C++0x). For example, do you write code like this if you use `shared_ptr`:
```
#ifdef CPPOX
#include <memory>
#else
... | [
0.5915069580078125,
0.3620932996273041,
0.006700470112264156,
-0.08047743886709213,
-0.3204679489135742,
-0.2197631597518921,
0.00690038176253438,
0.12417838722467422,
-0.16378259658813477,
-0.30538409948349,
0.01787932589650154,
0.7237392663955688,
-0.13662706315517426,
-0.070429101586341... | |
exactly a flood of answers - does this mean it's a non-issue? Anyway, thanks to those that replied; I'm accepting jalfs answer because I like being advised to do nothing!**
The simple answer is "do nothing". Boost is not going to remove the libraries that got adopted into 0x. So boost::shared\_ptr will still exist. So ... | [
0.47429224848747253,
0.08060472458600998,
0.41531699895858765,
0.19121111929416656,
-0.10477659106254578,
-0.24612724781036377,
0.4083024859428406,
-0.06353151798248291,
-0.05175231397151947,
-0.2238512933254242,
-0.15884380042552948,
0.7400988340377808,
-0.18570435047149658,
-0.1469045579... | |
still compile when 0x hits... and it should, just like that. Boost isn't going to delete half their libraries. (I'm not guessing. They've stated this on their mailing list before)
(and if you want to switch to the standard shared\_ptr, I'd say it's probably easier to just do a simple search/replace when the time comes... | [
0.4165337383747101,
0.21905098855495453,
0.15014836192131042,
0.15487775206565857,
0.09625890105962753,
-0.2635296881198883,
0.2060053050518036,
0.15395304560661316,
-0.38269659876823425,
-0.45092514157295227,
-0.03481796383857727,
0.6425168514251709,
-0.028210991993546486,
-0.043195456266... | |
How do you print all variables available in the context of a Smarty template? Something like the Django debug trace that lists everything being passed.
Thanks
Use `{debug}` [From the manual](http://www.smarty.net/docs/en/language.function.debug.tpl):
> `{debug}` dumps the debug console to the
> page. This works rega... | [
0.48211589455604553,
0.030715418979525566,
0.340047687292099,
0.11111486703157425,
-0.045379363000392914,
-0.4674393832683563,
0.46749794483184814,
-0.1155276745557785,
-0.17064692080020905,
-0.7375919222831726,
-0.08534698933362961,
0.5606919527053833,
-0.2701691687107086,
-0.269373893737... | |
settings or class, and site popups must be unblocked to see the window | [
0.20619170367717743,
-0.11315172165632248,
0.11741511523723602,
0.2466624230146408,
0.2566942572593689,
-0.22811660170555115,
0.4021244943141937,
0.5249482989311218,
-0.17833544313907623,
-0.7066451907157898,
-0.539189338684082,
0.13226200640201569,
-0.027950819581747055,
0.219973072409629... | |
i created a UITextField of type rounded textfield, using Interface Builder,so in order to set the Height of a textfield its window was disabled(not to set any height manually) in SizeInspector.so if we want to set height manually,what procedure should we follow.
One thing i would like to mention is ,we can do that in ... | [
0.12386994063854218,
-0.04590064659714699,
0.6592739820480347,
0.06196116283535957,
-0.2681869566440582,
-0.04435022920370102,
0.11003854870796204,
-0.2343253493309021,
-0.06395132839679718,
-0.8364866375923157,
0.06629829108715057,
0.5084755420684814,
-0.09283445030450821,
-0.045153625309... | |
rules from [iPhone Human Interface Guidelines](http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/Introduction/Introduction.html) | [
0.03169453144073486,
0.04507698118686676,
0.22614242136478424,
-0.05474904179573059,
0.17919903993606567,
-0.34229370951652527,
0.061416905373334885,
-0.7094914317131042,
-0.297518789768219,
-0.28444960713386536,
-0.39109736680984497,
0.2817927896976471,
-0.4353640079498291,
-0.46124568581... | |
Where can I find good Java web services practicals and tutorials (I'm a newbe to JWS so I prefer from the scratch).
Thanks.
Try the [Sun Tutorial](http://java.sun.com/webservices/docs/1.6/tutorial/doc/). These are usually very good | [
0.34113162755966187,
0.19866760075092316,
-0.26937708258628845,
0.009697775356471539,
-0.13899193704128265,
-0.3641864061355591,
0.3462105095386505,
0.34047216176986694,
-0.23212049901485443,
-0.7488943338394165,
0.04130757972598076,
0.48450320959091187,
0.2531175911426544,
-0.282723277807... | |
I use a snippet in <http://www.djangosnippets.org/snippets/1034/> for my Model inheritance. It works fine at the first. However, after I delete some elements in database, the code works wrong.
As I debug, I found that the problem is reside in the method: as\_leaf\_class.
In the following code:
```
if (model == Meal):
... | [
0.0590549111366272,
0.1607431024312973,
0.2093488574028015,
-0.17028875648975372,
-0.10707896947860718,
0.19988621771335602,
0.07256156951189041,
-0.2644345462322235,
-0.28040534257888794,
-0.6047263741493225,
0.25481662154197693,
0.470679372549057,
-0.3872394561767578,
0.3137304484844208,... | |
= super(SubclassingQuerySet, self).__getitem__(k)
if isinstance(result, models.Model) :
return result.as_leaf_class()
else :
return result
def __iter__(self):
for item in super(SubclassingQuerySet, self).__iter__():
yield item.as_leaf_class()
class MealMa... | [
-0.3658347427845001,
-0.3818150460720062,
0.3681715428829193,
-0.12173105031251907,
0.016125580295920372,
0.231805682182312,
0.07791122049093246,
-0.4291791021823883,
-0.4446430206298828,
-0.7205989956855774,
-0.4508676826953888,
0.5044626593589783,
-0.2589380145072937,
0.3279549479484558,... | |
name = models.TextField(max_length=100)
content_type = models.ForeignKey(ContentType,editable=False,null=True)
objects = MealManager()
def save(self, *args, **kwargs):
if(not self.content_type):
self.content_type = ContentType.objects.get_for_model(self.__class__)
super(Meal... | [
-0.08514080941677094,
-0.05529917776584625,
0.2631291449069977,
-0.32527855038642883,
0.170349583029747,
0.2706337869167328,
0.15523268282413483,
-0.16809521615505219,
-0.36559176445007324,
-0.7252774238586426,
-0.36137083172798157,
0.5477955341339111,
-0.25849032402038574,
0.2708867192268... | |
return self
return model.objects.get(id=self.id)
class Salad (Meal) :
too_leafy = models.BooleanField(default=False)
objects = MealManager()
```
Try the [Sun Tutorial](http://java.sun.com/webservices/docs/1.6/tutorial/doc/). These are usually very good | [
-0.10023204237222672,
-0.14560559391975403,
-0.07500599324703217,
-0.4156203269958496,
0.04181506112217903,
-0.00016824422345962375,
0.08109254390001297,
-0.06247857213020325,
-0.19966408610343933,
-0.7318102717399597,
0.04211961105465889,
0.8062728047370911,
-0.055223412811756134,
-0.1918... | |
Has anybody here ever used ngen? Where? why? Was there any performance improvement? when and where does it make sense to use it?
Yes, I've seen performance improvements. My measurements indicated that it did improve startup performance if I also put my assemblies into the GAC since my assemblies are all strong named. I... | [
0.10919991135597229,
0.014702705666422844,
-0.11753426492214203,
-0.12168192863464355,
-0.031061580404639244,
-0.15548007190227509,
0.10917163640260696,
0.2747192084789276,
-0.4715048372745514,
-0.5568374991416931,
0.33149483799934387,
0.5150700807571411,
-0.30836522579193115,
0.2269493043... | |
loading the whole managed assembly from disk so it can validate it circumventing one of the major benefits of NGen.
This wasn't a very good option for my application since we rely on common assemblies from our company (that are also strong named). The common assemblies are used by many products that use many different... | [
0.22428132593631744,
-0.10639715939760208,
-0.2975885272026062,
0.09957881271839142,
-0.3304283320903778,
-0.14547352492809296,
0.007950201630592346,
0.09956298023462296,
-0.397276908159256,
-0.4008371829986572,
0.2219027578830719,
0.7067766785621643,
-0.22000664472579956,
0.19108042120933... | |
weren't worth the risks. | [
0.41787654161453247,
0.19357213377952576,
-0.3330524265766144,
0.5549008846282959,
-0.25149181485176086,
0.11572477966547012,
0.4833221435546875,
-0.06675231456756592,
0.017305411398410797,
0.23097829520702362,
0.28386905789375305,
0.07687170803546906,
-0.16113489866256714,
-0.109614066779... | |
I have been trying to draw an [annulus](http://en.wikipedia.org/wiki/Annulus_(mathematics)) (ring with thickness) with a transparent hole and a gradient rim in C# with very little success. Does anyone have any suggestions on how to do this?
here's a nice [Blend Utility](http://www.codeproject.com/KB/miscctrl/ColorBlen... | [
0.1085558533668518,
-0.10126645863056183,
0.7540753483772278,
-0.091020867228508,
-0.09896120429039001,
0.25110992789268494,
0.055112291127443314,
-0.46996045112609863,
-0.2089107483625412,
-0.7109833359718323,
0.08381462097167969,
0.16127343475818634,
0.06381122767925262,
0.16712637245655... | |
* 2) + x, (int)(side * 2) + y);
return rec;
}
void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics gTarget = e.Graphics;
gTarget.SmoothingMode = SmoothingMode.AntiAlias;
GraphicsPath pTemp = new GraphicsPath();
Rectangle r = GetSquareRec(200, 225, 225);
... | [
-0.013005332089960575,
-0.6032982468605042,
0.8582009077072144,
-0.055067434906959534,
-0.30578309297561646,
0.6244855523109436,
0.017950158566236496,
-0.567038893699646,
-0.3355778455734253,
-0.6138043403625488,
-0.2523147761821747,
0.5152520537376404,
-0.3842756450176239,
-0.094611808657... | |
Color[] colors = new Color[5];
colors[0] = Color.FromArgb(192, 192, 192);
colors[1] = Color.FromArgb(105, 0, 0);
colors[2] = Color.FromArgb(169, 169, 169);
colors[3] = Color.FromArgb(0, 0, 0);
colors[4] = Color.FromArgb(0, 0, 0);
float[] positions = new float[5];
... | [
-0.09413398057222366,
0.01458190381526947,
0.7040382623672485,
-0.09890159964561462,
0.05516070872545242,
0.3241904079914093,
-0.003775928169488907,
-0.6751961708068848,
-0.19108368456363678,
-0.3299281895160675,
-0.565437912940979,
0.32090580463409424,
-0.2649146616458893,
0.2796095311641... | |
= 0.1f;
positions[2] = 0.35f;
positions[3] = 0.5f;
positions[4] = 1f;
ColorBlend Cb = new ColorBlend();
Cb.Colors = colors;
Cb.Positions = positions;
PathGradientBrush pgb = new PathGradientBrush(pTemp);
pgb.InterpolationColors = Cb;
pgb.CenterPo... | [
-0.14789411425590515,
-0.2337375432252884,
1.1232556104660034,
-0.018088841810822487,
0.030403830111026764,
0.3282196521759033,
0.12220784276723862,
-0.5924039483070374,
-0.2331794798374176,
-0.32902103662490845,
0.002505189273506403,
0.17899999022483826,
-0.023885618895292282,
0.396844655... | |
2), r.Y + (r.Height / 2));
gTarget.FillPath(pgb, pTemp);
}
```
<http://www.freeimagehosting.net/uploads/th.515733e62e.jpg>
This is how I did it in the [Scrolling Game Development Kit](http://sgdk2.sf.net/):
```
pTemp = new GraphicsPath();
pTemp.AddEllipse(Start.X, Start.Y, End.X - Start.X, End.Y - Start... | [
-0.0336257740855217,
-0.14025907218456268,
0.8690849542617798,
-0.08408575505018234,
-0.03871333599090576,
0.3434884250164032,
-0.0951903760433197,
-0.3605475425720215,
-0.3893977105617523,
-0.47346189618110657,
-0.30306950211524963,
0.755065381526947,
-0.4700254499912262,
-0.1304614692926... | |
(End.Y - Start.Y) / 2f);
PathGradientBrush pgb = new PathGradientBrush(pTemp);
Blend b = new Blend();
b.Factors = new float[] { 0, 1, 1 };
b.Positions = new float[] { 0, .5F, 1 };
pgb.Blend = b;
pgb.CenterColor = ((SolidBrush)CurrentBrush).Color;
pgb.SurroundColors = new Color[] {CurrentPen.Color};
gTarget.FillPath(pgb... | [
-0.01348769199103117,
-0.3718588352203369,
0.8080776333808899,
-0.1929585337638855,
0.11877007782459259,
0.29502034187316895,
0.2027941644191742,
-0.6195119619369507,
0.09700444340705872,
-0.46952304244041443,
0.07901083678007126,
0.45489901304244995,
-0.38472211360931396,
-0.0869432166218... | |
this:
```
Blend blend = new Blend();
blend.Factors = new float[] { 0, 1, 0, 0 };
blend.Positions = new float[] { 0, 0.25F, .5F, 1 };
pgb.Blend = blend;
``` | [
0.05139665678143501,
-0.3320334553718567,
0.7662591934204102,
-0.339702308177948,
0.1409323364496231,
0.1262308657169342,
-0.10007581859827042,
-0.4762871563434601,
0.008357633836567402,
-0.33105745911598206,
-0.30540668964385986,
0.4966357946395874,
-0.4260466694831848,
0.0291754901409149... | |
I was wondering how i should go about writing an XML data layer for a fairly simple php web site. The reasons for this are:
1. db server is not available.
2. Simple data schema that can be expressed in xml.
3. I like the idea of having a self contained app, without server dependencies.
4. I would possibly want to abst... | [
0.29956772923469543,
0.3362029194831848,
0.37937062978744507,
-0.05958028510212898,
-0.5334909558296204,
-0.13522018492221832,
0.35256803035736084,
-0.403301864862442,
-0.11230630427598953,
-0.5411155223846436,
0.007068997249007225,
0.24553602933883667,
-0.37000423669815063,
0.028915492817... | |
to 15mb. But it could grow at some point to ~100mb.
I am actually considering extending my model classes to handle xml data.
Currently I fetch data with a combination of XMLReader and SimpleXml, like this:
```
public function find($xpath){
while($this->xml_reader->read()){
if($this->xml_rea... | [
-0.05182981491088867,
-0.29517972469329834,
0.9942797422409058,
-0.17745642364025116,
-0.010628394782543182,
-0.09631351381540298,
-0.1396562159061432,
-0.35468003153800964,
-0.009673151187598705,
-0.7034311294555664,
-0.09873057901859283,
0.6621170043945312,
-0.05370171368122101,
0.089304... | |
$dom = new DOMDocument();
$n = $dom->importNode($node, true);
$dom->appendChild($n);
$sx = simplexml_import_dom($n);
// xpath returns an array
$res = $sx->xpath($xpath);
if(isset($res[0]) && $res[0]){ | [
-0.21471507847309113,
-0.22982408106327057,
0.7976670861244202,
-0.38248518109321594,
0.04710843786597252,
0.2143489122390747,
0.49120140075683594,
-0.48239168524742126,
-0.2009027898311615,
-0.3390611708164215,
-0.5836496353149414,
0.7602663040161133,
-0.17965736985206604,
0.3253411352634... | |
$this->results[] = $res;
}
}
return $this->results;
}
```
So, instead of loading the whole xml file in memory, I create a SimpleXml object for each section and run an xpath query on that object. The function returns an array of SimpleXml objects. For conservative search I ... | [
0.08145224303007126,
0.019859082996845245,
0.6099613904953003,
0.07182438671588898,
-0.0937594622373581,
-0.059415895491838455,
0.22061090171337128,
-0.47926566004753113,
-0.022991979494690895,
-0.4111548662185669,
-0.32490235567092896,
0.5454862117767334,
-0.3313297629356384,
0.1778715550... | |
i have to ask are:
1. Would you consider this as a viable solution, even for a medium to large data store?
2. Are there any considerations/patterns to keep in mind, when handling XML in PHP?
3. Does the above code scale for large files (100mb)?
4. Can inserts and updates in large xml files be handled in a low overhead... | [
0.558901846408844,
0.1346440613269806,
0.017506614327430725,
0.09457600116729736,
-0.15974514186382294,
-0.04885194078087807,
0.05542173981666565,
-0.5401350855827332,
-0.3406078815460205,
-0.31022968888282776,
0.29272112250328064,
0.516950786113739,
0.21183830499649048,
-0.111818663775920... | |
store, use a data-base, not a markup language.
PHP has good support for various database systems via [PDO](http://www.php.net/manual/en/intro.pdo.php); for small data sets, you can use SQLite, which doesn't need a server (it is stored in a normal file). Later, should you need to switch to a full-featured database, it ... | [
0.10222109407186508,
0.05322331190109253,
0.25733092427253723,
0.49857383966445923,
-0.1413872092962265,
-0.1701124757528305,
-0.11900419741868973,
0.14608561992645264,
-0.3173292577266693,
-0.5606327652931213,
0.0006931223906576633,
0.11159911006689072,
-0.2422412782907486,
0.023908674716... | |
write (slow to parse,large memory footprint, etc.). While you could subvert XML to work as a data store, it is simply the wrong tool for the job.
3. No (everything will take forever, if you don't run out of memory before that).
4. No, for many reasons (locking, re-writing the whole XML-string/file, not to mention memor... | [
0.1953471153974533,
0.20333756506443024,
0.4870430827140808,
-0.012486453168094158,
-0.23313848674297333,
-0.14116856455802917,
0.30416080355644226,
-0.45894235372543335,
-0.1424773633480072,
-0.6248066425323486,
0.05063902959227562,
0.280855655670166,
-0.20376063883304596,
0.2023603916168... | |
store, consider a relational database (and it is usually easier to switch databases than to switch from XML to a database). | [
0.22411687672138214,
0.3270549178123474,
-0.0464576780796051,
0.27161481976509094,
0.10969536006450653,
0.06669266521930695,
-0.2416478395462036,
0.07509715110063553,
-0.019177524372935295,
-0.6244268417358398,
-0.3463476598262787,
0.3422207236289978,
-0.3341521620750427,
0.230648264288902... | |
Are there any conditions that a language must satisfy so that a meta-circular evaluator can be written for that language? Can I write one for BASIC, or for Python?
To quote [Reg Braithwaite](http://weblog.raganwald.com/2006/11/significance-of-meta-circular_22.html):
> The difference between self-interpreters and meta-... | [
0.05750901997089386,
0.3896060287952423,
-0.3215359151363373,
-0.1201181635260582,
-0.3365268409252167,
0.42059609293937683,
0.20801739394664764,
-0.35150471329689026,
-0.11567490547895432,
0.09809748083353043,
0.10302333533763885,
0.6757029891014099,
-0.24808934330940247,
-0.1518281996250... | |
primary representation of the program is a primitive datastructure of the language itself. Lisp exhibits this by virtue of the fact that programs are themselves expressed as lists. | [
-0.17922937870025635,
0.3181227445602417,
-0.12098647654056549,
0.016173098236322403,
-0.34076979756355286,
0.27315661311149597,
0.0425616055727005,
0.0336473248898983,
-0.13976432383060455,
-0.3646170198917389,
-0.3181869685649872,
0.3973628878593445,
-0.6802405118942261,
-0.5317277908325... | |
Most of the time I worked as an application developer at backend side. I worked on enterprise web projects but never touched on user interface, design issues.
Good looking web sites and user interfaces always impress me.
And nowadays I am trying to develop public web site I know CSS, HTML but stuck with web design /... | [
0.9203554391860962,
0.2836557626724243,
-0.2122923880815506,
0.233417347073555,
-0.21275481581687927,
-0.14401206374168396,
0.28047510981559753,
0.30099576711654663,
-0.14850515127182007,
-0.562222957611084,
0.20086981356143951,
0.7386863231658936,
0.012854612432420254,
0.5185529589653015,... | |
interfaces a god's gift?
Looks like you hit on a hot topic. As a web/graphic designer myself, I think the best way to improve your ability in that regard is to look at a lot of good designs; meaning, actively seek them out.
As pixeline says, there's not a lot of objective knowledge to be learned (though there is *some... | [
0.7158697843551636,
0.3150859773159027,
0.32417207956314087,
0.35476118326187134,
-0.5573024749755859,
0.05666585639119148,
0.38662517070770264,
0.18432782590389252,
-0.15964820981025696,
-0.9958184957504272,
0.3881215751171112,
0.7264400124549866,
-0.06783434748649597,
-0.2047508209943771... | |
label, so from time to time I'm called upon to work on band sites, album designs, magazine ads, sticker/clothing/merch designs, etc. So I'm always flipping through metal magazines and looking at ads designed by other people, or admiring the merch designs of other bands, or checking out the sites of other labels.
This ... | [
1.1900240182876587,
0.4785189926624298,
-0.2907371520996094,
-0.10154405236244202,
0.09878147393465042,
-0.2069385051727295,
0.14818574488162994,
0.2186543345451355,
-0.32663896679878235,
-0.4782143235206604,
0.09784694761037827,
0.7283055782318115,
0.2689041793346405,
0.545674204826355,
... | |
people's tastes are always changing. A good designer knows how to stay just ahead of the curve all the time. This means that your designs don't deviate too drastically from accepted aesthetics (otherwise your designs will be rejected by audiences), but you also don't want to employ design elements that are overused and... | [
0.820417582988739,
0.04448708891868591,
0.20090726017951965,
0.2681763172149658,
0.0784393772482872,
-0.11661065369844437,
0.2698391079902649,
0.34202155470848083,
-0.4132349193096161,
-0.8387265801429749,
-0.016618842259049416,
0.639297604560852,
0.07916878908872604,
0.24459528923034668,
... | |
while making it their own by adding their own twist to it.
If you're just starting to venture into web/graphic design, don't be afraid to emulate others and steal good ideas. Don't plagiarize, and give credit where credit is due, but just as making copies of famous drawings/paintings is an essential training technique... | [
0.950060248374939,
-0.24026528000831604,
0.013176207430660725,
0.27969762682914734,
0.12502479553222656,
-0.1762388050556183,
0.25442004203796387,
0.330361008644104,
-0.526344895362854,
-0.6750674843788147,
0.25321924686431885,
0.3202546238899231,
0.3926364481449127,
0.04861762002110481,
... | |
flood your mind with examples of good aesthetics.
EDIT: I also want to emphasize that talent is not as much of a factor as most people would think. More often, **interest** is what people confuse as "talent." If you truly have an interest in something, you will be motivated to immerse yourself in it and practice it. T... | [
0.7715078592300415,
0.11174440383911133,
0.06072225794196129,
0.42882347106933594,
0.10186625272035599,
-0.1690783053636551,
0.18650667369365692,
0.2892586886882782,
-0.2190595269203186,
-0.8817726969718933,
0.14495523273944855,
0.7701388001441956,
0.404276967048645,
-0.5023905038833618,
... | |
can check out my portfolio via my profile link) and an alright artist. And people often comment on how talented I am, but they don't realize that I have literally spent thousands of hours honing my craft. While other kids were out playing with their friends, I was in my room drawing. That's the only reason I excelled i... | [
1.169739007949829,
0.4331852197647095,
-0.3570069968700409,
-0.045181550085544586,
-0.12657932937145233,
-0.08846821635961533,
0.4215480387210846,
0.7374569773674011,
-0.5099508166313171,
-0.6756319403648376,
0.21732619404792786,
0.5236021876335144,
0.4376485347747803,
0.3199831247329712,
... | |
The question probably applies to drawing systems in general. I was wondering how the undo functionality is implemented in PS. Does the program take snapshots of the canvas before each operation? If so, wouldn't this lead to huge memory requirements? I've looked into the Command pattern, but I can't quite see how this w... | [
0.36656323075294495,
-0.10634435713291168,
0.28155404329299927,
0.22983913123607635,
-0.23387302458286285,
0.2208978235721588,
-0.048558034002780914,
-0.3320915400981903,
-0.5738258957862854,
-0.936392068862915,
0.017073608934879303,
0.36204826831817627,
-0.29818353056907654,
-0.2240925729... | |
and they get garbage collected or reference counted (ex: using `shared_ptr` in C++).
Now when the user makes changes to an image tile, you create a new version while shallow copying the unmodified tiles:
[](https://i.stack.imgur.com/syaYe.jpg)
Every... | [
0.01772971637547016,
0.04203960299491882,
0.5254834294319153,
0.028326500207185745,
0.10162626206874847,
0.10381969809532166,
0.12771402299404144,
-0.3810594975948334,
-0.39494043588638306,
-0.779985785484314,
-0.1363089680671692,
0.5718975067138672,
-0.27822190523147583,
0.167493224143981... | |
stored over and over in each undo entry. As a bonus when users copy and paste layers, it barely takes any more memory unless/until they make changes to that pasted layer. It basically provides you an instancing system for images. As yet another bonus, when a user creates a transparent layer that's, say, 2000x2000 pixel... | [
0.1713232696056366,
-0.20298734307289124,
0.41840124130249023,
0.34514787793159485,
-0.0875062420964241,
-0.12724116444587708,
0.1392192393541336,
-0.16994909942150116,
-0.4712316393852234,
-0.7311944365501404,
0.12431112676858902,
0.24630331993103027,
-0.02725704200565815,
-0.179646044969... | |
layers, because you don't have to alpha blend the empty image tiles and can just skip over them. It also speeds up image filters in those cases as well since they can likewise just skip over the empty tiles.
As for PS actions, that's a bit of a different approach. There you might use some scripting to indicate what ac... | [
0.43828660249710083,
-0.3517124056816101,
0.20206332206726074,
0.3191589415073395,
-0.09167719632387161,
-0.09419182687997818,
0.042530402541160583,
-0.12244279682636261,
-0.29304423928260803,
-0.8816109895706177,
-0.3273824453353882,
0.39350980520248413,
-0.30067041516304016,
-0.461539208... | |
blow up memory usage to cache previous states of an image for undoing without having to fiddle with writing separate undo/redo logic for all kinds of different operations that could occur. | [
0.3860277235507965,
0.18656255304813385,
-0.170983225107193,
0.4541706442832947,
0.009609492495656013,
-0.08068513870239258,
0.32338982820510864,
-0.023479938507080078,
0.0947975367307663,
-0.6156985759735107,
-0.2724563777446747,
0.08908785134553909,
-0.17741873860359192,
0.31006547808647... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.