text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
Given this: ``` Public Sub timReminder_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) If DateTime.Now() > g_RemindTime Then Reminders.ShowDialog() timReminder.Enabled = False End If End Sub ``` I want to be able to say this (as I would in Delphi): ``` timReminder.Tick = tim...
[ 0.04907667636871338, -0.011616595089435577, 0.46217042207717896, -0.10346317291259766, -0.049628570675849915, 0.06115392595529556, 0.1932472437620163, -0.323999285697937, -0.3481203317642212, -0.3953024744987488, -0.12964333593845367, 0.4657089412212372, -0.39195388555526733, 0.31430953741...
Java & Oracle both have a *timestamp* type called Date. Developers tend to manipulate these as if they were *calendar* dates, which I've seen cause nasty one-off bugs. 1. For a basic date quantity you can simply chop off the time portion upon input, i.e., reduce the precision. But if you do that with a date range, (e....
[ 0.18567773699760437, -0.2919779419898987, -0.05033641308546066, -0.29566696286201477, -0.257999449968338, 0.14594712853431702, 0.1413913369178772, -0.22055815160274506, -0.18409299850463867, -0.5114049315452576, -0.03808216750621796, 0.24551714956760406, -0.0651797503232956, -0.16554281115...
alternative is to use true timestamps: **9/29** 00:00:00 - **10/1** 00:00:00. (midnight-to-midnight, so does not include any part of Oct). Now durations are intrinsically correct, and range comparisons are simpler: `start <= now < end`. Certainly cleaner for internal processing, however end dates do need to be converte...
[ 0.45178908109664917, -0.2694966793060303, 0.2547808587551117, 0.1044241264462471, 0.045582566410303116, -0.0864277258515358, 0.15409620106220245, -0.17656469345092773, -0.17619572579860687, -0.6501212120056152, 0.08892866224050522, 0.39156869053840637, -0.026669152081012726, 0.068555854260...
it. 1. Use timestamps. 2. Use Half-open intervals for comparison: `start <= now < end`. Ignore the whiners who insist that BETWEEN is somehow essential to successful SQL. With this a series of date ranges is really easy to audit. The database value for `9/30 to 10/1` encompass one day (9/30). The next interval's sta...
[ 0.38690298795700073, -0.18010157346725464, 0.39634478092193604, 0.06865126639604568, -0.04724523797631264, -0.47551241517066956, 0.05449618399143219, 0.06070848926901817, -0.16048559546470642, -0.48306018114089966, -0.10558401793241501, 0.4061508774757385, 0.09417630732059479, 0.2257347553...
true. So "9/30 to 10/1" means "valid starting 9/30, no longer valid starting 10/1".
[ 0.550541341304779, 0.16298477351665497, 0.6832314729690552, -0.002878541126847267, 0.21062956750392914, -0.05667533725500107, 0.2937109172344208, 0.42289021611213684, -0.14958474040031433, -0.08512632548809052, -0.349418967962265, 0.31259414553642273, -0.037554848939180374, 0.3015437722206...
You can limit "Check-In Policy" rules via the "Custom Paths" policy. But the "Check-in Notes" tab doesn't seem to fit in to the same system. Why isn't "Check-In notes" just another "Check-In policy"?? I'm using Team Foundation Server 2008 SP1 We had a similar problem some time ago. For some sub tree we wanted to requi...
[ 0.11876232177019119, -0.1863066703081131, 0.2326207458972931, -0.019278785213828087, 0.012097572907805443, -0.4568539261817932, 0.17702285945415497, -0.26694780588150024, -0.45666107535362244, -0.7651640176773071, 0.0029283484909683466, 0.485328733921051, -0.42291533946990967, -0.268226712...
I'm using a Form to show notifications (it appears at the bottom right of the screen), but when I show this form it steals the focus from the main Form. Is there a way to show this "notification" form without stealing focus? Hmmm, isn't simply overriding Form.ShowWithoutActivation enough? ``` protected override bool S...
[ 0.3744868040084839, 0.182974711060524, 0.5977755784988403, -0.4006395936012268, -0.07407922297716141, -0.057768020778894424, 0.5609558820724487, -0.3387952446937561, -0.015509085729718208, -0.643867015838623, -0.057698145508766174, 0.4964749217033386, -0.4720812141895294, 0.040056809782981...
= 0x00000080; baseParams.ExStyle |= ( int )( WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW ); return baseParams; } } ```
[ -0.05318721756339073, 0.02578703686594963, 0.33623090386390686, -0.28268638253211975, 0.27759841084480286, 0.1280185878276825, 0.5250141620635986, -0.26280879974365234, -0.015253715217113495, -0.4169609844684601, -0.36143943667411804, 0.48171865940093994, -0.39018577337265015, 0.1399655342...
I hear people writing these programs all the time and I know what they do, but how do they actually do it? I'm looking for general concepts. Technically, screenscraping is any program that grabs the display data of another program and ingests it for it's own use. Quite often, screenscaping refers to a web client that ...
[ 0.6862272024154663, -0.14609593152999878, -0.1299571841955185, 0.3691596984863281, -0.19299007952213287, -0.4706558883190155, -0.3877527117729187, 0.3538512587547302, -0.4874039888381958, -0.32100269198417664, -0.1355133354663849, 0.15259191393852234, -0.2633545994758606, 0.169189304113388...
Ruby, which is one of the better-architected HTML parsers used for screen scraping.
[ -0.11917047202587128, 0.08304261416196823, -0.24418655037879944, -0.07964915037155151, -0.5560702681541443, 0.2550713121891022, 0.43625906109809875, 0.1337067186832428, -0.11209240555763245, -0.2637515962123871, -0.19108295440673828, 0.31290528178215027, -0.5198796391487122, 0.234997540712...
When paging through data that comes from a DB, you need to know how many pages there will be to render the page jump controls. Currently I do that by running the query twice, once wrapped in a `count()` to determine the total results, and a second time with a limit applied to get back just the results I need for the c...
[ 0.22305253148078918, -0.1661081463098526, 0.36600685119628906, -0.1843324452638626, -0.44938841462135315, -0.0355813167989254, 0.35252103209495544, -0.013941803015768528, -0.392366886138916, -0.5445001125335693, 0.249633327126503, 0.5177215933799744, -0.29566463828086853, -0.04838361963629...
to get the full count *and* the limited result in one query. Introduced with [PostgreSQL 8.4 in 2009](https://www.postgresql.org/docs/8.4/release-8-4.html). ```sql SELECT foo , **count(*) OVER() AS full_count** FROM bar WHERE <some condition> ORDER BY <some col> LIMIT <pagesize> OFFSET <offset>; ``` Note th...
[ -0.22045554220676422, -0.16348931193351746, 0.9589793086051941, -0.1706925332546234, -0.36559057235717773, 0.11475476622581482, -0.12100895494222641, -0.19212767481803894, -0.46192467212677, -0.43330007791519165, -0.08477561175823212, 0.5927092432975769, -0.2861597239971161, -0.03248759731...
is at least as great as the number of rows from the base query, ***no row*** is returned. So you also get no `full_count`. Possible alternative: * [Run a query with a LIMIT/OFFSET and also get the total number of rows](https://stackoverflow.com/questions/28888375/run-a-query-with-a-limit-offset-and-also-get-the-total-...
[ -0.032681167125701904, -0.3158663511276245, 0.3700926601886749, 0.059375837445259094, 0.09716863185167313, -0.056350938975811005, 0.0630340650677681, -0.24638505280017853, -0.33067384362220764, -0.5289791822433472, -0.39791202545166016, 0.5125572085380554, -0.24150632321834564, -0.30927047...
aggregate functions would go here.) Not here. ( 3. Other `SELECT` list expressions are evaluated, based on grouped / aggregated columns.) Not here. 4. Window functions are applied depending on the `OVER` clause and the frame specification of the function. The simple `count(*) OVER()` is based on all qualifying rows. ...
[ -0.04419240728020668, 0.09721869230270386, 0.37905988097190857, -0.14361262321472168, -0.18831363320350647, 0.20575855672359467, 0.006529925391077995, -0.555020809173584, -0.19388021528720856, -0.42891770601272583, -0.015905406326055527, 0.5393946766853333, -0.4331458806991577, -0.05183190...
OFFSET on large table](https://stackoverflow.com/questions/34110504/optimize-query-with-offset-on-large-table/34291099#34291099) ### Alternatives to get final count There are completely different approaches to get the count of affected rows (***not*** the full count before `OFFSET` & `LIMIT` were applied). Postgres h...
[ -0.08859659731388092, -0.11070345342159271, 0.3816530406475067, 0.07411941140890121, -0.08968380093574524, 0.3357059061527252, -0.2733139991760254, -0.33474087715148926, -0.4826423227787018, -0.5887987017631531, 0.14938536286354065, 0.5906716585159302, -0.20605431497097015, 0.0350932367146...
query in PostgreSQL](https://stackoverflow.com/questions/10175073/calculate-number-of-rows-affected-by-batch-query-in-postgresql/10175149)
[ -0.5396230816841125, 0.07784198969602585, 0.3677278459072113, 0.14911778271198273, -0.04098988324403763, 0.22196252644062042, -0.024686597287654877, -0.07067374885082245, -0.45690709352493286, -0.2520560026168823, -0.008093326352536678, 0.24590712785720825, -0.3999922275543213, 0.018548278...
I'm using CSS Filters to modify images on the fly within the browser. These work perfectly in Internet Explorer, but aren't supported in Firefox. Does anyone know what the CSS Filter equivalent for these is for Firefox? An answer that would work cross browser (Safari, WebKit, Firefox, etc.) would be preferred. ``` <s...
[ 0.57493656873703, -0.14421972632408142, 0.34266263246536255, -0.1542072296142578, -0.2126999795436859, -0.21149767935276031, 0.2686525583267212, -0.04049539566040039, -0.010149198584258556, -1.2892985343933105, 0.027475062757730484, 0.39867568016052246, -0.4468991458415985, 0.1252231895923...
Library](http://www.nihilogic.dk/labs/imagefx/): * supports IE and Fx pretty well * has a lot of effects You can find many other effects in the [CVI Projects](http://www.netzgesta.de/cvi/): * they are also JS based * there's a [Lab to experiment](http://www.netzgesta.de/lab/) Good Luck
[ 0.6681005954742432, -0.10172167420387268, 0.3322630226612091, 0.2040155678987503, 0.004364759661257267, -0.31148606538772583, 0.3319365680217743, -0.03242071345448494, -0.20566518604755402, -0.601023256778717, 0.180158793926239, 0.3584522008895874, 0.20995785295963287, -0.3376140296459198,...
I guess I'll illustrate with an example: In [this game](http://www.kloonigames.com/blog/games/crayon) you are able to draw 2D shapes using the mouse and what you draw is rendered to the screen in real-time. I want to know what the best ways are to render this type of drawing using hardware acceleration (OpenGL). I had ...
[ 0.49773287773132324, -0.11921729147434235, 0.25047892332077026, 0.17836102843284607, -0.034177400171756744, 0.279885470867157, -0.24590760469436646, 0.3627072870731354, -0.2909855842590332, -1.0329493284225464, 0.261472225189209, 0.41518285870552063, 0.01982220448553562, 0.0450100824236869...
to be best/most efficient/easiest? Any suggestions are welcome. I love crayon physics (music gets me every time). Great game! But back to the point... He has created brush sprites that follow your mouse position. He's created a few brushes that account for a little variation. Once the mouse goes down, I imagine he is ...
[ 0.32067441940307617, -0.23133046925067902, 0.289201557636261, 0.3671773374080658, -0.1339021921157837, -0.05018000304698944, -0.06126187741756439, -0.15421798825263977, -0.05343068391084671, -0.80146324634552, 0.23836462199687958, 0.5553387403488159, -0.012848595157265663, 0.06960472464561...
Is there a framework equivalent to Guice (<http://code.google.com/p/google-guice>) for Python? I haven't used it, but the [Spring Python](http://springpython.webfactional.com/) framework is based on Spring and implements [Inversion of Control](http://static.springsource.org/spring-python/1.2.x/sphinx/html/objects.html)...
[ -0.17279845476150513, -0.2965836226940155, -0.08912534266710281, 0.08079179376363754, -0.3472844362258911, 0.10132083296775818, 0.18012529611587524, -0.06037931516766548, -0.5546087026596069, 0.056549131870269775, 0.14254039525985718, 0.36848485469818115, -0.5239412188529968, -0.1723698824...
Is there a good reason why there is no `Pair<L,R>` in Java? What would be the equivalent of this C++ construct? I would rather avoid reimplementing my own. It seems that **1.6** is providing something similar (`AbstractMap.SimpleEntry<K,V>`), but this looks quite convoluted. In [a thread on `comp.lang.java.help`](http...
[ 0.1097055971622467, 0.06532242149114609, -0.5401105284690857, -0.18613483011722565, -0.2821838855743408, 0.27191054821014404, 0.31609880924224854, -0.42311686277389526, 0.04513305425643921, -0.4291478097438812, 0.01799762062728405, 0.16123323142528534, -0.6660763621330261, 0.01102476101368...
Mike proposed, for each application you would have made of the `Pair` class. `Map.Entry` is an example of a pair that carry its meaning in its name. To sum up, in my opinion it is better to have a class `Position(x,y)`, a class `Range(begin,end)` and a class `Entry(key,value)` rather than a generic `Pair(first,second)...
[ 0.26537057757377625, 0.07814516127109528, -0.09557068347930908, -0.0122323427349329, -0.13496224582195282, 0.07304989546537399, 0.07348579913377762, -0.18244585394859314, 0.13642194867134094, -0.5300588011741638, -0.18390068411827087, 0.2956131398677826, -0.38056859374046326, 0.20669187605...
The title is self explanatory. Is there a way of directly doing such kind of importing? The .BAK files from SQL server are in Microsoft Tape Format (MTF) ref: <http://www.fpns.net/willy/msbackup.htm> The bak file will probably contain the LDF and MDF files that SQL server uses to store the database. You will need to ...
[ -0.1162867471575737, 0.22743088006973267, 0.6577112674713135, 0.04215139523148537, -0.3240499198436737, -0.3809919059276581, 0.42782163619995117, -0.17649705708026886, -0.011729325167834759, -0.29786863923072815, -0.27408018708229065, 0.5840586423873901, -0.19186994433403015, 0.14277732372...
backup - what you need is the first fields that tell you the logical names - one will be the actual database and the other the log file. ``` RESTORE DATABASE mydbName FROM disk='c:\temp\mydbName-2009-09-29-v10.bak' WITH MOVE 'mydbName' TO 'c:\temp\mydbName_data.mdf', MOVE 'mydbName_log' TO 'c:\temp\mydbName_da...
[ -0.07914063334465027, 0.2596321105957031, 0.6054008603096008, 0.27224835753440857, 0.15079057216644287, -0.20892219245433807, 0.09683842211961746, 0.12730130553245544, -0.2921334207057953, -0.3873293995857239, -0.3910142183303833, 1.0387037992477417, -0.17084026336669922, -0.13832519948482...
We are putting up a company blog at companyname.com/blog but for now the blog is a Wordpress installation that lives on a different server (blog.companyname.com). The intention is to have the blog and web site both on the same server in a month or two, but that leaves a problem in the interim. At the moment I am usi...
[ 0.5659434199333191, 0.2516683042049408, 0.8284015655517578, -0.1624317169189453, 0.17051047086715698, -0.1243571862578392, 0.2011348456144333, 0.2561892867088318, -0.19943375885486603, -0.7342292070388794, 0.17583173513412476, 0.46656036376953125, 0.026496924459934235, 0.2307933121919632, ...
but not across a different server? Thanks Rather than using mod\_rewrite, you could use [mod\_proxy](http://httpd.apache.org/docs/1.3/mod/mod_proxy.html#forwardreverse) to set up a reverse proxy on companyname.com, so that requests to <http://companyname.com/blog/article-name> are proxied (rather than redirected) to <...
[ -0.05539314076304436, 0.08684571832418442, 0.538568377494812, -0.1526927500963211, -0.21785393357276917, 0.20892195403575897, 0.37616458535194397, -0.17889825999736786, -0.35530760884284973, -0.4010632634162903, 0.09143324196338654, 0.12480878084897995, -0.06164330989122391, 0.374078840017...
I'm just trying to time a piece of code. The pseudocode looks like: ``` start = get_ticks() do_long_code() print "It took " + (get_ticks() - start) + " seconds." ``` How does this look in Python? More specifically, how do I get the number of ticks since midnight (or however Python organizes that timing)? In the `ti...
[ 0.6350017189979553, -0.3256917893886566, 0.3660544753074646, -0.04833288490772247, 0.04544951021671295, 0.2562922537326813, 0.24400752782821655, -0.19410884380340576, -0.23060882091522217, -0.507486879825592, 0.21464186906814575, 0.5409033298492432, -0.07416972517967224, -0.015152478590607...
typically better than a microsecond". It has no special meaning, it's just a number (it starts counting the first time you call `clock` in your process). ``` # ms windows t0= time.clock() do_something() t= time.clock() - t0 # t is wall seconds elapsed (floating point) ``` * on \*nix, `clock` reports...
[ 0.2068241983652115, -0.03505370765924454, 0.413751482963562, 0.11341636627912521, 0.12171834707260132, 0.010458441451191902, 0.1642683744430542, -0.034187525510787964, -0.35498911142349243, -0.7357819676399231, 0.025282539427280426, 0.5919972062110901, 0.3224780857563019, 0.136690914630889...
So, this number, which typically is smaller¹ than the wall time (i.e. time.time() - t0), is more meaningful when benchmarking code: ``` # linux t0= time.clock() do_something() t= time.clock() - t0 # t is CPU seconds elapsed (floating point) ``` Apart from all that, the [timeit](http://docs.python.or...
[ 0.3570936620235443, -0.1091410294175148, 0.5442777276039124, -0.24402862787246704, 0.0938282310962677, 0.024045636877417564, -0.08260980248451233, -0.2790760099887848, -0.4085372984409332, -0.42076990008354187, -0.21110184490680695, 0.5872558951377869, -0.028769556432962418, 0.203498050570...
As a Java developer who is reading Apple's Objective-C 2.0 documentation: I wonder what "*sending a message to nil*" means - let alone how it is actually useful. Taking an excerpt from the documentation: > There are several patterns in Cocoa > that take advantage of this fact. The > value returned from a message to ...
[ 0.4012373089790344, 0.20158855617046356, 0.15704423189163208, -0.13988475501537323, -0.21969328820705414, 0.08368273824453354, 0.12114512920379639, -0.05880344659090042, -0.37759634852409363, -0.3892425298690796, -0.033588241785764694, 0.3808821439743042, -0.2585677206516266, 0.07750532031...
message sent to nil returns 0. > * If the method returns a struct, as defined by the Mac OS X ABI Function > Call Guide to be returned in > registers, then a message sent to nil > returns 0.0 for every field in the > data structure. Other struct data > types will not be filled with zeros. > * If the method returns...
[ 0.023444658145308495, 0.053629208356142044, 0.13985396921634674, -0.18046212196350098, -0.2229665070772171, 0.2696759104728699, 0.28621402382850647, -0.14337782561779022, 0.2198900431394577, -0.7020906209945679, 0.009723500348627567, 0.4127272367477417, -0.3352154791355133, 0.1753225475549...
I am missing that would make this as clear as glass? I do get the idea of messages/receivers in Objective-C, I am simply confused about a receiver that happens to be `nil`. Well, I think it can be described using a very contrived example. Let's say you have a method in Java which prints out all of the elements in an A...
[ 0.24908801913261414, 0.03269327059388161, 0.009310927242040634, -0.3213055729866028, -0.2878345847129822, -0.09233016520738602, 0.39764347672462463, -0.15959420800209045, -0.3921740651130676, -0.3691391348838806, 0.07319119572639465, 0.509297251701355, -0.5826372504234314, 0.17151349782943...
when it tries to access list, in this case in the call to list.size(); Now, you'd probably never call someObject.foo(NULL) with the NULL value like that. However, you may have gotten your ArrayList from a method which returns NULL if it runs into some error generating the ArrayList like someObject.foo(otherObject.getAr...
[ -0.10524246841669083, -0.2638458013534546, 0.2696624994277954, -0.46761849522590637, -0.15856726467609406, -0.13429686427116394, 0.3798597753047943, -0.22579747438430786, -0.28605344891548157, -0.4235752820968628, -0.09469392895698547, 0.6777330040931702, -0.6611336469650269, 0.17552793025...
} } ``` Now, if we have the following code: ``` [someObject foo:nil]; ``` we have the same situation in which Java will produce a NullPointerException. The nil object will be accessed first at [anArray count] However, instead of throwing a NullPointerException, Objective-C will simply return 0 in accordance with t...
[ -0.1612129807472229, -0.09618165343999863, 0.07241293042898178, -0.22624656558036804, -0.03706514462828636, -0.14755362272262573, 0.3625414967536926, -0.04733622074127197, -0.21102523803710938, -0.596906840801239, -0.02819686010479927, 0.49131670594215393, -0.5348852872848511, 0.3027233779...
nil each time through the loop. (Although NSLog is a function and not a method, it prints out (null) if passed a nil NSString. In some cases it's nicer to have a NullPointerException, since you can tell right away that something is wrong with the program, but unless you catch the exception, the program will crash. (In...
[ -0.01988855004310608, -0.17810305953025818, -0.095039963722229, 0.04830927774310112, -0.12636448442935944, -0.2322029322385788, 0.3974319398403168, 0.06753769516944885, -0.17037026584148407, -0.378761351108551, -0.001436940161511302, 0.32024383544921875, -0.2471187710762024, 0.185385033488...
to check to make sure the object or parameters are nil.
[ 0.37134867906570435, 0.04499991238117218, -0.08274219930171967, 0.26128751039505005, 0.065917007625103, -0.271835595369339, -0.08248753845691681, 0.05689925700426102, -0.11066123098134995, -0.3291760981082916, 0.01404821127653122, 0.44469091296195984, -0.06791830062866211, 0.14641600847244...
It's quite a simple question - how do I sort a collection? I've got a CSV file with rows in a random order. I'd like to sort the rows according to the date in one column. Do I add the rows to a recordset? Can I sort with a Scripting.Dictionary? I've clearly been spoilt with .NET and Linq, and now I find myself back i...
[ 0.2139471471309662, 0.003834142815321684, 0.20754198729991913, -0.08369948714971542, -0.0959906205534935, -0.060376718640327454, 0.27589213848114014, 0.32141199707984924, -0.6132594347000122, -0.480915367603302, -0.009651352651417255, -0.1003141924738884, 0.1153983473777771, 0.644222378730...
use **System.Collections.Sortedlist** within your ASP app and get your key value pairs sorted. ``` set list = server.createObject("System.Collections.Sortedlist") with list .add "something", "YY" .add "something else", "XX" end with for i = 0 to list.count - 1 response.write(list.getKey(i) & " = " & list.get...
[ 0.08648940920829773, -0.30899909138679504, 0.5898923277854919, -0.05897005647420883, 0.19344116747379303, 0.10474761575460434, 0.3290351331233978, -0.4908747375011444, -0.38199692964553833, -0.9709969162940979, -0.4156118929386139, 0.4766661524772644, -0.44794517755508423, -0.0576641596853...
I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets for unordered lists are hideous. Customising the rendering seems extremely difficult. Therefore I'm looking for a replacement with better HTML rendering. Does this exist? (I asked Google, and found nothing except a promising dead li...
[ 0.6208853125572205, 0.16710549592971802, 0.0022211926989257336, -0.10904335975646973, -0.28434744477272034, 0.08866600692272186, -0.15577982366085052, 0.13264790177345276, -0.2767763137817383, -0.323874294757843, 0.30831488966941833, 0.28924766182899475, -0.128604456782341, -0.060543850064...
I'm implementing a cache in a class library that i'm using in an asp.net application. I created my cache object as a singleton pattern with a static method to update the cache which is really just loading a member variable/property with a collection of data i need cached (got some locking logic ofcourse). I figured i...
[ 0.13722994923591614, 0.2287384271621704, -0.09617990255355835, 0.11862171441316605, -0.014770175330340862, -0.1776081770658493, 0.15948133170604706, 0.2175946980714798, -0.394455224275589, -0.7893109917640686, 0.14827945828437805, 0.06533721089363098, -0.4909517168998718, 0.550184011459350...
one will not load all of the data at once, but rather store a collection for each key accessed. ``` MyOtherCacheObject.Instance.MyOtherDataCollection(indexkey) ``` This time the question about garbage collection was brought up. Since i'm storing a huge amount of data, wouldn't it be a waste if it got gc'ed all of a ...
[ 0.3032863140106201, 0.23070460557937622, 0.025079865008592606, 0.07377035170793533, -0.13219310343265533, -0.2345542311668396, -0.02152979001402855, -0.1669521927833557, -0.3843131363391876, -0.6177559494972229, 0.0788828656077385, 0.43024173378944397, -0.19950227439403534, 0.3191752433776...
seems a bit 'off' since this is just a class library, or what do you think? In my opinion, the best solution would have the following characteristics: * Uses the available caching services provided by the platform trying to avoid writing your own. * Does not couple your class library to System.Web, in order to have th...
[ 0.28607213497161865, 0.05069616064429283, -0.16787990927696228, 0.2279793620109558, -0.1739841103553772, -0.2654639482498169, 0.02625241130590439, -0.13418948650360107, -0.20968788862228394, -0.8741776943206787, -0.056013502180576324, 0.09482742846012115, -0.17615099251270294, -0.016293942...
to allow the class library to use different caching implementations, based on the environment it is running on. Suppose you define your abstract caching contract as: ``` public interface ICacheService { AddItem(...); } ``` You could provide an implementation based on System.Web: ``` public AspNetBasedCacheSer...
[ 0.09287629276514053, 0.013272389769554138, 0.047329653054475784, -0.04011131823062897, -0.14387553930282593, -0.04519851878285408, -0.10677766054868698, -0.19788895547389984, -0.1324205845594406, -0.7809638381004333, 0.008768209256231785, 0.3617982864379883, -0.5584075450897217, 0.19861218...
of the full 'cache object'. ``` public class CacheServiceProvider { public static ICacheService Instance {get; set;} } ``` You would have to initialize the caching implementation either by performing lazy initialization, or at application startup (in `Global.asax.cs`) And every domain component would be able ...
[ -0.1386493742465973, 0.28583794832229614, 0.12862825393676758, -0.03800929710268974, 0.10550827533006668, -0.10966663807630539, 0.1621244251728058, -0.19799703359603882, 0.020871726796030998, -0.7103896141052246, -0.11407776176929474, 0.39646804332733154, -0.558392345905304, 0.276069521903...
I have built a CFC designed to serve as a dynamic, aging cache intended for almost everything worth caching. LDAP queries, function results, arrays, ojects, you name it. Whatever takes time or resources to calculate and is needed more than once. I'd like to be able to do a few things: * **share the CFC between applica...
[ 0.5168110132217407, 0.44265061616897583, 0.4297814965248108, -0.04605912044644356, 0.0773574709892273, -0.2517884075641632, -0.021863440051674843, 0.06982272118330002, -0.0019241253612563014, -0.7824265956878662, 0.12324829399585724, 0.2706475257873535, -0.3174552619457245, 0.1747787147760...
would of course be using a different cache instance for every distinct task, but I'd like to be able to use the same CFC across applications. The cache itself is (what else) a Struct, private to the cache instance. How would I properly implement caching and locking when the scope itself is subject to change? For locki...
[ 0.3961005210876465, 0.4389694631099701, 0.3890582323074341, 0.207515150308609, 0.030087901279330254, -0.3434528410434723, 0.2891806662082672, -0.04235152527689934, -0.3270622789859772, -0.8053592443466187, -0.04439699649810791, 0.4776574671268463, -0.224448561668396, 0.2818777561187744, ...
application level caching also seems the wrong thing to do. Is there a better way? I understand your desire to avoid passing in the actual scope structure that you want to cache to, but your alternatives are limited. The first thing that comes to mind is just passing the name (a string) of the scope you want your cache...
[ 0.4499484598636627, 0.1870565265417099, -0.07178326696157455, 0.19511179625988007, 0.014942153356969357, -0.497681587934494, 0.14814907312393188, -0.11988963186740875, -0.047251179814338684, -0.5020967721939087, 0.30811628699302673, 0.680324912071228, -0.41486310958862305, 0.04907450452446...
irrelevant to what I want to test) here: **cache.cfc:** ``` <cfcomponent> <cfset variables.cacheScope = "session" /><!--- default to session ---> <cfset variables.cache = ""/> <cfscript> function init(scope){ variables.cacheScope = arguments.scope; return this; } function cac...
[ 0.12182208895683289, 0.043793559074401855, 0.5966584086418152, -0.08057738095521927, 0.08655963838100433, 0.2689884603023529, 0.5124697685241699, -0.3196907639503479, 0.13595187664031982, -0.5349857807159424, 0.035269055515527725, 0.6718870401382446, -0.4457044303417206, -0.051113862544298...
structKeyExists(evaluate(variables.cacheScope), arguments.key)){ return ""; }else{ variables.cache = evaluate(variables.cacheScope); return variables.cache[arguments.key]; } } </cfscript> </cfcomponent> ``` And a view to test it: ``` <!--- clear out any ...
[ 0.08311574161052704, 0.23183009028434753, 0.5345810651779175, -0.1040428876876831, -0.1945405751466751, -0.026643747463822365, 0.4795040786266327, -0.4571249485015869, -0.07370872795581818, -0.5028085112571716, -0.15031851828098297, 0.5705031752586365, -0.21600444614887238, -0.003167957300...
value ---> <cfset cacher.cacheWrite("foo", "bar")/> <!--- read stored value ---> <cfset rtn = cacher.cacheRead("foo")/> <!--- show values ---> <cfdump var="#rtn#"> <cfdump var="#session#" label="session vars"> ``` *Off topic: I like to write my setter functions to return "this" [as seen above] so that I can chain met...
[ 0.43445634841918945, 0.3265216052532196, 0.35551345348358154, -0.20578642189502716, -0.22380651533603668, -0.3128003776073456, 0.42135217785835266, -0.4233976900577545, -0.13520193099975586, -0.38642704486846924, 0.10552489012479782, 0.8123440146446228, -0.2580651342868805, 0.0299071781337...
the scope you want to cache into. If you're still bothered by it (and maybe rightly so?), you could create another CFC that abstracts reading and writing from the desired scope and pass that into your caching CFC as the storage location (a task well-suited for [ColdSpring](http://coldspringframework.org/)), that way i...
[ 0.5328992009162903, 0.14944420754909515, 0.5230333209037781, 0.18409883975982666, -0.07367594540119171, -0.24242734909057617, 0.1750434786081314, -0.16970330476760864, -0.31863996386528015, -0.7868847846984863, -0.05467354506254196, 0.24092411994934082, -0.4410848915576935, 0.1551454365253...
you have the request scope. If what you're looking for is a way to cache something for the current request and have it die shortly afterward, request scope may be what you want. Caching is usually more valuable when it spans multiple requests.
[ 0.2634304165840149, -0.3249591290950775, 0.15931880474090576, 0.2713884711265564, -0.062072157859802246, -0.17093317210674286, -0.07325833290815353, 0.09753907471895218, -0.33945778012275696, -0.737063467502594, -0.14591632783412933, 0.3321482539176941, -0.172659769654274, 0.29753190279006...
Alright, I have been doing the following (variable names have been changed): ``` FileInputStream fis = null; try { fis = new FileInputStream(file); ... process ... } catch (IOException e) { ... handle error ... } finally { if (fis != null) fis.close(); } ``` Recently, I started using FindB...
[ 0.3800894320011139, -0.005581701174378395, 0.28779852390289307, -0.35696330666542053, -0.03309616073966026, -0.3854697048664093, 0.5806493759155273, -0.19244572520256042, -0.12272126227617264, -0.6759310960769653, -0.04802096635103226, 0.562916100025177, -0.39441826939582825, 0.08240044862...
throw too many checked exceptions. For Java 7 and above [try-with-resources](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) should be used: ``` try (InputStream in = new FileInputStream(file)) { // TODO: work } catch (IOException e) { // TODO: handle error } ``` If you're stuc...
[ 0.37992313504219055, -0.024471860378980637, 0.0983915776014328, -0.10862276703119278, 0.07462578266859055, -0.24969154596328735, 0.4587511122226715, -0.439887672662735, -0.2789359390735626, -0.6557455658912659, -0.009658259339630604, 0.6469963788986206, -0.35537686944007874, -0.24086330831...
in.close(); } } catch (IOException e) { // TODO: error handling } ``` --- For a more detail on how to effectively deal with *close*, read this blog post: [Java: how not to make a mess of stream handling](http://illegalargumentexception.blogspot.com/2008/10/java-how-not-to-make-mess-of-stream....
[ 0.028112227097153664, -0.1478758454322815, 0.09807419776916504, -0.3046516180038452, -0.07969080656766891, -0.23424242436885834, 0.32661154866218567, -0.36630842089653015, -0.2010546177625656, -0.3527485132217407, -0.15859593451023102, 0.1362518072128296, -0.7492443919181824, -0.0526861064...
I want to implement a two-pass cache system: * The first pass generates a PHP file, with all of the common stuff (e.g. news items), hardcoded. The database then has a cache table to link these with the pages (eg "index.php page=1 style=default"), the database also stores an uptodate field, which if false causes the fi...
[ 0.38465362787246704, 0.017323927953839302, 0.3702876567840576, 0.06018600985407829, -0.0023559913970530033, -0.23215050995349884, 0.3184976279735565, -0.05078728124499321, -0.04073484241962433, -0.5512435436248779, -0.019970154389739037, 0.030326424166560173, -0.0526508204638958, 0.1796410...
and non-cached (e.g., search) pages, without a lot of code and several queries. Right now each time the page is loaded the PHP script is run regenerating the page. For pages like search this is fine, because most searches are different, but for other pages such as the index this is virtually the same for each hit, yet...
[ 0.18249355256557465, -0.013320726342499256, 0.44164004921913147, 0.16861359775066376, -0.12242046743631363, -0.08273524045944214, 0.39875707030296326, 0.044431012123823166, -0.5927456021308899, -0.6029552221298218, -0.19563359022140503, 0.2619568407535553, -0.09918685257434845, 0.356260508...
in 10,000's of nearly identical pages. The main concern is with reducing the load on the server, since I'm on shared hosting and at this point can't afford to upgrade, but the site is using a sizeable portion of the servers CPU + putting a fair load on the MySQL server. So basically minimising how much has to be done...
[ 0.2412893921136856, 0.20557980239391327, 0.6389740705490112, 0.1391361653804779, -0.26758602261543274, 0.1414104402065277, 0.25377357006073, 0.0025301731657236814, -0.34657689929008484, -0.4758589565753937, -0.06838376075029373, 0.18179266154766083, 0.02932821959257126, 0.326323002576828, ...
HTML, but then that means maintaining them in several places (since they may be used for searches and the comments are on a page dedicated to that news item (i.e. news.php), etc). I second Ken's rec of PEAR's [Cache\_Lite](http://pear.php.net/package/Cache_Lite) library, you can use it to easily cache either parts of p...
[ 0.12185657769441605, 0.13501136004924774, 0.39464181661605835, 0.06109689176082611, -0.5539355278015137, -0.2926568388938904, 0.24216756224632263, -0.01955168880522251, -0.2615266740322113, -0.7128615379333496, -0.047874435782432556, 0.00986473262310028, -0.14242829382419586, 0.03214277699...
much the same way as Cache\_Lite, to cache various page sections or full pages (or other arbitrary blobs of data), and it's very easy to use since PHP has a [memcache interface built in](http://www.php.net/manual/en/intro.memcache.php). For super high-traffic full-page caching, take a look at doing [Varnish](http://va...
[ 0.1665177196264267, 0.06272049993276596, 0.42975786328315735, 0.1495206505060196, -0.3940640091896057, -0.25400301814079285, 0.09470635652542114, -0.06503420323133469, -0.2466956079006195, -0.5148224234580994, 0.25255295634269714, 0.5052820444107056, -0.14836791157722473, 0.080084480345249...
caching strategy when you don't really need it. For a page like your home page that's getting hit several times a second, you definitely want to optimize it for speed; for a page that gets maybe a few hits an hour, like a month-old blog post, it's a bad idea to cache it, you only waste your time and make things more co...
[ 0.03783143684267998, -0.2776849567890167, 0.08218275010585785, 0.12993553280830383, -0.05765397101640701, -0.1543864905834198, 0.08186736702919006, 0.10567396134138107, -0.22886301577091217, -0.6791611313819885, 0.19183720648288727, 0.16961924731731415, -0.26146531105041504, -0.17991717159...
I started using [Sandcastle](http://www.codeplex.com/SHFB) some time ago to generate a Documentation Website for one of our projects. It's working quite well but we've always only written documentation for classes, methods, properties (...) in our project and had completely separate documentation for the overall projec...
[ 0.562984049320221, 0.319648802280426, 0.0771949291229248, 0.027124475687742233, -0.06574802100658417, -0.05219029635190964, 0.014776933006942272, -0.10914041846990585, -0.09520450979471207, -0.5889572501182556, 0.3112909495830536, 0.2878612279891968, 0.05292758718132973, 0.2500007450580597...
to do this? I know it's possible somehow and it would be really nice to have... :) Sandcastle also supports the ndoc-style namespace documentation, which allows you to stick the documentation in the source files: Simply create a non-public class called NamespaceDoc in the namespace you want to document, and the xml do...
[ 0.5288054347038269, 0.16176550090312958, -0.19506514072418213, 0.10080175846815109, 0.010251179337501526, -0.28357818722724915, 0.16775132715702057, 0.008007289841771126, -0.15340931713581085, -0.5295765995979309, -0.04160458967089653, 0.5384451150894165, -0.14589691162109375, -0.029991040...
</summary> [System.Runtime.CompilerServices.CompilerGenerated] class NamespaceDoc { } } ``` The work item in SandCastle is located [here.](http://www.codeplex.com/SHFB/WorkItem/View.aspx?WorkItemId=15516)
[ -0.18090228736400604, 0.24413084983825684, 0.32428690791130066, -0.18304651975631714, -0.03400760143995285, 0.16446378827095032, 0.303971529006958, -0.38119959831237793, -0.41172534227371216, -0.5231407284736633, -0.3499348759651184, -0.11174851655960083, -0.18065039813518524, 0.2538398206...
We are using fmt:setBundle to load a resource bundle from a database (we extended the ResourceBundle class to do that). When we modify a value in database, we have to reload the web server to display the new value on the web app. Is there any simple way to use the new value without restarting the web server ? (We do ...
[ 0.48878952860832214, 0.032374463975429535, 0.1000770628452301, 0.1875869780778885, 0.02822069078683853, -0.32365065813064575, 0.2292582243680954, -0.27905556559562683, -0.08282904326915741, -0.6009748578071594, -0.24954868853092194, 0.6499087810516357, -0.5073385238647461, 0.05956518650054...
others have pointed out in the comments, you might want to look into Spring - particularly the [ReloadableResourceBundleMessageSource](http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/context/support/ReloadableResourceBundleMessageSource.html).
[ 0.3877951502799988, -0.1481950432062149, 0.005515269003808498, -0.06333871185779572, -0.01809448003768921, 0.008531438186764717, 0.010951067321002483, 0.0086616026237607, -0.706718921661377, -0.06338553130626678, -0.4345865547657013, 0.14765915274620056, -0.019334590062499046, 0.1203719228...
I would like to know what of the many XSLT engines out there works well with Perl. I will use Apache (2.0) and Perl, and I want to obtain PDFs and XHTMLs. I'm new to this kind of projects so any comment or suggestion will be welcome. Thanks. --- Doing a simple search on Google I found a lot and I suppose that ther...
[ 0.201255664229393, 0.2570324242115021, 0.1812286078929901, 0.2504972815513611, -0.3358669579029083, -0.23306502401828766, 0.30403897166252136, 0.0992795079946518, -0.1952080875635147, -0.3785136640071869, 0.13721579313278198, 0.4783001244068146, 0.07126984000205994, -0.027933252975344658, ...
one solution, and it's not always clear which ones work, have been abandoned, are broken, slow or whatever. And disturbingly, the best answer (or at least, one of the best) comes up on page **four** of the results :( As other folks have suggested, [XML::LibXSLT](http://search.cpan.org/dist/XML-LibXSLT/) is robust and ...
[ -0.24354097247123718, 0.29433518648147583, 0.7891520857810974, -0.07203070819377899, 0.004708730615675449, 0.013514152728021145, 0.27205690741539, -0.6346836686134338, 0.048455607146024704, -0.7402645349502563, -0.4459492266178131, 0.5334446430206299, -0.1987709254026413, -0.11863285303115...
output file open(my $output_xml_file_name, '>', 'test.xml'); print $output_xml_file_name "$results"; ``` If you don't want to do anything fancy, though, there's [XML::LibXSLT::Easy](http://search.cpan.org/dist/XML-LibXSLT-Easy/), which essentially just wraps the above in one method call (and does a bunch of clever st...
[ 0.17367564141750336, 0.4323459565639496, 0.423378050327301, -0.19710852205753326, -0.15545548498630524, -0.3446108102798462, 0.28563210368156433, -0.07809494435787201, -0.07445396482944489, -0.7021924257278442, -0.3163127303123474, 0.5376297235488892, -0.3058449923992157, -0.24669316411018...
I am very new to creating webservers - and I have had several goes at trying to understand them and write a quick webserver, but it's never quite 'clicked'. At the moment I am under the impression that REST would be most suitable for my purposes (I will explain later). Can anyone either show me a basic code example in...
[ 0.47864222526550293, 0.1666366308927536, -0.007753048557788134, 0.11707562953233719, -0.12008251994848251, -0.2271764874458313, 0.44703248143196106, -0.03222990408539772, -0.29047277569770813, -0.458087682723999, -0.05247759446501732, 0.4676382839679718, 0.01038342621177435, -0.04872317612...
to the client dependant on some criteria - maybe a lookup list. * Once the client is successfully accepted they will be allowed to pass in some more values to the webserver that will be used to write a row in a database table. Many thanks. PS - I would have thought there might have been soemthing that comes with Ecli...
[ 0.345375120639801, 0.006285218987613916, 0.6221397519111633, 0.30503034591674805, -0.17422251403331757, -0.0021064644679427147, -0.09360755980014801, 0.17515702545642853, -0.3116951286792755, -0.506138265132904, 0.0630338042974472, 0.6008966565132141, 0.13992144167423248, -0.02444643341004...
I have an error occuring frequently from our community server installation whenever the googlesitemap.ashx is traversed on a specific sectionID. I suspect that a username has been amended but the posts havn't recached to reflect this. Is there a way a can check the data integruity by performing a select statement on t...
[ 0.08464702218770981, 0.14498937129974365, 0.3587931990623474, 0.054256170988082886, -0.12616081535816193, -0.23100461065769196, 0.512538492679596, 0.03950241208076477, -0.39931976795196533, -0.8024731278419495, -0.08238550275564194, 0.33213454484939575, -0.24505361914634705, 0.292272746562...
Do you have a common base class for Hibernate entities, i.e. a MappedSuperclass with id, version and other common properties? Are there any drawbacks? Example: ``` @MappedSuperclass() public class BaseEntity { private Long id; private Long version; ... @Id @GeneratedValue(strategy = GenerationType.A...
[ 0.45153287053108215, -0.48092761635780334, 0.22100768983364105, -0.03924117609858513, 0.1288764923810959, -0.13149935007095337, 0.10463989526033401, -0.16876818239688873, -0.21279190480709076, -0.5720584392547607, -0.11806545406579971, 0.44682028889656067, -0.0757235512137413, 0.3471009135...
{return creationDate;} ... } @Entity public class Customer extends BaseEntity { private String customerName; ... } ``` This works fine for us. As well as the ID and creation date, we also have a modified date. We also have an intermediate *TaggedBaseEntity* that implements a *Taggable* interface, because ...
[ 0.24910657107830048, -0.05278409644961357, 0.42005813121795654, -0.04477011412382126, 0.1609492152929306, -0.1595396101474762, -0.04736441373825073, -0.03348993510007858, 0.10562935471534729, -0.385410875082016, -0.013460543937981129, 0.4169592261314392, 0.11124396324157715, 0.374557852745...
This is a question with many answers - I am interested in knowing what others consider to be "best practice". Consider the following situation: you have an object-oriented program that contains one or more data structures that are needed by many different classes. How do you make these data structures accessible? 1. ...
[ 0.21603626012802124, 0.2097274214029312, -0.06821241974830627, 0.563001275062561, -0.1447746902704239, -0.1740223914384842, 0.31416594982147217, -0.08608715236186981, -0.3767063319683075, -0.7128127813339233, -0.09663137048482895, 0.4506199061870575, -0.4025060534477234, 0.2943039536476135...
object, and pass around references to this object. This can either be an object created just for this purpose, or it could be the "main" object of your program. This simplifies the problems of (1), but the data structures may or may not have anything to do with one another, and collecting them together in a single obje...
[ 0.11761604249477386, -0.07996615022420883, 0.07689961045980453, 0.19995439052581787, -0.02502351440489292, -0.16234512627124786, 0.19554558396339417, 0.005004444625228643, -0.3726884126663208, -0.44551604986190796, -0.1989329606294632, 0.19385282695293427, -0.5670735239982605, 0.1182222813...
can only ever be a single instance of the program. When there are a lot of data structures, all required by a lot of classes, I tend to use (2). This is a compromise between OO-purity and practicality. What do other folks do? (For what it's worth, I mostly come from the Java world, but this discussion is applicable to...
[ 0.06111668050289154, 0.09662632644176483, -0.1744501143693924, 0.25916364789009094, -0.14067767560482025, -0.23873041570186615, 0.2654496431350708, 0.4543781578540802, -0.49662137031555176, -0.7281312346458435, -0.1990995705127716, 0.4156879186630249, -0.2506338357925415, 0.056385718286037...
you use some global stuff in your program, you're merely extending this huge environment your class implementation can already see of the OS with a bit of data that is domain specific to your app. Passing pointers/references everywhere is often taught in OO courses and books, academically it sounds nice. Pragmatically...
[ 0.5172080993652344, 0.3749423027038574, 0.012004719115793705, 0.3241850435733795, -0.0025424340274184942, -0.2665078043937683, 0.2178044468164444, 0.42867112159729004, -0.36891311407089233, -0.7259163856506348, -0.40501031279563904, 0.2885700762271881, -0.053124625235795975, 0.138842374086...
(abstracted away behind a nice interface obviously) are pretty much a must in a decent sized app.
[ 0.4595709443092346, 0.19852904975414276, 0.1728196144104004, 0.3555641770362854, 0.31883275508880615, 0.0175965316593647, -0.0006805016309954226, 0.3587052822113037, -0.1901235282421112, -0.23351043462753296, -0.04057624936103821, 0.510394811630249, 0.30486083030700684, -0.1777034848928451...
If I hit a page which calls `session_start()`, how long would I have to wait before I get a new session ID when I refresh the page? Check out php.ini the value set for session.gc\_maxlifetime is the ID lifetime in seconds. I believe the default is 1440 seconds (24 mins) <http://www.php.net/manual/en/session.configura...
[ 0.23489287495613098, -0.025371123105287552, 0.7792057394981384, -0.07421771436929703, 0.0819629356265068, -0.39486047625541687, 0.5004218220710754, -0.06136443838477135, -0.45053452253341675, -0.409542053937912, 0.16485966742038727, 0.6212932467460632, 0.3625376224517822, -0.02651433274149...
When verbally talking about methods, I'm never sure whether to use the word *argument* or *parameter* or something else. Either way the other people know what I mean, but what's correct, and what's the history of the terms? I'm a C# programmer, but I also wonder whether people use different terms in different language...
[ 0.4122527837753296, 0.40528449416160583, 0.23161602020263672, 0.003799463389441371, -0.1870400309562683, -0.1308610588312149, 0.624294638633728, -0.3376539647579193, 0.014753655530512333, -0.24376697838306427, 0.015313305892050266, 0.5124510526657104, 0.25078070163726807, 0.047704305499792...
OK to use these terms interchangeably in a team environment. Except perhaps when you're defining the precise terminology; then you can also use "*formal* argument/parameter" and "*actual* argument/parameter" to disambiguate. A parameter is a variable in a method definition. When a method is called, the arguments are th...
[ -0.043956127017736435, 0.039337631314992905, 0.1449723094701767, 0.11002536863088608, 0.07723673433065414, -0.08770030736923218, 0.11963603645563126, -0.08211561292409897, -0.026386810466647148, -0.17021845281124115, -0.12703803181648254, 0.29313924908638, -0.2751138508319855, 0.2978292703...
I've written a simple SessionItem management class to handle all those pesky null checks and insert a default value if none exists. Here is my GetItem method: ``` public static T GetItem<T>(string key, Func<T> defaultValue) { if (HttpContext.Current.Session[key] == null) { HttpContext.Current.Session[k...
[ 0.2434328943490982, 0.011915215291082859, 0.4987984299659729, -0.20267300307750702, -0.08527864515781403, -0.1261516958475113, 0.3062629997730255, -0.27275076508522034, -0.17986899614334106, -0.44295045733451843, -0.09916145354509354, 0.7581266164779663, -0.3833617866039276, 0.268319159746...
func that is invoked as a default. You could also simplify to: ``` return ((T)HttpContext.Current.Session[key]) ?? defaultValue(); ``` Where ?? is the null-coalescing operator - if the first arg is non-null, it is returned; otherwise the right hand is evaluated and returned (so defaultValue() isn't invoked unless ...
[ -0.27195173501968384, -0.4703761637210846, 0.3986903727054596, -0.006378140300512314, -0.3087925314903259, -0.23986117541790009, 0.02347981370985508, -0.08144417405128479, -0.32730790972709656, -0.314354807138443, -0.4934295117855072, 1.0282708406448364, -0.5535629987716675, -0.04601207002...
What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like to setup dynamic Dynamic DNS solution. I'm ...
[ 0.049177009612321854, 0.10514704883098602, 0.6606676578521729, -0.026722775772213936, -0.05783954635262489, -0.3562362492084503, 0.1505892127752304, 0.006360932253301144, -0.3033769130706787, -0.9563764929771423, -0.2087426632642746, 0.456402450799942, -0.06597535312175751, 0.2036442309617...
the current directory on my local machine. If you don't get this, try `sudo apt-get install bash-completion`, and check that your .bashrc contains the following lines (mine did by default): ``` # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and ...
[ 0.19459398090839386, 0.1951407492160797, 0.672081708908081, -0.22069522738456726, 0.31940409541130066, -0.2145802527666092, 0.1909140646457672, -0.21104592084884644, -0.01841196045279503, -0.83786541223526, -0.10279174149036407, 0.7448005676269531, -0.14526228606700897, 0.1920240819454193,...
Ok, here's one for the Java/JavaScript gurus: In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple beans containing the car's name, id, year of production etc. So, the map looks something like this...
[ 0.28743866086006165, 0.18937133252620697, 0.4465872347354889, 0.42831605672836304, -0.04171507805585861, 0.22579385340213776, -0.39174187183380127, 0.11542285978794098, -0.23661471903324127, -0.1954154372215271, 0.31355148553848267, 0.5447937250137329, 0.26205170154571533, 0.21842828392982...
my JSP i have two comboboxes. One should receive a list of car manufacturers(keys from the map - this part I know how to do), and the other one should **dynamicaly change** to display the names of the cars when the user selects a certain manufacturer from the first combobox. So, for example, user selects a "Porsche" in...
[ 0.4014240503311157, -0.07601173222064972, 0.5998423099517822, 0.13731901347637177, -0.20797428488731384, 0.4472725987434387, 0.033129286020994186, -0.054193563759326935, 0.1372218281030655, -0.39764177799224854, -0.04771261289715767, 0.497737854719162, -0.17076852917671204, -0.064096428453...
a wall somewehere along the way. Can anybody suggest how I should approach this one? Yes, I'm a JavaScript newbie, if anybody was wondering... EDIT: I've retagged this as a code-challenge. Kudos to anybody who solves this one without using any JavaScript framework (like JQuery). Well anyway, as i said, i finally manag...
[ 0.24281412363052368, -0.124407097697258, 0.5192692279815674, 0.027560535818338394, -0.12835267186164856, 0.1122531071305275, -0.06907808035612106, -0.5502088069915771, -0.4414360523223877, -0.8681781888008118, 0.2524137496948242, 0.38773012161254883, 0.07097309082746506, -0.026330932974815...
<c:forEach var="manufacturersItem" items="<%= manufacturers%>"> <option value='<c:out value="${manufacturersItem}" />'><c:out value="${manufacturersItem}" /></option> </c:forEach> </select> ``` ``` select id="modelsList" name="modelsList" <c:forE...
[ -0.2660035789012909, -0.020797939971089363, 0.5204703211784363, -0.028849264606833458, 0.26638516783714294, 0.5244934558868408, -0.24587227404117584, -0.45270100235939026, -0.41597554087638855, -0.558424174785614, -0.16321659088134766, 0.6343218684196472, -0.04533420875668526, 0.1918025165...
<option value='<c:out value="${model}" />'><c:out value="${model}" /></option> </c:forEach> </select> ``` I imported the following classes (some names have, of course, been changed): ``` <%@ page import="org.mycompany.Car,java.util.Map,java.util.TreeMap,java.util.List,java.util.Arra...
[ -0.16143584251403809, 0.13335202634334564, 0.5033558011054993, -0.10546030104160309, -0.11526353657245636, 0.4605085551738739, -0.11367899924516678, -0.4682198464870453, -0.29390281438827515, -0.7423291802406311, -0.3051322400569916, 0.551468014717102, -0.3233155608177185, 0.02584608644247...
Set manufacturers = mansAndModels.keySet(); //We'll use this one to populate the first combo Object[] manufacturersArray = manufacturers.toArray(); List cars; List models = new ArrayList(); //We'll populate the second combo the first time the page is displayed with this list //initial second combo pop...
[ 0.2292778640985489, -0.21388547122478485, 0.8730760812759399, 0.1012817919254303, -0.12220568209886551, 0.44837161898612976, -0.028012851253151894, -0.7695500254631042, -0.5475744009017944, -0.4276944696903229, -0.1132267639040947, 0.5788251757621765, -0.12206543236970901, 0.19269673526287...
modelsArray = new Array(); //Here goes the tricky part, we populate a two-dimensional javascript array with values from the map <% for(int i = 0; i < manufacturersArray.length; i++) { cars = (List) mansAndModels.get(manufacturersArray[i]); Iterator carsIterator = cars.it...
[ 0.17235219478607178, -0.09620149433612823, 0.5888990163803101, 0.43326154351234436, -0.008117751218378544, 0.4105128347873688, -0.04313734546303749, -0.6602106094360352, -0.33287906646728516, -0.3800871670246124, 0.28795555233955383, 0.6825003027915955, -0.07198924571275711, 0.264619112014...
for(int j = 0; carsIterator.hasNext(); j++) { Car car = (Car) carsIterator.next(); %> singleManufacturerModelsArray[<%= j%>] = "<%= car.getModel()%>"; <% } %> modelsArray[<%= i%>] = singleManufacturerModelsArray; <% } %> var modelsList = document.getElementById("mo...
[ -0.038766346871852875, -0.3601286709308624, 0.7114916443824768, -0.017803367227315903, 0.13084003329277039, 0.7499125003814697, 0.210224449634552, -0.6230812072753906, -0.09248491376638412, -0.7931360006332397, -0.20149756968021393, 0.4927956759929657, 0.1083066314458847, 0.236107856035232...
i < modelsArray[key].length; i++) { modelsList.options[i] = new Option(modelsArray[key][i], modelsArray[key][i]); } } ```
[ -0.15057459473609924, -0.4267001450061798, 0.7016913890838623, -0.20356065034866333, 0.3226482570171356, 0.034966014325618744, 0.25790804624557495, -0.579866886138916, -0.20746152102947235, -0.8054696917533875, -0.24531055986881256, 0.7333803772926331, -0.35312363505363464, 0.1678400784730...
I have some REST web services implemented in WCF. I wish to make these services return "Bad Request" when the xml contains invalid elements. The xml serialization is being handled by XmlSerializer. By default XmlSerializer ignores unknown elements. I know it is possible to hook XmlSerializer.UnknownElement and throw a...
[ 0.05135713145136833, 0.052999045699834824, 0.1963745653629303, 0.019492514431476593, -0.06564188003540039, -0.31905460357666016, 0.4741520285606384, -0.15371476113796234, -0.20565611124038696, -0.7492150664329529, 0.10900085419416428, 0.43100401759147644, -0.5964308977127075, 0.34919568896...
to do this... In a WCF project that I worked on, we did something similar using the IDispatchMessageFormatter interface. More information can be found here <http://nayyeri.net/blog/use-idispatchmessageformatter-and-iclientmessageformatter-to-customize-messages-in-wcf/> It allows you peak at the message headers, con...
[ 0.3000014126300812, -0.5091828107833862, 0.25974422693252563, 0.12452654540538788, -0.3462914824485779, -0.5805048942565918, 0.11663292348384857, -0.29239824414253235, -0.560538649559021, -0.3910185992717743, 0.34064263105392456, 0.4203627109527588, -0.1844845712184906, -0.0054153697565197...
I am working on developing an on-screen keyboard with java. This keyboard has a `JComponent` for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The keyboard itself is within a `JFrame` with no decorations and set to always-...
[ 0.1957114040851593, 0.07343575358390808, 0.3684384226799011, -0.2002597451210022, 0.08422741293907166, 0.2877291440963745, 0.16420850157737732, 0.1623905748128891, -0.16754232347011566, -0.6634422540664673, -0.17378652095794678, 0.5950087904930115, -0.102501280605793, -0.008543615229427814...
other application How can I keep my on-screen keyboard "Always-without-focus"? Is it maybe possible to use another approach to send the key-press? Apparently the only way to do this is to have a JNI layer that will make the conversion from java to native. Java has no easy way to provide such funcionality. This could ...
[ 0.42680415511131287, -0.21119898557662964, 0.06763306260108948, 0.09313306957483292, -0.10644687712192535, -0.1030731350183487, 0.123188316822052, 0.3455318212509155, -0.1297522485256195, -0.5899291634559631, 0.02053525485098362, 0.9049497246742249, -0.19221451878547668, -0.282358497381210...