text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I'm trying to create a route for the following urls:
www.mysite.com/user/username
www.mysite.com/user/username/pictures
I tried doing that with the following code:
```
routes.MapRoute(
"UserProfile",
"user/{sn}/{action}",
new { controller = "User", action = "Index", sn = "" }
... | [
0.29117465019226074,
-0.0602613128721714,
0.3963380455970764,
0.06544052809476852,
-0.020912766456604004,
-0.0889720544219017,
0.23752649128437042,
0.1205768883228302,
-0.404854953289032,
-0.92451411485672,
0.2424796223640442,
-0.026462417095899582,
-0.3872573971748352,
0.10689917951822281... | |
quite sure why you want to overload > and < in this case, but perhaps I don't quite understand the question. It looks like you intend to have several different kinds of tree nodes, all of which inherit from `DataType`. If that is the case, simply add a const member function to the `DataType` base class:
```
class Data... | [
-0.32633206248283386,
-0.17863351106643677,
0.1581060141324997,
0.13001418113708496,
0.22165347635746002,
-0.09165278822183609,
0.14685869216918945,
-0.14233121275901794,
-0.256544291973114,
-0.5465441346168518,
-0.07587912678718567,
0.6313997507095337,
-0.45785781741142273,
0.436194747686... | |
// ...
virtual ~DataType();
};
```
Now, in your `findID` loop, you can simply use:
```
while (!found && locptr != 0)
{
if (locptr->data.id() > id)
{
locptr = locptr->left;
}
else if (locptr->data.id() < id)
{
locptr = locptr->right;
}
else
{
found = tru... | [
-0.1099919006228447,
-0.34484076499938965,
0.7173245549201965,
-0.24397526681423187,
0.6064406633377075,
-0.236472949385643,
-0.11298913508653641,
-0.4431614875793457,
-0.05089425668120384,
-0.46034422516822815,
-0.36405181884765625,
0.696524441242218,
0.04416103661060333,
-0.0271953791379... | |
}
}
```
And you don't have to go through all of the unnecessary hassle of operator overloading. | [
0.3058411777019501,
0.40540167689323425,
-0.06955724209547043,
0.07145596295595169,
0.3968358337879181,
-0.2542150616645813,
-0.034265805035829544,
0.2748076021671295,
-0.012504386715590954,
-0.46649906039237976,
-0.17531579732894897,
0.7855333685874939,
-0.13545116782188416,
0.11130574345... | |
I recently started using vim 7 (previously vim 6) and the `smartindent` setting. For the most part, it works well, though I'm so used to typing a tab after an open brace that it is almost counter-productive.
However, there is one piece of maniacal behaviour. When editing a shell script, I try to create a comment at th... | [
0.38005805015563965,
0.06399379670619965,
0.4435054361820221,
-0.32134971022605896,
-0.18212836980819702,
-0.11402779072523117,
0.6170359253883362,
0.1530008465051651,
0.0870465338230133,
-0.3685328960418701,
-0.15386180579662323,
0.7316916584968567,
-0.32903334498405457,
0.163304135203361... | |
I'd like to know what's the best way to fix it?
(I'm also not keen on `smartindent`'s ideas about indenting `then` after `if`.)
Preferred solutions will save me manual bashing - I'm being lazy. One option would be 'turn off `smartindent` when editing shell scripts (leave it on for the rest)'. Another option would be ... | [
0.08359398692846298,
-0.09020128101110458,
0.3783389925956726,
0.1638190895318985,
0.21346788108348846,
0.05867503955960274,
0.2587467133998871,
0.2505381405353546,
-0.11819712817668915,
-0.6002309322357178,
-0.01931288279592991,
1.1159313917160034,
-0.1129123643040657,
0.02660274133086204... | |
sanity) is to leave `smartindent` unset.
I saw the vaguely related question on "[(PHP and) annoying vim unindent rules](https://stackoverflow.com/questions/313359/annoying-vim-unindent-rules)"; it doesn't provide me with the direct answer, though maybe the `cindent` and related items mentioned in there are in fact par... | [
0.020331263542175293,
-0.1552017629146576,
0.6119609475135803,
0.3648853600025177,
-0.02113863080739975,
0.027187621220946312,
0.3661171495914459,
-0.017603065818548203,
-0.18963120877742767,
-0.07639483362436295,
0.0885087177157402,
0.580703854560852,
-0.2599741220474243,
0.45600780844688... | |
completely wrong, Check out:
[Restoring indent after typing hash](http://vim.wikia.com/wiki/Restoring_indent_after_typing_hash)
or
[howto-configure-vim-to-not-put-comments-at-the-beginning-of-lines-while-editing](https://stackoverflow.com/questions/354097/howto-configure-vim-to-not-put-comments-at-the-beginning-of-l... | [
0.008362502790987492,
0.1445614993572235,
0.2325054556131363,
-0.01981322467327118,
0.15895171463489532,
-0.18874597549438477,
0.5930778384208679,
0.1383020132780075,
-0.24991029500961304,
-0.3108179569244385,
-0.33649900555610657,
0.5508886575698853,
-0.2133425772190094,
0.016485672444105... | |
I am writing a simple application that lets a user upload images. After the upload, the user can tag them or remove them.
I figured out how to upload the files and save them once the files are uploaded. I am keeping tracking of a global path where images are kept. In the database I keep the meta data about the images ... | [
0.7061172723770142,
-0.08105122298002243,
0.2888384461402893,
0.15724483132362366,
0.031041262671351433,
-0.0610111728310585,
0.0628865584731102,
0.13762260973453522,
-0.3306342661380768,
-0.7699680328369141,
0.2808624505996704,
0.6071146726608276,
-0.38641199469566345,
-0.0312610007822513... | |
server. One main web application and other one is the where I upload the images.
But this does not work as I can not see the uploaded images in the main application until I redeploy/restart Tomcat.
It seems like Tomcat does not pick newly uploaded images automatically.
Does anyone have any solutions?
This is a simp... | [
0.28746941685676575,
-0.055841512978076935,
0.482073575258255,
0.18715766072273254,
-0.3245203495025635,
-0.060181599110364914,
0.4002164602279663,
0.22032685577869415,
-0.5760906934738159,
-0.6557319164276123,
0.270730197429657,
0.5287742018699646,
-0.27062246203422546,
0.0849242284893989... | |
allow you to store the image just about anywhere.
Since you are using two tomcat applications, your best bet may be to store the images outside of either app and stream the image back to the user instead of letting tomcat manage the files. Otherwise, I would ask why you are trying to do this with two web apps. | [
0.46750620007514954,
-0.17003504931926727,
0.24394556879997253,
0.4640836715698242,
0.3072960376739502,
-0.09135794639587402,
0.004740462172776461,
0.135273739695549,
-0.33858948945999146,
-0.795325756072998,
-0.021147219464182854,
0.6392715573310852,
-0.2870410978794098,
-0.04011636599898... | |
The question has been asked: [No PHP for large projects? Why not?](https://stackoverflow.com/questions/385203/no-php-for-large-projects-why-not) It's a recurring theme and PHP developers--with some cause--are forced to [defend PHP](https://stackoverflow.com/questions/309300/defend-php-convince-me-it-isnt-horrible).
Al... | [
0.4832349419593811,
0.3842920660972595,
-0.050196573138237,
0.10039660334587097,
-0.35555553436279297,
-0.05269836634397507,
0.33690783381462097,
0.12158994376659393,
-0.412521094083786,
-0.234450563788414,
0.03223859518766403,
0.30294331908226013,
-0.16385114192962646,
0.2559553384780884,... | |
application?
EDIT: While I appreciate that the organizational aspects are important, they apply to **any** large project. What I'm primarily aiming for here is technical guidance and how to deal with common issues of scalability. Using an opcode cache like APC is an obvious starter. Cluster-aware sessions would be ano... | [
0.19813059270381927,
0.20090968906879425,
0.1558295041322708,
0.2766016721725464,
-0.05672143027186394,
-0.261518657207489,
0.2810894548892975,
-0.09714563935995102,
-0.2466028928756714,
-0.6064735651016235,
-0.1275666356086731,
0.3683954179286957,
-0.37460124492645264,
-0.2387389242649078... | |
that, by itself, is pretty quick-and-dirty. Nevertheless, it still has many advantages for large-scale web apps. You'll just need to know how to add in some level of infrastructure to avoid a lot of the common web programming blunders. See - [What should a developer know *before* building a public web site](https://sta... | [
0.5353591442108154,
0.14004771411418915,
-0.0710650384426117,
0.3924429416656494,
0.08331069350242615,
-0.4565393328666687,
0.095655657351017,
-0.01969415508210659,
-0.33274179697036743,
-0.4623572826385498,
0.12034144997596741,
0.6948272585868835,
0.07833953201770782,
0.002566262148320675... | |
should learn about evil things like register\_globals and why you should never ever use them. In short, you should **do your homework** about your tool before just diving in for a real-world, large-scale, web app.
Once you are educated, it comes down to you'll probably want to build a framework or use a preexisting fr... | [
0.4283938407897949,
0.15704968571662903,
-0.06027538701891899,
0.32558029890060425,
0.011000349186360836,
-0.42287927865982056,
0.46198543906211853,
-0.04168694466352463,
-0.1034001037478447,
-0.35623958706855774,
0.11143668740987778,
0.6063233613967896,
-0.13640093803405762,
-0.1686851680... | |
If you have a pending operation, eg
```
stream.BeginRead(_buffer, 0, _buffer.Length, _asyncCallbackRead, this);
```
and you close the stream provider, eg
```
serialPort.Close();
```
you unsurprisingly cause an exception.
Is there an preferred method by which one might cancel a pending APM operation, prior to cl... | [
0.18618814647197723,
0.3412112593650818,
0.7637280225753784,
0.028926508501172066,
0.3115452527999878,
-0.025598835200071335,
0.12149906903505325,
0.10818740725517273,
-0.20317625999450684,
-0.25621628761291504,
-0.22825323045253754,
0.802837073802948,
-0.24233928322792053,
0.3102675080299... | |
with an underscore is a class private member assigned in the constructor of DeviceSession.
The constructor also provides the initial call to `_stream.BeginRead`.
```
void ReadStream(IAsyncResult ar)
{
if (IsOpen)
try
{
DevicePacket packet;
int cbRead = _stream.EndRead(ar);
_endOfValidDat... | [
-0.011103961616754532,
0.10919883102178574,
0.6926155686378479,
-0.42714428901672363,
0.22214418649673462,
0.1967097967863083,
0.2085191309452057,
-0.6454421877861023,
-0.163405641913414,
-0.5092034339904785,
-0.21913067996501923,
0.2550644874572754,
-0.4397898316383362,
0.4215382933616638... | |
_asyncCallbackRead, null);
}
catch (Exception ex)
{
Trace.TraceError("{0}\r\n{1}", ex.Message, ex.StackTrace);
_restart(_streamProvider, _deviceId);
}
}
```
Notice that I haven't bothered to set `ar.AsyncState`. Because the callback delegate refers to the method of a specific instance of D... | [
-0.026229217648506165,
0.05289922282099724,
0.47354161739349365,
-0.23825626075267792,
0.2957497835159302,
-0.12965787947177887,
0.565248966217041,
-0.17422369122505188,
-0.30421411991119385,
-0.374148428440094,
-0.42369115352630615,
0.6072574257850647,
-0.2315238118171692,
0.3154399991035... | |
stream provider triggers the callback but attempting to invoke EndRead results in an `IOException`.
Generally such an exception indicates a fault requiring a listener restart and one will want to respond by restarting the stream provider and recreating the session. This is complicated by the absence of a reliable str... | [
-0.16224141418933868,
-0.10918163508176804,
0.22942224144935608,
-0.024513477459549904,
0.12105756253004074,
-0.2628762722015381,
0.3355315923690796,
0.023676564916968346,
-0.10226718336343765,
-0.4007479250431061,
-0.5378479957580566,
0.8843676447868347,
-0.27006787061691284,
0.1193241924... | |
smoothly complete the final abortive execution of `ReadStream`.
If `IsOpen` is `true` then an `IOException` represents a failure in need of recovery. If `IsOpen` is `false` the failure was deliberately induced and no action is required.
This is not directly supported in the framework. Your best bet is to write a wrapp... | [
0.008966837078332901,
-0.20714658498764038,
0.0808444395661354,
0.2574056386947632,
0.40790265798568726,
-0.4044674038887024,
0.39344286918640137,
0.10121528804302216,
-0.1260954588651657,
-0.5745555758476257,
-0.20894533395767212,
0.39888206124305725,
0.013725359924137592,
0.1231773495674... | |
I want to execute something in a linux shell under a few different conditions, and be able to output the execution time of each execution.
I know I could write a perl or python script that would do this, but is there a way I can do it in the shell? (which happens to be bash)
Use the built-in `time` keyword:
```
$ he... | [
0.5339870452880859,
0.04963938146829605,
0.00027780234813690186,
-0.1364579200744629,
0.2764679491519928,
-0.15296289324760437,
0.3424864411354065,
0.14786680042743683,
0.060673993080854416,
-0.6416019201278687,
-0.01688775233924389,
0.9444025754928589,
-0.13971219956874847,
-0.23220202326... | |
the return status of PIPELINE. The `-p' option
prints the timing summary in a slightly different format. This uses
the value of the TIMEFORMAT variable as the output format.
```
Example:
```
$ time sleep 2
```
```
real 0m2.009s
user 0m0.000s
sys 0m0.004s
``` | [
0.4623371362686157,
-0.3476521670818329,
0.28813472390174866,
-0.25458887219429016,
0.41038429737091064,
0.2236219346523285,
0.10402439534664154,
-0.13502119481563568,
0.1908484548330307,
-0.5255870819091797,
-0.10258027911186218,
0.8511762619018555,
-0.15312297642230988,
0.019948430359363... | |
Mostly for my amusement, I created a `makefile` in my `$HOME/bin` directory called `rebuild.mk`, and made it executable, and the first lines of the file read:
```
#!/bin/make -f
#
# Comments on what the makefile is for
...
all: ${SCRIPTS} ${LINKS} ...
...
```
I can now type:
```
rebuild.mk
```
and this causes ... | [
0.5233529210090637,
0.14593718945980072,
-0.019013796001672745,
-0.2333574742078781,
0.16695153713226318,
0.0072058578953146935,
0.45678892731666565,
-0.35834306478500366,
-0.11325570940971375,
-0.47179242968559265,
-0.17081767320632935,
0.6539585590362549,
-0.31400197744369507,
0.17443053... | |
used in Debian; that is interesting to know. Thank you.
2. I agree that typing 'make' is more idiomatic.
3. However, the scenario (previously unstated) is that my $HOME/bin directory already has a cross-platform main makefile in it that is the primary maintenance tool for the 500+ commands in the directory.
4. However,... | [
0.4035343825817108,
0.007270462345331907,
-0.07805502414703369,
-0.20644809305667877,
-0.04021390527486801,
-0.2309013456106186,
0.22564780712127686,
-0.15820474922657013,
-0.17031535506248474,
-0.5803091526031494,
0.0073676202446222305,
0.6094262599945068,
-0.339887797832489,
0.0584841854... | |
'`rebuild.mk`' instead.
6. Fixing the position of the `make` utility is problematic across platforms.
7. The `#!/usr/bin/env make -f` technique is likely to work, though I believe the official rules of engagement are that the line must be less than 32 characters and may only have one argument to the command.
8. @dF com... | [
0.49631932377815247,
0.021318184211850166,
0.45497921109199524,
-0.3645711839199066,
-0.1899271011352539,
0.33280518651008606,
0.45917803049087524,
-0.37203437089920044,
0.049185119569301605,
-0.6459329724311829,
-0.21786561608314514,
0.6839130520820618,
0.0012932474492117763,
0.1447020769... | |
version) and targets 'someprogram' and macros CC='cc' WFLAGS=-v (to use a different compiler and cancel the GCC warning flags which the Sun compiler does not understand).
### I would not advocate this as a general technique.
As stated, it was mostly for my amusement. I may keep it for this particular job; it is most ... | [
0.3515274226665497,
-0.008406075648963451,
0.3772618770599365,
-0.18951882421970367,
-0.1228385791182518,
-0.2623211443424225,
0.3500189185142517,
0.20631512999534607,
-0.05557648092508316,
-0.6676173210144043,
-0.05583623796701431,
0.7332137227058411,
-0.6874386668205261,
0.23638184368610... | |
('Programming Perl' by Larry Wall).
One problem with this for generally distributable Makefiles is that the location of `make` is not always consistent across platforms. Also, some systems might require an alternate name like `gmake`.
Of course one can always run the appropriate command manually, but this sort of defe... | [
0.5522873401641846,
0.002177452202886343,
-0.14181749522686005,
-0.023150894790887833,
0.1603008508682251,
-0.19294463098049164,
0.42874765396118164,
-0.02543875388801098,
-0.006466553080826998,
-0.22708292305469513,
-0.3297400176525116,
0.30390745401382446,
-0.39606255292892456,
0.2150016... | |
How do I extract a double value from a string using regex.
```
import re
pattr = re.compile(???)
x = pattr.match("4.5")
```
Here's the easy way. Don't use regex's for built-in types.
```
try:
x = float( someString )
except ValueError, e:
# someString was NOT floating-point, what now?
``` | [
-0.026792583987116814,
0.13029295206069946,
0.44972947239875793,
-0.21480794250965118,
-0.027057094499468803,
-0.048533305525779724,
0.2830699682235718,
-0.3569525480270386,
-0.06998112052679062,
-0.09242674708366394,
0.006646543741226196,
0.4951826333999634,
-0.42720896005630493,
-0.24429... | |
I'm working a piece of code to turn phone numbers into links for mobile phone - I've got it but it feels really dirty.
```
import re
from string import digits
PHONE_RE = re.compile('([(]{0,1}[2-9]\d{2}[)]{0,1}[-_. ]{0,1}[2-9]\d{2}[-_. ]{0,1}\d{4})')
def numbers2links(s):
result = ""
last_match_index = 0
... | [
0.1257745623588562,
0.25626835227012634,
0.7799913883209229,
-0.3102041780948639,
-0.04423477500677109,
0.0732976570725441,
0.5807686448097229,
-0.4497591555118561,
-0.21957439184188843,
-0.8317849040031433,
-0.15194562077522278,
0.5124269723892212,
-0.4531235992908478,
0.31952452659606934... | |
result += s[last_match_index:match.start()] + call
last_match_index = match.end()
result += s[last_match_index:]
return result
>>> numbers2links("Ghost Busters at (555) 423-2368! How about this one: 555 456 7890! 555-456-7893 is where its at.")
'Ghost Busters at <a href="tel:5554232368">(555) 423-236... | [
-0.219931960105896,
-0.021161817014217377,
0.7325835227966309,
-0.04981743544340134,
-0.16804476082324982,
0.06437809020280838,
0.40797287225723267,
-0.3433421850204468,
-0.23974134027957916,
-0.5231593251228333,
0.11058492958545685,
0.44451195001602173,
-0.32146430015563965,
0.12324002385... | |
my regex - I realize that it's limited. Instead I'm wondering if anyone had any comments on the method of substiting in links for the phone numbers - is there anyway I could use `re.replace` or something like that instead of the string hackery that I have?
Nice first take :) I think this version is a bit more readable ... | [
0.18721573054790497,
0.05637509375810623,
0.7702197432518005,
-0.1611730307340622,
0.20173513889312744,
-0.16083887219429016,
0.7578660845756531,
-0.32330965995788574,
-0.38606318831443787,
-0.6266917586326599,
-0.39624854922294617,
0.8789324164390564,
-0.5055878758430481,
0.05255864933133... | |
raw_number = mo.group()
number = NON_NUMERIC.sub("", raw_number)
return '<a href="tel:%s">%s</a>' % (number, raw_number)
return PHONE_RE.sub(makelink, s)
print numbers2links("Ghost Busters at (555) 423-2368! How about this one: 555 456 7890! 555-456-7893 is where its at.")
```
A note: In my practice,... | [
0.06683094054460526,
-0.025828320533037186,
0.31797921657562256,
0.03446149453520775,
0.09125664085149765,
0.08611209690570831,
0.6915693283081055,
-0.24984410405158997,
-0.30506956577301025,
-0.6246205568313599,
-0.05059697851538658,
0.6782851815223694,
-0.28252869844436646,
-0.1661302000... | |
each character to see if it's in `string.digits` with another `re.sub()` because I think my version is more readable, not because I'm certain it performs better (although it might). | [
-0.02332473173737526,
0.06459883600473404,
0.17896109819412231,
-0.11033681780099869,
-0.05226510390639305,
0.2752823531627655,
0.15655475854873657,
-0.060781627893447876,
0.026708438992500305,
-0.5543456077575684,
-0.38004156947135925,
0.20547418296337128,
0.04824380949139595,
-0.06852423... | |
We have a table, name *'employeeReg'* with fields
```
employeeNo | employeeName | Registered_on
```
Here *Registered\_on* is a timestamp.
We require an hourly pattern of registrations, over a period of days. eg.
> 01 Jan 08 : 12 - 01 PM : 1592 registrations
>
>
> 01 Jan 08 : 01 - 02 PM : 1020 registrations
Can ... | [
0.31045252084732056,
0.2904433310031891,
0.44613537192344666,
0.2266862541437149,
0.06778135895729065,
-0.2502540051937103,
0.09659824520349503,
-0.10576337575912476,
-0.1340266466140747,
-0.6239815950393677,
-0.04895526170730591,
0.25494012236595154,
0.16265568137168884,
0.199860900640487... | |
many SQL questions - the table name was not given originally!*)
The basic technique will be to find a function that will format the varied Registered\_on values such that all the entries in a particular hour are grouped together. This presumably can be done with `TO_CHAR()` since we're dealing with Oracle (MySQL does ... | [
0.14452257752418518,
0.18646816909313202,
0.3532942235469818,
0.09752631932497025,
0.029873378574848175,
0.058152709156274796,
0.11646858602762222,
-0.08788365125656128,
-0.20656058192253113,
-0.4215306341648102,
-0.3679376244544983,
0.47914665937423706,
-0.18942728638648987,
0.14568796753... | |
expression; however, for reasons of backwards compatibility, it is likely that this will work as written (but I cannot verify that for you on Oracle - an equivalent works OK on IBM Informix Dynamic Server using `EXTEND(Registered_on, YEAR TO HOUR)` in place of `TO_CHAR()`).
If you then decide you want zeroes to appear... | [
0.3370686173439026,
0.013323916122317314,
0.18317314982414246,
-0.0804896205663681,
0.24711968004703522,
-0.06776703894138336,
0.29111555218696594,
-0.06372875720262527,
-0.07472170144319534,
-0.26337987184524536,
-0.1173955425620079,
0.4823910593986511,
-0.23272091150283813,
0.04933792725... | |
correct list - different DBMS have different ways of doing it. | [
0.014748545363545418,
-0.18448013067245483,
0.32744482159614563,
0.1932990550994873,
-0.001661136164329946,
-0.15119099617004395,
0.2676985263824463,
-0.20676375925540924,
-0.3138902485370636,
-0.3553578853607178,
-0.3687182068824768,
0.42719072103500366,
-0.22884051501750946,
-0.139944270... | |
How can I tell unix "find" to include in it's recursive search a folder which is softlinked?
-L . This causes it to follow all symbolic (I assume this is what you mean by soft) links. | [
-0.19006220996379852,
-0.10242205113172531,
0.22411859035491943,
-0.045880917459726334,
0.28251397609710693,
-0.34967198967933655,
-0.17345070838928223,
0.4741972088813782,
-0.15008781850337982,
-0.5601411461830139,
-0.3034484386444092,
0.618390679359436,
-0.11493558436632156,
-0.131378978... | |
I have a MS SQL table that I don't have any control over and I need to write to. This table has a int primary key that isn't automatically incremented. I can't use stored procs and I would like to use Linq to SQL since it makes other processing very easy.
My current solution is to read the last value, increment it, tr... | [
0.16681256890296936,
-0.04278271645307541,
0.46314042806625366,
0.0862409844994545,
0.25362205505371094,
-0.021366704255342484,
0.16913551092147827,
-0.2546563148498535,
-0.2794714868068695,
-0.6973812580108643,
0.23314973711967468,
0.6270744800567627,
-0.22493578493595123,
0.4563874304294... | |
};
dc.Logs.InsertOnSubmit(newEntity);
const int maxRetries = 10;
int retries = 0;
bool success = false;
while (!success && retries < maxRetries)
{
try
{ | [
0.1780099868774414,
-0.3170064687728882,
0.3480316996574402,
-0.13141581416130066,
0.6026262640953064,
0.10005055367946625,
0.6859395503997803,
-0.2960144579410553,
-0.2694450318813324,
-0.21269316971302032,
-0.4770074784755707,
0.6225394010543823,
-0.20417167246341705,
0.23147495090961456... | |
dc.SubmitChanges();
success = true;
}
catch (SqlException)
{
retries++;
newEntity.ID = dc.Logs.Max(l => l.ID);
}
}
if (retries >= maxRetries)
{
throw new Exception("Bummer...");
}
```
Does anyone have a better | [
0.37661173939704895,
-0.41154247522354126,
0.23487962782382965,
0.21691830456256866,
0.09156101197004318,
-0.09397371858358383,
0.35836488008499146,
-0.37825918197631836,
-0.4614833891391754,
-0.33047446608543396,
-0.09207911789417267,
0.44882863759994507,
-0.3244614601135254,
0.2059019505... | |
solution?
EDIT: Thanks to [Jon](https://stackoverflow.com/questions/385809/correctly-incrementing-values-using-linq-to-sql#385814), I simplified the max ID calculation. I was still in SQL thinking mode.
That looks like an expensive way to get the maximum ID. Have you already tried
```
var maxId = dc.Logs.Max(s => s.I... | [
0.2634912133216858,
0.07778339087963104,
0.4560246169567108,
0.14082717895507812,
0.38377615809440613,
0.07138694822788239,
0.29879310727119446,
-0.3295575678348541,
-0.13781239092350006,
-0.44208410382270813,
0.1212012991309166,
0.5064971446990967,
-0.187902569770813,
-0.18572364747524261... | |
Of all these methods what's being run and in what order??
I guess the first question to ask is whats being run first?
**And why does th.start() start run()?**
```
import java.applet.*;
import java.awt.*;
import javax.swing.JFrame;
public class BallApplet extends Applet implements Runnable {
int x_pos = 10;
... | [
0.227702796459198,
-0.12085620313882828,
0.30337291955947876,
-0.11794476956129074,
-0.10088042914867401,
0.1764398068189621,
0.22511470317840576,
-0.23472978174686432,
-0.16841977834701538,
-0.8005746006965637,
-0.2812005877494812,
0.5709775686264038,
-0.5788849592208862,
0.10801788419485... | |
Thread th = new Thread (this);
th.start();
}
public void stop() {}
public void destroy() {}
public void run() {
// 20 second delay per frame refresh (animation doesn't
// need to be perfectly continuous)
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
... | [
0.4100934565067291,
-0.3370874226093292,
0.6927466988563538,
-0.0628359392285347,
0.3144374489784241,
0.13971616327762604,
0.40397879481315613,
-0.0071163722313940525,
-0.4478261470794678,
-0.401739239692688,
-0.3317922055721283,
0.5720843076705933,
-0.25042393803596497,
0.6810649037361145... | |
x_pos++;
repaint();
try {
Thread.sleep(20);
}
catch (InterruptedException ex) {
System.out.println("Caught!"); | [
-0.00898386724293232,
-0.5292478799819946,
0.27025410532951355,
-0.33420661091804504,
0.44967612624168396,
0.14636309444904327,
0.4342256784439087,
0.043272633105516434,
-0.3469112813472748,
-0.5892571806907654,
-0.24753285944461823,
0.3887532949447632,
-0.40723833441734314,
0.278241395950... | |
}
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
}
}
public void update(Graphics g) {
// implements double buffering
// drawing on doublebufferImage, note the dbG=dbImage.getGraphics(), so everything dbG.whatever() is
// drawing on the Image's graphics ... | [
0.1618819534778595,
-0.33867138624191284,
0.577248215675354,
-0.2849409282207489,
0.016333946958184242,
0.18220588564872742,
0.01895413175225258,
-0.10707715153694153,
-0.18790410459041595,
-0.6055290102958679,
-0.08865884691476822,
0.5906631946563721,
-0.5917600393295288,
0.07768360525369... | |
if (dbImage == null) {
dbImage = createImage (this.getSize().width, this.getSize().height);
dbG = dbImage.getGraphics();
}
// clear screen in background
dbG.setColor(getBackground()); // gets background color
dbG.fillRect(0, 0, this.getSize().width, this.getSize... | [
-0.00799653958529234,
-0.4282607436180115,
0.4305421710014343,
-0.17350688576698303,
0.19563215970993042,
0.18725967407226562,
0.25174757838249207,
-0.42363765835762024,
0.047065287828445435,
-0.6851480007171631,
-0.3484783172607422,
0.37172064185142517,
-0.4813205897808075,
-0.04688536748... | |
dbG.setColor(getForeground());
paint(dbG);
// draw image on the screen
g.drawImage(dbImage, 0, 0, this);
}
public void paint(Graphics g) {
g.setColor(Color.RED);
g.fillOval(x_pos-radius, y_pos-radius, 2*radius, 2*radius);
}
}
```
The `init()` and `start()` methods ... | [
0.10837611556053162,
-0.2674722671508789,
0.583765983581543,
-0.493021696805954,
-0.18481959402561188,
0.20720496773719788,
0.2821630835533142,
-0.2791593372821808,
0.1645790934562683,
-0.78626948595047,
-0.2803843915462494,
0.5863338112831116,
-0.617784857749939,
0.11429808288812637,
-0... | |
invoked by Swing independently in the GUI event handling thread, if Swing detects that the applet needs to be redrawn.
I note that the class's main `run()` method also repeatedly calls `repaint()`. That explicitly tells the GUI thread to invoke `update()`. | [
0.0787607952952385,
-0.143923819065094,
0.12502111494541168,
-0.30483749508857727,
-0.04261457175016403,
-0.05588317662477493,
0.2802221179008484,
-0.36178091168403625,
-0.21961349248886108,
-0.33898863196372986,
-0.2865462005138397,
0.7777358889579773,
-0.4552984833717346,
-0.096102342009... | |
Our whole system is being designed around REST and are now considering how processes which are quite clearly RPC in intent can be mapped to RESTful resources without using verbs in the URL. Our remote procedure call is used to rebuild our search index when a content listing has been modified elsewhere.
What we are thi... | [
0.3401026427745819,
0.028629465028643608,
0.47798261046409607,
0.1454741358757019,
0.21312998235225677,
-0.3940809965133667,
0.3326835334300995,
0.17649465799331665,
-0.01254107616841793,
-0.8089172840118408,
-0.22909417748451233,
0.5505031943321228,
-0.3535411059856415,
0.1423900574445724... | |
does have a log mechanism, so in theory we could return a URL to a index\_update resource so as to allow a GET to retrieve the resource, but to be honest we're not interested in the resource as this is nothing more than an RPC in disguise.
So my question is whether RESTfulness is expressed in structure or intent. I fe... | [
0.3082921802997589,
0.12174373865127563,
0.3206692039966583,
0.13626711070537567,
0.11938164383172989,
-0.48114481568336487,
0.6030000448226929,
0.02550654299557209,
-0.14864017069339752,
-0.13677914440631866,
-0.0955820232629776,
0.5560084581375122,
-0.0011384158860892057,
0.0407761335372... | |
procedure call, and there's no reason to pretend it's REST. | [
0.34309643507003784,
0.0882183089852333,
0.8161550760269165,
-0.17643505334854126,
0.4015965759754181,
-0.2381475567817688,
0.045594681054353714,
-0.052589207887649536,
-0.24678967893123627,
-0.31793805956840515,
0.04033288359642029,
0.6387679576873779,
0.0147778345271945,
0.08094173669815... | |
I'm new to Windows development and I have a question. I'm using a Mac with Boot Camp to run Windows in dual boot, but I have an extremely small Windows partition (10 GB, because Boot Camp failed with bigger partition, due to the disk usage). After installing Visual Studio 2008 I continuously get low-disk-space warnings... | [
0.3496803939342499,
0.21158061921596527,
0.10321155935525894,
-0.2721099555492401,
-0.10861402750015259,
-0.1092558205127716,
0.4448312222957611,
0.06075833737850189,
-0.09233087301254272,
-0.7616618275642395,
0.03330244868993759,
0.7923317551612854,
-0.14341582357883453,
0.143819183111190... | |
other ones.
Thank you.
You can remove the 1.1 Framework, but **you cannot remove the 2.0 Framework**
This is because the **.NET 3.5 framework is an extension of the 2.0 framework, and not a separate one**. | [
0.4062066972255707,
-0.08774694055318832,
0.04176589101552963,
0.16504022479057312,
-0.13816384971141815,
-0.29505228996276855,
0.27761927247047424,
-0.06554911285638809,
-0.42819273471832275,
-0.7274867296218872,
-0.23709921538829803,
0.48865485191345215,
-0.43008893728256226,
-0.04118194... | |
Say I have the following code:
```
function One() {}
One.prototype.x = undefined;
function Two() {}
var o = new One();
var t = new Two();
```
`o.x` and `t.x` will both evaluate to `undefined`. `o.hasOwnProperty('x')` and `t.hasOwnProperty('x')` will both return false; the same goes for `propertyIsEnumerable`. Two ... | [
0.05147199705243111,
0.17031645774841309,
0.2312067598104477,
-0.14462998509407043,
0.12162069976329803,
0.03820555657148361,
0.09341686964035034,
-0.3123490512371063,
-0.04122999310493469,
-0.3626021146774292,
-0.18432104587554932,
0.5299903750419617,
-0.21198531985282898,
0.3641040921211... | |
internally (at least in Chrome).
A slightly simpler way than your method is to use the [Javascript in operator](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Operators/Special_Operators/in_Operator)
```
alert('x' in o); // true
alert('x' in t); // false
``` | [
0.5286334753036499,
0.15014708042144775,
0.3326369524002075,
-0.31077778339385986,
-0.0806906521320343,
0.019873183220624924,
0.18602095544338226,
-0.22236667573451996,
-0.19544574618339539,
-0.8166051506996155,
-0.2587585747241974,
0.7065767645835876,
-0.44018828868865967,
-0.402230888605... | |
I have the table (Product\_Id, category priority, atribute1, atribute2...) in MS Access, and I am trying to make a query that orders the data grouped by Category and ordered by the highest priority. Priority can be Null, so it should be placed at the end.
Example:
Table
```
1, 100, 2, atr1, atr2
2, 300, , atr1, atr2
... | [
-0.6364840269088745,
0.19629301130771637,
0.4952622354030609,
0.16224372386932373,
0.1139015257358551,
0.793656587600708,
-0.07801705598831177,
-0.12076909095048904,
-0.5926049947738647,
-0.3901958167552948,
-0.2964942455291748,
0.2025771290063858,
-0.4493359625339508,
0.3070921301841736,
... | |
Jet SQL, this may suit:
```
SELECT t2.MinOfPriority, tn.Field2, Nz([tn.Field3],999) AS Priority,
tn.Field4, tn.Field5
FROM tn
INNER JOIN (SELECT Min(Nz(tn.Field3,999)) AS MinOfPriority, tn.Field2
FROM tn GROUP BY tn.Field2) AS t2 ON tn.Field2 = t2.Field2
ORDER BY t2.MinOfPriority, tn.Field2, Nz([... | [
-0.21846501529216766,
-0.39224714040756226,
0.5268325805664062,
0.2504758834838867,
0.005228659603744745,
0.3016204833984375,
-0.18145209550857544,
-0.14873450994491577,
0.01956760883331299,
0.07687894999980927,
-0.3278694152832031,
0.7786762714385986,
-0.34927958250045776,
-0.001119914115... | |
Should I invest time learning Microsoft's new F# language?
I am mainly a C# .NET developer and I wonder if learning F# will be of any help in developing today's typical applications.
F# is a perfectly good place to start learning functional languages. If you're worried that F# knowledge won't apply to other functional ... | [
0.3262307643890381,
0.026549378409981728,
0.14130598306655884,
0.037803493440151215,
0.07449233531951904,
-0.09673799574375153,
-0.05272722616791725,
0.2151487022638321,
-0.07983746379613876,
-0.6110635995864868,
-0.04403257369995117,
0.5310057401657104,
-0.215004101395607,
-0.314189493656... | |
F# is worth learning. | [
0.3370465636253357,
0.19348232448101044,
0.1089210957288742,
0.21574485301971436,
-0.11993123590946198,
-0.22999417781829834,
0.30191749334335327,
0.4387686550617218,
-0.16845060884952545,
-0.5723820924758911,
-0.12060080468654633,
0.5211405754089355,
0.4001311957836151,
-0.223574519157409... | |
I have a problem.
I need to host grid with controls in ScrollViewer to prevent textbox from being either truncated or collapsed to zero-with at the UI. Also I want the with of textbox to be expanded when user change windows width.
I'm setting Window's content to following code
```
<DockPanel>
<TreeView DockPanel.D... | [
0.13777697086334229,
-0.06913130730390549,
0.853377103805542,
-0.21232980489730835,
-0.0002190898230765015,
0.24270902574062347,
0.19361336529254913,
-0.24831166863441467,
-0.26862388849258423,
-0.922288715839386,
0.145245760679245,
0.6944307088851929,
-0.05651762709021568,
0.0754795819520... | |
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Name" | [
-0.28771498799324036,
0.17853766679763794,
0.30339908599853516,
-0.19315709173679352,
0.04922717437148094,
0.290515273809433,
-0.017322197556495667,
-0.45946037769317627,
-0.3699096143245697,
-0.7873234152793884,
-0.18502658605575562,
0.4171620309352875,
-0.32680225372314453,
-0.0783075615... | |
Margin="5"
VerticalAlignment="Center"/>
<TextBox Grid.Column="1"
Text="Some Name"
Margin="5" | [
-0.40262338519096375,
-0.21157115697860718,
0.5222615003585815,
0.0783892273902893,
-0.01513623632490635,
0.20576660335063934,
-0.18043625354766846,
0.01259660255163908,
-0.3030039370059967,
-0.7918413877487183,
0.09734772145748138,
0.10595531761646271,
0.28130313754081726,
0.1543768346309... | |
VerticalAlignment="Center"
MinWidth="200"/>
</Grid>
</ScrollViewer>
</DockPanel>
```
All work fine, but when user types very long text in TextBox it is being expanded and horizontal scroll appears.
Is there any easy way to limit TextBox maximum width and allow it to be expanded only w... | [
-0.044829919934272766,
-0.23766709864139557,
0.9494783282279968,
-0.14892160892486572,
0.045545950531959534,
0.10222296416759491,
-0.03327345475554466,
-0.21490971744060516,
-0.41554537415504456,
-0.8121307492256165,
0.022238092496991158,
0.40846702456474304,
0.014594576321542263,
0.129376... | |
present it will expand instead of staying at the initial automatic size.
One solution here is to make another auto-sized element and bind the TextBox.Width to it:
```
<DockPanel>
<TreeView Width="150" DockPanel.Dock="Left"/>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"... | [
-0.07238538563251495,
-0.08936122059822083,
0.8576464056968689,
-0.4118861258029938,
-0.0837697982788086,
0.1482890397310257,
-0.16502989828586578,
-0.4590965807437897,
-0.4116069972515106,
-0.8070744872093201,
-0.13324181735515594,
0.5777826905250549,
0.016107123345136642,
-0.273903399705... | |
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Margin="5" VerticalAlignment="Center" Text="Name"/>
<Border x:Name="b" Grid.Column="1" Margin="5"/>
<TextBox Width="{Binding Actual... | [
-0.13343143463134766,
-0.08988790959119797,
0.7960688471794128,
-0.0524354949593544,
-0.13853423297405243,
0.22949238121509552,
-0.08159773051738739,
-0.6024697422981262,
-0.3886593282222748,
-0.6665245294570923,
0.15129007399082184,
0.36820557713508606,
0.02628680318593979,
0.155374735593... | |
MinWidth="200"
Grid.Column="1"
Margin="5"
VerticalAlignment="Center"
Text="Some Name"/> | [
-0.2900366485118866,
-0.13496987521648407,
0.5698355436325073,
0.15597949922084808,
0.07493844628334045,
0.22030210494995117,
-0.06387423723936081,
-0.006291401572525501,
-0.22071301937103271,
-0.7255551815032959,
-0.05558207631111145,
0.09128288179636002,
0.26250115036964417,
0.1022003665... | |
</Grid>
</ScrollViewer>
</DockPanel>
```
**Note that we set the Margin property of the auto-sizing element (the Border).** This is important because if it's not set, there will be a loop:
1. Border width autosizes to Grid column width
2. TextBox width resizes to Border.ActualWidth
3. Grid column width resizes to... | [
0.20280598104000092,
-0.03579404577612877,
0.9738001227378845,
-0.09522023797035217,
-0.13321813941001892,
0.18808278441429138,
0.039557866752147675,
-0.6959168910980225,
-0.12853726744651794,
-0.7861915826797485,
0.06417468935251236,
0.6003507971763611,
0.16669060289859772,
-0.04716519638... | |
I am writing a website with PHP. Since it will need to be accessed by anyone on the network to access the internet I have to create a mobile version. How do I best check if it's a mobile device? I don't want to have a switch statement with 50 devices at the end since I don't only want to support the iPhone.
Is there a... | [
0.31603413820266724,
0.15887948870658875,
0.29393860697746277,
-0.09295963495969772,
-0.1780168116092682,
-0.14726930856704712,
0.2891058623790741,
-0.06627371907234192,
-0.20093390345573425,
-0.7287951111793518,
0.17680761218070984,
0.4144373834133148,
-0.3673904836177826,
-0.244786977767... | |
Using ASP.net, how do you write ANSI characters to a text file?
I need to write this file's text to the web browser. Do they support ANSI?
I don't do ASP, so I can't tell you how to do it exactly. But I believe most (all?) browsers do support ANSI plain text. You might return HTTP Content Type as text/plain, and send ... | [
0.24442072212696075,
-0.11104663461446762,
0.23699724674224854,
-0.044783420860767365,
-0.2773257791996002,
0.1222473531961441,
0.15540732443332672,
0.02278815023601055,
-0.2781052887439728,
-0.822191596031189,
0.008518673479557037,
0.3776099383831024,
-0.2895968556404114,
-0.2365433573722... | |
I'm working on a tool which would need to communitacte: send and recieve files with other remote instances of the tool over the internet. Which communication option would be best to use in this case ? Sockets?
Sockets is definitely not the way to go. Instead you should use an already existing, higher layer protocol, li... | [
0.4118858277797699,
0.04736846312880516,
0.18608391284942627,
0.34163519740104675,
-0.12492162734270096,
-0.23334847390651703,
0.05821657180786133,
0.07708612829446793,
-0.19587431848049164,
-0.8235016465187073,
-0.08963221311569214,
0.6036782264709473,
-0.08155793696641922,
0.069423541426... | |
I would like to use an SQL Server table as an action queue. So whenever the table is non-empty, I'd like some sort of notification to my [VDF](http://www.visualdataflex.com/) application, in order to avoid constantly polling the database. VDF relies on using [stdcall](http://en.wikipedia.org/wiki/X86_calling_convention... | [
0.31299638748168945,
-0.20587804913520813,
0.4131454527378082,
0.052466604858636856,
-0.24526001513004303,
-0.11697779595851898,
0.040467120707035065,
-0.03998078033328056,
-0.5344683527946472,
-0.5179521441459656,
0.07425638288259506,
0.596341609954834,
-0.4613266587257385,
-0.02786499634... | |
above)?
You could use an ON INSERT trigger, possibly to send the row right to [MSMQ](http://www.microsoft.com/windowsserver2003/technologies/msmq/default.mspx), where your application listens for events as new messages come in.
Here is an [example of how to feed MSMQ using SQL Server](http://www.developerfusion.com/co... | [
0.2548180818557739,
-0.10467615723609924,
0.7329928278923035,
0.13504081964492798,
-0.2515313923358917,
-0.11796394735574722,
-0.1600268930196762,
-0.1403932273387909,
-0.3078581392765045,
-0.3425183594226837,
-0.038015350699424744,
0.6137959361076355,
-0.08140642940998077,
-0.112736411392... | |
I'm doing some research in code generation from xsd schema files.
My requirements:
* Must generate C# 2.0 code (or above), using generic collections where needed.
* Must generate comments from the xsd comments
* Must generate fully serializable code.
* Should be able to generate resuable basetypes when generating fro... | [
0.3926498293876648,
-0.04852815344929695,
0.11338650435209274,
0.15423309803009033,
-0.4051923453807831,
-0.10668721050024033,
0.14400580525398254,
-0.4914936125278473,
-0.3048878610134125,
-0.7583879828453064,
-0.14790114760398865,
0.5001367926597595,
-0.42057690024375916,
-0.034546684473... | |
[XsdObjectGen](http://www.microsoft.com/downloads/details.aspx?familyid=89e6b1e5-f66c-4a4d-933b-46222bb01eb0&displaylang=en) by Microsoft
6. [XSDClassGen](http://www.dotnetjunkies.com/WebLog/ram-marappan/default.aspx) (Seems to be missing in action)
Did I miss any? Because (1), (2) and (5) do not generate 2.0 code, an... | [
0.1270950883626938,
-0.011510869488120079,
0.3433310389518738,
-0.04507376253604889,
-0.14067967236042023,
-0.1918266862630844,
0.21021489799022675,
-0.051710184663534164,
-0.4433387815952301,
-0.7078438997268677,
0.01659334823489189,
0.6313249468803406,
-0.4389171600341797,
0.191223025321... | |
definitions. I tried all the tools listed above as well as others and most were either deprecated, unmaintained or unable to match the current functionality of xsd.exe available in VS2010.
**Xsd2Code** however is a superb tool and seems to be actively maintained. It provides all the functionality that was listed above... | [
0.7463825345039368,
-0.06601978838443756,
0.32800817489624023,
0.25730305910110474,
-0.25077739357948303,
-0.2123938351869583,
0.2971583306789398,
-0.09368766099214554,
-0.03738699108362198,
-1.13944411277771,
0.3175842761993408,
0.6242150068283081,
-0.201788991689682,
0.2004779875278473,
... | |
will automatically update the code as you update the XSD). All in all saved us a lot of work.
A quick summary of the other tools i looked at:
* [Dingo](http://dingo.sourceforge.net/) - Seems to be more aligned to Java
* XSDCodeGen - More of a demo on how to write a custom build tool
* [CodeXS](http://www.bware.biz/Co... | [
0.15660624206066132,
-0.1656610667705536,
0.534975528717041,
0.043882064521312714,
-0.3141421377658844,
-0.4009827971458435,
0.12651735544204712,
-0.050526294857263565,
-0.2596127390861511,
-0.9705677032470703,
0.10407420247793198,
0.5385106801986694,
-0.23995864391326904,
-0.0174631718546... | |
but not what i was looking for
**Addendum:**
If you do decided to go ahead with XSD2Code, there are a number of issues i found working with the command-line tool. In particular, there are some bugs with the argument processing that require some arguments to be in a certain order as well as some undocumented dependenci... | [
0.3837905824184418,
0.18993477523326874,
0.35662734508514404,
0.09401603788137436,
0.17473934590816498,
0.07029420882463455,
0.12952931225299835,
-0.2744145095348358,
-0.01655910164117813,
-0.4588663578033447,
-0.1060623899102211,
0.8813223242759705,
-0.39004021883010864,
0.142556071281433... | |
the initial code, changing the paths to the correct locations:
```
@echo off
set XsdPath=C:\schemas
set OutPath=%XsdPath%\Code
set ExePath=C:\Progra~1\Xsd2Code
set Namespace=InsertNamespaceHere
echo.Starting processing XSD files ...
for /f %%a IN ('dir %XsdPath%\*.xsd /a-d /b /s') do call:ProcessXsd %%a
echo.Finish... | [
-0.055450182408094406,
-0.022909360006451607,
0.7817704081535339,
-0.0753680169582367,
0.1377788633108139,
0.21918289363384247,
0.25111278891563416,
-0.6466408371925354,
-0.31997862458229065,
-0.5664458274841309,
-0.45143139362335205,
0.5158263444900513,
-0.3165748715400696,
0.093861483037... | |
- **{:w}TYPE** with **\1**
5. Replace - open documents, case, whole word - **System.DateTime** with **DateTime**, then add missing using statements
6. Replace - open documents, case, whole word - **[System.Xml.Serialization.XmlIgnoreAttribute()]** with **[XmlIgnore]**
7. Replace - current project - **System.Xml.Seriali... | [
-0.016000384464859962,
-0.015609877184033394,
0.6255608797073364,
0.2152128517627716,
0.1118297427892685,
0.0031853974796831608,
0.3533627688884735,
-0.24199311435222626,
-0.16524763405323029,
-0.6241733431816101,
-0.34327128529548645,
0.45628923177719116,
-0.20166614651679993,
-0.04578286... | |
Is there any way that I could get the source of a website (as a string preferably), let's say www.google.com, from some c# code inside code behind of asp.net website?
edit: of course i mean html code - in every browser you can view it using "view **source**" in context menu.
Assuming you want to retrieve the html:
``... | [
0.49436861276626587,
0.04554744064807892,
0.3649614751338959,
0.03944887965917587,
0.1071634367108345,
-0.1769363284111023,
0.21623507142066956,
0.44455486536026,
-0.13655778765678406,
-0.6606200337409973,
-0.11903215944766998,
0.39121973514556885,
-0.37637293338775635,
0.210304856300354,
... | |
using (StreamReader reader = new StreamReader(stream))
{
Console.WriteLine(reader.ReadToEnd());
}
}
}
``` | [
-0.08130566775798798,
-0.17478737235069275,
0.6172287464141846,
-0.07100892812013626,
0.3780236542224884,
-0.007085403427481651,
0.16098476946353912,
-0.15974798798561096,
0.23349857330322266,
-0.9052598476409912,
-0.2690733075141907,
0.695732057094574,
-0.2937195599079132,
0.4581489562988... | |
I want to keep the class simple and not defined a constructor so i can do Pt data = {0, 5};
so i figured the best way convert Pt\_t from a short to long or vice versa is to do something like this.
```
template <class T>
struct Pt_t
{
T x, y;
template <class T2> operator Pt_t<T2>() { Pt_t pt = {x, y}; return pt... | [
0.3778669834136963,
-0.3110271096229553,
0.2185448408126831,
-0.2875695526599884,
0.193735733628273,
0.015406043268740177,
0.21186542510986328,
-0.40472620725631714,
-0.09675614535808563,
-0.5590111017227173,
-0.14805617928504944,
0.6757131814956665,
-0.42301538586616516,
0.149767979979515... | |
constructors removing Pt\_t pt = {1, 2}; which i prefer to keep if i can.
I'm pretty sure the unqualified Pt\_t in your functions body is `Pt_t<T>`, but don't you want it to be `Pt_t<T2>`? You'll need to explicitly qualify it. | [
-0.004433976486325264,
0.0855347290635109,
0.03205807879567146,
-0.2188519984483719,
0.018054984509944916,
-0.054945532232522964,
0.1969267725944519,
-0.16968777775764465,
-0.0016855731373652816,
-0.4396737813949585,
-0.3030005395412445,
0.6256032586097717,
-0.5088101029396057,
-0.12561893... | |
Lately I have seen a lot of blog posts concerning how to build loosely coupled applications. Which patterns do you use most when creating loosely coupled applications? Dependency Injection? Inversion of Control?
[Model-View-Controller](http://en.wikipedia.org/wiki/Model-view-controller).
Aside: things that stops me wr... | [
0.14533229172229767,
-0.11347157508134842,
0.1099892184138298,
0.2710898220539093,
-0.4269735515117645,
-0.19450369477272034,
0.2307925671339035,
0.018569117411971092,
-0.3956494927406311,
-0.7624461650848389,
0.2280484139919281,
0.2887510657310486,
-0.5020580291748047,
0.37402889132499695... | |
I have an access database with many tables. I am looking for a field which may or may not exist in one or many of the tables. How do I check if it exists or not? (without querying each table of course)
There is a schema for fields:
```
Set cn = CurrentProject.Connection
SelectFieldName = "SomeFieldName"
'Get names ... | [
-0.16788716614246368,
0.2623266577720642,
0.5881926417350769,
-0.0240633562207222,
0.3037484884262085,
-0.030625708401203156,
0.34004876017570496,
-0.12081832438707352,
-0.5075650811195374,
-0.47935840487480164,
-0.03612459450960159,
0.5285454988479614,
-0.2216150164604187,
0.2341732829809... | |
When creating a criteria for NHibernate all criteria are added as `AND`.
For instance:
```
session.CreateCriteria(typeof(someobject))
.Add(critiera)
.Add(other_criteria)
```
then end result will be
```
SELECT ...
FROM ...
WHERE criteria **AND** other_criteria
```
I would like to tell NHibernate to add the criter... | [
-0.14807221293449402,
0.15017443895339966,
0.45562002062797546,
-0.054574232548475266,
-0.3443567454814911,
0.14411096274852753,
-0.09748882055282593,
-0.5047050714492798,
0.025851821526885033,
-0.3936540484428406,
-0.2776748836040497,
0.4491507112979889,
-0.3915238678455353,
0.01517297886... | |
I learned a lot of Perl RegEx syntax rules, but probably the only way to actually be able to write them is to do a bunch of 'RegEx' related exercises.
I looked over the other "Learn RegEx" threads on StackOverflow, but haven't found anything similar.
Is there any collection of such exercises? In form of book, HTML, w... | [
0.41731250286102295,
-0.09914787858724594,
0.1947450488805771,
0.5181664824485779,
0.02180403843522072,
-0.05887856334447861,
0.17739488184452057,
0.19365878403186798,
-0.22811104357242584,
-0.2870608866214752,
0.2815556526184082,
0.42596450448036194,
-0.12793588638305664,
-0.1502881795167... | |
that sometimes you'll come up with answers that are worth publishing.
Three good things with this approach:
1. You'll be working with real-world
problems.
2. You might learn stuff
about other programming languages as
you go. ('Tis always good to learn
new languages).
3. You probably will be
helping the world find goo... | [
-0.06743545830249786,
0.07337380200624466,
-0.11851517856121063,
0.3202882409095764,
-0.2394014447927475,
0.004455698188394308,
0.3802790343761444,
0.32221198081970215,
-0.13670241832733154,
-0.4523341953754425,
-0.22624842822551727,
0.8482347726821899,
-0.16280381381511688,
-0.04200651869... | |
Assume your .NET-based development team is already using the following set of tools in its processes:
* Subversion / TortoiseSVN / VisualSVN (source control)
* NUnit (unit testing)
* An open source Wiki
* A proprietary bug-tracking system that is paid for
You are happy with Subversion and NUnit, but dislike the Wiki ... | [
0.620039701461792,
-0.17093414068222046,
0.11523572355508804,
0.31946077942848206,
-0.17498791217803955,
-0.38957053422927856,
0.18939821422100067,
0.07445280998945236,
-0.39981991052627563,
-0.4655762314796448,
-0.21672552824020386,
0.7080739736557007,
-0.0585201121866703,
-0.102465599775... | |
control)? Is the integration of all these features greater than the sum of the parts, or would it simply be better to acquire and replace the parts that you either do not like or do not have?
I remember looking into VSTS a few years ago and thought it was terribly expensive and not really better than many of the free ... | [
0.3833635151386261,
-0.2356300801038742,
0.3945949971675873,
0.6949381828308105,
0.2924560606479645,
-0.05294640362262726,
-0.16873838007450104,
-0.0009133264538832009,
-0.026012634858489037,
-0.34472501277923584,
0.37789681553840637,
0.9423851370811462,
-0.21682177484035492,
0.06094557046... | |
that if a person uses **only** the work item system, and works **only** with his/her own work items (no peeking at other person's work items!) then there is no need for a CAL. This makes it a bit easier to use it as an external bugreport system. Still it leaves a lot to be desired in this area.
There is one way to all... | [
0.565252423286438,
-0.0795295238494873,
0.30946090817451477,
0.5043495297431946,
0.16206063330173492,
-0.371009886264801,
0.2837124764919281,
-0.09405842423439026,
-0.2027708888053894,
-0.670724630355835,
0.004939084406942129,
0.6796813011169434,
-0.053378064185380936,
-0.02350153774023056... | |
be enough for most companies. But getting the Gold status might be tricky, depending on what you do.
If you only dislike those two parts, then perhaps it's better just to find a replacement for them instead for everything? There are many wiki systems out there, some should be to your liking. The same goes for bugtrack... | [
0.7959955334663391,
0.07053528726100922,
-0.16416019201278687,
0.36665767431259155,
0.25608229637145996,
-0.21708951890468597,
0.07189484685659409,
0.21527710556983948,
-0.49795567989349365,
-0.10555338114500046,
0.20606814324855804,
0.6272286176681519,
-0.1683511883020401,
-0.200758501887... | |
What is the best way to encrypt a value in INI file?
Using Encryption/Decryption key??
For what purpose? Security?
If you are trying to (e.g.) encrypt a plaintext password you should probably use some implementation of PKI. Remember though, that then key management becomes your problem. Just encrypting the value is ... | [
-0.08344732969999313,
0.03893527761101723,
-0.09274125844240189,
0.4059998095035553,
0.12268199771642685,
-0.22652357816696167,
0.4189026653766632,
-0.09252829849720001,
-0.20168623328208923,
-0.5676481127738953,
-0.1584482342004776,
0.5833762884140015,
-0.18580394983291626,
0.149383008480... | |
place you store your key pair they can decrypt it themselves. | [
0.5470318794250488,
0.2592276632785797,
0.10427747666835785,
0.30018848180770874,
0.19594189524650574,
0.024367639794945717,
0.2954255938529968,
-0.2887052893638611,
-0.18827180564403534,
-0.46844178438186646,
-0.3326976001262665,
0.410661518573761,
0.35560181736946106,
-0.0771968290209770... | |
Avast there fellow programmers!
I have the following problem:
I have two rectangles overlapping like shown on the picture below.

I want to figure out the polygon consisting of point ABCDEF.
Alternate christmas description: The red cookie c... | [
0.07797539234161377,
0.18760336935520172,
0.34072133898735046,
-0.28527650237083435,
-0.3172091245651245,
0.34878477454185486,
0.40121105313301086,
-0.03510729596018791,
-0.5844637751579285,
-0.5856720805168152,
0.022184187546372414,
0.2893325388431549,
-0.3955431878566742,
0.0936311855912... | |
data structure you've described pretty well.
Note that it's quite possible you'll end up with a rectangle with a hole in it (if the red one is entirely inside the black one) or even two rectangles (eg if the red is taller and skinnier than the black). If you're certain there is only one corner of the red rectangle ins... | [
-0.08906574547290802,
-0.0636615976691246,
-0.08894786238670349,
0.5446174144744873,
0.04113295301795006,
-0.19944295287132263,
-0.07326690107584,
0.039943791925907135,
-0.45607325434684753,
-0.7480193972587585,
-0.13573814928531647,
0.002756875939667225,
-0.2607950270175934,
0.26461344957... | |
I am converting a VB6 to C# and I want to make my data structure that holds values and relationships more efficient. In VB I have a collection of values and another collection of relationships between those values with priorities for those relationships. I also have an algorithm that when a set of values is passed to i... | [
0.42104077339172363,
0.31883931159973145,
0.35763561725616455,
-0.2308947741985321,
-0.27947261929512024,
0.17194750905036926,
0.20158900320529938,
-0.2665673494338989,
-0.055354561656713486,
-0.3099410831928253,
-0.21237005293369293,
0.49872538447380066,
-0.3152296245098114,
0.09041853249... | |
--
1,2
2,8
8,10
9,10
Since there may be multiple paths the least amount of relationships would be returned but there is a caveat of relationship priorities. If a relationship has a higher priority then that relationship would be added and the rest of the relationships would be added from there. I am thinkin... | [
0.09015990048646927,
-0.07517791539430618,
0.5230759382247925,
0.38561689853668213,
0.05088174715638161,
0.3003150522708893,
0.09374473989009857,
-0.41137680411338806,
-0.05745217949151993,
-0.4171525239944458,
-0.07892715930938721,
0.2966793477535248,
-0.18893341720104218,
0.1163788363337... | |
paths. Also, I did not ask this but would the algorithm in [Disjoint-set data structure](http://en.wikipedia.org/wiki/Disjoint-set_data_structure) be the most efficient?
It sounds like what you have is a [Graph](http://en.wikipedia.org/wiki/Graph_(mathematics)). This is a structure with Nodes and Edges. There are [many... | [
0.24385811388492584,
-0.10684733092784882,
0.4173453152179718,
0.5988357663154602,
-0.2622450888156891,
-0.33208444714546204,
0.05178797245025635,
-0.19260430335998535,
-0.5522022843360901,
-0.9710961580276489,
0.01471450924873352,
0.2928979992866516,
-0.32095205783843994,
-0.1430224031209... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.