text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I have a DLL that I need to access methods from.
In most cases like this I just use [DllImport] to access methods from unmanaged assemblies, but the problem with that in this situation is that it requires the path to the DLL at instantiation time, so a constant string.
This particular DLL is one that gets installed w... | [
0.12184643745422363,
0.023297056555747986,
0.22687269747257233,
-0.02126752771437168,
-0.01482898835092783,
-0.07250562310218811,
0.29911231994628906,
-0.05600709840655327,
-0.09108201414346695,
-0.5928645133972168,
0.03783782199025154,
0.28666719794273376,
-0.25415873527526855,
0.32496246... | |
with a variable path?
Any ideas or suggestions would be greatly appreciated!
This is a bit of hack, but since you say that you can find the path to the dll at runtime, why not copy it to your current working directory before you use any of the functions? That way, the dll will exist next to your exe and will be found ... | [
0.051199741661548615,
-0.4093751907348633,
0.45375704765319824,
0.18921451270580292,
-0.0298856683075428,
-0.3674846291542053,
0.19830656051635742,
-0.19589751958847046,
-0.2318102866411209,
-0.5621788501739502,
-0.0900457352399826,
0.8738346695899963,
-0.5662899017333984,
0.00438779639080... | |
Load the library from the desired path (LoadLibrary)
3) Find the desired function (GetProcAddress)
4) Cast the pointer to a delegate [Marshal.GetDelegateForFunctionPointer](http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getdelegateforfunctionpointer(vs.80).aspx)
5) Invoke it.
... | [
0.01674254983663559,
-0.15747451782226562,
0.22042617201805115,
0.2772252559661865,
0.26150235533714294,
-0.2786734700202942,
0.3147136867046356,
-0.5186330676078796,
-0.22973668575286865,
-0.5272999405860901,
-0.4269533157348633,
0.38437700271606445,
-0.35139521956443787,
0.06495019048452... | |
If I have this class:
```
<?php
class Model
{
var $db;
function Model()
{
$this->db=new Db_Class();
}
}
?>
```
and a second class that extended the parent class:
```
<?php
class LessonModel extends Model
{
public function LessonModel()
{
//code here
}
public functi... | [
-0.048068299889564514,
-0.49629661440849304,
0.8134174346923828,
-0.02986709587275982,
-0.014962702989578247,
-0.08428046107292175,
0.11293626576662064,
-0.33699899911880493,
0.1521119922399521,
-0.8124121427536011,
-0.24639257788658142,
0.6588272452354431,
-0.1213630959391594,
0.231513738... | |
that the `$LessonModel->db` field would have been instantiated by the parent `Model` class's constructor, or do I need to run it manually using something like `parent::Model();`?
You cannot assume that the parent constructor has been called because you have overridden this in your subclass. You would need to call `pare... | [
0.2322959005832672,
0.020284181460738182,
-0.22314468026161194,
-0.0005349096027202904,
-0.22321099042892456,
-0.021007005125284195,
0.2051771730184555,
-0.05524536594748497,
-0.13220341503620148,
-0.27856120467185974,
-0.04126404598355293,
0.7186311483383179,
-0.284040242433548,
0.3841555... | |
the parent class name. You can then rearrange your classes' inheritance with less hassle and less danger of introducing obscure bugs. | [
0.22101956605911255,
-0.2471427172422409,
-0.25365015864372253,
0.5779474377632141,
0.23981590569019318,
-0.08652953803539276,
0.04345298185944557,
0.12739983201026917,
-0.019639207050204277,
-0.6869404911994934,
-0.39673155546188354,
0.2489660531282425,
-0.06050767004489899,
0.53799003362... | |
I have created a wn32 project with **Visual Studio 2008** and **Visual C++** language, it uses the ws2\_32.lib library and then I compiled in **Release mode**.
It runs very good in the same computer, but when I copy the exe file to other computer (that doesn't have installed Visual Studio), it doesn't run.
The messa... | [
0.30146852135658264,
0.3246002793312073,
0.1760743260383606,
0.003348906524479389,
-0.35401585698127747,
-0.0013601318933069706,
0.4402361810207367,
-0.2811269164085388,
-0.10641390085220337,
-0.79294753074646,
-0.00011315600568195805,
0.6846638917922974,
-0.38559502363204956,
0.0331725850... | |
DEV C++ executable runs in the other computer.
I have add the library ws2\_32.lib to the linker properties of my project, in the **Additional Dependencies** field.
How can I fix it to work with Visual Studio 2008?
My code is the following: <http://www.stan.com.mx/yupi/udpserver.cpp>
I agree with JaredPar. The applic... | [
0.3703346252441406,
0.04567132145166397,
0.479108065366745,
-0.01786150224506855,
-0.5210299491882324,
-0.164053276181221,
0.28736260533332825,
-0.1623990833759308,
-0.2258751094341278,
-0.4844268560409546,
0.02001912146806717,
0.7604457139968872,
-0.4192318320274353,
-0.19558031857013702,... | |
on another machine without redistributing the CRT by getting VS2008 to link statically for you (if its just the standard lib you're missing). I don't have a copy of VS2008 to hand, so I'll describe how to do it in VS2005 and hopefully it'll translate across.
1. Bring up configuration properties for the project (right ... | [
0.35300010442733765,
-0.18894095718860626,
0.3231920301914215,
0.16064101457595825,
0.10070442408323288,
-0.22666019201278687,
0.21765807271003723,
-0.2918541729450226,
-0.12945251166820526,
-1.080191969871521,
-0.065061055123806,
0.601784348487854,
-0.28535154461860657,
-0.056667048484086... | |
release builds you want "Multi-threaded (/MT)"
Try and see if that works. You'll obviously get a much bigger final binary now the library is statically linked. | [
0.5742508172988892,
-0.02073286660015583,
0.1460927426815033,
0.2430563122034073,
-0.15878914296627045,
-0.06980288028717041,
0.4054499566555023,
-0.10387256741523743,
-0.5608655214309692,
-0.2162771373987198,
-0.22580116987228394,
0.3616653084754944,
-0.2729629874229431,
0.067365586757659... | |
In a paper about the **Life Science Identifiers** (see [LSID Tester, a tool for testing Life Science Identifier resolution services](http://www.scfbm.org/content/3/1/2)), Dr Roderic DM Page wrote :
Given the LSID urn:lsid\*\*:ubio.org\*\*:namebank:11815, querying the DNS for the SRV record for *\_lsid.\_tcp*.**ubio.o... | [
0.4718281924724579,
0.03164657577872276,
0.2343011349439621,
-0.1852113902568817,
0.04489423334598541,
-0.03131705895066261,
0.054145652800798416,
0.04651934653520584,
-0.49088335037231445,
-0.486247718334198,
-0.010362621396780014,
0.0829329788684845,
-0.355084091424942,
0.589996695518493... | |
can lookup SRV records. You need to do something like:
```
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
env.put("java.naming.provider.url", "dns:");
DirContext ctx = new InitialDirContext(env);
Attributes attrs = ctx.getAttributes("_lsid._tcp.ubio.org",... | [
-0.005139239598065615,
-0.10965655744075775,
0.4695723056793213,
0.0708003118634224,
0.07002381980419159,
0.035083163529634476,
-0.024251466616988182,
-0.3535310626029968,
-0.3296448886394501,
-0.6932530403137207,
-0.044191259890794754,
0.5845494270324707,
-0.39144203066825867,
0.228751659... | |
On an server running multiple ASP.NET sites, is it better to use one application pool per site or for sites to share a single application pool? What are the advantages or disadvantages inherent to each setup? Or is there a hard and fast rule here?
This really depends on what the requirements are of the site, as well as... | [
0.39690113067626953,
-0.027697449550032616,
0.10266871750354767,
0.2668621242046356,
0.1469716727733612,
-0.24375787377357483,
0.17304125428199768,
-0.2532472610473633,
-0.5178707242012024,
-0.5815975069999695,
-0.052884966135025024,
0.26764172315597534,
-0.3242247402667999,
0.048746239393... | |
site starts having issues and using memory it could cause recycles or freezes that could impact both.
Although there is not a "hard and fast" rule to this, some of the things that I consider and that cause "automatic" decisions for me are the following.
* Is the application mission critical? (If so, separate app pool... | [
0.24765793979167938,
-0.07635797560214996,
0.23731641471385956,
0.19859495759010315,
0.15704800188541412,
-0.3743250370025635,
0.6838797926902771,
0.19117425382137299,
-0.49118247628211975,
-0.775016188621521,
-0.02540372870862484,
0.34813955426216125,
-0.22150518000125885,
-0.125425383448... | |
to troubleshoot single applications. Here is a [Microsoft article](http://technet.microsoft.com/en-us/library/cc783655.aspx) that touches on it a bit as well. | [
0.2475644052028656,
0.07563801109790802,
-0.20239844918251038,
0.2839377820491791,
0.1180235892534256,
-0.2854859232902527,
0.053015951067209244,
0.053125008940696716,
-0.6550172567367554,
-0.1853368729352951,
-0.1662018746137619,
0.3876500725746155,
-0.13509038090705872,
-0.25277996063232... | |
Azul Systems has an appliance that supports thousands of cache coherent CPUs. I would love insight into what changes would need to occur to an operating system in order to schedule thousands of simultaneously running threads.
You're asking for possible changes to the OS, so I presume there's a significant engineering t... | [
0.0973052829504013,
-0.04809586703777313,
0.15014365315437317,
0.4310711622238159,
0.25467604398727417,
0.018199803307652473,
-0.2557315230369568,
0.4300558269023895,
-0.31038159132003784,
-0.579511284828186,
0.15078583359718323,
0.3225262761116028,
-0.0840546041727066,
0.05273414403200149... | |
the have to talk to each other through sockets, and not by using shared memory?
What is the memory architecture? Are you straight SMP with 1024 cores, or is there some other NUMA (Non-Uniform Memory Architecture) or MMP going on here? What are your page tables like?
Knowing only the very smallest of info about Azu... | [
0.3558247685432434,
0.030407611280679703,
0.10997100174427032,
0.5450632572174072,
-0.09382493048906326,
0.12231497466564178,
-0.2444380521774292,
0.2583521604537964,
-0.4473683834075928,
-0.5186966061592102,
0.012713095173239708,
0.5101165771484375,
-0.30363574624061584,
0.050061833113431... | |
way. Does your hardware support this model? (You would likely end up needing one IP address per core as well, and at 1024 IP addrs, this might be troublesome, although they could all be NAT'd, and maybe it's not such a big deal). If course, this model would lead to some inefficiencies, like extra page tables, and a fai... | [
0.2882416248321533,
0.003836412914097309,
0.13775098323822021,
0.5061490535736084,
0.2495567947626114,
-0.048581864684820175,
0.30915409326553345,
0.09260590374469757,
-0.4442633390426636,
-0.7011163830757141,
-0.14912042021751404,
0.5368410348892212,
-0.27252253890037537,
-0.0919970348477... | |
you wanted to run 1 thread per core in a traditional SMP machine with 1024 cores (and only a few physical CPUs) then I would expect that the old fashioned O(1) scheduler is what you'd want. It's likely that your CPU[0] will end up nearly 100% in kernel and doing interrupt handling, but that's just fine for this use cas... | [
0.10935176908969879,
0.0658736526966095,
0.20588064193725586,
0.3146694600582123,
0.1481073945760727,
0.0005315807065926492,
0.18725821375846863,
0.29247766733169556,
-0.510387122631073,
-0.5100905299186707,
-0.1822129338979721,
0.2567978799343109,
-0.3186267614364624,
-0.00902312435209751... | |
how do I get the value of X, Y, and Z from a string "vt X,Y,Z"
You're asking for possible changes to the OS, so I presume there's a significant engineering team behind this effort.
There are also a few pieces of clarififying info that would help define the problem parameters:
How much IPC (inter process communicati... | [
0.4625244736671448,
0.12966877222061157,
0.21461497247219086,
0.5168763995170593,
0.40454578399658203,
0.12255287170410156,
0.04763567075133324,
0.15946711599826813,
-0.456169068813324,
-0.5882103443145752,
0.09809137135744095,
0.5375741720199585,
0.09071596711874008,
0.26692792773246765,
... | |
architecture? Are you straight SMP with 1024 cores, or is there some other NUMA (Non-Uniform Memory Architecture) or MMP going on here? What are your page tables like?
Knowing only the very smallest of info about Azul systems, I would guess that you have very little IPC, and that a simple "run one kernel per core" mo... | [
0.2948284447193146,
0.0729173868894577,
0.30679062008857727,
0.34598308801651,
-0.007994099520146847,
0.13092219829559326,
-0.15063218772411346,
0.17912442982196808,
-0.5941662788391113,
-0.6427479982376099,
0.191094309091568,
0.5258697271347046,
-0.2967696189880371,
0.08399052917957306,
... | |
and at 1024 IP addrs, this might be troublesome, although they could all be NAT'd, and maybe it's not such a big deal). If course, this model would lead to some inefficiencies, like extra page tables, and a fair bit of RAM overhead, and may even not be supported by your hardware system.
Even if "1 kernel per core" doe... | [
0.12062989175319672,
0.013680830597877502,
0.22320210933685303,
0.4253617227077484,
0.0026708936784416437,
0.021494904533028603,
0.4040139317512512,
0.017890023067593575,
-0.6857073307037354,
-0.6036559343338013,
-0.13319024443626404,
0.45163121819496155,
-0.4285488426685333,
-0.1310625523... | |
physical CPUs) then I would expect that the old fashioned O(1) scheduler is what you'd want. It's likely that your CPU[0] will end up nearly 100% in kernel and doing interrupt handling, but that's just fine for this use case, unless you need more than 1 core to handle your workload. | [
-0.017261363565921783,
0.05368216335773468,
0.28822222352027893,
0.468627393245697,
0.03742927685379982,
-0.002474820939823985,
0.10478315502405167,
0.1647890955209732,
-0.3077857196331024,
-0.8229129910469055,
-0.1478791981935501,
0.7051954865455627,
-0.2536850571632385,
0.040287625044584... | |
I have an application that needs to work with a vendor-supplied API to do Screen Pops when a call is routed to the user's extension. Another developer worked on getting the API to work and delivered a prototype wrapper class that isn't quite right, and I'm trying to get it right.
Because this API can block for several... | [
0.37915632128715515,
0.006460137665271759,
0.3812090754508972,
-0.04364221915602684,
0.013551457785069942,
0.11054643988609314,
0.13164347410202026,
-0.21030718088150024,
-0.15768904983997345,
-0.7285565137863159,
-0.05014253035187721,
0.4912338852882385,
-0.3357219994068146,
0.32466807961... | |
_bInitialized = true;
_listener.StartListening( _extension );
_bListening = true;
}
```
The call to Initialize is the one that could hang, if the phone server was unresponsive.
I don't think it was intentional on the part of the developer who did this, but when the API is initialized this way, the thread keeps r... | [
0.25692451000213623,
-0.24596108496189117,
0.34513431787490845,
-0.2117956131696701,
0.023295124992728233,
-0.2912667691707611,
0.21289388835430145,
-0.22949998080730438,
-0.13373346626758575,
-0.31364706158638,
-0.024539155885577202,
0.531481146812439,
-0.6269971132278442,
0.3862330615520... | |
logic used to shut everything down and clean up:
```
public void ShutdownFunc()
{
try
{
if ( _bListening )
{
_listener.StopListening();
_bListening = false;
}
if ( _bInitialized )
{
_listener.Shutdown();
_bInitialized = false;
}
if ( _bAllocated )
{
_li... | [
-0.1715320646762848,
-0.12196017056703568,
0.15549814701080322,
0.00719128642231226,
0.029959894716739655,
-0.059789370745420456,
0.6432444453239441,
-0.13220499455928802,
-0.11962772160768509,
-0.1277797371149063,
-0.41670212149620056,
0.5192664265632629,
-0.5251354575157166,
0.5133330225... | |
}
}
}
```
Of course, there is a try/catch around the whole mess to prevent unhandled exceptions.
My biggest problem is, how do I call the shutdown code when the API interface code is running in a separate thread? I need to clean up in case the user logs off and then logs back on again, as the API gets confused if ... | [
0.3844405710697174,
0.2735280394554138,
0.12970590591430664,
-0.16159318387508392,
0.03498261049389839,
-0.3788931369781494,
0.4696396589279175,
0.154254749417305,
-0.22451572120189667,
-0.5103945136070251,
-0.18389186263084412,
0.6894412636756897,
-0.47194889187812805,
0.38097724318504333... | |
seems to be no way to call the shutdown logic if the API interface code is running on a separate thread. Thread.Abort() bypasses all the logic and kills the thread without cleaning up. Calling the shutdown logic from the GUI thread hangs when it calls the Shutdown method. So, what can I do?
The IDispose interface just... | [
0.545762836933136,
0.24476808309555054,
0.3345576524734497,
0.1745939701795578,
-0.041546694934368134,
-0.09361432492733002,
0.43919679522514343,
0.04421256110072136,
-0.3065687417984009,
-0.6887668371200562,
0.178086519241333,
0.9278116226196289,
-0.4409271776676178,
0.21593394875526428,
... | |
Dave
With the help of a fellow developer here, I was able to get the code working as desired. What I needed to do was take everything out of the thread except the call to Initialize(), so that the API instance was not running on a separate thread. I then had a different problem, as the status was set from 2 different t... | [
0.5117560029029846,
0.04369043931365013,
0.188874751329422,
-0.11808662116527557,
0.218654066324234,
0.2729943096637726,
0.044372621923685074,
0.25401127338409424,
-0.3307754099369049,
-0.7121140956878662,
0.2387896031141281,
0.6134092211723328,
-0.6085221767425537,
0.21282948553562164,
... | |
_phoneListener = new ScreenPopTelephoneListener();
_apiState = ApiState.Allocated;
_phoneListener.StatusChanged += new _IScreenPopTelephoneListenerEvents_StatusChangedEventHandler( StatusChangedEvent );
_phoneListener.ScreenPop += new _IScreenPopTelephoneListenerEvents_ScreenPopEventHandler( ScreenPopEvent... | [
0.13588066399097443,
0.2092265784740448,
0.6914552450180054,
-0.16453635692596436,
0.34913170337677,
0.22331544756889343,
0.5120145678520203,
-0.2583170235157013,
-0.2787541449069977,
-0.776154100894928,
-0.37208643555641174,
0.9336704015731812,
-0.3876100480556488,
0.33068227767944336,
... | |
API instance is running in the same thread as the UI and everybody's happy. The call to Shutdwn() no longer hangs, I don't need Invoke() for the callbacks, and the long-running code executes in a background worker thread.
What this code does not show are the great ideas presented earlier for how to handle the case whe... | [
0.24384744465351105,
0.060666441917419434,
0.327014684677124,
-0.029172811657190323,
-0.1849094033241272,
0.06673488020896912,
0.592151939868927,
0.10140900313854218,
-0.32436081767082214,
-0.6732240319252014,
-0.003080518916249275,
0.5956318974494934,
-0.47492992877960205,
0.1373016536235... | |
My co-workers complain that my Perl looks too much like C, which is natural since I program in C most of the time, and Perl just a bit. Here's my latest effort. I'm interest in Perl that is easy to understand. I'm a bit of a Perl critic, and have little tolerance for cryptic Perl. But with readability in mind, how coul... | [
0.24511930346488953,
0.15870898962020874,
0.32151469588279724,
-0.0013019880279898643,
-0.42029792070388794,
-0.01931433379650116,
-0.05239216983318329,
0.038541022688150406,
-0.2404884248971939,
-0.42791613936424255,
0.009869914501905441,
0.3498679995536804,
-0.22424788773059845,
0.067009... | |
which will contain lists of IP addresses, and see if
# any of them are in the ranges spelled out in the local file "ip", which has contents of the
# form start-dotted-quad-ip-address,end-dotted-quad-ip_address,stuff_to_be_ignored
use English;
open(IPS,"ips") or die "Can't open 'ips' $OS_ERROR";
# Increment a dotted-... | [
-0.05767519026994705,
-0.06758636981248856,
0.6580535173416138,
-0.0810963362455368,
0.1032509058713913,
-0.005757479928433895,
0.49702224135398865,
-0.4598272442817688,
-0.14183707535266876,
-0.4165022075176239,
-0.6099063754081726,
0.18811051547527313,
-0.47433769702911377,
0.09574491530... | |
($part_3++);
if ( $part_3 > 255 ) {
$part_3 = 0;
($part_2++);
if ( $part_2 > 255 ) {
$part_2 = 0;
($part_1++); | [
-0.667963981628418,
-0.27031391859054565,
0.8998328447341919,
-0.27360329031944275,
-0.08054953068494797,
0.1438559740781784,
0.5313556790351868,
-0.4279780685901642,
0.1686215102672577,
0.28803160786628723,
-0.8379247188568115,
0.44877856969833374,
-0.4531843662261963,
0.07950844615697861... | |
}
}
}
return ("$part_1.$part_2.$part_3.$part_4");
}
# Compare two dotted-quad ip addresses.
sub is_less_than {
$left = shift;
$right = shift;
my ($left_part_1, $left_part_2, $left_part_3, $left_part_4) = split (/\./, $left);
my ($right_part_1, $right_part_2, $right_part_3, $right... | [
-0.33478862047195435,
-0.3862230181694031,
0.5767539143562317,
-0.232092946767807,
0.2800539433956146,
0.022046320140361786,
0.25313231348991394,
-0.24116282165050507,
0.24264144897460938,
-0.486313134431839,
-0.3872607946395874,
0.3661048710346222,
-0.10534593462944031,
0.2451032698154449... | |
}
if ($left_part_2 != $right_part_2 ) {
return ($left_part_2 < $right_part_2);
}
if ($left_part_3 != $right_part_3 ) {
return ($left_part_3 < $right_part_3);
}
if ($left_part_4 != $right_part_4 ) {
return ($left_part_4 < $right_part_4);
}
return (false); #... | [
-0.5412243604660034,
0.10882536321878433,
0.7132725715637207,
0.06203673034906387,
0.30647483468055725,
0.19895079731941223,
0.23681917786598206,
-0.34885236620903015,
0.33854371309280396,
-0.525724470615387,
-0.24087589979171753,
0.3588740825653076,
-0.2889009118080139,
0.2084590494632721... | |
record them in a hash.
while (<IPS>) {
my ($ip, $end_ip, $junk) = split /,/;
while (is_less_than($ip, $end_ip) ) {
$addresses{$ip}=1;
$ip = increment($ip);
}
}
# print IP addresses in any of the found ranges
foreach (@ARGV) {
open(TRAFFIC, $_) or die "Can't open $_ $OS_ERROR";
w... | [
0.11802573502063751,
0.22058521211147308,
0.4518539309501648,
-0.05660039186477661,
0.39368486404418945,
0.30449697375297546,
0.10937079042196274,
-0.183416947722435,
-0.36718419194221497,
-0.49865812063217163,
-0.26482322812080383,
0.2504487931728363,
-0.3772607445716858,
0.36440786719322... | |
print "$_\n";
}
}
close (TRAFFIC);
}
```
Sometimes the most Perlish thing to do is to turn to CPAN instead of writing any code at all.
Here is a quick and dirty example using [Net::CIDR::Lite](http://search.cpan.org/perldoc?Net::CIDR::Lite) and [Net::IP::Match::Regexp](http://search.cpan.org/perldoc... | [
0.0476570688188076,
0.2589547336101532,
0.5318623185157776,
-0.2652970850467682,
-0.21639755368232727,
-0.12468579411506653,
0.35334303975105286,
-0.1792990267276764,
0.05044881999492645,
-0.4329776465892792,
-0.1966196596622467,
0.493233859539032,
-0.33089861273765564,
0.18940505385398865... | |
my $range = join('-', $start, $end);
$cidr->add_range($range);
}
$ips_fh->close();
my $regexp = create_iprange_regexp($cidr->list());
foreach my $traffic_fn (@ARGV) {
my $traffic_fh = IO::File->new();
$traffic_fh->open($traffic_fn) or die "Can't open '$traffic_fh': $OS_ERROR";
while (my $ip_addr... | [
-0.21761123836040497,
0.34471872448921204,
1.0726388692855835,
-0.41484522819519043,
0.1775091290473938,
0.08635472506284714,
0.36777448654174805,
-0.2918957769870758,
-0.11055810749530792,
-0.5414177775382996,
-0.24700383841991425,
0.6374102830886841,
-0.4139786958694458,
0.16788797080516... | |
just banged that out, it's had minimal testing and no benchmarking. Sanity checks, error handling and comments omitted to keep the line count down. I didn't scrimp on the whitespace, though.
As for your code: There is no need to define your functions before you use them. | [
0.24082010984420776,
0.2976568937301636,
0.06549490988254547,
0.039272844791412354,
0.00683149229735136,
0.12447172403335571,
0.5512913465499878,
0.08609742671251297,
-0.16310378909111023,
-0.3413882255554199,
0.306493878364563,
0.55858314037323,
0.04801078885793686,
-0.1939496397972107,
... | |
I have a table where I'm inserting, for instance, images and the names of the colors found in said images. The color string looks something like:
> *white, yellow, orange, black*
Since I have a lot of these, the 50% threshold is starting to drop off some colors, since they appear on most of the rows.
The whole point... | [
0.26639482378959656,
-0.01959388144314289,
-0.10343943536281586,
0.16394948959350586,
-0.07048850506544113,
0.1461808979511261,
0.17603068053722382,
0.37498608231544495,
-0.2040211409330368,
-0.7365242838859558,
0.143015056848526,
0.23702415823936462,
-0.3241010010242462,
0.200650170445442... | |
to the table to bypass the 50%, but that sounds pretty desperate.
This is NOT a problem to be solved with full text search.
Instead, you need a child table with one row per color per image.
The color should be a foreign key to a color table, so your child table actually becomes a many-to-many relation between image ... | [
-0.1353207677602768,
0.1890837699174881,
0.4743654131889343,
0.06199776381254196,
0.27462196350097656,
0.44148239493370056,
-0.0713808611035347,
-0.2845357656478882,
-0.04698660597205162,
-0.856255829334259,
-0.27706074714660645,
0.6096806526184082,
-0.4329119622707367,
0.1867220103740692,... | |
a unique constraint on the tuple (image\_id, color\_id).
Then to find all images with a particular color:
```
select a.* from image a
join image_color b on (a.id = b.image_id)
join color c on (b.color_id = c.id)
where c.name = 'yellow';
``` | [
-0.3504815995693207,
0.10189282894134521,
0.4377622604370117,
-0.1695736050605774,
-0.0734483003616333,
0.1862887442111969,
-0.012428517453372478,
-0.24233761429786682,
-0.022861594334244728,
-0.8092519044876099,
-0.5662754774093628,
0.40393775701522827,
-0.572677731513977,
0.0919796898961... | |
Recently, the book on threading for Winforms application (Concurrent programming on Windows by Joe Duffy) was released. This book, focused on winforms, is 1000 pages.
What gotchas are there in ASP.NET threading? I'm sure there are plenty of gotchas to be aware of when implementing threading in ASP.NET. What should I b... | [
0.29380878806114197,
0.13673534989356995,
-0.16983933746814728,
0.22655202448368073,
-0.16049224138259888,
0.04205288738012314,
0.020706914365291595,
0.01687367632985115,
-0.39176467061042786,
-0.5715355277061462,
0.15843552350997925,
0.3335339426994324,
-0.051855504512786865,
0.1129023879... | |
is it more about processing global tasks in the background?
**EDIT**
If you need to handle *concurrent operations* (a better term than *multi-threaded* IMO) for a given request/response cycle, then use the asynchronous features of ASP.NET. These provide an abstraction over IIS's support for concurrency, allowing the ... | [
0.0064196777530014515,
-0.3042674660682678,
0.10704268515110016,
0.1658134013414383,
-0.12048165500164032,
0.08129868656396866,
0.01136602833867073,
-0.020829999819397926,
-0.8879461884498596,
-0.5647091269493103,
-0.08580779284238815,
0.39742982387542725,
-0.7020957469940186,
0.0175911150... | |
sort of schedule. Any important background processing should be done outside of IIS, either as a scheduled task or a Windows Service. The approach I usually take is to have a Windows Service and a shared work-queue where the web-site can post work items. The queue can be a database table, a reliable message-based queue... | [
0.427014023065567,
-0.21051667630672455,
0.2779621183872223,
0.10579119622707367,
0.21132084727287292,
-0.11860541254281998,
-0.07414600253105164,
-0.09294497966766357,
-0.4060598909854889,
-0.8643059730529785,
-0.29100582003593445,
0.2071029543876648,
-0.23055845499038696,
0.2291396856307... | |
I have a customer table, and my requirement is to add a new varchar column that automatically obtains a random unique value each time a new customer is created.
I thought of writing an SP that randomizes a string, then check and re-generate if the string already exists. But to integrate the SP into the customer recor... | [
0.07772302627563477,
0.11867077648639679,
0.8072853684425354,
0.03435809165239334,
-0.1508091241121292,
0.3104070723056793,
-0.1915346384048462,
-0.20540514588356018,
-0.3691123425960541,
-0.31123223900794983,
0.39613574743270874,
0.20172981917858124,
-0.07625240087509155,
0.11034233868122... | |
0 on the left.
if it has to be varchar, you can cast a uniqueidentifier to varchar.
to get a random uniqueidentifier do [NewId()](http://msdn.microsoft.com/en-us/library/ms190348.aspx)
here's how you cast it:
```
CAST(NewId() as varchar(36))
```
### EDIT
as per your comment to @Brannon:
are you saying you'll NEV... | [
-0.11362121999263763,
0.14147977530956268,
0.3099188804626465,
0.16725482046604156,
-0.07739618420600891,
0.1516406536102295,
-0.00210689939558506,
-0.1550927311182022,
-0.08524014055728912,
-0.5964767932891846,
0.19423969089984894,
0.1119813472032547,
0.052631039172410965,
0.2802384793758... | |
Not sure that this is a valid programming question ... but is it possible to program infa red using vb.net express (iRDA) Got a programming project in my mind, but none of the coding examples work, IrDAClient never gets recognised
Cheers
It's a valid question but it needs to be a bit more specific. VB.Net can certainl... | [
0.3629112243652344,
0.12583191692829132,
0.19015569984912872,
0.1153712347149849,
-0.6263333559036255,
-0.13835318386554718,
0.14082834124565125,
-0.13033953309059143,
-0.25250881910324097,
-0.4095573425292969,
0.4340311586856842,
0.6289980411529541,
-0.37879279255867004,
0.049457572400569... | |
Update to comments
There is nothing that will prevent you from writing a program targeting IRDA from VB Express. What you appear to be missing is a reference to the DLL that contains the IrDA libraries. You'll neeed to add a reference to System.Net.Irda.dll. It will be in the following directory (assuming your program... | [
0.26030516624450684,
-0.00025065476074814796,
0.1360880732536316,
0.17051254212856293,
-0.19373966753482819,
-0.22648432850837708,
0.32989078760147095,
0.31315162777900696,
-0.0888015553355217,
-0.8155220150947571,
0.11159292608499527,
0.46552690863609314,
-0.3678923547267914,
0.2095148116... | |
> **Possible Duplicate:**
>
> [Best way to really grok Java for a C# guy](https://stackoverflow.com/questions/90578/best-way-to-really-grok-java-for-a-c-guy)
I worked on C# for a few years now move to Java. Is there a good Java tutorial for C# developers?
thanks!
[Here is a helpful article](http://www.25hoursaday.... | [
0.1375613957643509,
0.14016054570674896,
0.08731477707624435,
-0.14006033539772034,
-0.17231886088848114,
-0.016966277733445168,
0.5229369401931763,
0.5088804364204407,
-0.4354213774204254,
-0.6795884370803833,
0.043350063264369965,
0.39272820949554443,
0.06419708579778671,
-0.118914142251... | |
I have an interesting problem coming up soon and I've started to think about the algorithm. The more I think about it, the more I get frightened because I think it's going to scale horribly (O(n^4)), unless I can get smart. I'm having trouble getting smart about this one. Here's a simplified description of the problem.... | [
0.11233954131603241,
0.42311903834342957,
0.2919173240661621,
-0.013873697258532047,
-0.12881222367286682,
0.43730267882347107,
0.3481632471084595,
-0.11476995050907135,
-0.6195325255393982,
-1.1230953931808472,
0.21082937717437744,
0.14230139553546906,
-0.2760862112045288,
0.3848377466201... | |
among other polygons (Think of the polygons as surrounding regions of interest, sometimes the regions but up against each other). I see something like this
```
Polygon i | Vertex | Polygon j | Vertex
1 1 2 2
1 2 2 3
1 | [
-0.0713086724281311,
0.269978404045105,
0.054837632924318314,
0.0069720628671348095,
-0.24910223484039307,
0.09704384207725525,
0.09641467034816742,
0.1370285451412201,
-0.5672056078910828,
-0.7429869771003723,
-0.17119906842708588,
-0.08637765794992447,
-0.19730709493160248,
0.23384170234... | |
5 3 1
1 6 3 2
1 7 3 3
```
This mean that vertex 1 in polygon 1 | [
-0.4372658133506775,
0.4757809340953827,
0.016284378245472908,
-0.2053571343421936,
-0.3263492286205292,
0.0457720085978508,
0.8269890546798706,
-0.11587867885828018,
-0.39552000164985657,
-0.8615325689315796,
-0.24499985575675964,
-0.43448805809020996,
-0.07370320707559586,
0.428584098815... | |
is the same point as vertex 2 in polygon 2, and vertex 2 in polygon 1 is the same point as vertex 3 in polygon 2. Likewise vertex 5 in polygon 1 is the same as vertex 1 in polygon 3....
For simplicity, we can assume that polygons never overlap, the closest they get is touching at the edge, and that all the vertices ar... | [
-0.26632580161094666,
0.10149084031581879,
0.2649359107017517,
-0.0424865297973156,
-0.1812739223241806,
0.1917288601398468,
0.39150872826576233,
-0.3005801737308502,
-0.7407793998718262,
-0.7825232148170471,
0.11383677273988724,
-0.15333954989910126,
-0.11665557324886322,
0.28148260712623... | |
O(N^2\*M^2) which is going to be very bad in my case. I can have very large files of polygons, so I can't even store it all in RAM, so that would mean multiple reads of the file.
Here's my pseudocode so far
```
for i=1 to N
Pi=Polygon(i)
for j = i+1 to N
Pj=Polygon(j)
for ii=1 to Pi.VertexCount()
Vi... | [
-0.1422659456729889,
0.25464338064193726,
0.3945249021053314,
-0.3881557583808899,
0.029024166986346245,
0.540434718132019,
0.6385797262191772,
-0.5591716766357422,
-0.3181345760822296,
-0.8865208625793457,
0.007202145643532276,
0.09764876961708069,
-0.3202991783618927,
-0.2126603573560714... | |
end for
end for
end for
end for
```
I'm assuming that this has come up in the graphics community (I don't spend much time there, so I don't know the literature). Any Ideas?
This is a classic iteration-vs-memory problem. If you're comparing every polygon with every other polygon, you'll run into a O(n^2) solutio... | [
-0.05803229287266731,
0.26048967242240906,
-0.11622109264135361,
0.11470900475978851,
-0.09612542390823364,
0.3649258315563202,
-0.053953733295202255,
-0.1397080421447754,
-0.5636399388313293,
-0.9753682613372803,
0.1469482034444809,
0.2520926296710968,
-0.41872549057006836,
-0.02329907193... | |
key, multiple entries) with each vertex as the key, and the polygon as the entry. Then you can walk each polygon exactly once, inserting the vertex and polygon into the map. If the vertex already exists, you add the polygon as an additional entry to that vertex key.
Once you've hit all the polygons, you walk the entir... | [
-0.2663963735103607,
-0.19971418380737305,
0.38815194368362427,
0.21266405284404755,
-0.00425688037648797,
0.19687427580356598,
0.4274887144565582,
-0.35846051573753357,
-0.6018422842025757,
-0.844181478023529,
-0.07413533329963684,
0.17686417698860168,
-0.13024786114692688,
0.283531397581... | |
### Duplicate of
> [Any value in double script tags?](https://stackoverflow.com/questions/691449/any-value-in-double-script-tags)
Here's a code snipped from UserVoice in order to stick their tab on my site (this isn't specific to UserVoice however, I see this kind of thing all the time):
```
<script type="text/javas... | [
0.2253216803073883,
0.25009360909461975,
0.5438469052314758,
-0.2493487447500229,
-0.1255962997674942,
-0.16760027408599854,
0.37099140882492065,
-0.06763440370559692,
-0.24789421260356903,
-0.7547755241394043,
-0.03507613390684128,
0.19368375837802887,
-0.4210190176963806,
0.1789436638355... | |
alignment: 'right', /* 'left', 'right' */
background_color: '#94C97B',
text_color: 'white', /* 'white', 'black' */
hover_color: '#7AA1C5',
lang: 'en' /* 'en', 'de', 'nl', 'es', 'fr' */
})
</script>
```
How this can't all be jammed into one script tag and put into a separate file? A... | [
0.11742180585861206,
0.10388753563165665,
0.14361147582530975,
0.011035282164812088,
0.08647347241640091,
0.47293800115585327,
0.2628706991672516,
-0.27046841382980347,
-0.0682510957121849,
-0.9599066376686096,
-0.01615823619067669,
0.5817416310310364,
-0.3526403307914734,
-0.1687057018280... | |
in the first script tag, it's writing another script tag to the page. The code in the second script tag is using a function that is in the file that is loaded by the written script tag, so it has to be in a separate tag as the file is not loaded until the first code has been executed.
You could put the scripts in sepa... | [
0.1488884836435318,
-0.2891636788845062,
0.27363649010658264,
0.12784603238105774,
-0.05734074115753174,
-0.15782630443572998,
-0.1548284888267517,
-0.2728734314441681,
-0.12450329214334488,
-0.9603053331375122,
-0.23576343059539795,
0.4727966785430908,
-0.3552932143211365,
-0.190705031156... | |
I've got two tables that look like this:
[alt text http://www.brettrobichaud.com/images/linq.png](http://www.brettrobichaud.com/images/linq.png)
I'm trying to generate query that includes two specific StatisticsNames for each period from ApplianceStatisticsLog. Below is the Linq query I have come up with. It works bu... | [
-0.03070250153541565,
-0.09176371246576309,
0.5546776056289673,
-0.10164789110422134,
-0.03836633637547493,
0.35269275307655334,
0.13674196600914001,
-0.4811171889305115,
-0.40307971835136414,
-0.7597982883453369,
0.35560616850852966,
0.19849687814712524,
0.18501655757427216,
0.21819198131... | |
l.ApplianceStatisticsLogId
&& s.ApplianceStatisticNameId == 2
select s.Value,
Stat2 = from s in ApplianceStatistics
where s.ApplianceStatisticsLogId == l.ApplianceStatisticsLogId
&& s.ApplianceStatisticNameId == 3
select s.Value
}
```
Freddy was on the right track and almo... | [
-0.051162876188755035,
-0.29103514552116394,
0.622008204460144,
-0.286496639251709,
0.4465579688549042,
0.5318675637245178,
0.23001623153686523,
-0.5275070071220398,
0.11985301971435547,
-0.891515851020813,
-0.06779274344444275,
0.5084506869316101,
0.06213736906647682,
0.2082371860742569,
... | |
l.PeriodEndUtc,
Stat1 = (from s in ApplianceStatistic
where s.ApplianceStatisticsLogId == l.ApplianceStatisticsLogId
&& s.ApplianceStatisticNameId == 2
select s.Value).First(),
Stat2 = (from s in ApplianceStatistics
where s.ApplianceStatisticsLogId == l.Applian... | [
-0.21364541351795197,
-0.5041627883911133,
0.5091502070426941,
-0.53069007396698,
0.3685266375541687,
0.604215681552887,
0.11344511806964874,
-0.39031508564949036,
0.210902139544487,
-0.7059080004692078,
-0.23220394551753998,
0.5829464793205261,
0.15481896698474884,
-0.02747739478945732,
... | |
select s.Value).First()
}
```
I had neglected to mention that only one record should match in the subqueries. Thanks for the help Freddy! | [
0.34976282715797424,
0.15671195089817047,
0.2553398609161377,
0.08795519173145294,
0.10056586563587189,
-0.18215033411979675,
-0.02261292189359665,
0.02252102643251419,
-0.174054354429245,
-0.6119775772094727,
0.08546049892902374,
0.6185938715934753,
-0.2648495137691498,
0.1644386202096939... | |
I am trying to figure out how to get the parameters that are passed in the URL from a jQuery plugin that I am using. Basically, I'm sending a POST ajax request to my web service and trying to use the URL parameters, but they are always returned as nothing. I'm assuming this has to do with the fact that I'm in a POST.
... | [
0.5434686541557312,
0.12482893466949463,
-0.015091379173099995,
0.16381923854351044,
-0.2617528736591339,
-0.26616522669792175,
0.1500478982925415,
0.43477901816368103,
-0.2736346423625946,
-0.8367444276809692,
0.11246049404144287,
0.15418805181980133,
0.07333092391490936,
0.31899997591972... | |
instead of manually doing an ajax call. Here's a quick tutorial/walk-through on using ScriptManager with web services: <http://msdn.microsoft.com/en-us/magazine/cc163354.aspx>
Something roughly like this:
```
// in html you have this
<script src="WebService.asmx/jsdebug" type="text/javascript"></script>
// csharp we... | [
0.022554896771907806,
-0.09486204385757446,
0.1590510904788971,
-0.2140330672264099,
-0.2787425220012665,
-0.15877504646778107,
0.24656328558921814,
-0.43563592433929443,
-0.025592109188437462,
-0.7258177399635315,
-0.09153660386800766,
0.5250970721244812,
-0.2988407611846924,
-0.029517425... | |
We have many developers here using MSVC 2008 and I want to standardize the Visual Studio settings and project setup.
In particular, I want:
1) All of the settings in the Tools -> Options to be the same (especially the tab settings!)
2) We have a source repository where we have a shared folder. The shared folder has ... | [
0.588856041431427,
0.13301372528076172,
0.33958861231803894,
0.01712270826101303,
0.036127131432294846,
-0.08990644663572311,
0.051563043147325516,
-0.2998315989971161,
-0.16279336810112,
-0.6439592838287354,
-0.03564967215061188,
0.8201232552528381,
0.08280167728662491,
0.1356042176485061... | |
each time we create a new solution, we have to re-type these include/lib names over and over)
Could someone please save us and point us to the right solution?
For #1, you can easily set up one Visual Studio environment, and then use the Import/Export Settings (under the Tools menu) to save a settings file that can be l... | [
0.6561000347137451,
-0.12130143493413925,
0.5564486384391785,
0.4184730052947998,
0.5991812348365784,
0.14296852052211761,
0.12202378362417221,
-0.10177118331193924,
-0.3206135928630829,
-0.6192373037338257,
0.21767555177211761,
0.7048018574714661,
0.13333860039710999,
-0.32895955443382263... | |
I am using the WPF DataGrid with a DataGridTemplateColumn. The DataGridTemplateColumn.CellEditingTemplate contains a ComboBox with IsEditable set to 'true'. In my RowEditEnding event handler, I'd like to read the Text property of that ComboBox - the only problem is that I don't know how to retrieve the ComboBox instanc... | [
0.000075655581895262,
-0.03063173033297062,
0.6234279274940491,
-0.192661851644516,
-0.1827821433544159,
-0.09103984385728836,
0.16065098345279694,
-0.6423311233520508,
0.10105881094932556,
-0.7417154312133789,
0.17468243837356567,
0.5201218724250793,
-0.2072172462940216,
0.122227966785430... | |
</DataTemplate>
</my:DataGridTemplateColumn.CellEditingTemplate>
<!-- ... -->
```
And my code:
```
private void productsDataGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
{
// UH-OH! Where do I find the ComboBox instance?
}
```
I know that I can get to the current affec... | [
-0.041400570422410965,
0.06336093693971634,
0.5029394626617432,
-0.1702302247285843,
-0.035097137093544006,
0.1347072273492813,
0.3488144278526306,
-0.05384086072444916,
-0.12525582313537598,
-0.9909274578094482,
0.021070081740617752,
0.5681049227714539,
-0.14614452421665192,
0.12598288059... | |
suggest the [Repository Pattern](http://martinfowler.com/eaaCatalog/repository.html) | [
0.41324350237846375,
0.1576993763446808,
0.1339896023273468,
-0.07359914481639862,
0.3099508285522461,
0.08599920570850372,
0.1926259845495224,
0.1932823359966278,
-0.43660441040992737,
-0.31262725591659546,
0.026513375341892242,
-0.09339690208435059,
-0.29788732528686523,
0.20061443746089... | |
Is there an easy way to get DataContractSerializer to spit out formatted XML rather then one long string? I don't want to change the tags or content in any way, just have it add line breaks and indentation to make the XML more readable?
```
<tagA>
<tagB>This is</tagB>
<tagC>Much</tagC>
<tagD>
<tagE>e... | [
0.26346227526664734,
-0.11728660017251968,
0.0511588491499424,
-0.11013943701982498,
-0.25336405634880066,
-0.2289600372314453,
-0.16613243520259857,
-0.3005458116531372,
-0.0035296285059303045,
-0.718529224395752,
0.12274125218391418,
0.5518943071365356,
-0.5356744527816772,
0.03806485608... | |
ds.WriteObject(w, someFoos);
``` | [
-0.04519163444638252,
0.03382236510515213,
0.1354944407939911,
-0.2403671145439148,
0.061845775693655014,
-0.23799316585063934,
0.4384167194366455,
0.010338952764868736,
0.08139294385910034,
-0.8390981554985046,
-0.3022845685482025,
0.6375152468681335,
-0.5211740732192993,
0.16193543374538... | |
I'm working in Delphi (and Delphi terminology), but my question is language neutral.
Suppose you have a class, TClient, which sends messages to another class, TFacade. I assume TClient instances would have a private reference variable of type TFacade. A method somewhere in TClient would create an instance of TFacade ... | [
0.18292249739170074,
-0.22817759215831757,
0.23639985918998718,
0.0027307686395943165,
-0.17781978845596313,
0.014348435215651989,
-0.055405691266059875,
0.10210033506155014,
-0.0637214258313179,
-0.5125638246536255,
0.10246285051107407,
0.41844117641448975,
-0.607877254486084,
0.021261328... | |
constructor). TFacade classes need to use the WorkerClass units.
So how does information get from the WorkerClasses back to TClient? If TClient is a form, for example, it might receive user input which is used by TFacade--and, in turn, used by the WorkerClasses. After WorkerClasses have manipulated or used information... | [
0.13268403708934784,
-0.2908787131309509,
0.23173187673091888,
0.13615724444389343,
-0.1095680296421051,
-0.0591561421751976,
0.054573994129896164,
-0.03614812716841698,
-0.11629100143909454,
-0.609935462474823,
-0.013811753131449223,
0.47152307629585266,
-0.406616747379303,
0.290507555007... | |
am a newbie, don't be afraid of being too simple or too specific in your response. I can handle it :-)
Thanks, as always -- Al C.
> I hope this is clear. Basically I'm just asking if Class1 calls a method in Class2, and Class2 calls a method in Class3, how does Class3 send information back to Class1?
It doesn't, as t... | [
0.2400663048028946,
-0.1833004504442215,
0.24679093062877655,
0.16236117482185364,
0.09230700880289078,
-0.2327146679162979,
0.05901327356696129,
-0.0708480030298233,
-0.10484634339809418,
-0.8340964317321777,
-0.023826440796256065,
0.3339596390724182,
-0.19439981877803802,
0.1313619166612... | |
Class2.
There are other, more advanced idioms, for further reducing coupling, but this is enough for you to start with. | [
0.17451313138008118,
-0.258873850107193,
-0.23895147442817688,
0.0353134386241436,
-0.38956281542778015,
-0.053204167634248734,
0.38937556743621826,
-0.23899254202842712,
0.088511623442173,
-0.34078964591026306,
-0.12019791454076767,
0.30027642846107483,
-0.4243767559528351,
0.045885033905... | |
I have a resource file that will have some optional keys. If the optional resource key is not present, I set a default instead. It appears that there is no easy way to determine if a key exists in the resource bundle. So this is what I'm doing to get around it.
```
<fmt:message var="title" key="login.reg.signup.${sig... | [
0.1452864408493042,
-0.03273944556713104,
0.3222769498825073,
-0.11131592094898224,
0.38776642084121704,
-0.28947293758392334,
0.10486491024494171,
-0.4546845555305481,
-0.024965105578303337,
-0.7412262558937073,
-0.3234345614910126,
0.755111813545227,
-0.12582999467849731,
0.0263846777379... | |
class. | [
-0.14031410217285156,
-0.061591736972332,
0.1970747709274292,
0.23996996879577637,
0.16072900593280792,
-0.030123164877295494,
0.26015838980674744,
0.3078117370605469,
-0.25533729791641235,
-0.2821454703807831,
-0.22259463369846344,
0.24438507854938507,
0.3611188232898712,
-0.0612066611647... | |
I'm wondering if there is a quick and easy way to output ordinals given a number in python.
For example, given the number `1`, I'd like to output `"1st"`, the number `2`, `"2nd"`, et cetera, et cetera.
This is for working with dates in a breadcrumb trail
```
Home > Venues > Bar Academy > 2009 > April > 01
```... | [
0.37829041481018066,
0.4859035313129425,
0.49626094102859497,
-0.34630563855171204,
-0.059564605355262756,
0.05730512738227844,
-0.11068973690271378,
-0.15330184996128082,
-0.2418999820947647,
-0.4039998948574066,
-0.28300055861473083,
0.07325050979852676,
0.029036929830908775,
0.279206961... | |
24 <= day <= 30:
suffix = "th"
else:
suffix = ["st", "nd", "rd"][day % 10 - 1]
``` | [
0.2949487566947937,
0.16313855350017548,
0.3438010811805725,
-0.3162398636341095,
-0.3365226984024048,
0.1088302880525589,
0.39468124508857727,
-0.13647131621837616,
-0.22040694952011108,
-0.5275420546531677,
-0.2290671020746231,
0.5767004489898682,
-0.3602948486804962,
0.06456825882196426... | |
I am using NuSOAP to try to consume a Web Service built in Java. I have this code so far:
```
<?php
require_once('lib/nusoap.php');
$wsdl="http://localhost:8080/HelloWorldWS/sayHiService?WSDL";
$client=new nusoap_client($wsdl, 'wsdl');
$param='John';#array('name'=>'John');
echo $client->call('Hey', $param);
unset($c... | [
0.30231425166130066,
0.2360890805721283,
0.2121044099330902,
-0.266679048538208,
-0.2268996387720108,
-0.005133341066539288,
0.13617609441280365,
-0.20230671763420105,
-0.3666859567165375,
-0.7570540904998779,
0.11400003731250763,
0.35563817620277405,
-0.28707176446914673,
0.12463840842247... | |
use some web service (not written by me, implemented in Java) and none of these SOAP clients worked, but the NuSOAP. and I really could not figure out why.
anyway, here is the thing that I did to use that web service back then:
```
$soapClient = new nusoap_client($wsdlFile, 'wsdl', '', '', '', '');
$soapClient->soap_... | [
0.1619463860988617,
0.1320638507604599,
0.19786155223846436,
0.02044253796339035,
0.05238551273941994,
-0.022359156981110573,
0.5815192461013794,
-0.6011814475059509,
0.06857655197381973,
-0.5015448927879333,
-0.03961194306612015,
0.6285553574562073,
-0.4649427831172943,
-0.035097107291221... | |
'SOAP method invocation (verifyT) failed: ' . $soapError;
throw new Exception($errorMessage);
}
if ($soapClient->fault) {
$fault = "{$soapClient->faultcode}: {$soapClient->faultdetail} ";
// handle fault situation
}
``` | [
0.009970211423933506,
-0.09374087303876877,
0.16733478009700775,
-0.28031331300735474,
0.01810556836426258,
0.015004361048340797,
0.7641318440437317,
-0.49926409125328064,
0.23150606453418732,
-0.17378142476081848,
-0.05836011841893196,
0.5649101734161377,
-0.2219340056180954,
0.0809699222... | |
I'm currently in the middle of porting a fairly large Perl The problem is that it uses little Perl tricks to make its code available for `use`ing. I've done about the same with Python, making the codebase one big module for `import`ing. I've had a firm grasp of Python for a long time, but I have no experience with larg... | [
0.35892561078071594,
0.13467338681221008,
0.0685281753540039,
-0.24613304436206818,
-0.29597508907318115,
-0.11350864171981812,
0.10425453633069992,
0.23260372877120972,
-0.20330588519573212,
-0.3675138056278229,
-0.050467126071453094,
0.5677819848060608,
-0.3583115339279175,
-0.0248471926... | |
best of ways. Here's an example from the master script that sets everything in motion:
```
self.Benchmark = Benchmark(self)
self.Exceptions = Exceptions
self.Settings = Settings(self)
self.Cache = Cache(self)
self.Deal = Deal(self)
self.Utils = Utils(self)
self.FileParsers = FileParsers(self)
self.Network = Network... | [
-0.04510023072361946,
0.01931696943938732,
0.22757510840892792,
0.04047499597072601,
0.2159762680530548,
-0.2222873419523239,
0.25119683146476746,
-0.3251782953739166,
-0.4379000663757324,
-0.9182640314102173,
-0.1170039176940918,
0.6060635447502136,
-0.18322765827178955,
0.133522152900695... | |
entire rest of the codebase through the parent class.
```
self.parent.Settings.loadSysConfig()
```
So my question is this: considering the above, what would be the best way to reorganize the project and refactor the code so that it retains its current ability to access everything else? The code is very noncritical, ... | [
0.43204590678215027,
0.09868080168962479,
0.148031085729599,
0.016083810478448868,
0.02781364507973194,
-0.20297837257385254,
0.25601983070373535,
0.018291406333446503,
-0.3455685079097748,
-0.4179705083370209,
-0.16001740097999573,
0.4863341152667999,
-0.0472557470202446,
0.39723363518714... | |
is [here](http://openkore.svn.sf.net/viewvc/openkore/openkore/trunk/).
> what would be the best way to reorganize the project and refactor the code so that it retains its current ability to access everything else?
I think you're actually quite close already, and probably better than many Python projects where they jus... | [
0.30041342973709106,
-0.010677884332835674,
-0.028866324573755264,
0.24815019965171814,
0.09762907773256302,
-0.06361757963895798,
0.08566313982009888,
-0.10187137871980667,
-0.5143452286720276,
-0.3200075626373291,
-0.05529341474175453,
0.4992596507072449,
0.0802815780043602,
0.0276542175... | |
I would do from the looks of the code above would be to factor out any of those modules and classes that aren't a core competency of your application, things that don't necessarily need access to the application's state. Names like “Utils” and “Misc” sound suspiciously like much of their contents aren't really specific... | [
0.2007494866847992,
-0.017672788351774216,
0.18421301245689392,
0.03559277579188347,
0.11696294695138931,
-0.03144640102982521,
0.21503779292106628,
0.07847011089324951,
-0.20134802162647247,
-0.6561111807823181,
-0.24967002868652344,
0.5869848132133484,
-0.1949564665555954,
0.137835800647... | |
Then from your run-script or just the interpreter, you can get a complete instance of the application as simply as:
```
import myapplication
a= myapplication.Application()
```
You could also consider moving any basic deployment settings from the Settings class into the initialiser:
```
a= myapplication.Application... | [
0.27014246582984924,
0.45892584323883057,
0.2159862518310547,
-0.04822586476802826,
0.03863537684082985,
0.2242116630077362,
0.2903977334499359,
-0.21193501353263855,
-0.2241276651620865,
-0.7344186902046204,
-0.099843829870224,
0.5620711445808411,
-0.3148308992385864,
-0.08294770866632462... | |
members of the owner application object:
```
# myapplication/__init__.py
class Application(object):
def __init__(self, dbfactory, debug):
# ...
self.mailer= self.Mailer(self)
self.webservice= self.Webservice(self)
# ...
import myapplication.mailer, myapplication.webservice
# myap... | [
-0.2122250646352768,
0.24980606138706207,
0.306322306394577,
-0.0867881029844284,
0.09323543310165405,
0.24797745048999786,
0.2211274355649948,
-0.40577375888824463,
-0.23936887085437775,
-0.6813650131225586,
-0.546699583530426,
0.37643763422966003,
-0.4571545124053955,
0.2588343024253845,... | |
by replacing/subclassing the inner classes:
```
import myapplication
class MockApplication(myapplication.Application):
class Mailer(myapplication.Application.Mailer):
def send(self, message, recipients):
self.owner.log('Mail send called (not actually sent)')
return True
```
> I'm... | [
0.26127904653549194,
0.13840632140636444,
-0.0800124779343605,
-0.051614776253700256,
-0.18899008631706238,
-0.0018846443854272366,
0.705350399017334,
-0.04221479594707489,
-0.10897715389728546,
-0.5054700374603271,
-0.06193629279732704,
0.6273568868637085,
-0.46656668186187744,
0.09308188... | |
And those long chains slow the code down as well.
Not really noticeably. Readability is the important factor; anything else is premature optimisation. | [
0.295073926448822,
0.12849701941013336,
-0.16997148096561432,
0.30567070841789246,
-0.031031355261802673,
-0.09656462073326111,
0.4089507460594177,
0.11768971383571625,
-0.12463174760341644,
-0.2727888524532318,
-0.1891629844903946,
0.5188212394714355,
-0.10715758800506592,
-0.113594993948... | |
Here's the scenario: I have a local git repository that mirrors the contents of another source control system (a proprietary one). I've written a script that periodically syncs my git branch with that system's latest copy of the same branch (called by another term in the other system but conceptually similar).
Now, su... | [
0.34141504764556885,
0.08644901216030121,
-0.02494039200246334,
0.2748619318008423,
0.21994520723819733,
0.17238540947437286,
0.002664136467501521,
0.45758673548698425,
-0.40243592858314514,
-0.6559938192367554,
0.0922551155090332,
0.561032772064209,
-0.16905851662158966,
0.244571790099143... | |
is closest to the new branch. If I can do this, I'll know which commit from the main branch to make as the parent of this new branch.
This sounds to me like a problem of computing "tree distances". But as SHA1 hashes don't have a distance metric, is there another way to do this besides the obvious manual deep search o... | [
-0.13223573565483093,
0.03184949606657028,
0.1755153089761734,
-0.06132345274090767,
-0.1933393031358719,
-0.04637746140360832,
0.029927683994174004,
0.20192664861679077,
-0.3592900335788727,
-0.5853090882301331,
0.12576603889465332,
0.05615641176700592,
-0.02217859774827957,
0.29280793666... | |
to see how similar they are.
Hoping this is a rare event, I would clone the git repository and start rolling back versions to locate the commit that is closest to the tree you wish to duplicate. It would be nice to think of using `git bisect` for this, but since there's no total ordering and no absolute concept of `go... | [
0.32574352622032166,
-0.2016238570213318,
-0.0824170857667923,
0.17229114472866058,
0.03404394909739494,
0.08616039156913757,
0.015413522720336914,
0.2071855366230011,
-0.39649856090545654,
-0.819664716720581,
0.0472198948264122,
0.40732720494270325,
-0.027188414707779884,
0.31042462587356... | |
time the new branch is created. Then maybe you can just **grab the last commit before that timestamp**? | [
0.6135129332542419,
-0.36650606989860535,
0.39918479323387146,
0.27358704805374146,
0.3792712986469269,
0.11189176142215729,
0.06806604564189911,
0.3988482356071472,
-0.5087157487869263,
-0.6371354460716248,
0.3224998116493225,
0.3054654896259308,
-0.0013196754734963179,
0.2501149475574493... | |
Does anyone commit Qt to their own source control? If so, how do you do it? Do you commit the whole Qt directory or do you pick only the ones that your application needs (bin/lib/include/src)
How do you handle the case when new Qt version comes out?
I'm asking because I'm trying to setup Build automation and Qt moc i... | [
0.7682742476463318,
0.11970331519842148,
-0.3014277219772339,
0.022445136681199074,
-0.024507539346814156,
-0.0712638795375824,
-0.011480588465929031,
-0.2010544389486313,
-0.13403305411338806,
-0.4992215633392334,
0.10610703378915787,
0.8416290283203125,
-0.43322882056236267,
-0.014272001... | |
Java (Jambi) or Python (PyQt).
At the build/package stage, our build tools note the dependencies and include DLLs, etc as needed. If you're interested, we're using CMake by Kitware.
<http://www.cmake.org/>
It has the added benefit of being cross-platform. Depending on your project size, consider the complementary to... | [
0.5860333442687988,
0.09840374439954758,
-0.18755033612251282,
-0.17499765753746033,
-0.11582457274198532,
-0.1727449595928192,
0.09888512641191483,
0.09149631857872009,
-0.04861152544617653,
-0.7294299602508545,
-0.0027426176238805056,
0.5457941293716431,
-0.34697893261909485,
-0.06055830... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.