text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
There are six unique chess pieces and 64 fields on the board. So for every field we take 6 neurons (1 for every piece). If there is a white piece, the input value is 1. If there is a black piece, the value is -1. And if there is no piece of that sort on that field, the value is 0. In addition to that there should be 1 ...
[ 0.08437510579824448, -0.04732207581400871, 0.06420619040727615, 0.13446976244449615, -0.003405074356123805, 0.49248775839805603, 0.14084792137145996, -0.5446532368659973, -0.49448487162590027, -0.49500834941864014, 0.10484394431114197, 0.009053400717675686, -0.42479056119918823, 0.43131855...
network is quite good. But the main part is missing: How can I implement this neural network into a coding language (e.g. Delphi)? I think the weights for each neuron should be the same in the beginning. Depending on the result of a match, the weights should then be adjusted. But how? I think I should let 2 computer pl...
[ 0.042783863842487335, -0.1675463616847992, -0.054179225116968155, 0.16546402871608734, 0.021645667031407356, -0.08677759021520615, 0.07044524699449539, -0.2039697766304016, -0.24584653973579407, -0.8782569766044617, 0.31842243671417236, 0.42335790395736694, -0.5079125165939331, -0.16369926...
Delphi, otherwise pseudo-code). Thanks in advance! Been there, done that. Since there is no continuity in your problem (the value of a position is not closely related to an other position with only 1 change in the value of one input), there is very little chance a NN would work. And it never did in my experiments. I w...
[ -0.06702934205532074, -0.05604247748851776, -0.10626184940338135, -0.03299040347337723, 0.045975927263498306, 0.27918341755867004, 0.027023330330848694, -0.21982523798942566, -0.2358485907316208, -0.31778571009635925, -0.07057580351829529, 0.38012662529945374, -0.06228522211313248, 0.10834...
a graph, with each node being a neuron. Each neuron has a current activation value, and a transition formula to compute the next activation value, based on input values, i.e. activation values of all the nodes that have a link to it. A more classical NN, that is with an input layer, an output layer, identical neurons ...
[ -0.2801361680030823, -0.5472872257232666, 0.08984952419996262, 0.22476258873939514, -0.10264722257852554, 0.31342947483062744, 0.11688584834337234, 0.13423210382461548, -0.42219066619873047, -0.7873491644859314, -0.2080097794532776, 0.047699231654405594, -0.622913658618927, 0.2643407583236...
Computing the output value is simply setting the activations of the input neurons to the input values, and iterating through each subsequent layer in turn, computing the activation values from the previous layer using the transition formula. When you have reached the last (output) layer, you have your result.
[ -0.10100356489419937, -0.40783002972602844, 0.4216289520263672, 0.013604855164885521, 0.2414977252483368, 0.2873530387878418, 0.1817215234041214, -0.4175674021244049, -0.22092394530773163, -0.5591917634010315, -0.1258009672164917, 0.2731776237487793, -0.007955661043524742, -0.0561115704476...
I'm an absolute newbie when it comes down to subversion and SVN (don't even know the difference). As I'm developing a pretty big website I'm looking for a way to take care of different versions (PHP, CSS, JavaScript files and MySQL database) and to make backups. I would like to use a web based system so I have an exter...
[ 0.8632675409317017, 0.16018077731132507, 0.12071111798286438, -0.2510749399662018, -0.17064090073108673, -0.37170347571372986, 0.35125404596328735, 0.30975306034088135, -0.3382127583026886, -0.817811906337738, 0.11332834511995316, 0.4732710123062134, -0.19034092128276825, 0.069635599851608...
better ways to accomplish this. Any suggestions? Subversion (aka SVN) and <http://tortoisesvn.net/> > TortoiseSVN is an easy to use SCM / > source control software for Microsoft > Windows and maybe the best standalone > Subversion client there is. It is > implemented as a Windows shell > extension, which makes it...
[ 0.16715961694717407, -0.5430861115455627, 0.392781138420105, 0.05962701141834259, -0.20098529756069183, -0.31939172744750977, 0.19317613542079926, 0.24394303560256958, -0.4994257986545563, -0.4867675304412842, -0.21386738121509552, 0.39319100975990295, -0.020013336092233658, 0.130156323313...
since you still depend on the safety of your own hard drive.
[ 0.24939855933189392, 0.008673051372170448, -0.1576816737651825, 0.36042752861976624, 0.28967925906181335, -0.0539519377052784, -0.04643067345023155, 0.2504706084728241, -0.22456979751586914, -0.11034133285284042, 0.12756817042827606, 0.5959112048149109, 0.16117851436138153, -0.028940886259...
What is the "most pythonic" way to build a dictionary where I have the values in a sequence and each key will be a function of its value? I'm currently using the following, but I feel like I'm just missing a cleaner way. NOTE: `values` is a list that is not related to any dictionary. ``` for value in values: new_d...
[ 0.1951272040605545, 0.19540101289749146, 0.243099182844162, -0.41335174441337585, 0.00012668990530073643, 0.20950037240982056, 0.27782827615737915, -0.08113689720630646, -0.04940124601125717, -0.5200363993644714, 0.034638360142707825, 0.7707791328430176, -0.4913271367549896, -0.31814759969...
a shorthand for the above: ``` { v : v**2 for v in l } ```
[ 0.17878997325897217, 0.08343566954135895, 0.1484983116388321, -0.45200634002685547, -0.22646115720272064, 0.06827398389577866, 0.10101895034313202, -0.05951803922653198, -0.1549101620912552, -0.2956641614437103, -0.4166233241558075, 0.2794262766838074, -0.2079135924577713, 0.06709905713796...
Heyo, I'm currently working on a project where I need to place the camera such that the full motion of a character would be viewable without moving the camera. I have the position where the character starts, as well as the maximum distance that the character will travel in all three directions (X,Y, & Z). I also have ...
[ -0.05966632440686226, 0.036465853452682495, 0.6694413423538208, -0.10812228918075562, -0.2610224485397339, 0.1927270144224167, 0.05535591393709183, 0.01997808925807476, -0.19988314807415009, -0.4607546031475067, 0.22208236157894135, 0.4308607876300812, 0.3516371250152588, -0.45461764931678...
of the character that's in the motion, not above. It'll also be moving along a ground plane. If you make a bounding sphere of the points, all you need to do is keep the camera at a distance greater than or equal to the radius of the bounding sphere / sin(FOV/2). For example, if you have a bounding sphere with radius ...
[ -0.25561773777008057, -0.21372471749782562, 0.7607572078704834, 0.07001819461584091, -0.09688379615545273, 0.17865517735481262, -0.2700658440589905, -0.3735332787036896, -0.17045719921588898, -0.5279017686843872, 0.07972521334886551, 0.36797934770584106, -0.20917102694511414, -0.0252683088...
in 3D, for a camera at any orientation.
[ -0.014894858933985233, 0.09435183554887772, 0.43264660239219666, -0.12120086699724197, -0.022011632099747658, -0.12293398380279541, -0.022315066307783127, -0.04324321448802948, -0.35488763451576233, -0.380208283662796, -0.3185500204563141, 0.2825041115283966, -0.2493865191936493, -0.170273...
Is there a way to limit the header files that Boost.Build recursively scans for #include directives to a particular directory or set of directories? I.e. I'd like it to recursively scan the header files within my project only. I know that they external dependencies are not going to change (and being Boost and Qt they'r...
[ 0.548064649105072, 0.05338553711771965, 0.15365195274353027, 0.0972471535205841, 0.03799587860703468, 0.08548929542303085, 0.40482857823371887, -0.12799227237701416, -0.011778680607676506, -0.6036460399627686, 0.14648720622062683, 0.7248607873916626, -0.15264582633972168, -0.19507703185081...
INCLUDE environment variable (I'm using MSVC) - this means Boost.Build need not be informed of the include paths (I'm using the feature) and hence will not scan them. This seems a bit of a hack. I feel like I must be missing something obvious because I haven't been able to find other people experiencing similar proble...
[ 0.37134772539138794, 0.1615363210439682, 0.11757148802280426, -0.2437565177679062, -0.1380738914012909, -0.2797307074069977, 0.3961186707019806, -0.2167954444885254, -0.1818433403968811, -0.26926231384277344, 0.07966318726539612, 0.6044859290122986, -0.5278061032295227, 0.1164282038807869,...
than once, but certainly the cost of loading a file and scanning the entire contents must add up? If I could tell it not to bother scanning a particular directory or set of directories in which I can guarantee the header files are not going to change, that would be perfect. This question was also posted on the Boost m...
[ 0.5992250442504883, 0.04842885583639145, 0.3217581510543823, -0.053607698529958725, -0.12488962709903717, -0.1631234735250473, 0.2630271315574646, -0.06955695152282715, -0.13727329671382904, -0.17588865756988525, 0.16943374276161194, 0.7827733159065247, -0.0252836961299181, -0.209007889032...
a certain amount of sense. However, I am still curious as to why this is not a more common problem for people. I see that caching the dependencies would reduce the time, but surely if we scan *all* external libraries we end up with a huge dependency tree, much of it redundant? When I'm working on a project, I'm not go...
[ 0.5571919083595276, 0.265727162361145, -0.017888203263282776, 0.14331260323524475, -0.11482388526201248, -0.33077719807624817, 0.5535503029823303, 0.1526409387588501, -0.4676888585090637, -0.608161449432373, 0.1259109228849411, 0.5597335696220398, -0.26535558700561523, 0.27418071031570435,...
If I have several SPs ``` SP1 SP2 some_inline_queries ``` how do I ensure that they are all run at once without interruption from other threads? Is it possible to do this from SQL Server level? edit: Let's say we have a main script with 3 major actions: **sp1** scans table t1 to generate a random string that is...
[ 0.15260940790176392, 0.05908491462469101, 0.46131524443626404, 0.0886402279138565, -0.2591761648654938, -0.028751123696565628, 0.34481173753738403, -0.23284773528575897, -0.597855806350708, -0.6418445110321045, 0.051811583340168, 0.3969951272010803, -0.23968100547790527, 0.0420141890645027...
suggest two methods of doing overlapped I/O and ignore the third (or I'm misunderstanding your question). When you issue an overlapped operation, a [WSARecv()](http://msdn.microsoft.com/en-us/library/ms741688(VS.85).aspx) for example, you can specify an OVERLAPPED structure which contains an event and you can wait for...
[ 0.19310776889324188, -0.09706496447324753, 0.40247058868408203, -0.07171867787837982, 0.06359812617301941, -0.14763367176055908, 0.15213683247566223, -0.32540497183799744, -0.5490405559539795, -0.2238030880689621, -0.2920339107513428, 0.3541502058506012, -0.28285375237464905, 0.13225965201...
and requires that the thread that issued the WSARecv() call is in an 'alertable' state for the completion routine to be called. Threads can put themselves in an alertable state in several ways (calling SleepEx() or the various EX versions of the Wait functions, etc). The [Richter book](http://www.lenholgate.com/blog/20...
[ 0.36161965131759644, -0.05137285217642784, 0.3110944330692291, -0.1652611941099167, 0.04772420972585678, -0.2968822717666626, 0.25957155227661133, -0.19445361196994781, -0.2958594560623169, -0.2695137858390808, -0.1872214525938034, 0.6473773121833801, -0.1948302686214447, 0.185153752565383...
you want to do overlapped I/O on with a completion port. You then create a pool of threads which service this completion port by calling GetQueuedCompletionStatus() and looping. You issue your WSARecv() with an OVERLAPPED structure WITHOUT an event in it and when the I/O completes the completion pops out of GetQueuedCo...
[ 0.3245239555835724, -0.21064473688602448, 0.4082694351673126, 0.05963018909096718, 0.08932822942733765, -0.2399122565984726, 0.058479804545640945, -0.6093418002128601, -0.5310336351394653, -0.4582401514053345, -0.2663526237010956, 0.1600402295589447, -0.2100876271724701, 0.0485900454223156...
completed. Link to a reference to that can be found [here](http://www.lenholgate.com/blog/2008/02/major-vista-overlapped-io-change.html). But this problem is easy to work around anyway; you simply marshal the WSARecv over to one of your I/O pool threads using the same IOCP that you use for completions... Anyway, IMHO ...
[ 0.28843954205513, 0.021842310205101967, 0.5522347092628479, 0.11531364917755127, 0.21306422352790833, -0.18729877471923828, 0.18014799058437347, -0.6393390893936157, -0.335430771112442, -0.42994460463523865, -0.15138912200927734, 0.3770778179168701, -0.13884589076042175, -0.056697897613048...
code to get you going then I have several articles on writing IO completion port systems and a heap of free code that provides a real-world framework for high performance servers; see [here](http://www.serverframework.com/products---the-free-framework.html). As an aside; IMHO, you really should read "[Windows Via C/C...
[ 0.7097524404525757, 0.040208637714385986, 0.2851991355419159, 0.27642422914505005, 0.14613832533359528, -0.11175374686717987, 0.31408384442329407, -0.24840450286865234, -0.09648067504167557, -0.5906616449356079, -0.3729051947593689, 0.3933958411216736, -0.041169095784425735, -0.04283173754...
I am building a C# application, using the server-client model, where the server is sending an image (100kb) to the client through a socket every 50ms... I was using TCP, but besides the overhead of this protocol, sometimes the client ended up with more than one image on the socket. And I still haven't though of a cle...
[ 0.40847504138946533, 0.2039175182580948, 0.5291748046875, 0.05725432559847832, -0.23127028346061707, 0.16706684231758118, -0.10172892361879349, 0.04138835147023201, -0.4359806776046753, -0.8837922811508179, 0.10750684142112732, 0.20944122970104218, -0.2390899658203125, 0.13076519966125488,...
otherwise the packet would be divided along the network and the chances of losing parts of the packet would be greater. So now I'm a bit confused. Should I continue using TCP and put some escaping bytes in the end of each image so the client can separate them? Or should I use UDP, send dgrams of 1500 bytes and come up...
[ 0.5750709772109985, 0.007512179668992758, 0.6102572679519653, 0.42190974950790405, -0.14623616635799408, -0.007092126179486513, 0.08671730756759644, -0.10039518773555756, -0.7003878355026245, -0.6620709896087646, 0.12249350547790527, 0.38494163751602173, -0.2279054969549179, 0.278557896614...
in advance! I'd recommend using UDP if: * Your application can cope with an image or small burst of images not getting through, * You can squeeze your images into 65535 bytes. If you're implementing a video conferencing application then it's worth noting that the majority use UDP. Otherwise you should use TCP and im...
[ 0.7192318439483643, -0.07764527946710587, 0.4432891011238098, 0.2047177106142044, -0.02715555764734745, -0.13466280698776245, -0.19955308735370636, -0.25093144178390503, -0.25507140159606934, -0.7172790169715881, -0.12101438641548157, 0.6514363884925842, -0.13680016994476318, 0.01378984749...
wrappers for non .Net libraries or half completed ones I did not have much success. I just had another quick look and this may be of this one [ConferenceXP](http://www.codeplex.com/ConferenceXP) looks a bit more promising.
[ 0.4911743402481079, -0.1597839891910553, 0.21323536336421967, 0.2516807019710541, 0.024762259796261787, -0.3245469331741333, 0.10097621381282806, 0.38125115633010864, -0.3424546718597412, -0.6239648461341858, 0.11455420404672623, 0.2097058892250061, -0.0996009111404419, -0.1227336302399635...
What is the most fun/hard/easy mobile platform to develop for today? I had a SonyEricsson P800 running Symbian OS a long time ago and did some Java applications on it. I felt that JavaME was so limited at that time, but it was maybe 5 years ago. Please, share your experiences; I need an update. I think iPhone's is, by...
[ 0.05158162862062454, 0.20111529529094696, 0.0021700586657971144, 0.20905117690563202, 0.40186378359794617, 0.05247589200735092, -0.030510282143950462, 0.5107949376106262, -0.34605270624160767, -0.5796678066253662, 0.163704976439476, 0.6941314935684204, -0.2104618102312088, -0.0424691699445...
Despite all the bad rep Apple has for its unclear approvement process. Documentation is very good. PalmOS? Too old and almost unsupported by now. Complete lack of good development tools. Documentation is very bad. Windows Mobile? I like Windows Mobile. In my opinion, Visual Studio is the best IDE you can use to code,...
[ 0.1589328795671463, 0.3552233874797821, 0.1323120892047882, 0.022227339446544647, -0.06949323415756226, 0.3114278018474579, 0.05513281002640724, -0.008843564428389072, -0.18016071617603302, -0.8396938443183899, 0.013563278131186962, 0.8480252623558044, -0.11837530136108398, -0.169878348708...
editing, it's not that great for mobile development. Its simulator is too slow. I haven't used it that much though. Documentation is quite alright. Symbian? Having C/C++ behind is the most difficult one. But it has the biggest installed base so it can't be ignored by any mean. Tools aren't that great and neither is do...
[ 0.10739561915397644, 0.08164823055267334, 0.06994011253118515, 0.23257388174533844, 0.022165900096297264, 0.05521151050925255, 0.03884891793131828, 0.2790176272392273, -0.27967533469200134, -0.7027760148048401, 0.20536038279533386, 0.5891754627227783, -0.39780235290527344, -0.3352197408676...
ignore this platform. JavaME? Only for low end phones.
[ 0.2646683156490326, -0.2063504457473755, -0.12187404185533524, 0.18169176578521729, 0.07456662505865097, -0.20760779082775116, 0.531794548034668, 0.44144776463508606, -0.05178825184702873, -0.17536459863185883, 0.0952213779091835, 0.41167712211608887, -0.49797341227531433, -0.2026497423648...
How do I change the default textwrapping style of a button in WPF? The obvious solution of: ``` <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Setter Property="TextWrapping" Value="Wrap"></Setter> </Style> ``` doesn't work, because Textwrapping isn't a settable property here, apparently. If I try:...
[ 0.07762626558542252, -0.21326549351215363, 0.831061601638794, -0.19238640367984772, 0.013728116638958454, 0.08851932734251022, 0.033027008175849915, -0.667183518409729, -0.20966558158397675, -0.8689637184143066, -0.08226098865270615, 0.5039772391319275, -0.311077356338501, 0.06854486465454...
</ControlTemplate> </Setter.Value> </Setter> </Style> ``` I just get a worthless response from the compiler: ``` Error 5 After a 'SetterBaseCollection' is in use (sealed), it cannot be modified. ``` Removing the ControlTemplate tag keeps the error. The following attempt yields a different error...
[ 0.04635060951113701, 0.2586234211921692, 0.6553533673286438, -0.12534308433532715, -0.09894238412380219, -0.0041672405786812305, 0.20564375817775726, -0.49072498083114624, 0.15526945888996124, -0.5756806135177612, -0.08566181361675262, 0.5090020298957825, -0.409932941198349, 0.001409097691...
button individually, but that's pretty asinine. How can I do it as a style? What are the magic words? And for future reference, where can I find a list of these magic words, so I can just do this on my own? The MSDN entry is pretty useless when I try to find out about which properties can be set by the setter. Your se...
[ 0.2153080850839615, -0.2912745475769043, 0.7375475764274597, 0.06611903011798859, -0.17256061732769012, 0.18231762945652008, 0.16753573715686798, -0.4187024235725403, -0.24719789624214172, -0.8560978770256042, 0.11900188028812408, 0.6173935532569885, -0.5456043481826782, 0.0559518001973629...
TargetType="{x:Type Button}"> <TextBlock Text="{TemplateBinding Content}" FontSize="20" TextWrapping="Wrap"/> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- then --> <Button Style="{StaticResource fie}">verylongcaptiongoeshereandwraps/Button> ``` Note this completely replaces the butt...
[ 0.2410079389810562, -0.13045302033424377, 0.7313715815544128, -0.09005013853311539, -0.06959415227174759, 0.05849536135792732, 0.118899866938591, -0.5486242771148682, 0.08417684584856033, -0.7191461324691772, 0.04448700323700905, 0.6151220202445984, -0.34083160758018494, -0.161723405122756...
of dependency properties.
[ -0.23928628861904144, 0.274793803691864, -0.373332679271698, 0.18321390450000763, 0.04619099944829941, -0.0746953934431076, -0.260130912065506, -0.12250117212533951, 0.08985710144042969, -0.3806864023208618, -0.22424758970737457, 0.911856472492218, -0.2398219108581543, 0.1173568144440651, ...
Does anyone know if Red Hat has forked the code you download from JBOSS.org? I'm guessing that the answer is "yes", but I'd like to confirm it. I can't pin it down at the Red Hat site, and jboss.org giving me an HTTP 502 right now for some reason. I know that Red Hat owns JBoss. Does that mean that the code they sell...
[ 0.8591756224632263, 0.48180148005485535, -0.02861613593995571, 0.1765572428703308, -0.09151030331850052, -0.19735082983970642, 0.07130318135023117, 0.5262015461921692, -0.442012757062912, -0.07282543182373047, 0.4995085299015045, 0.5079060792922974, -0.02258673496544361, 0.4951727390289306...
in different code - its build from the .org versions and put through various tests/QA environments, certified if necessary etc... Its analagous to what goes on with Fedora and Red Hat Enterprise Linux (I think the idea is to have a similar model) - so if you look into that model it might help explain it better then I...
[ 0.6000998616218567, 0.023995202034711838, -0.06947296112775803, 0.06535902619361877, -0.05378769710659981, -0.13089688122272491, -0.11816466599702835, 0.1633569747209549, -0.03022000379860401, -0.5751559734344482, 0.1748816817998886, 0.38948407769203186, -0.09173382073640823, 0.11776078492...
I am currently working on a web application that has been created using a magnitude of frames that stretch down up to 5 times, The issue is that i need to preform some jquery magic throughout the website. What would be the best way to go about this (other than rewriting it which i have considered)? **EDIT:** The Fra...
[ 0.8464431166648865, 0.1758979707956314, 0.5568372011184692, 0.04852792248129845, -0.21457535028457642, -0.19372084736824036, 0.3406735360622406, -0.39195460081100464, -0.20226582884788513, -0.751146137714386, 0.299171507358551, 0.26964887976646423, 0.04153021052479744, 0.07267686724662781,...
header.html body.html footer.html ``` The magic i am referencing is a few hot key shortcuts, find and replace that kind of stuff This is what you want: [$.frameReady()](http://ideamill.synaptrixgroup.com/?p=6) > frameReady lets you run jQuery > commands in a target frame as if it > were in the loc...
[ 0.576869785785675, -0.2045109122991562, 0.5134299397468567, 0.1533087193965912, -0.3673006594181061, -0.3152978718280792, 0.10337769985198975, -0.3031948208808899, -0.3255017399787903, -0.7171326875686646, 0.038898635655641556, 0.5403531193733215, -0.061948224902153015, -0.0823609232902526...
you if it doesn’t already exist > and allows you to load other script > files and stylesheets easily. > frameReady supports nested frames and > iframes in any combination, even > dynamically created frames.
[ 0.34856680035591125, -0.19820302724838257, 0.25733622908592224, 0.20995476841926575, -0.2041076421737671, -0.19602900743484497, 0.14871656894683838, -0.02406897582113743, -0.0609981007874012, -0.8818026185035706, -0.03589806333184242, 0.46129941940307617, -0.3105573058128357, 0.04381809383...
**A little background:** I am loading a WPF UI from a database which is stored in a table of properties (Control type, label, margin, etc.) which I load into a class I call ControlPresenter. Basically I set ControlPresenter as the DataContext of a ContentPresenter and use a TemplateSelector to choose which type of cont...
[ 0.353403240442276, 0.03468446061015129, 0.7467823624610901, 0.08220312744379044, -0.07396665960550308, -0.11227602511644363, 0.03315001353621483, -0.2700881361961365, 0.010790238156914711, -0.6186259984970093, -0.07691676169633865, 0.3560066223144531, -0.015467243269085884, 0.1262656450271...
that implement INotifyPropertyChanged) to these controls. The control's DataContext is the associated ControlPresenter so I can't bind directly to the other presenters and I can't set up two bindings on the same dependency property (I can't bind the control and the desired presenter property to the same DP). **Possib...
[ 0.2797618508338928, -0.13580098748207092, 0.49141958355903625, 0.22477568686008453, -0.15254829823970795, -0.18333962559700012, 0.27588704228401184, -0.30516475439071655, -0.04085484892129898, -0.6460581421852112, -0.25396111607551575, 0.4765632450580597, -0.5426887273788452, 0.07759482413...
breaking so I'm hoping someone else has come up with a better solution. **Edit:** I came up with a solution that works fairly well (see below). Thanks to everyone that looked at this and if you come up with a better method than I did please let me know. Don't use reader.ready(). Just call readLine() and let readLine()...
[ 0.18397414684295654, -0.07075407356023788, 0.36256152391433716, 0.0392523854970932, -0.04900810122489929, -0.3277834951877594, 0.6441974639892578, 0.14754992723464966, -0.4302385449409485, -0.5084079504013062, -0.2798331677913666, 0.27175045013427734, -0.19784557819366455, 0.25122681260108...
How is pattern matching in Scala implemented at the bytecode level? Is it like a series of `if (x instanceof Foo)` constructs, or something else? What are its performance implications? For example, given the following code (from [Scala By Example](http://www.scala-lang.org/docu/files/ScalaByExample.pdf) pages 46-48),...
[ 0.08917776495218277, -0.32284215092658997, 0.2355380803346634, -0.10758176445960999, -0.12527219951152802, 0.34400641918182373, 0.12050739675760269, -0.7706490159034729, -0.33701881766319275, -0.5729727149009705, 0.05470176786184311, 0.4093444049358368, -0.6582353711128235, -0.259002298116...
me, but probably it would be better for the other readers to know how it would look like as Java code. P.P.S. Does the book [Programming in Scala](https://rads.stackoverflow.com/amzn/click/com/0981531601) give an answer to this and similar questions about how Scala is implemented? I have ordered the book, but it has n...
[ 0.30043622851371765, -0.019796747714281082, -0.028173817321658134, -0.025224514305591583, 0.07418423146009445, 0.24050967395305634, 0.11912098526954651, -0.39451462030410767, -0.1662338376045227, -0.32426074147224426, 0.0867450162768364, 0.45496150851249695, -0.14470092952251434, 0.0005113...
custom extractors case "hello" // equality check case _ : Foo // instance of check case x => // assignment to a fresh variable case _ => // do nothing, this is the tail else on the if/else ``` There's much more that you can do with patterns like or patterns and combinations like "case Foo(45, x)", but generally thos...
[ 0.40173619985580444, -0.33865946531295776, 0.351593554019928, 0.06454845517873764, -0.13546201586723328, 0.15680496394634247, -0.026626108214259148, -0.2701062858104706, -0.4619622826576233, -0.6058077216148376, 0.21149325370788574, 0.7045319676399231, -0.48087215423583984, 0.0462868772447...
Advanced patterns and optimization are an active area of work in the compiler, so don't be surprised if the byte code improves substantially over these basic rules in current and future versions of Scala. In addition to all that, you can write your own custom extractors in addition to or instead of the default ones S...
[ -0.18176554143428802, -0.2719484865665436, 0.47237202525138855, 0.1538955718278885, 0.055429983884096146, 0.1659911423921585, -0.05091514438390732, -0.49960416555404663, -0.11415892839431763, -0.716383159160614, -0.06729166209697723, 0.6133735775947571, -0.2613808810710907, -0.264749377965...
I hope I framed the question right. I am trying to force myself to be a better programmer. By better I mean efficient. I want to write a program to identify the files in a directory and read each file for further processing. After some shuffling I got to this: ``` for file in os.listdir(dir): y=open(dir+'\\'+file,...
[ -0.01626383140683174, 0.1305500566959381, 0.5537860989570618, -0.1225084438920021, -0.07983893901109695, 0.09420592337846756, 0.09428999572992325, -0.11500609666109085, -0.09883958846330643, -0.7554778456687927, 0.040729351341724396, 0.5309770703315735, -0.21131457388401031, 0.113589137792...
I am thinking about this and am afraid that I have five open files (there are five files in the directory specified by dir. I can fix the code so it runs and I explicitly close the files after opening them. I am curious if I need to or if Python handles closing the file in the next iteration of the loop. If so then I ...
[ 0.07559520751237869, 0.28193145990371704, 0.5429909229278564, -0.29631245136260986, -0.009481733664870262, 0.013639818876981735, 0.3515734076499939, -0.08111914247274399, -0.2486909031867981, -0.6867178678512573, -0.32381993532180786, 0.7816066145896912, -0.34967362880706787, 0.21824069321...
reason I think that this might be handled is that I have changed the object/thing that y is referencing. When I start the second iteration there are no more memory references to the file that was opened and read using the readlines method. Python will close open files when they get garbage-collected, so generally you c...
[ -0.1323874145746231, 0.1372312754392624, 0.6790174245834351, -0.21333885192871094, 0.00429221335798502, 0.0067574079148471355, 0.22706197202205658, -0.00846159178763628, -0.34863656759262085, -0.7122546434402466, -0.1454450488090515, 0.6864206790924072, -0.20189666748046875, 0.023168852552...
pass f.close() ``` However, we can immediately improve this, because in python you can iterate over file-like objects directly: ``` for file in os.listdir(dir): y = open(dir+'\\'+file,'r') for line in y: pass y.close() ``` Finally, in recent python, there is the '[with](http://docs.python.o...
[ -0.05300072580575943, -0.03985367342829704, 0.6583201885223389, -0.37798944115638733, -0.3347855806350708, -0.06891244649887085, 0.17411120235919952, -0.21306264400482178, 0.07288030534982681, -0.4176344573497772, -0.4291420578956604, 0.448293000459671, -0.5112238526344299, 0.0242845173925...
for you and clean it up. (you also might want to look into `os.path` for more pythonic tools for manipulating file names and directories)
[ 0.3088040053844452, -0.1226896345615387, -0.11031275242567062, 0.1704718917608261, 0.19704782962799072, -0.39633095264434814, 0.4719303846359253, 0.3476923406124115, -0.47156670689582825, -0.668994128704071, -0.29714521765708923, 0.5260749459266663, -0.15910477936267853, -0.091407187283039...
I'm developing now API for developers feature, which gives users API access to some functions of our product. All responses are in **json** format. HTTP **Content-Type** header in our server's response is **text/plain; charset=utf-8** Should I send one of this: * **application/json** * **text/x-json** * **text/json...
[ 0.24155737459659576, -0.06591476500034332, 0.48134684562683105, -0.1596672385931015, -0.40545183420181274, 0.12442199885845184, 0.0214709360152483, -0.13859643042087555, -0.054962147027254105, -0.8072511553764343, -0.6154572367668152, 0.47661057114601135, -0.30083560943603516, 0.0082754893...
*To make this easier to understand, I will present the exact same problem as if it was about a forum (the actual app doesn't have to do with forums at all, but I think such a parallel is easier for most of us to grasp, the actual app is about something very specific that most programmers won't understand (it's an app i...
[ 0.32166311144828796, 0.24577423930168152, 0.38040590286254883, 0.2962976396083832, -0.20499706268310547, 0.162876695394516, 0.3202338218688965, 0.15702001750469208, -0.39210495352745056, -0.5509641766548157, 0.28198927640914917, 0.6489248871803284, -0.09701785445213318, -0.0486339293420314...
and number of votes in the thread table and triggers sounded like a good idea for updating it (I used to do such stuff in the actual application code, but I think triggers are worth a try, despite the debugging dangers). As you know, MS SQL Server doesn't support a trigger to be executed per row, it has to be per stat...
[ 0.3881467878818512, -0.05772266536951065, 0.47081831097602844, -0.00688751507550478, -0.06200731173157692, -0.12760214507579803, 0.06844404339790344, -0.6248785257339478, -0.21858970820903778, -0.24527423083782196, 0.32893866300582886, 0.5083552002906799, -0.30432960391044617, 0.0776197686...
thread.voters = thread.voters + COUNT(inserted.rating) FROM thread INNER JOIN inserted ON(inserted.threadid = thread.threadid) GROUP BY inserted.threadid ``` but I get an error for the "GROUP BY" clause (which I expected). The question is, how can I make this work? Sorry if the question is stupid, but it...
[ 0.1987895965576172, -0.20890600979328156, 0.24549435079097748, 0.08183843642473221, 0.10011930018663406, -0.06716147065162659, 0.37552931904792786, -0.5498963594436646, 0.013693321496248245, -0.37928757071495056, 0.19945067167282104, 0.3593492805957794, -0.25270727276802063, 0.226730987429...
(foreign key to the primary key of the users table) and rating (tinyint between 1 and 5). The error message is "Incorrect syntax near the keyword 'GROUP'." First, I strongly recommend that you *not* use triggers. If you're getting a syntax error, check that your parens are balanced as well as your `begin`/`ends`. In...
[ 0.08400076627731323, 0.2547686696052551, -0.095559261739254, -0.14803250133991241, -0.102909617125988, -0.045062076300382614, 0.42652496695518494, -0.10944149643182755, -0.10864174365997314, -0.5926215648651123, 0.06186775118112564, 0.5005653500556946, -0.20359663665294647, -0.040407393127...
are not in either. You need to add thread.rating, thread.voters, etc. to your group by or perform some kind of aggregate on them. This is all assuming that there are multiple records with the same threadID (ie, it's not the primary key). If that's *not* the case, then what's the purpose of the group by? --- Edit: I...
[ 0.19937536120414734, 0.056126032024621964, 0.09117309004068375, 0.07574320584535599, -0.09495336562395096, -0.14637339115142822, 0.13185851275920868, -0.24957799911499023, -0.38567832112312317, -0.4420869052410126, 0.15129545331001282, 0.05923934280872345, -0.4378741979598999, 0.2383573651...
not null, rating int not null, voters int not null) ALTER TRIGGER thread_rating ON threadrating AFTER INSERT AS UPDATE Thread SET Thread.rating = (SELECT (Thread.Rating * Thread.Voters + SUM(I.Rating)) / (Thread.Voters + COUNT(I.Rating)) FROM ThreadRating I WHERE I.ThreadID = thread.ThreadID) ,Thread.Vot...
[ 0.29482603073120117, -0.33026760816574097, 0.7107248902320862, -0.16172462701797485, 0.19018271565437317, -0.02368796057999134, 0.2890952527523041, -0.7118443250656128, 0.054077696055173874, -0.5177696347236633, -0.025567462667822838, 0.4266304671764374, -0.343753457069397, 0.2391219437122...
you wanted, then we can check the performance/execution plan and modify as needed. We might be able to get it to work with the group by yet. --- **Alternatives to triggers** If you are updating data that impact ratings in only a few select places, I'd recommend updating the ratings directly there. Factoring the logi...
[ 0.587237536907196, -0.19852933287620544, 0.47229692339897156, 0.3042234480381012, -0.005183713976293802, -0.10365970432758331, 0.12801675498485565, -0.4163385331630707, -0.33208560943603516, -0.4827938377857208, 0.263024240732193, 0.9486134052276611, -0.09754817932844162, -0.26936748623847...
to short circuit the trigger in those cases but it gets complicated rapidly.
[ 0.4268069863319397, 0.20467324554920197, 0.20897629857063293, 0.06579576432704926, 0.25503110885620117, -0.26208820939064026, 0.40449678897857666, -0.45931971073150635, -0.28854838013648987, -0.3224126994609833, 0.11220848560333252, 0.37834861874580383, 0.10658767819404602, -0.129797860980...
I use the following data: ``` date latitude route name longitude 2009-04-11 00:50:31.640000 40.80708 White Loop 86 -77.85891 2009-04-11 00:50:27.718000 40.80708 White Loop 86 -77.85891 2009-04-11 00:50:01.562000 40.80708 White Loop 86 -77.85891 2009-04-11 00:49:48.7...
[ 0.1555909514427185, 0.4779633581638336, 0.08214902132749557, 0.14597982168197632, 0.028642522171139717, -0.024558965116739273, 0.8747600317001343, 0.4510926604270935, -0.19363589584827423, -0.7872690558433533, 0.10459204763174057, -0.30846360325813293, -0.5505915284156799, 0.19761066138744...
86 -77.85073 2009-04-11 00:49:22.468000 40.802338 White Loop 86 -77.85073 2009-04-11 00:48:35.671000 40.802338 White Loop 86 -77.85073 2009-04-11 00:48:29.125000 40.802338 White Loop 86 -77.85073 2009-04-11 00:47:19.906000 40.79889 White Loop 86 -77.85299 2009-04-11 00:47:03.609000 40.79889 Wh...
[ -0.06352782994508743, 0.2303766906261444, -0.20077797770500183, -0.068588025867939, -0.21634745597839355, 0.4904373288154602, 0.8810672760009766, 0.20691707730293274, -0.3293578326702118, -0.6200211644172668, 0.0216564629226923, 0.18090981245040894, -0.48947930335998535, -0.103106096386909...
White Loop 86 -77.85299 2009-04-11 00:46:41.406000 40.79889 White Loop 86 -77.85299 2009-04-11 00:50:31.687000 40.792194 White Loop 82 -77.863235 2009-04-11 00:50:27.781000 40.792194 White Loop 82 -77.863235 2009-04-11 00:50:01.640000 40.792194 White Loop 82 -77.863235 2009-04-11 00:49:48.812000 ...
[ -0.03107445314526558, 0.09435007721185684, -0.1654754877090454, 0.21627187728881836, -0.10328451544046402, 0.43802258372306824, 0.8660545945167542, 0.16769272089004517, -0.28465738892555237, -0.9082303047180176, 0.0701618492603302, -0.06080254912376404, -0.6614556908607483, 0.0375473238527...
White Loop 82 -77.86755 2009-04-11 00:47:19.984000 40.79738 White Loop 82 -77.86755 2009-04-11 00:47:03.656000 40.79738 White Loop 82 -77.86755 2009-04-11 00:46:54.484000 40.79738 White Loop 82 -77.86755 2009-04-11 00:46:52.734000 40.79738 White Loop 82 -77.86755 2009-04-11 00:46:51.156000 40...
[ -0.0850752592086792, 0.07176763564348221, -0.1824924349784851, -0.005181329324841499, -0.02059837616980076, 0.38846713304519653, 0.8135520219802856, 0.12961789965629578, -0.2876635491847992, -0.8164820671081543, -0.13874901831150055, -0.0054658567532896996, -0.8103072643280029, -0.07389454...
81 -77.88552 2009-04-11 00:50:27.750000 40.776066 White Loop 81 -77.88552 2009-04-11 00:50:01.593000 40.776066 White Loop 81 -77.88552 2009-04-11 00:49:48.796000 40.776066 White Loop 81 -77.88552 2009-04-11 00:49:34.812000 40.764687 White Loop 81 -77.88271 2009-04-11 00:49:22.515000 40.764687 Wh...
[ -0.04444270208477974, 0.04336819052696228, -0.14914584159851074, -0.036115486174821854, -0.026129119098186493, 0.46403077244758606, 0.7921463847160339, 0.1482902467250824, -0.3209472596645355, -0.8023294806480408, 0.03671102970838547, -0.01486345287412405, -0.4630197584629059, -0.091537140...
Loop 81 -77.876755 2009-04-11 00:46:54.468000 40.76335 White Loop 81 -77.876755 2009-04-11 00:46:52.718000 40.76335 White Loop 81 -77.876755 2009-04-11 00:46:51.156000 40.76335 White Loop 81 -77.876755 2009-04-11 00:46:48.609000 40.76335 White Loop 81 -77.876755 2009-04-11 00:46:41.437000 40....
[ -0.43986353278160095, 0.29890143871307373, -0.05726844444870949, -0.11883425712585449, -0.01148764044046402, 0.2455524355173111, 0.6033287644386292, 0.16703616082668304, -0.40083420276641846, -0.4659545123577118, -0.22229871153831482, 0.12493603676557541, -0.6173951625823975, -0.1297383308...
-77.85891 2009-04-11 00:50:31.687000 40.792194 White Loop 82 -77.863235 2009-04-11 00:50:31.656000 40.776066 White Loop 81 -77.88552 ``` And I want all results to have date values that are no more than 1 minute old. Keep in mind that the date values are Python datetime properties. Thanks First, I strongly ...
[ -0.1350802779197693, 0.06944090873003006, 0.15988725423812866, -0.14131562411785126, 0.1396554559469223, -0.09123625606298447, 0.4177112877368927, 0.11769979447126389, -0.3787841200828552, -0.3723442256450653, -0.29443469643592834, 0.40132129192352295, -0.27745094895362854, 0.0946931764483...
that, you'll likely get some more errors like "columns x,y,z not in an aggregate or group by". That's because you have several columns that are not in either. You need to add thread.rating, thread.voters, etc. to your group by or perform some kind of aggregate on them. This is all assuming that there are multiple reco...
[ 0.37826231122016907, 0.2763633131980896, 0.0392887219786644, 0.1409255564212799, -0.1459696739912033, 0.13439136743545532, 0.22777359187602997, -0.11962896585464478, -0.36146196722984314, -0.38482382893562317, 0.293701708316803, 0.05387692153453827, -0.40613940358161926, 0.3461488783359527...
modify as needed and try this: ``` --CREATE TABLE ThreadRating (threadid int not null, userid int not null, rating int not null) --CREATE TABLE Thread (threadid int not null, rating int not null, voters int not null) ALTER TRIGGER thread_rating ON threadrating AFTER INSERT AS UPDATE Thread SET Thread.rating = ...
[ 0.10447100549936295, -0.2074822187423706, 0.7973008751869202, -0.06003720313310623, 0.11095109581947327, 0.008353101089596748, 0.11311725527048111, -0.7454813122749329, -0.06118018552660942, -0.6538009643554688, 0.04986852779984474, 0.49981051683425903, -0.31134751439094543, 0.325545042753...
FROM Thread JOIN Inserted ON Inserted.ThreadID = Thread.ThreadID ``` If that's what you wanted, then we can check the performance/execution plan and modify as needed. We might be able to get it to work with the group by yet. --- **Alternatives to triggers** If you are updating data that impact ratings in only a fe...
[ 0.47020137310028076, -0.17197611927986145, 0.30017468333244324, 0.1173442155122757, 0.021248621866106987, -0.06053360924124718, 0.016102062538266182, -0.3740394413471222, -0.2101769894361496, -0.5295705795288086, 0.2364867627620697, 0.7638970017433167, -0.27469244599342346, 0.0159460324794...
execute every single time someone touches that table. Things like view counts, last updated dates, etc. will execute this trigger. You can add logic to short circuit the trigger in those cases but it gets complicated rapidly.
[ 0.4969271123409271, -0.03615193068981171, 0.46373090147972107, 0.17001721262931824, 0.16625957190990448, -0.2522434890270233, 0.3015339970588684, -0.3443615436553955, -0.4280920922756195, -0.40278172492980957, 0.021188557147979736, 0.346377968788147, -0.19556893408298492, -0.19748710095882...
Given a C process that runs at the highest priority that requests the current time, Is the time returned adjusted for the amount of time the code takes to return to the user process space? Is it out of date when you get it? As a measurement taking the execution time of known number of assembly instructions in a loop an...
[ 0.4991626441478729, 0.09950315952301025, 0.4123586118221283, 0.2608095407485962, 0.37272071838378906, -0.10996557027101517, -0.05707799270749092, 0.3074008524417877, -0.259657621383667, -0.22491316497325897, -0.12470955401659012, 0.39377856254577637, -0.24135248363018036, 0.321226805448532...
the near future. I have read a few articles on the subject but they do not indicate that any correction is made to make the time given to you be slightly ahead of the time the system read in. Should I lose sleep over other things? Yes, they are almost definitely "wrong". For Windows, the timing functions do not take i...
[ 0.3114117681980133, -0.3202848434448242, 0.5139792561531067, 0.158141627907753, 0.5858896970748901, -0.0630345270037651, -0.048172786831855774, 0.5093268156051636, 0.003632268402725458, -0.9311619997024536, -0.027537280693650246, 0.42632657289505005, 0.21978385746479034, 0.1902138441801071...
timing things you should snap a start and an end time around a large number of iterations to weed out these sort of uncertainties.
[ 0.6889357566833496, -0.13481953740119934, -0.24088439345359802, 0.4164596199989319, 0.065915048122406, 0.0731777623295784, 0.2293388992547989, 0.1515592783689499, -0.2458506077528, -0.5274605751037598, 0.3806094825267792, 0.4979378581047058, 0.039152782410383224, -0.38947638869285583, -0...
I'm writing an agglomerative clustering algorithm in java and having trouble with a remove operation. It seems to always fail when the number of clusters reaches half the initial number. In the sample code below, `clusters` is a `Collection<Collection<Integer>>`. ``` while(clusters.size() > K){ // de...
[ -0.3965354561805725, 0.07715445011854172, 0.23046240210533142, -0.2709861993789673, -0.08308152109384537, -0.03795758634805679, 0.021804116666316986, -0.2404269576072693, -0.15944479405879974, -0.6289060115814209, -0.19073066115379333, 0.08484441787004471, -0.29008185863494873, 0.296361446...
double mindist = Double.POSITIVE_INFINITY; for(Collection<Integer> cluster1 : clusters){ for(Collection<Integer> cluster2 : clusters){ if( cluster1 != cluster2 && getDistance(cluster1, cluster2) < mindist){ minclust1 = cluster1;
[ -0.2775587737560272, -0.6234031319618225, 0.4765217900276184, -0.20189499855041504, 0.26026278734207153, -0.016967076808214188, 0.18216291069984436, -0.19110514223575592, -0.040307916700839996, -0.35293832421302795, -0.4078000783920288, 0.6302874088287354, -0.20724345743656158, -0.03800141...
minclust2 = cluster2; mindist = getDistance(cluster1, cluster2); } } }
[ -0.715836763381958, -0.48475128412246704, 0.31993773579597473, -0.09897220134735107, 0.1593361496925354, 0.08539623767137527, 0.17736615240573883, -0.020071780309081078, -0.006558170076459646, -0.6197207570075989, -0.2993716597557068, 0.6156473159790039, -0.179615780711174, 0.0942771732807...
// merge the two clusters minclust1.addAll(minclust2); clusters.remove(minclust2); } ``` After a few runs through the loop, `clusters.remove(minclust2)` eventually returns false, but I don't understand why. I tested this code by first creating 10 clusters, each with one integer from 1 to ...
[ -0.1570519059896469, -0.09609540551900864, 0.3978663384914398, -0.37285181879997253, 0.16367408633232117, 0.05332644656300545, 0.11167823523283005, -0.17135807871818542, 0.010213173925876617, -0.5798000693321228, -0.048816926777362823, 0.1807910054922104, -0.20150208473205566, 0.1643407493...
clusters, the merge operation, and the result of clusters.remove(minclust2). ``` Clustering: 10 clusters [[3], [1], [10], [5], [9], [7], [2], [4], [6], [8]] [5] <- [6] true Clustering: 9 clusters [[3], [1], [10], [5, 6], [9], [7], [2], [4], [8]] [7] <- [8] true Clustering: 8 clusters [[3], [1], [10], [5, 6], [9], [7, ...
[ -0.259294331073761, 0.5011823177337646, 0.224845752120018, -0.0816514641046524, -0.06617410480976105, 0.4197726249694824, 0.6001598238945007, 0.08819234371185303, -0.08164485543966293, -0.5494916439056396, -0.42280903458595276, 0.3078385293483734, -0.15456943213939667, 0.3212006986141205, ...
[5, 6, 4], [7, 8]] [10, 9, 5, 6, 4] <- [5, 6, 4] false Clustering: 5 clusters [[3, 2], [1], [10, 9, 5, 6, 4, 5, 6, 4], [5, 6, 4], [7, 8]] [10, 9, 5, 6, 4, 5, 6, 4] <- [5, 6, 4] false ``` The the [10, 9, 5, 6, 4, 5, 6, 4, ...] set just grows infinitely from there. **Edit: to clarify, I'm using a `HashSet<Integer>` f...
[ -0.2675618827342987, 0.40806809067726135, 0.13874392211437225, -0.07844571024179459, 0.2103801816701889, 0.4012525677680969, 0.47505906224250793, -0.05793740227818489, -0.4537004232406616, -0.5765549540519714, -0.3917560875415802, 0.04680180922150612, -0.25995105504989624, 0.29994934797286...
cached. You need to remove it, alter it and then re-insert it.
[ 0.1975218504667282, 0.17410461604595184, -0.07419828325510025, 0.018968665972352028, 0.3705506920814514, 0.41695091128349304, -0.1579333245754242, 0.3037591278553009, 0.3058202564716339, -0.6735050082206726, -0.12840646505355835, 0.20541688799858093, -0.20618818700313568, 0.331408321857452...
Is there a better way to require that an argument is not null in a method? I keep checking if any of the arguments that my method requires are null, as show below. But I'm wondering if there is a better way. ``` public void MyMethod(string a, int b) { if(a==null){throw new ArgumentNullException("a");} if(b==null...
[ 0.42245015501976013, 0.048802971839904785, 0.09628849476575851, -0.19650879502296448, -0.035305265337228775, 0.10341278463602066, 0.533737063407898, -0.11384467780590057, 0.0841137170791626, -0.5372549891471863, 0.2031567096710205, 0.8879620432853699, -0.6713769435882568, -0.15993477404117...
I requested 100 pages that all 404. I wrote ``` { var s = DateTime.Now; for(int i=0; i < 100;i++) DL.CheckExist("http://google.com/lol" + i.ToString() + ".jpg"); var e = DateTime.Now; var d = e-s; d=d; Console.WriteLine(d); } static public bool CheckExist(string url) { ...
[ 0.11839601397514343, -0.09290612488985062, 0.8693867325782776, -0.03073262982070446, -0.08792581409215927, 0.16606509685516357, 0.5903184413909912, -0.2815282344818115, 0.27275964617729187, -0.6477324366569519, -0.5221017003059387, 0.40731433033943176, -0.29814136028289795, 0.3247714042663...
try { wreq = (HttpWebRequest)WebRequest.Create(url); wreq.KeepAlive = true; wreq.Method = "HEAD"; wresp = (HttpWebResponse)wreq.GetResponse(); ret = true; } catch (System.Net.WebException) { } finally { if (wresp != null)
[ 0.12086369842290878, -0.42000317573547363, 0.6385102868080139, -0.041654765605926514, 0.16306056082248688, -0.062085941433906555, 0.8975360989570618, -0.3387156128883362, 0.06502737104892731, -0.6182690262794495, -0.39173051714897156, 0.5625113248825073, -0.24508653581142426, 0.08664383739...
wresp.Close(); } return ret; } ``` Two runs show it takes 00:00:30.7968750 and 00:00:26.8750000. Then i tried firefox and use the following code ``` <html> <body> <script type="text/javascript"> for(var i=0; i<100; i++) document.write("<img src=http://google.com/lol" + i + ".jpg><br>"); </script> </body...
[ 0.06246938556432724, -0.009992782026529312, 0.8168827891349792, -0.1636902242898941, -0.24702198803424835, 0.13173598051071167, 0.7216054797172546, -0.465370774269104, -0.12135722488164902, -0.7668920755386353, 0.19342294335365295, 0.8249849677085876, 0.35245850682258606, -0.20808456838130...
say 1) it still needs to check the headers from the remote server to see if it has been updated (which is what i want my app to do) 2) I am not receiving the body, my code should only be requesting the header. So, how do i solve this? Probably Firefox issues multiple requests at once whereas your code does them one by ...
[ 0.7565047144889832, 0.07790271192789078, 0.44097432494163513, 0.2225583791732788, -0.08465220034122467, -0.2286972999572754, 0.3536805510520935, -0.2912057936191559, -0.2616425156593323, -0.5708581805229187, 0.17697878181934357, 0.44647493958473206, -0.4323101341724396, 0.03639031574130058...
This code compiles fine in Java <= 1.4. Java 1.6 bitches and moans with the warning: "The method add(Object) belongs to the raw type Collection. References to generic type Collection should be parameterized" ``` import org.apache.commons.collections.Buffer; import org.apache.commons.collections.BufferUtils; import or...
[ 0.12983761727809906, 0.024563409388065338, 0.29956677556037903, 0.038136404007673264, -0.3288435637950897, -0.17858602106571198, 0.3310477137565613, -0.6501497626304626, -0.28708314895629883, -0.5074271559715271, 0.029601765796542168, 0.22233180701732635, -0.7252468466758728, 0.32275295257...
need to suppress (or live with) the warning. As an alternative, there is a [fork of Commons Collections that supports generics](http://larvalabs.com/collections/), and [Google also has a Collections library](http://code.google.com/p/google-collections/). I have not checked if either of them has a Buffer, though, and i...
[ 0.49713754653930664, 0.05139583721756935, 0.04940799996256828, 0.011662169359624386, -0.18459093570709229, -0.29606208205223083, 0.6217883229255676, -0.035621579736471176, -0.22228507697582245, -0.5603591203689575, -0.3506542444229126, 0.41788434982299805, -0.5703165531158447, 0.2349244356...
Any one know how can I display the loading progress with completed % on my client side while the system is still getting data in the server side. For example, when I press 'ok' button in the client side, it will call to server side to collect data from the database, the whole process may take 2 to 3 mins. How can I di...
[ 0.23075158894062042, -0.06338667869567871, 0.4712843894958496, 0.12675663828849792, -0.23238550126552582, 0.09158088266849518, 0.2698218524456024, -0.03774949163198471, -0.4113844931125641, -0.698284387588501, 0.02671588957309723, 0.5113580822944641, 0.18318061530590057, -0.149174675345420...
server-side and keep the percentage loaded in the session. That way, client-side you could make a request via AJAX to another php script returning the percentage loaded. You would end up with 2 server-side scripts (one to fetch the data and other to fetch the percentage) and one AJAX request client side. I think tha...
[ 0.30231472849845886, -0.1136595830321312, 0.33616432547569275, 0.2655002176761627, -0.6429741978645325, 0.06280995905399323, -0.12772832810878754, -0.09818293154239655, -0.01554397027939558, -0.5934138298034668, 0.5263404250144958, 0.6928560733795166, 0.18762581050395966, -0.23682367801666...
I have a bit of Python to connect to a database with a switch throw in for local versus live. ``` LOCAL_CONNECTION = {"server": "127.0.0.1", "user": "root", "password": "", "database": "testing"} LIVE_CONNECTION = {"server": "10.1.1.1", "user": "x", "password": "y", "database": "nottesting"} if debug_mod...
[ 0.3343939483165741, 0.16763339936733246, 0.37318745255470276, -0.4051789343357086, 0.001557465991936624, -0.14432545006275177, 0.4499228000640869, 0.009170162491500378, -0.10553597658872604, -0.8705196380615234, 0.08992946892976761, 0.6226198077201843, -0.15851759910583496, 0.1085353270173...
(Linux, Python 2.4) I'm getting: ``` UnboundLocalError: local variable 'connection_info' referenced before assignment ``` I see the same error even if I remove the if/ else and just assign connection info directly to the LIVE\_CONNECTION value. If I hard-code the live connection values into the last line, it all wor...
[ 0.24052345752716064, 0.047977667301893234, 0.3579573333263397, -0.424346387386322, 0.2852385938167572, -0.10622672736644745, 0.3386114239692688, 0.23496213555335999, -0.4202174246311188, -0.5893632769584656, -0.09841083735227585, 0.7113322019577026, -0.4507989287376404, 0.26359257102012634...
I have the following PHP code, which is meant to insert data in the event that the username field is empty for a given username, or update data if a username exists. At the moment, the insert was previously working fine, but it would never switch to the update clause. Now however, the insert clause fails to recognise ...
[ 0.11511176079511642, 0.24891234934329987, 0.5431876182556152, -0.18113550543785095, -0.06592786312103271, -0.04807174950838089, 0.3420027494430542, -0.3122447729110718, 0.17510823905467987, -0.5358980298042297, 0.21660400927066803, 0.316628634929657, -0.22873187065124512, 0.248803228139877...
{ $checkUsername = $row['username']; } if ($checkUsername == null) { $userQuery = "INSERT INTO USERS VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; if ($userInfo = $con->prepare($userQuery)) { $userInfo->bind_param("ssssssssssssssssssss", $username, $firstname, $lastname, $flaggedauc...
[ -0.25423553586006165, 0.13241581618785858, 0.6987044811248779, -0.4259680509567261, 0.2933875322341919, 0.2517523765563965, 0.4527190327644348, -0.48405349254608154, -0.0880199670791626, -0.5417464971542358, -0.49263280630111694, 0.40670695900917053, -0.5033309459686279, -0.024993466213345...
?, lastauction = ?, street1 = ?, city1 = ?, postcode1 = ?, street2 = ?, city2 = ?, postcode2 = ?, phone = ?, mobilephone = ?, fax = ?, email = ?, website = ?, bank = ?, banknumber = ?, accoutnumber = ? WHERE username = ?"; if ($userInfo = $con->prepare($userQuery)) { $userInfo->bind_param("sssssssssssssssssss", $fi...
[ -0.2526441514492035, 0.018866008147597313, 0.6401321887969971, -0.37036797404289246, 0.12407553941011429, 0.2574106454849243, 0.5870793461799622, -0.630251944065094, -0.14834851026535034, -0.47221407294273376, -0.6932430863380432, 0.22123025357723236, -0.3424588441848755, -0.09515152871608...
update or an insert depending on the content of $username matched against the username field? ``` Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given ``` That's your error message? I think your problem is this line: ``` $xblah = $con->query($usernameQuery); ``` Do a `var_dump` on $...
[ -0.18303854763507843, 0.06400728225708008, 0.37801632285118103, -0.16858668625354767, 0.18809685111045837, -0.10077085345983505, 0.582587480545044, 0.05334702879190445, -0.20740512013435364, -0.47175508737564087, -0.22522281110286713, 0.8829860687255859, -0.5454632639884949, 0.156287863850...
I'm working on a project with a DLL and an EXE in visual studio 2005. Amongst the code for the DLL is a template for a growable array class: ``` template <class Type> class GArray { Type *p; uint32 len; uint32 alloc; protected: bool fixed; public: /// Constructor GArray(int PreAlloc = 0) ...
[ 0.18407683074474335, -0.08820784091949463, 0.10997643321752548, -0.3378836512565613, -0.10143968462944031, 0.10101703554391861, 0.07457960397005081, -0.04647831618785858, -0.1501283198595047, -0.5074116587638855, -0.025197742506861687, 0.41708722710609436, -0.4034484028816223, 0.1272726953...
alloc = PreAlloc; if (alloc) { int Bytes = sizeof(Type) * alloc; p = (Type*) malloc(Bytes); if (p) { memset(p, 0, Bytes);
[ -0.1703677922487259, -0.0806863084435463, 0.5561412572860718, -0.2814079821109772, 0.38565605878829956, 0.5570943355560303, 0.18542422354221344, -0.29353660345077515, -0.2824938893318176, -0.4617347717285156, -0.7487278580665588, 0.47296589612960815, -0.2469063699245453, 0.0970254018902778...