text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
should use virtual inheritance as shown in the answer by Gal Goldman. | [
-0.043486908078193665,
-0.186824768781662,
-0.30039504170417786,
0.3843190670013428,
0.2562478184700012,
-0.002121757948771119,
0.03564004600048065,
-0.28854900598526,
0.047155141830444336,
-0.31383439898490906,
-0.4624458849430084,
0.4165928065776825,
-0.174992635846138,
-0.03353908285498... | |
I have a file that contains a mish-mash of cities, states, and zip codes. Example:
> Munson 11010 Shelter Island Heights. . . .. 11965
> Brentwood 11717 Halesite 11743
I need to grab all of the zip codes out of that text. They are only 5 digit (no 5+4), and there are no other numbers besides the zips. It seems like... | [
0.47262150049209595,
0.15008008480072021,
0.49350786209106445,
0.2215355783700943,
0.10716148465871811,
0.20827791094779968,
0.4777517318725586,
-0.06133393570780754,
-0.14048205316066742,
-0.7088491320610046,
0.027503948658704758,
-0.10687605291604996,
-0.32148730754852295,
-0.03893476724... | |
can copy/paste into something like Excel.
Thanks for any help!
The following code should send you in the right direction:
```
<?php
$str = 'Munson 11010 Shelter Island Heights. . . .. 11965 Brentwood 11717 Halesite 11743 ';
preg_match_all("/\d{5}/", $str, $matches);
print_r($matches);
?>
``` | [
0.17945827543735504,
0.37009191513061523,
0.5620104074478149,
0.006919560953974724,
0.5287408232688904,
-0.02878977358341217,
0.5345826745033264,
0.08466114848852158,
-0.08164802938699722,
-1.114067554473877,
-0.10908043384552002,
0.2870555520057678,
-0.4418085217475891,
-0.068863004446029... | |
In Visual Studio 2008, it seems that when I tab on a line it inserts either 4 spaces or a tab, however - when I backspace it removes a tab as if it were 4 spaces, one space at a time..
I checked the text-editor settings in Tools.. tried both use spaces and use tabs, neither seem to work.
Any ideas?
Thanks in advance... | [
0.14142392575740814,
-0.06064298748970032,
0.25222691893577576,
-0.15398527681827545,
-0.5116822123527527,
0.3451865315437317,
0.20841166377067566,
0.008256648667156696,
-0.4568850100040436,
-0.4541582465171814,
0.2294803410768509,
0.5263732075691223,
-0.5167640447616577,
-0.26241934299468... | |
I need to take an **existing winforms application** and drop into an **event tracing mode**, with hopefully as little friction as possible.
I would like to see every action the user takes as a simple stack trace-looking thing:
```
MainForm.LaunchThing_Click
ThingWindow.NameInput_Focus
ThingWindow.NameInput_TextChange... | [
0.23989857733249664,
-0.059587087482213974,
0.24285683035850525,
-0.02242441475391388,
-0.04907039552927017,
-0.6428650617599487,
0.22627757489681244,
-0.1791149526834488,
-0.3656856417655945,
-0.5740439295768738,
0.05535411462187767,
0.6270262598991394,
-0.3261663019657135,
-0.04237920790... | |
I'm lazy. Gotta be a better way.
* I can't attach a debugger, I want to get this information automatically attached to bug reports from testing users in the field because *[it turns out...]* nobody can accurately remember exactly what the sequence of things they clicked on was.
So I'm wondering if anyone has any good ... | [
0.6503888964653015,
-0.17188046872615814,
0.2732763886451721,
0.16600972414016724,
-0.07916567474603653,
-0.13029998540878296,
0.46605822443962097,
0.22146283090114594,
-0.45678675174713135,
-0.5243145227432251,
0.11957477033138275,
0.4081854522228241,
-0.3376796245574951,
-0.2150881290435... | |
Create an EventLogger class with a bunch of overloaded Log methods (one for each event method signature) that do the logging. Instantiate it on application start and subscribe it to each of the UI events.
It should even be possible to do the subscribing automatically with reflection - though I would think it is more e... | [
0.18098635971546173,
-0.25856584310531616,
0.18793660402297974,
0.34118378162384033,
-0.10771410167217255,
-0.5267272591590881,
-0.1039942055940628,
-0.14027725160121918,
-0.38517069816589355,
-0.6281949877738953,
-0.15774689614772797,
0.4907907545566559,
-0.2548564672470093,
-0.2573726177... | |
Can I control the order static objects are being destructed?
Is there any way to enforce my desired order? For example to specify in some way that I would like a certain object to be destroyed last, or at least after another static object?
The static objects are destructed in the reverse order of construction. And the ... | [
0.3043217062950134,
-0.015757715329527855,
0.0195033960044384,
0.21069157123565674,
-0.4161278307437897,
-0.0453127957880497,
0.13882356882095337,
-0.016914768144488335,
-0.2120189219713211,
-0.48959144949913025,
0.012602885253727436,
0.4026200473308563,
-0.3374011516571045,
0.532716095447... | |
Its a simple config app with 4 checkboxes and 5 textboxes, and all values must persist across sessions.
do I have to serialize the fields and restore them by hand? I really have no idea the best way to approach this.
You could use the **User settings**, reading the values on load and saving on exit.
You can find info... | [
0.2809237241744995,
0.15876886248588562,
0.3018021285533905,
0.13964198529720306,
0.14241252839565277,
0.025950109586119652,
0.4107530415058136,
-0.04757744073867798,
-0.038405586034059525,
-0.5431132912635803,
0.07718737423419952,
0.7245775461196899,
-0.15506267547607422,
0.02170679904520... | |
I have a table that contains maybe 10k to 100k rows and I need varying sets of up to 1 or 2 thousand rows, but often enough a lot less. I want these queries to be as fast as possible and I would like to know which approach is generally smarter:
1. Always query for exactly the rows I need with a WHERE clause that's dif... | [
0.21158574521541595,
0.1727721095085144,
0.40700533986091614,
0.06890033185482025,
-0.06653622537851334,
0.15718768537044525,
0.2278658151626587,
-0.11112800985574722,
-0.3187274634838104,
-0.7693227529525757,
0.10459154844284058,
0.3100607395172119,
-0.21896424889564514,
0.037993475794792... | |
the cache (it's always the same query so it can cache the result) and filter the output as needed
I'd like to be agnostic of a specific DB engine for now.
I firmly believe option 1 should be preferred in an initial situation.
When you encounter performance problems, you can look on how you could optimize it using cach... | [
-0.10704338550567627,
0.1856028139591217,
-0.05533571168780327,
0.03691374883055687,
-0.3032689094543457,
0.01420858595520258,
0.4996776282787323,
-0.11423622816801071,
0.06388561427593231,
-0.795311450958252,
-0.09708769619464874,
0.5575963854789734,
-0.48442867398262024,
0.06128726899623... | |
I need to get 2 summed figures however im having issues as one will be for total orders and one is for orders incomplete. These use the same initial query however the orders incomplete has an additional where clause. Can these be put into a query so that i just get the 2 columns. I have done inner queries before but i ... | [
0.18934266269207,
-0.045006923377513885,
0.4012889862060547,
-0.14742352068424225,
-0.3496071994304657,
0.47640395164489746,
0.4218906760215759,
-0.7893463373184204,
-0.2748950719833374,
-0.7087542414665222,
0.10394062101840973,
0.659171462059021,
-0.3246845006942749,
0.2487972527742386,
... | |
ON TBL_PROPERTY.PROPREF = TBL_REPAIR_ORDER.PROPREF INNER JOIN
TBL_REPAIR_VISIT ON TBL_REPAIR_ORDER.ORDERID = TBL_REPAIR_VISIT.ORDERID INNER JOIN
tbl_contract ON tbl_repair_order.CONTRACT = tbl_contract.CONTRACT
WHERE (TBL_CONTRACT.CONTRACT IN ('STE')) AND
(TBL_REPAIR_ORDER.RAISEDDATE BETWEE... | [
-0.01880166493356228,
0.12171090394258499,
0.4964933693408966,
-0.25734132528305054,
-0.1418580710887909,
0.6889768838882446,
0.3366934657096863,
-0.8465735912322998,
-0.27993667125701904,
-0.8129504323005676,
-0.18514035642147064,
0.672393262386322,
-0.04899636283516884,
0.715681910514831... | |
tbl_contract ON tbl_repair_order.CONTRACT = tbl_contract.CONTRACT
WHERE (TBL_CONTRACT.CONTRACT IN ('STE')) AND
(TBL_REPAIR_ORDER.RAISEDDATE BETWEEN '01/12/2008' AND DATEADD(hh,23,'01/01/2009')) AND
TBL_REPAIR_ORDER.STATUS <> 'Completed')
```
```
SELECT Count(TBL_PROPERTY.PROPREF) AS TotalOrders
, S... | [
0.08904838562011719,
-0.1160927340388298,
0.45461514592170715,
-0.17030449211597443,
0.15591906011104584,
0.5704768896102905,
0.356876015663147,
-0.7362965941429138,
-0.19993998110294342,
-0.5382940173149109,
-0.11503073573112488,
0.7536833882331848,
-0.08630084991455078,
0.511797964572906... | |
I was wondering what is the design motive behind extension methods in C#
It allows you to create new functionality to an existing code base without editing the original code.
<http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx>
**"Extension methods allow developers to... | [
0.3785507380962372,
0.12886352837085724,
0.34681734442710876,
0.012025774456560612,
0.1436423510313034,
-0.07992231100797653,
0.00959349237382412,
-0.22858598828315735,
-0.30142742395401,
-0.441552072763443,
-0.22151270508766174,
0.644686222076416,
-0.1435260772705078,
-0.2752228379249573,... | |
introduced with .NET as part of the "Orcas" release."** | [
0.30500754714012146,
-0.29743731021881104,
0.46062758564949036,
0.17770671844482422,
-0.06412996351718903,
-0.07067245244979858,
0.1456643044948578,
0.3799551725387573,
-0.3166086673736572,
-0.42936837673187256,
-0.12243592739105225,
0.05935848876833916,
-0.06758344173431396,
-0.0771007835... | |
I'd like to show a widget with a "To:"-field and a "Subject:"-field, just like Mail application does and the SMS application partly does (it has no subject field). For example, when entering a few letters of a person name a table is shown with relevant hits from the address book. A recipient is encapsulated in a blue b... | [
0.524147093296051,
-0.02635391242802143,
0.2385421097278595,
0.1477527618408203,
0.09808044135570526,
0.10204202681779861,
0.32471710443496704,
-0.08869575709104538,
-0.16472600400447845,
-0.8787320256233215,
0.06510625779628754,
-0.07580315321683884,
-0.11889226734638214,
-0.0334019362926... | |
I am looking to have a C# application implement the Konami Code to display an Easter Egg.
<http://en.wikipedia.org/wiki/Konami_Code>
What is the best way to do this?
This is in a standard C# windows forms app.
In windows forms I would have a class that knows what the sequence is and holds the state of where you are ... | [
0.4626065790653229,
0.014635985717177391,
0.1641867756843567,
-0.07931315153837204,
-0.06395280361175537,
-0.1639256477355957,
0.015059682540595531,
-0.18498185276985168,
-0.21840384602546692,
-0.7567318677902222,
0.042113639414310455,
0.352825403213501,
-0.26188957691192627,
0.25113895535... | |
System.Windows.Forms.Keys.Down, System.Windows.Forms.Keys.Down,
System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right, | [
-0.26488542556762695,
0.08863459527492523,
0.6168947219848633,
0.06090850383043289,
0.3410354256629944,
0.4950472414493561,
0.0015511506935581565,
-0.18895848095417023,
-0.3027060627937317,
-0.8384475111961365,
-0.42418184876441956,
0.2882552444934845,
-0.09383314847946167,
0.1255335509777... | |
System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right,
System.Windows.Forms.Keys.B, System.Windows.Forms.Keys.A};
private int mPosition = -1;
public int Position {
get { return mPosition; } | [
-0.463727205991745,
-0.41215580701828003,
0.5063113570213318,
-0.19324016571044922,
0.07388459146022797,
0.7113921642303467,
0.2513313591480255,
-0.2713269591331482,
-0.4660211503505707,
-0.5599580407142639,
-0.7477170825004578,
0.21034623682498932,
-0.5492398738861084,
-0.1991115063428878... | |
private set { mPosition = value; }
}
public bool IsCompletedBy(Keys key) {
if (Keys[Position + 1] == key) {
// move to next
Position++;
} | [
-0.1444557011127472,
-0.23991139233112335,
0.4034974277019501,
-0.272752046585083,
0.12872987985610962,
-0.07790853828191757,
0.3023736774921417,
-0.3616233766078949,
-0.19656874239444733,
-0.30039918422698975,
-0.5885870456695557,
0.3774935305118561,
-0.596191942691803,
0.1068927347660064... | |
else if (Position == 1 && key == System.Windows.Forms.Keys.Up) {
// stay where we are
}
else if (Keys[0] == key) {
// restart at 1st
Position = | [
0.2511023283004761,
-0.25683364272117615,
0.7533725500106812,
0.06608910858631134,
0.6438180208206177,
-0.12335953861474991,
0.39574554562568665,
-0.1487426608800888,
-0.17255917191505432,
-0.17814098298549652,
-0.40683653950691223,
0.5949849486351013,
0.24761393666267395,
-0.0778008550405... | |
0;
}
else {
// no match in sequence
Position = -1;
}
if (Position == Keys.Count - 1) { | [
-0.38079753518104553,
-0.18657509982585907,
0.0966634452342987,
-0.39717429876327515,
0.36414608359336853,
-0.14271898567676544,
0.12816041707992554,
-0.3233065605163574,
0.23842625319957733,
-0.042431462556123734,
-0.3199235200881958,
0.46534448862075806,
-0.33737635612487793,
0.069812126... | |
Position = -1;
return true;
}
return false;
}
}
}
```
To use it, you would need something in your Form's code responding to key up events. Something like this should do it:
```
private KonamiSequence sequence = new KonamiSequence();
private | [
-0.18746647238731384,
-0.472409188747406,
0.17413651943206787,
-0.1456989347934723,
0.0026977434754371643,
-0.0899193063378334,
0.022629253566265106,
-0.5008200407028198,
0.15944422781467438,
-0.398183137178421,
-0.22953271865844727,
0.539900541305542,
-0.06706956028938293,
0.2307136654853... | |
void Form1_KeyUp(object sender, KeyEventArgs e) {
if (sequence.IsCompletedBy(e.KeyCode)) {
MessageBox.Show("KONAMI!!!");
}
}
```
Hopefully that's enough to give you what you need. For WPF you will need slight differences is very similar (see edit history #1).
EDIT: updated for winform... | [
0.32082727551460266,
-0.3152475655078888,
0.5132469534873962,
-0.2773706316947937,
-0.05580487102270126,
-0.26906880736351013,
0.17929701507091522,
-0.2569900453090668,
-0.08740122616291046,
-0.7515538930892944,
-0.18781255185604095,
0.5204893350601196,
-0.40724724531173706,
0.114783979952... | |
Can anyone help me with the trying to write SQL (MS SqlServer) - I must admit this is not by best skill.
What I want to do is exactly the same functionality as appears for the search boxes for the [Yell website](http://www.yell.com/) i.e.
* Search for company type
* AND/OR company name
* AND/OR enter a company name
*... | [
0.551974892616272,
0.3256848156452179,
0.2223961055278778,
-0.36196914315223694,
-0.6709610223770142,
-0.28474465012550354,
0.516421914100647,
0.00989021547138691,
0.0034926317166537046,
-0.1927337646484375,
0.17119508981704712,
0.5368843078613281,
-0.05530708283185959,
-0.0354878790676593... | |
AS varchar
SELECT *
FROM TABLE_NAME
WHERE (@CompanyType IS NULL OR COMPANY_TYPE_COLUMN LIKE '%' + @CompanyType + '%')
AND (@CompanyName IS NULL OR COMPANY_NAME_COLUMN LIKE '%' + @CompanyName + '%')
AND (@Town IS NULL OR TOWN_COLUMN LIKE '%' + @Town + '%')
```
Or this (only match start of columns with the wi... | [
-0.28773829340934753,
0.1787405014038086,
0.7959727644920349,
-0.618374228477478,
-0.45177721977233887,
0.5147730708122253,
0.26619264483451843,
-0.37353435158729553,
0.019740119576454163,
-0.05830769240856171,
-0.3168046176433563,
0.37898173928260803,
-0.3000652492046356,
0.41250100731849... | |
IS NULL OR TOWN_COLUMN LIKE @Town + '%')
``` | [
-0.1365835964679718,
0.3174193203449249,
0.5398110151290894,
-0.24529336392879486,
-0.18796709179878235,
-0.005316739436239004,
0.4192503094673157,
0.27490442991256714,
0.22581765055656433,
-0.1340252310037613,
-0.3649435341358185,
-0.11008046567440033,
-0.3029571771621704,
0.4153147041797... | |
I'm using the following xaml to fill the dataContext:
```
DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
```
The application works fine, but Cider complains that I must set the Path property.
I'm interested in the entire object, and not a specific property though.
I hope there's a way to ge... | [
-0.20971590280532837,
0.025497034192085266,
0.5905730128288269,
-0.13439686596393585,
0.042589303106069565,
-0.14114998281002045,
0.3282291889190674,
-0.1987602263689041,
-0.1966245025396347,
-0.8024654388427734,
-0.06628657877445221,
0.6923216581344604,
-0.13054783642292023,
0.06257368624... | |
Date and time in MySQL can be stored as DATETIME, TIMESTAMP, and INTEGER (number of seconds since 01/01/1970). What are the benefits and drawbacks of each, particularly when developing under a LAMP stack?
* TIMESTAMP is stored in a MySQL proprietary method (though it's basically just a string consisting of year, month,... | [
0.21896852552890778,
0.322844922542572,
0.45637738704681396,
0.06676704436540604,
0.10785889625549316,
0.29761964082717896,
-0.1552082747220993,
-0.06702632457017899,
-0.17727741599082947,
-0.6373259425163269,
0.09421835839748383,
0.003695457009598613,
-0.06131048500537872,
0.4285701811313... | |
null default '', ts timestamp not null);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into timestamp_test (val) values ('foobar');
Query OK, 1 row affected (0.00 sec)
mysql> select * from timestamp_test;
+----+--------+----------------+
| id | val | ts |
+----+--------+----------------+
| 1 | f... | [
-0.39848440885543823,
-0.21523511409759521,
0.4214366376399994,
-0.13202038407325745,
0.04001624882221222,
0.29752033948898315,
0.6731468439102173,
-0.3488393723964691,
-0.11705882847309113,
-0.5631891489028931,
-0.45841526985168457,
0.6172341108322144,
-0.26633524894714355,
0.010882798582... | |
ts |
+----+---------+----------------+
| 1 | foo bar | 20090122174123 |
+----+---------+----------------+
1 row in set (0.00 sec)
mysql>
```
* DATETIME is the standard data type for dates and times which works in conjunction with the date and time functions in MySQL. I'd probably use this in practice
* ... | [
0.11505734175443649,
-0.05603533983230591,
0.6159289479255676,
0.1299041211605072,
-0.1852721869945526,
-0.10943774878978729,
0.12821725010871887,
0.24790209531784058,
-0.5368056297302246,
-0.5860101580619812,
-0.07589174062013626,
0.1063365638256073,
-0.1506378948688507,
0.207937210798263... | |
in that field. | [
0.3441446125507355,
0.2347463220357895,
-0.3802245557308197,
0.1482517421245575,
0.04583240672945976,
-0.33741962909698486,
0.03513457626104355,
0.0019684825092554092,
-0.17794300615787506,
-0.2318735122680664,
0.16570760309696198,
0.26618996262550354,
0.04675139859318733,
0.22641403973102... | |
The .NET `Console` class and its default `TextWriter` implementation (available as `Console.Out` and implicitly in e.g. `Console.WriteLine()`) does not signal any error when the application is having its output piped to another program, and the other program terminates or closes the pipe before the application has fini... | [
0.06851060688495636,
-0.0751122459769249,
0.14798647165298462,
-0.09170801937580109,
0.05421346798539162,
-0.15453216433525085,
0.3127100467681885,
-0.1508202701807022,
0.01071105431765318,
-0.5820785164833069,
0.008134343661367893,
0.4275386333465576,
-0.3023845851421356,
0.19262406229972... | |
the effect of computation:
```
using System;
class Produce
{
static void Main()
{
for (int i = 0; i < 10000; ++i)
{
System.Threading.Thread.Sleep(100); // added for effect
Console.WriteLine(i);
}
}
}
```
`Consume` only reads the first 10 lines of input and ... | [
0.18204465508460999,
0.07872500270605087,
0.49903354048728943,
-0.3270983397960663,
0.254780113697052,
0.5211988687515259,
0.12724082171916962,
-0.32080739736557007,
-0.26493385434150696,
-0.7101383805274963,
-0.12794750928878784,
0.32834380865097046,
-0.08037497103214264,
0.28900247812271... | |
{
for (int i = 0; i < 10; ++i)
Console.ReadLine();
}
}
```
If these two programs are compiled, and the output of the first piped to the second, like so:
```
Produce | Consume
```
... it can be observed that `Produce` keeps on running long after `Consume` has terminated.
In reality, my `Con... | [
0.5917361974716187,
0.2236512154340744,
0.2871861457824707,
-0.26827484369277954,
0.22098751366138458,
-0.08077667653560638,
0.06529539078474045,
0.1277543306350708,
0.04653047397732735,
-0.6182652115821838,
0.004796333611011505,
0.6794190406799316,
-0.26004260778427124,
0.5229260921478271... | |
the connection.
How can I do this in .NET?
(I know that an obvious alternative is to pass a command-line argument to limit output, and indeed that's what I'm currently doing, but I'd still like to know how to do this since I want to be able to make more configurable judgements about when to terminate reading; e.g. pi... | [
-0.1326674073934555,
-0.059199944138526917,
0.6272077560424805,
0.21085990965366364,
0.014034440740942955,
-0.264144629240036,
0.22867125272750854,
0.16907604038715363,
-0.29114919900894165,
-0.6778996586799622,
0.026582438498735428,
0.6894862651824951,
-0.313423216342926,
0.46554628014564... | |
basic stream implementation over Win32 file handles. This wasn't terribly difficult, as I didn't need to implement asynchronous support, buffering or seeking.
Unfortunately, unsafe code needs to be used, but that generally isn't a problem for console applications that will be run locally and with full trust.
Here's t... | [
-0.30055907368659973,
-0.13973422348499298,
0.09886834025382996,
-0.03582727164030075,
-0.0201113298535347,
-0.09710604697465897,
0.1365235596895218,
0.04070675000548363,
0.2957346439361572,
-0.6491451263427734,
-0.1622314453125,
0.6456082463264465,
-0.3535359501838684,
0.2748917043209076,... | |
}
public override bool CanRead
{
get { return (_access & FileAccess.Read) != 0; }
}
public override bool CanSeek
{
get { return false; }
}
public override bool CanWrite
{
get { return (_access & FileAccess.Write) != 0; }
}
public override void Flush() | [
0.21590206027030945,
0.008115889504551888,
0.15493161976337433,
-0.28703925013542175,
0.1862938404083252,
-0.25962695479393005,
0.4712357521057129,
-0.09746068716049194,
0.1938381791114807,
-0.32479938864707947,
-0.3588241934776306,
0.8141822814941406,
-0.2938935458660126,
0.07030723989009... | |
{
// use external buffering if you need it.
}
public override long Length
{
get { throw new NotSupportedException(); }
}
public override long Position
{
get { throw new NotSupportedException(); }
set { throw new NotSupportedException(); }
}
static void ... | [
0.13565674424171448,
-0.39514079689979553,
0.1785326451063156,
-0.15223759412765503,
0.3064463138580322,
0.014777574688196182,
0.051355306059122086,
-0.3562425971031189,
-0.0918344035744667,
-0.3178245723247528,
-0.3329804837703705,
0.548504114151001,
-0.2501278519630432,
0.075040705502033... | |
int count)
{
if (offset < 0 || count < 0 || (offset + count) < 0
|| (offset + count) > buffer.Length)
throw new ArgumentOutOfRangeException();
}
public bool EndOfStream
{
get { return _eof; }
}
public override int Read(byte[] buffer, int offset, int coun... | [
-0.23123663663864136,
-0.2905234396457672,
0.4279068410396576,
-0.3376539349555969,
0.2674188017845154,
-0.017816364765167236,
0.3580935299396515,
-0.418811559677124,
0.18711644411087036,
-0.408784955739975,
-0.2074013650417328,
0.7949249744415283,
-0.3418346047401428,
-0.00277005508542060... | |
{
CheckRange(buffer, offset, count);
int result = ReadFileNative(_handle, buffer, offset, count);
_eof |= result == 0;
return result;
}
public override void Write(byte[] buffer, int offset, int count)
{
int notUsed;
Write(buffer, offset, count, out notUsed);
... | [
0.06626708060503006,
-0.20451951026916504,
0.3010924160480499,
-0.3818262815475464,
0.5231509804725647,
0.127940833568573,
0.24301129579544067,
-0.40189430117607117,
-0.05228711664676666,
-0.3208167552947998,
-0.4232344329357147,
0.634331226348877,
-0.38267943263053894,
0.00085786188719794... | |
buffer, int offset, int count, out int written)
{
CheckRange(buffer, offset, count);
int result = WriteFileNative(_handle, buffer, offset, count);
_eof |= result == 0;
written = result;
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotSu... | [
0.2725268006324768,
-0.3814588189125061,
0.5101330280303955,
-0.21599158644676208,
0.6032765507698059,
0.06888642907142639,
0.2650662362575531,
-0.6081476211547852,
0.20077338814735413,
-0.2863951623439789,
-0.22648344933986664,
0.6252415180206299,
-0.3981054127216339,
0.2533981204032898,
... | |
{
throw new NotSupportedException();
}
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32", SetLastError=true)]
static extern unsafe bool ReadFile(
SafeHandle hFile, byte* lpBuffer, int nNumberOfBytesToRead,
out int lpNumberOfBytesRead, IntPtr lpOverlapped);
[retu... | [
-0.024938616901636124,
0.11334145069122314,
0.10099475830793381,
-0.12769031524658203,
0.283183217048645,
-0.06095142662525177,
0.5651472210884094,
-0.6125048995018005,
0.005883957725018263,
-0.2147657722234726,
-0.39804625511169434,
0.7925077676773071,
-0.388431578874588,
0.17584732174873... | |
lpNumberOfBytesWritten, IntPtr lpOverlapped);
unsafe static int WriteFileNative(SafeHandle hFile, byte[] buffer, int offset, int count)
{
if (buffer.Length == 0)
return 0;
fixed (byte* bufAddr = &buffer[0])
{
int result;
if (!WriteFile(hFile, bufAddr... | [
-0.0969916507601738,
-0.19024953246116638,
0.7670924663543701,
-0.5003881454467773,
0.647079348564148,
0.07354708015918732,
-0.03954765573143959,
-0.413834810256958,
-0.31832796335220337,
-0.09034763276576996,
-0.28148797154426575,
0.8863284587860107,
-0.6363232135772705,
-0.17137306928634... | |
{
// Using Win32Exception just to get message resource from OS.
Win32Exception ex = new Win32Exception(Marshal.GetLastWin32Error());
int hr = ex.NativeErrorCode | unchecked((int) 0x80000000);
throw new IOException(ex.Message, hr); | [
-0.12459208071231842,
-0.025731444358825684,
0.2160201519727707,
-0.23136703670024872,
0.16474024951457977,
0.10476483404636383,
0.6429115533828735,
-0.36073747277259827,
-0.029429636895656586,
-0.7488030791282654,
-0.16654662787914276,
0.7031751275062561,
-0.30521059036254883,
0.201970890... | |
}
return result;
}
}
unsafe static int ReadFileNative(SafeHandle hFile, byte[] buffer, int offset, int count)
{
if (buffer.Length == 0)
return 0;
fixed (byte* bufAddr = &buffer[0])
{ | [
0.024735406041145325,
-0.10666146129369736,
0.3153795897960663,
-0.3368440270423889,
0.2877015173435211,
0.2013208568096161,
0.12044983357191086,
-0.31942030787467957,
-0.09525357186794281,
-0.0766804963350296,
-0.2561703622341156,
0.6402735114097595,
-0.48867732286453247,
0.06760621815919... | |
int result;
if (!ReadFile(hFile, bufAddr + offset, count, out result, IntPtr.Zero))
{
Win32Exception ex = new Win32Exception(Marshal.GetLastWin32Error());
int hr = ex.NativeErrorCode | unchecked((int) 0x80000000);
throw new IOException(ex.Message, | [
-0.1271006017923355,
-0.0771612823009491,
0.31832313537597656,
-0.188784658908844,
0.284186452627182,
0.2112599015235901,
0.5151817798614502,
-0.6154215335845947,
0.01219996064901352,
-0.5352270007133484,
-0.2258930802345276,
0.7469465732574463,
-0.13530202209949493,
0.08220943808555603,
... | |
hr);
}
return result;
}
}
}
```
`BufferedStream` can be wrapped around it for buffering if needed, but for console output, the `TextWriter` will be doing character-level buffering anyway, and only flushing on newlines.
The stream abuses `Win32Exception` to extract an error message... | [
-0.06976703554391861,
-0.02919173613190651,
0.6957618594169617,
-0.0240746159106493,
0.2513052523136139,
-0.0846078097820282,
0.12080041319131851,
-0.3026878833770752,
0.19111794233322144,
-0.46757879853248596,
-0.14708083868026733,
0.8310145139694214,
-0.18613433837890625,
0.1188321933150... | |
{
Input = -10,
Output = -11,
Error = -12,
}
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr GetStdHandle(int nStdHandle);
static SafeHandle GetStdHandle(StdHandle h)
{
return new SafeFileHandle(GetStdHandle((int) h), true);
}
public ... | [
-0.13446010649204254,
-0.3871666491031647,
0.4958374500274658,
-0.013183592818677425,
0.12834590673446655,
0.06815305352210999,
0.5435450077056885,
-0.563762366771698,
-0.1232641190290451,
-0.6599076390266418,
-0.3777361810207367,
0.6465028524398804,
-0.3894137442111969,
0.2943452596664428... | |
HandleStream(GetStdHandle(StdHandle.Input), FileAccess.Read);
}
public static HandleStream OpenStandardOutput()
{
return new HandleStream(GetStdHandle(StdHandle.Output), FileAccess.Write);
}
public static HandleStream OpenStandardError()
{
return new HandleStream(GetStdHandle(S... | [
-0.4713539183139801,
0.10889296233654022,
0.8822823762893677,
-0.049269430339336395,
-0.6232456564903259,
0.4573058485984802,
0.27604615688323975,
-0.3346324861049652,
-0.43300706148147583,
-0.6410910487174988,
-0.35371747612953186,
0.5413764119148254,
-0.131557434797287,
0.455251067876815... | |
{
if (_out == null)
{
_out = new StreamWriter(OpenStandardOutput());
_out.AutoFlush = true;
}
return _out;
} | [
-0.11042959243059158,
-0.26141685247421265,
0.44189953804016113,
-0.29639706015586853,
0.3789985477924347,
0.29340580105781555,
0.36737674474716187,
-0.06588771194219589,
0.004575428087264299,
-0.6386235952377319,
-0.20616495609283447,
0.5828853249549866,
-0.46810415387153625,
0.2074677050... | |
}
public static TextWriter Error
{
get
{
if (_error == null)
{
_error = new StreamWriter(OpenStandardError());
_error.AutoFlush = true; | [
-0.2382572889328003,
-0.17505382001399994,
0.4734305739402771,
-0.10065420717000961,
0.3335062265396118,
0.13423778116703033,
0.680900514125824,
-0.0021975014824420214,
0.16526371240615845,
-0.6277797222137451,
-0.3285350501537323,
0.9123666882514954,
-0.45331689715385437,
0.08411768823862... | |
}
return _error;
}
}
public static TextReader In
{
get
{
if (_in == null)
_in = new StreamReader(OpenStandardInput()); | [
-0.4196108281612396,
-0.5245552062988281,
0.4305984079837799,
-0.048084866255521774,
0.1565612405538559,
-0.011756205931305885,
0.4002601206302643,
0.2896563410758972,
0.14566205441951752,
-0.8564571738243103,
-0.7341557145118713,
0.6544491648674011,
-0.4958304762840271,
0.2254945039749145... | |
return _in;
}
}
}
```
The final result is that writing to the console output after the other end of the pipe has terminated the connection, results in a nice exception with the message:
> The pipe is being closed
By catching and ignoring the `IOException` at the outermost level, it looks like I'm good t... | [
-0.03079664148390293,
0.27005645632743835,
0.9722782969474792,
-0.31268107891082764,
0.29785704612731934,
-0.12515419721603394,
0.47184351086616516,
0.36554431915283203,
0.09456583857536316,
-0.5324802994728088,
-0.20285522937774658,
0.5909367799758911,
0.055437300354242325,
0.314395427703... | |
I tried everything possible, but still failed. I thought I got it at the point which I'll post
as my final attempt, but still isn't good [enough].
A script is being passed three arguments. Domain name, username and password.
But the probles is that I need domain separated in "domain" + ".com" format. Two variabl... | [
0.5067070722579956,
0.07573488354682922,
0.38155218958854675,
-0.3101283311843872,
-0.36053505539894104,
0.0872899740934372,
0.5731819868087769,
-0.5720800161361694,
0.007643621880561113,
-0.7086345553398132,
0.2549913823604584,
0.36042067408561707,
-0.14929048717021942,
0.1891599446535110... | |
String operations in DOS Shell are a pain in the ass. I might be able to convince
a script writer to pass me 4 arguments instead of 3... but in case that fails... HELP!
To solve this one, I had to write my own basic stream implementation over Win32 file handles. This wasn't terribly difficult, as I didn't need to im... | [
-0.26732948422431946,
-0.051901720464229584,
0.028112677857279778,
-0.24863043427467346,
-0.12264401465654373,
-0.05894361063838005,
0.36068522930145264,
-0.030704950913786888,
-0.08514005690813065,
-0.4606897234916687,
0.10684297978878021,
0.7894654273986816,
-0.4036737382411957,
0.045839... | |
_handle;
FileAccess _access;
bool _eof;
public HandleStream(SafeHandle handle, FileAccess access)
{
_handle = handle;
_access = access;
}
public override bool CanRead
{
get { return (_access & FileAccess.Read) != 0; }
}
public override bool CanSeek
{
... | [
0.0025671429466456175,
0.10639912635087967,
0.35973209142684937,
-0.25534453988075256,
-0.058336831629276276,
-0.07890241593122482,
0.5804051756858826,
-0.29039978981018066,
0.0636514201760292,
-0.3458612263202667,
-0.42313244938850403,
0.665729820728302,
-0.22812455892562866,
0.4143612384... | |
}
}
public override bool CanWrite
{
get { return (_access & FileAccess.Write) != 0; }
}
public override void Flush()
{
// use external buffering if you need it.
}
public override long Length
{
get { throw new NotSupportedException(); }
}
public ove... | [
0.21572627127170563,
-0.34854042530059814,
0.19000817835330963,
-0.2476634979248047,
0.36542415618896484,
-0.23104862868785858,
0.31824180483818054,
-0.4226151704788208,
-0.03694610670208931,
-0.18572263419628143,
-0.28977641463279724,
0.6805617213249207,
-0.2763492166996002,
0.17934063076... | |
Position
{
get { throw new NotSupportedException(); }
set { throw new NotSupportedException(); }
}
static void CheckRange(byte[] buffer, int offset, int count)
{
if (offset < 0 || count < 0 || (offset + count) < 0
|| (offset + count) > buffer.Length)
thro... | [
-0.19104284048080444,
-0.3716466426849365,
0.14603108167648315,
-0.23754248023033142,
0.19189982116222382,
0.24638544023036957,
-0.022304464131593704,
-0.4805256128311157,
0.08966927230358124,
-0.42063823342323303,
-0.3377445936203003,
0.33633604645729065,
0.00582625949755311,
-0.054429743... | |
new ArgumentOutOfRangeException();
}
public bool EndOfStream
{
get { return _eof; }
}
public override int Read(byte[] buffer, int offset, int count)
{
CheckRange(buffer, offset, count);
int result = ReadFileNative(_handle, buffer, offset, count);
_eof |= result ... | [
-0.3379148244857788,
-0.2646372616291046,
0.5598297119140625,
-0.311918169260025,
0.32064422965049744,
0.21820956468582153,
0.39899104833602905,
-0.36632099747657776,
0.1916595995426178,
-0.47212424874305725,
-0.3281094431877136,
0.7519185543060303,
-0.27182239294052124,
0.0872214362025260... | |
public override void Write(byte[] buffer, int offset, int count)
{
int notUsed;
Write(buffer, offset, count, out notUsed);
}
public void Write(byte[] buffer, int offset, int count, out int written)
{
CheckRange(buffer, offset, count);
int result = WriteFileNative(_handle... | [
0.0554984025657177,
-0.1532440334558487,
0.2949289083480835,
-0.2171119749546051,
0.7074521780014038,
0.003736221930012107,
0.3979845941066742,
-0.44130393862724304,
0.14740630984306335,
-0.25593504309654236,
-0.4352892339229584,
0.7023752927780151,
-0.3800030052661896,
-0.0422633513808250... | |
= result;
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotSupportedException();
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32", SetLastErro... | [
0.22637322545051575,
-0.1648075431585312,
0.47162091732025146,
-0.16129814088344574,
0.5534982681274414,
0.032920632511377335,
0.3414606750011444,
-0.660307765007019,
0.011581570841372013,
-0.1939326971769333,
-0.3596826195716858,
0.8388457298278809,
-0.15140970051288605,
0.306527525186538... | |
lpNumberOfBytesRead, IntPtr lpOverlapped);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32.dll", SetLastError=true)]
static extern unsafe bool WriteFile(
SafeHandle hFile, byte* lpBuffer, int nNumberOfBytesToWrite,
out int lpNumberOfBytesWritten, IntPtr lpOverlapped);
uns... | [
-0.10982569307088852,
-0.09321752190589905,
0.7188888192176819,
-0.3998417556285858,
0.5623509883880615,
0.02200251631438732,
0.005871109664440155,
-0.4296765625476837,
-0.43367981910705566,
-0.10853366553783417,
-0.286695271730423,
1.0130313634872437,
-0.6935928463935852,
-0.0899070724844... | |
&buffer[0])
{
int result;
if (!WriteFile(hFile, bufAddr + offset, count, out result, IntPtr.Zero))
{
// Using Win32Exception just to get message resource from OS.
Win32Exception ex = new Win32Exception(Marshal.GetLastWin32Error()); | [
0.14469708502292633,
-0.08460413664579391,
0.36010196805000305,
-0.17396673560142517,
0.5138205289840698,
-0.08435851335525513,
0.6093255281448364,
-0.6460956931114197,
-0.049612000584602356,
-0.6150107383728027,
-0.21820661425590515,
0.6698455810546875,
-0.12082072347402573,
0.19455486536... | |
int hr = ex.NativeErrorCode | unchecked((int) 0x80000000);
throw new IOException(ex.Message, hr);
}
return result;
}
}
unsafe static int ReadFileNative(SafeHandle hFile, byte[] buffer, int offset, int count)
{ | [
-0.17120277881622314,
0.007322615943849087,
0.20842517912387848,
-0.32609811425209045,
0.13468576967716217,
0.24179188907146454,
0.44094496965408325,
-0.5056107640266418,
0.0050893425941467285,
-0.4987058639526367,
-0.1635185331106186,
0.7049855589866638,
-0.41614100337028503,
-0.001577824... | |
if (buffer.Length == 0)
return 0;
fixed (byte* bufAddr = &buffer[0])
{
int result;
if (!ReadFile(hFile, bufAddr + offset, count, out result, IntPtr.Zero))
{
Win32Exception | [
-0.18975810706615448,
-0.2736909091472626,
0.3667025566101074,
-0.3490428924560547,
0.4351302683353424,
0.28069621324539185,
-0.03770652785897255,
-0.3077828586101532,
0.015424257144331932,
-0.2752736508846283,
-0.21448402106761932,
0.7168055772781372,
-0.3305675983428955,
-0.1631486117839... | |
ex = new Win32Exception(Marshal.GetLastWin32Error());
int hr = ex.NativeErrorCode | unchecked((int) 0x80000000);
throw new IOException(ex.Message, hr);
}
return result;
}
}
}
```
`BufferedStream` can be wrapped around it for buffering if needed, but ... | [
-0.3532336354255676,
-0.11099103093147278,
0.5758033394813538,
-0.2778612971305847,
0.25209906697273254,
0.017603745684027672,
0.4865097403526306,
-0.28096988797187805,
0.07043587416410446,
-0.6084495186805725,
-0.1664600968360901,
0.676154613494873,
-0.25873640179634094,
0.059154339134693... | |
character-level buffering anyway, and only flushing on newlines.
The stream abuses `Win32Exception` to extract an error message, rather than calling `FormatMessage` itself.
Building on this stream, I was able to write a simple wrapper for console I/O:
```
static class ConsoleStreams
{
enum StdHandle
{
... | [
-0.07669518887996674,
-0.34431660175323486,
0.6771268248558044,
0.0679837316274643,
0.1572933793067932,
0.07456504553556442,
0.19398872554302216,
-0.25219693779945374,
0.11089281737804413,
-0.5396332740783691,
-0.15191006660461426,
0.7525381445884705,
-0.24287500977516174,
0.25050142407417... | |
static SafeHandle GetStdHandle(StdHandle h)
{
return new SafeFileHandle(GetStdHandle((int) h), true);
}
public static HandleStream OpenStandardInput()
{
return new HandleStream(GetStdHandle(StdHandle.Input), FileAccess.Read);
}
public static HandleStream OpenStandardOutput()
... | [
-0.26574715971946716,
-0.14033854007720947,
0.6342962384223938,
0.023097146302461624,
-0.27531102299690247,
0.1262209713459015,
0.47633063793182373,
-0.4819794297218323,
-0.2035313993692398,
-0.5504072308540344,
-0.48019883036613464,
0.5223138928413391,
-0.46540579199790955,
0.262149125337... | |
}
static TextReader _in;
static StreamWriter _out;
static StreamWriter _error;
public static TextWriter Out
{
get
{
if (_out == null)
{
_out = new StreamWriter(OpenStandardOutput()); | [
-0.43270376324653625,
-0.20780538022518158,
0.500881016254425,
-0.354785293340683,
0.22105886042118073,
0.1790153533220291,
0.38250312209129333,
-0.025187568739056587,
0.11969418823719025,
-0.6816214323043823,
-0.5714185833930969,
0.7164870500564575,
-0.5012525320053101,
0.1863114982843399... | |
_out.AutoFlush = true;
}
return _out;
}
}
public static TextWriter Error
{
get
{
if (_error == null) | [
-0.2767985761165619,
-0.11321629583835602,
0.21208541095256805,
-0.2756088972091675,
0.1567600667476654,
0.30846333503723145,
0.5993765592575073,
0.022275151684880257,
0.10330694913864136,
-0.4288006126880646,
-0.1975288987159729,
0.9665239453315735,
-0.5300620794296265,
-0.104333251714706... | |
{
_error = new StreamWriter(OpenStandardError());
_error.AutoFlush = true;
}
return _error;
}
}
public static TextReader In
{
get | [
-0.28908878564834595,
-0.24627789855003357,
0.4497426450252533,
-0.048760995268821716,
0.21003031730651855,
0.040693361312150955,
0.5063451528549194,
0.21622630953788757,
0.11054003983736038,
-0.8058509826660156,
-0.5657366514205933,
0.8921935558319092,
-0.4294549524784088,
0.1725956350564... | |
{
if (_in == null)
_in = new StreamReader(OpenStandardInput());
return _in;
}
}
}
```
The final result is that writing to the console output after the other end of the pipe has terminated the connection, results in a nice exception with the message:
> The pipe is b... | [
-0.1259998381137848,
0.033062998205423355,
0.586124837398529,
-0.10916250944137573,
0.2672307789325714,
-0.05270173028111458,
0.3336923122406006,
0.08589238673448563,
0.16985401511192322,
-0.6754265427589417,
-0.2213684618473053,
0.5622531175613403,
-0.31619152426719666,
0.3461496233940124... | |
at the outermost level, it looks like I'm good to go. | [
0.34694141149520874,
0.22359183430671692,
0.5008599162101746,
-0.252332478761673,
0.38923555612564087,
-0.28099218010902405,
0.3548769950866699,
0.1481967568397522,
-0.19515909254550934,
-0.6454834342002869,
0.009350020438432693,
0.4143902659416199,
0.4881589114665985,
-0.09912600368261337... | |
In your object-oriented language, what guidelines do you follow for grouping classes into a single file? Do you always give each class a seperate file? Do you put tightly coupled classes together? Have you ever specified a couple of implementations of an interface in one file? Do you do it based on how many lines of co... | [
0.26971396803855896,
-0.12538257241249084,
-0.48040536046028137,
0.39647090435028076,
-0.2798721492290497,
-0.0020117710810154676,
0.16609543561935425,
-0.055589549243450165,
-0.3172348737716675,
-0.5711151361465454,
-0.09539202600717545,
0.3981165289878845,
-0.37887951731681824,
0.0632458... | |
in the file. For example, a nested class in C# would remain in the parent classes file, but utility classes that *might* be useful elsewhere get broken into their own file or even namespace.
The key is to understand your environment and where people will look for things. If there is an established methodology in place... | [
0.2399035096168518,
-0.009806144051253796,
-0.41806259751319885,
0.469361275434494,
0.08725305646657944,
-0.42041337490081787,
0.4158760607242584,
-0.05033251643180847,
-0.43402299284935,
-0.6944303512573242,
-0.4065338969230652,
0.1762315183877945,
-0.10006880015134811,
0.1247657090425491... | |
files rather than less is version control. If you make a small change, it should change only a small file where possible. If you make a sweeping change, it is obvious looking at the logs because of all the files (and indirectly, classes) that were affected are noted. | [
0.34098386764526367,
-0.135080486536026,
0.194318488240242,
0.35579222440719604,
0.06666570156812668,
-0.4732934832572937,
0.18507586419582367,
0.04715808108448982,
-0.7552357912063599,
-0.7555980086326599,
-0.16490298509597778,
0.44619685411453247,
-0.13512350618839264,
0.3832455277442932... | |
A new client of mine has a small VB/Access database application written in 2002 that he wants rewritten to bring it more up to date and to support new features he has been wanting for some time. So, I'm going to convert it over to use C#.NET 2008 and SQL Server Express 2008 on the local machine with the ability to scal... | [
-0.06347645819187164,
0.20608098804950714,
0.6722322106361389,
-0.12515191733837128,
-0.11505763232707977,
0.005891828797757626,
0.03386865183711052,
0.0877479687333107,
-0.4848642647266388,
-0.6599260568618774,
0.37815505266189575,
0.6322758793830872,
-0.3434639573097229,
0.27286785840988... | |
done this through the use of triggers and stored procedures, and it is a pain in the @!#$.
I have had an itch lately to mess with the Change Data Capture features of SQL Server 2008. During my initial hour of playing with it, I realized that it creates a job in SQL Agent that by default runs every 5 seconds. It also s... | [
0.29140782356262207,
0.09472908079624176,
0.22618277370929718,
-0.09816288948059082,
0.03652000054717064,
-0.20428065955638885,
0.20766381919384003,
-0.10540018230676651,
-0.14174090325832367,
-0.4435512125492096,
0.4214995205402374,
0.4188951253890991,
-0.29311349987983704,
-0.07489479333... | |
this overkill for a small desktop application that might or might not eventually migrate over to a remote server?
2. What should I expect in terms of performance? As his database size increases, am I going to get more calls from him saying that his computer is running slow?
3. Are there any other gotchas with CDC that ... | [
0.15630488097667694,
0.2079899162054062,
0.2477208524942398,
0.5166229605674744,
0.07598473131656647,
-0.3039654493331909,
0.2481464147567749,
0.42064741253852844,
-0.349094957113266,
-0.6281147003173828,
0.5079230070114136,
0.3643425703048706,
-0.16187573969364166,
0.21051907539367676,
... | |
edition. so if you have express you can't use it and you'll have to remain with triggers. | [
0.009418303146958351,
-0.2547161281108856,
0.4557553827762604,
0.22005267441272736,
-0.0991111770272255,
-0.37402504682540894,
-0.19669972360134125,
-0.15733224153518677,
0.0808505117893219,
-0.4789070188999176,
-0.07064762711524963,
0.2638707160949707,
-0.6802420616149902,
-0.304011523723... | |
For some reason I can't save a Time to MySQL. My Column is a datetime and I've also tried using a timestamp when I was testing. Here's my console session below:
```
$ ./script/console
Loading development environment (Rails 2.1.0)
>> Event.find 1
# Event id: 1, name: "Meeting at XXX", start_date: "2009-01-17"
>> e.sta... | [
-0.1790883094072342,
0.16337844729423523,
0.35819652676582336,
0.061274267733097076,
-0.34603652358055115,
-0.25376346707344055,
0.2814081907272339,
0.08618397265672684,
-0.05715853348374367,
-0.8344107866287231,
0.4528704583644867,
0.3175770044326782,
-0.4026331603527069,
0.26418188214302... | |
use it and you'll have to remain with triggers. | [
0.5437862873077393,
0.020924841985106468,
-0.05120282620191574,
0.28152215480804443,
-0.013059360906481743,
-0.378032386302948,
0.22244209051132202,
-0.4484017491340637,
0.02246977761387825,
-0.21959362924098969,
0.09425737708806992,
0.5143139958381653,
-0.34558141231536865,
-0.14081674814... | |
I have installed:
* Visual C# 2008 Express
* Visual Web Developer 2008 Express
* Visual Studio 2008
* SQL Server 2008 Express
* SQL Server Management Studio
In Visual C# 2008 Express, I can "Add Item" and create a "Local Database" (.sdf file) or a "Service Based Database" (.mdf file).
Visual Studio 2008 is the same ... | [
-0.42841678857803345,
0.3369455635547638,
0.32265111804008484,
-0.13074111938476562,
-0.6726469993591309,
0.04334578290581703,
0.23152117431163788,
-0.11457093805074692,
-0.10283602774143219,
-0.8568978905677795,
0.18613934516906738,
0.4900510609149933,
-0.29904404282569885,
-0.15394012629... | |
create a SQL CE database.
Questions:
* why the discrepency between the applications, is this normal or did something go wrong with my installations?
* I never "installed SQL CE", where did it come from and how is it that I am able to create .sdf file?
* How do you work with these in projects on a day to day basis, do... | [
0.6811294555664062,
0.3638051450252533,
0.16101190447807312,
0.3002808392047882,
-0.2498473972082138,
-0.28686603903770447,
-0.07180644571781158,
0.01701543480157852,
-0.18824008107185364,
-0.6674015522003174,
0.052641361951828,
0.38743793964385986,
-0.3047217130661011,
0.28083717823028564... | |
see an option to exclude it.
Personally I use VS 2008 to add items to my project databases. Since it's open anyway I just use it. It provides most of the same functionality as Management Studio. If I am doing separate database work, I usually do it in Management studio.
The CE databases are pretty useless. They have... | [
0.400064617395401,
0.3512380123138428,
0.23678818345069885,
0.20079024136066437,
-0.08976452052593231,
-0.3483262062072754,
0.006080202292650938,
0.17405898869037628,
-0.21419461071491241,
-0.8057877421379089,
0.03267970681190491,
0.2585873603820801,
-0.018065163865685463,
0.44488823413848... | |
table.
Once you create your database it must be manually added to your project.
You cannot directly create a LINQ to SQL class in VS2008 on a CE database. You need to use the command line tool sqlmetal (called from .NET console) to create the class for you.
I've had issues where the Class created for a CE database... | [
0.4214867949485779,
0.2384921759366989,
0.5414237380027771,
0.25795304775238037,
0.16761019825935364,
-0.22672155499458313,
-0.1551809310913086,
-0.04232783243060112,
-0.35749736428260803,
-0.698485791683197,
0.25448015332221985,
0.3567025363445282,
-0.3383801281452179,
0.20774520933628082... | |
a great self-contained database not requiring any type of external engine.
Sorry I don't have any performance statistics for an SQL CE database.
I hope this is somewhat helpful.
Brett | [
0.29005861282348633,
0.34451064467430115,
-0.2531864643096924,
0.5479568243026733,
0.19909627735614777,
-0.3267683982849121,
0.13607251644134521,
0.21614527702331543,
0.005444621667265892,
-0.6483441591262817,
0.16340191662311554,
0.38206514716148376,
0.1327662318944931,
-0.092384383082389... | |
I've written a class with a single static method that copies property values from one object to another. It doesn't care what type each object is, only that they have identical properties. It does what I need, so I'm not engineering it further, but what improvements would you make?
Here's the code:
```
public class S... | [
0.4872259199619293,
-0.05860332027077675,
0.17493678629398346,
0.11605348438024521,
0.3178918957710266,
-0.09749981015920639,
-0.09376200288534164,
-0.06661585718393326,
0.11282022297382355,
-0.5759669542312622,
0.4224776327610016,
0.6765364408493042,
-0.21452617645263672,
0.51666396856307... | |
to.GetType();
foreach (var propertyInfo in from.GetType().GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance))
{
toType.GetProperty(propertyInfo.Name).SetValue(to, propertyInfo.GetValue(from, null), null);
}
}
}
```
I'm using it as follows:
``... | [
0.1258084625005722,
-0.043475858867168427,
0.6452268362045288,
-0.061275701969861984,
-0.02057923562824726,
0.017398755997419357,
0.1701134592294693,
-0.31304553151130676,
-0.06982506811618805,
-0.7453344464302063,
-0.28384578227996826,
0.52522212266922,
-0.274901419878006,
0.3328360021114... | |
copying on your DTOs that each DTO implements. | [
0.6920064687728882,
0.06234477460384369,
0.03234897926449776,
0.3691439628601074,
0.05387239530682564,
0.14445099234580994,
-0.15614503622055054,
0.17946317791938782,
-0.2868289351463318,
-0.7718607187271118,
-0.09273923933506012,
0.5126601457595825,
-0.26537007093429565,
-0.07960785925388... | |
Per version (1.0, 1.1, 2.0, 3.0, 3.5), how many classes are in the .NET framework?
I am looking for the information for a presentation that I'm going to give for a class in my Master's program.
See Brad Abrams's blog post *[Number of Types in the .NET Framework](http://blogs.msdn.com/brada/archive/2008/03/17/number-of... | [
0.39409998059272766,
0.011210036464035511,
-0.08291458338499069,
-0.09427838027477264,
-0.14611253142356873,
-0.0373227521777153,
0.43754470348358154,
0.14685574173927307,
-0.19413739442825317,
-0.6034027934074402,
-0.0056138490326702595,
0.3867877423763275,
-0.2778722941875458,
0.06550893... | |
I have this syntax which works (since it's from the API, pretty much)
```
<% form_tag :action => "whatever" do -%>
<div><%= submit_tag 'Save' %></div>
<% end -%>
```
and this, which works
```
<%= form_tag({:action => "whatever"}, {:method => "get"})%>
```
Now I have tried to combine them, guessing the sy... | [
0.09974808245897293,
0.04797253757715225,
0.5036461353302002,
-0.18945571780204773,
-0.08387088030576706,
0.004487492144107819,
0.22202050685882568,
-0.383787602186203,
-0.04245483875274658,
-0.7586674094200134,
-0.22778363525867462,
0.6132829189300537,
-0.18442319333553314,
-0.27707657217... | |
=> 'whatever'}, :method => "get") do -%>
<div><%= submit_tag 'Save' %></div>
<% end -%>
```
Looking at the [API docs](http://apidock.com/rails/ActionView/Helpers/FormTagHelper/form_tag), the issue is that `:method` needs to go in the `options` hash, and the `:action` in the `url_for_options` hash, and you need... | [
0.09957180172204971,
-0.3709237277507782,
0.29441675543785095,
-0.22877530753612518,
0.1666414737701416,
0.13291652500629425,
0.10326544940471649,
-0.5800972580909729,
-0.22000062465667725,
-0.32634827494621277,
-0.22236058115959167,
0.6742412447929382,
-0.23558878898620605,
-0.22440811991... | |
As the title suggests, I'm using Google App Engine and Django.
I have quite a bit of identical code across my templates and would like to reduce this by including template files. So, in my main application directory I have the python handler file, the main template, and the template I want to include in my main templa... | [
0.27200600504875183,
0.14817243814468384,
0.24475409090518951,
-0.12027736008167267,
-0.08631052821874619,
-0.044014062732458115,
0.27531203627586365,
-0.20857812464237213,
-0.020030613988637924,
-0.7965570688247681,
0.028872760012745857,
0.7298240661621094,
-0.4272519052028656,
-0.0633858... | |
)
```
But to no avail. I'll try some other possibilities too.
I found that it works "out of the box" if I don't load Templates first and render them with a Context object. Instead, I use the standard method shown in the [AppEngine tutorial](http://code.google.com/appengine/docs/python/gettingstarted/templates.html). | [
0.4860343635082245,
0.02396330051124096,
0.08828044682741165,
0.009379889816045761,
0.053608138114213943,
-0.05384918674826622,
0.4041021466255188,
-0.14613759517669678,
-0.25309687852859497,
-0.42292457818984985,
-0.26733967661857605,
0.7207420468330383,
-0.34778958559036255,
-0.047565005... | |
I am using asp.net MVC to develop an application that will have ajax interactions. I have JsonResult methods in the controller returning my json serialized data. So for example when a request is made to <http://somesite.com/findwidgets/> mvc serializes the data as json and sends it back.
I am using jQuery on the clien... | [
0.08798646926879883,
-0.007852637208998203,
0.5421568155288696,
-0.06057674065232277,
-0.40019524097442627,
-0.16211186349391937,
0.02306298539042473,
0.21206605434417725,
-0.31918030977249146,
-0.8802719116210938,
-0.07956158369779587,
0.4748325049877167,
-0.11945982277393341,
0.045140210... | |
download.
Also, how do i ensure that others cannot simply make requests and grab data using <http://somesite.com/findwidgets/> ?
Is cross domain the right topic here or is that speaking to other security problems?
Thanks
> Also, how do i ensure that others
> cannot simply make requests and grab
> data using
> <... | [
0.3832407295703888,
-0.12669426202774048,
0.3645818829536438,
0.44493362307548523,
0.08840618282556534,
-0.29364028573036194,
0.22704283893108368,
-0.014565698802471161,
-0.36638614535331726,
-0.6946107149124146,
-0.04044429957866669,
0.7024903297424316,
-0.07154136151075363,
0.11090220510... | |
each request and each subsequent request must pass the previously generated key for validation. A request that arrives with no key or an invalid key is denied access.
> i have found that i can make requests
> to <http://somesite.com/findwidgets/>
> from the address bar of the browser
> and it will return the json d... | [
0.15486447513103485,
0.03580775856971741,
0.5975946187973022,
0.0726291686296463,
-0.09220065176486969,
0.07686847448348999,
0.4045403003692627,
-0.07202962040901184,
0.009258163161575794,
-0.7969135642051697,
-0.5701477527618408,
0.31414124369621277,
-0.18384821712970734,
0.14359587430953... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.