text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
community.
Unfortunately Open Office does not seem to set the \_NET\_WM\_PID property so this doesn't ultimately solve my problem but it does answer the question.
```
// Attempt to identify a window by name or attribute.
// by Adam Pierce <adam@doctort.org>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <iost... | [
0.2749893069267273,
0.3335913121700287,
0.06887981295585632,
-0.025550512596964836,
-0.19438572227954865,
-0.15474261343479156,
0.539415180683136,
-0.07144159078598022,
-0.07738158106803894,
-0.7769554257392883,
-0.1774665117263794,
0.28150612115859985,
-0.47263795137405396,
0.233729079365... | |
if(_atomPID == None)
{
cout << "No such atom" << endl;
return;
}
search(wRoot);
}
const list<Window> &result() const { return _result; }
private:
unsigned long _pid;
Atom _atomPID; | [
-0.10443606227636337,
-0.4005644619464874,
0.42690205574035645,
-0.4674637019634247,
0.2914370000362396,
-0.007406855002045631,
0.3401738405227661,
-0.14591377973556519,
0.22823834419250488,
-0.5778621435165405,
-0.46307751536369324,
0.3578871190547943,
-0.5299684405326843,
0.0716133117675... | |
Display *_display;
list<Window> _result;
void search(Window w)
{
// Get the PID for the current Window.
Atom type;
int format;
unsigned long nItems;
unsigned long bytesAfter; | [
0.11928538978099823,
-0.17396917939186096,
0.4614916145801544,
-0.3814550042152405,
0.176825150847435,
0.11928264051675797,
0.17386886477470398,
-0.06566618382930756,
-0.06911227107048035,
-0.8826436996459961,
-0.383171409368515,
0.37192854285240173,
-0.3326035439968109,
0.2341742217540741... | |
unsigned char *propPID = 0;
if(Success == XGetWindowProperty(_display, w, _atomPID, 0, 1, False, XA_CARDINAL,
&type, &format, &nItems, &bytesAfter, &propPID))
{
if(propPID != 0) | [
-0.21286435425281525,
-0.3092878758907318,
0.28622567653656006,
0.0009158642496913671,
0.47819480299949646,
0.3695160448551178,
0.723353922367096,
-0.3861848711967468,
0.014790398068726063,
-0.22483690083026886,
-0.11808887124061584,
0.6496490836143494,
-0.23983915150165558,
-0.17585936188... | |
{
// If the PID matches, add this window to the result set.
if(_pid == *((unsigned long *)propPID))
_result.push_back(w);
XFree(propPID);
} | [
0.17377713322639465,
-0.5458005666732788,
0.5337890386581421,
-0.1913342922925949,
0.3329009413719177,
0.24685333669185638,
0.35435789823532104,
-0.3463315963745117,
0.03764274716377258,
-0.7025259733200073,
-0.24731037020683289,
0.5636545419692993,
-0.46863627433776855,
0.0263459607958793... | |
}
// Recurse into child windows.
Window wRoot;
Window wParent;
Window *wChild;
unsigned nChildren;
if(0 != XQueryTree(_display, w, &wRoot, &wParent, &wChild, &nChildren))
{
for(unsigned i = 0; i < nChildren; i++) | [
-0.08894006907939911,
-0.11389689892530441,
0.5518689155578613,
-0.25182342529296875,
0.5864721536636353,
0.41035196185112,
0.5773006677627563,
-0.18021436035633087,
0.10349708050489426,
-0.7341312766075134,
-0.33380261063575745,
0.4133993685245514,
-0.20216839015483856,
0.3943487107753753... | |
search(wChild[i]);
}
}
};
int main(int argc, char **argv)
{
if(argc < 2)
return 1;
int pid = atoi(argv[1]);
cout << "Searching for windows associated with PID " << pid << endl;
// Start with the root window.
Display *display = XOpenDisplay(0);
WindowsMatchingPid match(display... | [
-0.4482356011867523,
-0.27517688274383545,
0.772777795791626,
-0.3016924262046814,
0.07061966508626938,
0.06078333407640457,
0.24111099541187286,
-0.32212790846824646,
-0.04603085666894913,
-0.6910650134086609,
-0.2606799006462097,
0.5210869908332825,
-0.4759850800037384,
0.243656873703002... | |
for(list<Window>::const_iterator it = result.begin(); it != result.end(); it++)
cout << "Window #" << (unsigned long)(*it) << endl;
return 0;
}
```
The only way I know to do this is to traverse the tree of windows until you find what you're looking for. Traversing isn't hard (just see what xwininfo -root ... | [
0.0776633769273758,
0.06328941136598587,
0.48192813992500305,
-0.20466554164886475,
0.09143537282943726,
-0.11360498517751694,
0.4348827302455902,
-0.10119897127151489,
-0.19150812923908234,
-0.9860101938247681,
-0.1405285894870758,
0.5929107666015625,
-0.25615593791007996,
0.1650094836950... | |
property (as do most Gnome apps), so you're in luck. | [
0.30931514501571655,
-0.1809951514005661,
0.3000675141811371,
0.16363193094730377,
0.23128215968608856,
-0.1388269066810608,
0.12766996026039124,
0.22715122997760773,
-0.47593164443969727,
-0.15199653804302216,
-0.20661436021327972,
0.4220617115497589,
0.4373500645160675,
0.276108175516128... | |
I've got a siluation where i need to access a SOAP web service with WSE 2.0 security. I've got all the generated c# proxies (which are derived from Microsoft.Web.Services2.WebServicesClientProtocol), i'm applying the certificate but when i call a method i get an error:
```
System.Net.WebException : The request failed ... | [
0.20524154603481293,
0.3235945701599121,
0.4884035587310791,
-0.036793459206819534,
0.04516306519508362,
-0.12451963126659393,
0.5761435031890869,
-0.3188922703266144,
-0.03636391833424568,
-0.5439471006393433,
-0.08564204722642899,
0.5676190853118896,
-0.2565380036830902,
0.22303889691829... | |
by a Telecom New Zealand, so it's bound to be configured correctly. I believe it's written in Java)
Can anyone shed some light on this issue?
Ok, found what the problem was. I was trying to call a .wsdl url instead of .asmx url.
Doh! | [
0.8036915063858032,
0.017038395628333092,
0.1302880048751831,
0.216185063123703,
0.06630608439445496,
-0.3567793369293213,
0.44649630784988403,
0.00018168949463870376,
-0.13779374957084656,
-0.11478111147880554,
0.09363143891096115,
0.3229272961616516,
-0.18517273664474487,
-0.026392405852... | |
I have a function pointer defined by:
```
typedef void (*EventFunction)(int nEvent);
```
Is there a way to handle that function with a specific instance of a C++ object?
```
class A
{
private:
EventFunction handler;
public:
void SetEvent(EventFunction func) { handler = func; }
void EventOne() { handle... | [
0.1161021888256073,
-0.18940547108650208,
0.3091152012348175,
-0.14217954874038696,
0.1792239397764206,
-0.02513640746474266,
0.12704117596149445,
-0.3789275288581848,
0.0042265006341040134,
-0.28405025601387024,
-0.30382081866264343,
0.809536337852478,
-0.2766823470592499,
-0.006746850442... | |
std::mem_fun(&X::foo), &x);
f(5); // Call x.foo(5)
```
Unfortunately Boost is not an option for me. Is there some sort of "currying" function that can be written in C++ that will do this kind of wrapping of a pointer to a member function in to a normal function pointer?
I highly recommend Don Clugston's excellent Fas... | [
-0.026965338736772537,
-0.07010038942098618,
-0.004331495147198439,
0.10999846458435059,
-0.14327093958854675,
0.007283085025846958,
0.15613685548305511,
-0.3081933856010437,
-0.39389148354530334,
-0.255317360162735,
-0.15694357454776764,
0.7666230201721191,
-0.13839001953601837,
-0.254982... | |
In .NET, what is the difference between `String.Empty` and `""`, and are they interchangable, or is there some underlying reference or Localization issues around equality that `String.Empty` will ensure are not a problem?
In .NET prior to version 2.0, `""` creates an object while `string.Empty` creates no object[ref](h... | [
-0.19194886088371277,
-0.21206313371658325,
0.44255727529525757,
-0.1645868420600891,
-0.1991506814956665,
-0.3084394931793213,
0.4452868103981018,
-0.016385775059461594,
-0.09072025865316391,
-0.9057933688163757,
-0.24994924664497375,
0.6076876521110535,
-0.49270564317703247,
-0.094619229... | |
specification for more information](https://www.ecma-international.org/publications/standards/Ecma-334.htm). | [
-0.009127343073487282,
-0.1771070957183838,
0.7027146816253662,
0.06183728948235512,
0.2691775858402252,
-0.10421878099441528,
0.003937136847525835,
-0.5553222298622131,
-0.5883901715278625,
-0.23014482855796814,
-0.29815956950187683,
0.2818993926048279,
-0.03592701628804207,
0.01390919182... | |
I came from Java, and now I am working more with Ruby.
One language feature I am not familiar with is the `module`. I am wondering what exactly is a `module` and when do you use one, and why use a `module` over a `class`?
The first answer is good and gives some structural answers, but another approach is to think abo... | [
0.5825589299201965,
-0.05148257687687874,
-0.219240203499794,
0.04641316086053848,
-0.005781502462923527,
-0.28782421350479126,
0.3050912916660309,
-0.08373528718948364,
-0.18921823799610138,
-0.6765928268432617,
-0.03846327215433121,
0.43143564462661743,
-0.3858887255191803,
-0.2035713195... | |
and authorization systems are good examples of modules. Authentication systems work across multiple app-level classes (users are authenticated, sessions manage authentication, lots of other classes will act differently based on the auth state), so authentication systems act as shared APIs.
You might also use a module... | [
0.5667548179626465,
-0.10981178283691406,
0.11655746400356293,
0.3704971969127655,
0.20306748151779175,
-0.26809659600257874,
0.2476644217967987,
-0.3998480439186096,
-0.4040710926055908,
-0.42902013659477234,
-0.47476333379745483,
0.4400729537010193,
-0.2610723078250885,
-0.18335463106632... | |
I have this big data-entry sort of page, a table kind of layout using divs. Each row has subrows which can be toggled open/closed. The toggling is triggered using css visibility settings. Each "cell" of the table has a little image in its corner, you click on the image, and a popup window opens that allows you to put n... | [
0.14977777004241943,
0.03892182558774948,
0.6271284222602844,
0.012124086730182171,
-0.00774800032377243,
-0.10441024601459503,
-0.04290793463587761,
-0.03784485161304474,
-0.03540715575218201,
-0.9191973209381104,
-0.028413517400622368,
-0.1375138908624649,
0.04404068365693092,
0.21927385... | |
iframe and scrolled the page down, mousing over the popup's textarea makes it disappear and show the page content beneath it. The checkboxes also show the page below when you mouse over.
So, I've tried a few different fixes. Z-index was what I was hoping could be used to fix this. no such luck. I might try replacing t... | [
0.19952671229839325,
0.1309659332036972,
0.3448293209075928,
-0.06319471448659897,
-0.2105061411857605,
0.06619758158922195,
0.3961252272129059,
0.3540358543395996,
-0.12512031197547913,
-0.750490128993988,
0.4165244698524475,
0.1552496999502182,
-0.4485674500465393,
0.4423387050628662,
... | |
[read more](http://haslayout.net/haslayout) | [
0.2763458490371704,
0.04933209344744682,
0.14310142397880554,
0.11660780012607574,
0.3115374445915222,
-0.5586373805999756,
0.137221559882164,
0.3590504229068756,
-0.6331096291542053,
-0.5129801034927368,
-0.3874744176864624,
0.0320405475795269,
0.2165909856557846,
0.559364378452301,
-0.... | |
I'm creating a Firefox extension for demo purposes.
I to call a specific JavaScript function in the document from the extension.
I wrote this in my HTML document (not inside extension, but a page that is loaded by Firefox):
```
document.funcToBeCalled = function() {
// function body
};
```
Then, the extension wil... | [
0.33858227729797363,
0.16768385469913483,
0.555926501750946,
-0.1502566635608673,
0.2590521574020386,
-0.27269446849823,
0.3358326852321625,
-0.5475805401802063,
-0.17249201238155365,
-0.6048744320869446,
-0.3918769061565399,
0.8102478981018066,
-0.4853568375110626,
0.019790692254900932,
... | |
chrome](http://developer.mozilla.org/en/Safely_accessing_content_DOM_from_chrome),
If you control the page, the best way to do this is set up an event listener in the page and dispatch an event from your extension (addEventListener in the page, dispatchEvent in the extension).
Otherwise, see <http://groups.google.com... | [
0.10987234115600586,
-0.020769597962498665,
0.5043451189994812,
-0.2976459860801697,
-0.2448837012052536,
-0.14309382438659668,
0.1995088905096054,
-0.41664576530456543,
-0.3420135974884033,
-0.6816576719284058,
-0.17417365312576294,
0.6573182940483093,
-0.6289469003677368,
-0.142333909869... | |
How do you detect if `Socket#close()` has been called on a socket on the remote side?
The `isConnected` method won't help, it will return `true` even if the remote side has closed the socket. Try this:
```
public class MyServer {
public static final int PORT = 12345;
public static void main(String[] args) thr... | [
0.16720974445343018,
-0.09089158475399017,
0.6119747757911682,
-0.27080240845680237,
0.5236420035362244,
-0.013485951349139214,
0.5815025568008423,
0.02580113522708416,
-0.3081831932067871,
-0.8771506547927856,
-0.2970522344112396,
0.47161513566970825,
-0.2350846230983734,
0.52916783094406... | |
s.close();
}
}
public class MyClient {
public static void main(String[] args) throws IOException, InterruptedException {
Socket s = SocketFactory.getDefault().createSocket("localhost", MyServer.PORT);
System.out.println(" connected: " + s.isConnected());
Thread.sleep(10000);
Sys... | [
0.24172963201999664,
-0.12560898065567017,
0.5937368869781494,
-0.23727566003799438,
0.2983926832675934,
0.20752015709877014,
0.5414427518844604,
0.06775801628828049,
-0.35013100504875183,
-0.9937894940376282,
-0.5467647314071655,
0.3998093008995056,
-0.4307616949081421,
0.4538907706737518... | |
find out is by reading (you'll get -1 as return value) or writing (an `IOException` (broken pipe) will be thrown) on the associated Input/OutputStreams. | [
0.3063080310821533,
-0.11421889811754227,
0.28465545177459717,
0.2649867534637451,
0.5018249750137329,
-0.2125503122806549,
0.07785163819789886,
0.11843293905258179,
0.27019762992858887,
-0.5088000297546387,
-0.1483391523361206,
0.5184616446495056,
0.2431434839963913,
-0.03259370103478432,... | |
I am trying to get the yasnippet and pabbrev packages working together with emacs, but I cannot seem to get any love. How can I get them to play nicely together?
The crux of the problem is that pabbrev and yasnippet are binding to the tab keys. Both packages seem to do this fallback when a match isn't found, but they ... | [
-0.026404546573758125,
0.04609238728880882,
0.24018077552318573,
-0.0514899380505085,
-0.1416483074426651,
0.1752610206604004,
0.25796058773994446,
0.10895935446023941,
-0.2824600338935852,
-0.8141695857048035,
-0.04061860218644142,
0.32868242263793945,
-0.5003312230110168,
0.1371794641017... | |
to mark either solution as a correct answer. I'm hacking away at tabkey2 to make it work though.
Have a look at [tabkey2.el](http://www.emacswiki.org/cgi-bin/wiki/tabkey2.el). It looks like it addresses the problem you're having. | [
0.1893366575241089,
0.006849847733974457,
0.0752604678273201,
0.17986753582954407,
0.012182649224996567,
-0.162187859416008,
0.17573072016239166,
0.17053340375423431,
-0.17602962255477905,
-0.4656620919704437,
0.07213162630796432,
0.4458862245082855,
-0.20955967903137207,
-0.12550638616085... | |
In PHP5, is the \_\_destruct() method guaranteed to be called for each object instance? Can exceptions in the program prevent this from happening?
The destructor will be called when the all references are freed, or when the script terminates. I assume this means when the script terminates properly. I would say that cri... | [
0.2009713053703308,
0.062294673174619675,
0.45502763986587524,
-0.23873946070671082,
0.15600834786891937,
-0.2734321355819702,
0.5889407396316528,
0.060099534690380096,
-0.16684465110301971,
-0.4109624922275543,
-0.2363920360803604,
0.8365451097488403,
-0.3718254268169403,
0.12499205023050... | |
```
<my:DataGridTemplateColumn
CanUserResize="False"
Width="150"
Header="{Binding MeetingName, Source={StaticResource LocStrings}}"
SortMemberPath="MeetingName">
</my:DataGridTemplateColumn>
```
I have the above column in a Silverlight grid control. But it is g... | [
0.1759462207555771,
0.31374627351760864,
0.44924256205558777,
-0.14726004004478455,
0.08590535819530487,
-0.4264821708202362,
0.24585826694965363,
-0.3901066482067108,
-0.10391644388437271,
-0.6281459331512451,
0.09496543556451797,
0.3838203549385071,
-0.5769366025924683,
0.098451256752014... | |
multiple languages.
Also my syntax for the binding to a resouce is correct because I tried it in a lable outside of the grid.
You can't Bind to Header because it's not a FrameworkElement. You can make the text dynamic by modifying the Header Template like this:
```
xmlns:data="clr-namespace:System.Windows.Controls;as... | [
0.034383174031972885,
0.014011768624186516,
0.29229116439819336,
-0.08025234192609787,
-0.26621171832084656,
0.14608357846736908,
0.13899387419223785,
-0.31753799319267273,
-0.3086353540420532,
-0.4464746117591858,
-0.1547306627035141,
0.5145807266235352,
-0.5041998028755188,
0.02170857414... | |
<TextBlock Text="{Binding MeetingName, Source={StaticResource LocStrings}}" />
</ControlTemplate> | [
-0.19708992540836334,
0.02583901397883892,
0.33847758173942566,
0.06641584634780884,
0.08205597847700119,
-0.0841858983039856,
0.0614076666533947,
-0.3722084164619446,
0.11267247051000595,
-0.44275060296058655,
-0.23893192410469055,
0.22410374879837036,
-0.5649093985557556,
0.0527490116655... | |
</Setter.Value>
</Setter>
</Style>
</data:DataGridTemplateColumn.HeaderStyle>
</data:DataGridTemplateColumn>
``` | [
0.1100512370467186,
0.3759264051914215,
0.26675522327423096,
0.07908375561237335,
-0.11008144170045853,
-0.36738815903663635,
-0.3826403021812439,
-0.28302299976348877,
-0.18329238891601562,
-0.43792980909347534,
-0.24645905196666718,
0.24670255184173584,
-0.0537392795085907,
0.03543825075... | |
We have built a custom application, for internal use, that accesses TFS. We use the Microsoft libraries for this (e.g Microsoft.TeamFoundation.dll).
When this application is deployed to PCs that already have Team Explorer or VS installed, everything is fine. When it’s deployed to PCs that don’t have this installed, it... | [
0.26188787817955017,
0.02702171541750431,
0.3372533321380615,
0.052072521299123764,
0.2433401495218277,
-0.3755319118499756,
0.5538493990898132,
0.1808212250471115,
-0.14144152402877808,
-0.9201298952102661,
-0.2849257290363312,
0.6419562101364136,
-0.3612193167209625,
-0.14153772592544556... | |
note that many other custom applications that access TFS (e.g. <http://hinshelwood.com/tfsstickybuddy.aspx>) also require Team Explorer or VS to be installed to work.
Clearly the DLLs are not enough and there is some magic that happens when these installs occur. Anyone know what it is? Anyone know how to make the magi... | [
0.6470085978507996,
-0.1379512995481491,
0.23571278154850006,
0.14316046237945557,
0.04085931554436684,
-0.476441353559494,
0.5701833367347717,
-0.11933194100856781,
-0.3600534498691559,
-0.6138681769371033,
-0.23988114297389984,
0.570359468460083,
-0.28245922923088074,
-0.2130340337753296... | |
API's get upgraded as well. There are no re-distribution rights to the TFS API's therefore they should not be shipped with your application.
BTW - Also note that if you are writing an application that used the TFS OM, then be sure to compile it as "X86" only rather than "Any CPU". The TFS API assemblies are all marked... | [
0.471700519323349,
0.15415607392787933,
0.42017725110054016,
0.18857106566429138,
-0.0888318419456482,
-0.16916199028491974,
0.4068832993507385,
0.1452806144952774,
-0.49348390102386475,
-0.8208115100860596,
0.011831638403236866,
0.7231248617172241,
-0.45418280363082886,
0.1389735788106918... | |
Given a pretty basic source tree structure like the following:
```
trunk -------
QA |--------
Stage |-------
Prod |------
```
And an environment which mirrors that (Dev, QA, Staging and Production servers) - how do you all manage automated or manual code promotion? Do you use a CI server to build... | [
0.7740265727043152,
-0.025199618190526962,
-0.06191765516996384,
0.5623180866241455,
0.20209984481334686,
-0.239274263381958,
-0.32880350947380066,
-0.005610190331935883,
0.12232275307178497,
-0.49648019671440125,
-0.1447777897119522,
0.4639487564563751,
-0.12192402780056,
0.07976944744586... | |
build, and then push the output of the build to the correct server. The second being that at some point - QA or Staging - the binaries that were promoted would be the exact same ones copied to the other stages. The third is keeping a secondary source tree for deployed binaries which would automatically move in lockstep... | [
0.6075236797332764,
0.040326524525880814,
0.23283937573432922,
0.11847235262393951,
0.010707341134548187,
-0.0337604358792305,
0.03666868060827255,
-0.08610386401414871,
-0.023484785109758377,
-0.5526823401451111,
-0.25658124685287476,
0.4484695792198181,
-0.11859997361898422,
0.0097604636... | |
needed you can reproduce the build in a dev environment. At least if you make a mistake at this point, the consequences won't be as drastic. | [
0.8668656945228577,
0.1286725103855133,
-0.2745053172111511,
0.47853773832321167,
0.21910659968852997,
0.03483598679304123,
0.33049023151397705,
-0.0637611672282219,
-0.017499007284641266,
-0.7936345934867859,
0.47365856170654297,
0.5751228928565979,
-0.22621962428092957,
0.118000224232673... | |
I've been trying to submit a form with the FormPanel using the Action class Ext defaults to. However, I'd like it to consider the response as a script, not JSON-encoded.
Has anyone had any experience on this?
The best plan would be to create a custom action by extending `Ext.form.Action`.
You can then `eval` the `res... | [
0.41922083497047424,
-0.3496420383453369,
0.24548357725143433,
-0.1698969155550003,
-0.09458619356155396,
0.23281288146972656,
0.23173588514328003,
-0.1914181262254715,
-0.16821174323558807,
-0.35699304938316345,
-0.29938575625419617,
0.7900567650794983,
-0.18973705172538757,
-0.1290585398... | |
What is the resolution of the image for the tab bar item?
And also, please provide some other useful information regarding that tab item image.
Thanks in advance.
The documentation says that the tab bar image is usually 30x30, but I've found that the best size to setup the images is 48x32 pixels. This size still rend... | [
0.14288119971752167,
-0.11385627090930939,
0.5849929451942444,
0.11481102555990219,
-0.24134424328804016,
0.35531526803970337,
0.05159178748726845,
-0.12887530028820038,
-0.08304145187139511,
-0.8773729801177979,
0.0853596180677414,
0.6604108214378357,
-0.060450319200754166,
-0.07050223648... | |
I'm making a mini ORM for a Java program I'm writing... there is a class for each table in my db, all inheriting from `ModelBase`.
`ModelBase` is abstract & provides a bunch of static methods for finding & binding objects from the db, for example:
```
public static ArrayList findAll(Class cast_to_class) {
//build t... | [
0.275921493768692,
0.3301275670528412,
0.21258774399757385,
-0.11584935337305069,
-0.06520635634660721,
-0.19318100810050964,
-0.02162037044763565,
-0.2658936381340027,
-0.14325189590454102,
-0.3103306293487549,
0.2639937996864319,
0.49996334314346313,
-0.3972051739692688,
0.27120873332023... | |
```
public class Album extends ModelBase {
public static String getSelectSQL() { return "select * from albums.....";}
}
```
because there is no polymorphism for static methods in Java. But I don't want to make `getSelectSQL()` an instance method in `Album` because then I need to create an instance of it just to get... | [
0.19392961263656616,
0.2795579135417938,
0.12086500227451324,
-0.20451128482818604,
-0.06156019866466522,
-0.32508131861686707,
0.1421293467283249,
-0.2944636940956116,
-0.2389824390411377,
-0.3085894286632538,
-0.12187511473894119,
0.8008547425270081,
-0.43381696939468384,
0.0187699291855... | |
specify abstract static methods in classes or interfaces. I know *why* static method polymorphism doesn't and can't work, but that doesn't stop me from wanting to use it time again!
Is there any pattern/construct that allows me to ensure that concrete subclasses X and Y implement a class method(or failing that, a clas... | [
0.3312333822250366,
0.02757684513926506,
-0.016798220574855804,
0.2655169367790222,
-0.16315393149852753,
-0.18065814673900604,
0.14964546263217926,
0.12034463882446289,
-0.19072546064853668,
-0.5042067170143127,
0.44978559017181396,
0.6463660597801208,
-0.5942022800445557,
0.2546868920326... | |
comment "I need to create an instance of it just to get a string that is really static in behaviour"
It is not completely correct. If you look well, you are not changing the behavior of your base class, just changing the parameter for a method. In other words you're changing the data, not the algorithm.
Inheritance ... | [
0.36924830079078674,
-0.2800174355506897,
-0.24371111392974854,
0.09088260680437088,
-0.08753518760204315,
-0.2983074486255646,
-0.020011866465210915,
0.14059555530548096,
-0.16169963777065277,
-0.5090136528015137,
0.13635662198066711,
0.5405609011650085,
-0.6392867565155029,
0.08158829063... | |
the queries
private static Map<String,String> selectMap = new HashMap<String,String>(); static {
selectMap.put( "Album", "select field_1, field_2 from album");
selectMap.put( "Artist", "select field_1, field_2 from artist");
selectMap.put( "Track", "select field_1, field_2 from track");
... | [
-0.06565135717391968,
-0.18919283151626587,
0.23076236248016357,
-0.025992073118686676,
0.19707949459552765,
0.12052927911281586,
-0.00677567208185792,
-0.4962257146835327,
-0.15648837387561798,
-0.5936650633811951,
-0.3284560441970825,
0.6957464218139648,
-0.35669001936912537,
0.060124617... | |
String sql = getSelectSQL( classToFind );
results = execute( sql );
//etc...
return ....
}
// Return the correct select sql..
private static String getSelectSQL( Class classToFind ){
String statement = tableMap.get( classToFind.getSimpleName() );
if( statement == nul... | [
0.07777342200279236,
-0.3261267840862274,
0.5614671111106873,
-0.12005380541086197,
0.035579945892095566,
0.07091409713029861,
0.16093969345092773,
-0.2829744219779968,
-0.14668744802474976,
-0.03584842383861542,
-0.3720598518848419,
0.5321285724639893,
-0.5339038372039795,
0.1018538475036... | |
throw new IllegalArgumentException("Class " +
classToFind.getSimpleName + " is not mapped");
}
return statement;
}
}
```
That is, map all the statements with a Map. The "obvious" next step to this is to load the map from an external resource, such as a properties file, or a xml ... | [
0.0015318149235099554,
-0.2801949083805084,
-0.07433820515871048,
0.1714591234922409,
-0.05256318673491478,
-0.27609556913375854,
0.2666512131690979,
-0.2346287965774536,
-0.27830249071121216,
-0.42834189534187317,
-0.23385471105575562,
0.5132474303245544,
-0.3520428538322449,
0.0570089332... | |
clients ( and your self ) happy, because you don't needed "creating an instance" to do the work.
```
// Client usage:
...
List albums = ModelBase.findAll( Album.class );
```
...
Another approach is to create the instances from behind, and keep your client interface intact while using instance methods, the methods ... | [
0.16162535548210144,
0.04019501432776451,
0.3527582585811615,
-0.08110006153583527,
0.026378171518445015,
0.09285545349121094,
0.16385100781917572,
-0.2650037109851837,
-0.6735614538192749,
-0.7400604486465454,
0.019110478460788727,
1.0827840566635132,
-0.5186592936515808,
-0.1099554449319... | |
selectMap.put( "Album", new AlbumModel() );
selectMap.put( "Artist", new ArtistModel());
selectMap.put( "Track", new TrackModel());
}
// Finds all the objects for the specified class...
// Note: it is better to use "List" rather than "ArrayList" I'll explain this later.
public static Li... | [
0.28329944610595703,
-0.21365925669670105,
0.34470391273498535,
-0.036330003291368484,
0.12424986064434052,
-0.019589338451623917,
0.061283212155103683,
-0.636390745639801,
-0.2713608145713806,
-0.38497382402420044,
-0.18690535426139832,
0.5934561491012573,
-0.3177820146083832,
-0.01015484... | |
//etc...
return ....
}
// Return the correct select sql..
private static String getSelectSQL( Class classToFind ){
ModelBase dao = tableMap.get( classToFind.getSimpleName() );
if( statement == null ) {
throw new IllegalArgumentException("Class " +
class... | [
0.12304439395666122,
-0.35171669721603394,
0.4646631181240082,
0.013048912398517132,
0.41255518794059753,
0.0050416733138263226,
0.27760180830955505,
-0.3817283511161804,
-0.2958725690841675,
-0.07256470620632172,
-0.17742373049259186,
0.5303869843482971,
-0.428447425365448,
0.112948268651... | |
is not mapped");
}
return dao.selectSql();
}
// Instance class to be overrided...
// this is "protected" ...
protected abstract String selectSql();
}
class AlbumModel extends ModelBase {
public String selectSql(){
return "select ... from album";
}
}
class ArtistModel ... | [
-0.04933707416057587,
-0.40834131836891174,
0.49722129106521606,
-0.20918123424053192,
0.40490350127220154,
-0.23035378754138947,
-0.12225795537233353,
-0.5122591257095337,
-0.18793587386608124,
-0.35384926199913025,
-0.277213990688324,
0.8353378772735596,
-0.34378892183303833,
-0.11557762... | |
}
}
class TrackModel extends ModelBase {
public String selectSql(){
return "select ... from track";
}
}
```
And you don't need to change the client code, and still have the power of polymorphism.
```
// Client usage:
...
List albums = ModelBase.findAll( Album.class ); // Does not know , behind the ... | [
0.1992855966091156,
-0.1906367838382721,
0.3131539523601532,
0.06062264367938042,
0.08861029893159866,
-0.19070586562156677,
0.0687314122915268,
-0.21952204406261444,
-0.36183857917785645,
-0.6013736128807068,
0.15120266377925873,
0.9786059260368347,
-0.2980600595474243,
-0.161821067333221... | |
implementation that is faster, or does something else, without changing your client code. | [
0.11002258211374283,
-0.12149663269519806,
0.2049296647310257,
0.1722712218761444,
-0.019653374329209328,
-0.31291264295578003,
0.06604893505573273,
0.04271700233221054,
-0.17026495933532715,
-1.2399053573608398,
-0.09268981218338013,
0.5504809021949768,
-0.2673237919807434,
-0.41418194770... | |
I'm running an old little app which runs in the browser from local files, and I keep getting the, "To help protect your security, Internet Explorer has restricted this webpage from running scripts or Activex controls that could access your computer" message.
Is there a registry setting or something I can tweak to allo... | [
0.5390363931655884,
0.35686710476875305,
0.31640198826789856,
-0.08837238699197769,
0.28705817461013794,
-0.3577994108200073,
0.3928634524345398,
0.008617018349468708,
-0.37239882349967957,
-0.6427403092384338,
-0.0374554768204689,
0.3180895447731018,
-0.13194353878498077,
0.33070200681686... | |
What's the best way of inserting information in table A and using the index from table A to relate to table B.
The "solution" I tried is inserting the info in table A (which has a automatically generated ID), then, select the last index and insert it in table B. This may not be very useful, as the last index may chan... | [
0.10856049507856369,
-0.05738883465528488,
0.19677507877349854,
0.22213521599769592,
0.18499791622161865,
-0.0752798318862915,
-0.2212485671043396,
-0.006422185339033604,
-0.0919867604970932,
-0.6832719445228577,
0.06619321554899216,
0.45848262310028076,
-0.36790090799331665,
0.04583508148... | |
SCOPE\_IDENTITY to return the last id inserted in your current session. You can then use that to insert into table B.
[This article from MSDN](http://msdn.microsoft.com/en-us/library/ms190315.aspx) gives a decent example on how to do it. | [
0.4462721645832062,
-0.24627844989299774,
0.33724212646484375,
0.024629585444927216,
0.29308369755744934,
-0.5302910804748535,
0.2711541950702667,
-0.048130329698324203,
-0.23465655744075775,
-0.7159984111785889,
-0.08976850658655167,
0.7670818567276001,
-0.3311355412006378,
0.007045683916... | |
What is the best way to free resources (in this case unlock the ReadWriteLock) when leaving the scope ? How to cover all possible ways (return, break, exceptions etc)?
A try/finally block is the closest thing that you can get to this behaviour:
```
Lock l = new Lock();
l.lock(); // Call the lock before calling try.
t... | [
0.3385176360607147,
-0.17749634385108948,
0.28344082832336426,
-0.1642860472202301,
0.4328809678554535,
-0.26585671305656433,
0.525732159614563,
-0.4398995041847229,
-0.26515188813209534,
-0.6235983371734619,
-0.47949156165122986,
0.5576403737068176,
-0.33085379004478455,
0.060610227286815... | |
Visual Studio includes support for \_\_forceinline. The Microsoft Visual Studio 2005 documentation states:
> The \_\_forceinline keyword overrides
> the cost/benefit analysis and relies
> on the judgment of the programmer
> instead.
This raises the question: When is the compiler's cost/benefit analysis wrong? And,... | [
-0.10946742445230484,
-0.1507866233587265,
0.08170190453529358,
-0.14948628842830658,
-0.42603999376296997,
0.09756340831518173,
0.19544297456741333,
-0.3490965664386749,
-0.08290255069732666,
-0.19474279880523682,
-0.10815244168043137,
1.0413814783096313,
-0.4201008081436157,
-0.633746862... | |
of calls to a specific piece of code is often largely determined by the context in which it is used, e.g. the data. Profiling a typical set of use cases will do this. Personally, I gather this information by enabling profiling on my automated regression tests. In addition to forcing inlines, I have unrolled loops and c... | [
0.357047438621521,
0.31137222051620483,
-0.13170567154884338,
0.2162564992904663,
-0.10717391222715378,
-0.0855480208992958,
0.5400247573852539,
-0.3257739245891571,
-0.10027904808521271,
-0.04903627559542656,
0.008436382748186588,
0.7763974070549011,
-0.5347549915313721,
-0.03281652554869... | |
though, in my experience, tweaking alogorithms gives much better results than straight code optimization. | [
0.15105970203876495,
0.2416820079088211,
-0.0032510231249034405,
0.25710564851760864,
-0.0632018893957138,
-0.07254495471715927,
0.10676781833171844,
-0.30508238077163696,
0.14423605799674988,
-0.377139687538147,
0.09168358892202377,
0.4290916919708252,
-0.06219073757529259,
-0.12943357229... | |
Emacs puts backup files named `foo~` everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points to the backup when I'm done editing, and that's confusing and awful. How can I either eliminate these backup files, or h... | [
0.0639660656452179,
0.5838272571563721,
0.20487244427204132,
0.10270185768604279,
0.33409273624420166,
0.10588400065898895,
0.19398599863052368,
0.5093479752540588,
-0.41262614727020264,
-0.3554501235485077,
-0.19523487985134125,
0.5428639054298401,
-0.29821792244911194,
0.2487584501504898... | |
that is easy to change. You can make all backup files go
into a directory by putting something like the following in your
`.emacs`.
```lisp
(setq backup-directory-alist `(("." . "~/.saves")))
```
There are a number of arcane details associated with how Emacs
might create your backup files. Should it rename the origi... | [
0.08955272287130356,
0.18831618130207062,
0.33708229660987854,
0.24371971189975739,
0.26285621523857117,
-0.157525435090065,
0.1883271336555481,
0.12259107083082199,
-0.25142142176628113,
-0.4916061460971832,
-0.4249774217605591,
0.6707409620285034,
-0.5532213449478149,
-0.0618337579071521... | |
of them. Have a look at the Emacs
documentation for these variables (with `C-h v`).
```lisp
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
```
Finally, if you absolutely must have no backup files:
```lisp
(setq make-backup-files nil)
```
It makes me sick to think of i... | [
0.3140212893486023,
0.23723088204860687,
0.4535105526447296,
0.058831505477428436,
0.48131251335144043,
-0.3797627389431,
0.34629926085472107,
0.35237744450569153,
-0.37974265217781067,
-0.32509154081344604,
-0.4025114178657532,
1.0142734050750732,
-0.4819108247756958,
0.0980830118060112,
... | |
The Project's Web section (under project properties in VS2008) has a list of debuggers: ASP.NET, Native Code, SQL Server. What is Native Code?
Native code is machine code executed directly by the CPU. This is in contrast to .NET bytecode, which is interpreted by the .NET virtual machine.
A nice MSDN hit: [Debugging Na... | [
0.33225929737091064,
-0.08981069922447205,
0.06116443872451782,
0.3934269845485687,
-0.1951930820941925,
0.08397497236728668,
0.3615407645702362,
-0.03443349152803421,
-0.27470383048057556,
-0.5958492755889893,
-0.2576431334018707,
0.24302347004413605,
-0.17860491573810577,
0.4559040963649... | |
I am looking to store 2D arrays of 900x100 elements in a database. Efficient recall and comparison of the arrays is important. I could use a table with a schema like [A, x, y, A(x,y)] such that a single array would compromise 90,000 records. This seems like an ~ok~ table design to store the array, and would provide for... | [
0.40206560492515564,
0.33637893199920654,
-0.05670395493507385,
0.19957971572875977,
-0.14904969930648804,
0.2946182191371918,
-0.017164865508675575,
-0.4328874945640564,
-0.17779289186000824,
-0.6958702206611633,
0.24130433797836304,
0.4076016843318939,
-0.3706006407737732,
0.295614093542... | |
to structure the table such that I can get efficient array comparisons using database only operations?
thanks
If the type of data allows, store it in a concatenated format and compare in memory after it has been de-concatenated. The database operation will be much faster and the in-memory operations will be faster tha... | [
0.2779707908630371,
0.13790616393089294,
0.08682840317487717,
0.24423612654209137,
-0.14566949009895325,
0.001206390792503953,
-0.2540712356567383,
-0.04521310701966286,
-0.2872960865497589,
-0.673810601234436,
0.30357450246810913,
0.44884341955184937,
-0.1402241289615631,
0.18621477484703... | |
Is it possible to get the route/virtual url associated with a controller action or on a view? I saw that Preview 4 added LinkBuilder.BuildUrlFromExpression helper, but it's not very useful if you want to use it on the master, since the controller type can be different. Any thoughts are appreciated.
You can get that dat... | [
0.15038050711154938,
-0.388149619102478,
0.42246341705322266,
0.2278854250907898,
-0.12553799152374268,
-0.307463675737381,
0.1790427267551422,
0.08022338896989822,
-0.3067553639411926,
-0.6381967067718506,
-0.030073920264840126,
0.3896307945251465,
-0.3979608118534088,
0.3552325665950775,... | |
return ViewContext.RouteData.Values["controller"].ToString().Equals(controller, StringComparison.OrdinalIgnoreCase);
}
return false;
}
public bool IsAction(string action)
{
if (ViewContext.RouteData.Values["action"] != null)
{
return ViewContext.RouteData.Values["action"].ToString().Equals(actio... | [
0.06763692945241928,
-0.38498759269714355,
0.8434175252914429,
-0.02041047066450119,
-0.20089340209960938,
0.18594098091125488,
0.020120317116379738,
-0.0905495211482048,
-0.1177610233426094,
-0.3992195427417755,
-0.20608390867710114,
0.7701476216316223,
-0.4841703176498413,
0.217718884348... | |
of the controller.</typeparam>
/// <param name="helper">Url Helper</param>
/// <param name="action">The action to check.</param>
/// <returns>
/// <c>true</c> if the specified action is the current view; otherwise, <c>false</c>.
/// </returns>
public static bool IsAction<TController>(this Ur... | [
0.006484141107648611,
-0.5031871199607849,
0.5546842217445374,
0.22205562889575958,
-0.20258237421512604,
0.390461802482605,
-0.13419200479984283,
-0.5756398439407349,
-0.43561848998069763,
-0.30090200901031494,
-0.17600658535957336,
0.3797733783721924,
-0.5725193619728088,
0.2031258940696... | |
throw new ArgumentException("Expression must be a method call", "action");
}
return (call.Method.Name.Equals(helper.ViewContext.ViewName, StringComparison.OrdinalIgnoreCase) &&
typeof(TController) == helper.ViewContext.Controller.GetType());
}
/// <summary>
/// Determines i... | [
-0.14933174848556519,
-0.14617103338241577,
0.45680421590805054,
0.0627334713935852,
-0.2981807589530945,
0.4299391508102417,
0.17015688121318817,
-0.7018471360206604,
-0.35749322175979614,
-0.3448035717010498,
-0.22100429236888885,
0.41758111119270325,
-0.26272597908973694,
0.033929035067... | |
/// <returns>
/// <c>true</c> if the specified action is the current view; otherwise, <c>false</c>.
/// </returns>
public static bool IsAction(this UrlHelper helper, string actionName)
{
if (String.IsNullOrEmpty(actionName))
{
throw new ArgumentException("Please specify t... | [
-0.15083478391170502,
-0.6535271406173706,
0.783168613910675,
-0.24156634509563446,
0.09762309491634369,
0.10110720247030258,
0.0076540266163647175,
-0.05435868725180626,
-0.11421843618154526,
-0.3869640529155731,
-0.4454610049724579,
0.7166317701339722,
-0.42169785499572754,
0.12105458974... | |
return IsAction(helper, actionName, controllerName);
}
/// <summary>
/// Determines if the current view equals the specified action
/// </summary>
/// <param name="helper">Url Helper</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="controllerName">Name of th... | [
-0.07373245805501938,
-0.3886474072933197,
0.7169026732444763,
-0.02564401365816593,
-0.1314658373594284,
0.3003734350204468,
-0.14544664323329926,
-0.41400599479675293,
-0.21608801186084747,
-0.30379459261894226,
-0.39987611770629883,
0.48312729597091675,
-0.5167784690856934,
-0.179057970... | |
helper, string actionName, string controllerName)
{
if (String.IsNullOrEmpty(actionName))
{
throw new ArgumentException("Please specify the name of the action", "actionName");
}
if (String.IsNullOrEmpty(controllerName))
{
throw new ArgumentException("P... | [
-0.8288443088531494,
-0.7913579940795898,
0.7038516998291016,
-0.1847410649061203,
0.4038619101047516,
0.2045079469680786,
-0.04899564012885094,
-0.2507345378398895,
0.10116975009441376,
-0.43865081667900085,
-0.6374958753585815,
0.827002763748169,
-0.5949831604957581,
-0.00691113946959376... | |
}
if (!controllerName.EndsWith("Controller", StringComparison.OrdinalIgnoreCase))
{
controllerName = controllerName + "Controller";
}
bool isOnView = helper.ViewContext.ViewName.SafeEquals(actionName, StringComparison.OrdinalIgnoreCase);
return isOnView && helper.Vi... | [
-0.34290704131126404,
-0.42080286145210266,
0.7228460311889648,
0.07325011491775513,
0.1273658722639084,
0.1440417468547821,
0.14186644554138184,
-0.4683707058429718,
-0.12712045013904572,
-0.4506494402885437,
-0.5400934219360352,
0.38737839460372925,
-0.27656489610671997,
0.03808024153113... | |
name="helper">The helper.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <returns>
/// <c>true</c> if the current view is on the specified controller; otherwise, <c>false</c>.
/// </returns>
public static bool IsController(this UrlHelper helper, string controllerNam... | [
-0.45098841190338135,
-0.3922070562839508,
0.7390822172164917,
-0.18051038682460785,
-0.08812377601861954,
0.3141629993915558,
-0.020388362929224968,
-0.42524421215057373,
-0.2056725174188614,
-0.46219897270202637,
-0.5388994216918945,
0.32262250781059265,
-0.4645814895629883,
0.2837351262... | |
}
if (!controllerName.EndsWith("Controller", StringComparison.OrdinalIgnoreCase))
{
controllerName = controllerName + "Controller";
}
return helper.ViewContext.Controller.GetType().Name.Equals(controllerName, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
... | [
-0.24980375170707703,
-0.4471651613712311,
0.792111337184906,
0.32909178733825684,
0.15744207799434662,
0.3399449288845062,
-0.1350405216217041,
-0.502320408821106,
-0.3502309322357178,
-0.487021803855896,
-0.24681487679481506,
0.4676334857940674,
-0.37951210141181946,
0.31983593106269836,... | |
/// <returns>
/// <c>true</c> if the current view is on the specified controller; otherwise, <c>false</c>.
/// </returns>
public static bool IsController<TController>(this UrlHelper helper) where TController : Controller
{
return (typeof(TController) == helper.ViewContext.Controller.GetType(... | [
0.011133698746562004,
-0.3064335882663727,
0.7185429930686951,
0.2229858934879303,
-0.02781706117093563,
-0.0955158993601799,
-0.03265479952096939,
0.029742185026407242,
-0.356235533952713,
-0.49795597791671753,
-0.18297776579856873,
0.5781916975975037,
-0.42809897661209106,
0.635400831699... | |
I want to use remote debugging.
The program that I want to debug runs on machine b.
Visual Studio runs on machine a.
On machine b I have a folder with the following files:
* msvcr72.dll
* msvsmon.exe
* NatDbgDE.dll
* NatDbgDEUI.dll
* NatDbgEE.dll
* NatDbgEEUI.dll
If you think some files are missing, could you also ... | [
0.032119955867528915,
0.2622198164463043,
0.04805721715092659,
-0.15323007106781006,
-0.10039710253477097,
-0.024878427386283875,
0.4189068377017975,
-0.1884758621454239,
-0.3519977629184723,
-0.6363620162010193,
-0.2487386167049408,
0.5062669515609741,
-0.36789557337760925,
0.418676018714... | |
I used the correct IP as a qualifier and took the right process (program.exe). After a while the following message occurred in a popup-window:
> Unhandled exception at 0x7c812a7b in program.exe: 0xE0434F4D: 0xe0434f4d
I can continue or break; When continuing, the exception occurs again and again and again. So I press... | [
0.029950788244605064,
0.08853422105312347,
0.37583687901496887,
-0.09445877373218536,
0.03474690392613411,
-0.07161817699670792,
0.628035306930542,
-0.28000304102897644,
-0.2555723488330841,
-0.5595208406448364,
-0.11315809935331345,
0.501323401927948,
-0.3335989713668823,
0.16315458714962... | |
I need to scan uploaded files for viruses on a Linux server, but I'm not sure how to go about it.
What are my options, if any? I'm also interested in how the scanners perform when multiple users send multiple files at the same time.
I would have a look at [Clam AntiVirus](http://www.clamav.net/). It provides a `clamsc... | [
0.6394833922386169,
0.266950398683548,
0.08728471398353577,
0.03240077570080757,
0.39689016342163086,
-0.2588183879852295,
-0.13189944624900818,
0.31935563683509827,
-0.5368545055389404,
-0.4241061210632324,
0.3470679521560669,
0.5196130871772766,
-0.14573366940021515,
0.2412523776292801,
... | |
I've got a php script. Most of the time the script returns html, which is working fine, but on one occasion (parameter ?Format=XML) the script returns XML instead of HTML.
Is there any way to change the returned mime type of the php output on the fly from text/html to text/xml or application/xml?
```
header('Content-t... | [
0.5219279527664185,
0.3258179724216461,
0.4346514344215393,
-0.130441814661026,
0.03212488442659378,
-0.16929180920124054,
0.27940186858177185,
0.2892926335334778,
-0.034333955496549606,
-0.5437904596328735,
0.07616197317838669,
0.15165910124778748,
-0.014391303062438965,
0.050637308508157... | |
I want to be able to compare an image taken from a webcam to an image stored on my computer.
The library doesn't need to be one hundred percent accurate as it won't be used in anything mission critical (e.g. police investigation), I just want something OK I can work with.
I have tried a demonstration project for [Ima... | [
0.5891254544258118,
-0.03888336196541786,
0.2106960564851761,
0.17357495427131653,
-0.17073892056941986,
0.0909787267446518,
0.0431000180542469,
0.01909543201327324,
-0.3481672704219818,
-0.6533846855163574,
0.1568491905927658,
0.3904053866863251,
0.0024613910354673862,
0.00348961260169744... | |
be able to provide a link to a library I could use in either C# or VB.NET?
You could try this: <http://code.google.com/p/aforge/>
It includes a comparison analysis that will give you a score. There are many other great imaging features of all types included as well.
```
// The class also can be used to get similarity... | [
0.17893703281879425,
-0.10661686211824417,
0.37929409742355347,
0.31101569533348083,
-0.35065674781799316,
0.028158294036984444,
0.02964755892753601,
-0.43057435750961304,
0.017372552305459976,
-0.9573280811309814,
0.3480514585971832,
0.4955032765865326,
-0.14095763862133026,
0.11935655772... | |
);
// Check similarity level
if (matchings[0].Similarity > 0.95)
{
// Do something with quite similar images
}
``` | [
0.27300000190734863,
0.16770203411579132,
0.6038039922714233,
-0.0627962201833725,
-0.005651241168379784,
-0.2361060231924057,
0.24861113727092743,
-0.30305415391921997,
0.22562754154205322,
-0.6369908452033997,
-0.09957968443632126,
0.6063340902328491,
-0.19452618062496185,
0.198821559548... | |
I agree, that programming against interfaces is a good practice. In most cases in Java "interface" in this sense means the language construct interface, so that you write an interface and an implementation class and that you use the interface instead of the implementation class most of the time.
I wonder if this is a ... | [
0.2342056781053543,
0.1712784767150879,
0.06003912538290024,
-0.04284755513072014,
-0.2673117220401764,
0.19191709160804749,
0.1902807652950287,
-0.14550445973873138,
-0.23776260018348694,
-0.7353217601776123,
0.30771195888519287,
0.6718327403068542,
-0.3640233874320984,
0.0090044727548956... | |
of Orders? Or would you use interfaces in the domain model, only if it is really driven by the domain, e.g. you've got at least two different types of Orders? In other words, would you use interfaces because of only technical needs in the domain model, or only when it is really appropriate with respect to the actual do... | [
0.31267037987709045,
0.10769148916006088,
0.06318897753953934,
0.37676215171813965,
-0.3538745641708374,
-0.0996921956539154,
0.3802746832370758,
-0.009530787356197834,
-0.22074943780899048,
-0.6848297119140625,
0.11538999527692795,
0.6488650441169739,
-0.32246071100234985,
-0.079241260886... | |
I'm interested in actual examples of using fixed point combinators (such as the [y-combinator](https://stackoverflow.com/questions/93526/what-is-a-y-combinator) in C++. Have you ever used a fixed point combinator with [egg](http://p-stade.sourceforge.net/boost/libs/egg/doc/html/boost_egg/function_adaptors.html#boost_eg... | [
0.14113424718379974,
-0.014123204164206982,
0.05006147176027298,
-0.0068288445472717285,
-0.08230570703744888,
-0.1541595160961151,
-0.31720170378685,
-0.05007769167423248,
-0.2757112681865692,
-0.4401129484176636,
-0.13511744141578674,
0.38627561926841736,
-0.24003171920776367,
-0.3076112... | |
: a * f(a-1)
bll::if_then_else_return( _2 == 0,
1,
_2 * lazy(_1)(_2 - 1)
)
) | [
-0.06002598628401756,
-0.02110747992992401,
0.27544379234313965,
-0.6105818748474121,
0.24222016334533691,
0.3730897605419159,
0.16847392916679382,
-0.23095004260540009,
-0.1741267889738083,
-0.038663629442453384,
-0.4377346634864807,
0.5649517178535461,
-0.36908677220344543,
-0.0397584289... | |
) (5);
BOOST_CHECK(r == 5*4*3*2*1);
}
```
Can you explain how this all works?
Is there a nice simple example perhaps using bind with perhaps fewer dependancies than this one?
Here is the same code converted into `boost::bind` notice the y-combinator and its application site in the main function. I hope this hel... | [
-0.09460178017616272,
-0.06515735387802124,
0.6356555223464966,
-0.12518295645713806,
0.06814435869455338,
0.14488190412521362,
0.21049147844314575,
-0.3942503035068512,
-0.07737251371145248,
-0.39104950428009033,
-0.31890028715133667,
0.8498969078063965,
-0.47927334904670715,
-0.131168469... | |
= y(fact);
std::cout << factorial(5) << std::endl;
return 0;
}
``` | [
0.21926194429397583,
-0.0477798692882061,
0.5619558691978455,
-0.23173567652702332,
0.27770039439201355,
0.08935391902923584,
0.1776311844587326,
-0.10462687164545059,
-0.07678920030593872,
-0.295550137758255,
-0.5545576810836792,
0.6786060333251953,
-0.3298470973968506,
0.4016827046871185... | |
I have an ASP.NET page with a gridview control on it with a CommandButton column with delete and select commands active.
Pressing the enter key causes the first command button in the gridview to fire, which deletes a row. I don't want this to happen. Can I change the gridview control in a way that it does not react an... | [
0.24276819825172424,
0.02451426349580288,
0.5907039642333984,
0.12586064636707306,
-0.06078655272722244,
-0.06227646768093109,
0.4397147595882416,
-0.21498575806617737,
-0.19262023270130157,
-0.8733373880386353,
0.047030650079250336,
0.5404984951019287,
-0.14593857526779175,
0.076853521168... | |
prevent accidental deletes, but we need something better than this.
This is the markup for the gridview, as you can see it's inside an asp.net updatepanel (i forgot to mention that, sorry): (I left out most columns and the formatting)
```
<asp:UpdatePanel ID="upContent" runat="server" UpdateMode="Conditional">
... | [
0.12078694999217987,
-0.22836729884147644,
0.49494075775146484,
-0.09354973584413528,
0.1667362004518509,
-0.13225388526916504,
0.43420663475990295,
-0.1725330650806427,
-0.36982572078704834,
-0.6298648715019226,
-0.1838364601135254,
0.5682741403579712,
-0.25786861777305603,
-0.26314887404... | |
<div id="CodeGrid" class="Grid">
<asp:GridView ID="dgCode" runat="server">
<Columns>
<asp:CommandField SelectImageUrl="~/Images/Select.GIF" | [
-0.14633074402809143,
-0.2877673804759979,
0.2025785744190216,
-0.18005132675170898,
-0.08159189671278,
0.2328128069639206,
-0.15706658363342285,
-0.2757977545261383,
-0.3022630512714386,
-0.7661629319190979,
-0.20722690224647522,
0.39724835753440857,
-0.19528430700302124,
-0.1704978644847... | |
ShowSelectButton="True"
ButtonType="Image" | [
0.020559223368763924,
-0.23742949962615967,
0.3094967007637024,
0.07871333509683609,
-0.1596553474664688,
-0.02173543907701969,
0.4704682230949402,
-0.04434548690915108,
-0.2694745361804962,
-0.32657352089881897,
-0.20172499120235443,
0.3786412477493286,
-0.7024805545806885,
-0.14874510467... | |
CancelText=""
EditText=""
InsertText="" | [
0.07895544171333313,
-0.1936555951833725,
0.28925517201423645,
-0.017917143180966377,
-0.036786194890737534,
-0.21576730906963348,
0.13627995550632477,
0.01046629436314106,
0.07118164002895355,
-0.36845120787620544,
-0.750710666179657,
0.5795307755470276,
-0.7109472751617432,
-0.1659032255... | |
NewText=""
UpdateText="" | [
-0.321801096200943,
-0.24459728598594666,
0.3019813895225525,
0.022647911682724953,
-0.22549861669540405,
-0.20444467663764954,
0.5017491579055786,
0.17485451698303223,
0.19341245293617249,
-0.4962308406829834,
-0.37437132000923157,
0.5417666435241699,
-0.40726011991500854,
-0.168469592928... | |
DeleteImageUrl="~/Images/Delete.GIF"
ShowDeleteButton="True" />
<asp:BoundField DataField="Id" HeaderText="ID" Visible="False" /> | [
-0.022816836833953857,
-0.3557944595813751,
0.3361178934574127,
-0.043691396713256836,
-0.018177516758441925,
0.12287836521863937,
0.4356631636619568,
-0.23329177498817444,
-0.1548207402229309,
-0.3518315553665161,
-0.42981287837028503,
0.5070194005966187,
-0.3031984269618988,
-0.024410013... | |
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
```
This solution is blocking the enter key on the entire page
[Disable Enter Key](http://www.bloggingdeveloper.com/post/Disable-Form-Submit-on-Enter-Key-Press.aspx) | [
0.03937031328678131,
-0.07152841985225677,
0.7613624930381775,
-0.11111017316579819,
-0.10620301961898804,
-0.37225714325904846,
0.5213049650192261,
-0.12049886584281921,
-0.10184315592050552,
-0.6656351089477539,
-0.5320873856544495,
0.276248961687088,
-0.5381086468696594,
0.0358811356127... | |
How can I set points on a 24h period spreaded by the Gaussian distributions? For example to have the peak at 10 o'clock?
The following code generates a gaussian distributed random time (in hours, plus fractions of an hour) centered at a given time, and with a given standard deviation. The random times may 'wrap around'... | [
0.47467586398124695,
-0.17286311089992523,
0.5049929022789001,
-0.16728129982948303,
-0.06406982243061066,
0.07210782915353775,
0.18147805333137512,
-0.11113570630550385,
-0.22853942215442657,
-0.45501941442489624,
0.04601401090621948,
0.3667110204696655,
-0.1894756704568863,
0.26785087585... | |
10-o-clock
$stdev=2; // Standard deviation of two hours
$hoursOnClock=24; // 24-hour clock
do // Generate gaussian variable using Box-Muller
{
$u=2.0*mt_rand()/mt_getrandmax()-1.0;
$v=2.0*mt_rand()/mt_getrandmax()-1.0;
$s = $u*$u+$v*$v;
} while ($s > 1);
$gauss=$u*sqrt(-2.0*log($s)/$s);
$gauss = $gauss*$s... | [
0.1542011797428131,
0.155843585729599,
0.6577045321464539,
-0.31863516569137573,
-0.04783650115132332,
0.49517622590065,
0.33247512578964233,
-0.023920267820358276,
-0.23737624287605286,
-0.44208085536956787,
-0.06802857667207718,
0.5306082963943481,
-0.447820246219635,
0.260429322719574,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.