text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
you just define the various `extern "C"` functions to pass to the desired member functions, like this (this is only one; the rest work similarly)
```
extern "C" void MyClass_foo (MyClass* obj, int i)
{
obj->foo(i);
}
```
The code will then have a C interface, without having to change the C++ code at all (except fo... | [
0.1805308312177658,
0.04934222996234894,
0.26233336329460144,
-0.052472639828920364,
0.026177702471613884,
-0.1631976068019867,
0.35715585947036743,
-0.07416511327028275,
-0.10464596748352051,
-0.6832022070884705,
-0.1860102266073227,
0.6689335703849792,
-0.4009668827056885,
0.200296714901... | |
of course, use `new`/`delete` for this). | [
-0.15667720139026642,
-0.0006775013753212988,
0.19679564237594604,
0.04296831041574478,
0.29641231894493103,
-0.28509843349456787,
0.2893882095813751,
0.11204719543457031,
-0.06011711433529854,
-0.2543134391307831,
-0.5260230302810669,
0.5303887724876404,
-0.020612796768546104,
0.074906878... | |
If I have a `DropDownList` control that makes up part of a CompositeControl how can I expose the `SelectedIndexChanged` event to the consuming aspx page?
Thanks
There is a much simpler way that is a direct pass through.
Try this:
```
public event EventHandler SelectedIndexChanged
{
add { this.TargetC... | [
0.155104860663414,
-0.2523343563079834,
0.023632731288671494,
0.04895566403865814,
-0.04769805073738098,
-0.09315028041601181,
0.20555232465267181,
-0.06249750405550003,
-0.19849543273448944,
-0.6388633847236633,
0.10024340450763702,
0.6415608525276184,
-0.24299024045467377,
-0.01892932504... | |
The following event can possibly get called hundreds of times a frame.
```
public bool OnCollision(Body body1, Body body2)
{
if(body2.Tag is Dog)
((Dog)body2.Tag).Bark();
}
```
I understand that using "is" causes a cast to be made and then when i want to do something with it, cast it a second time. Is there a... | [
0.47974589467048645,
-0.06957976520061493,
0.18198779225349426,
-0.18347331881523132,
-0.08439931273460388,
-0.009801269508898258,
0.5731291174888611,
-0.4526228606700897,
-0.16503392159938812,
-0.5012354850769043,
-0.1402721107006073,
0.3019939363002777,
-0.46476516127586365,
-0.081848561... | |
cast again. Better would be:
```
Dog dog = body2.Tag as Dog;
if (dog != null)
{
dog.Bark();
}
``` | [
0.1611802577972412,
-0.09334727376699448,
0.02657128870487213,
-0.32067713141441345,
-0.04449404403567314,
0.11931367963552475,
0.6576123833656311,
-0.6448094844818115,
-0.1875205934047699,
-0.4460296928882599,
-0.17520689964294434,
0.5103220343589783,
-0.5559062361717224,
-0.1507569253444... | |
Many times when I read books related to CSS I see things like this "this will not work on some browser", "this hack will work for that browser".
Where I can all information that I need to know the hacks for working for all browsers?
thanks
I suggest [Quirksmode](http://www.quirksmode.org/). Very useful resource for... | [
0.5588095784187317,
0.15425550937652588,
-0.07252068817615509,
0.27316203713417053,
-0.1457703709602356,
-0.36925891041755676,
0.34537196159362793,
0.557517945766449,
-0.4846481382846832,
-0.651902973651886,
0.3168119490146637,
0.12808774411678314,
0.07511752843856812,
0.0783671885728836,
... | |
This morning, I tried to commit a revision to Subversion and found that all of a sudden I did not have permission to do so.
```
Can't move '/svn/db/txn-protorevs/21000-ga9.rev' to '/svn/db/revs/21/21001':
Permission Denied
```
Looking at the revs directory, I noticed that somebody had committed the 21000th revision, ... | [
-0.10237745940685272,
0.35473811626434326,
0.6977187395095825,
-0.04057460278272629,
-0.3150827884674072,
-0.3393690884113312,
0.6910704970359802,
-0.24464838206768036,
-0.46779802441596985,
-0.5312963128089905,
-0.047165438532829285,
0.6763838529586792,
-0.24320177733898163,
0.38480064272... | |
2008-12-18 11:18 21
```
Setting the group write permission on that directory allows me to commit, so I'm good for another 1000 revisions. But why does this happen, and what can I change to make sure it doesn't happen again?
If you have more than one developer accessing the repository through the `file://` protocol, y... | [
0.06871654838323593,
0.2755957841873169,
0.78128582239151,
-0.10079970955848694,
-0.3300686776638031,
-0.2668141722679138,
0.6997876763343811,
-0.2432636320590973,
-0.22655218839645386,
-0.33095356822013855,
-0.012148096226155758,
0.4879153072834015,
0.027538545429706573,
0.151846975088119... | |
simple idea of having all of your users access a repository directly via `file://` URLs. Even if the repository is readily available to everyone via a network share, this is a bad idea. It removes any layers of protection between the users and the repository: users can accidentally (or intentionally) corrupt the reposi... | [
0.4793882369995117,
-0.11492353677749634,
0.07639991492033005,
0.3489985167980194,
0.0389069989323616,
-0.6085397601127625,
0.4073992073535919,
-0.07320933043956757,
-0.5515667200088501,
-0.652039647102356,
-0.20069973170757294,
0.45674577355384827,
-0.18011052906513214,
0.2815029621124267... | |
via `svn+ssh://` URLs—from a security standpoint, it's effectively the same as local users accessing via `file://`, and it can entail all the same problems if the administrator isn't careful. | [
0.38577646017074585,
0.11661741882562637,
0.46066978573799133,
0.14945372939109802,
-0.07923156768083572,
-0.6733638644218445,
0.5274222493171692,
0.19882528483867645,
-0.3914411962032318,
-0.7612060904502869,
-0.4173457622528076,
0.46388593316078186,
-0.2515626549720764,
0.556560575962066... | |
When writing an abstract class, or a class that doesn't get instantiated directly... do you tend to write a dealloc method in the abstract class and release where appropriate, and then allow for children to call [super dealloc] and then worry about only instance variables they add which aren't part of the super class?
... | [
-0.03432871028780937,
-0.06795089691877365,
0.23372508585453033,
-0.3546355664730072,
-0.030196135863661766,
-0.33685439825057983,
-0.061322372406721115,
-0.33482375741004944,
-0.4136626422405243,
-0.37348300218582153,
-0.18391501903533936,
0.4732164442539215,
-0.700755774974823,
-0.087697... | |
ClassB
- (void) dealloc {
[bar release];
[super dealloc];
}
@end
```
Please pardon any syntactical errors, I just wrote this up on the fly. Does the above make sense or should memory be managed differently? GC isn't an option as I'm doing this on the iPhone.
Yes, you take responsibility for yourself, not for ... | [
0.08300791680812836,
0.043391428887844086,
0.11390873789787292,
-0.3368370831012726,
0.053607068955898285,
-0.30699294805526733,
0.26266947388648987,
0.06390821188688278,
-0.26320257782936096,
-0.3227137327194214,
-0.39560186862945557,
0.6460238695144653,
-0.6069086194038391,
-0.0890939980... | |
I need to do a number of network-related things in C++ that I would normally do with `ifconfig` in Linux, but I'd like to do it without parsing the output of a group of system calls. Which C or C++ libraries can I use to tell if a network adapter is up or down, read or change an adapter's IP address and netmask, and ch... | [
0.5271710753440857,
-0.07627769559621811,
0.0048496960662305355,
0.3885558247566223,
-0.12906217575073242,
-0.39818888902664185,
-0.20500324666500092,
-0.12950918078422546,
-0.06685996800661087,
-0.7032033205032349,
0.08675538748502731,
0.7428480982780457,
-0.2732897102832794,
-0.046082273... | |
other links that might be helpful:
* [Network Interface operations on AIX](http://www.ibm.com/developerworks/aix/library/au-ioctl-socket.html)
* [XBMC's implementation](http://xbmc.org/trac/browser/branches/linuxport/XBMC/xbmc/linux/NetworkLinux.cpp) (check out CNetworkInterfaceLinux)
EDIT: Let me also add that if yo... | [
0.209074467420578,
0.0030705404933542013,
0.1957084834575653,
0.16398200392723083,
-0.35843563079833984,
-0.04312021657824516,
0.21234972774982452,
0.22114330530166626,
-0.3968103229999542,
-0.8969339728355408,
-0.19793112576007843,
0.2925286293029785,
-0.3471614420413971,
0.31041631102561... | |
`CGI.escapeHTML` is pretty bad, but `CGI.unescapeHTML` is completely borked. For example:
```
require 'cgi'
CGI.unescapeHTML('…')
# => "…" # correct - an ellipsis
CGI.unescapeHTML('…')
# => "…" # should be "…"
CGI.unescapeHTML('¢')
# => "\242" ... | [
-0.4584887623786926,
0.19188764691352844,
0.721138060092926,
0.015724722295999527,
0.0969199612736702,
0.06957376003265381,
0.46609389781951904,
-0.09138173609972,
-0.20849370956420898,
-0.5132899880409241,
-0.6622728109359741,
0.35384872555732727,
-0.5199251174926758,
0.03426153585314751,... | |
"…" # should be "…"
```
It appears that `unescapeHTML` knows about all of the numeric codes plus `&`, `<`, `>`, and `"`. And `escapeHTML` only knows about those last four -- it doesn't do any of the numeric codes. I understand that escaping doesn't generally need to be as robus... | [
-0.2740366458892822,
0.051004648208618164,
0.4150567948818207,
0.1296408325433731,
-0.1715669482946396,
-0.03361125662922859,
0.7213039398193359,
-0.06862947344779968,
-0.3780897557735443,
-0.3266405463218689,
-0.5347017645835876,
0.562202513217926,
-0.44356465339660645,
-0.151264891028404... | |
unescaping?
The htmlentities gem should do the trick:
```
require 'rubygems'
require 'htmlentities'
coder = HTMLEntities.new
coder.decode('…') # => "…"
coder.decode('…') # => "…"
coder.decode('¢') # => "¢"
coder.decode('¢') # => "¢"
coder.encode("…", :named) # => "…"
coder.encode("…", :... | [
0.10771088302135468,
-0.09845069795846939,
0.41816410422325134,
0.20153333246707916,
-0.012388873845338821,
0.04367071017622948,
0.3441182076931,
-0.2315618097782135,
-0.27982109785079956,
-0.6367703676223755,
-0.3213765323162079,
0.7040319442749023,
-0.568864643573761,
-0.2328796088695526... | |
I need to update a field (which is currently empty) based on a match with another table. This should be simple, but my syntax is wrong.
In SQLServer 2005, the syntax would be
```
UPDATE Facilities-NOID
SET Facilities-NOID.ID = Facilities-ID.ID
FROM Facilities-NOID, Facilities-ID
WHERE [Facilities-ID].[Structure ID] ... | [
-0.22359652817249298,
0.2681005895137787,
0.5344681143760681,
-0.2470708191394806,
-0.2785525619983673,
-0.18018631637096405,
0.08103104680776596,
-0.23064836859703064,
-0.29120489954948425,
-0.7053549885749817,
-0.30453363060951233,
0.5470051169395447,
-0.5406602621078491,
0.0837055072188... | |
Facilities-NOID based on a match on Structure ID occurring in Facilities-ID. | [
-0.026052508503198624,
-0.11339463293552399,
0.17823266983032227,
0.31281158328056335,
0.14151166379451752,
-0.2512473464012146,
-0.2397620677947998,
-0.11904983967542648,
-0.11940708756446838,
-0.9442258477210999,
-0.27988916635513306,
0.04381059482693672,
-0.10960499942302704,
0.07637091... | |
I need to convert a name in the format Parisi, Kenneth into the format kparisi.
Does anyone know how to do this in Perl?
Here is some sample data that is abnormal:
Zelleb, Charles F.,,IV
Eilt, John,, IV
Wods, Charles R.,,III
Welkt, Craig P.,,Jr.
These specific names should end up as czelleb, jeilt, cwo... | [
0.3848077058792114,
0.5068857073783875,
0.37018147110939026,
0.17711956799030304,
0.014318859204649925,
0.0497603565454483,
0.39120039343833923,
-0.009389308281242847,
-0.17987163364887238,
-0.4105757176876068,
-0.0037041136529296637,
0.18305529654026031,
-0.270699143409729,
0.296254098415... | |
damned below judas if i cant get that o between the p and the n
```
vinko@parrot:~$ cat genlogname.pl
```
```
use strict;
use warnings;
my @list;
push @list, "Zelleb, Charles F.,,IV";
push @list, "Eilt, John,, IV";
push @list, "Woods, Charles R.,,III";
push @list, "Welkt, Craig P.,,Jr.";
for my $name (@list) {
... | [
0.21287517249584198,
0.4501979947090149,
0.5295971035957336,
-0.3179187476634979,
0.013435610570013523,
0.26421481370925903,
0.7330780625343323,
-0.3762378394603729,
-0.17971393465995789,
-0.34959256649017334,
-0.002707693725824356,
0.7710360288619995,
-0.30941495299339294,
0.1953564435243... | |
space (the
#optional space is my addition) and the first char of the name,
#which seems to satisfy your condition
$n =~ m/(\w+), ?(.)/;
return lc($2.$1);
}
```
```
vinko@parrot:~$ perl genlogname.pl
czelleb
jeilt
cwoods
cwelkt
``` | [
-0.04788246005773544,
0.01876562274992466,
0.5766633152961731,
-0.07146871089935303,
0.5202814936637878,
0.24170279502868652,
0.1785646378993988,
-0.05200420692563057,
-0.13785476982593536,
-0.39516207575798035,
-0.41214901208877563,
0.6623190641403198,
-0.09138905256986618,
0.266640365123... | |
Consider the following example. It consists of two header files, declaring two different namespaces:
```
// a1.h
#pragma once
#include "a2.h"
namespace a1
{
const int x = 10;
typedef a2::C B;
}
```
and the second one is
```
// a2.h
#pragma once
#include "a1.h"
namespace a2 {
class C {
public:
... | [
-0.0345035195350647,
0.16792833805084229,
0.14127564430236816,
-0.2264203429222107,
0.003458610503003001,
0.33006754517555237,
0.001208615256473422,
-0.2973906099796295,
-0.3954664170742035,
-0.262046217918396,
-0.219680517911911,
0.28869733214378357,
-0.39685720205307007,
0.14196705818176... | |
is that `a1` namespaces is not declared (C2653 on Windows). If you change include order in `main.cpp` this way:
```
#include "a2.h"
#include "a1.h"
```
you get a symmetric error message, i.e. `a2` namespace is not declared.
What's the problem?
You need to use a forward declaration in your header files because you h... | [
-0.18003235757350922,
0.25331783294677734,
0.07346449792385101,
-0.15661734342575073,
-0.04557107016444206,
0.008327201008796692,
0.21398641169071198,
-0.27749547362327576,
-0.7393873333930969,
-0.2153700292110443,
-0.14492319524288177,
0.20604416728019714,
-0.43070369958877563,
0.42251282... | |
We have a bunch of VB6 applications that access two different database servers (both 32-bit windows 2003, one SQL Server 2000, one SQL Server 2005). About every ten minutes or so, we are getting a few errors:
> [Microsoft][ODBC SQL Server Driver]Timeout expired
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server... | [
0.30157047510147095,
0.18182602524757385,
0.29237890243530273,
0.35085588693618774,
0.005162553396075964,
-0.24586893618106842,
0.443529337644577,
0.19417136907577515,
-0.492916077375412,
-0.31683826446533203,
0.2452981024980545,
0.5862206220626831,
-0.28618982434272766,
0.4774997532367706... | |
they were getting, but VNC still continues to work. Email also works. It just seems to be an ODBC connection to SQL Server that causes the issue. The errors happen for both of our SQL Servers. We have scoured google, but haven't been able to come up with a solution. Is there anything we can try to diagnose the problem?... | [
0.3791426122188568,
0.24095669388771057,
0.4517194926738739,
0.4702907204627991,
-0.019429218024015427,
-0.11161760985851288,
0.4997078776359558,
0.29249733686447144,
-0.4104444980621338,
-0.47783586382865906,
0.1464310884475708,
0.5772483944892883,
-0.22180455923080444,
0.1116946861147880... | |
other doesn't.
The strange thing is that it has worked fine for years and now all of a sudden these errors are happening. Nothing has changed on those servers for quite some time. That leads us to beleive it is a bad switch, but that seems unlikely since nothing else (email, phones, vnc, file server, etc) all work wit... | [
0.1753460317850113,
-0.10270202159881592,
0.2320350855588913,
0.4350689649581909,
0.24337144196033478,
-0.22178508341312408,
0.12376736104488373,
0.5350690484046936,
-0.1655280739068985,
-0.4879715144634247,
0.5314328074455261,
0.6825506687164307,
-0.18155081570148468,
0.37974247336387634,... | |
I'm having a little bit of trouble understanding what the problem is here. I have a bit of code that pulls records from a database using LINQ and puts them into an object which is cast into an interface. It looks a bit like this:
```
public IEnumerable<ISomeObject> query()
{
return from a in dc.SomeTable
... | [
0.4594152867794037,
-0.018708670511841774,
0.1936933994293213,
0.170859232544899,
0.05333520099520683,
-0.2929644286632538,
-0.16181866824626923,
0.007442689500749111,
-0.23776784539222717,
-0.6130203008651733,
0.16161873936653137,
0.3792980909347534,
-0.29703548550605774,
0.51546865701675... | |
} as ISomeObject;
}
```
When I test this, I put the returned IEnumerable into a variable called results and run this line:
```
Assert.AreEqual(EXPECTED_COUNT, results.Count());
```
When this is run, I get a System.Security.VerificationException: "Operation could destabilize the runtime."
I found the solution [her... | [
0.13136431574821472,
-0.07960664480924606,
0.29509496688842773,
-0.2346639782190323,
0.05127215012907982,
-0.06405624747276306,
0.39473608136177063,
-0.47385817766189575,
-0.034864816814661026,
-0.3770013749599457,
-0.11865253746509552,
0.5159117579460144,
-0.3809206783771515,
0.0256304610... | |
} as ISomeTable;
return results.OfType<ISomeObject>();
```
This works, but I'm having trouble understanding what's happening here. Why did I get the exception in the first place and how did the lines of code above fix it? The MSDN documentation seems to suggest that this is an issue of type safety, but I'm not seeing... | [
-0.12416340410709381,
0.00801574345678091,
0.11681555956602097,
0.09157063066959381,
0.03957976773381233,
-0.054556284099817276,
0.3472656011581421,
-0.02202688157558441,
-0.14508070051670074,
-0.7652574181556702,
-0.14485302567481995,
0.627016007900238,
-0.4318544268608093,
0.102342233061... | |
but I'm still confused about the *why*. Why didn't the compiler force me to cast the IEnumerable into an IQueryable?
I believe it is an issue of covariance or contravariance as noted by [this forum post](http://www.manning-sandbox.com/message.jspa?messageID=77137#77137).
See [Covariance and Contravariance in C#, Part ... | [
-0.012294823303818703,
0.10249070823192596,
0.16648180782794952,
-0.05058615282177925,
-0.3528328239917755,
-0.19359514117240906,
0.0866038054227829,
-0.3962394595146179,
-0.31622445583343506,
-0.1662210375070572,
-0.07033589482307434,
0.6831425428390503,
-0.27437451481819153,
0.0054915724... | |
could put a Turtle into an Animals IEnumerable when that IEnumerable can only contain Giraffes). I think the reason it works when you return `IQueryable` is because that is *larger/wider* than anything you could return, so you're guaranteed that what you return you will be able to handle(?).
In the second example, [Of... | [
0.045521657913923264,
-0.16378511488437653,
-0.36649468541145325,
0.16764351725578308,
0.3503592610359192,
-0.01908600702881813,
-0.0037443460896611214,
-0.37488245964050293,
-0.37281733751296997,
-0.4848027527332306,
-0.16843196749687195,
0.4699522852897644,
-0.19995734095573425,
0.041502... | |
Functions Hurt My Brain](http://blogs.msdn.com/ericlippert/archive/2007/10/24/covariance-and-contravariance-in-c-part-five-higher-order-functions-hurt-my-brain.aspx) and I am having trouble expressing precisely why this is a co/contravariant issue. | [
-0.22612108290195465,
0.18238840997219086,
0.39755702018737793,
-0.10433316975831985,
-0.15420649945735931,
0.06502123177051544,
0.1999286711215973,
-0.2103201299905777,
-0.19244369864463806,
-0.13032403588294983,
0.12560352683067322,
0.8102390766143799,
-0.10123756527900696,
0.02376605942... | |
I have to ship some groovy code to some users that have only java installed (no grooy, no $groovy\_home, etc). I'm trying to invoke groovy from the commandline but I'm having no luck. Here's my bat file:
```
java -classpath .;lib;bin;bin-groovy introspector.AclCollector
```
And here's my exception:
```
Exception in... | [
-0.30209556221961975,
0.12230519950389862,
0.5564096570014954,
-0.13086622953414917,
-0.017440591007471085,
0.3070314824581146,
0.34490567445755005,
-0.02435755357146263,
-0.3748759329319,
-0.6645605564117432,
-0.10904473811388016,
0.5021953582763672,
-0.492515504360199,
0.2382617741823196... | |
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Lau... | [
-0.4233551025390625,
-0.023998577147722244,
0.16417907178401947,
-0.19088923931121826,
-0.10812994092702866,
0.11642835289239883,
0.6526343822479248,
-0.14410759508609772,
-0.5040192008018494,
-0.6318144202232361,
-0.4033099412918091,
0.3923785984516144,
-0.5557590126991272,
0.079011037945... | |
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 12 more
Could not find the main class: introspector.AclCollector. Program will exit.
```
Does anyone h... | [
0.030930262058973312,
0.10596317797899246,
0.13333559036254883,
0.06558336317539215,
-0.005862402264028788,
0.08802630752325058,
0.4679250717163086,
0.1726769655942917,
-0.3419661223888397,
-0.4808667302131653,
-0.07498472929000854,
0.6469510793685913,
-0.5962595343589783,
0.08886536955833... | |
I need to know if a variable in Python is a string or a dict. Is there anything wrong with the following code?
```
if type(x) == type(str()):
do_something_with_a_string(x)
elif type(x) == type(dict()):
do_somethting_with_a_dict(x)
else:
raise ValueError
```
**Update**: I accepted avisser's answer (though... | [
0.34560513496398926,
0.08974814414978027,
0.11848651617765427,
-0.14632819592952728,
-0.23849214613437653,
-0.26637953519821167,
0.3368685841560364,
-0.2606305778026581,
0.00808119960129261,
-0.3919704258441925,
-0.0038279446307569742,
0.5474423766136169,
-0.4363749921321869,
0.02949398569... | |
it in a list. If it's a dict, I need a list of the unique values. Here's what I came up with:
```
def value_list(x):
cases = {str: lambda t: [t],
dict: lambda t: list(set(t.values()))}
try:
return cases[type(x)](x)
except KeyError:
return None
```
If `isinstance` is preferred... | [
-0.07628224045038223,
-0.09897138178348541,
0.19822947680950165,
-0.1486978381872177,
-0.1243290975689888,
-0.0077011846005916595,
0.07956700772047043,
-0.42863136529922485,
-0.11764693260192871,
-0.3716520071029663,
-0.2874683141708374,
0.4780540466308594,
-0.4791707694530487,
-0.10685935... | |
dict? Or a class implementing a dict-like interface? Following code covers first two cases. If you are using Python 2.6 you might want to use [`collections.Mapping`](https://docs.python.org/2/library/collections.html#collections.Mapping) instead of `dict` as per the [ABC PEP](http://www.python.org/dev/peps/pep-3119/).
... | [
0.10256998986005783,
-0.18975187838077545,
0.23859283328056335,
-0.20072712004184723,
-0.3569919764995575,
0.09675033390522003,
0.09633966535329819,
-0.3684879541397095,
0.04760042950510979,
-0.5128996968269348,
-0.3417983651161194,
0.7604416608810425,
-0.6079390645027161,
-0.2792808115482... | |
There is someone in my team that swears by using some kind of GVim feature to do manually code folding.
As I'm using another editor and do not really need the folding feature, I think it only pollutes the source code with tags like:
```
/* {{{1 */
```
Convincing the person not to use this folding is not an option (... | [
0.45123282074928284,
0.2794051170349121,
0.09302252531051636,
-0.020877176895737648,
-0.3358166515827179,
-0.45220625400543213,
0.4916442334651947,
0.23298369348049164,
0.013240756466984749,
-0.6907996535301208,
0.25574055314064026,
0.5084686875343323,
-0.32269325852394104,
0.1113636791706... | |
smart folding that takes the syntax of the programming language into account without changing the source code?
It only took a Google for "vim folding" to [discover](http://www.vim.org/htmldoc/fold.html) that Vim supports six fold methods.
`syntax`, `indent` and `diff` all mean that the user has little control over whe... | [
0.11298719048500061,
-0.053606268018484116,
0.29799678921699524,
0.04048657789826393,
-0.03218812867999077,
-0.0798288881778717,
0.13690625131130219,
-0.4444528818130493,
-0.06199954077601433,
-0.6680752635002136,
0.11300071328878403,
0.4437706172466278,
-0.30958178639411926,
-0.2962699532... | |
`set foldmethod=manual` combined with `:mkview` and `:loadview` would do the trick. | [
0.1349264234304428,
-0.6830164790153503,
0.2850904166698456,
-0.039750661700963974,
-0.35544300079345703,
-0.34939044713974,
0.03009575977921486,
-0.4026486277580261,
0.050680313259363174,
-0.42808225750923157,
-0.5571234226226807,
0.8839577436447144,
-0.2829482853412628,
-0.41363808512687... | |
Can I do something like this in the markup of an asp.net page, based off the "Define DEBUG constant" setting?
```
#IF (DEBUG) THEN
<asp:TextBox ID="TextBox1" runat="server">You're in debug mode</asp:TextBox>
#END IF
```
The close as I can get is:
```
<asp:Literal id="isDebug" runat="server" />
<script runat="serve... | [
0.05861443281173706,
-0.08917763084173203,
0.3939063847064972,
-0.2007693648338318,
-0.013501311652362347,
-0.3456091284751892,
0.5475453734397888,
-0.23953230679035187,
-0.1721782684326172,
-0.8423228859901428,
-0.24519594013690948,
0.35543882846832275,
-0.3180289566516876,
0.030605534091... | |
do this, I would encapuslate the above code into a user control and include that control in the pages of interest.
My test user control looks like this:
```
<%@ Control Language="C#" AutoEventWireup="true" %>
<asp:Literal id="isDebug" runat="server" />
<script runat="server">
void Page_Load()
{
#if D... | [
-0.025809478014707565,
0.05580795928835869,
0.48206624388694763,
-0.13849717378616333,
0.25066113471984863,
-0.376492440700531,
0.3626875877380371,
-0.17871105670928955,
0.03920093923807144,
-0.6503192186355591,
-0.06392446905374527,
0.4691464900970459,
-0.42856940627098083,
-0.07840334624... | |
Your basic SP with a default parameter:
```
ALTER PROCEDURE [usp_debug_fails]
@DATA_DT_ID AS int = 20081130
WITH RECOMPILE
AS
BEGIN
/*
Usage:
EXEC [usp_debug_fails] WITH RECOMPILE
*/
-- Stuff here that depends on DATA_DT_ID
END
```
The same SP with a local that is hardcoded.
```
ALTE... | [
-0.4792112708091736,
-0.1490403115749359,
0.5466558933258057,
0.07302383333444595,
-0.008655400015413761,
-0.12042898684740067,
0.4590941071510315,
-0.6472752690315247,
-0.16317707300186157,
-0.6362529993057251,
-0.3685359060764313,
0.6572086215019226,
-0.29288250207901,
-0.251826375722885... | |
SET @DATA_DT_ID = 20081130
-- Stuff here that depends on DATA_DT_ID
END
```
You can see where I put in the (redundant, even) `WITH RECOMPILE` options in order to avoid parameter sniffing (this was never necessary in development where this thing worked fine)
The one that works completes fine in a minute or two, t... | [
0.7999062538146973,
-0.01145387627184391,
0.7649093270301819,
-0.003024573437869549,
0.0044629815965890884,
-0.13326068222522736,
0.31477490067481995,
-0.22551262378692627,
-0.1694847196340561,
-0.7646576762199402,
0.11920426040887833,
0.74360591173172,
-0.2639436721801758,
0.0546028204262... | |
exhibits the problem, and have been very careful to keep both versions of the SP the same except for that one parameter.
I have plenty of other SPs which take parameters and they do run fine. I've also `DROP`ped and re`CREATE`ed the SPs.
Any ideas?
And yes, I have a DBA looking at it and I do not have SHOWPLAN or an... | [
0.17407400906085968,
0.3047080934047699,
0.3153276741504669,
0.01297943014651537,
-0.05181673541665077,
-0.22467158734798431,
0.26518386602401733,
-0.001954619539901614,
-0.47803422808647156,
-0.33101633191108704,
0.11301258206367493,
0.45921725034713745,
-0.3215391933917999,
-0.0202541928... | |
issue about this, so until I figure it out or the DBA figures it out, I'm kind of stuck.
**UPDATE**
This also fails to complete (this is actually the normal form for these SPs - I just put a default in to make it easier to switch back and forth during testing)
```
ALTER PROCEDURE [usp_debug_fails]
@DATA_DT_ID AS... | [
-0.06752856075763702,
0.2544805407524109,
0.5738512277603149,
-0.167338564991951,
0.04535502940416336,
-0.18645547330379486,
0.7119037508964539,
-0.35090577602386475,
-0.40723884105682373,
-0.5305103063583374,
-0.17168663442134857,
0.6007667779922485,
-0.07857689261436462,
0.08312077075242... | |
(which may work as a workaround, although I have about 25 of these SPs to modify which all have the same form):
```
ALTER PROCEDURE [usp_debug_fails]
@DATA_DT_ID_in AS int
WITH RECOMPILE
AS
BEGIN
/*
Usage:
EXEC [usp_debug_fails] 20081130 WITH RECOMPILE
*/
DECLARE @DATA_DT_ID AS int
... | [
-0.15408571064472198,
0.061812762171030045,
0.3705480098724365,
-0.034621816128492355,
-0.0028620176017284393,
-0.15094205737113953,
0.5564495921134949,
-0.5277916193008423,
-0.4114851653575897,
-0.4221232235431671,
-0.47281721234321594,
0.7396270632743835,
-0.23212727904319763,
-0.0501139... | |
sent on first call) being sniffed at compile time. So, recompile has no effect.
I've seen huge difference between estimated plans simply by changing the default from say, zero to NULL, or not having one.
```
ALTER PROCEDURE [usp_debug_mightwork]
@DATA_DT_ID AS int = 20081130
AS
BEGIN
DECLARE @IDATA_DT_ID AS i... | [
0.1756652146577835,
-0.2666374146938324,
0.3483138680458069,
-0.048180434852838516,
-0.43323007225990295,
-0.359212189912796,
0.32746073603630066,
-0.7943601012229919,
0.1702813357114792,
-0.5095778703689575,
0.0702914223074913,
0.6349449753761292,
-0.47476422786712646,
0.00892990548163652... | |
RECOMPILE option specified on
> the GetRecentSales stored procedure
> above does not eliminate the
> cardinality estimation error
[Kind of related article about constants and plans](http://www.sqlskills.com/BLOGS/CONOR/post/Contradictions-within-Contradictions.aspx) | [
-0.22748394310474396,
-0.4875820577144623,
0.15711063146591187,
0.4161596894264221,
0.13583628833293915,
0.1527489572763443,
0.3251996338367462,
-0.35082921385765076,
-0.3893791735172272,
-0.195861354470253,
-0.33599555492401123,
0.6411232948303223,
-0.2649516761302948,
0.13722586631774902... | |
I know that having diamond inheritance is considered bad practice. However, I have 2 cases in which I feel that diamond inheritance could fit very nicely. I want to ask, would you recommend me to use diamond inheritance in these cases, or is there another design that could be better.
**Case 1:** I want to create class... | [
0.32812023162841797,
-0.3003634810447693,
-0.5512465238571167,
0.17906151711940765,
-0.1590404063463211,
0.16911113262176514,
0.23393170535564423,
-0.2977820336818695,
-0.3044617176055908,
-0.46604153513908386,
0.026760177686810493,
0.5745079517364502,
-0.2441283017396927,
-0.0593430846929... | |
The action's "flow type" can be FlowA or FlowB.
I intend to have the following design:
```
// abstract classes
class Action
{
// methods relevant for all actions
};
class ActionRead : public virtual Action
{
// methods related to reading
};
class ActionWrite : public virtual Action
{
// met... | [
-0.10875562578439713,
-0.42288485169410706,
0.41611915826797485,
-0.032344501465559006,
-0.07123658806085587,
0.5140868425369263,
0.2847990095615387,
-0.13791394233703613,
-0.3383612334728241,
-0.38321906328201294,
-0.2353072464466095,
0.41543811559677124,
-0.37128379940986633,
-0.20889519... | |
: public virtual Action {/*...*/};
class ActionFlowB : public virtual Action {/*...*/};
// concrete classes
class ActionFlowAReadWithDelay : public ActionFlowA, public ActionRead, public ActionWithDelay
{
// implementation of the full flow of a read command with delay that does Flow A.
};
class ActionFlow... | [
-0.039036959409713745,
-0.10487505793571472,
0.2388128787279129,
-0.21998757123947144,
-0.0744156613945961,
0.4894252121448517,
0.39572492241859436,
-0.2896129786968231,
-0.33045899868011475,
-0.4762834906578064,
-0.03223834186792374,
0.4206773042678833,
-0.31700530648231506,
-0.0651059448... | |
want to have a sequence of commands, which can also be read, written, deleted, etc. A sequence of commands can contain other sequences of commands.
So I have the following design:
```
class CommandAbstraction
{
CommandAbstraction(){};
~CommandAbstraction()=0;
void Read()=0;
void Write()=0;
void R... | [
0.11368709802627563,
-0.14143340289592743,
0.3705940842628479,
-0.26715484261512756,
0.2647849917411804,
0.38000693917274475,
0.1024346798658371,
-0.22926536202430725,
-0.11073482036590576,
-0.5591233372688293,
-0.04316970333456993,
0.7779066562652588,
-0.3163115680217743,
0.14406889677047... | |
kind of commands, "Modern" commands. Both one command and composite command can be modern. Being "Modern" adds a certain list of properties to one command and composite command (mostly same properties for both of them). I want to be able to hold a pointer to CommandAbstraction, and initialize it (via new) according to ... | [
0.3043718636035919,
-0.29619917273521423,
0.6187857985496521,
-0.06044516712427139,
0.39248761534690857,
0.06679508835077286,
0.12652447819709778,
-0.3727334141731262,
-0.0757623165845871,
-0.7148508429527283,
-0.001653075683861971,
0.8149318099021912,
-0.14218971133232117,
0.4714647829532... | |
public ModernCommand
{
void ModernSomethingElse() {/*...*/};
// ... few methods specific for OneModernCommand
};
class CompositeModernCommand : public CompositeCommand, public ModernCommand
{
void ModernSomethingElse() {/*...*/};
// ... few methods specific for CompositeModernCommand
};
```
Again, I w... | [
0.048512041568756104,
-0.0739225521683693,
0.34051236510276794,
-0.08762039989233017,
0.11803501099348068,
-0.04385773837566376,
0.10447835177183151,
-0.2571321427822113,
-0.04831207916140556,
-0.5626788139343262,
0.019583551213145256,
0.6137025952339172,
-0.2284495085477829,
0.30897188186... | |
from the base. Is it due to implementation or just an interface? Will you want to use any element of the hierarchy as a base element? Or are just leaves in your hierarchy that are real Action's? If only leaves are actions and you are adding behavior you can consider Policy based design for this type of composition of b... | [
0.26596009731292725,
-0.5558029413223267,
-0.13860946893692017,
0.2250979095697403,
-0.13912630081176758,
0.14698287844657898,
-0.010028157383203506,
-0.32892659306526184,
-0.3355075716972351,
-0.3873613774776459,
0.06411513686180115,
0.47231608629226685,
-0.5562437772750854,
0.00646893586... | |
be executed now or in the future, and the command to execute.
I provide an abstract class so that different instantiations of the template can be stored (through pointers) in a container or passed to functions as arguments and get called polymorphically.
```
class ActionDelayPolicy_NoWait;
class ActionBase // Only ... | [
0.5646806359291077,
-0.6033236384391785,
0.22438308596611023,
-0.2134157121181488,
0.47217243909835815,
0.2737583518028259,
0.12023473531007767,
-0.3157202899456024,
-0.40468382835388184,
-0.40922895073890686,
-0.1758592575788498,
0.5074906945228577,
-0.45373862981796265,
0.074537344276905... | |
Command::execute(); // inherit command to execute
}
};
// Real executed code can be written once (for each action to execute)
class CommandSalute
{
public:
void execute() { std::cout << "Hi!" << std::endl; }
};
class CommandSmile
{
public:
void execute() { std::cout << ":)" << std::endl; }
};
// And waitin... | [
0.2016228288412094,
-0.6194744110107422,
0.34388506412506104,
-0.16687951982021332,
0.26375898718833923,
0.2902646064758301,
0.22907701134681702,
-0.4623720943927765,
-0.5644372701644897,
-0.16351695358753204,
-0.16304093599319458,
0.6101025342941284,
-0.29541704058647156,
-0.1413996517658... | |
{ sleep( seconds_ ); }
void wait_period( int seconds ) { seconds_ = seconds; }
int wait_period() const { return seconds_; }
private:
int seconds_;
};
// Polimorphically execute the action
void execute_action( Action& action )
{
action.run();
}
// Now the usage:
int main()
{
Action< CommandSalute > salu... | [
0.2537623345851898,
-0.3232422471046448,
0.49650588631629944,
-0.4324086904525757,
0.3499409258365631,
0.40210267901420593,
0.004205349367111921,
-0.35979512333869934,
-0.4286862909793854,
-0.46247708797454834,
-0.43553608655929565,
0.6521033644676208,
-0.06763602793216705,
0.1265628188848... | |
the use of aggregation for combining the policies as no new function members could be pushed into the class interface. In the example, the template depends on the policy having a wait() method, which is common to all waiting policies. Now waiting for a time period needs a fixed period time that is set through the perio... | [
0.03150824084877968,
-0.6208788752555847,
0.11252401024103165,
0.024378834292292595,
0.18837963044643402,
0.10810986161231995,
0.06626259535551071,
-0.2954508066177368,
-0.5447725653648376,
-0.4674534797668457,
0.125637948513031,
-0.04751579463481903,
-0.20898066461086273,
0.39029523730278... | |
be waiting on a number of milliseconds, clock ticks, or until some external event, by providing a class that registers as a callback for the given event.
If you don't need polymorphism you can take out from the example the base class and the virtual methods altogether. While this may seem overly complex for the curren... | [
0.49373483657836914,
-0.7387022376060486,
-0.10332266986370087,
0.25940102338790894,
0.07176641374826431,
-0.15788638591766357,
0.1298438161611557,
-0.2872830927371979,
-0.1621522754430771,
-0.44559890031814575,
-0.038741737604141235,
0.5819598436355591,
-0.4951933026313782,
-0.15258392691... | |
glue it together in the Action template.
For example, you could make your action periodic and add an exit policy that determine when to exit the periodic loop. First options that come to mind are LoopPolicy\_NRuns and LoopPolicy\_TimeSpan, LoopPolicy\_Until. This policy method ( exit() in my case ) is called once for ... | [
-0.00512493122369051,
-0.4445427656173706,
0.5009220838546753,
-0.15337726473808289,
0.15515713393688202,
0.2186540812253952,
0.1284746676683426,
-0.3339090049266815,
-0.48019930720329285,
-0.6082948446273804,
0.014619256369769573,
0.2814638614654541,
-0.47898373007774353,
-0.0736974030733... | |
will run this process until a given time (clock).
If you are still following me up to here, I would indeed make some changes. The first one is that instead of using a template parameter Command that implements a method execute() I would use functors and probably a templated constructor that takes the command to execut... | [
0.2664620876312256,
-0.1855229288339615,
0.31530964374542236,
0.11810985207557678,
0.010224622674286366,
-0.030903255566954613,
0.146047443151474,
-0.26723915338516235,
-0.256656676530838,
-0.4995584189891815,
0.10685756057500839,
0.7191062569618225,
-0.3281930088996887,
0.0478447787463665... | |
class.
Now I have to go, but if you are interested I can try posting a modified version. | [
0.3825865387916565,
-0.19704794883728027,
-0.05195966362953186,
0.5064390897750854,
0.09434942901134491,
-0.803749680519104,
0.40502798557281494,
0.7918210029602051,
0.1803676038980484,
-0.3997686207294464,
0.2852137088775635,
0.12580446898937225,
0.11644585430622101,
0.07328539341688156,
... | |
I am working on a software development project that uses code written primarily in C and C#. Currently, the responsibility of testing falls mostly on developers as they change the code.
I am interested in implementing an automated testing framework to help us improve the quality of our code. In particular, it would b... | [
0.8660178780555725,
0.5531414151191711,
-0.3829648792743683,
0.0756383091211319,
0.1284496933221817,
-0.024442417547106743,
0.19699746370315552,
0.11572343111038208,
-0.006709772627800703,
-0.5702923536300659,
0.02164047211408615,
0.7535083293914795,
0.10590748488903046,
0.1136778667569160... | |
some hurdles we would face to implement it company-wide and on a rather large existing code base?
In particular, I have been looking at how [Gallio](http://www.gallio.org/) might be used. Any comments on this particular product would be appreciated.
**Additional Information**:
[Adding unit tests to an existing proje... | [
0.6986021399497986,
-0.15259259939193726,
0.08733415603637695,
0.226581409573555,
-0.25314223766326904,
-0.172337606549263,
0.5174687504768372,
-0.45636624097824097,
-0.3010236620903015,
-0.5890064239501953,
0.0064783357083797455,
0.4172586500644684,
0.3207482397556305,
-0.1369197964668274... | |
I've got a grid (dojox.grid v1.2) that I don't want to be sortable. How can I disable that?
Found it:
<http://dojotoolkit.org/forum/dojox-dojox/dojox-grid-support/disable-sorting-specific-column-0>
To save linking:
In your onload, or postrender add code like this:
`dojo.byId('myGridId').canSort = function(col){
if... | [
0.12582188844680786,
0.1221042275428772,
0.4496200978755951,
-0.17984244227409363,
0.07734407484531403,
-0.08369726687669754,
0.2669731080532074,
-0.07481233775615692,
-0.2786235809326172,
-0.9489450454711914,
0.17171718180179596,
0.17583049833774567,
-0.3499898910522461,
0.064901836216449... | |
I just started with the WCF REST Starter Kit.
I created a simple service that return an array of an object.
Using the browser, everything works fine but when I use a WCF client, I get an ArgumentException.
I'm not using IIS and here is the code:
**The contract:**
```
[ServiceContract]
public interface IGiftSer... | [
0.14012058079242706,
-0.12268587946891785,
0.5756316781044006,
-0.18359410762786865,
-0.3981371819972992,
0.0007854126743040979,
0.22673805058002472,
-0.3330300450325012,
0.1336645483970642,
-0.7688205242156982,
-0.17179197072982788,
0.5486700534820557,
-0.10268128663301468,
0.282637506723... | |
{
return new List<Gift>() {
new Gift() { Name = "1", Price = 1.0 },
new Gift() { Name = "2", Price = 1.0 },
new Gift() { Name = "3", Price = 1.0 } | [
0.09069157391786575,
-0.48146018385887146,
0.6013312339782715,
-0.09741204231977463,
-0.5056397914886475,
0.2945084273815155,
-0.023140771314501762,
-0.39677509665489197,
0.08650568127632141,
-0.48150184750556946,
-0.5328248143196106,
0.6997972726821899,
0.11377634853124619,
0.405111223459... | |
};
}
}
[DataContract]
public class Gift {
[DataMember]
public string Name { get; set; }
[DataMember]
public double Price { get; set; }
}
```
**To start the service:**
```
WebServiceHost2 host = new WebServiceHost2( | [
0.2827616333961487,
-0.4497445523738861,
0.6018956899642944,
0.046536289155483246,
-0.2260090708732605,
-0.20612291991710663,
0.045031074434518814,
-0.0393364243209362,
0.1245000809431076,
-0.5836739540100098,
-0.4555995762348175,
0.5642145872116089,
0.2028534710407257,
0.34013718366622925... | |
typeof(GiftService),
true,
new Uri("http://localhost:8099/tserverservice"));
host.Open();
Console.WriteLine("Running");
Console.ReadLine();
host.Close();
```
**To start the client:**
```
WebChannelFactory<IGiftService> factory = new W... | [
-0.2825356423854828,
-0.14260756969451904,
1.1479862928390503,
-0.21956971287727356,
-0.13020657002925873,
0.08158183842897415,
0.3950170874595642,
0.0892384797334671,
-0.1245327964425087,
-0.811332643032074,
-0.3781209886074066,
0.21470850706100464,
-0.061416152864694595,
0.67180293798446... | |
new Uri("http://localhost:8099/tserverservice"));
IGiftService service = factory.CreateChannel();
List<Gift> list = service.GetGifts();
Console.WriteLine("-> " + list.Count);
foreach (var item in list) {
Console.WriteLine("-> " + item.Name); | [
-0.3195945620536804,
-0.21511700749397278,
0.951005756855011,
-0.3350944221019745,
-0.19198694825172424,
0.31847405433654785,
0.25885531306266785,
-0.2364693284034729,
-0.08032454550266266,
-0.8097564578056335,
-0.5681992769241333,
0.1262378692626953,
-0.2315872758626938,
0.81772381067276,... | |
}
```
The server and the client are in the same solution and I'm using the same interface in both (to describe the service contract).
The exception says: "A property with the name 'UriTemplateMatchResults' already exists." and that is the stack trace:
**Class firing the exception** -> Microsoft.ServiceModel.Web.Wra... | [
-0.14168810844421387,
0.12507270276546478,
0.7548025250434875,
-0.06620312482118607,
0.0198376402258873,
0.17968635261058807,
0.1940602958202362,
-0.4204530417919159,
-0.22400566935539246,
-0.7480892539024353,
-0.48521387577056885,
0.4767453670501709,
-0.08089910447597504,
0.30360716581344... | |
request, InstanceContext instanceContext)
```
What am I doing wrong?
**UPDATE:** I disabled the help page and the service is working now. Is it a bug?
```
host.EnableAutomaticHelpPage = false;
```
Thank you!
André Carlucci
In his book "[SQL Programming Style](https://rads.stackoverflow.com/amzn/click/com/0120887... | [
-0.05345983803272247,
0.28065672516822815,
0.19381409883499146,
0.03641701117157936,
-0.11566704511642456,
-0.0697198361158371,
0.18812543153762817,
-0.37446966767311096,
-0.362281858921051,
-0.05557706207036972,
-0.07818514108657837,
0.40795907378196716,
-0.5117230415344238,
0.31087753176... | |
I have a `Dictionary<string,int>` that has the potential to contain upwards of 10+ million unique keys. I am trying to reduce the amount of memory that this takes, while still maintaining the functionality of the dictionary.
I had the idea of storing a hash of the string as a long instead, this decreases the apps memo... | [
0.08356910198926926,
0.34290769696235657,
0.3082853853702545,
-0.08452602475881577,
0.26000040769577026,
0.12054946273565292,
0.24781586229801178,
-0.34029045701026917,
-0.11300979554653168,
-0.40633371472358704,
0.003423079615458846,
0.5368847846984863,
-0.15268753468990326,
0.13284593820... | |
I then use as a key. While this works, at least for the data I'm testing with, I don't feel like this is a very reliable solution due to the increased possibility for key collisions.
Are there any other ways of reducing the Dictionary's memory footprint, or is the method I have above not as horrible as I think it is?... | [
0.24739040434360504,
0.25891172885894775,
0.06486037373542786,
0.045418206602334976,
0.06885689496994019,
0.050496745854616165,
0.4441320300102234,
-0.1518286168575287,
0.11115404963493347,
-0.42031919956207275,
-0.010348953306674957,
0.6477171778678894,
0.019427966326475143,
0.14053329825... | |
use a `Dictionary<long,int>` where the long is the result of a hashing function on the string.
So I have done something similar recently and for a certain set of reasons that are fairly unique to my application did not use a database. In fact I was try to stop using a database. I have found that GetHashCode is signific... | [
0.31106895208358765,
0.16157862544059753,
0.23339399695396423,
0.09594851732254028,
-0.17522230744361877,
-0.3666808009147644,
0.656002402305603,
-0.06777074933052063,
-0.10182284563779831,
-0.750399649143219,
0.11219791322946548,
0.7908934950828552,
-0.2189614474773407,
0.1902196407318115... | |
might work better or worse on your data. You also need to account for speed. As a general rule cryptographic hash functions should not have many collisions even as the number of hashes moves into the billions. For things that I need to be unique I typically use SHA1 Managed. In general the CryptoAPI has terrible perfor... | [
-0.3494056761264801,
0.10219953954219818,
0.012540041469037533,
0.05928114429116249,
-0.24080705642700195,
-0.058926187455654144,
0.3454313576221466,
-0.048164550215005875,
-0.35720670223236084,
-0.44459283351898193,
0.133016437292099,
0.3883005678653717,
-0.15134698152542114,
0.0340173803... | |
happen over about 100 million hashes. You can find the code to both publicly available on the web.
Still conduct your own analysis. What has worked for me may not work for you. Actually inside of my office different applications with different requirements actually use different hash functions or combinations of hash... | [
0.67523193359375,
0.22527241706848145,
0.0898979902267456,
0.04387645050883293,
0.31352052092552185,
-0.21865521371364594,
0.4686082899570465,
0.2364742010831833,
-0.15065087378025055,
-0.7184786796569824,
0.22225168347358704,
0.3728061318397522,
-0.19674398005008698,
0.1475626677274704,
... | |
I have a text file that contains localized language strings that is currently encoded in GB2312 (simplified Chinese), but all of my other language files are in UTF-8. I am finding it very difficult to work with this file, as none of my text editors will work properly with it and keep corrupting it. Are there any tools ... | [
0.2623180150985718,
0.489327609539032,
0.04544393718242645,
0.03344011679291725,
0.001389879733324051,
-0.178292915225029,
0.40991079807281494,
0.2885676324367523,
-0.05341605097055435,
-0.9331874251365662,
-0.3623853325843811,
0.48517823219299316,
-0.14121806621551514,
-0.0167361032217741... | |
tried using Notepad++ and Notepad2 to edit the GB2312 files, but both are unable to read the files and corrupt them.
You can try this [online service](http://www.iconv.org/) that uses the Open Source `iconv` utility.
You can also install [Charco](http://www.marblesoftware.com/Charco.html), a command-line version of ... | [
0.3817111849784851,
0.10602878034114838,
-0.04871974140405655,
0.10689558833837509,
0.07573428004980087,
0.3414304852485657,
0.14334052801132202,
0.12000903487205505,
-0.46877917647361755,
-0.7401772737503052,
0.44267940521240234,
0.45026400685310364,
-0.45566248893737793,
0.02768117934465... | |
it and it works):
**In C#**
```
static void Main(string[] args) {
string infile = args[0];
string outfile = args[1];
using (StreamReader sr = new StreamReader(infile, Encoding.GetEncoding(936))) {
using (StreamWriter sw = new StreamWriter(outfile, false, Encoding.UTF8)) {
sw.Write(sr.... | [
-0.1358852982521057,
-0.2853887677192688,
0.7406866550445557,
-0.18356873095035553,
0.35672029852867126,
-0.17365258932113647,
0.20744657516479492,
-0.06303618848323822,
0.025091465562582016,
-0.3547716736793518,
-0.5112187266349792,
0.6003516912460327,
-0.21895696222782135,
0.094279475510... | |
String)
Dim infile As String = args(0)
Dim outfile As String = args(1)
Dim sr As StreamReader = New StreamReader(infile, Encoding.GetEncoding(936))
Dim sw As StreamWriter = New StreamWriter(outfile, false, Encoding.UTF8)
sw.Write(sr.ReadToEnd)
sw.Close
sr.Close
End Sub
``` | [
-0.08277208358049393,
-0.2965140640735626,
0.9056142568588257,
-0.43820661306381226,
0.06352904438972473,
-0.03498263657093048,
0.5569853186607361,
-0.49049612879753113,
-0.041412416845560074,
-0.4531502425670624,
-0.4635924994945526,
0.6672461032867432,
-0.24731668829917908,
0.30034309625... | |
I am working with a cvs repository at a clients site, and I do a checkin via ssh (CVS\_RSH=ssh).
My default group is "foo", and I am also a member of "bar".
The repository should be accessible by members of group "bar". However, whenever I do a checkin, it changes the group of the file I checked in to "foo". This mak... | [
0.48519331216812134,
0.5342704653739929,
0.4538816213607788,
-0.5094707608222961,
0.07283378392457962,
-0.30047598481178284,
0.3609195351600647,
-0.19900062680244446,
-0.276165246963501,
-0.46867746114730835,
-0.17026115953922272,
0.6195634603500366,
-0.24650484323501587,
0.040480069816112... | |
connection? Or is this just an ancient version of CVS that needs to be updated.
Well, CVS has really no file metadata out of binary and executable.
There are a few things you can do
* do a chmod g+s bar on the server directory where you want it to stay bar
* write a small shell wrapper which will replace the real cvs... | [
0.2284684032201767,
-0.024507496505975723,
0.4592704772949219,
0.30948957800865173,
0.164951890707016,
-0.2968899607658386,
-0.017512701451778412,
0.3613516390323639,
-0.4008694887161255,
-0.3558212220668793,
0.08591321855783463,
0.7686618566513062,
-0.4369117319583893,
0.3821658194065094,... | |
I'm trying to come up with a clean way of sorting a set of strings based on a "sorting template". I apologize if my wording is confusing, but I can't think of a better way to describe it (maybe someone can come up with a better way to describe it after reading what I'm trying to do?).
Consider the following list of st... | [
0.38967305421829224,
0.08199679106473923,
0.005995900370180607,
-0.040665384382009506,
-0.1259649246931076,
0.4889000356197357,
-0.048284776508808136,
-0.05822015553712845,
-0.201472669839859,
-0.4915001690387726,
-0.036386165767908096,
-0.10334786772727966,
-0.224399134516716,
0.160120114... | |
I'd like the following list:
* [TY, PR, PR, ZZ, BC, AK]
to be sorted into the following list based on the "sorting template":
* [TY, AK, PR, PR, ZZ, BC]
What would be a good way to acomplish this?
The best idea I have yet is to use an enumeration...
```
enum Command
{
FA,
TY,
AK,
PO,
PR,
ZZ... | [
0.11523285508155823,
0.4212738573551178,
0.15573693811893463,
-0.0507945753633976,
0.04992141202092171,
0.45483091473579407,
-0.2187918722629547,
-0.30816856026649475,
-0.135764941573143,
-0.48693814873695374,
-0.10387197881937027,
0.21874284744262695,
-0.22162692248821259,
0.0984925106167... | |
a list of Commands, which would then be sorted based on the order of the enumeration.
I don't know. The enumeration seems like it would work, but is there a better way I could go about this?
You could use a `Dictionary<string, int>` to store and retrieve your sorting template tokens. However, this basically does the s... | [
0.21962769329547882,
-0.10004537552595139,
0.10822100937366486,
-0.11243818700313568,
-0.13966548442840576,
0.304920494556427,
0.03354749456048012,
-0.5879372358322144,
-0.2612406611442566,
-0.6697782278060913,
-0.030461227521300316,
0.33210569620132446,
-0.4392178952693939,
-0.11725841462... | |
the `template` dictionary. | [
0.19031383097171783,
0.2067098766565323,
0.013955427333712578,
0.06869871914386749,
-0.039154984056949615,
-0.21992842853069305,
0.035020291805267334,
-0.021066583693027496,
0.014015967026352882,
-0.4994151294231415,
-0.3334156572818756,
0.240128755569458,
-0.3362601697444916,
-0.088525108... | |
My project is about to introduce SOAP. It's going to be used for C++ <-> Java and C++ <-> Flex communication. I'm responsible for refactoring our apps to take advantage of Java business rules engine and new Flex gui.
What resources are must read for C++ SOAP? I've read W3 materials. We're probably be using gSOAP on So... | [
0.3877282440662384,
0.291586697101593,
0.4783329367637634,
-0.11016660183668137,
-0.22870080173015594,
0.038830261677503586,
0.1037479043006897,
-0.15037937462329865,
-0.07265026867389679,
-0.9790632128715515,
0.06238783150911331,
0.513168454170227,
-0.15189465880393982,
-0.273777812719345... | |
In the C# example of polymorphism, there is a Cat class which inherits a class called AnimalBase and an interface called IAnimal.
The link in question is: <http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming>
My question is, why is both a base class and an interface used? Why not one or the other... | [
0.15467873215675354,
-0.2564193904399872,
-0.44708946347236633,
-0.002974577946588397,
-0.14143981039524078,
-0.4035729765892029,
-0.06186482310295105,
-0.00603915611281991,
-0.18626560270786285,
-0.4570642113685608,
0.09576831758022308,
0.4281816780567169,
-0.8228023648262024,
0.312485873... | |
Object Oriented purist would insist that a language should provide inheritance, encapsulation, modularity and polymorphism in order to be a fully-featured Object Oriented language. In dynamically-typed - or duck typed - languages (like Smalltalk,) polymorphism is trivial; however, in statically typed languages (like Ja... | [
-0.13377360999584198,
0.07739796489477158,
-0.18885651230812073,
0.01997469551861286,
-0.38996341824531555,
-0.19342513382434845,
0.07342266291379929,
0.19153150916099548,
-0.020956600084900856,
-0.35469895601272583,
-0.12822526693344116,
0.7066696882247925,
-0.7357428669929504,
0.05192789... | |
:= Pig new.
anAnimal makeNoise.
anAnimal := Cow new.
anAnimal makeNoise.
```
That code:
1. Declares a local variable called anAnimal (note that we DO NOT specify the TYPE of the variable - all variables are references to an object, no more and no less.)
2. Creates a new instance of the class named "Pig"
3. Assigns ... | [
0.18239836394786835,
-0.12116054445505142,
-0.06659466028213501,
-0.16571523249149323,
-0.08595313131809235,
0.40088194608688354,
0.269142210483551,
-0.11259246617555618,
-0.14537401497364044,
-0.5367227792739868,
-0.11260879039764404,
0.10561813414096832,
-0.5235632061958313,
0.4369897842... | |
of Animal:
```
Animal anAnimal = new Pig();
duck.makeNoise();
anAnimal = new Cow();
cow.makeNoise();
```
That's all well and good, until we introduce class Vegetable. Vegetables have some of the same behavior as Animal, but not all. For example, both Animal and Vegetable might be able to grow, but clearly vegetable... | [
-0.05886390805244446,
0.05952474847435951,
-0.08385836333036423,
-0.23673337697982788,
-0.23226723074913025,
0.41469064354896545,
0.08461739867925644,
0.020602064207196236,
-0.09879956394433975,
-0.7927976250648499,
-0.20715932548046112,
0.4736757278442383,
-0.318854421377182,
0.0675240382... | |
to an object, a lookup is performed on the receiver's method list, and if a matching method is found, it is called. If not, some kind of NoSuchMethodError exception is thrown - but it's all done at runtime.
But in Java, a statically typed language, what type can we assign to our variable? Corn needs to inherit from Ve... | [
0.21183206140995026,
0.07242943346500397,
-0.3483167588710785,
0.08033487945795059,
-0.07258425652980804,
0.11648603528738022,
0.12144885957241058,
-0.2866681218147278,
-0.05215154588222504,
-0.37426841259002686,
0.027494361624121666,
0.1846591830253601,
-0.5047057867050171,
0.303872108459... | |
the ability to inherit from more than one class. But that turns out to be a pretty difficult language feature because of all the edge cases that pop up (what happens when more than one parallel superclass implement the same method?, etc.)
Along come interfaces...
If we make Animal and Vegetable classes, with each imp... | [
0.3534630537033081,
-0.201120063662529,
-0.042727697640657425,
-0.03995925933122635,
0.2292490154504776,
0.0665702298283577,
0.03481977432966232,
-0.2678559124469757,
-0.3093908727169037,
-0.6588796377182007,
0.02669994719326496,
0.6332820057868958,
-0.3106115162372589,
0.2518767714500427,... | |
it lets us do this, to make animal noises:
```
List<Animal> list = new ArrayList<Animal>();
list.add(new Cow());
list.add(new Pig());
for(Animal a : list) {
a.makeNoise();
}
```
The biggest advantage to the duck-typed language is that you get really nice polymorphism: all a class has to do to provide behavior is p... | [
0.24313126504421234,
-0.011162529699504375,
0.04352697730064392,
-0.04149487242102623,
-0.1633596569299698,
0.02503424510359764,
0.278237909078598,
-0.07924262434244156,
-0.09988246858119965,
-0.43478676676750183,
-0.06757688522338867,
0.6956924796104431,
-0.49759742617607117,
-0.212682411... | |
checked until runtime.
```
Statically-typed languages provide much better "programming by contract," because they will catch the two kinds of error below at compile-time:
```
Animal farmObject = new Corn(); // Compiler error: Corn cannot be cast to Animal.
farmObject makeNoise();
```
--
```
Animal farmObject = n... | [
0.3794320523738861,
0.11093097180128098,
-0.047895628958940506,
-0.14561598002910614,
-0.04770481213927269,
-0.043110448867082596,
0.2341099977493286,
-0.34121644496917725,
-0.041205357760190964,
-0.754140317440033,
0.054409295320510864,
0.6644436120986938,
-0.5261799097061157,
-0.09116990... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.