text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
// OK
BOOST_MPL_ASSERT(( bool_< false > )); // assert
// metafunction predicates
BOOST_STATIC_ASSERT(( is_same< A, A >::type::value ));// OK
BOOST_STATIC_ASSERT(( is_same< A, Z >::type::value ));// assert, line 19
BOOST_MPL_ASSERT(( is_same< A, A > )); // OK
BOOST_MPL_ASSERT(... | [
-0.34988585114479065,
0.10434649884700775,
0.6430031657218933,
-0.21647469699382782,
-0.2460404336452484,
0.4639487564563751,
0.5294916033744812,
-0.541600227355957,
-0.10795249789953232,
0.2883932292461395,
-0.4216899573802948,
0.6527593731880188,
-0.5412291288375854,
-0.02918112650513649... | |
return 0;
}
```
For comparison, here are the error messages my compiler (Microsoft Visual C++ 2008) generated for lines 19 and 21 above:
```
1>static_assert.cpp(19) : error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
1> with
1> [
1> x=false
1> ]
1>static_assert.c... | [
-0.4568174481391907,
0.27143222093582153,
0.4422056972980499,
-0.0835762545466423,
-0.2015640288591385,
0.37083467841148376,
0.4677174985408783,
-0.5499551892280579,
-0.29147154092788696,
-0.22842621803283691,
-0.22742146253585815,
0.5732097625732422,
-0.14709192514419556,
-0.0133504969999... | |
_Ty1=A,
1> _Ty2=Z
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
```
So if you're using metafunctions (as defined [here](http://www.boost.org/doc/libs/1_38_0/libs/mpl/doc/refmanual/metafunction.html)) as predicates then `BOOST_MPL_ASSERT` i... | [
-0.09766674041748047,
0.22868840396404266,
0.36530208587646484,
-0.09123703092336655,
-0.6692985892295837,
0.1519995480775833,
0.44694390892982483,
-0.41458413004875183,
0.11410296708345413,
0.009456108324229717,
-0.48124584555625916,
0.7566483020782471,
-0.2367148995399475,
-0.05651476606... | |
There is another recent Project Euler question but I think this is a bit more specific (I'm only really interested in PHP based solutions) so I'm asking anyway.
[Question #5](http://projecteuler.net/index.php?section=problems&id=5) tasks you with: "What is the smallest number that is evenly divisible by all of the num... | [
-0.08245681971311569,
0.0007898618932813406,
0.20603442192077637,
-0.05881994217634201,
-0.3367685377597809,
0.23787996172904968,
-0.05535903573036194,
-0.4416011869907379,
-0.647127628326416,
-0.6333100199699402,
0.0539466068148613,
0.11021802574396133,
-0.041209153831005096,
0.1276797205... | |
I am wondering if any of you could demonstrate a more efficient solution to this problem.
\*spoiler: Here is my less than optimal (7 seconds to run) but still tolerable solution (not sure what to do about the double $... just pretend you only see 1...
```
function euler5(){
$x = 20;
for ($y = 1;... | [
0.19402280449867249,
-0.11287013441324234,
0.5099336504936218,
0.02721979096531868,
0.312871515750885,
0.058341704308986664,
0.4390850067138672,
-0.1657983809709549,
0.020983844995498657,
-0.421436607837677,
-0.26733410358428955,
0.5586696267127991,
-0.018216146156191826,
0.182168647646904... | |
} else {
$x+=20;
$y = 1;
}
}echo $x;
};
```
in php it will look like this:
```
<?php
function gcd($a,$b) {
while($a>0 && $b>0) {
if($a>$b) $a=$a-$b; else $b=$b-$a; | [
0.07160376012325287,
-0.0075129191391170025,
0.39460888504981995,
-0.40072837471961975,
-0.10688015818595886,
0.010445749387145042,
0.2000904083251953,
-0.36827826499938965,
-0.07373175770044327,
-0.04832213744521141,
-0.24305133521556854,
0.31825679540634155,
-0.6156900525093079,
0.055157... | |
}
if($a==0) return $b;
return $a;
}
function euler5($i=20) {
$euler=$x=1;
while($x++<$i) {
$euler*=$x/gcd($euler,$x);
}
return $euler;
}
?>
```
Its at least twice as fast than what you posted. | [
-0.038117121905088425,
-0.5071079730987549,
0.5346390604972839,
-0.060157451778650284,
-0.05150477588176727,
0.19662854075431824,
0.3647322356700897,
-0.14478647708892822,
-0.22607947885990143,
-0.8473360538482666,
-0.2096957415342331,
0.1960151642560959,
-0.483573317527771,
0.206310510635... | |
Intuitively, it would seems that a compiler for language `Foo` cannot itself be written in Foo. More specifically, the *first* compiler for language `Foo` cannot be written in Foo, but any subsequent compiler could be written for `Foo`.
But is this actually true? I have some very vague recollection of reading about a ... | [
0.35717976093292236,
0.3276579976081848,
-0.39305397868156433,
0.013086398132145405,
-0.170328751206398,
-0.12912972271442413,
0.4335451126098633,
0.12776245176792145,
-0.014186236076056957,
-0.4165470004081726,
0.02699085883796215,
0.627829909324646,
-0.5183441638946533,
-0.18442808091640... | |
the compiler in language Foo. You use the first bootstrap compiler to compile the compiler, and then use this compiled compiler to compile everything else (including future versions of itself).
Most languages are indeed created in this fashion, partially because language designers like to use the language they are cre... | [
0.3063752055168152,
-0.005766186863183975,
-0.2592480480670929,
-0.30388009548187256,
-0.27973225712776184,
0.1869708001613617,
0.4773198366165161,
0.023211216554045677,
0.05401577800512314,
-0.2601530849933624,
-0.20520709455013275,
0.5155545473098755,
-0.9795710444450378,
-0.321728289127... | |
point on, the old Pizza compiler could be completely discarded, due to the fact that the new Scala compiler could be used to compile itself for future iterations. | [
0.14476901292800903,
-0.1328561156988144,
-0.1291094720363617,
-0.052288882434368134,
-0.033670831471681595,
0.142135888338089,
0.21873030066490173,
-0.0370485819876194,
0.010086157359182835,
-0.5142415761947632,
0.04247437044978142,
0.3094671368598938,
-0.43113404512405396,
0.206927165389... | |
I am talking about Google Text Translation User Interface, in [Google Language Tools](http://www.google.com/language_tools).
I like the fact that you can get translations of text for a lot of languages. However, I think is not so good always to show all options of translation. I believe is preferably to show, in first... | [
0.0272262804210186,
-0.05589624121785164,
0.32206180691719055,
-0.1838371455669403,
-0.05418753996491432,
0.3615400493144989,
0.45738816261291504,
0.7583245635032654,
-0.059370070695877075,
-0.619683027267456,
-0.1633242517709732,
0.7953177094459534,
-0.3429250121116638,
-0.332217454910278... | |
the keyboard again (F key repeatedly) shows Filipino and Finish before French!!!
What sort of ideas do you think can it be applied to this GUI to make it more effective for real people usage?
I've been frustrated with this interface as well. I think it would be a good idea to (a) use cookies to give preference to the ... | [
-0.13130231201648712,
0.08769570291042328,
0.2798866927623749,
0.09896828234195709,
0.10087209939956665,
0.06389211118221283,
0.27161067724227905,
0.7511046528816223,
-0.3359117805957794,
-0.5976823568344116,
-0.21116890013217926,
0.7865585684776306,
0.1077728271484375,
-0.4090504348278045... | |
applications have started using this approach when asking you to specify your time zone. Why display "Mid-Atlantic", "Azores", etc. if you expect 95% of your users to be in (for example) the 5 U.S. time zones. | [
0.260105699300766,
-0.24091848731040955,
0.6128784418106079,
0.17624793946743011,
0.4663360118865967,
-0.15535466372966766,
0.23055817186832428,
0.4194069504737854,
-0.5861888527870178,
-0.5360555648803711,
-0.295724481344223,
-0.17902642488479614,
-0.3595985174179077,
0.08942172676324844,... | |
I am working on developing a pair of libraries to work with a REST API. Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes). Are there any best pra... | [
0.6037514805793762,
0.2216005027294159,
0.010934948921203613,
0.3216221332550049,
-0.0928921177983284,
0.11818421632051468,
0.3404238820075989,
0.27688565850257874,
-0.31832167506217957,
-0.5557971596717834,
0.3504350781440735,
0.5548436641693115,
-0.368754118680954,
-0.027282893657684326,... | |
personal experience, having ported a library from Python to PHP. Idioms aren't just naming: for example, Python has a good deal of magic you can use with getters and setters to make object properties act magical; Python has monkeypatching; Python has named parameters.
With a port, you want to pick a "base" language, a... | [
0.24594953656196594,
-0.1244242787361145,
-0.07456587255001068,
0.48300740122795105,
-0.18214066326618195,
-0.17856094241142273,
0.38445866107940674,
0.006750318221747875,
-0.3547638952732086,
-0.5880575776100159,
0.0635177344083786,
0.5366390943527222,
0.0059834253042936325,
-0.2775737643... | |
I hear that tr1::result\_of gets used frequently inside of Boost... I'm wondering if there are any good (simple) use cases for tr1::result\_of I can use at home.
A description of result\_of is given at [open\_std.org](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1454.html). Microsoft has a quick example of ... | [
-0.06909476965665817,
-0.10075711458921432,
0.22732692956924438,
0.11324279755353928,
-0.009132042527198792,
-0.10567401349544525,
-0.1166641116142273,
-0.1800280213356018,
-0.10429170727729797,
-0.17269374430179596,
-0.12434212118387222,
0.8063080310821533,
0.15335577726364136,
-0.0453935... | |
As a matter of fact you have smth like `/java/src` and `/java/test`. But then, how do you name packages/classes the unittests go to? The same as classes they are written against? And when refactoring comes, do you manually rename in /test? Please share your experience.
I keep the tests in the same package as the class ... | [
0.5944867730140686,
0.05223434045910835,
-0.19526435434818268,
0.1504533588886261,
-0.09028539806604385,
-0.2519122362136841,
0.14164243638515472,
-0.17649197578430176,
-0.16857443749904633,
-0.5791211128234863,
0.10659587383270264,
0.5464789271354675,
0.0463130958378315,
0.060000337660312... | |
the ability to do this refactoring automatically, but I can't remember it off the top of my head. | [
0.6870927810668945,
0.3932870626449585,
0.10648110508918762,
-0.13648876547813416,
0.137942373752594,
-0.1039719358086586,
0.27552396059036255,
-0.27525681257247925,
-0.09430237114429474,
-0.2014061063528061,
0.29980048537254333,
0.3426344096660614,
0.513436496257782,
-0.031718358397483826... | |
We are currently evolving our development processes in an effort to become CMMI compliant (we will start with level 2, and move up from there). We are trying to locate a tool that is inexpensive (or free) that will allow us to develop requirements in the spirit of CMMI. In other words, we need to be able to enter our r... | [
0.6766462326049805,
0.1383148729801178,
0.26284295320510864,
0.32887640595436096,
0.44041213393211365,
-0.1331070363521576,
-0.023607445880770683,
-0.30958351492881775,
-0.14556823670864105,
-0.7094613909721375,
-0.29456305503845215,
0.4681059718132019,
0.20975065231323242,
-0.234267696738... | |
cost more than we are able to afford. We looked at a few on SourceForge (OSRM and others) but could not find anything that was sufficiently mature that also had the features that we needed.
We are looking for suggestions for a tool that meets the above requirements.
INCOSE is an excellent resource for this sort of que... | [
0.4692128896713257,
0.11283810436725616,
0.3842066824436188,
0.2755681574344635,
0.2724491059780121,
-0.08075156062841415,
-0.1190214455127716,
-0.020100533962249756,
-0.31618818640708923,
-0.8444250822067261,
-0.2586135268211365,
0.44995230436325073,
0.2463410496711731,
-0.128186374902725... | |
may provide some limited free functionality. [Workspace.com](http://www.workspace.com), for example, provides some free functionality. I would recommend against rolling your own solution, or adapting a tool that is not specifically intended for requirements management, because the hidden cost of getting it going, as we... | [
0.6893563270568848,
0.20630843937397003,
-0.09559264034032822,
0.4438771605491638,
0.22611097991466522,
-0.23949433863162994,
0.18311859667301178,
0.17555361986160278,
-0.4073426127433777,
-0.5250989198684692,
-0.31334182620048523,
0.544867753982544,
0.15920883417129517,
-0.111528538167476... | |
As part of learning jQuery, I decided to do a simple tic-tac-toe game in JavaScript and, at the moment, I'm using a HTML table for spacing and using graphic images within the table.
The images are either a small circle or a big X or O. When the user clicks on a circle, it changes to an X or O then checks whether the g... | [
0.4368841350078583,
-0.00004528524732450023,
0.11970606446266174,
0.04538070783019066,
-0.34390729665756226,
-0.05628051236271858,
-0.07026314735412598,
0.17154964804649353,
-0.12546202540397644,
-0.5888588428497314,
0.1541379690170288,
0.10686234384775162,
0.05043498054146767,
0.046664632... | |
using CSS rather than tables to do the formatting and how would that best be done (HTML tables are very easy)?
2/ Is there a better way than using images so that I don't have to create the JPGs before hand? I tried with text labels (<a>) but the changing colors and underlines annoyed me?
As you can probably tell, I'm... | [
0.4978742301464081,
-0.07309180498123169,
0.06448354572057724,
0.29032668471336365,
-0.314595103263855,
-0.22070905566215515,
-0.1859525591135025,
0.08218689262866974,
-0.4202733039855957,
-0.821292519569397,
0.11284229159355164,
0.3969555199146271,
-0.3164645731449127,
-0.1742124110460281... | |
can use CSS to override the colors and underline styles of anchors, but it's easier IMO to just use images. PNG would be better than JPEG, because you can make PNG images transparent without artifacts. | [
0.1485978215932846,
-0.1780836284160614,
0.02222096174955368,
0.46127432584762573,
-0.4707162082195282,
0.035038672387599945,
-0.44722384214401245,
-0.1091144010424614,
-0.30408257246017456,
-0.5511174201965332,
-0.29526278376579285,
0.2899307608604431,
-0.370562881231308,
-0.2693206667900... | |
Given a point such as (0, 0, 0) and a vector like (x, y, z). What is the easiest way to align the negative Z-axis centered at (0, 0, 0) to point in the direction of this vector? Examples using OpenGL would be welcome, but not neccessary.
There's lots of different ways to rotate a coordinate-frame to point in a given di... | [
0.01004039403051138,
-0.08320712298154831,
0.37362179160118103,
-0.028777319937944412,
-0.29526105523109436,
0.04977631941437721,
-0.1400197148323059,
-0.07004645466804504,
-0.04915592446923256,
-0.5601447820663452,
0.0574873685836792,
0.612840473651886,
-0.2889494299888611,
-0.08409812301... | |
normalise( vector );
float rot_angle = acos( dot_product(target_dir,z_axis) );
if( fabs(rot_angle) > a_very_small_number )
{
vec3 rot_axis = normalise( cross_product(target_dir,z_axis) );
glRotatef( rot_angle, rot_axis.x, rot_axis.y, rot_axis.z );
}
``` | [
-0.2134724110364914,
-0.25493237376213074,
0.8337106704711914,
-0.4127315878868103,
-0.035588525235652924,
0.40902501344680786,
-0.11869776248931885,
-0.3249845504760742,
-0.09236574172973633,
-0.6103794574737549,
-0.24431787431240082,
0.5128679275512695,
-0.4500807523727417,
0.05569745600... | |
I am a little confused by the multitude of ways in which you can import modules in Python.
```
import X
import X as Y
from A import B
```
I have been reading up about scoping and namespaces, but I would like some practical advice on what is the best strategy, under which circumstances and why. Should imports happen... | [
0.7489413022994995,
0.2173600196838379,
-0.07933002710342407,
-0.32163843512535095,
-0.1807776540517807,
-0.28446584939956665,
-0.050708018243312836,
-0.11759436130523682,
-0.4925641119480133,
-0.2846199870109558,
-0.39789271354675293,
0.6977185010910034,
-0.32661277055740356,
0.0073338220... | |
the following rules.
We place imports at the beginning of the file, right after the main file's docstring, e.g.:
```
"""
Registry related functionality.
"""
import wx
# ...
```
Now, if we import a class that is one of few in the imported module, we import the name directly, so that in the code we only have to use t... | [
0.30514800548553467,
0.16149039566516876,
0.4177720248699188,
-0.019498439505696297,
0.12262820452451706,
-0.19692112505435944,
0.03840254992246628,
-0.37878739833831787,
-0.216230109333992,
-0.6481309533119202,
-0.4000523090362549,
0.6620882749557495,
-0.42333850264549255,
0.2003517001867... | |
as rarely as possible, because it makes searching for usage of a particular module or class difficult. Sometimes, however, you have to use it if you wish to import two classes that have the same name, but exist in different modules, e.g.:
```
from Queue import Queue
from main.core.MessageQueue import Queue as MessageQ... | [
0.10714074224233627,
-0.26593101024627686,
-0.0385761559009552,
0.0015927758067846298,
-0.19881635904312134,
-0.1309618502855301,
0.06585606187582016,
0.05512746423482895,
-0.7611638307571411,
-0.5624343156814575,
-0.31606876850128174,
0.22422845661640167,
-0.5199206471443176,
0.3229961991... | |
What is the difference between the CIL instructions "Call" and "Callvirt"?
`call` is for calling non-virtual, static, or superclass methods, i.e., the target of the call is not subject to overriding. `callvirt` is for calling virtual methods (so that if `this` is a subclass that overrides the method, the subclass versi... | [
0.026071593165397644,
-0.4878585934638977,
0.2507060468196869,
0.04639047756791115,
0.01190929301083088,
-0.21618175506591797,
0.10742884874343872,
-0.10338511317968369,
0.010034645907580853,
-0.1091930940747261,
-0.503978431224823,
0.7968941926956177,
-0.5429951548576355,
-0.0018133281264... | |
Through some bungling in creating and removing publications, I was left with a lot of obsolete publications which for some reason still remains in the Replication Monitor.
How do you remove these publications? It doesn't seem to have a clear way to remove them.
This is an old question of mine, but then again at least... | [
0.48889589309692383,
0.4429575502872467,
0.14325770735740662,
0.371044784784317,
0.02916630543768406,
-0.24751684069633484,
-0.07885541766881943,
0.4086684584617615,
-0.6383553147315979,
-0.4586419463157654,
0.4640377163887024,
0.12822529673576355,
-0.13759329915046692,
0.8974404335021973,... | |
the publication has to be the same type as the obsoleted one, but it works.
**UPDATE:** Okay, the publication type and database name is important, otherwise the newly created publication will be considered as a different publication. Kinda obvious, but now I'm sure of it. | [
0.44216006994247437,
0.29409804940223694,
0.23311683535575867,
0.2322675734758377,
0.15664300322532654,
-0.47532129287719727,
0.3599283993244171,
0.34397947788238525,
-0.19528596103191376,
-0.5461058616638184,
-0.038364116102457047,
0.3171308636665344,
0.021909154951572418,
0.1876988857984... | |
How to check reliably if a SoundChannel is still playing a sound?
For example,
```
[Embed(source="song.mp3")]
var Song: Class;
var s: Song = new Song();
var ch: SoundChannel = s.play();
// how to check if ch is playing?
```
I've done a little research and I can't find a way to query any object to determine if a s... | [
0.12850253283977509,
0.012196961790323257,
0.22670051455497742,
-0.05396520346403122,
0.05168066546320915,
-0.3142602741718292,
0.1397499293088913,
-0.489614337682724,
-0.0858318954706192,
-0.5338828563690186,
-0.30384114384651184,
0.9615062475204468,
-0.2987847924232483,
0.047913998365402... | |
private var Song:Class;
private var s:Song;
private var ch:SoundChannel;
private var isSoundPlaying:Boolean;
public function SoundPlayer()
{
s = new Song();
play();
}
public | [
-0.15945450961589813,
-0.301163911819458,
0.3026007413864136,
-0.12086296826601028,
0.1431855410337448,
0.3111591041088104,
0.2596648633480072,
-0.24258749186992645,
-0.1527472585439682,
-0.4730217158794403,
-0.36811110377311707,
0.7108030915260315,
-0.16408859193325043,
0.4747448265552521... | |
function play():void
{
if(!isPlaying)
{
ch = s.play();
ch.addEventListener(
Event.SOUND_COMPLETE, | [
0.428423136472702,
-0.37349048256874084,
0.5038834810256958,
-0.3698957860469818,
0.4189909100532532,
-0.15405988693237305,
0.2500978410243988,
-0.447158545255661,
-0.23688405752182007,
-0.5426840782165527,
-0.2886248826980591,
0.7855789065361023,
-0.3683856725692749,
0.09458011388778687,
... | |
handleSoundComplete);
isSoundPlaying = true;
}
}
public function stop():void
{
if(isPlaying)
{ | [
-0.24712729454040527,
-0.3279378116130829,
0.40311455726623535,
-0.1744738221168518,
0.1666029393672943,
0.06426162272691727,
0.27010378241539,
-0.13435235619544983,
-0.1971704512834549,
-0.19302572309970856,
-0.31502196192741394,
0.5602326393127441,
-0.44429999589920044,
-0.19468821585178... | |
ch.stop();
isSoundPlaying = false;
}
}
private function handleSoundComplete(ev:Event):void
{
isSoundPlaying = false;
}
}
}
``` | [
-0.045930832624435425,
0.011415749788284302,
0.1383437067270279,
-0.22611737251281738,
-0.012798335403203964,
0.14004690945148468,
0.2627650201320648,
-0.05905300751328468,
-0.24388282001018524,
-0.20763292908668518,
-0.286283016204834,
0.5835809707641602,
-0.4216140806674957,
0.0677314922... | |
*With the popularity of the Apple iPhone, the potential of the Microsoft [Surface](http://www.microsoft.com/surface/index.html), and the sheer fluidity and innovation of the interfaces pioneered by Jeff Han of [Perceptive Pixel](http://link.brightcove.com/services/link/bcpid713271701/bclid713073346/bctid709364416) ...*... | [
0.30169689655303955,
0.1173643097281456,
0.06045207381248474,
0.2440212219953537,
-0.15571056306362152,
0.3799947202205658,
-0.06560294330120087,
0.17756183445453644,
-0.3613063395023346,
-0.7708578705787659,
0.25210636854171753,
0.46748122572898865,
0.03818836435675621,
-0.039555456489324... | |
You might also want to explore the [ACM CHI Conference](http://www.chi2008.org/). I used to know some of the people who worked on zooming interfaces; the [Human Computer Interaction Lab an the University of Maryland](http://www.cs.umd.edu/hcil/research/) also has a bunch of links which you may find interesting.
Lastly... | [
0.7134937047958374,
-0.017823781818151474,
-0.20053865015506744,
0.5378950834274292,
-0.09357912093400955,
-0.2367287576198578,
-0.3927903175354004,
0.1824025958776474,
-0.2555079162120819,
-0.7108805179595947,
0.267784059047699,
0.48178473114967346,
0.397301584482193,
0.17539367079734802,... | |
for the most part, replaced by mice. Good design sometimes goes against naive intuition (mine anyway). There is a nice [rant](http://www.useit.com/alertbox/981115.html) on this topic with regard to 3d graphics on [useit.com](http://useit.com). | [
0.5493436455726624,
0.20967406034469604,
0.027630701661109924,
0.01359363179653883,
-0.19412212073802948,
-0.07634848356246948,
0.20926621556282043,
0.4129664897918701,
-0.14265376329421997,
-0.5759298801422119,
-0.04275550693273544,
0.37096089124679565,
-0.1806606501340866,
0.080434553325... | |
I'm using:
```
FileInfo(
System.Environment.GetFolderPath(
System.Environment.SpecialFolder.ProgramFiles)
+ @"\MyInstalledApp"
```
In order to determine if a program is detected on a users machine (it's not ideal, but the program I'm looking for is a right old kludge of a MS-DOS application, and I c... | [
0.2504822611808777,
0.26633667945861816,
0.39160820841789246,
-0.06573940068483353,
0.2672625184059143,
-0.4380907416343689,
0.5164226293563843,
0.09485998004674911,
-0.12647706270217896,
-0.9123519659042358,
-0.048603713512420654,
0.672414243221283,
-0.24407219886779785,
0.099013328552246... | |
Program Files x86 without hard wiring "C:\Program Files (x86)"?
The function below will return the x86 `Program Files` directory in all of these three Windows configurations:
* 32 bit Windows
* 32 bit program running on 64 bit Windows
* 64 bit program running on 64 bit windows
```
static string ProgramFilesx86()
{
... | [
0.033132169395685196,
0.18966826796531677,
0.4140768051147461,
-0.09538587927818298,
0.2868713140487671,
0.21313174068927765,
0.28710228204727173,
-0.128876194357872,
-0.2191215455532074,
-0.5380869507789612,
-0.4501476287841797,
0.811515748500824,
-0.47992926836013794,
0.17285537719726562... | |
I asked before about pixel-pushing, and have now managed to get far enough to get noise to show up on the screen. Here's how I init:
```
CGDataProviderRef provider;
bitmap = malloc(320*480*4);
provider = CGDataProviderCreateWithData(NULL, bitmap, 320*480*4, NULL);
CGColorSpaceRef colorSpaceRef;
colorSpaceRef = CGColor... | [
0.007875452749431133,
-0.1065831258893013,
0.817083477973938,
-0.1586374044418335,
-0.1975889950990677,
0.46389007568359375,
0.3059154152870178,
-0.5141981244087219,
-0.19515876471996307,
-0.9098192453384399,
0.003899077884852886,
0.6124171614646912,
-0.07332483679056168,
0.033624198287725... | |
chip?
The slowness is almost certainly in the noise generation. If you run this in Instruments you'll probably see that a ton of time is spent sitting in your loop.
Another smaller issue is your colorspace. If you use the screen's colorspace, you'll avoid a colorspace conversion which is potentially expensive.
If yo... | [
0.5083871483802795,
0.004724043887108564,
0.12184762954711914,
0.2979789972305298,
0.227933868765831,
-0.024211950600147247,
-0.04054531455039978,
-0.3401433825492859,
-0.1975516825914383,
-0.6031138896942139,
0.20563286542892456,
0.7084020972251892,
-0.11173445731401443,
-0.08528050780296... | |
"here") that shows how to compute it.
And yeah, for raw performance, OpenGL. | [
-0.1682632714509964,
-0.07823939621448517,
0.39520278573036194,
0.5439229011535645,
-0.14432565867900848,
-0.3368017077445984,
-0.03794641047716141,
0.307391494512558,
-0.19990725815296173,
-0.45615100860595703,
-0.14144308865070343,
0.6860619783401489,
-0.02760559879243374,
-0.10617874562... | |
I have an intranet application that needs contact information for various locations on our campus that are served by our IT lab support organization. We have an enterprise directory that contains contact information so I'm not keeping the actual contact information in the database, but rather an immutable identifier th... | [
0.5194191932678223,
0.4060778319835663,
0.2048889398574829,
0.1195678561925888,
0.4696130156517029,
-0.24809134006500244,
-0.08189824223518372,
0.20930197834968567,
-0.24660876393318176,
-0.7854936122894287,
0.07123062759637833,
0.2737422287464142,
0.35192766785621643,
0.23043575882911682,... | |
not the id that I will store in the database. Directory lookups are most easily performed using the person's Active Directory login id. What I will be using is called the Master Records Unique ID.
My question is: where is the most reasonable place to do the translation from MRUID to Active Directory login id for the l... | [
0.34651464223861694,
0.16083985567092896,
0.5495601892471313,
0.10355465114116669,
-0.03656072914600372,
-0.19479942321777344,
0.4395805895328522,
-0.1839989274740219,
-0.2397126853466034,
-0.9622586369514465,
-0.2136990875005722,
0.29443615674972534,
-0.18547841906547546,
0.39682114124298... | |
I would migrate the helper class to a shared web controls library.
I considered putting the code in the data or business layer, but opted not to because of the caching. How and what you cache seems to be more a function of the application rather than these other layers.
I'd be interested in other opinions and ideas t... | [
0.1784989982843399,
-0.187427818775177,
-0.04871803894639015,
0.2374231219291687,
-0.07008752971887589,
-0.03289997950196266,
0.062423888593912125,
-0.14429421722888947,
-0.00504025723785162,
-0.7299413084983826,
-0.20624500513076782,
0.43996375799179077,
-0.22288839519023895,
0.0196854230... | |
class library that has a dependency on the system.web namespace.
Specifically, it will make use of HttpContext.Current to interoperate with the web site that is hosting the library. I'm not sure, but I generally think of this as a business layer assembly, but one that assumes it is hosted in a web context.
I keep my... | [
0.1099177896976471,
-0.34984368085861206,
0.20006591081619263,
0.25644129514694214,
-0.20223408937454224,
-0.11816049367189407,
0.012309759855270386,
0.009878307580947876,
-0.08618977665901184,
-0.9063281416893005,
0.037180908024311066,
0.35820430517196655,
-0.12335871160030365,
0.33260175... | |
you to interact with the asp.net cache API and related stuff. But it also keeps the code portable for use in more than one web application too.
Generally this web-dependent assembly is also where my HttpModules and HttpHandlers live too.
Keep in mind though that "layers" are logical concepts, not physical ones. Ther... | [
0.6610095500946045,
-0.10176922380924225,
-0.003841245314106345,
0.3957572281360626,
-0.10361704975366592,
-0.11707508563995361,
0.21036548912525177,
0.06065136194229126,
-0.3250780999660492,
-0.9887118339538574,
-0.01950039528310299,
0.12804101407527924,
0.04522091522812843,
0.10775448381... | |
In Visual Studio if I define a class to implement an interface e.g.
```
class MyObject : ISerializable {}
```
I am able to right click on ISerializable, select "*Implement Interface*" from the context menu and see the appropriate methods appear in my class definition.
```
class MyObject : ISerializable {
#regio... | [
-0.02753218449652195,
-0.44879037141799927,
0.5315607190132141,
-0.009490934200584888,
0.19732055068016052,
-0.36207807064056396,
-0.004067912232130766,
0.05708480626344681,
-0.15908685326576233,
-1.1540353298187256,
-0.5164209008216858,
0.5083656907081604,
-0.2241276353597641,
-0.11340903... | |
anything like this functionality available in Xcode on the Mac? I would like to be able to automatically implement Protocols in this way. Maybe with the optional methods generated but commented out.
I have not seen that feature in Xcode.
But it seems like someone could write a new user script called "Place Implementor ... | [
0.5109685063362122,
-0.0328749381005764,
-0.04413023963570595,
0.19590264558792114,
-0.01001126691699028,
-0.5073126554489136,
0.20589546859264374,
-0.0019695546943694353,
-0.2302977293729782,
-0.8627400994300842,
0.25387319922447205,
0.4953469932079315,
-0.3830625116825104,
-0.07200700789... | |
I just played with Java file system API, and came down with the following function, used to copy binary files. The original source came from the Web, but I added try/catch/finally clauses to be sure that, should something wrong happen, the Buffer Streams would be closed (and thus, my OS ressources freed) before quiting... | [
0.27649298310279846,
-0.026344437152147293,
0.458793580532074,
-0.262704998254776,
0.3123689591884613,
0.01713503897190094,
0.2402823269367218,
-0.0905856043100357,
-0.06281249970197678,
-0.5612593293190002,
0.05574101209640503,
0.4462546110153198,
-0.8287721276283264,
0.2671903967857361,
... | |
try
{
int c;
while((c = oSBuffer.read()) != -1) // could throw a IOException
{
oDBuffer.write(c); // could throw a IOException
}
}
finally
{
oDBuffer.close(); | [
0.11596817523241043,
-0.0787152349948883,
0.5485574007034302,
-0.33460134267807007,
0.2828785479068756,
-0.06389839947223663,
0.313881516456604,
-0.2507186830043793,
0.3268651068210602,
-0.5760027766227722,
-0.14920468628406525,
0.6587831974029541,
-0.5062923431396484,
-0.03548303991556167... | |
// could throw a IOException
}
}
finally
{
oSBuffer.close(); // could throw a IOException
}
}
```
As far as I understand it, I cannot put the two `close()` in the finally clause because the first `close()` could well throw, and then, the second would not be executed.
I know C# has the *Dispos... | [
0.4315809905529022,
0.15733425319194794,
0.47653308510780334,
-0.39050760865211487,
0.01105127390474081,
-0.3219591975212097,
0.14940480887889862,
-0.08900430053472519,
0.06426496058702469,
-0.6154671907424927,
-0.21501265466213226,
0.5677896738052368,
-0.33366450667381287,
0.0910977944731... | |
BufferedInputStream oSBuffer(oSStream, 4096);
BufferedOutputStream oDBuffer(oDStream, 4096);
int c;
while((c = oSBuffer.read()) != -1) // could throw a IOException
{
oDBuffer.write(c); // could throw a IOException
}
// I don't care about resources, as RAII handle them for me
}
```
I am mi... | [
0.11244088411331177,
0.1264478713274002,
0.2794957756996155,
-0.23486419022083282,
0.15137219429016113,
-0.011889908462762833,
0.37701788544654846,
0.02128845453262329,
-0.20170152187347412,
-0.6403195261955261,
0.09572834521532059,
0.4175320267677307,
-0.5584859848022461,
0.08456388860940... | |
I saw both the question and all the answers decreased by one point in a couple of minutes? Is someone enjoying himself too much while remaning anonymous?**
EDIT 2: **McDowell** offered a very interesting link I felt I had to mention here:
<http://illegalargumentexception.blogspot.com/2008/10/java-how-not-to-make-mess-... | [
0.31951624155044556,
-0.08122046291828156,
0.13478203117847443,
-0.03283647447824478,
-0.14749236404895782,
-0.23560252785682678,
0.5422525405883789,
-0.11031468957662582,
-0.32093966007232666,
-0.29612332582473755,
0.03874082863330841,
0.48627573251724243,
-0.536797821521759,
0.2385008782... | |
streams. Be careful doing this for these reasons: [Java: how not to make a mess of stream handling](http://illegalargumentexception.blogspot.com/2008/10/java-how-not-to-make-mess-of-stream.html)*
---
Java 7 introduces *try-with-resources*:
```
/** transcodes text file from one encoding to another */
public static vo... | [
0.3527087867259979,
-0.24323444068431854,
0.054511915892362595,
0.3225666880607605,
0.12728245556354523,
-0.19967123866081238,
0.2899135947227478,
-0.05834845453500748,
-0.26652780175209045,
-0.6298633813858032,
-0.20696699619293213,
0.423385888338089,
-0.8089137077331543,
0.28992772102355... | |
throws IOException {
try (InputStream in = new FileInputStream(source);
Reader reader = new InputStreamReader(in, srcEncoding);
OutputStream out = new FileOutputStream(target);
Writer writer = new OutputStreamWriter(out, tgtEncoding)) {
char[] buffer = new char[1024]; | [
-0.11529175192117691,
-0.2604278028011322,
0.1924266666173935,
-0.320296972990036,
0.04095505550503731,
0.4648013412952423,
0.3069688081741333,
-0.3160274922847748,
0.10912460833787918,
-0.6169388890266418,
-0.11350817233324051,
0.5474956631660461,
-0.37529024481773376,
0.02326790802180767... | |
int r;
while ((r = reader.read(buffer)) != -1) {
writer.write(buffer, 0, r);
}
}
}
```
[`AutoCloseable`](http://download.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html) types will be automatically closed:
```
public class Foo {
public static void main(String[] args) {
... | [
-0.15262983739376068,
0.0724966824054718,
0.6370009183883667,
-0.35363417863845825,
0.268869549036026,
0.30202794075012207,
0.34815967082977295,
-0.25880107283592224,
-0.12369069457054138,
-0.18322136998176575,
-0.433538556098938,
0.4867387115955353,
-0.6063374876976013,
0.3425422906875610... | |
new CloseTest()) {}
}
}
``` | [
0.0076583377085626125,
-0.06323962658643723,
0.608916163444519,
0.04050812870264053,
0.2974904775619507,
-0.1232055127620697,
0.19311444461345673,
0.02355780079960823,
-0.21736641228199005,
-0.5681260824203491,
-0.29492491483688354,
0.42759257555007935,
-0.25313517451286316,
0.647208750247... | |
In a [related question](https://stackoverflow.com/questions/194272), my team is about to (hopefully) start using LINQ, and I'd like to take advantage of anonymous types. What is the best way to mix VB.NET's Option Strict (which we've been using through the life of the project) and the new Option Infer directives?
Optio... | [
0.37780022621154785,
-0.318844199180603,
0.11620575934648514,
0.12041865289211273,
0.061285436153411865,
-0.3161991834640503,
-0.10903431475162506,
-0.10204722732305527,
-0.242336243391037,
-0.5048843026161194,
-0.09387550503015518,
0.5997262001037598,
-0.1760888397693634,
-0.0351351425051... | |
settings are used. | [
0.221238374710083,
0.03121001087129116,
0.3066425025463104,
0.0889694020152092,
0.5713104009628296,
-0.05040961131453514,
-0.02237536944448948,
0.14097553491592407,
-0.04219437763094902,
-0.7429218888282776,
-0.41569197177886963,
0.6997568607330322,
0.018719831481575966,
-0.140830993652343... | |
The existing application is in C#. During startup the application calls a virtual method to make changes to the database (for example a new revision may need to calculate a new field or something). An open OleDb connection is passed into the method.
I need to change a field width. The ALTER TABLE statement is working... | [
0.07251599431037903,
-0.013907262124121189,
0.7130496501922607,
0.1436983197927475,
0.20666803419589996,
-0.17592503130435944,
0.1755668818950653,
0.020765453577041626,
-0.24721074104309082,
-0.6169820427894592,
-0.08869575709104538,
0.5921413898468018,
-0.4964001476764679,
0.4308566749095... | |
completely.
But you could query the table for 0 rows (SELECT 1 FROM myTable WHERE 1= 0)
And you could use recordet's field collection, refer to that field by name or index
and use field's property like size, type etc.
Does that help? | [
-0.046859920024871826,
-0.03581834211945534,
0.07340828329324722,
0.3335117697715759,
0.09537508338689804,
-0.038389403373003006,
-0.2090383768081665,
-0.11482630670070648,
-0.42851537466049194,
-0.39789438247680664,
0.10895881801843643,
0.3440214991569519,
-0.1448564976453781,
0.214731618... | |
I'm experimenting with internationalization by making a Hello World program that uses properties files + ResourceBundle to get different strings.
Specifically, I have a file "messages\_en\_US.properties" that stores "hello.world=Hello World!", which works fine of course.
I then have a file "messages\_ja\_JP.propertie... | [
0.2772867977619171,
0.26584288477897644,
0.11605620384216309,
0.023504002019762993,
-0.3173331618309021,
-0.1845162808895111,
0.38464275002479553,
0.21812158823013306,
-0.19446246325969696,
-0.8170648217201233,
-0.02648179419338703,
0.4975326955318451,
-0.01474098488688469,
0.2988609075546... | |
encoding with the Japanese string as-is for the value. Something I read indicates that Java expects a properties file to be in the native encoding of the system...? It didn't work either way.
* The file in default encoding (ISO-8859-1) and the value stored as escaped Unicode created by the native2ascii program included... | [
-0.08515343815088272,
0.16420844197273254,
-0.04267824441194534,
0.06423535943031311,
-0.10496319830417633,
0.18184290826320648,
0.37954220175743103,
0.06496532261371613,
-0.0705580785870552,
-0.9695773720741272,
-0.04783939942717552,
0.3890177309513092,
-0.4467240273952484,
0.005345328710... | |
from my operating system's default encoding each time, and as such not producing the correct escaped Unicode string.
Running native2ascii with the "-encoding *encoding\_name*" option where *encoding\_name* was the name of the source file's encoding (SHIFT-JIS in this case) produced the correct result and everything wo... | [
0.09137631952762604,
0.07797197997570038,
-0.006675418931990862,
-0.21865972876548767,
-0.12964968383312225,
0.13460808992385864,
0.4805063009262085,
-0.12871214747428894,
-0.017157845199108124,
-1.092737078666687,
0.00491455290466547,
0.5568088889122009,
-0.3353957533836365,
-0.0697710588... | |
files of the same name in the output folder. | [
0.024154169484972954,
0.1364881843328476,
0.23622654378414154,
0.2963144779205322,
0.0312851183116436,
0.04705456644296646,
-0.3350304067134857,
0.12592853605747223,
-0.30166569352149963,
-0.504847526550293,
-0.3786691129207611,
0.25349345803260803,
-0.14147275686264038,
0.2089411914348602... | |
In a language where both are available, would you prefer to see an instance constructor or a static method that returns an instance?
For example, if you're creating a `String` from a `char[]`:
1. `String.FromCharacters(chars);`
2. `new String(chars);`
In [Effective Java, 2nd edition](https://rads.stackoverflow.com/am... | [
-0.017098965123295784,
0.1899702548980713,
-0.40047353506088257,
-0.34448710083961487,
-0.05263320729136467,
0.03444875031709671,
0.32070374488830566,
-0.31440770626068115,
-0.20999376475811005,
-0.3768768906593323,
-0.09855401515960693,
0.4292181432247162,
-0.5413581132888794,
-0.25083094... | |
corollary of the first - you can have different factory methods with the same parameter list
* You can return null for "potentially expected failure" cases whereas a constructor will *always* either return a value or throw an exception
* You can return a type other than the declared (e.g. return a derived class)
* You ... | [
0.3895808458328247,
-0.15574154257774353,
-0.11932323127985,
-0.06254065781831741,
-0.3648676872253418,
-0.0556693896651268,
0.5343698263168335,
-0.24254333972930908,
-0.4950123131275177,
-0.6042381525039673,
0.036083366721868515,
0.5714995861053467,
-0.47300654649734497,
0.403533011674881... | |
recently](https://stackoverflow.com/questions/194484/whats-the-strangest-corner-case-youve-seen-in-c-or-net))
* You need to make appropriate constructors available for subclasses
* In C# 3, constructor calls are able to set fields/properties in a compact manner with object initializer expressions; the feature doesn't a... | [
-0.0044549922458827496,
-0.04287176951766014,
0.21570712327957153,
0.06816939264535904,
-0.06688057631254196,
-0.3553467094898224,
0.0366038978099823,
-0.040061235427856445,
-0.5240778923034668,
-0.3514412045478821,
-0.15864481031894684,
0.38913771510124207,
-0.1482209861278534,
0.25392082... | |
I got a text file with a couple of lines and I am looking for a string in this file. I need to pass following command line parameters to the program:
- file path
- the string I am looking for
- maximum number of processes the program is allowed to "fork" in order to complete this task.
How to such a program ... | [
0.5642327070236206,
0.1466427892446518,
0.32861268520355225,
0.12320514768362045,
0.15418894588947296,
0.3015928864479065,
0.25667718052864075,
0.21234482526779175,
-0.3609849214553833,
-0.4062619209289551,
0.25558632612228394,
0.3360113799571991,
0.04809250310063362,
0.26631131768226624,
... | |
(or not, see the comments, as this may be system specific...).
* You may not see the speed increase you are hoping for due to disk access and/or cache miss patterns.
You might be able to beat both issues by memory mapping the file (well you still risk an increased cache miss rate)...
---
How badly do you need this? ... | [
0.2602716386318207,
0.13431616127490997,
0.21717476844787598,
0.45262643694877625,
0.1458626389503479,
-0.2337711900472641,
0.17637598514556885,
0.40148285031318665,
-0.3595367670059204,
-0.7700763940811157,
-0.014833882451057434,
0.779284656047821,
0.06000441312789917,
0.0821744054555893,... | |
recently I was given the task to discover a C# solution I have never seen before, and give suggestions on refactoring it. I think I will use NDepend (for the first time ever) to see the overall picture, and also to check a lot of code metrics to figure out what could be refactored. NDepend is pretty good at showing the... | [
0.20299412310123444,
0.11051545292139053,
-0.06328011304140091,
0.14592835307121277,
-0.15472036600112915,
-0.25434234738349915,
0.2034439891576767,
0.13669098913669586,
-0.4504469633102417,
-0.6560671329498291,
-0.03089766763150692,
0.42828264832496643,
0.08959876745939255,
0.245122149586... | |
logical design documentation and the code is poorly commented.)
Code Discovery is much more easy with NDepend. This tool provides a top-down approach on dependencies and layering between assemblies, namespaces and classes. This is done with some graph and depednencies matrix generated from the code.
You'll also get de... | [
0.11216138303279877,
-0.18225190043449402,
-0.014364738017320633,
0.5186055898666382,
-0.2751806080341339,
-0.25567880272865295,
-0.024934059008955956,
-0.32324352860450745,
-0.20808440446853638,
-0.7543196082115173,
0.13019150495529175,
0.7111247777938843,
0.13883258402347565,
0.171855553... | |
I have been looking at various dependency injection frameworks for .NET as I feel the project I am working on would greatly benefit from it. While I think I have a good grasp of the *capabilities* of these frameworks, I am still a little unclear on how best to introduce them into a large system. Most demos (understanda... | [
0.399271160364151,
-0.1088443398475647,
-0.3120940029621124,
0.22536936402320862,
-0.08458845317363739,
0.14200249314308167,
-0.018987445160746574,
0.13535554707050323,
0.0263325497508049,
-0.8413342833518982,
0.11543771624565125,
0.7860352993011475,
-0.22876191139221191,
0.094732500612735... | |
parameters in their constructor. Would it be better to use a static instance of the DI container to get these when they are needed?
```
MyClass(ILog log, IAudit audit, IPermissions permissions, IApplicationSettings settings)
// ... versus ...
ILog log = DIContainer.Get<ILog>();
```
**Second**, how do you approach de... | [
0.37652966380119324,
-0.16344481706619263,
-0.06314174085855484,
0.23315906524658203,
-0.12974826991558075,
-0.08374139666557312,
0.10821332037448883,
-0.2739342153072357,
-0.1454133242368698,
-0.6200617551803589,
0.02223045751452446,
0.7055019736289978,
-0.4683481454849243,
0.178843051195... | |
static way of getting directly to the DI Container and ask for it at the point it is needed?
**Third**, suppose you have a large Windows Forms application, in which the top level GUI component (e.g. MainForm) is the parent of potentially hundreds of sub-panels or modal forms, each of which may have several dependencie... | [
0.19205287098884583,
-0.42175519466400146,
0.3588891923427582,
0.3099595904350281,
-0.2216230034828186,
0.05864713713526726,
0.0018696142360568047,
0.14692242443561554,
-0.44103872776031494,
-0.42252808809280396,
-0.019584953784942627,
0.14160381257534027,
-0.35166308283805847,
0.194809123... | |
moment you create MainForm, wasting time and memory in the process?
**First:** Add the simple dependencies to your constructor as needed. There is no need to add every type to every constructor, just add the ones you need. Need another one, just expand the constructor. Performance should not be a big thing as most of t... | [
0.2700982689857483,
-0.5925804376602173,
0.027289029210805893,
0.13950645923614502,
-0.07079862058162689,
-0.21524958312511444,
0.2359541654586792,
0.05547836050391197,
-0.013344870880246162,
-0.9875183701515198,
-0.2732878029346466,
0.5196109414100647,
-0.21393214166164398,
0.108624391257... | |
for the moment)
```
IUnityContainer container = new UnityContainer();
container.RegisterInstance<IUnityContainer>(container);
```
This way you can just add a dependency on IUnityContainer and use that to create expensive or seldom needed objects. The main advantage is that it is much easier when unit testing as ther... | [
0.14399124681949615,
-0.3959085941314697,
0.3252051770687103,
0.003838054370135069,
-0.058793943375349045,
-0.13283264636993408,
0.16961540281772614,
-0.45893269777297974,
-0.008944276720285416,
-0.8676605224609375,
-0.06464503705501556,
0.7555552124977112,
-0.34044063091278076,
0.15045480... | |
said the startup cost and memory consumption of the mainform would go through the roof if you create everything at startup time. | [
0.33528614044189453,
0.023311380296945572,
-0.1342461258172989,
0.2012096792459488,
0.07348759472370148,
0.16775564849376678,
0.1450500190258026,
0.08017606288194656,
0.004613347351551056,
-0.14409850537776947,
-0.19092117249965668,
0.34950143098831177,
0.32025203108787537,
0.1430829465389... | |
I have to implement the VinPower application. They offer a Java version, a C dll and an ActiveX dll, if anyone has an idea on where I could begin, I'd appreciate it.
First step would be to put the VinPOWER Jar file into your lib directory, then restart the server.
(Or, you can put the file in a different directory an... | [
0.7394251227378845,
0.22835254669189453,
0.5661258101463318,
-0.02593846060335636,
-0.27725401520729065,
-0.3011733591556549,
0.19378778338432312,
-0.3127410411834717,
0.11979217082262039,
-0.8805198073387146,
0.5542682409286499,
0.7478245496749878,
0.007994582876563072,
-0.155139535665512... | |
This might be an odd question, but when I scale my image in C# I need it to be pixelated and not anti-aliased. Just like in MSpaint when you scale.
I hope images anti-alias by default in C#, or else I changed something I didn't want to.
I've tried playing around with the `Graphics.InterpolationMode` but no luck there... | [
0.19044335186481476,
-0.1819753497838974,
0.7388778924942017,
0.042651303112506866,
-0.07587405294179916,
0.06705506891012192,
0.1556379348039627,
-0.28733178973197937,
-0.39331796765327454,
-0.751105785369873,
0.07286914438009262,
0.6888332366943359,
-0.43849360942840576,
-0.1701063066720... | |
= 1.0f;
InterpolationMode m_interpolationMode;
...
////////////////////////////////////////////////////////
public ZoomPanPicBox()
{
//Double buffer the control
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.Use... | [
0.2857288420200348,
-0.39552709460258484,
0.6333461999893188,
-0.29184189438819885,
0.29348286986351013,
0.16250798106193542,
0.44253474473953247,
-0.4100255072116852,
-0.2027125209569931,
-0.5265052914619446,
-0.2747603952884674,
0.665398895740509,
-0.7742871642112732,
-0.3994173407554626... | |
{
base.OnPaintBackground(e);
return;
}
//Set up a zoom matrix
Matrix mx = new Matrix(m_zoom,0,0,m_zoom,0,0);
//now translate the matrix into position for the scrollbars
mx.Translate(this.AutoScrollPosition.X / m_zoom, this.AutoScrollPosition.Y / m_zoom); | [
-0.0985996350646019,
-0.12403392791748047,
0.8411701321601868,
-0.3123664855957031,
0.18792985379695892,
0.20094218850135803,
0.21536317467689514,
-0.30242663621902466,
0.059977807104587555,
-0.6077712774276733,
-0.2211814671754837,
0.7114594578742981,
-0.45218390226364136,
-0.144545435905... | |
//use the transform
e.Graphics.Transform = mx;
//and the desired interpolation mode
e.Graphics.InterpolationMode = m_interpolationMode;
//Draw the image ignoring the images resolution settings.
e.Graphics.DrawImage(m_image,new Rectangle(0,0,this.m_image.Width,this.m_image.Heigh... | [
0.09746647626161575,
-0.13987651467323303,
0.600364089012146,
-0.26562342047691345,
-0.11369704455137253,
0.24136795103549957,
0.37414395809173584,
-0.35472342371940613,
-0.24231268465518951,
-0.7922700643539429,
-0.05300132930278778,
0.6728087663650513,
-0.32906779646873474,
-0.0713214948... | |
I am a heavy command line user and use the `find` command extensively in my build system scripts. However on Mac OS X when I am not concentrating I often get output like this:
```
$ find -name \*.plist
find: illegal option -- n
find: illegal option -- a
find: illegal option -- m
find: illegal option -- e
find: *.plist... | [
0.17046669125556946,
0.29798078536987305,
0.16613687574863434,
-0.2682865262031555,
0.14672599732875824,
-0.10143042355775833,
0.17431768774986267,
0.10474684834480286,
-0.2732228934764862,
-0.7477763891220093,
0.050223737955093384,
0.7747794389724731,
-0.43361803889274597,
0.0153855225071... | |
the same time, so it's of great benefit to me to have all my tools behave the same. I tried writing a bash `find` function that added "./" if I forgot, but I failed. Thanks for your help. :)
If you can't discipline yourself to use `find` 'correctly', then why not install GNU `find` (from `findutils`) in a directory on ... | [
0.5418462753295898,
0.21462009847164154,
0.1253417283296585,
0.2693452835083008,
0.24059364199638367,
-0.4355626404285431,
0.13090158998966217,
-0.007121779024600983,
-0.2916453778743744,
-0.4408051371574402,
-0.025317421182990074,
0.8978999853134155,
-0.11645117402076721,
0.08741295337677... | |
personal `bin` directory for many years - but eventually removed it because I no longer used the functionality. (My 'cp.sh' was written in 1987 and edited twice, in 1990 and 1997, as part of changes to version control system notations. I think I removed it around 1998. The primary problem with the script is that `cp fi... | [
-0.07259398698806763,
0.36638355255126953,
0.7276747226715088,
-0.05691991746425629,
0.04747224971652031,
-0.10085868090391159,
0.08335700631141663,
0.002879526698961854,
-0.06108948215842247,
-0.4984276294708252,
0.19471314549446106,
0.5217581391334534,
-0.17610234022140503,
0.29002064466... | |
directory, then adjust the command line arguments to include dot ahead of the rest of the command. That will be confusing if you ever type:
```
~/bin/find /non-existent/directory -name '*.plist' -print
```
because the non-existent directory isn't a directory and the script will add dot to the command line -- the sor... | [
0.20720121264457703,
0.0035418393090367317,
0.8438149690628052,
-0.16414156556129456,
0.44063499569892883,
0.15143315494060516,
0.10408066213130951,
0.27354660630226135,
-0.31581738591194153,
-0.8039350509643555,
-0.08030369132757187,
0.5847467184066772,
-0.37744298577308655,
0.21482774615... | |
If I have a method such as:
```
private function testMethod(param:string):void
{
// Get the object that called this function
}
```
Inside the testMethod, can I work out what object called us? e.g.
```
class A
{
doSomething()
{
var b:B = new B();
b.fooBar();
}
}
class B
{
fooBar()
{
// Can I... | [
0.3061726689338684,
0.08001526445150375,
0.11583608388900757,
-0.08693239837884903,
0.007563549093902111,
-0.019621528685092926,
0.3344476819038391,
-0.4558461904525757,
0.1321113407611847,
-0.45025330781936646,
-0.19955281913280487,
0.6833663582801819,
-0.183675155043602,
0.19300456345081... | |
you want. Although the arguments object is still available in AS3 the caller property was removed from AS3 (and therefore Flex 3) so there is no direct way you can do what you want. It is also recommeded that you use the [...rest parameter](<http://livedocs.adobe.com/flex/3/langref/statements.html#..._(rest)_parameter)... | [
0.12310346215963364,
-0.17373909056186676,
0.5086888670921326,
-0.10545121878385544,
-0.2934940755367279,
-0.0015773765044286847,
0.4756324887275696,
-0.646525502204895,
-0.18264426290988922,
-0.21003210544586182,
-0.1396392434835434,
0.836456298828125,
-0.2809227406978607,
-0.244481921195... | |
for more details.
The basic idea from the blog post is you throw an Error and then catch it immediately and then parse the stack trace. Ugly, but it may work for you.
code from the blog post:
```
var stackTrace:String;
try { throw new Error(); }
catch (e:Error) { stackTrace = e.getStackTrace(); }
var lines:Array ... | [
-0.040702734142541885,
-0.30450329184532166,
0.4020549952983856,
-0.04600024223327637,
0.024807056412100792,
-0.0799718052148819,
0.485007643699646,
-0.43238380551338196,
-0.10831901431083679,
-0.5099814534187317,
-0.09601480513811111,
0.5614106059074402,
-0.4780905246734619,
-0.0052310344... | |
line = matches[2].split(':')[2];
}
else
{
path = (lines[2] as String).substring(4);
}
trace(path + (line != -1 ? '[' + line.toString() + ']' : ''));
``` | [
-0.0302797332406044,
-0.6677508354187012,
0.49466514587402344,
-0.37698468565940857,
0.41319558024406433,
-0.016371404752135277,
0.5134803652763367,
-0.47776156663894653,
0.04683415964245796,
-0.5867377519607544,
-0.28805670142173767,
0.45450881123542786,
-0.556443989276886,
0.102712899446... | |
Is there any good tool or tool-chain that allows UML images in the .svg format to be created from a textual source file?
The reason for this question is that I want to automate the generation of these images to avoid having to manually create and update this set of images.
[UMLGraph](http://www.umlgraph.org/) is a pro... | [
0.2270773947238922,
-0.19384300708770752,
0.6522406935691833,
0.2570344805717468,
-0.33594268560409546,
-0.0819704681634903,
-0.12099140137434006,
0.16890297830104828,
-0.43859681487083435,
-0.5853105783462524,
0.09906895458698273,
0.10711986571550369,
-0.4754149913787842,
-0.0129025923088... | |
The GNU plotutils [pic2plot](http://www.gnu.org/software/plotutils/plotutils.html) program can
> then process the sequence diagram to
> create a PNG, PNM, (pseudo)GIF, **SVG**,
> AI, Postscript, CGM, FIG, PCL, HPGL,
> Regis, or TEK drawing. | [
0.25212424993515015,
-0.37489262223243713,
0.6492196917533875,
0.4193314015865326,
-0.27758142352104187,
0.13433191180229187,
-0.5285105109214783,
-0.33968108892440796,
-0.23444029688835144,
-0.6217361092567444,
-0.1484249085187912,
0.12117797881364822,
-0.5170946717262268,
-0.021595548838... | |
Has anyone got to some good code to zoom into an image using javascript?
I know I could just resize it etc but was being lazy and looking for something clever to zoom to different levels, move around when zoomed etc
This really depends on what quality you are after. If you need a hires hiquality image with detailed zo... | [
0.6025827527046204,
-0.05249880626797676,
0.24016635119915009,
0.33980703353881836,
-0.2387257069349289,
-0.10429101437330246,
0.27262982726097107,
0.20643262565135956,
-0.10789326578378677,
-0.5485607981681824,
0.08399031311273575,
0.8157605528831482,
0.054390352219343185,
-0.279910981655... | |
div absolutely positioned, offset for the area you want to view and sized as determined by your zoom level.
I would say you are probably after the first option. There are some tools already made [for this](http://blogs.zdnet.com/microsoft/?p=1252), I persoanlly havnt used any of the tools; I am sure othes will post li... | [
0.5594668388366699,
-0.11740948259830475,
0.6074448227882385,
-0.027677539736032486,
-0.2849165201187134,
-0.2309536635875702,
-0.014756164513528347,
-0.016537925228476524,
0.05834967643022537,
-0.5343480110168457,
0.06753341853618622,
0.7219724655151367,
-0.23182840645313263,
0.0475830733... | |
id) and the coordinates to zoom on and the target image size. I have the service load the image and crop and resize it (its more complicated than that as I have many optimizations and preparsing when the file is originally uploaded, such as multiple cross sections of the file for faster serving when zooming, but what I... | [
0.4844364523887634,
-0.005050673149526119,
0.6769037842750549,
0.10538601130247116,
-0.1543784737586975,
-0.1093965619802475,
-0.10392619669437408,
-0.14772942662239075,
0.07455646991729736,
-0.7098240852355957,
0.034674666821956635,
0.6753110885620117,
-0.14998412132263184,
-0.10718322545... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.