text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
[The X-Frame-Options response header](https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options).
From the MDN:
> The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a frame or iframe. Sites can use this to avoid clickjacking attacks, by... | [
0.00041362547199241817,
-0.20210404694080353,
0.4397885799407959,
-0.03741783648729324,
-0.12753793597221375,
-0.041561685502529144,
0.18272338807582855,
-0.1098501905798912,
-0.3285599648952484,
-0.621882975101471,
-0.4308982193470001,
0.3886759281158447,
-0.32876354455947876,
-0.10944969... | |
I have seen code around with these two styles , I am not not sure if one is better than another (is it just a matter of style)? Do you have any recommendations of why you would choose one over another.
```
//Example1
class Test {
private:
static const char* const str;
};
const char* const Test::str = ... | [
0.1435699611902237,
0.2287958413362503,
-0.15684998035430908,
-0.1437862068414688,
-0.27536821365356445,
0.18501877784729004,
0.5003104209899902,
-0.15146058797836304,
-0.0008095224038697779,
-0.5268958806991577,
-0.20026502013206482,
0.5955544114112854,
-0.2947212755680084,
-0.11545541137... | |
pointer initialized with the string literal has a significant benefit.
There are two initializations for static data. The one is called static initialization, and the other is called dynamic initialization. For those objects that are initialized with constant expressions and that are PODs (like pointers), C++ require... | [
-0.13175827264785767,
-0.3514105975627899,
0.055497653782367706,
0.03375372663140297,
-0.09604685753583908,
-0.047598376870155334,
-0.22308164834976196,
-0.016835400834679604,
0.025302985683083534,
-0.40160447359085083,
-0.4122920632362366,
0.5095883011817932,
-0.3300098180770874,
-0.03222... | |
when you use the `const char* const` version, while using the `std::string` version, which isn't initialized statically, you don't know whether the string is already initialized - because the order of initialization of objects across translation unit boundaries is not defined. | [
-0.3430705964565277,
-0.29818519949913025,
0.08114534616470337,
-0.05253147333860397,
-0.17179112136363983,
-0.08644246309995651,
0.2091938853263855,
0.13567006587982178,
-0.06551919132471085,
-0.37670624256134033,
-0.4608643352985382,
0.37906622886657715,
-0.18996499478816986,
0.092415302... | |
After laying out my schema diagram in SQL Server (both 2000 and 2005), I want to print a copy to paper. When I go to print, SQL seems intent on recalculating the pagination (and getting it very wrong).
I'm simply printing to the default printer - an HP Officejet. I've tried forcing a repagination before manually adju... | [
0.17728476226329803,
0.38288602232933044,
0.6503369808197021,
-0.20072534680366516,
-0.15552225708961487,
0.12006320059299469,
-0.1875305026769638,
0.049162521958351135,
-0.2667340040206909,
-0.7928490042686462,
0.1613595187664032,
0.4753951132297516,
-0.3267587423324585,
0.167266041040420... | |
when I want a hard copy printout.
What's the deal with this very unhelpful "feature" of SQL Server?
The ability to print the SQL Diagrams has always been an issue. That's about the best answer I can give you. | [
0.5261666774749756,
0.2748244106769562,
0.020294684916734695,
0.34470251202583313,
0.018170539289712906,
-0.40789321064949036,
0.15338198840618134,
0.4279073476791382,
-0.12050523608922958,
-0.37128642201423645,
0.18795904517173767,
0.48754847049713135,
-0.09324827790260315,
-0.03454924002... | |
I am working in a project that has two main parts: a class library assembly and the main application. Both are using Castle Windsor for IoC and both manually setup their list of of components in code (to aid refactoring and prevent the need for a config file). Currently the main application has code like this:
```
pub... | [
0.6381086111068726,
0.13126656413078308,
-0.09692022204399109,
-0.07576295733451843,
0.12588109076023102,
-0.49654847383499146,
0.06527829170227051,
-0.3944448232650757,
-0.020226946100592613,
-0.5961979627609253,
-0.12208853662014008,
0.19129684567451477,
-0.13481467962265015,
0.194249689... | |
// Start the application code ...
}
```
However the call to initialise the library doesn't seem like a good solution. What is the best way to setup a class library that uses an IoC container to decouple its internal components?
---
**Edit:**
* [Lusid](https://stackoverflow.com/users/56855/lusid) proposed using a s... | [
0.06471507251262665,
-0.052141331136226654,
0.10763230919837952,
0.07497543841600418,
-0.17772117257118225,
-0.17344410717487335,
-0.19155846536159515,
-0.19096730649471283,
-0.14945004880428314,
-0.6753777861595154,
-0.27519306540489197,
0.0876326858997345,
-0.5252968072891235,
0.13326993... | |
the `AppDomain.AssemblyLoad` event to perform custom steps at load time, however I am really after a way to avoid the client assembly from requiring any setup code.
Thanks!
I'm not sure if I'm understanding exactly the problem you are trying to solve, but my first guess is that you are looking for a way to decouple th... | [
0.05930394306778908,
-0.05449139326810837,
0.32922717928886414,
-0.15146063268184662,
-0.09167922288179398,
0.05745746195316315,
0.2273339033126831,
-0.15673650801181793,
-0.4201682507991791,
-0.7016627192497253,
-0.1455598920583725,
0.6634258031845093,
-0.874119758605957,
-0.0060676820576... | |
class libraries, and would like a quick and dirty way of evaluating all of them as they are loaded, here's a (kinda hairy) way:
```
[STAThread]
static void Main()
{
AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
}
static void CurrentDomain_AssemblyLoad(object sen... | [
0.1774967461824417,
-0.1637820601463318,
0.412718802690506,
-0.02640126459300518,
0.258780300617218,
0.12092406302690506,
0.32985547184944153,
-0.1997719556093216,
-0.21682876348495483,
-0.4947143793106079,
-0.100314661860466,
0.4834771752357483,
-0.6785035133361816,
0.3671759366989136,
... | |
assembly that gets loaded into the current AppDomain, and then I can do something with it, whether it be registering dependencies, maintaining an internal list, whatever.
Might not be exactly what you are looking for, but hopefully it helps in some way. | [
0.4402199983596802,
-0.15977998077869415,
0.4161433279514313,
0.20240336656570435,
0.1930156946182251,
0.08673074096441269,
-0.09071028977632523,
0.03233950212597847,
-0.359110951423645,
-0.6521646976470947,
-0.08491799235343933,
0.3002345561981201,
-0.24611571431159973,
-0.130259096622467... | |
I have a simple html block like:
```
<span id="replies">8</span>
```
Using jquery I'm trying to add a 1 to the value (8).
```
var currentValue = $("#replies").text();
var newValue = currentValue + 1;
$("replies").text(newValue);
```
What's happening is it is appearing like:
81
then
811
not 9, which would be t... | [
-0.2702130079269409,
0.11332768946886063,
0.6240816712379456,
-0.2792052626609802,
-0.2555304169654846,
0.20943237841129303,
0.3392041027545929,
-0.17988719046115875,
-0.28243333101272583,
-0.7178990840911865,
-0.05503831431269646,
0.4103643298149109,
-0.2547402083873749,
0.068234942853450... | |
Let's say that I have a Flash website where you could create an avatar and some motion.
Is there a way to save those into an animated GIF with a server-side language ? (php is preferred)
I've looked around and all I've got are ways to do that with the Flash software itself. Has anybody tried this ?
Thanks in advance... | [
0.292944073677063,
0.12246531248092651,
-0.1439151018857956,
0.23245304822921753,
-0.12803591787815094,
0.37062734365463257,
0.21363714337348938,
0.1030101329088211,
-0.3981439173221588,
-0.7217139005661011,
-0.1850430816411972,
0.3829371929168701,
-0.1301000714302063,
-0.39400458335876465... | |
Can someone please explain why this program outputs 0x00000004?
```
class AndAssignment
{
static void Main()
{
int a = 0x0c;
a &= 0x06;
Console.WriteLine("0x{0:x8}", a);
}
}
/*
Output:
0x00000004
*/
```
0x0c = 1100 in binary
0x06 = 0110 in binary
& operation is a binary AND... | [
-0.17822015285491943,
-0.10272426903247833,
0.1945759356021881,
-0.028439586982131004,
0.30239391326904297,
0.18420684337615967,
0.13665072619915009,
-0.05059226602315903,
-0.2020428329706192,
-0.42903563380241394,
-0.19096753001213074,
0.571412205696106,
-0.15329688787460327,
0.2375007718... | |
use windows calculator to see how integers is presented in different forms (hex and binary in your case). [More info](http://en.wikipedia.org/wiki/Hexadecimal). | [
0.058602239936590195,
0.1435062289237976,
0.013555274344980717,
0.22431066632270813,
0.07535824924707413,
-0.01057412289083004,
-0.18734700977802277,
0.00012597667227964848,
-0.5323452353477478,
-0.585269570350647,
-0.09033820033073425,
0.45342227816581726,
-0.2046205848455429,
-0.23384898... | |
I would like to know people's thoughts on the best way to do the opposite to [Phil Haack's Model Binding To A List](http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx). I have a form which contains several individual fields as well as form fields which are created dynamically using JQuery. This means th... | [
0.4437296986579895,
-0.03634285181760788,
0.08836060017347336,
0.014600537717342377,
-0.22495727241039276,
-0.10481971502304077,
-0.06798391044139862,
-0.1854051798582077,
-0.49534621834754944,
-0.42104023694992065,
0.06732772290706635,
0.4079410433769226,
-0.3421948552131653,
0.1123823747... | |
the correct items are selected for the drop down lists. I have a vague idea that it will involve View User Controls but I am struggling with how to put it all together.
The form:
```
<form action="/MyItems/Edit" method="post">
Title: <input type="text" name="Title" value="" /><br />
Description <input type="tex... | [
-0.35181787610054016,
-0.0494709350168705,
0.5601040720939636,
0.18205773830413818,
0.03726659715175629,
0.24173302948474884,
-0.15772706270217896,
-0.6582670211791992,
-0.11745964735746384,
-0.6579166054725647,
-0.4311477839946747,
0.6198158264160156,
0.0005255485302768648,
-0.24547569453... | |
id="item[1].Amount" name="item[1].Amount" type="text" value="" />
<select id="item[1].selectA"><option value="1">1</option>
<option value="2">2</option><option value="3">3</option></select>
<select id="item[1].selectB"><option value="1">1</option>
<option value="2">2</option><option value="3">3</option></se... | [
-0.1468132883310318,
-0.3870697617530823,
0.35709890723228455,
-0.10686704516410828,
0.027314428240060806,
0.3559960424900055,
0.031740665435791016,
-0.7000381350517273,
-0.4946081042289734,
-0.4246959686279297,
-0.23205161094665527,
0.479787677526474,
-0.26133546233177185,
0.1417827010154... | |
get; set; }
public string Description { get; set; }
public IEnumerable<SelectItem> SelectItems { get; set; }
}
```
Each `SelectItem` then looks like:
```
public class SelectItem
{
public int SelectA { get; set; }
public int SelectA { get; set; }
}
```
I hope I have explained this ok, thanks in adva... | [
0.016994882375001907,
-0.1673678755760193,
0.5961100459098816,
-0.13865849375724792,
0.11447496712207794,
-0.3097311556339264,
0.27632561326026917,
-0.2495097666978836,
-0.16440925002098083,
-0.6717939376831055,
-0.3899441957473755,
0.40894341468811035,
-0.47341758012771606,
0.197480022907... | |
that the same code now sits inside a custom modelbinder. Very neat. | [
0.44404101371765137,
0.1604834645986557,
-0.0027423398569226265,
0.40963783860206604,
0.3248915374279022,
-0.05985571816563606,
0.01997910998761654,
0.23352272808551788,
-0.31156450510025024,
-0.32774320244789124,
0.14412520825862885,
0.326532781124115,
-0.09406685084104538,
-0.02985282987... | |
I've got this pretty simple HTML page with a jQuery datepicker:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Datepicker</title>
<link rel="stylesheet" href="../... | [
0.033098261803388596,
-0.025580497458577156,
0.9342257380485535,
-0.2623876929283142,
-0.024710888043045998,
0.0048880428075790405,
-0.4419812560081482,
-0.018763570114970207,
-0.19658860564231873,
-0.6667284965515137,
-0.024255165830254555,
0.31231191754341125,
0.06814152747392654,
0.0297... | |
}
</script>
</head>
<body>
<input type="text" id="textBox" />
</body>
</html>
```
The datepicker itself seems to work perfectly but I can't apply my theme. Am I missing something really stupid here?
Thanks !!!!
My problem wasn't about the CSS validity or relative paths .... I was just referencing the wrong ... | [
0.2796948552131653,
0.020689595490694046,
0.6194449663162231,
0.1240081787109375,
-0.2887798249721527,
-0.38998275995254517,
0.13193272054195404,
0.32041695713996887,
-0.11473992466926575,
-0.5846385359764099,
0.10761751234531403,
0.6327683925628662,
-0.09531505405902863,
-0.09487976878881... | |
I am trying to come up with a validation for a nullable property, like int.
Example
```
[RangeValidator(0, RangeBoundaryType.Inclusive, 1, RangeBoundaryType.Inclusive)]
int? Age { get; set; }
```
However if I set `Age` to null validation fails because it doesn't fall in the range, I know I need an `[ValidatorCompos... | [
0.4814694821834564,
0.4633617103099823,
0.39405757188796997,
-0.3659767508506775,
0.17340952157974243,
0.17249861359596252,
0.35689347982406616,
-0.4199984073638916,
-0.11344368755817413,
-0.3062092065811157,
-0.2075841873884201,
0.2960335910320282,
-0.0078019024804234505,
0.29283887147903... | |
Several colleagues and I are faced with an architectural decision that has serious performance implications: our product includes a UI-driven schema builder that lets non-programmers build their own data types for a web app. Currently, it builds properly normalized schemas behind the scenes and includes some complex lo... | [
0.3210943937301636,
0.13787104189395905,
0.14197593927383423,
0.3355824649333954,
0.3820909559726715,
-0.06898685544729233,
0.2319713532924652,
-0.26602450013160706,
0.08988198637962341,
-0.5427972078323364,
-0.20515547692775726,
0.4320031702518463,
-0.13126739859580994,
-0.008953811600804... | |
table, so that changes to the data types will never require schema altering. (A single property could be turned into a 1:n relationship, for example, just by changing application logic.)
Because early benchmarking indicates this will exact a huge performance penalty, they have built a caching layer in application code... | [
0.20506832003593445,
0.38907334208488464,
0.38003185391426086,
0.07361313700675964,
0.12564724683761597,
0.03725919872522354,
0.26033416390419006,
-0.08149197697639465,
-0.3770276606082916,
-0.49264538288116455,
-0.04065436124801636,
0.15446139872074127,
-0.2991805374622345,
0.125692307949... | |
guns, or is moving the complexity from "Schema modification tools" to "Schema mirroring tools" a good thing?
> The normalized schemas have hit
> performance bottlenecks in the past,
> and a major refactoring has been
> scheduled. One of the groups of
> developers wants to store every
> property of the data types i... | [
0.6132780909538269,
0.4457777738571167,
0.20095668733119965,
0.23688650131225586,
0.033751849085092545,
0.05427251383662224,
0.35997509956359863,
-0.6825517416000366,
-0.2977917194366455,
-0.3277393579483032,
0.3298950791358948,
0.9588189125061035,
-0.48730629682540894,
-0.1221477761864662... | |
It's going to mess up your database performance. If you store these things on one row they will be physically located together on the disk and treated as one thing for the purposes of locking, etc.
2. Queries that you write are going to require a mass of extra joins and will be very painful. You will end up writing vie... | [
0.3444391191005707,
0.240016371011734,
0.3338296413421631,
0.3945082724094391,
0.125313863158226,
-0.006440849043428898,
0.18422944843769073,
-0.11410336941480637,
-0.43467792868614197,
-0.48009711503982544,
0.3697710931301117,
0.4954851567745209,
-0.43989142775535583,
0.4827463626861572,
... | |
to have to re-code and test a bunch of application code what's the little extra effort in making a database change at that time? You can make your child table, copy the data down into it with an update, and drop teh column from the parent table
5. If you are successful, in the future a different application may attach ... | [
0.4807887375354767,
0.0558999665081501,
0.3513794541358948,
0.4912274181842804,
0.4535551965236664,
0.01801144890487194,
0.3375822603702545,
-0.42282235622406006,
-0.27113983035087585,
-0.49470967054367065,
-0.15575489401817322,
0.3857661187648773,
0.036631666123867035,
0.28416168689727783... | |
too much to fit in memory, (b) you scale to multiple application servers, (c) you have a different application that connects to your database. You're working around a performance problem that is of your own making.
7. You are not going to be able to create an index on multiple columns if they are each living in a child... | [
0.16006343066692352,
0.033204223960638046,
0.3435438573360443,
0.4041687250137329,
0.30411508679389954,
0.16907553374767303,
0.0991402193903923,
-0.03377566114068031,
-0.4748716354370117,
-0.6351150870323181,
0.11550731956958771,
0.28511562943458557,
-0.29839104413986206,
0.498734265565872... | |
I've created a custom object that I'd like to return in JSON to a javascript method. This object was created as a class in C#.
What's the best way to return this object from a PageMethod ([WebMethod] if you like) to a javascript onPageMethodCallback() function? I need to be able to access the properties of this objec... | [
0.07210759073495865,
-0.05486901104450226,
0.45260658860206604,
0.052431657910346985,
-0.12243061512708664,
-0.1430685818195343,
0.16436757147312164,
-0.17732323706150055,
-0.32629144191741943,
-0.7377029061317444,
-0.061414044350385666,
0.6883018016815186,
-0.08117863535881042,
0.24224376... | |
new Name();
name.FirstName = "Dave";
name.LastName = "Ward";
return name;
}
```
You can then call the PageMethod directly from jQuery using basically the same method that JD linked to. More specifically, here's [a post about calling PageMethods with jQuery](http://encosia.com/2008/05/29/using-jquery-to-direct... | [
-0.0932786837220192,
-0.09498865157365799,
0.9282393455505371,
-0.2629460394382477,
-0.44002464413642883,
-0.14701563119888306,
0.15293735265731812,
0.18277519941329956,
-0.296316921710968,
-1.0329734086990356,
-0.24213345348834991,
0.4819811284542084,
-0.07373929768800735,
0.2205462157726... | |
Having the hours and minutes, is there any easier or better way to set it into a Calendar object than:
```
calendar.set(calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH),
hour, minute);
```
From [here]... | [
0.3045826256275177,
0.0037960701156407595,
0.3845110535621643,
-0.09570758044719696,
0.15050217509269714,
0.18552717566490173,
0.11929207295179367,
-0.3221864104270935,
-0.40804192423820496,
-0.4934017062187195,
-0.05052335560321808,
0.2689177691936493,
-0.022506702691316605,
0.05106880888... | |
I've added a file to the 'index' with:
```
git add myfile.java
```
How do I find out the SHA1 of this file?
You want the `-s` option to `git ls-files`. This gives you the mode and sha1 hash of the file in the index.
```
git ls-files -s myfile.java
```
Note that you do not want `git hash-object` as this gives you... | [
0.16259583830833435,
0.25690576434135437,
0.34286734461784363,
-0.10129482299089432,
0.01846318691968918,
-0.16659629344940186,
-0.0387679785490036,
-0.007753448095172644,
-0.1288776695728302,
-0.8457271456718445,
-0.14387743175029755,
0.37975743412971497,
-0.27881908416748047,
0.032349552... | |
When I add an HTTP handler:
```
<add verb="*" path="*test.aspx" type="Handler"/>
```
With the class:
```
using System;
using System.Web;
public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Wri... | [
-0.0844501331448555,
-0.06065976247191429,
0.4176987111568451,
-0.15891124308109283,
-0.10128645598888397,
0.04678880423307419,
0.8489564061164856,
-0.16580693423748016,
-0.04621348902583122,
-0.8938515782356262,
-0.3552352786064148,
0.39916035532951355,
-0.405830055475235,
0.3045360743999... | |
issue, so I tried what follows, but got the same "Could not load type 'Test.Handler'." error.
```
<add verb="*" path="*test.aspx" type="Test.Handler, Test"/>
```
With the class:
```
using System;
using System.Web;
namespace Test
{
public class Handler : IHttpHandler
{
public void ProcessRequest(H... | [
0.015473315492272377,
-0.06442966312170029,
0.2872430384159088,
-0.2291533201932907,
-0.11882355064153671,
0.041959140449762344,
0.5446967482566833,
-0.1466938704252243,
-0.057205863296985626,
-0.7156772613525391,
-0.44186779856681824,
0.48748594522476196,
-0.443432092666626,
0.27423980832... | |
IsReusable
{
get { return false; }
}
}
}
```
I knew I was getting rusty with ASP.NET, but I'm without a clue on this one.
I guess you are using a web site project in contrast of web application project. In this case you need to put the code behind file of your handler (Handler.cs) in... | [
0.10185481607913971,
0.1077016070485115,
0.30663755536079407,
0.03555452823638916,
0.19682323932647705,
-0.3861826956272125,
-0.005963771138340235,
0.1869044005870819,
-0.08321087807416916,
-0.6594651937484741,
-0.09699856489896774,
0.20239464938640594,
-0.17366760969161987,
-0.02887347526... | |
Class="Handler" CodeBehind="Handler.cs" %>
```
Then you can directly declare your handler in web.config:
```
<add verb="*" path="*test.aspx" type="Handler"/>
``` | [
0.3482053279876709,
-0.27954670786857605,
-0.02261427976191044,
-0.13884226977825165,
-0.1663251519203186,
-0.1362992823123932,
0.26618802547454834,
-0.13819682598114014,
-0.11168495565652847,
-0.6190217733383179,
-0.1761159747838974,
0.20045726001262665,
-0.36706605553627014,
0.0354287102... | |
I am using Linked server for Transaction
example
```
Alter Proc [dbo].[usp_Select_TransferingDatasFromServerCheckingforExample]
@RserverName varchar(100), ----- Server Name
@RUserid Varchar(100), ----- server user id
@RPass Varchar(100), ----- Server Password
@DbName varchar(100) ----- Server da... | [
0.05217910557985306,
0.42640864849090576,
0.81308913230896,
-0.2882228493690491,
-0.22812949120998383,
0.009372415021061897,
0.37303709983825684,
-0.6869235038757324,
0.21667228639125824,
-0.6359074115753174,
-0.2443389594554901,
0.28011155128479004,
-0.37651345133781433,
0.401856273412704... | |
''' + @RserverName + ''' end ')
Set @RserverName='['+@RserverName+']'
BEGIN TRY
BEGIN TRANSACTION
Declare @ColumnList varchar(max)
Set @ColumnList = null
Select @ColumnList = case when @ColumnList is not null then @ColumnList + ',' + quotename(name) else quotename(name) end from syscolumns where id = object_id('bdit... | [
0.045688264071941376,
-0.16359424591064453,
0.7066279053688049,
-0.11861792951822281,
-0.08319862931966782,
0.03888159990310669,
0.14304152131080627,
-0.8387317061424255,
-0.1447755992412567,
-0.1210930347442627,
-0.191621795296669,
0.6924819946289062,
-0.3646007180213928,
0.16727502644062... | |
Select 0
END
End
End Catch
Set @RserverName=replace(replace(@RserverName,'[',''),']','')
Exec sp_droplinkedsrvlogin @RserverName,@userID
Exec sp_dropserver @RserverName
```
this is the Error occured:
The Microsoft Distributed Transaction Coordinator (MS DTC) has canceled the distributed transaction.
I gues... | [
0.17196765542030334,
-0.20049022138118744,
0.5958112478256226,
-0.11637359112501144,
0.012445691972970963,
-0.42966851592063904,
0.13444289565086365,
-0.18708278238773346,
-0.050134360790252686,
-0.4879288077354431,
-0.2417234182357788,
0.044291988015174866,
-0.6175311207771301,
0.48109537... | |
I'm developing a media bookmarking site and am looking for a way to remember whether a user has bookmarked an item (without having to go to the DB every page load to check).
I haven't used PHP sessions before, but I'm thinking they would do the trick.
Would it make sense to do an initial DB call when the user logs in... | [
0.522453784942627,
0.06315133720636368,
0.3023216724395752,
0.25670701265335083,
-0.1802949607372284,
-0.0710519477725029,
0.06013074889779091,
-0.38763687014579773,
-0.10942237824201584,
-0.5505660176277161,
0.3875037729740143,
0.5842641592025757,
-0.013102222234010696,
0.0571187660098075... | |
that item's ID is in the session array (so we know whether to display the "bookmark" button or an indicator that they've already bookmarked it).
Just want to make sure this is a right strategy, or if there is a better way. Would this work fine even if there are 10,000 ids in the array?
Bear in mind that a common PHP s... | [
0.23901480436325073,
-0.03999301791191101,
0.15253946185112,
0.49617716670036316,
-0.04632486030459404,
-0.3035585582256317,
0.37640053033828735,
-0.14215435087680817,
-0.3022272288799286,
-0.5204710960388184,
0.20651833713054657,
0.6273199915885925,
0.025436613708734512,
-0.17187979817390... | |
I added a file to the index with:
```
git add somefile.txt
```
I then got the SHA1 for this file with:
```
git hash-object somefile.txt
```
I now have a SHA1 and I would like to retrieve the filename of the object in the index using the SHA1.
```
git show 5a5bf28dcd7944991944cc5076c7525439830122
```
This comma... | [
-0.039067331701517105,
0.33970388770103455,
0.3618218004703522,
-0.14051316678524017,
-0.15243417024612427,
-0.03744768351316452,
-0.0005423049442470074,
0.12114778161048889,
-0.3301168382167816,
-0.7163198590278625,
-0.09359584748744965,
0.19925148785114288,
-0.16813188791275024,
0.149171... | |
not a usual operation to want to retrieve a file name from a SHA1 hash so perhaps you could expand on a real world use case for it?
If you're looking at current files (i.e. the HEAD commit) you can try the following.
```
git ls-tree -r HEAD | grep <SHA1>
```
If you want to find the contents in previous commits you'... | [
0.04536471888422966,
0.24846258759498596,
0.19308510422706604,
-0.24604709446430206,
-0.23470662534236908,
0.030188636854290962,
0.30187246203422546,
-0.37143003940582275,
-0.5144907236099243,
-0.5011669397354126,
-0.27018851041793823,
0.5189685821533203,
-0.39662498235702515,
0.0054278406... | |
I had a requirement where in the text field the first character should be a alpha numeric
and then i can allow a hyphen from thereafter in JavaScript.Also hyphen should not be allowed at the end
If you do not want to match mutiple dashes after eachother:
```
^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$
```
This will match: `a`, ... | [
-0.1316293329000473,
0.4187549352645874,
0.3213101625442505,
-0.3590296804904938,
-0.5943601131439209,
0.3350260257720947,
0.23017115890979767,
-0.135582834482193,
0.01820661686360836,
-0.33875903487205505,
-0.19416692852973938,
0.44533270597457886,
-0.26543301343917847,
0.1257373392581939... | |
Is there any scripting library for Audacity?
Specifically, I'm looking for a way to give it a long mp3 file `podcast.mp3` and have it split into files of, say, 10 minutes each: `podcast0.mp3, podcast1.mp3` etc...
I don't want to do this manually, since I want to run all the podcasts I listen to through this script.... | [
0.5843648314476013,
0.07519088685512543,
0.12172301858663559,
0.46412280201911926,
0.08636628091335297,
-0.2791793942451477,
0.11587626487016678,
0.2684799134731293,
-0.24469125270843506,
-0.46099892258644104,
0.3346007764339447,
0.7492961287498474,
0.05063712224364281,
-0.0489106178283691... | |
player has a nasty habit of forgetting where in the file I was. For instance:
* Sometimes if somebody calls me while I'm in the middle of a podcast it'll start it from the beginning.
* Sometimes I pause a podcast when I get to work, and when I try to continue it at the end of the day it's reset to the beginning of th... | [
0.07447521388530731,
0.04064672067761421,
0.3195384740829468,
-0.008676770143210888,
-0.06656207144260406,
-0.1926509439945221,
-0.03692042455077171,
0.2216515839099884,
-0.623073399066925,
-0.43669939041137695,
-0.06564148515462875,
0.5142208337783813,
-0.03342244029045105,
0.688794434070... | |
me 6 or 7 minutes of holding the fast-forward button to get back to where I was. I figure if I split the long podcasts into shorter files, I can save a bit of annoyance.
I would suggest using a different tool such as [ffmpeg](http://ffmpeg.org/) or [mp3split](http://sourceforge.net/docman/display_doc.php?docid=12439&gr... | [
0.3035839796066284,
-0.24168363213539124,
0.4395754039287567,
0.10475429892539978,
-0.20577006042003632,
-0.08529669791460037,
0.29160818457603455,
0.06746936589479446,
-0.3655693531036377,
-0.42340368032455444,
-0.06120176985859871,
0.7416437864303589,
0.2408141791820526,
-0.0140672288835... | |
I have a slapd LDAP server which is critical to my application. I want to monitor it in order to detect when it has become over-loaded or if it fails.
Unfortunately we are stuck with a very old edition of slapd which has a known bug: It cannot cope with more than 64 concurrent connections. If a client attempts to open... | [
0.044773396104574203,
0.19754348695278168,
0.35232535004615784,
0.04368129000067711,
-0.2924134135246277,
-0.2525395452976227,
0.41144952178001404,
0.09996457397937775,
-0.5185840725898743,
-0.709479808807373,
0.22952736914157867,
0.3631936311721802,
-0.712303638458252,
0.2720063626766205,... | |
how can I find out the state of slapd? Is there a way to do it?
The best tool for that is [lsof](http://people.freebsd.org/~abe/).
```
lsof -i tcp:389
```
will show you all TCP connections to your LDAP server. | [
0.07524102181196213,
-0.038630690425634384,
0.43196138739585876,
0.1068321093916893,
-0.008899647742509842,
-0.4419006109237671,
0.16020317375659943,
0.3707231283187866,
-0.16938181221485138,
-0.8440147638320923,
-0.08620450645685196,
0.4371432662010193,
-0.3390304446220398,
0.061161827296... | |
Can anyone explain the use of ^ operator in java with some examples?
This is the same as ^ in most languages, just an XOR.
```
false ^ false == false
true ^ false == true
false ^ true == true
true ^ true == false
``` | [
0.13805246353149414,
0.054650504142045975,
0.0023110881447792053,
-0.23140034079551697,
-0.3245965838432312,
-0.07832485437393188,
0.2592717707157135,
0.041227906942367554,
-0.15934349596500397,
-0.6191590428352356,
-0.17020221054553986,
0.6901607513427734,
-0.5739192366600037,
-0.11705204... | |
What is the best way to ensure service robustness to prevent a service becoming unavailable, if it does become unavaliable is there a way of restarting the service?
thanks in advance.
Use a hosting technique. You can self host in a windows service, and place the faulted event to trigger the service to close. You can t... | [
0.08862495422363281,
0.026002958416938782,
0.07174452394247055,
0.35815632343292236,
-0.04036317765712738,
-0.15744821727275848,
0.6450123190879822,
0.1159132570028305,
-0.33665940165519714,
-0.42493000626564026,
-0.13174644112586975,
0.6840718388557434,
0.08852703869342804,
0.102014333009... | |
not running as such, the object merely exists. You are basically paying microsoft to provide .net and WCF to you which looks after the hosting side of things, they guarantee to you that your service will remain available.
A crash in a method would fault the service, but you can handle any exceptions which you can deal... | [
0.5352324843406677,
-0.017145125195384026,
0.10896287113428116,
0.31858763098716736,
-0.29354268312454224,
-0.5012875199317932,
0.19638916850090027,
0.08626778423786163,
-0.1786612570285797,
-0.49426716566085815,
-0.021151559427380562,
0.564492404460907,
-0.14718861877918243,
0.15211296081... | |
I want to shift elements inside container on any positions to the left or right. The shifting elements are not contiguous.
e.g I have a vector {1,2,3,4,5,6,7,8} and I want to shift {4,5,7} to the left on 2 positions, the expected result will be {1,4,5,2,7,3,6,8}
Is there an elegant way to solve it ?
You can write you... | [
0.04331870749592781,
-0.3807099163532257,
0.31453973054885864,
-0.3536091446876526,
0.26026439666748047,
0.37560200691223145,
-0.4130200743675232,
-0.3763720989227295,
-0.17252135276794434,
-0.5518112778663635,
0.01942383497953415,
0.5895288586616516,
-0.3772549629211426,
0.194144114851951... | |
// if you have their indexes, you can use advance
Iter it = find(c.begin(), c.end(), value);
Iter tmp = it;
advance(it, shifting);
c.erase(tmp);
c.insert(it, 1, value);
}
```
You can then use it like that:
```
vector<int> v;
// fill vector to, say, {1,2,3,4,5}
shift(v, 4, -2); // v = {1,4,2,3,... | [
0.006191962398588657,
-0.38535022735595703,
0.3879055678844452,
-0.20580270886421204,
0.150099977850914,
0.3147844970226288,
-0.25762858986854553,
-0.46280795335769653,
-0.18512558937072754,
-0.590022623538971,
0.047052621841430664,
0.41490113735198975,
-0.2669577896595001,
0.0699357464909... | |
case. However, I hope it gave you some hints on how to implement what you need. | [
0.2156815528869629,
-0.12962588667869568,
-0.09796170890331268,
0.4064602255821228,
0.34662389755249023,
-0.12580139935016632,
0.018065646290779114,
0.30163729190826416,
0.1746777594089508,
-0.6784012913703918,
0.30326047539711,
0.29972296953201294,
0.011076683178544044,
-0.169572636485099... | |
Does anybody know of a method to trigger an event in Prototype, as you can with jQuery's trigger function?
I have bound an event listener using the observe method, but I would also like to be able to fire the event programatically.
Thanks in advance
[`event.simulate.js`](http://github.com/kangax/protolicious/blob/5b5... | [
0.3602953851222992,
0.023784231394529343,
-0.04594308137893677,
0.17430272698402405,
-0.005801552440971136,
-0.15267133712768555,
0.19797077775001526,
0.09888825565576553,
-0.24946846067905426,
-0.5448669791221619,
0.25324419140815735,
0.5410184860229492,
-0.17331896722316742,
0.0449063479... | |
the standard prototype method [`Event.fire()`](http://www.prototypejs.org/api/element/fire). | [
0.07077451795339584,
-0.10050888359546661,
-0.2122938632965088,
-0.09750422835350037,
-0.021220523864030838,
-0.2899596691131592,
0.4307481348514557,
-0.3941158950328827,
-0.05054256692528725,
-0.20736390352249146,
-0.22007089853286743,
0.19880248606204987,
-0.27068042755126953,
-0.1790397... | |
I have an updatepanel which doesn't work. My whole code:
```
<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="AlgemeenDocument.aspx.cs" Inherits="PCK_Web_new.WebForm7" Title="Untitled Page" %>
```
```
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<script language... | [
0.10851036012172699,
0.22155597805976868,
0.7729777097702026,
-0.3718112111091614,
-0.060461144894361496,
0.14407415688037872,
0.5265394449234009,
-0.5339992642402649,
-0.12021500617265701,
-0.7850568294525146,
0.04545136168599129,
0.5246778726577759,
0.0029390098061412573,
0.0358553901314... | |
else
// Get viewport height - IE
vpHeight = document.documentElement.clientHeight;
// Get site height (div)
var treeview = document.getElementById("Treeview");
var siteHeight = 0;
if(treeview != null)
{
siteHeight = | [
0.15874724090099335,
-0.0198233462870121,
0.8700382709503174,
-0.31319040060043335,
0.1486905962228775,
-0.025487689301371574,
0.4896613657474518,
-0.3071763813495636,
-0.09953143447637558,
-0.5362505912780762,
-0.23504869639873505,
0.5766132473945618,
0.024838386103510857,
0.0404809750616... | |
document.getElementById("Treeview").offsetHeight;
}
siteHeight += document.getElementById("HeaderContainer").offsetHeight;
siteHeight += document.getElementById("divMainMenu").offsetHeight;
// Compare heights and set the overlay height
if(vpHeight < siteHeight)
pageH... | [
0.09832335263490677,
0.16514728963375092,
0.7130895853042603,
-0.02202339842915535,
-0.003692854894325137,
0.015993131324648857,
-0.012407969683408737,
-0.5872215032577515,
-0.1558718979358673,
-0.4813421666622162,
-0.38594499230384827,
0.34794506430625916,
0.05785122513771057,
-0.10900980... | |
var div = document.getElementById(panel);
div.className = "DocOverlayShow";
div.style.height = pageHeight;
document.getElementById('<%= pnlAddComment.ClientID %>').className="DocAddCommentBox";
}
function hideOverlay()
{
//document.getElementById(commentID).style.visibilit... | [
0.030447430908679962,
-0.23703525960445404,
0.46209582686424255,
-0.3546617329120636,
0.24295161664485931,
0.26916438341140747,
0.42290300130844116,
-0.30347591638565063,
-0.07757659256458282,
-0.5471482276916504,
-0.37281888723373413,
0.619598925113678,
-0.2603248953819275,
0.178506702184... | |
i = 0; i < inputs.length; i++ )
{
if ( inputs[i].type == 'text' )
{
inputs[i].value = '';
}
}
document.getElementById('<%= txtTitel.ClientID %>').value = | [
0.14399516582489014,
-0.2734906077384949,
0.9020755290985107,
-0.31766417622566223,
0.4225759506225586,
0.1330365091562271,
0.372213751077652,
-0.33007097244262695,
0.0886371061205864,
-0.6364740133285522,
-0.6556357741355896,
0.8378836512565613,
-0.2196870744228363,
0.20395632088184357,
... | |
"";
document.getElementById('<%= txtComment.ClientID %>').value = "";
document.getElementById('<%= pnlOverlay.ClientID %>').className = "DocOverlayHide";
}
</script>
<asp:Panel ID="pnlOverlay" runat="server" CssClass="DocOverlayHide">
<!-- <div id="DocAddCommentBox"> -->
<asp... | [
-0.2177116572856903,
0.048414602875709534,
0.47732383012771606,
-0.35994428396224976,
-0.04460730776190758,
0.30578842759132385,
0.13441848754882812,
-0.29376956820487976,
-0.3107030689716339,
-0.6643924713134766,
-0.46000275015830994,
0.44801652431488037,
0.03592623397707939,
0.1813361048... | |
<div id="DocACContentBox">
<div class="DocACLabel">
Titel:
</div>
<div class="DocACInput"> | [
0.056148722767829895,
-0.4112001955509186,
0.15744562447071075,
0.022713594138622284,
-0.10683921724557877,
0.18750780820846558,
0.07182524353265762,
-0.2274317890405655,
0.004474531393498182,
-0.9654894471168518,
-0.21466456353664398,
0.7194104194641113,
-0.19747407734394073,
0.1709875762... | |
<asp:TextBox ID="txtTitel" runat="server"></asp:TextBox>
</div>
<div class="ClearFloat">
</div>
<div class="DocACLabel">
Opmerking: | [
-0.3362726867198944,
-0.16775009036064148,
0.3716694116592407,
-0.23376071453094482,
0.12534494698047638,
0.0898345410823822,
0.07341285049915314,
-0.20726995170116425,
-0.20932890474796295,
-0.4889380633831024,
-0.48560047149658203,
0.6922622919082642,
-0.2892707586288452,
-0.218670547008... | |
</div>
<div class="DocACInput">
<asp:TextBox ID="txtComment" runat="server" TextMode="MultiLine" Rows="15"
Columns="40">
</asp:TextBox> | [
-0.12142873555421829,
-0.20636297762393951,
0.41691988706588745,
-0.10976230353116989,
-0.11044551432132721,
0.48835843801498413,
0.21322466433048248,
-0.2689509987831116,
-0.2620675265789032,
-0.7436062693595886,
-0.3226798176765442,
0.42991331219673157,
-0.19817009568214417,
0.0075992378... | |
</div>
<div class="ClearFloat">
</div>
<div id="DocBtnBox">
<input id="btnCancel" type="button" onclick="hideOverlay()" value="Annuleren"/> | [
-0.026825638487935066,
-0.21366386115550995,
0.31828999519348145,
-0.293517142534256,
0.17031234502792358,
-0.022448942065238953,
0.10364191979169846,
-0.1322396844625473,
-0.12673792243003845,
-0.4827437698841095,
-0.3060581088066101,
0.39982596039772034,
-0.3144918978214264,
-0.031600821... | |
<asp:UpdatePanel ID="UpdatePanel2" runat="server" EnableViewState="False" UpdateMode="Always" RenderMode="Block">
<ContentTemplate>
<asp:Button ID="btnSave" runat="server" CssClass="btnSave" onclick="btnSave_Click" Text="Opslaan" />
<asp:Label ID="lblT... | [
0.016755927354097366,
-0.07972424477338791,
0.6114103198051453,
-0.24857854843139648,
0.059381790459156036,
0.27521032094955444,
0.20499686896800995,
-0.34099575877189636,
-0.4429105520248413,
-0.5771528482437134,
-0.461898535490036,
0.4963541328907013,
-0.17241112887859344,
-0.38618758320... | |
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="ClearFloat"> </div>
</div>
</asp:Panel>
<!-- </div> -->
<asp:Panel ID="pnlResult" runat="server" CssClass="DocOverlayHide"> | [
-0.22043773531913757,
-0.36040475964546204,
0.6240704655647278,
-0.03331596776843071,
-0.2179679125547409,
-0.06220583990216255,
-0.2467440515756607,
-0.1963784247636795,
-0.41675782203674316,
-0.6821855902671814,
-0.4837716519832611,
0.2406841516494751,
-0.12806124985218048,
-0.0749002993... | |
<div id="DocResultBox">
<div id="Div1">
Opmerking plaatsen
</div>
<div id="Div2"> | [
-0.1878279745578766,
-0.07129356265068054,
0.09465665370225906,
-0.168844535946846,
-0.029937881976366043,
0.009033137932419777,
0.15853312611579895,
-0.29345381259918213,
-0.2621135115623474,
-0.35651278495788574,
-0.3400557041168213,
0.45169055461883545,
0.011383461765944958,
0.016186205... | |
<div class="DocACLabel">
<asp:Label ID="lblResult" runat="server" Text="Label"></asp:Label>
</div>
<div id="Div1">
<input id="btnClose" type="button" onclick="hideOverlay()" value="Sluiten"/> | [
0.03430788964033127,
-0.3922497034072876,
0.23735424876213074,
-0.2305041402578354,
-0.016416208818554878,
0.10993742197751999,
0.08763454854488373,
-0.2405516505241394,
-0.17757539451122284,
-0.4894055724143982,
-0.19203661382198334,
0.36770427227020264,
-0.21133001148700714,
0.0309678930... | |
</div>
<div class="ClearFloat"> </div>
</div>
</div>
</asp:Panel>
</asp:Panel>
<div class="DocContainer">
<div class="DocTitleBox">
<div class="DocLogo"> | [
-0.16433371603488922,
-0.43466413021087646,
0.5185225605964661,
-0.06439798325300217,
-0.19457221031188965,
-0.11090505868196487,
-0.0008455385104753077,
-0.1969638466835022,
-0.15243174135684967,
-0.7104114294052124,
-0.5120044350624084,
0.6071515083312988,
-0.32579201459884644,
0.0799081... | |
Het logo
</div>
<div class="DocTitle">
<asp:Label ID="lblTitle" runat="server"></asp:Label>
</div>
<div class="DocType">
Document soort
<asp:Label ID="lblDocType" runat="server"></asp:Label>
</div> | [
0.7349145412445068,
-0.17872509360313416,
0.3286402225494385,
-0.15402469038963318,
-0.22959011793136597,
-0.0039466372691094875,
0.1934201717376709,
-0.756702184677124,
-0.14381730556488037,
-0.3170858323574066,
-0.30978477001190186,
0.21296606957912445,
-0.32857659459114075,
0.0318916738... | |
<div class="DocBtn">
<input type="button" value="Opmerking" onclick="showOverlay('<%=pnlOverlay.ClientID %>')" />
</div>
</div>
<div class="DocContentBox">
<asp:Label ID="lblID" runat="server"></asp:Label>
<p>Algemeen Document Geen vaste opmaak.</p>
</div>
</div>
``... | [
0.04793081805109978,
0.031572308391332626,
0.31108394265174866,
-0.42215394973754883,
0.1894216537475586,
0.07086078822612762,
0.38639435172080994,
-0.48964667320251465,
-0.43523159623146057,
-0.3869134187698364,
-0.2388802319765091,
0.5665311217308044,
-0.4722798764705658,
0.0067847375757... | |
"BUTTON PRESSED";
}
```
When i set a breakpoint, it runs the code. But the label text isn't set :S
Hope someone can help?
Thnx!
EDIT:
I also tried this:
```
<div id="DocBtnBox">
<input id="btnCancel" type="button" onclick="hideOverlay()" value="Annuleren"/>
<asp:But... | [
0.024336982518434525,
-0.10536312311887741,
0.5324946045875549,
-0.34707456827163696,
0.1795007586479187,
0.1555616706609726,
0.5074447989463806,
-0.23843489587306976,
-0.44485849142074585,
-0.6748371720314026,
-0.30700036883354187,
0.42008307576179504,
-0.29011616110801697,
-0.14530055224... | |
runat="server" EnableViewState="False" UpdateMode="Always">
<ContentTemplate>
<asp:Label ID="lblTitleError" runat="server" Text="ertroro"></asp:Label>
</ContentTemplate>
<Triggers> | [
0.1447651982307434,
-0.23695313930511475,
0.5213072299957275,
-0.15107683837413788,
-0.015147899277508259,
-0.059559401124715805,
0.16585807502269745,
-0.25984397530555725,
-0.14232538640499115,
-0.3416154980659485,
-0.5086519718170166,
0.5003986954689026,
-0.5361586809158325,
-0.236243903... | |
<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
```
I think the best tutor on the web is Joe Stagner. His material for .NET is | [
0.05615886300802231,
0.13728374242782593,
-0.031646810472011566,
0.13605283200740814,
0.09972580522298813,
-0.05893130600452423,
0.35155782103538513,
0.17283158004283905,
-0.0730879008769989,
-0.8152266144752502,
-0.1696769744157791,
0.4480013847351074,
-0.001664789393544197,
-0.5868842601... | |
awesome.
Here is a [link](http://www.asp.net/LEARN/ajax-videos/video-159.aspx) where he shows you exactly, step-by-step how to do what you are trying.
Addendum:
If I were you I'd create a clean page from the sample code Joe has provided. Go to <http://www.asp.net/LEARN/ajax-videos/> and figure out which tutorial yo... | [
0.5957677960395813,
0.2032250165939331,
-0.020356876775622368,
0.2603961229324341,
0.2973119020462036,
-0.32792574167251587,
0.2319432646036148,
0.23062948882579803,
-0.39036422967910767,
-0.7443693280220032,
0.06764507293701172,
0.6533941626548767,
0.2922757565975189,
-0.15321548283100128... | |
In PHP, you can make two variables point to the same data.
```
$a = 'foo';
$b = 'bar';
$a =& $b;
echo $a // Outputs: bar
echo $b // Outputs: bar
```
What we are trying to do in Ruby is set `@app_session` to be equal to `session[@current_app[:uid]]`. So we only have to deal with `@app_session` in our app, and everyt... | [
0.2110721915960312,
0.5419694185256958,
0.5219702124595642,
-0.08908669650554657,
-0.20213288068771362,
0.08173828572034836,
0.44214391708374023,
-0.20242725312709808,
-0.19505411386489868,
-0.3146236538887024,
0.21058307588100433,
0.3132595419883728,
-0.43197500705718994,
-0.0428066961467... | |
point to the same object. That's why when you want to copy a given object, you need to write
```
a = b.dup
```
Writing
```
@app_session = session[@current_app[:uid]]
```
points to the same object so you should be fine.
EDIT: you can verify this this way:
```
irb(main):001:0> a = 1
=> 1
irb(main):002:0> b = a
=>... | [
0.0058106654323637486,
0.23931744694709778,
0.6391726732254028,
0.052499495446681976,
-0.07931017130613327,
-0.06412002444267273,
0.1503937840461731,
-0.3399933874607086,
-0.49345308542251587,
-0.6298395395278931,
0.06685446202754974,
0.30426639318466187,
-0.5332390069961548,
0.34060969948... | |
How to decrease the number of possible cache misses when designing a C++ program?
Does inlining functions help every time? or is it good only when the program is CPU-bounded (i.e. the program is computation oriented not I/O oriented)?
Here are some things that I like consider when working on this kind of code.
* Cons... | [
0.26908227801322937,
0.05180630087852478,
-0.16408579051494598,
0.17169587314128876,
-0.05487300083041191,
0.08634008467197418,
0.11654046922922134,
-0.24830487370491028,
-0.4151516556739807,
-0.832582950592041,
0.1154017522931099,
0.1920805275440216,
-0.24801652133464813,
-0.1677988618612... | |
you have an array of objects of class o, and you use o.x, o.y, o.z together frequently but only occasionally need to access o.i, o.j, o.k then consider puting o.x, o.y, and o.z together and moving the i, j, and k parts to a parallel axillary data structure.
* If you have multi dimensional arrays of data then with the u... | [
-0.2072668820619583,
-0.31888243556022644,
0.46836233139038086,
0.39452511072158813,
-0.12256886065006256,
0.32564663887023926,
0.046830229461193085,
-0.13448791205883026,
-0.6508207321166992,
-0.8412455320358276,
-0.18698646128177643,
0.3092105984687805,
-0.059602368623018265,
0.246096000... | |
similar -- they're just Z-order with a larger radix.)
* If you must incur a cache miss, then try to do as much as possible with that data in order to amortize the cost.
* Are you doing anything multi-threaded? Watch out for slowdowns from cache consistency protocols. Pad flags and small counters so that they'll be on s... | [
0.32346364855766296,
0.04817419499158859,
-0.0805017501115799,
0.32884007692337036,
0.05248613283038139,
-0.09266681969165802,
0.2711060345172882,
0.05563206598162651,
-0.602616548538208,
-0.7739233374595642,
0.056839846074581146,
0.6625485420227051,
-0.09131685644388199,
-0.21805219352245... | |
I'd like to script printing of a series of photographs, but to exact dimensions. (e.g. all jpegs in dir /tmp/printing, at 1.5" x 1.0", 6 to a page)
I happen to have my hands on a Ubuntu Linux box and a deskjet printer (hp5150) but could probably use Windows or possibly get another printer if absolutely required.
I'm ... | [
0.42379966378211975,
0.12343278527259827,
0.21336215734481812,
0.3006057143211365,
-0.1689784824848175,
0.12132134288549423,
0.07491077482700348,
-0.02503480389714241,
-0.1440565288066864,
-0.9577334523200989,
0.2379036545753479,
0.5109022259712219,
-0.059168796986341476,
-0.26385709643363... | |
(preferably with an example :)! ).
Thanks!
EDIT: Thanks to PEZ, I have a mechanism for printing mutiple images to a sheet, but I can't see how to resize images to set dimension, even using ImageMajick. I can resize to a dimension specified in pixels, is it a case of determining (or setting?) the DPI of the printer an... | [
0.3439065217971802,
-0.17442940175533295,
0.7085893154144287,
0.136083722114563,
-0.219913050532341,
0.11356490850448608,
0.0054244305938482285,
-0.3531297445297241,
-0.4484219253063202,
-0.9549614191055298,
0.13523028790950775,
0.7101318836212158,
-0.07067941874265671,
-0.0172064416110515... | |
of CUPS to print the images. The print command would look something like so:
```
lp -o number-up=6 my_scaled_image_*.jpg
``` | [
0.3087582588195801,
0.41257965564727783,
0.8725436329841614,
-0.11023405194282532,
-0.06977950036525726,
0.14018772542476654,
-0.471786230802536,
-0.3714684844017029,
-0.40985721349716187,
-0.4666353762149811,
0.11210054904222488,
0.5415526628494263,
-0.3697897493839264,
0.0939095467329025... | |
A project I am working on requires an old version of SLAPD (the LDAP
server) and must run on Windows, hence I am using cygwin packages:
I've found a binary package of slapd version I need 2.2.x here:
<http://www.mirrorservice.org/sites/sourceware.org/pub/cygwin/release/>...
How do I manually install it in cygwin?... | [
0.36503085494041443,
0.523673951625824,
0.17614667117595673,
-0.09693331271409988,
-0.03681064397096634,
-0.5049681067466736,
0.5051945447921753,
-0.17216530442237854,
-0.261145681142807,
-0.4871397614479065,
-0.09970620274543762,
0.9167621731758118,
-0.19830136001110077,
0.130247458815574... | |
I could!
Thanks
If you are using the cygwin package installer to install this package, usually if you select to view the full info and scroll to the package you need you will see some info about the version.
Now if you click on the version number you will see that it changes from the oldest in the repository to the ... | [
0.6070708632469177,
0.07395734637975693,
-0.0032679266296327114,
0.12562240660190582,
-0.20871320366859436,
-0.41260164976119995,
0.33462005853652954,
0.23962803184986115,
0.11163776367902756,
-0.8118438720703125,
0.1590106040239334,
0.7119094729423523,
0.4416647255420685,
0.44228580594062... | |
How is it that Java's `BigDecimal` can be this painful?
```
Double d = 13.3D;
BigDecimal bd1 = new BigDecimal(d);
BigDecimal bd2 = new BigDecimal(String.valueOf(d));
System.out.println("RESULT 1: "+bd1.toString());
System.out.println("RESULT 2: "+bd2.toString());
RESULT 1: 13.300000000000000710542735760100185871124... | [
-0.15101757645606995,
0.2229647934436798,
0.38740992546081543,
-0.2907390892505646,
-0.1688966006040573,
0.12380921840667725,
0.47516927123069763,
-0.30964896082878113,
-0.2826714515686035,
-0.5689358115196228,
0.021669942885637283,
0.8635680675506592,
-0.19506429135799408,
-0.068553201854... | |
unpredictable. One might
> assume that writing new
> BigDecimal(0.1) in Java creates a
> BigDecimal which is exactly equal to
> 0.1 (an unscaled value of 1, with a scale of 1), but it is actually equal
> to
> 0.1000000000000000055511151231257827021181583404541015625. This is because 0.1 **cannot be
> represented... | [
-0.03049699403345585,
-0.32752111554145813,
0.06531829386949539,
-0.06961369514465332,
-0.06108883023262024,
-0.34223413467407227,
0.6280512809753418,
-0.13098101317882538,
-0.1871694177389145,
-0.6384662389755249,
-0.02426370233297348,
0.4994478225708008,
-0.40435662865638733,
-0.15715911... | |
predictable:
> writing new BigDecimal("0.1") creates
> a BigDecimal which is exactly equal to
> 0.1, as one would expect. Therefore, **it is generally recommended that the
> String constructor be used in
> preference to this one.**
> 3. **When a double must be used as a source for a BigDecimal**, note that
> this... | [
0.27524206042289734,
-0.3920712471008301,
0.08281108736991882,
-0.06824202835559845,
0.0364709235727787,
-0.32122063636779785,
0.2005401849746704,
-0.20800235867500305,
-0.035136107355356216,
-0.538983166217804,
0.02401731349527836,
0.9830303192138672,
-0.4522566795349121,
-0.2564202249050... | |
of the story: The pain seems self-inflicted, just use [**`new BigDecimal(String val)`**](http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#BigDecimal(java.lang.String)) or [**`BigDecimal.valueOf(double val)`**](http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#valueOf(double)) instead =) | [
0.2388571947813034,
0.3228509724140167,
0.08030474931001663,
-0.06132667884230614,
-0.10054288059473038,
0.5502341389656067,
0.5991055369377136,
-0.22568821907043457,
-0.263762503862381,
-0.32324349880218506,
-0.13294094800949097,
0.8442990779876709,
0.0060973502695560455,
0.42685735225677... | |
The original release of Java 6 came with JAXB 2, but I have been told that 'later' Java 6 releases ship with JAXB 2.1.
Does anyone know what the first version of Java 6 to ship with JAXB 2.1 was?
Apparently Java 6 Update 4 was the first version to ship with JAXB 2.1 ([source](http://weblogs.java.net/blog/ramapulavarth... | [
0.28333520889282227,
-0.07217048108577728,
0.41521117091178894,
-0.4520847499370575,
-0.34196892380714417,
-0.11740569025278091,
0.5955559015274048,
-0.2386559247970581,
-0.19379693269729614,
-0.07085952162742615,
0.04227830469608307,
0.7225366830825806,
-0.6027690768241882,
-0.04058003053... | |
Im trying to define a dataTemplate for a business object in my wpf application a collection of which is being bound to a ListBox.
```
<UserControl.Resources>
<DataTemplate x:Key="ResizedItemsDataTemplate" DataType="{x:Type resizer:ResizeMonitorItem}">
<Border x:Name="bdr" BorderBrush="Blue"
... | [
0.15819954872131348,
-0.1529339700937271,
0.559971809387207,
0.09499967843294144,
0.06363942474126816,
0.10542473196983337,
0.03730969503521919,
-0.38498249650001526,
-0.14209707081317902,
-0.5651721954345703,
0.15404996275901794,
0.21584410965442657,
-0.3633408546447754,
0.193956166505813... | |
CornerRadius="2"
Width="auto"
HorizontalAlignment="Stretch" | [
-0.0829724371433258,
-0.23707523941993713,
0.4453805685043335,
-0.05622111260890961,
0.08496271073818207,
0.19025777280330658,
0.11385093629360199,
-0.0011690659448504448,
-0.31989553570747375,
-0.6026633977890015,
-0.014970754273235798,
0.3680350184440613,
0.12944649159908295,
0.074763529... | |
VerticalAlignment="Stretch">
<Grid Margin="2">
<Grid.RowDefinitions> | [
-0.3757213056087494,
-0.45610925555229187,
0.49604353308677673,
-0.09011055529117584,
0.047015681862831116,
0.5486544370651245,
-0.11697588115930557,
-0.10460811853408813,
-0.41512706875801086,
-0.8976488709449768,
0.05677780881524086,
0.28692370653152466,
-0.07461215555667877,
0.265386462... | |
<RowDefinition Height="14"></RowDefinition>
<RowDefinition Height="14"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding SaveAsFileName}"></TextBlock> | [
-0.22512127459049225,
0.09223983436822891,
0.4516807794570923,
-0.1872824728488922,
-0.09403463453054428,
0.31673240661621094,
0.08451955765485764,
-0.5809277296066284,
-0.458520770072937,
-0.8172810077667236,
-0.016338489949703217,
0.06297142803668976,
-0.4243188202381134,
0.0585853233933... | |
<TextBlock Grid.Row="1" Text="{Binding ResizedImageFilePath}"></TextBlock>
</Grid>
</Border>
</DataTemplate>
</UserControl.Resources>
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0">
<Border BorderThickness="0,0,0,5" BorderBrush="DarkGray" >
... | [
-0.1657790243625641,
-0.3582596182823181,
0.9232742190361023,
-0.0399966724216938,
0.1189475953578949,
0.17124046385288239,
-0.07338060438632965,
-0.5803271532058716,
-0.2555480897426605,
-0.7231641411781311,
0.07043210417032242,
0.2554030120372772,
-0.06023135408759117,
0.14285808801651,
... | |
x:Name=bdr to span the full width of each listbox item? At the moment it only spans the with of the textblocks inside it which dont neccessary fill the full width of the listboxitem and also vary for each listboxitem.
This is probably more to do with the ListBoxItems themselves not taking up the full width of the ListB... | [
0.5158708691596985,
-0.20592853426933289,
0.4199376404285431,
-0.21214161813259125,
-0.18698473274707794,
-0.08972954750061035,
0.19998282194137573,
-0.18884144723415375,
-0.12991765141487122,
-0.5875177979469299,
-0.004774357192218304,
0.47526973485946655,
-0.2203684151172638,
0.095513530... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.