text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
method (or in a test method). When the JUnit examples create an ArrayList in the setUp method, they all go on to test the behavior of that ArrayList, with cases like testIndexOutOfBoundException, testEmptyCollection, and the like. The perspective there is of someone writing a class and making sure it works right. You...
[ 0.34058019518852234, -0.14847157895565033, -0.3180631101131439, 0.28814759850502014, -0.20398330688476562, -0.2248799353837967, 0.26113995909690857, -0.3797808885574341, -0.04959462955594063, -0.43808528780937195, 0.0750991553068161, 0.32389798760414124, -0.41543957591056824, -0.1162525787...
matter) in your test code, it's probably not because you want to test it--it's just part of the test fixture. In this case, you can safely assume it works as intended, so initializing it in the declaration won't be a problem. For what it's worth, I work on a reasonably large, several-year-old, TDD-developed code base....
[ 1.146286129951477, 0.26544898748397827, 0.24839289486408234, 0.076643206179142, -0.01655072346329689, -0.061217013746500015, 0.20647035539150238, -0.43373018503189087, 0.04179149493575096, -0.11317703872919083, 0.0248379148542881, 0.6256471276283264, -0.07302630692720413, 0.238951310515403...
In the past I've worked with -Wall and other switches for gcc to eliminate every compiler warning for projects I've been involved in. Similarly, in Perl, I always program with use strict and use warnings (and often -T as well) to try to achieve the best code quality I can. I understand that a few years ago, the Perl po...
[ 0.3134021461009979, 0.2653391361236572, -0.1205778568983078, -0.30536970496177673, -0.3492506444454193, -0.36490893363952637, 0.18380539119243622, 0.19207622110843658, -0.27603620290756226, -0.47251206636428833, -0.321972131729126, 0.7337533235549927, -0.41772669553756714, 0.07437866181135...
more warnings to their code with Perl::Critic, which warns them when they violate best practices found in Damian Conway's Perl Best Practices book (and from other sources, I believe). I always had a good feeling about code that I had cleaned up this way, but sometimes I couldn't avoid the feeling that some of the work...
[ 0.2971594035625458, 0.332135409116745, -0.18167948722839355, -0.2813296318054199, -0.22226212918758392, -0.11041037738323212, 0.7620505690574646, 0.10211657732725143, -0.23850113153457642, -0.4626225531101227, -0.004695084877312183, 0.7664452791213989, -0.34214431047439575, 0.1126914024353...
It works just fine in that case, but gcc warnings would let you know that this function really ought to look like: ``` int main(int args, char* argv) { ``` I must've typed a couple of hundred unused int args, char\* argv lines back in the day. Did I really make my code better, or just wear my fingers down shorter? ...
[ 0.1960200071334839, 0.19192887842655182, 0.06527189165353775, -0.3199640214443207, 0.1401253491640091, -0.016171569004654884, 0.7241142392158508, 0.1783381700515747, -0.3035930395126343, -0.4624330699443817, 0.18406322598457336, 0.5275394916534424, -0.4099079966545105, -0.11530959606170654...
with compiler directives to suppress warnings (usually in tiny minimal methods to factor out the bad practice of ignoring warnings), but I'm finding ways to handle those, as well. Is this worth a programmer's time? Will a project really be much better if you track down every single compiler warning? If nothing else, ...
[ 0.621300458908081, 0.2378620207309723, -0.06306849420070648, 0.1600843369960785, 0.03015167824923992, -0.22903376817703247, 0.3109978437423706, 0.11999136954545975, -0.4191538393497467, -0.3365324139595032, -0.21170787513256073, 0.3015037775039673, -0.32775115966796875, -0.0772413909435272...
disable the warning -- if you're not going to act on it, having the warning is just preventing you from detecting when new warnings appear. Easiest way to get and keep the code warning-free is simply to always compile with -Werror (/WX in Visual Studio) or equivalent.
[ 0.6328466534614563, 0.0998920351266861, 0.12972313165664673, 0.3089190423488617, 0.05034375563263893, -0.43179765343666077, 0.6759753227233887, -0.21524183452129364, -0.05703115835785866, -0.45512017607688904, -0.3884080946445465, 0.6140944361686707, -0.02588842809200287, -0.22975151240825...
Can I set a Range Object to be equal to a set of non-sequential cells? I want my Range to be equal to cells A1, A3, A5 etc, where I can pick and choose the rows and columns at will. Sure, for example this selects a fairly random set of cells: ``` Range("A1:C8,E13:G21,C20:D26,L13:N22").Select ``` and this selects the...
[ 0.15905115008354187, 0.011835138313472271, 0.18784412741661072, -0.13433513045310974, 0.054297663271427155, 0.5621574521064758, 0.016676103696227074, -0.5815209150314331, -0.2776124179363251, -0.6627276539802551, 0.22951771318912506, 0.22753098607063293, -0.3672240376472473, 0.080734856426...
Let's say I have a resource that can have two different behaviors when delete is called 1. The resource is deleted. 2. The resource is moved to the recycle bin. How would model it in a REST compliant way? I thought about the following solution: ``` DELETE /myresource ``` moves the resource to the recycle bin...
[ -0.06100255250930786, -0.2535744607448578, 0.28446120023727417, -0.03437398746609688, 0.03576746955513954, -0.11452861875295639, 0.27396687865257263, -0.11626394838094711, -0.17747940123081207, -0.5843833684921265, -0.32991042733192444, 0.783001184463501, -0.25009894371032715, 0.3592466115...
parameter, so it sounds like good strategy to me. If you were to perform the same action like so: ``` DELETE /myresource.force ``` that would act like another resource, which wouldn't be optimal.
[ 0.052411921322345734, -0.06721530854701996, 0.18081147968769073, 0.12539924681186676, -0.16228139400482178, 0.07618161290884018, -0.06625998020172119, -0.04827892780303955, -0.10448221862316132, -0.6282158493995667, 0.14720290899276733, 0.8877447247505188, -0.1532304584980011, 0.2278958559...
I am making an app (asp.net/c#) that will autosuggest a couple fields that users type in. Each user will end up building their own auto-suggest list. Every time they add an item, if it's a new word, it will get added to their list of auto-suggests, just like gmail. I was wondering how most people go about this? Making...
[ 0.577320396900177, 0.2883598804473877, 0.5239642262458801, -0.00040392280789092183, -0.14004629850387573, 0.19118571281433105, 0.1050015464425087, -0.07349374890327454, -0.08687768876552582, -0.6937759518623352, 0.14101353287696838, 0.1225077286362648, -0.15469945967197418, 0.1383650004863...
questions, but what I am basically looking for is best practices. Thank you. I would store the values in a database (where you are storing their user profiles maybe), and pull the values into ASP.NET Session when the user logs in. Then just use the values from the Session for the auto-complete values. This way you will...
[ 0.6467756628990173, -0.014168069697916508, -0.0840400978922844, 0.41624370217323303, 0.1146823912858963, -0.3048315942287445, 0.38135528564453125, 0.004841378424316645, -0.06083002686500549, -0.591517448425293, 0.3909187316894531, 0.7941681146621704, 0.08963588625192642, -0.305313378572464...
Is there a way to customize XML serialization in JAXB, in the same way that it's possible using IXmlSerializable in .NET? (i.e. the ability to directly control serialization of an object using the equivalent of an XmlReader/Writer). I've taken a look at XmlAdapter and @XmlJavaTypeAdapter, but they just seem to be used...
[ 0.31604722142219543, -0.24868007004261017, 0.24248965084552765, 0.22510144114494324, -0.2882031202316284, -0.0997241958975792, 0.03738405555486679, -0.0698326900601387, -0.12697920203208923, -0.5782667398452759, 0.009883535094559193, 0.5750681757926941, -0.2846870422363281, -0.032354362308...
found a way to solve the problem, but it's such a nasty hack I'll probably go with one of the solutions suggested by the other posters. I'm not sure I fully understand what your goal is, but maybe you could do what you want to do programatically inside the no-args constructor of your root object, which will be called t...
[ 0.43096598982810974, 0.007863770239055157, 0.10371705889701843, 0.36980995535850525, 0.10650089383125305, 0.030360350385308266, 0.2403298020362854, 0.2468029111623764, -0.2381334900856018, -0.33755993843078613, 0.1351584941148758, 0.2308102250099182, -0.19211876392364502, 0.185991719365119...
In the code below. I expected true but i am getting false instead. What am I missing? ``` var text = "Sentence $confirmationlink$ fooo"; alert(placeHolderExists(text,'confirmationlink'); // alerts false function placeHolderExists(text,placeholdername) { var pattern = new RegExp('\$'+placeholdername+'\$'); ...
[ -0.10309168696403503, -0.12338825315237045, 0.308515727519989, -0.38532015681266785, 0.20971126854419708, 0.13099044561386108, 0.7822969555854797, -0.3867722451686859, -0.18344901502132416, -0.5092440247535706, -0.4442735016345978, 0.3789588510990143, -0.507251501083374, 0.0099971247836947...
I have a 2 monitors and a WinForm app that launches a WPF window. I want to get the screen that the WinForm is on, and show the WPF window on the same screen. How can I do this? WPF doesn't include the handy System.Windows.Forms.**Screen** class, but you can still use its properties to accomplish your task in your WinF...
[ 0.4348091185092926, -0.11763107031583786, 0.6607955098152161, -0.10144253820180893, -0.06488335877656937, -0.1345331370830536, 0.13039828836917877, -0.28491756319999695, -0.014660259708762169, -1.0121535062789917, 0.09625273942947388, 0.7567437887191772, -0.08281618356704712, 0.11597313731...
Screen.FromControl(this); _wpfWindow.StartupLocation = System.Windows.WindowStartupLocation.Manual; _wpfWindow.Top = screen.Bounds.Top; _wpfWindow.Left = screen.Bounds.Left; _wpfWindow.Show(); ``` The above code will instantiate the WPF Window at the Top-Left corner of the screen containing your WinForms Window. I'll...
[ -0.019203346222639084, -0.06291913986206055, 0.8617386817932129, -0.18834197521209717, 0.1115894690155983, -0.36906808614730835, 0.0585516132414341, -0.1166701689362526, -0.1940397322177887, -0.9132547378540039, -0.12919266521930695, 0.5659494996070862, -0.1594667136669159, -0.058383610099...
the WPF Window (and obviously the mouse could be on a different screen as your WinForms app if the user moves it quickly, or you use a default button, or whatever). Edit: [Here's a link to an SDK document](http://blogs.msdn.com/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx) a...
[ 0.1084684506058693, -0.3334835469722748, 0.40976232290267944, -0.01269474532455206, -0.10722131282091141, -0.13939304649829865, 0.049853794276714325, -0.2567988634109497, -0.4246634542942047, -0.8569999933242798, -0.13334862887859344, 0.6418573260307312, -0.2610960006713867, -0.10012608021...
I use the console.out.writeline() to print the coordinates belonging to the different sprites in a XNA game. But after a few seconds, the game starts to go really slow, and almost stop. (When not writing to the console, there are no problems with performance). (The sprite's positions are written in every update meth...
[ 0.11161232739686966, -0.11008986085653305, 0.5261644721031189, 0.19489146769046783, -0.13221484422683716, -0.058262914419174194, 0.14204725623130798, -0.16923405230045319, 0.10199974477291107, -0.7320979237556458, 0.3181157410144806, 0.28981730341911316, -0.029703818261623383, 0.2288271933...
up while this is running? If so, try minimising it when you're not interested. My guess is it's the scrolling which is causing the problem. EDIT: Okay, it seems some evidence is in order. A few tests... I don't have XNA installed, but different ways of writing to consoles are still interesting. I wrote the numbers 0-...
[ 0.32249197363853455, 0.019373377785086632, 0.7669243216514587, 0.254108726978302, -0.0030981723684817553, 0.22812849283218384, 0.4215284585952759, 0.014521081000566483, -0.47606196999549866, -0.8110716342926025, -0.14420905709266663, 0.5049306750297546, 0.004956207703799009, -0.02256304770...
minimised: 4149ms * As a console app, not under the debugger, console not minimised: 14514ms So as you can see, the Visual Studio console is painfully slow, a non-minimised "normal" console is next slowest, a minimised console is reasonably nippy, and writing to a file is very quick. I stand by my advice to try writi...
[ -0.23108798265457153, -0.16346189379692078, 0.4037649631500244, 0.25082799792289734, 0.08656708151102066, 0.17589890956878662, 0.39663034677505493, 0.08343794196844101, -0.08496395498514175, -0.6484904289245605, -0.13811233639717102, 0.529072642326355, 0.10349749028682709, -0.1355786472558...
I would like do do the following in Javascript (pseudo code): ``` myString.replace(/mypattern/g, f(currentMatch)); ``` that is, replace string isn't fixed, but function of current match. Are you able to write to a log file instead of the console? That may well be faster due to buffering and the lack of scrolling, di...
[ 0.03320787847042084, 0.1087026596069336, 0.5386255979537964, 0.15853673219680786, 0.15904903411865234, -0.1304369419813156, 0.22619394958019257, 0.13359950482845306, -0.06777308136224747, -0.7243046760559082, 0.023209040984511375, 0.5942719578742981, -0.28065598011016846, -0.00176078244112...
consoles are still interesting. I wrote the numbers 0-99999 to various consoles: * As a WinForms app, under the debugger, to the Visual Studio console: 135000ms, whether the console was visible or covered up. * As a WinForms app, under the debugger, writing to a file: 160ms * As a console app, not under the debugger, ...
[ -0.08004114031791687, 0.06448603421449661, 0.6803401112556458, 0.24391230940818787, 0.20168910920619965, 0.06005179509520531, -0.008547998033463955, 0.46894747018814087, -0.15679022669792175, -0.7261922359466553, 0.060263652354478836, 0.5395940542221069, 0.11421468108892441, -0.05180444195...
stand by my advice to try writing to a file instead of the console, and otherwise if it's a standalone console, try to minimise it for most of the time.
[ 0.40603020787239075, 0.21272186934947968, -0.059473916888237, 0.14754875004291534, 0.050254207104444504, -0.31003352999687195, 0.062386706471443176, 0.27132973074913025, -0.0593583881855011, -0.5157939195632935, 0.02859172411262989, 0.6766257286071777, 0.11483849585056305, -0.4135483503341...
I was just checking in my code and realized that I'm have no idea what criteria my code should ideally meet to perform a check in. Yesterday I checked in after having it my project checked out for a week. Today I checked in again after making little updates. Sometimes I like to keep the code I'm working on checked ou...
[ 0.9537136554718018, 0.1462627798318863, 0.17636844515800476, -0.05110064148902893, 0.33063146471977234, -0.26227957010269165, 0.5002068281173706, -0.12338780611753464, -0.09815827757120132, -0.5387648940086365, 0.15646512806415558, 0.22557349503040314, 0.1361675262451172, -0.00700546940788...
forget what I'm working on). Should I be concerned about hitting a critical mass of code or not being able to find bugs because there's too much code to search though? Check ins should be made often. A check in should be * Atomic. Contain all needed changes but no more. Which also means that * whitespace changes go...
[ 0.5067266821861267, 0.12825554609298706, 0.16168607771396637, 0.11528295278549194, 0.21338552236557007, -0.2075386941432953, 0.44913819432258606, -0.07137195020914078, -0.5874965786933899, -0.8190069198608398, -0.19194622337818146, 0.39024633169174194, 0.05113241448998451, 0.12337363511323...
you aren't working on that particular source (or even project) anymore. * working. Only commit if the code actually builds and does what it claims to do. If you need your personal playground for committing consider a working branch or mirroring the repository with something like git svn. Remember to merge changes done...
[ 0.8904744982719421, -0.14479228854179382, -0.31131041049957275, 0.2534377872943878, -0.30722713470458984, -0.12649403512477875, 0.45635730028152466, 0.1667586714029312, -0.499836266040802, -0.7261545062065125, 0.015917934477329254, 0.5937827229499817, -0.21832630038261414, -0.0026187719777...
I'm currently working on a solution that involves the following work flow: 1. System sends out an email which includes some kind of identifier/sessionID. 2. User replies to email. 3. System receives reply, and parses email for sender, identifier, and user response. 4. System queries a sql database to retrieve some inf...
[ 0.06683648377656937, 0.20173630118370056, 0.4942314326763153, 0.11143290251493454, 0.19540700316429138, 0.11684208363294601, 0.055952154099941254, -0.080306276679039, -0.2356240153312683, -0.5855588316917419, -0.1344209909439087, 0.438015878200531, -0.35646364092826843, 0.2642170786857605,...
be? In this case the business has already decided on the use BizTalk, so I would need to justify a negative answer. We have other BizTalk solutions already in place, so the product and time cost of configuring an initial BizTalk server setup does not factor here. Thanks. Edit: It would be fair to say that the use o...
[ 0.6704450249671936, 0.07437096536159515, -0.00366009003482759, 0.11799843609333038, -0.20668528974056244, 0.10450907051563263, 0.17803247272968292, 0.118111751973629, -0.010488062165677547, -0.4750528335571289, -0.09950805455446243, 0.5520766377449036, -0.5513464212417603, -0.0115297576412...
question itself, the scenario is of a workflow solution. You could either use WF or BizTalk depending on how you want to implement and manage it but BizTalk offers the following advantages over WF * BizTalk has extensive line of adapters and pipeline components that are often a must-have for cross-platform Enterpri...
[ 0.47074633836746216, -0.1521291583776474, -0.08212727308273315, 0.04795541241765022, -0.3087710440158844, -0.016777416691184044, 0.040118634700775146, -0.33361154794692993, -0.24344144761562347, -0.6678913235664368, 0.01501864567399025, 0.46473801136016846, -0.597362220287323, -0.301892220...
Business Activity Monitoring (BAM) Transaction: supports both atomic transaction and long-running transaction Extensive set of tools for admin, management, migration and scaling (However, all this changes with Dublin!!!) Having read your requirements once again, I think that your application doesn't fall ...
[ 0.17956455051898956, 0.053535591810941696, 0.33515307307243347, -0.022289926186203957, 0.034804265946149826, -0.35704323649406433, 0.2445758581161499, -0.2711353898048401, -0.6140482425689697, -0.3937073051929474, 0.10608658194541931, 0.44481411576271057, -0.35479918122291565, -0.201082065...
I'm using a graph with a `<mx:LineSeries>`. When I hover over the line it shows the data points as little circular points. How can I get these points to display all of the time? To turn off the datatips for a particular series, set the series.interactive property to false.
[ 0.5266939401626587, -0.159850612282753, 0.6360539793968201, 0.25641870498657227, -0.04937589541077614, 0.2582971155643463, 0.054624222218990326, 0.10947349667549133, -0.3356629014015198, -0.5753440260887146, 0.20387256145477295, -0.17156550288200378, -0.1191515251994133, 0.5433868765830994...
I am trying to build a java drum machine that needs to play WAV sound samples of the various drum parts (bass drum, snare, etc). Because I need to play the sounds in a tight sequence, I need high performance. Currently I'm using: ``` import sun.audio.*; import java.io.*; public class MusicPlayer { private String...
[ 0.7739682793617249, 0.09804514050483704, 0.2501664459705353, -0.30846044421195984, 0.28219908475875854, -0.04683210328221321, 0.14836083352565765, -0.3644677400588989, -0.28941109776496887, -0.5267204642295837, 0.06665530800819397, 0.979314923286438, -0.5530789494514465, 0.241022527217865,...
InputStream in = new FileInputStream(filename); AudioStream as = new AudioStream(in); AudioPlayer.player.start(as); } catch (IOException e) { e.printStackTrace(); } } } ``` as suggested here: [How can I play sound in Java?](https://stackoverflow.com/...
[ 0.10566404461860657, -0.15649870038032532, 0.6362423896789551, -0.2457476258277893, 0.09643524885177612, -0.37298983335494995, 0.12190645188093185, -0.4800735414028168, -0.03391985967755318, -0.5649226903915405, 0.03173155337572098, 1.003296136856079, -0.20428989827632904, 0.10417436808347...
it still sounds choppy at high tempo and when I do cpu intensive stuff like resizing the app window. Any tips on improving performance? BTW. I've also read that `sun.audio.*` is deprecated. Is there a similar solution? To turn off the datatips for a particular series, set the series.interactive property to false.
[ 0.49166926741600037, 0.07495754957199097, 0.24401725828647614, 0.14672976732254028, -0.05519559234380722, -0.20935384929180145, 0.5047222375869751, 0.02773389033973217, -0.011336563155055046, -0.5683072805404663, -0.18560753762722015, 0.8207348585128784, 0.07976704090833664, 0.084276944398...
I know there is no concept of an abstract class in Ruby. But if it needs to be implemented, how do I go about it? I tried something like this: ``` class A def self.new raise 'Doh! You are trying to write Java in Ruby!' end end class B < A ... ... end ``` But, when I try to instantiate B, it is internall...
[ 0.39027664065361023, 0.260467529296875, -0.011726119555532932, -0.29948654770851135, -0.3410433530807495, -0.2167927771806717, 0.6699704527854919, -0.2472309023141861, -0.4362020492553711, -0.480282187461853, 0.18968838453292847, 0.4269334375858307, -0.41127142310142517, 0.2722285687923431...
like using abstract classes in Ruby (there's almost always a better way). If you really think it's the best technique for the situation though, you can use the following snippet to be more declarative about which methods are abstract: ``` module Abstract def abstract_methods(*args) args.each do |name| clas...
[ 0.10850026458501816, -0.08753145486116409, 0.2108267843723297, -0.03688471019268036, -0.1355527937412262, -0.3686598539352417, 0.44751298427581787, -0.4447062313556671, -0.2912689745426178, -0.34101325273513794, -0.23318542540073395, 0.5356494784355164, -0.36496248841285706, -0.10596465319...
important that this END is capitalized, since it marks the end of <<-END end end end require 'rubygems' require 'rspec' describe "abstract methods" do before(:each) do @klass = Class.new do extend Abstract abstract_methods :foo, :bar end end it "raises NoMethodError" do proc { ...
[ -0.011820277199149132, 0.03532067686319351, 0.46411195397377014, -0.2428722232580185, 0.0009173615253530443, -0.12820228934288025, 0.6155405044555664, -0.6533768177032471, -0.08974287658929825, -0.2130284458398819, -0.41169899702072144, 0.2697283923625946, -0.34059885144233704, 0.079795323...
:overridden end end subclass.new.foo.should == :overridden end end ``` Basically, you just call `abstract_methods` with the list of methods that are abstract, and when they get called by an instance of the abstract class, a `NotImplementedError` exception will be raised.
[ 0.05176563560962677, 0.11973779648542404, 0.32530269026756287, -0.236723393201828, -0.13669465482234955, -0.4546946883201599, 0.3922172486782074, -0.3513184189796448, -0.08101538568735123, -0.2577238380908966, -0.16009442508220673, 0.47695061564445496, -0.3198392391204834, 0.40954285860061...
I'm in the process of moving SQL server to a separate machine. Currently we are running our web server and sql server on the same box. So we have a production server with IIS and SQLServer and then a separate development server that mirrors this setup. When it comes to our asp.net control's app.config and web site's w...
[ 0.39296212792396545, 0.06965731084346771, 0.17060227692127228, 0.19922786951065063, -0.17944888770580292, -0.06394509971141815, 0.0026052361354231834, -0.3495202660560608, -0.09016697853803635, -0.7050895690917969, 0.14951491355895996, 0.37936219573020935, -0.31847456097602844, 0.452987760...
without needing to edit the web.config and app.config each time we deploy or compile? Is this something Visual Source Safe could handle? Here's the solution I use. In the Web.Config, place the following "include" line: ``` <connectionStrings configSource="WebCS.config"/> ``` Then, create the WebCS.config file and en...
[ 0.3486752212047577, 0.29358384013175964, 0.7770640254020691, -0.005160992499440908, 0.13383126258850098, -0.1920233964920044, -0.021932389587163925, -0.13454434275627136, -0.29783007502555847, -1.0530056953430176, -0.19771595299243927, 0.656247615814209, -0.32992643117904663, -0.0040844404...
you without messing with your connection string.
[ 0.6007536053657532, -0.012441356666386127, 0.07632898539304733, 0.45968618988990784, -0.1853036731481552, -0.21622489392757416, 0.4229247570037842, -0.2251487672328949, -0.3204195499420166, -0.3305847942829132, -0.1636226773262024, 0.4461287260055542, -0.1816023588180542, -0.13261893391609...
I have a base class that inherits List<> which has multiple classes derived from it. I want to create a method that can add items to any class that has inherited from this base class, is this possible ? **pseudo code:** ``` public class BaseList<T> : List<T> where T: baseItem { } public BaseList<T> AddItems<T>(int ...
[ 0.598624587059021, -0.10581854730844498, 0.3665498197078705, -0.0863146111369133, -0.2035048007965088, -0.010129784233868122, 0.3007366359233856, -0.2549639940261841, -0.20706602931022644, -0.6126621961593628, 0.1924383044242859, 0.3298565745353699, -0.641743004322052, 0.19636280834674835,...
method in a non-generic type: ``` public static TList CreateList<TList,TItem>(int someArg) where TList : BaseList<TItem>, new() where TItem : baseItem, new() { TList temp = new TList(); temp.Add(new TItem()); temp.Add(new TItem()); return temp; } ``` It doesn't seem particularly nice though.....
[ 0.39359405636787415, -0.2132987231016159, 0.29790404438972473, -0.14889521896839142, -0.00920155830681324, -0.111692413687706, 0.31086671352386475, -0.4344155192375183, -0.09868650138378143, -0.20720435678958893, -0.0040801209397614, 0.3392742872238159, -0.6189528703689575, 0.1215114742517...
Does anybody know how to move the keyboard caret in a textbox to a particular position? For example, if a text-box (e.g. input element, not text-area) has 50 characters in it and I want to position the caret before character 20, how would I go about it? This is in differentiation from this question: [jQuery Set Curso...
[ 0.22592633962631226, 0.12140876799821854, 0.7423584461212158, 0.11056332290172577, 0.21812894940376282, 0.47379589080810547, -0.16646161675453186, -0.4393755793571472, -0.061138346791267395, -0.521177351474762, -0.05836033076047897, 0.49547913670539856, 0.21616268157958984, -0.393850982189...
{ var elem = document.getElementById(elemId); if(elem != null) { if(elem.createTextRange) { var range = elem.createTextRange(); range.move('character', caretPos); range.select(); } else { if(elem.selectionStart) {
[ -0.03908554092049599, -0.319511741399765, 0.39224356412887573, -0.26035076379776, 0.4031772017478943, 0.41133999824523926, 0.2831859290599823, -0.724648118019104, -0.021420102566480637, -0.4854387640953064, -0.7415757179260254, 0.5950795412063599, -0.21002694964408875, 0.12103404104709625,...
elem.focus(); elem.setSelectionRange(caretPos, caretPos); } else elem.focus(); } } } ``` The first expected parameter is the ID of the element you wish to insert the keyboard caret on. If the element is
[ -0.19575563073158264, -0.02371334284543991, 0.8251233100891113, -0.27208375930786133, 0.3884126842021942, 0.24005958437919617, -0.13001151382923126, -0.578731894493103, 0.12946562469005585, -0.6118439435958862, -0.5255869030952454, 0.7748623490333557, -0.2971542179584503, -0.45775932073593...
unable to be found, nothing will happen (obviously). The second parameter is the caret positon index. Zero will put the keyboard caret at the beginning. If you pass a number larger than the number of characters in the elements value, it will put the keyboard caret at the end. Tested on IE6 and up, Firefox 2, Opera 8, ...
[ -0.21122144162654877, -0.2858105003833771, 0.8470708131790161, -0.006428068038076162, 0.1348584145307541, 0.16681066155433655, 0.28722238540649414, -0.33244577050209045, -0.036286816000938416, -0.5091617703437805, -0.08778715133666992, 0.6558026671409607, -0.14429950714111328, -0.132550969...
focus: ``` function addLoadEvent(func) { if(typeof window.onload != 'function') { window.onload = func; } else { if(func) { var oldLoad = window.onload; window.onload = function() { if(oldLoad)
[ 0.13706912100315094, -0.33090198040008545, 0.6751105189323425, -0.44421491026878357, 0.046690765768289566, -0.04699499160051346, 0.011183712631464005, 0.053505368530750275, -0.0661877691745758, -0.5660043954849243, -0.6681333780288696, 0.9775258302688599, -0.4918244481086731, -0.0886368826...
oldLoad(); func(); } } } } // The setCaretPosition function belongs right here! function setTextAreasOnFocus() { /*** * This function will force the keyboard caret to be positioned * at the end of all textareas when they receive focus. */ var textAreas = document.getEle...
[ -0.1258673220872879, 0.03866804391145706, 1.0440723896026611, -0.3968212604522705, 0.33381032943725586, 0.121724933385849, 0.2718065083026886, -0.26211896538734436, -0.12534268200397491, -0.6419053077697754, -0.446591854095459, 0.6824753880500793, -0.22315490245819092, -0.07658854871988297...
textAreas[i].onfocus = function() { setCaretPosition(this.id, this.value.length); } } textAreas = null; } addLoadEvent(setTextAreasOnFocus); ```
[ -0.17307695746421814, -0.05514007434248924, 0.6630609631538391, -0.3371548354625702, 0.13756035268306732, 0.14782801270484924, 0.4724048972129822, -0.30357617139816284, 0.12149841338396072, -0.47880417108535767, -0.5763343572616577, 0.6909902095794678, -0.6483381986618042, -0.2121847122907...
I'm currently trying to verify whether or not, given an unsorted array A of length N and an integer k, whether there exists some element that occurs n/k times or more. My thinking for this problem was to compute the mode and then compare this to n/k. However, I don't know how to compute this mode quickly. My final res...
[ -0.07058819383382797, -0.06266911327838898, 0.23129776120185852, -0.2531825006008148, -0.32723352313041687, 0.05040077492594719, 0.36155077815055847, -0.2135990858078003, -0.2932247519493103, -0.5356072187423706, 0.03419286757707596, 0.39597275853157043, -0.3567562699317932, 0.238134399056...
maxCount = 0; foreach(num, count; counts) { if(count > maxCount) { mostFrequent = num; maxCount = count; } } ```
[ -0.34671640396118164, -0.37921544909477234, 0.4612713158130646, -0.28403106331825256, 0.3562956154346466, -0.22444099187850952, 0.4096463918685913, -0.12987388670444489, -0.07263696193695068, -0.44633227586746216, -0.3934961259365082, 0.9034824371337891, 0.02609674073755741, 0.130192056298...
I need to set the an environment variable from within Perl. Ideally, I need to query a variable and then change it if it is not what is required. Specifically it is the PATH variable I want to change. How do I get and set these variables? If you need to change environment variables globally and permanently, as if you...
[ 0.38155823945999146, -0.12190011888742447, 0.5173814296722412, 0.03749314323067665, 0.20280741155147552, -0.20042702555656433, 0.2750646471977234, -0.19195450842380524, -0.4910922050476074, -0.5798806548118591, -0.10617346316576004, 0.7154056429862976, -0.4308464825153351, 0.18155610561370...
environment variables in some current processes, notably perl.exe and cmd.exe. If you just want to change the current process (and subsequently spawned child processes), then the global %ENV hash variable is what you want (e.g. $ENV{PATH}). See [perldoc perlvar](http://perldoc.perl.org/perlvar.html).
[ -0.19812096655368805, -0.37741991877555847, 0.12355537712574005, 0.14532339572906494, 0.2826090157032013, 0.18498024344444275, -0.24187974631786346, 0.3535442650318146, -0.4750824570655823, -0.6650087833404541, 0.07148141413927078, 0.35096532106399536, -0.43217727541923523, 0.2854934632778...
I have a `DataGrid` in my Silverlight application and it works nicely, adding a row or removing a row as I manipulate the `ItemsSource` collection. However, I want there to be an additional row, or control that always appears after the last data row. I can get the additional control to appear after the last row using ...
[ -0.11072736978530884, -0.2423788607120514, 0.9057385921478271, -0.0007604623679071665, -0.14253321290016174, 0.17177119851112366, 0.2104712426662445, -0.024402020499110222, -0.12539999186992645, -0.5442326068878174, 0.11936715245246887, 0.613235592842102, 0.10224650800228119, 0.10159989446...
the bottom of the data grid rather than to the bottom of the last row. Is there a way I can have the Star height behavior on the RowsPresenter while still having my control appear the way I want? My current thinking is that I need to somehow use the LoadingRow event to find the position of the last row and use a Canv...
[ 0.22340142726898193, -0.2573472261428833, 0.6377734541893005, 0.48909249901771545, 0.025354932993650436, 0.07592516392469406, 0.10473045706748962, 0.197365403175354, -0.18999139964580536, -0.5400061011314392, 0.15328478813171387, 0.5274178385734558, 0.09442218393087387, -0.0698574483394622...
you don't want the custom row to scroll with the rest of the rows (such as in my case, where I wanted another datagrid header row to show totals and float over the other rows). [How do I pin one control below another in Silverlight?](https://stackoverflow.com/questions/849768/how-do-i-pin-one-control-below-another-in-...
[ 0.31077325344085693, -0.03625965490937233, 0.49908363819122314, 0.3223428726196289, 0.01919228956103325, 0.001945579657331109, -0.2428324967622757, -0.31430312991142273, -0.426160991191864, -0.3750631511211395, 0.43434691429138184, 0.3268265426158905, -0.18277795612812042, 0.10846007615327...
then placed the grid inside a ScrollViewer and then sized the scroll viewer row to Star sizing. I did not add the VerticalScrollbar template part into my template as this only scrolls the RowsPresenter. This gave me the exact behaviour I was looking for where a row is added and the custom row remains pinned to the bot...
[ 0.2832431495189667, -0.1734129786491394, 0.7677609920501709, 0.05735687166452408, -0.06875216960906982, -0.008554603904485703, 0.15842731297016144, -0.3340180516242981, -0.07360285520553589, -0.5614860653877258, 0.306323766708374, 0.7576084136962891, -0.017178446054458618, 0.03349678218364...
XAML. ``` <ControlTemplate TargetType="swcd:DataGrid" x:Key="DataGridTemplate"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid Name="Root" Background="{TemplateBinding Background}"> <Grid.RowDefinitions> ...
[ -0.09701331704854965, -0.12286331504583359, 0.6633049249649048, 0.031398750841617584, 0.13489972054958344, 0.004850937053561211, 0.02650337852537632, -0.5200241804122925, -0.32230475544929504, -0.7421417832374573, -0.053426530212163925, 0.41377076506614685, -0.262668251991272, 0.0095074661...
Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions>
[ -0.17043641209602356, -0.07040076702833176, 0.4327937960624695, -0.2266518622636795, -0.15304780006408691, 0.319671094417572, -0.11967252194881439, -0.5013567805290222, -0.49857085943222046, -0.6203086972236633, 0.003519879188388586, 0.7821569442749023, 0.2480078488588333, -0.0674320608377...
<swcdp:DataGridColumnHeader Name="TopLeftCornerHeader" Grid.Column="0"/> <swcdp:DataGridColumnHeadersPresenter Name="ColumnHeadersPresenter" Grid.Column="1"/> <swcdp:DataGridColumnHeader Name="TopRightCornerHeader" Grid.Column="2"/> <ScrollViewer Grid.Row="1" ...
[ -0.7403134107589722, -0.15853215754032135, 0.8074905276298523, 0.12179847061634064, -0.0001985286653507501, -0.23092451691627502, -0.11228397488594055, -0.3181515038013458, -0.3899725675582886, -0.3970634639263153, -0.35167574882507324, 0.38259127736091614, 0.02720813639461994, -0.16983221...
Padding="0,0,0,0" BorderThickness="0,0,0,0" VerticalScrollBarVisibility="Auto"> <Grid > <Grid.RowDefinitions>
[ -0.2530596852302551, -0.3520627021789551, 0.7494229674339294, -0.08128178864717484, -0.034315433353185654, 0.40908950567245483, -0.09739026427268982, -0.3751029074192047, -0.42425858974456787, -0.825771689414978, 0.169227734208107, 0.225226029753685, -0.2053173929452896, -0.159334242343902...
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <swcdp:DataGridRowsPresenter Name="RowsPresenter" Grid.Row="0" /> <Border
[ -0.18908795714378357, -0.21751481294631958, 0.6450648307800293, -0.053509511053562164, -0.028800662606954575, 0.051900219172239304, -0.23355881869792938, -0.31829833984375, -0.5417158007621765, -0.8075006008148193, 0.22574031352996826, 0.4907419979572296, 0.07481487095355988, 0.28083473443...
Margin="1,1,1,1" Padding="2,2,2,2" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
[ 0.07101399451494217, -0.33838406205177307, 0.7286244034767151, 0.12323250621557236, 0.01467963121831417, 0.15616826713085175, 0.07176870107650757, -0.5361288785934448, 0.012349966913461685, -0.6938304901123047, 0.25480538606643677, 0.19860373437404633, -0.0008309212862513959, -0.0114713786...
Grid.Row="1"> <Grid Background="{TemplateBinding Background}"> <Grid.RowDefinitions>
[ -0.04539971053600311, -0.31288519501686096, -0.03928789868950844, -0.04160410538315773, 0.039293691515922546, 0.17773942649364471, -0.24097615480422974, -0.45095494389533997, -0.1465822011232376, -0.942260205745697, -0.03657957911491394, 0.17722803354263306, -0.5262897610664368, 0.07208625...
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <TextBlock
[ -0.38587015867233276, 0.0823083370923996, 0.16458483040332794, -0.2255331575870514, -0.14812985062599182, 0.3825717866420746, 0.0167995635420084, -0.30298933386802673, -0.32914799451828003, -0.837001621723175, -0.03281953185796738, 0.5583608746528625, -0.30417412519454956, -0.2563771903514...
Grid.Row="0" TextAlignment="Left" TextWrapping="NoWrap"
[ -0.3654010593891144, -0.23614837229251862, 0.16023750603199005, -0.19786591827869415, 0.2607642114162445, -0.030110027641057968, 0.08245627582073212, -0.10918678343296051, -0.31461039185523987, -0.6501264572143555, -0.481294184923172, 0.07840988785028458, -0.2479531317949295, 0.25790596008...
Text="Add a new item using the lists below:" /> <mystuff:MySelectionControl HorizontalContentAlignment="Stretch"
[ -0.004926288966089487, -0.15521012246608734, 0.368718683719635, -0.1420232355594635, 0.2755386531352997, 0.15349921584129333, 0.12597475945949554, -0.010731401853263378, -0.48969781398773193, -0.6205142736434937, -0.2981530725955963, 0.3390003740787506, -0.06732147186994553, -0.06908702850...
Grid.Row="1" SelectionChanged="OnSelectionChanged"/> </Grid> </Border>
[ -0.09203291684389114, -0.4068049490451813, 0.31845980882644653, 0.09978891164064407, 0.11321572214365005, 0.1989315003156662, -0.2914070785045624, -0.4290187954902649, -0.42063188552856445, -1.0057477951049805, 0.19603554904460907, -0.09365545213222504, -0.2405361533164978, 0.2485381960868...
</Grid> </ScrollViewer> <Rectangle Name="BottomLeftCorner" Grid.Row="3" Grid.ColumnSpan="2" /> <Grid Grid.Column="1" Grid.Row="3"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" />
[ -0.2642192244529724, -0.004491164814680815, 0.5707780718803406, -0.16025984287261963, -0.09188307076692581, 0.3902188539505005, 0.03555237129330635, -0.5161899328231812, -0.45778733491897583, -0.7783370614051819, -0.21000877022743225, 0.5058632493019104, -0.08053787797689438, -0.1507840901...
<ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Rectangle Name="FrozenColumnScrollBarSpacer" /> <ScrollBar Name="HorizontalScrollbar" Grid.Column="1" Orientation="Horizontal" Height="18" /> </Grid> <Rectangle Name="BottomRightCorner" Grid...
[ -0.4313408434391022, -0.22653554379940033, 0.7600997090339661, 0.20012781023979187, -0.047261498868465424, 0.2891572117805481, -0.11915025115013123, -0.25112253427505493, -0.6407871246337891, -0.5354161262512207, -0.1907348781824112, 0.13871915638446808, 0.30388230085372925, 0.009441786445...
</Grid> </Border> </ControlTemplate> ```
[ 0.039869826287031174, 0.029219400137662888, 0.5294739007949829, 0.06704500317573547, 0.18985407054424286, -0.19261078536510468, -0.170746311545372, -0.0189918614923954, -0.22447030246257782, -0.8882201910018921, -0.2440844625234604, 0.12636439502239227, -0.2040490061044693, 0.1359885334968...
I'd like to ensure that there's never a line break between a radio button and the start of its adjacent label. However, I want text *within* the label to be allowed to wrap. Is this possible? You can see my failed attempts by rendering the following HTML: ``` <html> <head> <style type="text/css"> .box { border: ...
[ 0.6057248115539551, -0.042873844504356384, 0.550385594367981, -0.01450252253562212, 0.0795181393623352, -0.34068065881729126, 0.12461311370134354, -0.410831481218338, -0.34078237414360046, -0.5233584046363831, -0.19460046291351318, 0.4341716170310974, -0.14108256995677948, 0.05090346559882...
string without any spaces, we need it to be truncated, rather than extend beyond the edge of the box -- the problem is visible in the second box: ``` <div class="box"> <input type="radio"/> <label>This is a really long string with no spaces</label> </div> <div class="box"> <input type="radio"/> <label>This...
[ 0.03396568074822426, -0.28975972533226013, 0.3767048716545105, -0.1600392758846283, -0.1847839653491974, -0.39499619603157043, 0.38807201385498047, -0.08098818361759186, -0.1338443160057068, -0.2872617840766907, -0.09448844194412231, 0.40500500798225403, -0.358049601316452, 0.2837459146976...
class="chopped box"> <input type="radio"/> <label>This_is_a_really_long_string_with_no_spaces</label> </div> <hr/> ``` If I add <nobr>, the radio buttons are next to their labels, and so the unspaced string now looks perfect. However, this breaks the first string (the one with spaces), since it no longer wraps...
[ 0.2909117341041565, -0.2795908749103546, 0.6058488488197327, -0.09524646401405334, 0.05949005112051964, -0.39761704206466675, 0.3342916965484619, -0.4381888806819916, -0.19540485739707947, -0.4726144075393677, 0.014270028099417686, 0.6171742677688599, -0.0629454031586647, -0.05959719792008...
select the radio buttons by clicking the text. Then add a span around the text. ``` <div class="chopped box"> <label> <input type="radio"/> <span class="wrappable">This is a really long string with no spaces</span> </label> </div> <div class="chopped box"> <label> <input type="radio"/> <span class="wrappab...
[ 0.30735042691230774, -0.14818276464939117, 0.6234925389289856, -0.32343676686286926, -0.1712474226951599, -0.3585251569747925, 0.34903398156166077, -0.5622231960296631, -0.11032219976186752, -0.32744458317756653, -0.29103899002075195, 0.6395024061203003, -0.3424825668334961, -0.25167769193...
I haven't had a huge opportunity to research the subject but I figure I'll just ask the question and see if we can create a knowledge base on the subject here. 1) Using subdomains will force a client side cache, is this by default or is there an easy way for a client to disable it? More curious about what kind of a pe...
[ 0.6559441089630127, -0.1299273669719696, 0.3127707540988922, 0.297614723443985, -0.27821245789527893, -0.15982665121555328, 0.4135521352291107, 0.2747516632080078, -0.2052689790725708, -0.735346794128418, 0.05304601788520813, 0.15831054747104645, -0.39808279275894165, 0.2954196035861969, ...
is this correct? (and does this mean SO won't allow it?) I plan on integrating this onto all of my websites eventually but first I am going to try to do it for a network of flash game websites so I am thinking www.example.com for the website will remain the same but instead of using www.example.com/images, www.example...
[ 0.3507711589336395, 0.024747176095843315, 0.3667171001434326, 0.16452845931053162, -0.21177268028259277, -0.39354246854782104, 0.28425490856170654, -0.07162244617938995, -0.33673861622810364, -0.6047868132591248, 0.11225824058055878, 0.29971200227737427, -0.3238306939601898, -0.02106057666...
connections than it might otherwise do. This can speed up page load time. Caching of those elements is entirely down the HTTP headers delivered with that content. For static files like CSS, JS etc, a server will typically tell the client when the file was modified, which allows a browser to ask for the file "[If-Mod...
[ 0.1543475091457367, -0.1360154151916504, 0.5061637759208679, 0.112614206969738, -0.01694377511739731, -0.3000299334526062, 0.10480938851833344, -0.25532788038253784, -0.38250967860221863, -0.7156465649604797, -0.4257854223251343, 0.2917456030845642, -0.27024465799331665, 0.3772775530815124...
of cache control headers. As an example, if you had a subdirectory with your css files in, and wanted to ensure they were cached for at least an hour, you could place a .htaccess in that directory with these contents ``` ExpiresActive On ExpiresDefault "access plus 1 hours" ```
[ 0.31919264793395996, 0.22084693610668182, 0.46127745509147644, 0.317689448595047, 0.2654500901699066, -0.3789815604686737, 0.23438675701618195, -0.06680221855640411, -0.18736471235752106, -0.4355948865413666, -0.11311063170433044, 0.41194871068000793, -0.18476903438568115, 0.18816164135932...
I am trying to retrieve the largest number from a varchar column that includes both numbers and strings. An example of the data I'm working with: **BoxNumber** 123 A5 789 B1 I need to return the largest number (789 in this case) from the column while ignoring the non-numeric values of A5 and B1. I have f...
[ 0.3022443354129791, 0.04656818136572838, 0.4118652045726776, -0.09905398637056351, -0.2773136496543884, 0.2167682647705078, 0.011011665686964989, -0.36885952949523926, -0.1172083243727684, -0.3398052752017975, 0.24122247099876404, 0.38114306330680847, -0.06763418763875961, -0.1906211972236...
``` your where clause would be like this ``` WHERE VALUE NOT LIKE '%[a-z]%' AND ISNUMERIC(VALUE) = 1 create table #bla (value varchar(50)) insert #bla values('123') insert #bla values('a5') insert #bla values('789') insert #bla values('b1') SELECT MAX(CAST(value AS Int)) FROM #bla WHERE VALUE NOT LIKE '%[a-...
[ 0.3175859749317169, -0.07905146479606628, 0.3837434649467468, -0.11607902497053146, 0.09214933961629868, 0.22433653473854065, 0.3607158660888672, -0.5544785261154175, -0.19144509732723236, -0.24211715161800385, -0.277647465467453, 0.6215620636940002, -0.3437234163284302, -0.030466647818684...
I'm using a WrapPanel to display variable height items in columns. The wrappanel has a constrained size. Is there an way to determine when the WrapPanel is 'full'? I will then page to another panel with an animation. I've looked at the ArrangeOverride of the items that are the panels children, but they always seem t...
[ 0.12947112321853638, -0.17542290687561035, 0.2977261543273926, 0.18712283670902252, -0.11897016316652298, 0.5117355585098267, -0.3099903464317322, 0.04921923205256462, -0.5679004788398743, -0.686508297920227, 0.04823072999715805, 0.20934267342090607, 0.34709644317626953, 0.0862420722842216...
maybe I should look > into the source code... I did look but there's no hint of a functionality to sort these names. I would suggest a change request to the JUnit plugin, but I don't think, that there are lot of people using this thing, so: DIY. I would like to see the solution if you modify the plugin code.
[ 0.41111791133880615, 0.06399523466825485, -0.03992258757352829, 0.010716386139392853, -0.04145541042089462, -0.3202945590019226, 0.2637048065662384, 0.4188847839832306, -0.04651712626218796, -0.7323259115219116, 0.2150939702987671, 0.56350177526474, -0.0822228267788887, 0.1979367733001709,...
I'd like my GreaseMonkey script to run a function whenever elements with a specific class are inserted into a page. What's the most idiomatic way of doing that? If it helps, it's a `<select>` element that is being inserted. Can you do something with [DOMNodeInserted](http://www.manticmoo.com/articles/jeff/programming/...
[ 0.307919979095459, -0.1435573548078537, 0.32094308733940125, -0.018356502056121826, 0.25663432478904724, -0.1332082599401474, 0.032435011118650436, -0.0779884085059166, -0.19544009864330292, -0.3970222771167755, -0.001625745091587305, 0.6391069889068604, -0.08454262465238571, -0.1111166030...
We have the following example table (actually taken from another example here on stackoverflow...) ``` CREATE TABLE example ( id integer primary key, name char(200), parentid integer, value integer); ``` And given a specific child we want to get the top Parent. I know of the tablefunc connectby function bu...
[ -0.15841585397720337, 0.04751134663820267, 0.2169026881456375, 0.20041699707508087, 0.1461804360151291, 0.22528782486915588, -0.173817440867424, 0.025020718574523926, -0.16961941123008728, -0.5546283721923828, -0.14134269952774048, 0.2775163948535919, -0.13784688711166382, 0.09113121777772...
child integer ) RETURNS integer as $$ DECLARE parent integer; last_parent integer; BEGIN last_parent := child; SELECT INTO parent parentid FROM example WHERE id = child; IF parent is NOT NULL THEN parent
[ -0.26966792345046997, -0.13270863890647888, 0.16116012632846832, -0.29355257749557495, 0.3820769786834717, 0.42857664823532104, 0.14667381346225739, -0.18826891481876373, 0.16661536693572998, -0.4778658449649811, 0.016988953575491905, 0.1927570253610611, -0.06275418400764465, 0.60421460866...
:= get_top_parent(parent); ELSE parent := last_parent; END IF; RETURN parent; END $$ LANGUAGE plpgsql; ``` This function can definitely be optimized. It will likely be slow if depth is very high and the tables are large, so like Jegern mentioned it might be worth caching the hi...
[ -0.1265246868133545, -0.17298126220703125, 0.15478357672691345, -0.23789724707603455, -0.008402074687182903, -0.13268303871154785, 0.576231062412262, -0.08782624453306198, -0.03447890654206276, -0.30387386679649353, -0.2952662408351898, 0.4111403226852417, -0.1471799612045288, 0.1576388627...
So I need a 2-dimensional `ConcurrentHashMap`. It has to be as blazing fast as possible, as I'm going to be adding to and updating its values extremely frequently. It's in a multithreaded application, hence the choice to use ConcurrentHashMap instead of just HashMap. Both the "x" and "y" indices are integers with a k...
[ -0.09559115767478943, 0.20763210952281952, 0.2668438255786896, 0.25512564182281494, -0.24428768455982208, 0.13260845839977264, 0.30271828174591064, -0.05577601119875908, -0.2413329929113388, -0.5725719928741455, 0.2181617170572281, 0.4853922724723816, -0.22521260380744934, 0.17481689155101...
x and y, and use that as a key... though if I do that, what's the most efficient way to do `equals()` and `hashcode()`? and will I wind up allocating too many new `IntPair`s? Could I keep a set of `IntPair`s for each x/y I've assigned, and then use a purely reflexive equals() such that I'm just checking for the exact s...
[ -0.04751833900809288, 0.20415028929710388, 0.20991124212741852, -0.008893993683159351, -0.15492305159568787, 0.1659073382616043, 0.044880881905555725, -0.29377660155296326, -0.01831907220184803, -0.6539227962493896, 0.08573956042528152, 0.43463364243507385, -0.316160649061203, 0.1663436144...
those IntPairs which are used, not a prespecified subset. Intuitively, it seems to me that looking up an IntPair in a big map to see if I've already created it would, in fact, be more-or-less the same as just looking it up in the big "2-D" ConcurrentHashMap anyway, wouldn't it? So it seems the solution here is really ...
[ -0.20059390366077423, 0.008604618720710278, 0.32611438632011414, 0.04551544040441513, -0.15434765815734863, 0.24206751585006714, -0.01831839233636856, -0.10769816488027573, -0.43142154812812805, -0.849729597568512, 0.05763164162635803, 0.2756568193435669, -0.10986600071191788, 0.2253547459...
lot of `ConcurrentHashMap`s is going to be expensive. Your (immutable) `IntPair` suggestion seems more attractive in comparison. As you've suggested, you can even cache some of these pairs to improve performance (see [`Integer.valueOf(int)`](http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#valueOf(int)) t...
[ 0.12381713092327118, 0.21289579570293427, 0.0819249078631401, 0.024559980258345604, -0.1148681566119194, 0.13046476244926453, 0.2821967601776123, -0.29895278811454773, -0.29378947615623474, -0.49246713519096375, 0.19833433628082275, 0.31813162565231323, -0.5770617127418518, 0.1188701465725...
[`Integer.valueOf(int)`](http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#valueOf(int)).
[ -0.1733587384223938, 0.14972558617591858, 0.37783288955688477, -0.4034179747104645, 0.16383424401283264, 0.1829284429550171, -0.04669058695435524, -0.3050357699394226, -0.46349799633026123, -0.20333439111709595, -0.3400585949420929, 0.26829662919044495, -0.23520918190479279, -0.13266113400...
I'm creating a `UserControl` consisting of a `TextBox` and a `ListView`. I want keyboard focus to remain with the `TextBox` as long as the control has keyboard focus (selection changes in the `ListView` shouldn't remove keyboard focus from the `TextBox`). I've tried catching `GotKeyboardFocus` in the `ListView` and pa...
[ -0.05634462460875511, -0.24257715046405792, 0.6393325328826904, -0.1120324358344078, 0.09194649010896683, -0.07693799585103989, 0.022104384377598763, -0.21731887757778168, -0.1843176782131195, -0.48905640840530396, -0.15098924934864044, 0.6548300981521606, -0.08830451220273972, -0.22618842...
<TextBox x:Name="TextBox1" /> <ListView x:Name="ListBox1" Keyboard.GotKeyboardFocus="ListBox1_GotKeyboardFocus"> <ListViewItem Content="Able" /> <ListViewItem Content="Baker" /> <ListViewItem Content="Charlie" /> </ListView> </StackPanel> </Window> ``` --- ``` ...
[ 0.19539834558963776, -0.18474264442920685, 0.36711519956588745, -0.3830011487007141, -0.08461415022611618, 0.0701681450009346, 0.6911491751670837, -0.3528043329715729, -0.3985811173915863, -0.6975823044776917, -0.462510883808136, 0.5123810172080994, -0.41377052664756775, -0.030176311731338...
{ InitializeComponent(); } private void ListBox1_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { Keyboard.Focus(TextBox1); } } } ``` It looks like it's possible to change focus in the MouseUp event. I think if you do it too early, like in ...
[ 0.21488729119300842, -0.44339337944984436, 0.5624581575393677, -0.4704037308692932, 0.39800330996513367, -0.2001141607761383, 0.36824530363082886, 0.2367912381887436, -0.14714257419109344, -0.6791700124740601, -0.4058263599872589, 0.882966160774231, -0.4016357362270355, -0.0700522288680076...
the listview can handle the event and select the chosen item. ``` <StackPanel> <TextBox x:Name="TextBox1" /> <ListView x:Name="ListBox1" MouseUp="ListBox1_MouseUp"> <ListViewItem Content="Able" /> <ListViewItem Content="Baker" /> <ListViewItem Content="Charlie" /> </ListView> </Stac...
[ 0.28450655937194824, -0.31544944643974304, 0.44522127509117126, -0.2845103144645691, -0.3273840546607971, 0.020626427605748177, 0.4158620536327362, -0.47545668482780457, -0.4197550117969513, -0.5493221282958984, -0.5455339550971985, 0.5314199328422546, -0.5350167751312256, -0.2820523083209...
Can't exactly find a way on how to do the following in C/C++. Input : hexdecimal values, for example: ffffffffff... I've tried the following code in order to read the input : ``` uint16_t twoBytes; scanf("%x",&twoBytes); ``` Thats works fine and all, but how do I split the 2bytes in 1bytes `uint8_t` values (or may...
[ 0.09185612946748734, 0.062411919236183167, 0.16143374145030975, -0.11883638054132462, -0.20522816479206085, 0.05317576974630356, -0.07115303725004196, -0.17523431777954102, -0.2070995420217514, -0.6896955966949463, 0.034970786422491074, 0.4746561646461487, -0.27414292097091675, -0.15354207...
how to do this easily (and fast if it goes) is greatly appreciated . Edit: Found even a better method by using the fread function as it lets one specify how many bytes it should read from the stream (stdin in this case) and save to a variable/array. ``` size_t fread ( void * ptr, size_t size, size_t count, FILE * str...
[ 0.05171282961964607, -0.18615397810935974, 0.39892393350601196, 0.04440620541572571, -0.011831828393042088, 0.16666945815086365, -0.05469634756445885, -0.4160274863243103, -0.3110482692718506, -0.8605813384056091, -0.06957254558801651, 0.31459859013557434, -0.18992967903614044, -0.06154996...