text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
are a little bigger than most people's and my green-red-green cycles take a little longer. But now that I've been doing this for a little while I'm completely convinced that unit tests in the traditional sense aren't all they're cracked up to be.
In my experience writing a bunch of tiny unit tests ends up being an imp... | [
0.6921758055686951,
0.29969853162765503,
-0.14077331125736237,
0.13034260272979736,
-0.08356305211782455,
0.1590278446674347,
0.6342182755470276,
-0.011004339903593063,
-0.42385780811309814,
-0.42930516600608826,
0.257564514875412,
0.3754553496837616,
0.2744781970977783,
0.1892092823982238... | |
have to change. Now if I have tests that verify that the end to end flow through the system works as expected then my tests actually help me to identify places where my refactorings might have caused a change in the external behavior of the system.
The bottom line is that mocks codify the contract of a particular clas... | [
0.7056169509887695,
0.6466991305351257,
0.31218546628952026,
0.2118888795375824,
0.07714878767728806,
0.275325208902359,
0.6183450222015381,
-0.11868888139724731,
-0.051810141652822495,
-0.6489598751068115,
0.3446674048900604,
0.488027960062027,
-0.09190864115953445,
0.11188159137964249,
... | |
I have a c# form (let's call it MainForm) with a number of custom controls on it. I'd like to have the MainForm.OnClick() method fire anytime someone clicks on the form regardless of whether the click happened on the form or if the click was on one of the custom controls. I'm looking for behavior similar to the KeyPrev... | [
0.38997718691825867,
0.037334829568862915,
0.44319596886634827,
-0.04718277230858803,
-0.028072215616703033,
-0.3627772033214569,
0.3064303994178772,
0.09124511480331421,
0.03583154082298279,
-0.5424960255622864,
-0.02144753932952881,
0.5999906063079834,
-0.43055301904678345,
0.17233990132... | |
As Object, ByVal e As System.Windows.Forms.ControlEventArgs) Handles Me.ControlAdded
AddHandler e.Control.MouseClick, AddressOf Example_MouseClick
End Sub
Private Sub Example_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
MessageBox.Show("Click")
End S... | [
-0.3450447618961334,
0.011634587310254574,
0.560887336730957,
-0.15711838006973267,
0.1491100788116455,
0.17967358231544495,
0.28565138578414917,
-0.1550428420305252,
0.18673193454742432,
-0.4287649393081665,
-0.5411837697029114,
0.43700841069221497,
-0.30950644612312317,
0.444629162549972... | |
I would like to find out where I would be able to find the MP3 library, for implementation in an Operating System.
Are you looking for [Lame](http://lame.sourceforge.net/)? | [
0.34137940406799316,
0.13211703300476074,
-0.1150624230504036,
0.09392894804477692,
0.16272711753845215,
-0.343808114528656,
0.15781165659427643,
0.3155973255634308,
-0.43388688564300537,
-0.5479163527488708,
0.028156183660030365,
0.5306436419487,
-0.028234023600816727,
-0.0786843746900558... | |
I've just discovered that Oracle lets you do the following:
```
SELECT foo.a, (SELECT c
FROM bar
WHERE foo.a = bar.a)
from foo
```
As long as only one row in bar matches any row in foo.
The explain plan I get from PL/SQL developer is this:
```
SELECT STATEMENT, GOAL = ALL_ROWS ... | [
0.007318596355617046,
0.27551403641700745,
0.2549419403076172,
-0.32320547103881836,
-0.1135597676038742,
0.04705004021525383,
-0.12627193331718445,
-0.16863881051540375,
-0.13615012168884277,
-0.21274720132350922,
-0.18964114785194397,
0.4738906919956207,
-0.35810235142707825,
0.025891751... | |
FOO
```
This doesn't actually specify how the tables are joined. A colleague asserted that this is more efficient than doing a regular join. Is that true? What is the join strategy on such a select statement, and why doesn't it show up in the explain plan?
Thanks.
The plan you have there does not provide much infor... | [
0.152390718460083,
0.2600439190864563,
0.48289743065834045,
-0.059608396142721176,
-0.029862361028790474,
-0.31951919198036194,
0.08692073076963425,
0.060718636959791183,
-0.05120798945426941,
-0.34316664934158325,
-0.0054549118503928185,
0.5894395709037781,
-0.6297105550765991,
-0.1223830... | |
Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1837 | 23881 | 3 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| BAR | 18 | 468 | 2 (0)| 00:00:01 |
| 2 | TABLE ACCESS FULL| FOO | 1837 | 23881 | 3 (0)| 00:00:0... | [
-0.681986391544342,
0.26992639899253845,
0.4285246729850769,
-0.04481383040547371,
0.21310925483703613,
0.6204439401626587,
-0.04913782700896263,
-0.4874710142612457,
0.04372584447264671,
-0.4675162434577942,
-0.38111206889152527,
0.5836514830589294,
-0.23305635154247284,
0.163751199841499... | |
- filter("BAR"."A"=:B1)
Note
-----
- dynamic sampling used for this statement
18 rows selected.
```
I didn't create any indexes or foreign keys or collect statistics on the tables, which would change the plan and the join mechanism choosen. Oracle is actually doing a NESTED LOOPS type join here. Step 1, your inl... | [
0.32320573925971985,
-0.3075479567050934,
0.20966027677059174,
0.028080474585294724,
-0.136200949549675,
-0.12391883879899979,
0.45567816495895386,
-0.3049239218235016,
-0.021108021959662437,
-0.13631761074066162,
-0.03006208874285221,
0.5072510242462158,
-0.6053850054740906,
-0.1558273136... | |
I'm developing a solution which uses an ActiveX control (a commercial one which we bought and that I did not develop). I need to develop the proper installation pages to simulate what happens when a user who has never visited the site and does not have the add-on installed comes to the page.
I've found the "Manage Add... | [
0.16559959948062897,
-0.07960131764411926,
0.29145798087120056,
-0.1365869641304016,
0.1497780829668045,
-0.5177996754646301,
0.5007110238075256,
0.18838877975940704,
-0.03544880449771881,
-0.8039659857749939,
-0.4573008716106415,
0.5951647758483887,
-0.5994277000427246,
-0.032310038805007... | |
reworked and I no longer see an option to delete the control. Each control has a "Properties" dialog and I can "Remove" it, but the button doesn't appear to do anything (could be related to how "Delete ActiveX" doesn't work for this on in IE7).
It looks like maybe this control is installed in such a way that merely de... | [
0.3615097999572754,
-0.06440704315900803,
0.37315210700035095,
0.004991564899682999,
0.0009873887756839395,
0.03844449296593666,
0.4709002375602722,
-0.5161198377609253,
-0.2433478683233261,
-0.6935856938362122,
0.08315455913543701,
0.7818149328231812,
-0.23980876803398132,
0.3253616094589... | |
IE so that I can simulate what happens when people come to the site and the ActiveX control hasn't been installed yet? I figure there must be a way to "purge" IE of it.
You could unregister the control with
```
regsvr32 /u badboy.ocx
```
at the command line. Though i would suggest testing these things in a vmware. | [
0.5983266830444336,
0.14634159207344055,
0.20278911292552948,
0.041765548288822174,
0.07964158058166504,
-0.5325783491134644,
0.29344743490219116,
0.2599742114543915,
0.19737333059310913,
-0.7051835060119629,
-0.1338711977005005,
0.6303723454475403,
-0.4416562616825104,
0.2633059322834015,... | |
I heard Microsoft allows use of commercially available Office UI controls, with the exception of competing products, such as a word processor or spreadsheet app, etc.
How true is that?
Also, if it is not true, do you know of any *free* Ribbon controls?
You should look at [Jensen Harris' blog entry about licensing the... | [
0.47301214933395386,
0.30669957399368286,
0.4043598771095276,
0.18349669873714447,
0.2000446617603302,
-0.22697003185749054,
0.003249544184654951,
-0.2544250190258026,
-0.061908651143312454,
-0.0747513622045517,
-0.0719536766409874,
0.6322947144508362,
-0.15823118388652802,
0.1646760851144... | |
you
> can't obtain the royalty-free license. | [
0.6508956551551819,
0.32530319690704346,
0.02317601442337036,
0.1512901484966278,
-0.00033525892649777234,
-0.6059717535972595,
0.4068962335586548,
0.22778615355491638,
0.16333872079849243,
-0.3571048378944397,
-0.1970362663269043,
0.6702484488487244,
-0.18912652134895325,
0.41241949796676... | |
I´m not sure if this is really a programming question, but it's related to what I'm doing which is... I'm developing a web site that will have a lot of .domain.com, and based on what contain, the web site will show diffrent content.
Anyone knows how to do that? Maybe it requires changes in the DNS server.
You need a w... | [
0.8313416838645935,
0.09004274755716324,
0.3173920512199402,
0.24380886554718018,
0.11305568367242813,
-0.591960608959198,
0.05970286577939987,
0.16827577352523804,
-0.4032159745693207,
-0.5834776759147644,
0.13581736385822296,
0.1291794627904892,
-0.259410560131073,
0.7340770959854126,
... | |
I'm using a vendor API to obtain a JDBC connection to the application's database. The API works when running in the application server or when running in a stand-alone mode. I want to run a series of SQL statements in a single transaction. I'm fine with them occurring in the context of the JTA transaction if it exists.... | [
0.3631569445133209,
0.2506069540977478,
0.15956664085388184,
0.06076870486140251,
-0.07135768979787827,
-0.016427243128418922,
0.11195804178714752,
-0.08705580234527588,
-0.09720750153064728,
-0.5106271505355835,
0.11087866127490997,
0.5136082768440247,
-0.3044348359107971,
0.3617444038391... | |
from the JTA enabled DataSource or if it's just a straight JDBC connection.
Is there a straight forward way to make this determination?
Thanks!
Even if it's straight JDBC, you can have a JTA transaction enabled. Checking the autoCommit flag will NOT help in this regard. You can be in a transaction, distributed or oth... | [
0.36456915736198425,
-0.22154776751995087,
0.07910805940628052,
0.1765865534543991,
-0.012302595190703869,
-0.41176217794418335,
0.36600014567375183,
0.07602550089359283,
-0.44742482900619507,
-0.5549614429473877,
-0.2287450134754181,
0.7934870719909668,
-0.20586374402046204,
-0.0390230491... | |
is not equal to Status.NoTransaction(). This would tell you if you're in a JTA transaction. | [
0.16620635986328125,
-0.41084712743759155,
0.028611699119210243,
0.20339256525039673,
0.16961993277072906,
-0.2701081931591034,
0.06163616478443146,
-0.05326478183269501,
-0.2593323290348053,
-0.2850765287876129,
-0.02812979929149151,
0.3325924277305603,
-0.12098027765750885,
0.17565482854... | |
I have an upcoming project which will have to be able to print simple reports from its data. It'll be WPF-based, and I'm wondering which way to go.
I know that WPF introduces its own printing technology (based on XPS) which looks quite easy to use. However, part of me wonders whether it would just be easier to use the... | [
0.7794596552848816,
0.14003221690654755,
0.36010468006134033,
0.3899269104003906,
-0.15228654444217682,
-0.436260461807251,
-0.15948165953159332,
-0.07255780696868896,
-0.37414655089378357,
-0.5212494730949402,
0.283326655626297,
0.4306512773036957,
-0.10772034525871277,
0.0301798786967992... | |
recommend?
We had this same issue, and ended up using RDLC/ReportViewer for now. There's no native WPF reporting tool (that I know of) and RDLC is pretty simple to use, and is free. The runtime overhead for it is small (around 2Mb) but you must remember to distribute it as it isn't part of the .NET Framework. | [
0.9110115170478821,
-0.03355720639228821,
0.32856738567352295,
0.05610454082489014,
-0.33927929401397705,
-0.7793053388595581,
0.1069808155298233,
-0.3934483528137207,
-0.09591323137283325,
-0.3750307559967041,
0.33378157019615173,
0.5984253287315369,
-0.3342737555503845,
-0.07590176910161... | |
I looked at the AdaCore site, as well as for A# (which now appears to be owned by AdaCore) and neither appear to be free (although I could have misread something). Any recommendations?
GNAT is available for download here: <https://libre.adacore.com/>
Look for "GNAT GPL Edition". Not sure why it is so well hidden on th... | [
0.2887181341648102,
0.019726483151316643,
0.07870788127183914,
0.08974003791809082,
-0.323247492313385,
-0.6085003614425659,
0.22820907831192017,
0.4203992486000061,
-0.44470566511154175,
-0.6108412146568298,
0.22461283206939697,
0.3612871468067169,
-0.5473384261131287,
0.21305592358112335... | |
I need to clip out all the occurances of the pattern '--' that are *inside* single quotes in long string (leaving intact the ones that are outside single quotes).
Is there a RegEx way of doing this?
(using it with an iterator from the language is OK).
For example, starting with
```
"xxxx rt / $ 'dfdf--fggh-dfgdfg' ... | [
0.1502564251422882,
0.2813700735569,
0.381380170583725,
0.020699268206954002,
-0.1742940992116928,
0.16686908900737762,
0.11496920883655548,
-0.18673460185527802,
-0.0722031518816948,
-0.609744131565094,
-0.23559266328811646,
0.6425068974494934,
-0.4034064710140228,
0.030742714181542397,
... | |
Language | RegEx |
+-------------+------------------------------------------+
| JavaScript | input.replace(/someregex/g, "") |
| PHP | preg_replace('/someregex/', "", input) |
| Python | re.sub(r'someregex', "", input) | [
-0.06349607557058334,
0.059705618768930435,
0.20601317286491394,
-0.17627808451652527,
-0.06230500712990761,
0.16937166452407837,
0.508664071559906,
0.2620372176170349,
-0.21956570446491241,
-0.019171759486198425,
-0.30771151185035706,
0.6604164242744446,
-0.6864591240882874,
-0.1830751746... | |
|
| Ruby | input.gsub(/someregex/, "") |
+-------------+------------------------------------------+
```
I found another way to do this from an answer by **Greg Hewgill** at [Qn138522](https://stackoverflow.com/questions/138552)
It is based on using this regex (adapted to contain the pa... | [
0.11397546529769897,
0.3493962287902832,
0.06574568897485733,
-0.1615164875984192,
-0.08923561871051788,
-0.16167643666267395,
0.43124276399612427,
-0.37752091884613037,
-0.24512475728988647,
-0.21163882315158844,
-0.2228832095861435,
0.33614009618759155,
-0.46664005517959595,
-0.117904193... | |
characters up to the next quote, then looks for a sequence of either single characters or quoted groups of characters, until the end of the string. This relies on your assumption that the quotes are always balanced. This is also not very efficient."
The usage examples would be :
* JavaScript: `input.replace(/--(?=[^'... | [
-0.05255008861422539,
0.12201065570116043,
0.42685467004776,
-0.2364562600851059,
-0.13901853561401367,
0.3625369668006897,
0.03596212714910507,
-0.25255075097084045,
0.026877934113144875,
-0.4108332693576813,
-0.13842058181762695,
0.558766782283783,
-0.32001009583473206,
-0.35816571116447... | |
Here are some gems:
Literals:
```
var obj = {}; // Object literal, equivalent to var obj = new Object();
var arr = []; // Array literal, equivalent to var arr = new Array();
var regex = /something/; // Regular expression literal, equivalent to var regex = new RegExp('something');
```
Defaults:
```
arg = arg || 'de... | [
-0.008261282928287983,
0.032739054411649704,
-0.015457529574632645,
-0.17316579818725586,
-0.09298264235258102,
-0.0010921687353402376,
0.39071255922317505,
-0.23107117414474487,
-0.10310723632574081,
-0.216486856341362,
-0.412974089384079,
0.9087832570075989,
-0.4867023229598999,
-0.21369... | |
executes it
```
**Question:** What other great syntactic sugar is available in javascript?
Getting the current datetime as milliseconds:
```
Date.now()
```
For example, to time the execution of a section of code:
```
var start = Date.now();
// some code
alert((Date.now() - start) + " ms elapsed");
``` | [
-0.022409794852137566,
-0.26020297408103943,
0.3892054259777069,
0.015408365055918694,
0.17534424364566803,
0.11215262860059738,
0.3846207559108734,
0.10457117110490799,
-0.12232602387666702,
-0.36965110898017883,
-0.1702381670475006,
0.12403126806020737,
-0.13904942572116852,
-0.056612979... | |
What is the maximum length in characters a CString object can hold?
Up to your available memory or INT\_MAX-1 (whichever is less). | [
-0.018442727625370026,
0.023972028866410255,
0.4555445909500122,
0.0910392478108406,
0.18614797294139862,
0.4216269254684448,
-0.0666365846991539,
0.13331951200962067,
-0.328258752822876,
-0.246888667345047,
-0.14078456163406372,
0.47186774015426636,
0.1600334197282791,
-0.1936782002449035... | |
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)?
Go into 'Window' -> 'Preferences' then select 'Java' -> 'Installed JREs', clone the JRE used by Tomca... | [
0.293143630027771,
-0.05703144893050194,
0.5037966370582581,
-0.03527400642633438,
-0.07236151397228241,
-0.0010773013345897198,
0.2728039622306824,
-0.1771617829799652,
-0.15115687251091003,
-0.37155643105506897,
-0.12565509974956512,
0.6072065830230713,
-0.12119679152965546,
-0.306482613... | |
in the preferences, and select your Apache Tomcat environment, then click the 'Edit...' button. In the resulting window, select the new security enabled JRE, then click 'Finish' and restart Tomcat. | [
0.0917382761836052,
-0.12576161324977875,
0.4824748635292053,
0.23348240554332733,
0.2813701331615448,
-0.2828291952610016,
0.6265690922737122,
0.029570486396551132,
0.030959997326135635,
-0.6084509491920471,
-0.4796020984649658,
0.7123128771781921,
-0.1692972183227539,
-0.0130012826994061... | |
I've got a LOT of tests written for a piece of software (which is a GREAT thing) but it was built essentially as a standalone test in C#. While this works well enough, it suffers from a few shortcomings, not the least of which is that it isn't using a standard testing framework and ends up requiring the person running ... | [
0.6727290749549866,
0.23881642520427704,
0.08649390935897827,
0.12010837346315384,
-0.28785860538482666,
-0.3399597406387329,
0.4407893121242523,
-0.276960551738739,
0.325277715921402,
-0.2354438453912735,
0.2387605756521225,
0.838123083114624,
-0.1939283162355423,
-0.036909595131874084,
... | |
has the notion of a 'Generic Test' that might do what I want, but we're not in a position to spend the money on that version currently. I recently started using the VS 2008 Pro version.
These test methods follow a familiar pattern:
* Do some setup for the test.
* Execute the test.
* Reset for the next test.
Each of ... | [
0.5026500225067139,
0.1768675148487091,
0.14940527081489563,
0.1297769546508789,
-0.2651297152042389,
-0.06317581236362457,
0.6042360663414001,
-0.2468763142824173,
-0.12473268806934357,
-0.40664395689964294,
0.018199274316430092,
0.7092975974082947,
-0.16258014738559723,
-0.00783406756818... | |
all this test code to a testing framework and, frankly, I'm not all that excited about the idea of poring over 8-9K lines of test code by hand to do the conversion.
Have you had any experience undertaking such a conversion? Do you have any tips? I think I might be stuck slogging through it all doing global search/rep... | [
0.44865426421165466,
0.0007762769819237292,
-0.2731568515300751,
0.34814712405204773,
-0.5383540391921997,
-0.03024939075112343,
0.5661819577217102,
-0.16261358559131622,
-0.06969602406024933,
-0.4958305358886719,
0.1768587827682495,
0.6272693276405334,
0.02679830975830555,
-0.229925826191... | |
which is how it builds its list of the tests that show up in the UI, and the test classes use the NUnit `Assert` method to indicate whether they've passed or failed.
It seems to me that if your test methods are as consistent as you say, all of those NUnit methods would look something like this:
```
[Test]
public void... | [
0.2640376687049866,
-0.08247121423482895,
0.45069992542266846,
-0.18262404203414917,
-0.04176485538482666,
-0.02544216439127922,
0.5985864996910095,
-0.4006122350692749,
0.16879203915596008,
-0.5124357342720032,
-0.10528691858053207,
0.65544193983078,
-0.03379837051033974,
0.19801084697246... | |
a program that uses reflection to get all of the test method names on your old test class and produces a .cs file that has an NUnit method for each of your original test methods.
Annoying, maybe, but not extremely painful. And you'll only need to do it once. | [
0.41137588024139404,
0.00920114666223526,
-0.13027498126029968,
0.3591620624065399,
-0.22096942365169525,
-0.1429826021194458,
0.35781916975975037,
-0.04523327946662903,
0.0558716282248497,
-0.36148908734321594,
-0.04020960256457329,
0.34827062487602234,
0.05272100120782852,
-0.08837901055... | |
Is there a freely available Base64 decoding code snippet in C++?
See *[Encoding and decoding base 64 with C++](http://www.adp-gmbh.ch/cpp/common/base64.html)*.
Here is the implementation from that page:
```
/*
base64.cpp and base64.h
Copyright (C) 2004-2008 René Nyffenegger
This source code is provided 'as... | [
0.22265170514583588,
0.6020530462265015,
0.031342171132564545,
-0.029375074431300163,
0.09727500379085541,
-0.4662650525569916,
0.03642607852816582,
0.16982659697532654,
-0.3978632092475891,
0.07235770672559738,
-0.535538375377655,
0.3048156797885895,
-0.18462687730789185,
0.14696328341960... | |
freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
claim that you wrote the original source code. If you use this source code
in a product, an acknowledgment in the product documentation would be
appreciated but is not required... | [
0.6060018539428711,
0.29640433192253113,
0.13551977276802063,
0.16131199896335602,
0.0491325706243515,
-0.7137740850448608,
0.03645467385649681,
0.10142676532268524,
-0.4793849289417267,
-0.10843763500452042,
-0.25365743041038513,
0.33148178458213806,
0.08929160982370377,
0.206279143691062... | |
notice may not be removed or altered from any source distribution.
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
static inline bool is_base64(unsigned char c... | [
0.4777020514011383,
0.2751554846763611,
0.43831300735473633,
-0.44307562708854675,
0.0775144174695015,
0.3196018934249878,
0.39090725779533386,
-0.17109571397304535,
-0.13315215706825256,
-0.567980945110321,
-0.6426909565925598,
0.16006778180599213,
-0.4945721924304962,
-0.0388080775737762... | |
char_array_3[3];
unsigned char char_array_4[4];
while (in_len--) {
char_array_3[i++] = *(bytes_to_encode++);
if (i == 3) {
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3... | [
-0.05350930616259575,
-0.09797222167253494,
0.3815665543079376,
-0.4950326979160309,
-0.1252698451280594,
0.46063145995140076,
0.4487609565258026,
-0.6649073362350464,
-0.24420981109142303,
-0.0756751149892807,
-0.4006219506263733,
0.6311657428741455,
-0.3350118398666382,
-0.09969741851091... | |
ret += base64_chars[char_array_4[i]];
i = 0;
}
}
if (i)
{
for(j = i; j < 3; j++)
char_array_3[j] = '\0';
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0... | [
0.05145815387368202,
-0.27380117774009705,
0.9317274689674377,
-0.563035249710083,
-0.1164437010884285,
0.7261136770248413,
0.9142074584960938,
-0.982700765132904,
-0.08166927844285965,
-0.3874274492263794,
-0.6290515661239624,
1.041702151298523,
-0.3871256113052368,
0.17474998533725739,
... | |
+ 1); j++)
ret += base64_chars[char_array_4[j]];
while((i++ < 3))
ret += '=';
}
return ret;
}
std::string base64_decode(std::string const& encoded_string) {
int in_len = encoded_string.size();
int i = 0;
int j = 0;
int in_ = 0;
unsigned char char_array_4[4], char_array_3[3];
std::str... | [
-0.23442542552947998,
-0.16563445329666138,
0.5295681953430176,
-0.5335278511047363,
-0.02290370687842369,
0.4351826608181,
0.6120734810829163,
-0.8393617868423462,
-0.17570774257183075,
-0.2081199735403061,
-0.6805040836334229,
0.5407187938690186,
-0.499104380607605,
0.03174635022878647,
... | |
char_array_4[i] = base64_chars.find(char_array_4[i]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for (i = 0; ... | [
-0.1482299417257309,
0.030267909169197083,
0.37848007678985596,
-0.5876554846763611,
0.0009991988772526383,
0.3860826790332794,
0.5654627084732056,
-0.7523635625839233,
-0.040514010936021805,
-0.22428525984287262,
-0.48862728476524353,
0.6595548391342163,
-0.29860711097717285,
-0.020508455... | |
for (j = i; j <4; j++)
char_array_4[j] = 0;
for (j = 0; j <4; j++)
char_array_4[j] = base64_chars.find(char_array_4[j]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_arra... | [
-0.048778071999549866,
0.06399945169687271,
0.3359600305557251,
-0.48055869340896606,
0.0669809877872467,
0.23028679192066193,
0.6697155833244324,
-0.6182319521903992,
-0.06554342061281204,
-0.20866185426712036,
-0.6116393208503723,
0.7488410472869873,
-0.3793891966342926,
-0.0432701930403... | |
Just updated build server with rc0 and surprise no chiron. Wondering how you package up a xap file without chiron.
Hey Brian, you can get chiron from <http://www.codeplex.com/sdlsdk> -- it was decided to be removed from the SL SDK core tools, but is still a part of the DLR SDK which is available. | [
0.6674442291259766,
0.05965232104063034,
0.22706067562103271,
0.15654881298542023,
-0.41778990626335144,
-0.46223488450050354,
0.26173344254493713,
0.13011369109153748,
-0.21328559517860413,
-0.5264092683792114,
0.04312874376773834,
0.23460687696933746,
-0.4017390310764313,
0.2519743740558... | |
I am getting very frustrated because I cannot seem to figure out why Collections shuffling is not working properly.
Lets say that I am trying to shuffle the `randomizer` array.
```
int[] randomizer = new int[] {200,300,212,111,6,2332};
Collections.shuffle(Arrays.asList(randomizer));
```
For some reason the elemen... | [
-0.002889796858653426,
-0.32901731133461,
-0.05417661368846893,
0.08169995993375778,
0.013939060270786285,
0.11327781528234482,
0.08415494859218597,
-0.4366697072982788,
-0.5098667740821838,
-0.6888152360916138,
0.0796470120549202,
0.2998504638671875,
-0.5433959364891052,
0.233699813485145... | |
because of the behaviour of the variadic method `asList`: it just makes a one-element list, with the `int` array as its only member. | [
-0.18158958852291107,
-0.04702378064393997,
-0.21586497128009796,
-0.05410907045006752,
-0.24588501453399658,
-0.028764162212610245,
0.18687047064304352,
-0.5178754925727844,
-0.1489027887582779,
-0.182953879237175,
-0.3367234766483307,
0.03107275627553463,
-0.5153161287307739,
0.006442140... | |
What is the difference between the `search()` and `match()` functions in the Python `re` module?
I've read the [Python 2 documentation](https://docs.python.org/2/library/re.html?highlight=matching%20searching#search-vs-match) ([Python 3 documentation](https://docs.python.org/3/library/re.html#search-vs-match)), but I ... | [
0.08518348634243011,
0.09298496693372726,
0.5719953179359436,
-0.31152278184890747,
-0.3129549026489258,
0.0053026108071208,
0.2573043406009674,
-0.2624310553073883,
-0.013223527930676937,
-0.38378357887268066,
-0.052716586738824844,
0.5205554366111755,
-0.40736356377601624,
-0.10748951137... | |
the same as using `^` in the pattern.
As the [re.match documentation](http://docs.python.org/2/library/re.html#re.match) says:
> If zero or more characters at the
> **beginning of string** match the regular expression pattern, return a
> corresponding `MatchObject` instance.
> Return `None` if the string does not
... | [
-0.1448257565498352,
0.011288493871688843,
0.2947065830230713,
-0.19292207062244415,
-0.1061779037117958,
-0.02915467880666256,
0.1860259771347046,
-0.20849207043647766,
0.007169052958488464,
-0.657257616519928,
-0.24466687440872192,
0.4954405128955841,
-0.45112940669059753,
-0.27660664916... | |
return a
> corresponding `MatchObject` instance.
> Return `None` if no position in the
> string matches the pattern; note that
> this is different from finding a
> zero-length match at some point in the
> string.
So if you need to match at the beginning of the string, or to match the entire string use `match`. I... | [
-0.07413748651742935,
-0.08212048560380936,
-0.09897597879171371,
-0.13837836682796478,
-0.18613024055957794,
-0.20645363628864288,
0.13266319036483765,
-0.4480574131011963,
0.009995483793318272,
-0.5481188893318176,
-0.13479475677013397,
0.6967155337333679,
-0.5801936388015747,
-0.3147971... | |
the string,
> while `search` checks for a match
> **anywhere** in the string (this is what
> Perl does by default).
>
>
> Note that `match` may differ from `search`
> even when using a regular expression
> beginning with `'^'`: `'^'` matches only
> at the start of the string, or in
> `MULTILINE` mode also imme... | [
-0.1740470975637436,
-0.21040788292884827,
0.36180421710014343,
-0.083838552236557,
-0.06227314472198486,
-0.27298906445503235,
0.3747696578502655,
-0.2629128098487854,
0.05561333894729614,
-0.588642954826355,
-0.39702633023262024,
0.6205204129219055,
-0.4705287516117096,
-0.16691176593303... | |
a
> newline precedes it.
Now, enough talk. Time to see some example code:
```
# example code:
string_with_newlines = """something
someotherthing"""
import re
print re.match('some', string_with_newlines) # matches
print re.match('someother',
string_with_newlines) # won't match
print re.match('^someo... | [
-0.07012498378753662,
-0.13707862794399261,
0.6021345257759094,
-0.2058763951063156,
-0.05749988928437233,
-0.13090313971042633,
0.30056318640708923,
-0.05880944803357124,
-0.2557213306427002,
-0.7150694727897644,
-0.24583633244037628,
0.39384934306144714,
-0.09055126458406448,
-0.01062133... | |
re.MULTILINE) # also finds something
m = re.compile('thing$', re.MULTILINE)
print m.match(string_with_newlines) # no match
print m.match(string_with_newlines, pos=4) # matches
print m.search(string_with_newlines,
re.MULTILINE) # also matches
``` | [
-0.07819542288780212,
-0.1402483433485031,
0.7992410063743591,
-0.2531289756298065,
0.2532182037830353,
-0.09809015691280365,
0.3341805636882782,
-0.6877304911613464,
-0.25523340702056885,
-0.6650844812393188,
-0.6087266206741333,
0.5733462572097778,
-0.44869348406791687,
0.100539423525333... | |
I need any tool or IDE environment to debug and test the vb scripts code. Please suggest any free ones. My vb scripts are standalone (vbs extenstion).
Sadly not free....[How to debug Windows Script Host, VBScript, and JScript files](http://support.microsoft.com/kb/308364) | [
0.7076787352561951,
0.41914278268814087,
-0.000456133479019627,
0.05498374626040459,
-0.2324569672346115,
-0.46368932723999023,
0.6587141752243042,
0.1070922389626503,
-0.07575330138206482,
-0.4559655785560608,
-0.3457094728946686,
0.2778317332267761,
-0.27227911353111267,
0.38725364208221... | |
My application has no forms. It runs by calling Application.Run();
Call
```
System.Windows.Forms.Application.Exit();
``` | [
0.48623934388160706,
0.33863216638565063,
0.6738545894622803,
-0.18720702826976776,
0.1647024303674698,
-0.04204029589891434,
0.5376641154289246,
-0.019683489575982094,
0.09737855941057205,
-0.8725452423095703,
-0.19182029366493225,
0.34767091274261475,
-0.34289488196372986,
0.221843719482... | |
Has anyone been able to implement the JQuery grid plugin, jqGrid? I'm trying to implement the JSON paging, and I feel like I'm getting close, but that I am also being swamped by inconsequential details. If anyone could post some sample code, I would greatly appreciate it.
Found your post while I was trying to do this f... | [
0.4136471152305603,
-0.08632862567901611,
0.2150416374206543,
0.18388088047504425,
-0.09746947884559631,
-0.2960829734802246,
0.007196888327598572,
0.4234832525253296,
-0.3434876501560211,
-0.8920073509216309,
0.18442542850971222,
0.3034798204898834,
-0.14230307936668396,
-0.27465438842773... | |
section with the following:
```
case "json":
gdata = JSON.stringify(gdata); //ASP.NET expects JSON as a string
$.ajax({ url: ts.p.url,
type: ts.p.mtype,
dataType: "json",
contentType: "application/json; charset=utf-8", //required by ASP.NET
data: gdata,
... | [
-0.07261008024215698,
-0.22516322135925293,
0.41783657670021057,
-0.0843653455376625,
-0.1922159492969513,
-0.030089644715189934,
0.16940104961395264,
0.06973477452993393,
-0.3752973675727844,
-0.44744136929512024,
-0.5089331269264221,
0.5701162815093994,
-0.46597418189048767,
-0.214845448... | |
function(JSON, st) { if (st == "success") { addJSONData(cleanUp(JSON.responseText), ts.grid.bDiv); if (loadComplete) { loadComplete(); } } },
error: function(xhr, st, err) { if (loadError) { loadError(xhr, st, err); } endReq(); },
beforeSend: function(xhr) { if (loadBeforeSend) { loadBeforeS... | [
-0.33265221118927,
-0.33945366740226746,
0.5254898071289062,
-0.2441445142030716,
0.13132141530513763,
0.018471384420990944,
0.47687602043151855,
-0.5043460726737976,
-0.2407587170600891,
-0.3997405171394348,
-0.5709388256072998,
0.74241042137146,
-0.39574500918388367,
-0.01843111030757427... | |
eval
return myObject.d; //ASP.NET special
}
```
You will also need to include the [JSON parser and stringifier](https://github.com/douglascrockford/JSON-js/blob/master/json2.js). Along with working with ASP.NET, this revised code is also [more secure](http://www.json.org/js.html) because the eval statement is go... | [
-0.1559179425239563,
-0.029878389090299606,
0.33989471197128296,
-0.18527108430862427,
-0.3482781946659088,
0.09534408897161484,
0.6500423550605774,
-0.2645929157733917,
-0.47682034969329834,
-0.5353227257728577,
-0.20093898475170135,
0.33937954902648926,
-0.36360087990760803,
-0.167952045... | |
I am trying to learn some of the basic and advanced features of visual studio, Anyone find sites that have this type of information ?
I see this:
<https://stackoverflow.com/questions/86355/best-way-to-learn-visual-studio-power-features>
But it seems more related to tips and advanced features.
All three versions ( 2... | [
0.10090940445661545,
0.13185597956180573,
0.5167287588119507,
-0.2727082669734955,
-0.15666238963603973,
0.05176616832613945,
0.3418889045715332,
-0.20567943155765533,
0.1560089886188507,
-0.5597588419914246,
-0.05484629422426224,
0.8247907161712646,
0.03372962772846222,
-0.192845597863197... | |
or click new to create the entry.
If there is already a `PATH` use semi-colons to seperate each directory listed in it
7. Put `c:\ruby\bin` (change if you installed ruby somewhere else) in.
8. Click OK a lot of times to close all the windows we opened.
9. Restart your command prompt.
`gem` and `ruby` and `irb` shou... | [
0.2674674689769745,
0.08698819577693939,
0.6589400172233582,
-0.14307260513305664,
0.05392824485898018,
-0.06877510249614716,
0.5317546129226685,
-0.028249695897102356,
-0.12010586261749268,
-0.7530667781829834,
-0.23011450469493866,
0.9197088479995728,
-0.0635092481970787,
0.2907585203647... | |
I'm using a lot of JQuery in a web application that I am building for a client and I want to find an javascript implementation of a modal dialog that is reasonably stable across the following browser set.
IE 7+
FF 2+
Chrome and Safari
I've tried a couple of jQuery plugins but there always seems to be artifacts in one... | [
0.5420978665351868,
0.11766142398118973,
0.3238520324230194,
0.04414918273687363,
-0.309287965297699,
-0.4558064639568329,
0.5319076180458069,
0.27921754121780396,
-0.152133509516716,
-0.8125923871994019,
-0.14401504397392273,
0.7351605296134949,
-0.25647875666618347,
-0.06905028969049454,... | |
used [jqModal](http://dev.iceburg.net/jquery/jqModal/) few times and I'm very satisfied. It is pretty configurable yet very light weight. | [
0.022620663046836853,
0.1817150115966797,
0.22122196853160858,
0.05902794748544693,
-0.08656422048807144,
-0.10662815719842911,
0.2797406017780304,
0.4414978325366974,
-0.22899961471557617,
-0.472553551197052,
0.25228291749954224,
-0.005038878880441189,
0.2630695402622223,
0.01281839609146... | |
I have a tree of active record objects, something like:
```
class Part < ActiveRecord::Base
has_many :sub_parts, :class_name => "Part"
def complicated_calculation
if sub_parts.size > 0
return self.sub_parts.inject(0){ |sum, current| sum + current.complicated_calculation }
else
sleep(1)
r... | [
0.1770327091217041,
0.1725837141275406,
0.17861968278884888,
-0.09183192253112793,
0.2346542328596115,
-0.012896350584924221,
0.4266008734703064,
-0.4836168587207794,
-0.27035897970199585,
-0.6625028848648071,
0.19115664064884186,
0.5845083594322205,
-0.14580008387565613,
0.390198290348053... | |
parent, and grandparent, etc.
As a rough draft, I created a column to hold the cached calculation in the "parts" table, but this smells a little rotten. It seems like there should be a cleaner way to cache the calculated values without stuffing them along side the "real" columns.
1. You can stuff the actually cached v... | [
-0.005087070167064667,
-0.19215866923332214,
-0.09817826747894287,
0.24986495077610016,
0.274017870426178,
-0.31020501255989075,
0.4615260064601898,
0.0114047322422266,
-0.22570760548114777,
-0.5880389213562012,
-0.040737222880125046,
0.05760563164949417,
0.011926574632525444,
0.1894695311... | |
I added some ActiveRecord magic to your class to make getting the parent objects simplicity itself -- and you don't even need to touch your database. Remember to call `Part.sweep_complicated_cache(some_part)` as appropriate in your code -- you can put this in callbacks, etc, but I can't add it for you because I don't u... | [
-0.18037432432174683,
-0.2404944896697998,
0.41235649585723877,
0.134396493434906,
0.06514112651348114,
-0.022447865456342697,
0.41550305485725403,
-0.3591237962245941,
-0.12302649766206741,
-0.484566867351532,
-0.013237740844488144,
0.35909825563430786,
-0.4350789785385132,
0.116441659629... | |
cache[ [id, :complicated_calculation] ]
else
cache[ [id, :complicated_calculation] ] = complicated_calculation_helper (...)
end
end
def complicated_calculation_helper
#your implementation goes here
end
def Part.sweep_complicated_cache(start_part)
level = 1 # keep track to prevent infini... | [
-0.06190211698412895,
-0.03557303920388222,
0.5692534446716309,
0.0004900690983049572,
0.23549197614192963,
-0.239861860871315,
0.5152076482772827,
-0.4373379051685333,
-0.6108772158622742,
-0.3459742069244385,
0.2156992256641388,
0.21023300290107727,
-0.4034355580806732,
0.298686653375625... | |
cache[ [current_part.id, :complicated_calculation] ].delete
end
end
end
``` | [
-0.47707366943359375,
0.10459283739328384,
0.23861612379550934,
0.16323405504226685,
0.2292618602514267,
0.019344523549079895,
0.5804274082183838,
0.03962284326553345,
0.1920047253370285,
-0.4143375754356384,
-0.22542734444141388,
0.1138337180018425,
-0.09919586777687073,
0.651236057281494... | |
I wanted to do something like this:
```
<asp:Label ID="lblMyLabel" onclick="lblMyLabel_Click" runat="server">My Label</asp:Label>
```
I know that in Javascript I can do:
```
<span onclick="foo();">My Label</span>
```
So I'm wondering why I can't do that with a Label object.
You can use Attributes to add onclick c... | [
0.2793588936328888,
-0.0710657462477684,
0.31864503026008606,
-0.10743869096040726,
-0.33227458596229553,
-0.3286304771900177,
0.2204400599002838,
-0.281607061624527,
-0.2825357913970947,
-0.7420523762702942,
0.18049316108226776,
0.7593380212783813,
-0.4132997989654541,
-0.0209316182881593... | |
make it not look like a link by using CSS, if it is just that underline you are concerned about.
ASPX:
```
<asp:LinkButton ID="LinkButton1" runat="server"
CssClass="imjusttext" OnClick="LinkButton1_Click">
LinkButton
</asp:LinkButton>
```
CSS:
```
a.imjusttext{ color: #000000; text-decoration: none; }
a.imju... | [
0.023589862510561943,
-0.03868536278605461,
0.5387940406799316,
-0.16166402399539948,
-0.03693360090255737,
0.14918844401836395,
0.486865758895874,
-0.15411022305488586,
-0.362642765045166,
-0.6405773758888245,
-0.38278815150260925,
0.14053338766098022,
-0.5625503659248352,
-0.002720446558... | |
Is a new (or different) instance of `TestCase` object is used to run each test method in a JUnit test case? Or one instance is reused for all the tests?
```
public class MyTest extends TestCase {
public void testSomething() { ... }
public void testSomethingElse() { ... }
}
```
While running this test, how many i... | [
0.5314462780952454,
0.17647449672222137,
0.008883981965482235,
-0.06557976454496384,
-0.1200859397649765,
0.055959682911634445,
0.28205353021621704,
-0.3489021956920624,
0.06034283712506294,
-0.4829102158546448,
-0.04204175993800163,
0.4929448664188385,
-0.3860523998737335,
0.0825203061103... | |
of the others, so a new TestCase instance could be created for each test to be run.
If you have expensive test setup ("*fixtures*") that you want to be shared across all test cases in a test class, you can use the **@BeforeClass** annotation on a static method to achieve this result: <http://junit.sourceforge.net/java... | [
0.4662584066390991,
-0.11594819277524948,
-0.02149469405412674,
0.1394631713628769,
-0.06341974437236786,
-0.0001671033096499741,
0.23834648728370667,
-0.21897947788238525,
-0.09492649137973785,
-0.8526710867881775,
0.12960782647132874,
0.40293970704078674,
-0.1780509501695633,
0.212490364... | |
i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al.
I am researching this for a client and for an article, and i think my google-fu is not strong tonight. Any suggestions?
... | [
0.22957272827625275,
0.028370985761284828,
0.35543152689933777,
0.17771127820014954,
-0.20340755581855774,
0.08262384682893753,
0.33707377314567566,
0.15797577798366547,
-0.3058221936225891,
-0.9924877882003784,
0.07275772839784622,
0.3720749616622925,
-0.0999787300825119,
-0.0554100610315... | |
it out. Here is a solution that seems to work. It could be improved using user controls but this is the gist of it:
```
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow &&
(e.Row.RowState & DataControlRowState.Selected) > 0)
... | [
-0.014173642732203007,
-0.2424807995557785,
0.5576332807540894,
-0.26452726125717163,
0.2420051395893097,
0.07755832374095917,
0.21413274109363556,
-0.22784844040870667,
-0.10682438313961029,
-0.5642735958099365,
-0.32388636469841003,
0.40619152784347534,
-0.41714170575141907,
0.4193938076... | |
TableCell tc = new TableCell();
tc.ColumnSpan = GridView1.Columns.Count;
tc.Controls.Add(
makeChildGrid(Convert.ToInt32(
((DataRowView)e.Row.DataItem)["ROW_ID_FIELD"])));
tr.Cells.Add(tc);
tbl.Rows.Add(tr);
}
}
protected GridView makeChildGrid(int id)
{
... | [
0.010329130105674267,
-0.2494768649339676,
0.799839973449707,
0.09779480844736099,
-0.08894189447164536,
0.04520303010940552,
0.22197164595127106,
-0.4264409840106964,
-0.22706077992916107,
-0.589097261428833,
-0.12276198714971542,
0.5538773536682129,
-0.2565811276435852,
0.401931107044219... | |
= SqlDataSource1.ConnectionString;
sqlds.SelectCommand = "SELECT * from MY_TABLE_NAME " +
"WHERE KEY_FIELD = " + id.ToString();
DataView dv = (DataView)sqlds.Select(DataSourceSelectArguments.Empty);
gv.DataSource = dv;
gv.DataBind(); //not sure this is necessary...?
return gv;
}
``` | [
-0.09544380009174347,
-0.17415745556354523,
0.5394028425216675,
-0.1754019409418106,
0.08364588767290115,
-0.04611120745539665,
0.23714467883110046,
-0.20860955119132996,
-0.3562006652355194,
-0.4422815144062042,
-0.3298267126083374,
0.5995762348175049,
-0.2469835877418518,
0.3323411047458... | |
I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts. I'm using php, and at the moment this little snippet is responsible for generating the UID:
```
$id = tempnam (".", "");
unlink($id);
$id = substr($id, 2);
```
This code is hideous: it creates a temporary fil... | [
0.3024040162563324,
0.23623372614383698,
0.40124785900115967,
0.02499999850988388,
-0.3239480257034302,
-0.0803382471203804,
0.1545269936323166,
0.07699436694383621,
-0.1353147178888321,
-0.7493090033531189,
0.01588113233447075,
0.16056419909000397,
-0.20657506585121155,
0.3929642140865326... | |
microseconds.
```
USAGE: $id = uniqid(rand(), true);
``` | [
0.07109127938747406,
-0.12503519654273987,
0.15887916088104248,
0.09416846185922623,
0.2856970727443695,
-0.02616695873439312,
-0.053548943251371384,
-0.30756261944770813,
0.27203312516212463,
-0.6423035860061646,
0.040165580809116364,
0.6282823085784912,
-0.11543174088001251,
0.1976563334... | |
I was wondering if you know somewhere where I can find information on how to build a signature file for docuement retrieval.
Do you know if there is some code out there that I can use or look at?
I have to create a signature file in C++ under linux platform.
**UPDATE: Sorry, I appreciatte the help but I was r... | [
0.41605663299560547,
-0.10169407725334167,
0.08460965752601624,
0.1689356565475464,
-0.007709037512540817,
-0.4262302815914154,
0.2190835028886795,
0.41327881813049316,
-0.3595421612262726,
-0.7402189373970032,
0.07159879803657532,
0.4513261914253235,
0.16410550475120544,
0.091968208551406... | |
Trying to create my first iPhone app that would play back audio. When I try to set up playback, messages like these appear in gdb:
> =shlibs-removed,shlib-info=[num="54",name="AudioIPCPlugIn",kind="B",dyld-addr="0x2c2000",reason="dyld",requested-state="E",state="E",path="/System/Library/Extensions/AudioIPCDriver.kext/... | [
-0.1444563865661621,
0.1619209349155426,
0.5236014127731323,
-0.060143884271383286,
-0.14619281888008118,
0.18110638856887817,
0.42898130416870117,
-0.31906792521476746,
-0.014424862340092659,
-0.42432260513305664,
-0.3409740626811981,
0.5450870990753174,
-0.7006741762161255,
0.14384499192... | |
destructing (ie, unloading bundles, etc.) when you try to shut down your app's connection to CoreAudio. | [
0.4270279109477997,
-0.5490092039108276,
0.049307726323604584,
0.4566163420677185,
0.014441562816500664,
-0.311236709356308,
0.7806949615478516,
-0.15209855139255524,
-0.0865645483136177,
-0.897914469242096,
-0.7122804522514343,
0.7286202907562256,
-0.49490851163864136,
0.1496042013168335,... | |
In VB.NET I often `Catch…When`:
```
Try
…
Catch e As ArgumentNullException When e.ParamName.ToUpper() = "SAMPLES"
…
End Try
```
Is there a C# equivalent to `Catch…When`?
I don't want to resort to using an `if` statement inside a `catch` if possible.
This functionality was announced for C# 6. It is now possi... | [
0.43737003207206726,
-0.3112969398498535,
0.4475473463535309,
-0.1045319139957428,
-0.39678171277046204,
-0.12233512103557587,
0.13946059346199036,
-0.0716949999332428,
-0.149464949965477,
-0.44642114639282227,
-0.25012582540512085,
0.6613115668296814,
-0.269957959651947,
0.066740714013576... | |
Let me preface this by saying I'm a complete amateur when it comes to RegEx and only started a few days ago. I'm trying to solve a problem formatting a file and have hit a hitch with a particular type of data. The input file is structured like this:
```
Two words,Word,Word,Word,"Number, number"
```
What I need to d... | [
0.25521326065063477,
0.18143562972545624,
0.35732629895210266,
-0.025790497660636902,
-0.20459185540676117,
-0.1247599795460701,
0.0632791519165039,
-0.044864755123853683,
-0.00667948555201292,
-0.6879744529724121,
0.06087097153067589,
0.6514853835105896,
-0.3358730375766754,
0.11063848435... | |
replace a comma with "," [quote comma quote], but only when that comma isn't followed by a space. Note that the other fields will never have a space following the comma, only the delimited number list.
I managed to write up
```
s/,[A-Za-z0-9]/","/g
```
which, while matching the appropriate strings, would replace the... | [
0.07953668385744095,
-0.030937381088733673,
0.32385703921318054,
-0.024620654061436653,
0.025961823761463165,
0.19920916855335236,
0.04881537705659866,
-0.08051752299070358,
-0.11296147108078003,
-0.4244888722896576,
-0.5515968203544617,
0.4847598969936371,
-0.37646806240081787,
-0.2021275... | |
on which regex engine you're using, you might be writing `\1` or other things instead of `$1`.
If you're using Perl or otherwise have access to a regex engine with negative lookahead, `s/,(?! )/","/` (a "`,`" not followed by a space) works.
Your input looks like CSV, though, and if it actually is, you'd be better off... | [
-0.08229770511388779,
-0.030156755819916725,
0.2071988880634308,
0.26885876059532166,
-0.12050008028745651,
-0.0053157685324549675,
0.02817690558731556,
0.2392686903476715,
-0.21150769293308258,
-0.5899108648300171,
-0.06298890709877014,
0.6319600343704224,
-0.3665362000465393,
-0.22893086... | |
I have a function that looks like this
```
class NSNode {
function insertAfter(NSNode $node) {
...
}
}
```
I'd like to be able to use that function to indicate that the node is being inserted at the start, therefore it is after *nothing*. The way I think about that is that `null` means "nothing", so ... | [
-0.17286907136440277,
-0.001407032716087997,
0.08478617668151855,
-0.2406747192144394,
0.1436612904071808,
-0.19440191984176636,
0.15830443799495697,
0.34344756603240967,
-0.26838311553001404,
-0.5662405490875244,
-0.06893160194158554,
0.3763091564178467,
-0.33947354555130005,
0.3031231760... | |
to be able to specify a null-esque value.
So, short of changing it to `function insertAfter($node) { }`, is there a way I can pass something else to that function?
---
Update: I've accepted Owen's answer because it answered the question itself. Everyone else's suggestions were really good and I'll actually be implem... | [
-0.04725497215986252,
0.12027193605899811,
0.1550501585006714,
-0.23223872482776642,
0.1258118450641632,
-0.050818249583244324,
0.415155291557312,
-0.05297878384590149,
-0.2086653858423233,
-0.6724473834037781,
-0.09073089063167572,
0.5612114071846008,
-0.4723109006881714,
-0.1630526185035... | |
I have an asp.net text form that contains numerous decimal fields that are optional. I want to selectively update the database but not inserting a "0" for fields that do not have data (maintaining the null status).
Typically, I would create multiple functions, each with a different signature to handle this. However, ... | [
0.204664409160614,
0.11960087716579437,
0.0885554626584053,
0.22057676315307617,
0.002341943560168147,
-0.052790042012929916,
0.14898915588855743,
0.0022899394389241934,
-0.2766571044921875,
-0.428945392370224,
-0.07438452541828156,
0.08868454396724701,
-0.2626856565475464,
0.0689963921904... | |
the possibility of having no data in them. Presence of value can be checked using HasValue property of these types.
Pseudo code to read the fields:
```
decimal? dValue; // default value is null
if(decimalValueExists)
{
dValue = <value read from text file>
}
```
When you say multiple methods - I assume these are... | [
0.053331341594457626,
0.06959225982427597,
-0.02856529876589775,
0.09374016523361206,
0.03124801069498062,
0.08552630245685577,
0.24022234976291656,
-0.2079276591539383,
-0.2271401435136795,
-0.32483741641044617,
-0.2561674118041992,
0.5669246315956116,
-0.31088605523109436,
-0.14349265396... | |
optional field 1
}
```
Then define the web service method to use it:
```
[WebMethod]
void MyWSMethod(MyFields myFields)
{/* code here will ultimately call InsertMyFields */}
void InsertMyFields(MyFields myFields)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
// Create ... | [
-0.013181786052882671,
-0.186205193400383,
0.4825052320957184,
-0.15469151735305786,
0.30348294973373413,
-0.12788209319114685,
-0.028156086802482605,
-0.16380324959754944,
-0.009726710617542267,
-0.6794803142547607,
-0.4795439839363098,
0.5647068023681641,
-0.33333829045295715,
0.07637181... | |
// Add the required input parameter
SqlParameter parameter1 = new SqlParameter();
parameter1.ParameterName = "@ReqField1";
parameter1.SqlDbType = SqlDbType.NVarChar;
parameter1.Direction = ParameterDirection.Input;
parameter1.Value = myFields.req1;
// Add the parameter t... | [
-0.09938232600688934,
-0.19016942381858826,
0.6955522894859314,
0.010830933228135109,
-0.005160453729331493,
0.26913687586784363,
-0.0740055963397026,
-0.41281476616859436,
-0.08722108602523804,
-0.3222562372684479,
-0.09883122891187668,
0.5679376721382141,
-0.1464037299156189,
0.061748877... | |
SqlParameter parameter2 = new SqlParameter();
parameter2.ParameterName = "@OptField1";
parameter2.SqlDbType = SqlDbType.NVarChar;
parameter2.Direction = ParameterDirection.Input;
parameter2.Value = myFields.opt1 ?? DBNull.Value; //null coalescing operator
// Add the parameter to... | [
-0.21063783764839172,
-0.1698198765516281,
0.6825261116027832,
-0.06005465239286423,
-0.12184274196624756,
0.2397865653038025,
0.23873615264892578,
-0.39160698652267456,
-0.027211060747504234,
-0.2620096802711487,
-0.005860156379640102,
0.4371974468231201,
-0.38329339027404785,
0.262737900... | |
has a value, [Null Coalescing Operator](http://msdn.microsoft.com/en-us/library/ms173224(VS.80).aspx) will set the value or else it will set the other value that you specify (DBNull.Value in our case). | [
-0.01233609952032566,
-0.2267046421766281,
0.06073411554098129,
-0.009069508872926235,
0.14067663252353668,
-0.15818911790847778,
0.3608822524547577,
-0.1037331148982048,
-0.01992846466600895,
-0.34592944383621216,
-0.5413364768028259,
0.12497296184301376,
-0.3275166153907776,
0.3255644738... | |
Implementing a file upload under html is fairly simple, but I just noticed that there is an 'accept' attribute that can be added to the `<input type="file" ...>` tag.
Is this attribute useful as a way of limiting file uploads to images, etc? What is the best way to use it?
Alternatively, is there a way to limit file ... | [
0.2996661365032196,
-0.10333272814750671,
0.3985767960548401,
0.01686907932162285,
-0.21736617386341095,
-0.48758941888809204,
0.24674198031425476,
-0.15728530287742615,
-0.30477696657180786,
-0.4879322648048401,
-0.23081129789352417,
0.6069673895835876,
-0.4023507535457611,
-0.23663400113... | |
helps narrow down the results for users by default, so they can get exactly what they're looking for without having to sift through a hundred different file types.
Usage
=====
***Note:*** These examples were written based on the current specification and may not actually work in all (or any) browsers. The specificati... | [
-0.09861169010400772,
0.09214848279953003,
1.1123851537704468,
0.19001996517181396,
0.06402840465307236,
-0.19368499517440796,
-0.18196219205856323,
-0.6180775165557861,
-0.3682261109352112,
-0.808036744594574,
-0.1019161194562912,
0.4542240798473358,
-0.039688922464847565,
-0.187770903110... | |
(image/*) and files with the extension ".someext"</h1>
<p><label>.someext,image/* <input type="file" accept=".someext,image/*"></label></p>
<h1>Match all image files (image/*) and video files (video/*)</h1>
<p><label>image/*,video/* <input type="file" accept="image/*,video/*"></label></p>
```
From the HTML Specifi... | [
0.24797968566417694,
0.12885111570358276,
0.6418480277061462,
0.029951810836791992,
-0.06566490978002548,
0.2138720154762268,
-0.1043998971581459,
-0.7104354500770569,
-0.06290588527917862,
-0.509617269039154,
-0.29333990812301636,
0.8760111331939697,
0.030342429876327515,
-0.0997466742992... | |
> * Indicates that video files are accepted.
>
>
> ### The string `image/*`
>
>
> * Indicates that image files are accepted.
>
>
> ### A [valid MIME type with no parameters](http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#valid-mime-type-with-no-parameters)
>
>
> * Indicates that... | [
0.33660799264907837,
0.08459345251321793,
0.7682948112487793,
-0.07895511388778687,
0.009684302844107151,
-0.07686891406774521,
0.32643648982048035,
-0.4477327764034271,
0.0018436418613418937,
-0.4572218358516693,
-0.6546904444694519,
0.383639395236969,
-0.3132522702217102,
0.2051732838153... | |
I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action and referring controller but that becomes p... | [
0.21736249327659607,
0.17710912227630615,
0.5508145093917847,
-0.03989504650235176,
0.038988951593637466,
-0.13870017230510712,
0.44819512963294983,
-0.04907601699233055,
-0.3548184335231781,
-0.6097170114517212,
-0.10995960980653763,
0.308683305978775,
-0.11773212254047394,
0.312489032745... | |
form's action attribute should have the same ReturnUrl parameter (either as hidden input or as part of Url) so that FormsAuthentication can pick it up and redirect, e.g.
```
<form action="Login?ReturnUrl=<%=Html.AttributeEncode(Request.QueryString["ReturnUrl"]) %>"></form>
```
or
```
<form><input type="hidden" nam... | [
-0.05300471931695938,
-0.485469788312912,
0.7741806507110596,
-0.2993912994861603,
-0.24644163250923157,
-0.16331659257411957,
0.16251066327095032,
-0.5498769283294678,
-0.0032808484975248575,
-0.44132423400878906,
-0.5006089806556702,
0.3415486514568329,
-0.42403802275657654,
-0.261055946... | |
I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to regenerating the data layer?
I've run into... | [
0.3798367381095886,
0.0668720081448555,
0.09537506103515625,
-0.003882001154124737,
-0.016201339662075043,
-0.12522871792316437,
-0.02584969438612461,
0.2234085202217102,
-0.3548905849456787,
-0.6032003164291382,
0.2871248722076416,
0.4451374411582947,
-0.2796767055988312,
0.36948627233505... | |
Linq to SQL classes, but what is even slicker solution is to use Visual Studio's Tools->External Tools function to create a command in Visual Studio that runs sqlmetal with your parameters. This works great and you can even drop the created command onto your toolbar for single-click rebuilding. | [
0.27229759097099304,
-0.020739538595080376,
0.2830221951007843,
0.43983194231987,
-0.14805246889591217,
-0.24555769562721252,
0.04176652058959007,
-0.15495342016220093,
-0.07367822527885437,
-0.3621450364589691,
0.3267568349838257,
0.7820178270339966,
0.08761629462242126,
-0.08910962194204... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.