text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
is it working without ";" terminators at the end of my statements?
Thank you,
May be this will be of help,
<http://www.uc.edu/R/r25/documentation/Version3.2/install_instructions.pdf>:
> The scripts use a semi-colon (;) to terminate each SQL
> command. If you use the DB2 Command Line Processor,
> you should rem... | [
0.22799432277679443,
0.1665622442960739,
0.282802015542984,
-0.2157212793827057,
0.18827864527702332,
-0.13391031324863434,
0.48661839962005615,
-0.17198048532009125,
0.049212247133255005,
-0.41207149624824524,
-0.14080147445201874,
0.6598471999168396,
-0.26236310601234436,
-0.061507210135... | |
command was processed as an SQL statement because it was not a
>
> valid Command Line Processor command. During SQL processing it returned:
>
> SQL0104N An unexpected token “(“ was found following “ate table “ACCOUNTS””.
>
> Expected tokens may include: “END-OF-STATEMENT”. SQLSTATE=42601
So, I would add se... | [
-0.1476116180419922,
-0.17596983909606934,
0.18119113147258759,
0.04890879988670349,
-0.1451563537120819,
0.3227134644985199,
0.2629571557044983,
-0.16493810713291168,
-0.20497380197048187,
-0.4122025668621063,
-0.0557590015232563,
0.5564742684364319,
-0.07044148445129395,
-0.0699182748794... | |
I was wondering if there is an existing control that I could use to achieve what I am trying.
Basically, I have a html table that I display my header information.
It looks something like this:
```
<table class="tableEdit">
<tr>
<th>Job ID</th><td>10</td>
<th>Client</th><td>Tom</td>
</tr>
... | [
0.22518432140350342,
0.11764415353536606,
0.5006629228591919,
0.3577284812927246,
0.03216087445616722,
0.23436176776885986,
-0.3677296042442322,
-0.12812767922878265,
-0.3174278736114502,
-0.6394858360290527,
0.1488923877477646,
0.2615838050842285,
-0.2099073827266693,
0.001000872347503900... | |
datasource to that control
and leverage the field values as such.
```
<asp:Somecontrol runat="server" ID="someid">
<table class="tableEdit">
<tr>
<th>Job ID</th><td><%# Eval("Id") %></td>
<th>Client</th><td><%# Eval("Client.Name") %></td>
</tr>
<tr>
<th>Comments</th><td><%# Eval("C... | [
-0.0563020221889019,
-0.1996815949678421,
0.42901432514190674,
0.08252198994159698,
0.031404249370098114,
-0.07847315073013306,
0.05929587036371231,
-0.2663484811782837,
-0.22554193437099457,
-0.44729557633399963,
-0.05446069687604904,
0.5346134901046753,
-0.22142420709133148,
-0.074027515... | |
control.
I had never used this control previously, but this is the exact control for what i wanted to do.
It allows to to mark a region, assign a datasource and bind items as desired.
```
<asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource2" Visible="false">
<ItemTemplat... | [
-0.1714426726102829,
-0.48085275292396545,
0.6306760907173157,
0.2442055195569992,
-0.004012873861938715,
-0.2742912471294403,
-0.14144577085971832,
-0.25379133224487305,
-0.31451958417892456,
-0.6560617685317993,
-0.016833413392305374,
0.06727761030197144,
-0.30808061361312866,
0.40507218... | |
<tr>
<td>ClientId</td>
<td><asp:Label ID="ClientId" runat="server" Text='<%# Eval("ClientId") %>' /></td> | [
-0.23107099533081055,
-0.35476553440093994,
0.37844139337539673,
-0.13542142510414124,
-0.17407850921154022,
0.3385557532310486,
0.05050409585237503,
-0.5826556086540222,
-0.291584312915802,
-0.358296275138855,
-0.3628365099430084,
0.33644720911979675,
-0.14000624418258667,
-0.041329026222... | |
</tr>
<tr>
<td>ClientCode</td> | [
0.18946628272533417,
-0.13425275683403015,
-0.013733075000345707,
-0.052231576293706894,
-0.09288038313388824,
0.05457622557878494,
0.09306919574737549,
-0.2923331558704376,
-0.05796226114034653,
-0.47512125968933105,
-0.3997586965560913,
0.29238569736480713,
-0.1844160407781601,
-0.072503... | |
<td><asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("ClientCode") %>' /></td>
</tr>
<tr>
<td>Name</td> | [
0.03805381804704666,
-0.21535098552703857,
0.23060283064842224,
-0.2450423389673233,
-0.22697347402572632,
0.3362828195095062,
0.20955118536949158,
-0.37135958671569824,
-0.17729586362838745,
-0.24013425409793854,
-0.29483887553215027,
0.3588196635246277,
-0.2632485628128052,
0.03188887983... | |
<td><asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("Name") %>' /></td>
</tr>
<tr> | [
-0.04952825978398323,
-0.27525055408477783,
0.25254005193710327,
-0.16662149131298065,
-0.17246536910533905,
0.41543683409690857,
0.2618950605392456,
-0.4504340887069702,
-0.3080562353134155,
-0.18387234210968018,
-0.37957000732421875,
0.3621748685836792,
-0.17598170042037964,
-0.114850386... | |
<td>BillingContactName</td>
<td><asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval("BillingContactName") %>' /></td>
</tr>
```
Thanks AI W for your input. Repeater is also suitable | [
0.4177509546279907,
-0.3821280002593994,
0.4739919602870941,
-0.008837869390845299,
-0.21798163652420044,
0.2286936491727829,
0.3479330241680145,
-0.5464236736297607,
-0.013649063184857368,
-0.5490189790725708,
0.09964489936828613,
0.7060564756393433,
-0.1491517424583435,
0.146738499402999... | |
but for binding "a" record, FormView is ideal i think. Thanks. | [
0.4602605700492859,
0.26115086674690247,
0.284633606672287,
0.3538963496685028,
0.10166901350021362,
-0.44704470038414,
0.30859366059303284,
-0.03902428597211838,
-0.1601046472787857,
-0.26106664538383484,
0.5346530079841614,
0.37698036432266235,
0.029824532568454742,
0.0369710773229599,
... | |
What behavior have you had to implement in your Rails applications that you feel could exist nicely as a plugin?
What plugin functionality have you searched for in the past but couldn't find?
What existing Rails plugins could be improved or extended, and how?
I'd like to see an engines plugin that dropped in an admin... | [
0.19348932802677155,
-0.18357795476913452,
-0.07550462335348129,
0.4027746319770813,
0.0000664365288685076,
0.15574996173381805,
0.19070523977279663,
0.053287629038095474,
-0.25357773900032043,
-0.5317042469978333,
0.24932299554347992,
0.766004204750061,
-0.07122604548931122,
-0.1376884430... | |
I'm trying to use LINQ to return a list of ids given a list of objects where the id is a property. I'd like to be able to do this without looping through each object and pulling out the unique ids that I find.
I have a list of objects of type MyClass and one of the properties of this class is an ID.
```
public class ... | [
0.18818451464176178,
0.1995895653963089,
0.2026343047618866,
0.16558173298835754,
0.08032198250293732,
-0.041796620935201645,
-0.07474267482757568,
-0.15091930329799652,
0.0015656325267627835,
-0.7671752572059631,
0.06500893086194992,
0.4678044021129608,
-0.20126277208328247,
0.30990368127... | |
of the ids?
I'm sure it must be possible to do it in one or two lines using LINQ rather than looping through each item in the MyClass list and adding the unique values into a list.
```
IEnumerable<int> ids = list.Select(x=>x.ID).Distinct();
``` | [
0.18402038514614105,
0.19395184516906738,
0.2520217001438141,
-0.02908666431903839,
0.05582696199417114,
-0.09000144153833389,
0.03604565188288689,
-0.32577624917030334,
-0.05449949949979782,
-0.5720964074134827,
-0.04091086983680725,
0.4271881580352783,
-0.2434729039669037,
0.152632802724... | |
I am trying to write a custom code generator that can parse stored procedures. I wrote a few regex, but they don't seem to work all the time. I do have access to the database; does a system query exist that will return the required parameters and possible return values? I have played around with sp\_depends, but it doe... | [
0.3879101276397705,
0.18841543793678284,
0.2599261701107025,
0.2338521033525467,
0.2212066650390625,
0.04831210896372795,
0.2714921236038208,
-0.2638325095176697,
-0.4265977740287781,
-0.33549538254737854,
0.31936413049697876,
0.6386509537696838,
-0.2696399688720703,
-0.015584265813231468,... | |
syscolumns against the object\_id of the proc). Or the [info-schemas](http://msdn.microsoft.com/en-us/library/aa933216(SQL.80).aspx).
However, results are tricker, since SPs don't have very formalilsed output. UDFs have much stronger metadata. The best you can do with an SP (and it is still hit'n'miss) is SET FMT\_ONL... | [
-0.04984172806143761,
-0.35004594922065735,
0.7688726782798767,
0.07387524098157883,
0.20992249250411987,
-0.2060779631137848,
0.09681756049394608,
-0.30554288625717163,
-0.5884804129600525,
-0.26029762625694275,
-0.5215552449226379,
0.5573806166648865,
-0.40608760714530945,
-0.23063117265... | |
I have PHP, IIS7, ReWrite Module for IIS and Zend all installed.
I can execute PHP pages just fine, even got PHPINFO showing up.
I setup a Zend quickstart app on IIS and when I open it this is what I see:
You can see from the source that it's not executing the <= portions.
Any idea what needs to change?
[alt text ... | [
0.33277982473373413,
0.08535170555114746,
0.34983375668525696,
-0.15092068910598755,
-0.1873573511838913,
-0.19347235560417175,
0.32272616028785706,
-0.06453452259302139,
-0.1343299299478531,
-0.645439088344574,
0.05500694364309311,
0.452900767326355,
-0.28510987758636475,
-0.0111451614648... | |
of time typing but may actually be worse in the long run. | [
0.2264796644449234,
0.19509992003440857,
0.06603897362947464,
0.07188825309276581,
0.17912615835666656,
-0.08767527341842651,
0.1700136810541153,
0.2695789337158203,
-0.16578872501850128,
-0.7269353270530701,
0.19206884503364563,
0.6297386884689331,
-0.03035619854927063,
-0.189695090055465... | |
I have a WPF window which I am creating from another window by calling `Show()`, then letting it `Close()` itself. When the window closes, I expect it to die, call its destructor, and delete all its child elements (such as timers..).
What is the correct way of invoking such an action?
`Close()` releases all unmanaged ... | [
0.3638407588005066,
0.000029145017833798192,
0.5963245034217834,
-0.31769824028015137,
0.07147234678268433,
-0.10590627044439316,
0.25903159379959106,
-0.5514165163040161,
-0.3109278082847595,
-0.5815948843955994,
-0.2951977550983429,
0.14421573281288147,
-0.2567363679409027,
0.38179457187... | |
How can I trace MySQL queries on my Linux server as they happen?
For example I'd love to set up some sort of listener, then request a web page and view all of the queries the engine executed, or just view all of the queries being run on a production server. How can I do this?
You can run the MySQL command `SHOW FULL P... | [
0.6789385676383972,
0.1340218037366867,
0.21091414988040924,
0.23718298971652985,
-0.026317564770579338,
-0.10371948778629303,
0.19380317628383636,
-0.10881173610687256,
-0.40924370288848877,
-0.4899529814720154,
0.2915132939815521,
0.7267622351646423,
-0.153647318482399,
0.145610556006431... | |
through triggers. You could set up triggers so that every query run results in the query being inserted into some sort of history table, and then create a separate page to access this information.
Do be aware that this will probably considerably slow down everything on the server though, with adding an extra `INSERT` ... | [
0.7082605957984924,
-0.21001461148262024,
0.11866465210914612,
0.32179898023605347,
-0.10593879222869873,
-0.2898789942264557,
0.15661561489105225,
-0.13929598033428192,
-0.5515050292015076,
-0.5223985314369202,
-0.09924440830945969,
0.30510878562927246,
-0.13279904425144196,
0.00048001430... | |
though, enabling the GQL and then using running `tail -f` on the logfile would do the trick. | [
-0.04111947491765022,
-0.1806277483701706,
0.5324782729148865,
0.12889622151851654,
-0.015150101855397224,
-0.5202160477638245,
0.20469333231449127,
0.1288413554430008,
-0.009128977544605732,
-0.16232572495937347,
-0.14125941693782806,
0.4930981397628784,
-0.3244614601135254,
-0.0496806167... | |
Say you got an old codebase that you need to maintain and it's clearly not compliant with current standards. How would you distribute your efforts to keep the codebase backwards compatible while gaining standards compliance? What is important to you?
At my workplace we don't get any time to refactor things just because... | [
1.0221294164657593,
0.5129907727241516,
0.21576160192489624,
-0.056684475392103195,
0.007629910949617624,
-0.2306940108537674,
0.29179438948631287,
0.014121796004474163,
-0.28475654125213623,
-0.44732773303985596,
0.07577979564666748,
0.4788435399532318,
-0.03931652009487152,
0.52277743816... | |
to understand the code to make the change in the first place, that's the best time to make other changes.
Also this is a good time to add missing unit tests, for your change and the existing code.
I always do the refactoring first and then make my changes, so that way I'm much more confident my changes didn't break ... | [
0.509107232093811,
0.22876675426959991,
0.1403193473815918,
0.2110327184200287,
0.04996400326490402,
-0.027286218479275703,
0.3591853678226471,
-0.040916331112384796,
-0.212804913520813,
-0.39907610416412354,
-0.043419498950242996,
0.792891263961792,
0.009975793771445751,
-0.00243407487869... | |
designs:
----------------------------
I guess there are tons of books about this, but here's what helped me the most:
I build [facades](http://en.wikipedia.org/wiki/Facade_pattern):
1. Facades with a new good design which "quarantine" the existing bad code. I use this if I have to write new code and I have to reuse ... | [
0.7699026465415955,
0.42590978741645813,
0.14471317827701569,
-0.11198585480451584,
0.21261435747146606,
0.1942407339811325,
0.5239090323448181,
-0.056508682668209076,
-0.317973256111145,
-0.9709613919258118,
0.05955132469534874,
0.4488005042076111,
-0.2875250577926636,
0.21608921885490417... | |
dependencies and cascading effects. | [
0.11778870970010757,
0.05187509208917618,
0.5448856353759766,
0.2249774932861328,
0.07794000208377838,
0.047977447509765625,
0.11325003206729889,
0.020098045468330383,
-0.07124585658311844,
-0.6271112561225891,
-0.165126770734787,
0.5179688930511475,
-0.12246418744325638,
0.010836869478225... | |
I have written an external script that needs to run after DOM is ready (or after onload if thats impossible).
I use this method to load the script dynamically since I need parameters on the script:
```
<script type="text/javascript">
document.write(unescape("%3Cscript src='mydomain.com/script.js.php?u="+encodeURIComp... | [
-0.0015890165232121944,
-0.09362463653087616,
0.7073442339897156,
-0.25600701570510864,
0.11110161244869232,
-0.09294849634170532,
0.2995225489139557,
-0.43577930331230164,
-0.16354495286941528,
-0.7201334238052368,
-0.22601541876792908,
0.5806115865707397,
-0.04462087154388428,
0.00889836... | |
I tell if DOM is already ready (on the different browsers) when my script runs? In this case the methods to start the script on DOM ready or document load events will not work because the events were already fired.
Notes: 1.I have no control on the web sites the script will be attached to.
2. Can't use Jquery or other... | [
0.3247486650943756,
-0.29150494933128357,
0.3809235990047455,
-0.14927658438682556,
-0.15565171837806702,
-0.4188159704208374,
0.32020461559295654,
-0.35464510321617126,
-0.137284517288208,
-0.4195390045642853,
-0.036261122673749924,
0.9325718283653259,
-0.23601502180099487,
0.076099261641... | |
that off-site .js .
2) Load the script only after DOM is ready. | [
0.14762715995311737,
-0.09828482568264008,
0.45218586921691895,
-0.09936928749084473,
0.13151341676712036,
-0.49314671754837036,
0.38673096895217896,
-0.032748881727457047,
0.0946689322590828,
-0.3619369566440582,
-0.5508167147636414,
0.664190948009491,
0.06643182039260864,
0.0286470968276... | |
As per question, is it safe to store passwords on php pages such as
```
$password = 'pa$$w0rd';
```
If the users can't see it, it's safe, right?
EDIT:
Some people actually suggested using hash, however, there would be a problem with database server connection password, wouldn't it?
The short answer is both No, and ... | [
0.3268231451511383,
0.13827410340309143,
-0.043928831815719604,
0.22708360850811005,
0.0730370283126831,
-0.2424418330192566,
0.468466192483902,
0.17673048377037048,
-0.2854001820087433,
-0.4094514846801758,
-0.11704137176275253,
0.5302162170410156,
0.002333504380658269,
0.0798030421137809... | |
try to store it outside the webroot, eg
`/var/www/public_html/` Put your codez here
`/var/www/includes/` Put your passwords here
Even better than that would be to have the system that you need the password for (eg a database wrapper ) return an object already instantiated. so rather than asking for `$databasepasswo... | [
0.10586698353290558,
-0.022492866963148117,
0.1406739354133606,
0.2783663868904114,
0.26982399821281433,
-0.15200626850128174,
0.24335888028144836,
0.10496189445257187,
-0.16612200438976288,
-0.670322060585022,
-0.17106254398822784,
0.5396056771278381,
-0.20563958585262299,
0.1590401977300... | |
password to your supa-secrit subscriber content, meh, all you've lost is some subscription fees, if its your database, you may have a problem, if it's your online banking details, um good for you.
How valuable is the thing the password is protecting? | [
0.3369040787220001,
-0.040683794766664505,
0.2761707603931427,
0.4725193679332733,
0.3200816810131073,
-0.3337023854255676,
0.1699368953704834,
0.5343163013458252,
-0.19609946012496948,
-0.07210559397935867,
0.03108237497508526,
0.5227481126785278,
0.07527298480272293,
-0.02367980778217315... | |
I am a newbie in C++ programming.
When compiling I never use any option.
This is my day to day command:
```
g++ MyCode.cc -o MyCode
```
For safety practice what's the best option
to use?
```
g++ -W -Wall -Werror
```
Will display all errors and warnings possible and treat them as errors. | [
0.40249863266944885,
0.6276446580886841,
0.18841442465782166,
-0.4201049208641052,
0.0822281613945961,
-0.2506267726421356,
0.23570340871810913,
0.2953551709651947,
0.14573074877262115,
-0.8121490478515625,
-0.2631267011165619,
0.7345691323280334,
-0.1612810641527176,
0.09128588438034058,
... | |
What's the standard path on MacOS X for storing application data that is to be shared by different users? I am not talking about temporary data, but data which is used by one particular program on a regular basis and belongs to no particular user. For example a game highscore table.
Thanks,
Adrian
I believe you're ta... | [
-0.0008056791848503053,
0.00863337516784668,
0.5568975210189819,
0.33251461386680603,
0.22342097759246826,
-0.1342986673116684,
0.06117662042379379,
-0.19033171236515045,
-0.23100733757019043,
-0.5048978328704834,
-0.12708108127117157,
0.4295227527618408,
-0.22419601678848267,
-0.271607011... | |
As is well known, in XHR (aka AJAX) web applications no history for your app is build and clicking the refresh button often moves the user out of his/her current activity. I stumbled upon location.hash (e.g. `http://anywhere/index.html#somehashvalue`) to circumvent the refresh problem (use location.hash to inform your ... | [
0.08230538666248322,
0.3484622538089752,
0.3118553161621094,
0.02902906760573387,
-0.16441352665424347,
0.07566292583942413,
0.23010827600955963,
0.31052884459495544,
-0.30161380767822266,
-0.7199735045433044,
0.14586219191551208,
0.31201666593551636,
0.08205921947956085,
0.130652621388435... | |
the application page loads I start this:
```
setInterval(
function(){
if (location.hash !== appCache.currentHash) {
appCache.currentHash = location.hash;
appCache.history.push(location.hash);
/* ... [load state using the hash value] ... */
r... | [
-0.21465474367141724,
-0.07410910725593567,
1.096770167350769,
-0.4845258295536041,
0.1951940953731537,
0.05149145796895027,
0.24360282719135284,
-0.37094736099243164,
-0.16212418675422668,
-0.7019451856613159,
-0.37272894382476807,
0.39309147000312805,
-0.49483734369277954,
0.357977360486... | |
true;
}
return false;
}, 250
);
```
(*appCache* is a predefined object containing application variables) The idea is to trigger every action in the application from the hash value. In decent browsers a hash value change adds an entry to the history, in IE (<= 7) it doesn't. In all browse... | [
-0.036319222301244736,
-0.1766979694366455,
0.6120219230651855,
-0.26095232367515564,
-0.03785537928342819,
0.10694802552461624,
0.5758874416351318,
-0.20152877271175385,
-0.17519308626651764,
-0.3910290002822876,
-0.4147607386112213,
0.6809051036834717,
-0.4781306982040405,
0.018358705565... | |
the function everytime the hash value change is detected (programmatically, or by clicking back or forward) the app can take appropriate action. The application can keep track of it's own history and I should be able to present history buttons in the application (especially for IE users).
As far as I can tell this wor... | [
0.2194962054491043,
0.100807785987854,
0.5500541925430298,
-0.016367346048355103,
-0.07199446856975555,
0.1636285036802292,
0.20505355298519135,
-0.21000507473945618,
-0.11920884996652603,
-0.47080618143081665,
-0.02365441806614399,
0.7420704364776611,
-0.4046991765499115,
-0.1316286474466... | |
one of the existing frameworks. To be able to use location.hash in IE and having it in it's history too, I created a simple script (yes, it's needs an iframe) which may be of use to you. I published it [on my site](http://www.nicon.nl/hash2history/), feel free to use/modify/critizise it.
I think you'll have a tricky ti... | [
0.4845173954963684,
0.13275347650051117,
0.4583510458469391,
0.00888901948928833,
-0.1116090714931488,
-0.16891708970069885,
0.08808399736881256,
-0.08636222779750824,
-0.15848307311534882,
-0.7456141114234924,
0.20700444281101227,
0.05789778381586075,
-0.08092307299375534,
0.2364901155233... | |
to remove or not.
The history frameworks use iframes to get around the browser inconsistencies you mentioned. You only need to use iframes in the browsers that need them.
Another con is that users will always go for their browsers back button before they will go for your custom back button. I have a feeling the delay... | [
0.32391226291656494,
-0.18631646037101746,
0.20437456667423248,
0.006915715057402849,
-0.40993574261665344,
-0.04096528887748718,
0.3805101811885834,
0.09659479558467865,
-0.42645177245140076,
-0.5266486406326294,
0.19195662438869476,
0.3230036497116089,
-0.2542079985141754,
0.269631534814... | |
(especially ie6), it's been used by a lot of users and developers. The pattern they use is pretty flexible too. | [
0.7816914916038513,
0.09304418414831161,
0.09873988479375839,
-0.06051629036664963,
-0.20699819922447205,
-0.6686305403709412,
0.13165496289730072,
0.34104475378990173,
-0.13823367655277252,
-0.8288492560386658,
-0.1605473905801773,
0.2933547794818878,
-0.0694844052195549,
-0.2568447291851... | |
A colleague of mine refactored this code:
```
private void btnGeneral_Click(object sender, RoutedEventArgs e)
{
Button button = (Button)e.OriginalSource;
Type type = this.GetType();
Assembly assembly = type.Assembly;
string userControlFullName = String.Format("{0}.{1}", type.Namespace, button.Name);
... | [
0.0691290944814682,
0.15913592278957367,
0.4498233199119568,
-0.20674148201942444,
0.16174514591693878,
0.07586043328046799,
0.5940291881561279,
-0.13558393716812134,
0.05360282585024834,
-0.24815680086612701,
0.05650831758975983,
0.3400309681892395,
-0.4337691068649292,
0.4953359067440033... | |
be used once.
My response was that making once-used variables is good practice since it:
* functions as and reduces comments (it is clear what "userControlFullName" is)
* makes code easier to read, i.e. more of your code "reads like English"
* avoids super-long statements by replacing parts of them with clear variabl... | [
0.3726606070995331,
-0.05776652321219444,
-0.04219898208975792,
-0.13619159162044525,
-0.3794158399105072,
0.024136219173669815,
0.4790447950363159,
-0.11475895345211029,
-0.08732832968235016,
-0.5346260070800781,
-0.018948663026094437,
0.6482898592948914,
-0.23086965084075928,
-0.06240767... | |
for the compiler but with no significant speed or resource savings.
Can anyone think of any situations in which one should not create once-used variable names?
I'm with your opinion in this case. Readability is key. I'm sure that the compiler produces the same executable in both cases, with the compilers as intelligen... | [
0.037264466285705566,
0.4191524088382721,
-0.2733587622642517,
0.1117384061217308,
-0.01599488966166973,
-0.24028615653514862,
0.4742913544178009,
0.05332155525684357,
-0.12885506451129913,
-0.6353043913841248,
-0.27540111541748047,
0.7132195234298706,
-0.18122585117816925,
-0.079953402280... | |
For those of us that have programmed enough I’m sure we have come across many different flavours of coding standards that you can use when it comes to programming.
e.g. <http://msdn.microsoft.com/en-us/library/ms229042.aspx>
You might derive your coding standards for the current company you work for or from the origi... | [
1.0377854108810425,
0.27770423889160156,
-0.30029958486557007,
0.39313939213752747,
0.0762951597571373,
0.026355890557169914,
0.17996758222579956,
0.21474766731262207,
-0.20864878594875336,
-0.6088393926620483,
-0.09039128571748734,
0.5230653285980225,
0.03756426274776459,
0.06266451627016... | |
articles on this subject, but [C# Coding standard / Best practices](https://stackoverflow.com/questions/14967/c-coding-standard-best-practices) in SO has some very useful links in there which is worth a visit. (Check out the 2 links on .NET/C# guidelines by ESV - Accepted Answer)
Google has a posted style guide for C++... | [
0.6711155772209167,
0.13661177456378937,
-0.03438378497958183,
0.3079017996788025,
-0.09686952084302902,
-0.41745591163635254,
0.10056503862142563,
0.3829837739467621,
-0.45115306973457336,
-0.24574588239192963,
-0.20971393585205078,
0.46925854682922363,
0.17732007801532745,
-0.34267306327... | |
I want to match a web address through regex which should capture <http://www.google.com> as well as www.google.com i.e. with and without protocol.
Well it's going to depend on exactly what you want to capture ("FTP"? "/index.htm"?) because a general URI capture based on the RFC standard is very hard, but you could star... | [
0.20372246205806732,
0.14633771777153015,
0.7416535019874573,
0.05160241946578026,
0.1860831081867218,
-0.308497816324234,
-0.021024979650974274,
-0.26839587092399597,
-0.028501858934760094,
-0.6387743949890137,
0.010564001277089119,
0.4656272828578949,
-0.5064409375190735,
0.1216730028390... | |
I have an untyped XML column in Sql Server Database which holds values such as
```
1
<root><a>123</a></root>
<root>23d</root>
23
```
I was trying with the following query
```
declare @x xml
set @x='1'
select @x.exist('xs:int(.)')
```
But here the problem is exist function will return 1 even if `@x='<root><a... | [
0.10432039946317673,
0.295272558927536,
0.32349565625190735,
0.007999684661626816,
-0.14615359902381897,
-0.2541623115539551,
0.35214468836784363,
-0.2914479374885559,
-0.056694984436035156,
-0.7665642499923706,
-0.017358211800456047,
0.1988217830657959,
-0.42206019163131714,
0.36249187588... | |
0 when it's XML?
In that case you need to do the following:
```
declare @x xml
set @x='<root><a>12</a></root>'
select ISNUMERIC(CAST(@x.query('/') AS nvarchar))
```
This should return 0
```
declare @x xml
set @x='12'
select ISNUMERIC(CAST(@x.query('/') AS nvarchar))
```
This should return 1 | [
-0.1218767985701561,
-0.24582912027835846,
0.3857802450656891,
-0.2630852162837982,
-0.18628279864788055,
-0.13865739107131958,
-0.03391212597489357,
-0.3876766264438629,
0.22393974661827087,
-0.25789716839790344,
-0.3597615659236908,
0.42156505584716797,
-0.267896831035614,
-0.21004888415... | |
I'm attempting to declare a `Row` and a `Column` class, with the `Row` having a private `std::map` with values pointing to a templated `Column`. Something like this:
```
template <typename T> class DataType {
private:
T type;
};
template <typename T> class Field {
private:
T value;
DataType<T> type;
};... | [
0.26078370213508606,
0.0810629352927208,
0.12114231288433075,
-0.10672395676374435,
0.09084960073232651,
-0.008408046327531338,
0.09302899986505508,
-0.1457856148481369,
0.06350840628147125,
-0.4242570400238037,
-0.26864826679229736,
0.4830578863620758,
-0.35725969076156616,
0.225142315030... | |
column 2. But I'm not sure what's the correct syntax for the `Row::column` declaration, or if the `std::map` is limited in this sense and I should be using something else.
I appretiate you suggestions and thank you for them in advance.
`Field` alone is not a type, but a template which can generate a family of types, s... | [
0.2638639509677887,
0.22622519731521606,
0.39138755202293396,
-0.08503329008817673,
-0.24136237800121307,
-0.14986760914325714,
0.05667921155691147,
-0.07504993677139282,
0.04723299294710159,
-0.6227585077285767,
-0.003903675125911832,
0.3754831850528717,
-0.5545430183410645,
-0.0303499270... | |
FieldBase { };
template <typename T>
class Field : public FieldBase {
private:
T value;
DataType<T> type;
};
class Row {
private:
std::map<unsigned long,FieldBase*> column;
};
```
And consider using smart pointer instead of that raw pointer in the code. Anyway, now the problem is that the type-infor... | [
-0.0076782722026109695,
-0.0991448312997818,
0.2995360493659973,
0.01085558719933033,
0.17087751626968384,
-0.20556041598320007,
0.24415038526058197,
-0.39448124170303345,
-0.03468377888202667,
-0.4389164447784424,
-0.16075751185417175,
0.6005176901817322,
-0.32382509112358093,
0.051323421... | |
that's ugly. Especially because what you want there is a value semantic. I.e you would want to be able to copy your row, and it would copy all the fields in it. And you would want to get a double when a double is stored - without first using RTTI to hack your way to the derived type.
One way of doing it is to use a d... | [
0.25431886315345764,
0.10108429938554764,
0.08869700133800507,
0.18132513761520386,
-0.16567575931549072,
-0.1745385229587555,
0.020510602742433548,
-0.10341563075780869,
-0.06867686659097672,
-0.587346076965332,
0.06955602765083313,
0.34849220514297485,
-0.5885683298110962,
0.177819013595... | |
example:
```
template <typename T>
class Field {
private:
T value;
DataType<T> type;
};
class Row {
private:
std::map<unsigned long,
boost::variant< Field<int>, Field<double> > >
column;
};
```
boost::variant does all the work for you. You can use visitation to make it call a fun... | [
-0.11472954601049423,
-0.5408775210380554,
0.48222702741622925,
0.1218099445104599,
-0.07537543773651123,
-0.001915247761644423,
-0.09377048164606094,
-0.10623767226934433,
-0.5241298079490662,
-0.5143370628356934,
-0.23539605736732483,
0.5484068989753723,
-0.37013015151023865,
-0.19685056... | |
I simply want flowing text on the left, and a help box on the right.
The help box should extend all the way to the bottom.
If you take out the outer `StackPanel` below it works great.
But for reasons of layout (I'm inserting UserControls dynamically) I need to have the wrapping `StackPanel`.
How do I get the `Group... | [
-0.15746453404426575,
-0.11894401907920837,
0.5768575668334961,
-0.23249340057373047,
-0.0987461730837822,
-0.005685917101800442,
-0.05639898404479027,
-0.13909192383289337,
-0.2253715544939041,
-0.5727238059043884,
-0.14614632725715637,
0.5205547213554382,
0.044013913720846176,
-0.4939472... | |
VerticalAlignment="Stretch"
Height="Auto">
<DockPanel
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Height="Auto"
Margin="10">
<GroupBox
DockPanel.Dock="Right" | [
-0.14364062249660492,
-0.09257959574460983,
0.7756272554397583,
-0.2155434638261795,
0.3103085160255432,
0.6404452919960022,
-0.224472314119339,
-0.21013210713863373,
-0.45938655734062195,
-0.561577320098877,
-0.1456536054611206,
0.6746317744255066,
0.19133393466472626,
-0.1807081252336502... | |
Header="Help"
Width="100"
Background="Beige"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch" | [
0.10938181728124619,
-0.07306364923715591,
0.08193401247262955,
-0.0863342136144638,
0.2337024062871933,
0.39275962114334106,
0.02284717932343483,
0.23273715376853943,
-0.49489131569862366,
-0.48769500851631165,
-0.20844444632530212,
0.2979770004749298,
0.062041863799095154,
0.144449040293... | |
Height="Auto">
<TextBlock Text="This is the help that is available on the news screen." TextWrapping="Wrap" />
</GroupBox>
<StackPanel DockPanel.Dock="Left" Margin="10" Width="Auto" HorizontalAlignment="Stretch">
<TextBlock Text="Here is the news that should wrap... | [
-0.0723479613661766,
0.10343150049448013,
0.8313608169555664,
-0.19441483914852142,
-0.05933741107583046,
0.013395308516919613,
-0.05809515342116356,
-0.10419180244207382,
-0.6020244359970093,
-0.5414839386940002,
-0.36209118366241455,
0.5049535632133484,
0.11337100714445114,
-0.4628482460... | |
</DockPanel>
</StackPanel>
</Window>
```
Answer:
-------
Thanks Mark, using `DockPanel` instead of `StackPanel` cleared it up. In general, I find myself using `DockPanel` more and more now for WPF layouting, here's the fixed XAML:
```
<Window x:Class="TestDynamic033.Test3"
xmlns="http://schemas.microsoft.co... | [
-0.12468015402555466,
0.009507362730801105,
0.7245938181877136,
-0.3022279143333435,
-0.01541025098413229,
0.26913270354270935,
-0.2655559778213501,
-0.2876143455505371,
-0.5240736603736877,
-0.5026566982269287,
-0.029845261946320534,
0.5761169791221619,
0.2031254917383194,
-0.288636088371... | |
VerticalAlignment="Stretch"
Height="Auto"
MinWidth="400"
Margin="10">
<GroupBox
DockPanel.Dock="Right"
Header="Help" | [
0.0199142936617136,
-0.2873840034008026,
0.8992935419082642,
-0.07416993379592896,
0.2964867353439331,
0.5829236507415771,
0.1549939662218094,
-0.17964862287044525,
-0.4336918890476227,
-0.442220538854599,
-0.13712576031684875,
0.4433276355266571,
0.1381775289773941,
0.03645022585988045,
... | |
Width="100"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
Height="Auto">
<Border CornerRadius="3" Background="Beige">
<TextBlock Text="This is the | [
-0.026747578755021095,
-0.08845386654138565,
0.923288881778717,
-0.19357524812221527,
0.37816253304481506,
0.11156994849443436,
0.1220073401927948,
-0.13915613293647766,
-0.4568077325820923,
-0.7615636587142944,
-0.0005283577484078705,
0.35514551401138306,
0.07293760031461716,
0.0676825493... | |
help that is available on the news screen." TextWrapping="Wrap"
Padding="5"/>
</Border>
</GroupBox>
<StackPanel DockPanel.Dock="Left" Margin="10" Width="Auto" HorizontalAlignment="Stretch">
<TextBlock Text="Here is the news that should wrap arou... | [
-0.031455159187316895,
-0.02403484657406807,
0.9152318239212036,
0.007657601032406092,
0.12743672728538513,
-0.07737094163894653,
0.01771177537739277,
0.01985262520611286,
-0.44349825382232666,
-0.7816133499145508,
-0.3826488256454468,
0.5163781046867371,
-0.023790860548615456,
-0.27544075... | |
</StackPanel>
</DockPanel>
</DockPanel>
</Window>
```
It sounds like you want a `StackPanel` where the final element uses up all the remaining space. But why not use a `DockPanel`? Decorate the other elements in the `DockPanel` with `DockPanel.Dock="Top"`, and then your help control can fill the remaining... | [
-0.08699788898229599,
0.09028889983892441,
0.6722503900527954,
-0.3972626030445099,
0.33560770750045776,
0.3454129099845886,
-0.2615417242050171,
-0.48140522837638855,
-0.6327414512634277,
-0.5675416588783264,
-0.20801417529582977,
0.3443707227706909,
-0.01552121527493,
-0.4149391651153564... | |
Height="Auto"
Margin="10">
<GroupBox
DockPanel.Dock="Right"
Header="Help"
Width="100"
Background="Beige"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
Height="Auto">
<TextBlock Text="This is the help that is availabl... | [
-0.025517195463180542,
0.001499468693509698,
0.7273434400558472,
-0.14448779821395874,
0.35763663053512573,
0.26887279748916626,
0.05848892778158188,
-0.05401536822319031,
-0.45162415504455566,
-0.6135872602462769,
-0.2896513342857361,
0.5492982268333435,
0.0708690881729126,
-0.32172399759... | |
screen."
TextWrapping="Wrap" />
</GroupBox>
<StackPanel DockPanel.Dock="Left" Margin="10"
Width="Auto" HorizontalAlignment="Stretch">
<TextBlock Text="Here is the news that should wrap around."
TextWrapping="Wrap"/>
</StackPanel>
</Do... | [
0.14579994976520538,
0.08840733766555786,
0.761351466178894,
-0.5288370251655579,
0.15727610886096954,
0.10588368028402328,
-0.07197856903076172,
-0.029929552227258682,
-0.7473336458206177,
-0.780212938785553,
-0.2623743414878845,
0.6447343230247498,
-0.06134457886219025,
-0.23353981971740... | |
on a platform without `DockPanel` available (e.g. WindowsStore), you can create the same effect with a grid. Here's the above example accomplished using grids instead:
```
<Grid Width="200" Height="200" Background="PowderBlue">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Hei... | [
0.1432868242263794,
0.019607501104474068,
0.3961634039878845,
-0.2067670077085495,
-0.04436461627483368,
0.19073837995529175,
0.16392795741558075,
-0.5223039984703064,
-0.6914078593254089,
-0.8241909742355347,
0.03516490012407303,
0.429930180311203,
-0.06914936006069183,
-0.197304949164390... | |
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<GroupBox
Width="100"
Height="Auto"
Grid.Column="1"
Background="Beige"
Header="Help"> | [
-0.07795584201812744,
0.028284365311264992,
0.4561977684497833,
-0.2384277731180191,
0.1581425815820694,
0.3985641598701477,
0.015561827458441257,
-0.44301116466522217,
-0.3382277190685272,
-0.9024903774261475,
-0.15614822506904602,
0.431600421667099,
-0.041501015424728394,
-0.154944688081... | |
<TextBlock Text="This is the help that is available on the news screen."
TextWrapping="Wrap"/>
</GroupBox>
<StackPanel Width="Auto" Margin="10" DockPanel.Dock="Left">
<TextBlock Text="Here is the news that should wrap around."
TextWrapping="Wrap"/>
</Sta... | [
-0.07795921713113785,
0.21867775917053223,
0.6354598999023438,
-0.19514639675617218,
-0.15801657736301422,
-0.09244561940431595,
0.030104229226708412,
-0.042986731976270676,
-0.4969739615917206,
-0.6222360730171204,
-0.46789634227752686,
0.5102857947349548,
-0.14197427034378052,
-0.4225217... | |
</Grid>
</Grid>
``` | [
0.018906686455011368,
0.5501088500022888,
0.26965177059173584,
-0.06863657385110855,
0.14637954533100128,
0.1008794903755188,
0.0118413669988513,
0.17875586450099945,
-0.23059384524822235,
-0.9300528764724731,
-0.2224569320678711,
0.07610799372196198,
-0.13579151034355164,
0.00595774268731... | |
```
public struct Char
{
public const char MaxValue = (char)0xffff;
public const char MinValue = '\0';
}
```
Why don't make this fields to be static? What for it's always allocating additional memory for each char while this two values are permanent?
**Edit**: I don't know how I could forget about been static impl... | [
-0.021427154541015625,
0.19915662705898285,
0.2823358178138733,
-0.12448585778474808,
0.149967759847641,
0.09783150255680084,
0.43919119238853455,
0.21856607496738434,
-0.13329003751277924,
-0.473713219165802,
-0.14266720414161682,
0.8506898283958435,
-0.3125447630882263,
0.306009918451309... | |
I'm running into problems serializing lots of objects in .NET. The object graph is pretty big with some of the new data sets being used, so I'm getting:
```
System.Runtime.Serialization.SerializationException
"The internal array cannot expand to greater than Int32.MaxValue elements."
```
Has anyone else hit this lim... | [
0.02439451590180397,
0.198706716299057,
0.30875164270401,
0.0686909407377243,
0.12790356576442719,
-0.048479340970516205,
0.1500498503446579,
0.02906024269759655,
-0.5727810263633728,
-0.769926905632019,
0.10969704389572144,
0.3427595794200897,
-0.3243974447250366,
0.325946569442749,
0.0... | |
its members (some of them are recalculated during loading).
It looks like this an open issue for MS ([details here](http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=303278)), but it's been resolved as Wont Fix. The details are (from the link):
> Binary serialization fails for object
> ... | [
-0.27938225865364075,
-0.13675008714199066,
0.4417036771774292,
0.03173956274986267,
-0.28243622183799744,
-0.06190050020813942,
0.4022112786769867,
-0.13520461320877075,
-0.6900389790534973,
-0.3549547493457794,
-0.17081210017204285,
0.014787477441132069,
-0.33741286396980286,
0.394689559... | |
See the following lines:
>
>
>
> ```
> // Table of prime numbers to use as hash table sizes. Each entry is the
> // smallest prime number larger than twice the previous entry.
> private static readonly int[] sizes = {5, 11, 29, 47, 97, 197, 397,
> 797, 1597, 3203, 6421, 12853, 25717, 51437, 102877, 205759,
> 411527... | [
-0.10735156387090683,
0.19414646923542023,
0.34911760687828064,
0.053170159459114075,
0.007611708249896765,
0.4153657853603363,
0.42925703525543213,
-0.2823711931705475,
-0.49315571784973145,
-0.5468320846557617,
-0.06758538633584976,
0.17193572223186493,
-0.20292748510837555,
0.2338650524... | |
million objects is only 2 bytes. So I suspect you could not only fix the problem, but also significantly improve performance if you pack your data a little better in your custom ISerialize implementations. Don't let the serializer see so deep into your structure, but cut it off at the point where your object graph blow... | [
0.22416231036186218,
-0.0556635856628418,
0.041251521557569504,
0.31403234601020813,
-0.24399879574775696,
0.20929881930351257,
0.25141018629074097,
0.017770543694496155,
-0.5275556445121765,
-0.5318447351455688,
0.1878138929605484,
0.0167410708963871,
-0.20365244150161743,
0.3629088401794... | |
C, but manually manages the collection of class A:
```
class Program
{
static void Main(string[] args)
{
C c = new C(8, 2000000);
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.MemoryStr... | [
-0.025920184329152107,
0.009343884885311127,
0.4480936825275421,
-0.3431171774864197,
0.23220056295394897,
0.20895065367221832,
0.30612677335739136,
-0.23538072407245636,
-0.3447260558605194,
-0.1026286855340004,
-0.398835688829422,
0.7181057333946228,
-0.6473969221115112,
0.39887413382530... | |
for (int j = i; j < i + 3; j++)
Console.WriteLine("{0}, {1}", c.all[i][j].b1, c.all[i][j].b2);
Console.WriteLine("=====");
c = null;
c = (C)(bf.Deserialize(ms));
for (int i = 0; i < 3; i++)
for (int j = i; j < i + 3; j++) | [
-0.060490284115076065,
-0.35725295543670654,
0.22803393006324768,
-0.22927720844745636,
0.3203910291194916,
0.5064213871955872,
0.7140371203422546,
-0.46935874223709106,
-0.1017700731754303,
-0.7528553605079651,
-0.47285446524620056,
0.608699381351471,
-0.2544431686401367,
0.26406708359718... | |
Console.WriteLine("{0}, {1}", c.all[i][j].b1, c.all[i][j].b2);
Console.WriteLine("=====");
}
}
class A
{
byte dataByte1;
byte dataByte2;
public A(byte b1, byte b2)
{
dataByte1 = b1;
dataByte2 = b2;
}
public UInt16 GetAllData()
{
return (UInt16)((dataByte... | [
-0.31326478719711304,
-0.23014047741889954,
0.4332354664802551,
-0.24802568554878235,
0.3169762194156647,
0.25375640392303467,
0.17142954468727112,
-0.20134615898132324,
0.06610556691884995,
-0.43682873249053955,
-0.6143829822540283,
0.5589059591293335,
-0.30906304717063904,
0.173776477575... | |
}
public A(UInt16 allData)
{
dataByte1 = (byte)(allData >> 8);
dataByte2 = (byte)(allData & 0xff);
}
public byte b1
{
get
{
return dataByte1;
}
}
public byte b2 | [
-0.08480755984783173,
-0.12219372391700745,
-0.05346033349633217,
-0.20556247234344482,
0.02342451550066471,
0.1855749785900116,
0.07190266251564026,
-0.059487149119377136,
-0.2785071134567261,
-0.4446161985397339,
-0.5161632299423218,
0.41425150632858276,
-0.5121215581893921,
0.0213670227... | |
{
get
{
return dataByte2;
}
}
}
[Serializable()]
class B : System.Runtime.Serialization.ISerializable
{
string name;
List<A> myList;
public B(int size)
{
myList = new List<A>(size);
for (int i = 0; i < size; i++) | [
0.034654051065444946,
-0.4207758605480194,
0.33722537755966187,
-0.29674163460731506,
0.4023575186729431,
0.08556172996759415,
0.24000635743141174,
-0.254837304353714,
-0.42061901092529297,
-0.5267764925956726,
-0.35597383975982666,
0.38868048787117004,
-0.5626103281974792,
0.4321415126323... | |
{
myList.Add(new A((byte)(i % 255), (byte)((i + 1) % 255)));
}
name = "List of " + size.ToString();
}
public A this[int index]
{
get
{
return myList[index];
}
} | [
-0.01183293480426073,
-0.0637577623128891,
0.40406492352485657,
-0.42482730746269226,
0.23232239484786987,
0.13699102401733398,
0.11893394589424133,
-0.20347854495048523,
-0.25443166494369507,
-0.5051833391189575,
-0.3102427124977112,
0.40392741560935974,
-0.37922924757003784,
0.2323115915... | |
#region ISerializable Members
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
UInt16[] packed = new UInt16[myList.Count];
info.AddValue("name", name);
for (int i = 0; i < myList.Count; i++)
{... | [
-0.05124590918421745,
-0.5755556225776672,
0.7483897805213928,
0.034366484731435776,
0.3124220669269562,
-0.06913444399833679,
0.045475397258996964,
-0.13050806522369385,
-0.36829954385757446,
-0.8815943598747253,
-0.6320959329605103,
0.1637842208147049,
-0.5444691777229309,
0.459900885820... | |
protected B(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
name = info.GetString("name");
UInt16[] packed = (UInt16[])(info.GetValue("packedData", typeof(UInt16[])));
myList = new List<A>(packed.Length);
for (int i = 0; i... | [
0.3267271816730499,
-0.31793591380119324,
0.33936288952827454,
-0.27898064255714417,
0.359343022108078,
0.009160441346466541,
0.08061831444501877,
-0.41713377833366394,
-0.37786951661109924,
-0.423895001411438,
-0.44382065534591675,
0.5555865168571472,
-0.916700005531311,
0.046366989612579... | |
all = new List<B>(count);
for (int i = 0; i < count; i++)
{
all.Add(new B(size));
}
}
}
``` | [
0.19272254407405853,
-0.012694834731519222,
0.28670844435691833,
-0.49901488423347473,
0.040410444140434265,
-0.09191148728132248,
0.2505216598510742,
-0.5974498391151428,
-0.3822374641895294,
-0.387042760848999,
-0.365700900554657,
0.5414713621139526,
-0.7128909230232239,
0.15327183902263... | |
Do any sql ninja's know how to execute a script (.sql) from within another script? Specifically for the Sql Server 2005+ platform. E.g. psudeo code follows:
**ScriptA contents**
```
RESTORE DATABASE [MyDbName]
FROM
DISK = N'path' WITH FILE = 1
.......
GO
Exec c:\scripts\ScriptB.sql
```
**ScriptB cont... | [
-0.3513649106025696,
-0.39104631543159485,
0.21861445903778076,
0.057439450174570084,
-0.1713888943195343,
-0.05574861168861389,
0.7779951691627502,
-0.2761106491088867,
-0.09105312079191208,
-0.5079537630081177,
0.14163479208946228,
1.0952115058898926,
0.046784620732069016,
-0.27320587635... | |
The DevExpress Grid (XtraGrid) allows grids and their groups to have summary calculations. The available options are Count, Max, Min, Avg, Sum, None and Custom.
Has anyone got some sample code that shows how to calculate a weighted average column, based upon the weightings provided as values in another column?
I ended... | [
0.20792783796787262,
-0.3938099145889282,
0.36029770970344543,
0.30316054821014404,
-0.4311124086380005,
0.08786777406930923,
-0.11243297159671783,
-0.28419849276542664,
-0.15844137966632843,
-0.6559157967567444,
0.18334928154945374,
0.43910306692123413,
-0.36353927850723267,
-0.2587590217... | |
will do the rest:
```
private static void gridView_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e)
{
GridColumn weightColumn = ((GridSummaryItem)e.Item).Tag as GridColumn;
if (weightColumn == null)
return;
switch (e.SummaryProcess)
{
case CustomSummaryProcess.Start:
... | [
0.03171742707490921,
-0.680457353591919,
0.5773202776908875,
0.07565741240978241,
0.14959101378917694,
0.07664532214403152,
-0.03732229024171829,
-0.21665272116661072,
-0.18539223074913025,
-0.46328774094581604,
-0.26363685727119446,
0.6353666186332703,
-0.25473135709762573,
0.209287956357... | |
case CustomSummaryProcess.Calculate:
{
double size = Convert.ToDouble(e.FieldValue);
double weight = Convert.ToDouble(((GridView)sender).GetRowCellValue(e.RowHandle, weightColumn));
((WeightedAverageCalculator)e.TotalValue).Add(weight, size);
break;
}
... | [
-0.1436740756034851,
-0.5134754180908203,
0.46007782220840454,
0.044467419385910034,
0.05737808719277382,
0.263996422290802,
0.07394856214523315,
-0.4267663061618805,
-0.16417229175567627,
-0.3443835973739624,
-0.06464667618274689,
0.41704419255256653,
-0.04027959704399109,
-0.182873174548... | |
e.TotalValue = ((WeightedAverageCalculator)e.TotalValue).Value;
break;
}
}
}
private sealed class WeightedAverageCalculator
{
private double _sumOfProducts;
private double _totalWeight;
public void Add(double weight, double size)
{
_sumOfProducts += weight * size;
... | [
0.3139151334762573,
-0.21609392762184143,
0.34322550892829895,
-0.20338809490203857,
-0.10842685401439667,
0.34135088324546814,
0.14047886431217194,
-0.5039018988609314,
-0.2606256306171417,
-0.1894531399011612,
-0.36139047145843506,
0.5716737508773804,
-0.16590511798858643,
0.109084717929... | |
get { return _totalWeight==0 ? 0 : _sumOfProducts / _totalWeight; }
}
}
```
The code assumes that the underlying column values can be converted to doubles via `Convert.ToDouble(object)`. | [
0.099988654255867,
-0.07932598888874054,
0.31831324100494385,
-0.20465411245822906,
-0.11389993131160736,
0.22850897908210754,
0.06703644245862961,
-0.3537905812263489,
-0.17272870242595673,
-0.1888897716999054,
-0.23640309274196625,
0.6372418403625488,
-0.20529663562774658,
-0.13124366104... | |
*Brainstorming request*
I need an idea for an authentication algorithm with some unusual requirements.
The algorithm would be used to verify that the **sender** of a message is legitimate.
Restrictions:
-------------
1. The "transport layer" is e-mail
* the sender ('*Alice*') is a human being
* *Alice* only has a... | [
0.23151007294654846,
0.07224232703447342,
0.16976074874401093,
0.2105225771665573,
-0.08705941587686539,
-0.15643751621246338,
0.30390214920043945,
-0.05855775624513626,
-0.21587102115154266,
-0.3991614580154419,
-0.1782250851392746,
0.304891437292099,
-0.36259493231773376,
-0.085145138204... | |
can't send any out-of-band info. Reading some publicly available info (such as the time from a time server) is ok.
Assumptions:
------------
* *Alice* can access *some* information locally: maybe she carries a notebook, or we could even assume her web mail account is hack-proof, therefore sensitive information can be... | [
0.08032060414552689,
-0.05650904029607773,
0.12488644570112228,
0.39786723256111145,
0.13509880006313324,
-0.36839377880096436,
0.648042619228363,
-0.09574227035045624,
-0.31101271510124207,
-0.4915010631084442,
-0.12526926398277283,
0.40225014090538025,
-0.14407797157764435,
-0.1778174787... | |
eavesdroping possible if the communication is done in clear text, then replay attacks possible
2. Simple algorithm based on current date/time
Example: *Alice* adds the current date, hour and minute and sends the result as the auth token, which *Bob* can verify. Let's assume that read-only access to a time server doe... | [
0.22256043553352356,
-0.00993011612445116,
0.44243794679641724,
0.27935469150543213,
0.09332910180091858,
-0.055113062262535095,
0.7125179767608643,
-0.14186185598373413,
-0.45601993799209595,
-0.014050375670194626,
-0.3852117657661438,
0.3876369297504425,
-0.40210336446762085,
-0.05695416... | |
the expected response and the actual payload.
What are the details of the mechanism? I don't know :)
What can *you* think of? I'm hoping to see some creative answers ;-)
**Edit:**
Maybe an example would make rule #3 clearer: let's assume that *Alice* is using a proprietary closed-source device *`<cough>` iPhone ... | [
0.34066638350486755,
0.08897587656974792,
0.3074306547641754,
0.22515282034873962,
-0.2069462388753891,
-0.19431836903095245,
0.4028480350971222,
-0.20339435338974,
-0.42283809185028076,
-0.25013795495033264,
-0.01938439905643463,
0.4160335659980774,
-0.48417431116104126,
-0.17834009230136... | |
sent to Bob makes him reply with the current challenge, so Alice can query him by sending an empty mail
3. once Alice knows the challenge, she goes to <https://www.pwdhash.com/>
* in "Site Address" she enters the current challenge
* in "Site Password" she enters her personal password (which is known to Bob)
* PwdHas... | [
-0.06095104292035103,
0.2426854819059372,
0.5006178617477417,
-0.10217036306858063,
-0.48550131916999817,
0.15605467557907104,
0.5785436630249023,
-0.4169403910636902,
-0.3346104919910431,
-0.3072265386581421,
-0.29346176981925964,
0.10528015345335007,
-0.4380847215652466,
0.11288166046142... | |
message and and sends out a confirmation containing the new challenge (essentially this is step 1)
Advantages:
* cheap & simple, may even run on reasonably modern mobile devices
* human friendly (no math, easy to remember, prerequisites easily available on the net)
* no replay attack possible
* no clear text password... | [
0.24533234536647797,
-0.04414810612797737,
0.4766460657119751,
0.07309866696596146,
0.0025230732280761003,
-0.30655500292778015,
0.7054219245910645,
-0.32786762714385986,
-0.2699612081050873,
-0.4154418706893921,
-0.3382648229598999,
0.6304284930229187,
-0.2891665995121002,
-0.132992178201... | |
password off-site
* compromising Alice's password is the easiest attack vector (but that's the case with almost all password protected systems)
Note that PwdHash is an open hashing algorithm, Bob can easily implement it. The PwdHash web site works without post-backs, everything is client side JavaScript only, no trace... | [
0.1765153557062149,
-0.02270515076816082,
0.07039818912744522,
0.09504996985197067,
-0.32618921995162964,
-0.3822048008441925,
0.7970642447471619,
-0.07848330587148666,
-0.2675682604312897,
-0.4042206108570099,
-0.15231582522392273,
0.4550102651119232,
-0.5402700304985046,
-0.0699025839567... | |
Are there any tools, or 'best practices' for creating Migrations on MSSQL? I have a Dev & Production database, and the Dev one often has new SPROCs created, and occasionally the structure is added to. I'd like to be able to write a set of scripts during each iteration which will update the Dev server, then execute all ... | [
-0.014251567423343658,
-0.0077685401774942875,
0.17499016225337982,
0.014856505207717419,
-0.37162715196609497,
0.2582239806652069,
0.4836013615131378,
-0.20429836213588715,
-0.17569376528263092,
-0.43189185857772827,
-0.04903066158294678,
0.6242944002151489,
-0.2784925401210785,
-0.159756... | |
worth, my favourite of these is Fluent Migrator. | [
0.4152160882949829,
0.3808619976043701,
-0.04768851399421692,
-0.19133087992668152,
-0.539368748664856,
0.2710208296775818,
0.42509347200393677,
0.04167617857456207,
-0.0737270712852478,
-0.3702682554721832,
0.4106156527996063,
0.7360954880714417,
0.16796022653579712,
-0.2734609544277191,
... | |
I am trying to search a text file for a certain pattern. If this pattern occurs then it means that the rest of the line is not needed and therefore can be deleted.
I have tried using the following commands, but so far have been unsuccessful.
```
:%s/{pattern}/d$
:g/{pattern}/d$
```
If anyone has any suggestions th... | [
0.5759392380714417,
0.24445053935050964,
0.2330157458782196,
-0.3701101541519165,
0.1587556004524231,
0.07508397102355957,
0.5244802832603455,
0.21850913763046265,
-0.22213424742221832,
-0.8667069673538208,
-0.269395112991333,
0.4924999475479126,
-0.4240250289440155,
-0.028899285942316055,... | |
whenever i am pressing key in my server system i ll send that keyevent to another system after that the correspondingaction should be happend in the client machine.. help me to get a better way to solve this problem
thanx in advance
Use [jQuery Manipulation](http://docs.jquery.com/Manipulation)
try using these metho... | [
0.08586931228637695,
-0.19577118754386902,
0.6836044192314148,
-0.07423566281795502,
0.07387029379606247,
0.29657503962516785,
0.025613581761717796,
-0.3142554759979248,
-0.16385048627853394,
-0.4000996947288513,
-0.10585207492113113,
0.8211187124252319,
-0.16067899763584137,
-0.2001983970... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.