text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
So this is a question for anyone who has had to integrate the building/compilation of legacy projects/code in a Team Build/MSBuild environment - specifically, Visual Basic 6 applications/projects.
*Outside* of writing a custom build Task (which I am not against) does anyone have any suggestions on how best to integrat... | [
0.6568992137908936,
0.03820604085922241,
-0.1385158896446228,
0.06525729596614838,
-0.15738660097122192,
-0.23890866339206696,
0.24498024582862854,
-0.19013157486915588,
-0.25136029720306396,
-0.542616605758667,
-0.07327651977539062,
0.6539372801780701,
-0.10655038058757782,
0.068245604634... | |
functionality in a custom task, but really wondered if anyone has tried another solution (aside from executing shell commands) -
In essence, does anyone have a "cleaner" solution?
Ideally, executing commands using would be a last resort..
From a quick look, the following code from IO::Socket::INET
```
sub _get_addr ... | [
0.03477562591433525,
-0.20185375213623047,
0.7331013679504395,
-0.18986009061336517,
-0.004786668345332146,
0.10569117963314056,
0.5247241854667664,
-0.5677475333213806,
-0.30400678515434265,
-0.6593772768974304,
-0.11875146627426147,
0.5441712141036987,
-0.3670103847980499,
0.283194363117... | |
push(@addr, $h) if defined $h;
}
@addr;
}
```
suggests (if you look at the caller of this code) the work-around of adding `MultiHomed => 1,` to your code.
Without that work-around, the above code appears to try to call `inet_aton("hostname.com")` using the inet\_aton() from Socket.pm. That works for me in bo... | [
-0.09788814932107925,
-0.021553119644522667,
0.6471208930015564,
-0.4910735487937927,
-0.013766282238066196,
0.17667092382907867,
0.1581723541021347,
-0.13653290271759033,
-0.41609594225883484,
-0.6549056172370911,
-0.11694807559251785,
0.5480783581733704,
-0.4453294575214386,
0.4018520116... | |
struct in_addr ip_address;
struct hostent * phe;
if (phe = gethostbyname(host)) {
Copy( phe->h_addr, &ip_address, phe->h_length, char );
} else {
ip_address.s_addr = inet_addr(host);
}
ST(0) = sv_newmortal();
if(ip_address.s_addr != INADDR_NONE) ... | [
-0.3367036283016205,
0.1273522973060608,
0.9235902428627014,
-0.3471471965312958,
-0.192306250333786,
0.16827070713043213,
0.44416218996047974,
-0.3378598988056183,
-0.05134627968072891,
-0.7967905402183533,
-0.44569146633148193,
0.35182905197143555,
-0.22884640097618103,
0.473097383975982... | |
sv_setpvn( ST(0), (char *)&ip_address, sizeof ip_address );
}
}
```
It appears that the Perl gethostbyname() works better than the C gethostbyname() for you. | [
0.06271199882030487,
-0.30558788776397705,
0.8768397569656372,
-0.2158929854631424,
-0.09125219285488129,
-0.4075370132923126,
0.30286088585853577,
-0.2838064730167389,
-0.26662689447402954,
-0.5816342234611511,
-0.3534819781780243,
0.8714956045150757,
-0.24403859674930573,
0.0495549328625... | |
Here's the deal. Is there a way to have strings tokenized in a line based on multiple regexes?
One example:
I have to get all href tags, their corresponding text and some other text based on a different regex.
So I have 3 expressions and would like to tokenize the line and extract tokens of text matching every expres... | [
0.4371676445007324,
-0.47074195742607117,
0.31556522846221924,
0.09096521884202957,
-0.415536105632782,
-0.18568055331707,
-0.013595598749816418,
-0.5104699730873108,
-0.22169870138168335,
-0.5075921416282654,
0.15573838353157043,
0.5442012548446655,
-0.2520381808280945,
-0.165947034955024... | |
/ line based read).
The problem is that flex actually produces C/ C++ code which actually does the tokenizing job. I have a
make file which wraps all these things.
I was wondering if perl /python can in some way do the same thing. Its just that I would like to do everything
I like in a single programming language its... | [
0.28625237941741943,
-0.5466699600219727,
0.025503307580947876,
0.1429058462381363,
-0.5669991970062256,
-0.08913835883140564,
0.02475539594888687,
-0.02006225846707821,
-0.37732309103012085,
-0.6040388345718384,
0.06901612132787704,
0.5101447701454163,
-0.21850307285785675,
-0.46312209963... | |
there a way to do it naturally in python itself? pardon my ignorance, but are these tools used in any popular products / services?
Thank you.
If you're specifically after parsing links out of web-pages, then Perl's [WWW::Mechanize](http://search.cpan.org/perldoc?WWW::Mechanize) module will figure things out for you in... | [
0.19615283608436584,
0.08028757572174072,
0.1818304806947708,
0.022040801122784615,
-0.07094388455152512,
-0.36264052987098694,
0.3873942792415619,
-0.23836451768875122,
-0.26693636178970337,
-0.4368986189365387,
-0.13024072349071503,
0.7042356729507446,
-0.2704484760761261,
-0.17571951448... | |
"\n";
}
```
In the main loop, each `$link` is a [WWW::Mechanize::Link](http://search.cpan.org/perldoc?WWW::Mechanize::Link) object, so you're not just constrained to getting the text and URL.
All the best,
Paul | [
0.1697811335325241,
0.5720120668411255,
0.1407691091299057,
0.13419175148010254,
0.24149909615516663,
-0.07535221427679062,
0.3047856092453003,
-0.042789340019226074,
-0.47495236992836,
-0.37547245621681213,
-0.29943937063217163,
0.4428103268146515,
-0.25529953837394714,
0.1382743418216705... | |
I have to write a component that re-creates SQL Server tables (structure and data) in an Oracle database. This component also has to take new data entered into the Oracle database and copy it back into SQL Server.
Translating the data types from SQL Server to Oracle is not a problem. However, a critical difference bet... | [
0.43604975938796997,
0.47116246819496155,
0.16601651906967163,
0.0452536940574646,
-0.11520019173622131,
-0.07168442755937576,
0.2977883815765381,
-0.1317305862903595,
0.1648019254207611,
-0.6261311769485474,
-0.00017527482123114169,
0.34361428022384644,
-0.24192391335964203,
0.42958566546... | |
string to be the same as a `NULL` value, so if a `char` column is defined as `NOT NULL`, you cannot insert a blank string. This is causing my component to break whenever a `NOT NULL` char column contains a blank string in the original SQL Server data.
So far my solution has been to not use `NOT NULL` in any of my mirr... | [
0.20938709378242493,
0.06319816410541534,
0.09910277277231216,
0.14202775061130524,
-0.09928790479898453,
-0.23938404023647308,
0.5459520816802979,
-0.03717237338423729,
-0.26334285736083984,
-0.5357459783554077,
-0.0993736982345581,
0.4992314279079437,
-0.4491703510284424,
0.2586120069026... | |
come up with so far, and it may help to illustrate the problem. Because Oracle doesn't allow "" in a NOT NULL column, my component could intercept any such value coming from SQL Server and replace it with "@" (just for example).
When I add a new record to my Oracle table, my code has to write "@" if I really want to i... | [
0.35732293128967285,
0.10699231177568436,
0.13081921637058258,
0.16107718646526337,
-0.09009026736021042,
-0.11795035004615784,
0.3231034278869629,
-0.1436537653207779,
-0.09076737612485886,
-0.44437018036842346,
0.2180601954460144,
0.38179025053977966,
-0.43205544352531433,
-0.05476145818... | |
simpler solution, like some setting in Oracle that gets it to treat blank strings the same as all the other major database? And would this setting also be available in Oracle Lite?
I don't see an easy solution for this.
Maybe you can store your values as one or more blanks `-> ' '`, which aren't NULLS in Oracle, or k... | [
0.1324373483657837,
-0.08063329756259918,
-0.20233815908432007,
0.5538671016693115,
-0.037115372717380524,
-0.0014777075266465545,
-0.06271380186080933,
-0.1681388020515442,
-0.17057809233665466,
-0.588709831237793,
0.18271997570991516,
0.5387946367263794,
-0.37468668818473816,
-0.27128580... | |
I am pretty sure I have seen this before, but I haven't found out / remembered how to do it. I want to have a line of code that when executed from the Delphi debugger I want the debugger to pop-up like there was a break point on that line.
Something like:
```
FooBar := Foo(Bar);
SimulateBreakPoint; // Cause break po... | [
0.2835613787174225,
0.04890550300478935,
0.1619703769683838,
-0.08169838786125183,
0.15956446528434753,
-0.4267750382423401,
0.4770090579986572,
0.16893061995506287,
-0.16901595890522003,
-0.37520480155944824,
-0.10577613115310669,
0.7008225321769714,
-0.29000094532966614,
-0.0285511631518... | |
from code (supposedly, I don't have a copy of delphi handy to try):
```
asm int 3 end;
```
See this page:
<http://17slon.com/blogs/gabr/2008/03/debugging-with-lazy-breakpoints.html> | [
0.2853448688983917,
0.273333877325058,
-0.1397121697664261,
-0.15496495366096497,
-0.254296213388443,
-0.23073233664035797,
0.5875676274299622,
-0.10123709589242935,
-0.20707425475120544,
-0.26097944378852844,
-0.38983818888664246,
0.49985837936401367,
-0.3000676929950714,
0.01085205376148... | |
How can I check if a given number is even or odd in C?
Use the modulo (%) operator to check if there's a remainder when dividing by 2:
```
if (x % 2) { /* x is odd */ }
```
A few people have criticized my answer above stating that using x & 1 is "faster" or "more efficient". I do not believe this to be the case.
O... | [
0.09311114996671677,
0.22904683649539948,
-0.12993137538433075,
-0.09078655391931534,
-0.13787944614887238,
0.05989434942603111,
0.2852305471897125,
-0.38347750902175903,
-0.053819283843040466,
-0.28406384587287903,
0.19189083576202393,
0.386398047208786,
-0.2717263102531433,
0.04279094561... | |
if (x % 2)
printf("%d is odd\n", x);
return 0;
}
/* and.c */
#include <stdio.h>
int main(void)
{
int x;
for (x = 0; x < 10; x++)
if (x & 1)
printf("%d is odd\n", x);
return 0;
}
```
I then compiled these with gcc 4.1.3 on one of my machines 5 different times:
* With ... | [
-0.22020217776298523,
0.203388512134552,
0.3499378263950348,
-0.1966252326965332,
0.11488641798496246,
0.3555115759372711,
0.3380851149559021,
-0.4086689054965973,
-0.16844063997268677,
-0.4363504946231842,
-0.04421407729387283,
0.6631677746772766,
-0.5432010889053345,
0.056721918284893036... | |
-O2
* With -O3
I examined the assembly output of each compile (using gcc -S) and found that in each case, the output for and.c and modulo.c were identical (they both used the andl $1, %eax instruction). I doubt this is a "new" feature, and I suspect it dates back to ancient versions. I also doubt any modern (made in t... | [
0.1497783660888672,
0.35914087295532227,
0.14599205553531647,
-0.3331091105937958,
-0.1457267552614212,
-0.03815549984574318,
0.07495391368865967,
-0.18214765191078186,
0.052495960146188736,
-0.43223291635513306,
0.022087929770350456,
0.49692094326019287,
-0.3839462697505951,
-0.1034653857... | |
different result, I'd be very interested to know.
Finally, the modulo version is **guaranteed** by the standard to work whether the integer is positive, negative or zero, regardless of the implementation's representation of signed integers. The bitwise-and version is not. Yes, I realise two's complement is somewhat ub... | [
0.40806278586387634,
-0.21179893612861633,
0.17487148940563202,
-0.13326454162597656,
-0.16177426278591156,
-0.281444251537323,
0.2503334581851959,
-0.08473847806453705,
-0.2355310320854187,
-0.330190509557724,
-0.12243278324604034,
0.732236921787262,
-0.24889099597930908,
-0.1397008746862... | |
How can I tell if SP1 has been installed on VS2008? e.g. If I'm working on a co-worker's machine - how can I tell if he/she has installed SP1 for VS2008?
In Help->About, you can view the installed products. You should see something similar to
> Microsoft Visual Studio Team System
> 2008 Team Suite - ENU Service Pack ... | [
0.19578023254871368,
-0.07942310720682144,
0.11347789317369461,
0.20576663315296173,
0.004515307955443859,
-0.06016562134027481,
0.11633475124835968,
-0.2316761165857315,
-0.34006282687187195,
-0.5612109899520874,
-0.10455375164747238,
0.648521363735199,
0.036421358585357666,
-0.3192247450... | |
I have a function that takes a struct, and I'm trying to store its variables in array:
```
int detect_prm(Param prm) {
int prm_arr[] = {prm.field1, prm.field2, prm.field3};
return 0;
}
```
But with `gcc -Wall -ansi -pedantic-errors -Werror` I get the following error:
> initializer element is not computable at ... | [
-0.23512901365756989,
0.14087672531604767,
0.41535651683807373,
-0.39073318243026733,
-0.18983618915081024,
0.11526136100292206,
0.4034430682659149,
-0.6648917198181152,
-0.06619191914796829,
-0.2527405023574829,
-0.18129850924015045,
0.5927197337150574,
-0.4035950303077698,
0.018107248470... | |
I work on an application that has a both a GUI (graphical) and API (scripting) interface. Our product has a very large installed base. Many customers have invested a lot of time and effort into writing scripts that use our product.
In all of our designs and implementation, we (understandably) have a very strict requir... | [
1.0248897075653076,
0.5225079655647278,
0.07143876701593399,
-0.041298720985651016,
0.2824893891811371,
-0.17311157286167145,
0.14728166162967682,
0.06720128655433655,
0.0822034701704979,
-0.6012512445449829,
-0.04531300440430641,
0.6351891756057739,
0.07159121334552765,
0.0244316402822732... | |
and come up with new and better ways of doing things.
For example, we might come up with a better (and more usable) way of achieving a task which is already possible. It would be desirable to make this better way the default way, but we can't do this as it may have backwards compatibility implications. So we are stuck... | [
0.8755837678909302,
0.14307118952274323,
0.25846490263938904,
0.2981793284416199,
0.49452105164527893,
-0.2972687780857086,
0.37438157200813293,
-0.0006675113691017032,
-0.1826951801776886,
-0.5445631742477417,
-0.07322515547275543,
0.9055135250091553,
0.0304213035851717,
0.064331106841564... | |
know that Windows Vista annoyed a lot of people when it first came out, because of all the software and peripherals which didn't work on it, even when they worked on XP. It received a pretty bad reception because of this. But you can see that Microsoft have also succeeded in making some great innovations in Vista, at t... | [
0.5179340839385986,
0.3502134680747986,
-0.006373811978846788,
0.2644259035587311,
0.012626091949641705,
-0.10280099511146545,
-0.010074271820485592,
0.3621237874031067,
-0.31114163994789124,
-0.20161190629005432,
0.3658421039581299,
0.7314735054969788,
0.06989870220422745,
0.2005225718021... | |
How do you handle the juggling act?
As far is my programming experience is concerned, if I'm going to fundamentally change something that will prevent past incoming data to be used correctly, I need to create an abstraction layer for the old data where it can be converted for use in the new format.
Basically I set the... | [
0.5796800255775452,
0.016475822776556015,
0.05596662685275078,
0.26056811213493347,
-0.023890279233455658,
-0.17825408279895782,
0.3877672553062439,
-0.2934799790382385,
-0.15555132925510406,
-0.35463187098503113,
0.2354862093925476,
0.6941514015197754,
-0.23243920505046844,
-0.25395622849... | |
In .NET is there a way to enable Assembly.Load tracing? I know while running under the debugger it gives you a nice message like "Loaded 'assembly X'" but I want to get a log of the assembly loads of my running application outside the debugger, preferably intermingled with my Debug/Trace log messages.
I'm tracing out... | [
0.4386962652206421,
-0.2875136733055115,
0.18110515177249908,
-0.1667211949825287,
-0.08371540904045105,
-0.2750152051448822,
0.3218354880809784,
-0.05198809131979942,
-0.2306877076625824,
-0.6348223090171814,
-0.12670165300369263,
0.2684970796108246,
-0.6701270341873169,
0.075206108391284... | |
I am trying to send an email from a site I am building, but it ends up in the yahoo spam folder. It is the email that sends credentials. What can I do to legitimize it?
```
$header = "From: site <sales@site.com>\r\n";
$header .= "To: $name <$email>\r\n";
$header .= "Subject: $subject\r\n";
$header .= "Reply-To: site <... | [
0.5266202688217163,
0.4041875898838043,
0.32223302125930786,
-0.06607895344495773,
0.05375807359814644,
0.10647318512201309,
0.4194554090499878,
-0.1738327294588089,
0.07243533432483673,
-0.48270460963249207,
-0.18565233051776886,
0.22872130572795868,
-0.433993935585022,
0.1400916576385498... | |
with email being rejected as spam by Yahoo, or anyone else. | [
0.33072033524513245,
0.06305190920829773,
0.10984352976083755,
-0.13423855602741241,
-0.2622334659099579,
-0.31426283717155457,
0.29583144187927246,
0.40879252552986145,
-0.34519657492637634,
0.06264813244342804,
-0.34585872292518616,
0.20256610214710236,
-0.44195637106895447,
0.0627542361... | |
I'm running autoconf and configure sets SHELL to '/bin/sh'.
This creates huge problems. How to force SHELL to be '/bin/bash' for autoconf?
I'm trying to get this running on osx, it's working on linux. Linux is using SHELL=/bin/bash. osx defaults to /bin/sh.
I have similar problems on Solaris with GCC - and I use the '... | [
0.3583378791809082,
0.1431206315755844,
0.30583083629608154,
-0.3320342004299164,
-0.05864560604095459,
-0.19950589537620544,
0.35507258772850037,
-0.06904963403940201,
-0.047169290482997894,
-0.8787809014320374,
-0.14861784875392914,
0.9296251535415649,
-0.3539813756942749,
0.131804227828... | |
I have a form with a progress bar and a cancel button which is displayed as a process runs. The buttons "Cancel" property is set to true so pressing escape, cancels the process.
But, as the button is the only control on the form capable of taking the focus, should the user inadvertently press enter (or space bar) whil... | [
0.1767374575138092,
0.14554116129875183,
0.662484884262085,
-0.08081518113613129,
0.14642266929149628,
0.007928397506475449,
0.469332218170166,
-0.362367182970047,
-0.06626583635807037,
-0.5027409195899963,
-0.0986471027135849,
0.48697659373283386,
-0.22870118916034698,
0.28759899735450745... | |
click event fires first.
I've tried setting the button's TabStop property to "false" - no change.
Add a default button with size 1x1, no caption, no border, etc. Make a handler for it that does nothing. The Escape key will still do a cancel as it does now. | [
-0.28740161657333374,
-0.5064601302146912,
0.5437244772911072,
-0.10220799595117569,
0.17432914674282074,
-0.1247398853302002,
0.2092234045267105,
-0.21526242792606354,
-0.1595648229122162,
-0.304221510887146,
-0.3203723728656769,
0.6318705677986145,
-0.38255488872528076,
-0.09474410116672... | |
I've been developing web applications for a while and i am quite comfortable with mySql, in fact as many do i use some form of SQL almost every day. I like the syntax and a have zero problems writing queries or optimizing my tables. I have enjoyed this mysql [api](http://www.tmtm.org/en/mysql/ruby/).
The thing that ha... | [
0.35476869344711304,
0.2821367084980011,
0.011737886816263199,
-0.11559657752513885,
-0.40296709537506104,
-0.23029877245426178,
0.6056635975837708,
0.44617465138435364,
-0.16183294355869293,
-0.6589942574501038,
0.32052239775657654,
0.6086329221725464,
-0.35891082882881165,
0.265741825103... | |
best? If so why?
Is development without having to ever write a SQL statement healthy? What if you ever have to look something up that isn't already defined as a rails function? I know they have a function that allows me to do a custom query. I guess really i want to know what people think the advantages are of using ... | [
0.37722647190093994,
-0.14543189108371735,
-0.3171773850917816,
0.36950862407684326,
-0.030635274946689606,
-0.12940748035907745,
0.40036025643348694,
0.28651633858680725,
-0.16966982185840607,
-0.36124759912490845,
0.46865612268447876,
0.7789496779441833,
0.14928646385669708,
-0.070365183... | |
the SQL behind ActiveRecord's layer means people might forget to check the generated SQL. I've been bitten by this myself: missing indexes, inefficient queries, etc.
What ActiveRecord allows is making the easy things easy:
```
Post.find(1)
```
vs
```
SELECT * FROM posts WHERE posts.id = 1
```
You, the developer,... | [
0.010631642304360867,
0.18778912723064423,
0.345335990190506,
0.00016429094830527902,
-0.22717861831188202,
-0.27184444665908813,
0.43761304020881653,
-0.00196266476996243,
-0.09594877064228058,
-0.48695382475852966,
-0.16454623639583588,
0.8197548389434814,
-0.28048139810562134,
0.0622610... | |
params[:post][:title].length > 80 then
# complain again
end
```
Again, easy to specify, easy to validate. Want more validation? A single line to add to an ActiveRecord model. Convoluted code with multiple conditions is always harder to debug and test. Why not make it easy on you?
The final thing I really like abou... | [
0.008004828356206417,
-0.14122983813285828,
0.5543844103813171,
-0.017826909199357033,
-0.5758303999900818,
0.0024420993868261576,
0.4297901391983032,
-0.40537774562835693,
-0.32744723558425903,
-0.28078314661979675,
-0.11554055660963058,
0.8046777248382568,
-0.49044081568717957,
-0.170638... | |
does not prevent you from [writing your own SQL](http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001302) (usually for performance reasons), and finally;
* ActiveRecord is fully portable accross most database engines, while SQL itself is not (sometimes).
I know in your case you are talking specifically about... | [
0.3328310549259186,
-0.01875479705631733,
0.2634512186050415,
0.18183323740959167,
-0.1593335121870041,
-0.47657310962677,
0.46655920147895813,
0.3106285333633423,
-0.2698275148868561,
-0.5094461441040039,
-0.09512056410312653,
0.7270817160606384,
-0.21979735791683197,
-0.19346462190151215... | |
Hibernate has a handful of methods that, one way or another, takes your object and puts it into the database. What are the differences between them, when to use which, and why isn't there just one intelligent method that knows when to use what?
The methods that I have identified thus far are:
* `save()`
* `update()`
... | [
0.20147919654846191,
-0.056880224496126175,
0.5405153036117554,
-0.021587282419204712,
-0.12219556421041489,
-0.044999122619628906,
0.32361069321632385,
-0.22060434520244598,
-0.2861224114894867,
-0.5855739116668701,
0.14398324489593506,
0.6006720066070557,
-0.43783822655677795,
-0.0264536... | |
an entity. Will assign an identifier if one doesn't exist. If one does, it's essentially doing an update. Returns the generated ID of the entity.
**update**
Attempts to persist the entity using an existing identifier. If no identifier exists, I believe an exception is thrown.
**saveOrUpdateCopy**
This is deprecated a... | [
-0.048611968755722046,
-0.07145008444786072,
0.5157053470611572,
0.1782284528017044,
0.07327385991811752,
-0.20582425594329834,
0.1386173516511917,
0.14371754229068756,
-0.4189799129962921,
-0.5734162926673889,
-0.04201497510075569,
0.32013335824012756,
-0.2553870677947998,
0.6147628426551... | |
a Session so Hibernate knows what has changed. But when you have a transient object, there is no session involved. In these cases you need to use merge for updates and persist for saving.
**persist**
As mentioned above, this is used on transient objects. It does not return the generated ID. | [
0.08528488129377365,
-0.47318729758262634,
0.2705024182796478,
-0.11541878432035446,
-0.12353203445672989,
-0.44308778643608093,
0.6197690963745117,
0.15515947341918945,
-0.2713075280189514,
-0.5373915433883667,
-0.13533510267734528,
0.592024564743042,
-0.49323076009750366,
0.0882716476917... | |
I'm trying to run some commands in paralel, in background, using bash. Here's what I'm trying to do:
```
forloop {
//this part is actually written in perl
//call command sequence
print `touch .file1.lock; cp bigfile1 /destination; rm .file1.lock;`;
}
```
The part between backticks (``) spawns a new shell and e... | [
0.24464602768421173,
0.046576712280511856,
0.2608410120010376,
-0.2756936848163605,
0.13436317443847656,
0.09080281108617783,
0.2385045439004898,
-0.1614181399345398,
-0.32478758692741394,
-0.26553449034690857,
-0.07497110217809677,
0.7349600195884705,
-0.25492140650749207,
0.0582188591361... | |
that has the loop) would not end until all the spawned shells finish.
I could use threads in perl to spawn different threads which call different shells, but it seems an overkill...
Can I start a shell, give it a set of commands and tell it to go to the background?
I haven't tested this but how about
```
print `(tou... | [
0.5501425266265869,
-0.12483034282922745,
0.41535893082618713,
-0.1828748732805252,
0.26349762082099915,
-0.23803798854351044,
0.3840336501598358,
-0.03150812163949013,
-0.2496766895055771,
-0.3192518353462219,
0.016420206055045128,
0.6858100295066833,
-0.22302766144275665,
0.2762528657913... | |
What language or method would I use to listen to the event when a removeable drive is plugged into the PC?
I guess any language that can work with the Windows API should do. Basically, you listen to the windows message WM\_DEVICECHANGE. This alone will let you listen to system-wide messages.
For more specific scenario... | [
0.2635191082954407,
-0.05521966889500618,
0.20686355233192444,
0.04399329423904419,
-0.07486966252326965,
-0.3107701241970062,
0.4689277410507202,
0.24613210558891296,
-0.06862835586071014,
-0.6960676908493042,
0.025505559518933296,
1.2091119289398193,
-0.39457961916923523,
0.0419668704271... | |
I need to validate the email address of my users. Unfortunately, making a validator that [conforms to standards](https://www.rfc-editor.org/rfc/rfc2822#section-3.4.1) is hard.
[Here](http://www.ex-parrot.com/%7Epdw/Mail-RFC822-Address.html) is an example of a regex expression that tries to conform to the standard.
Is... | [
0.43946191668510437,
0.4338392913341522,
0.4204195737838745,
0.16054470837116241,
-0.028725147247314453,
-0.06716064363718033,
0.42399904131889343,
-0.19913648068904877,
-0.21708817780017853,
-0.32353076338768005,
0.05856793746352196,
0.3129947781562805,
-0.1099841445684433,
0.081406414508... | |
Given the following:
```
#light
//any function returning bool * 'a
let foo =
let x = ref 10
fun () ->
x := !x - 1
if !x <> 0 then
(true, x)
else
(false, x)
while let (c,x) = foo() in c do print_any x;//can't access x, but would be convinent.
//this is how I | [
0.2090831696987152,
0.141682431101799,
0.46550196409225464,
-0.4020116627216339,
-0.12038516253232956,
-0.22914278507232666,
0.3170638084411621,
-0.24413138628005981,
-0.052977390587329865,
-0.3589295446872711,
-0.29692259430885315,
0.7557402849197388,
-0.4462762475013733,
0.17602072656154... | |
want it to work, without all the typing
let rec loop f =
match f() with
| (true, x) ->
print_any x
loop f
| (false, _) -> ()
loop foo
```
How should I go about solving this?
Or should I just go through the hassle to convert "foo" to a sequence expression?
I found a library in google code: ... | [
0.5814302563667297,
0.2634525001049042,
0.5252196788787842,
-0.235645592212677,
0.167864128947258,
0.09521544724702835,
0.3760814964771271,
-0.32379722595214844,
-0.008472252637147903,
-0.19205544888973236,
0.14298580586910248,
0.5281548500061035,
-0.5569157004356384,
-0.2621285319328308,
... | |
I'm using `org.w3c` `XML API` to open an existing `XML` file. I'm removing some nodes , and I'm adding others instead.
The problem is that the new nodes that are added are written one after the other, with no newline and no indentation what so ever. While it's true that the `XML` file is valid , it is very hard for a ... | [
0.25689345598220825,
0.2547791004180908,
0.42487943172454834,
-0.08591005951166153,
0.0464019812643528,
-0.20418614149093628,
0.3093995749950409,
-0.14811857044696808,
-0.039642348885536194,
-0.7833822965621948,
-0.1707984060049057,
0.4675162136554718,
-0.2173839509487152,
0.07504177838563... | |
call `transform`:
```
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
``` | [
0.1534159630537033,
-0.4633908271789551,
0.34490954875946045,
-0.08400239050388336,
-0.030043968930840492,
0.037380509078502655,
0.21546776592731476,
-0.5374193787574768,
0.2886209189891815,
-0.5136839747428894,
-0.6046507358551025,
0.8360527753829956,
-0.34422895312309265,
0.0238697845488... | |
I developing ASP.NET application using a Swedish version of Windows XP and Visual studio Professional. When ever i get an error aka. "yellow screen of death" the error message is in swedish, making it a bit hard to search for info about it.
How can i change what language the error messages in ASP.NET uses?
I have no ... | [
0.17663830518722534,
0.28850501775741577,
0.24042052030563354,
-0.24362251162528992,
-0.000696428760420531,
-0.030422259122133255,
0.4894954562187195,
0.3768424391746521,
-0.2847498059272766,
-1.0060290098190308,
0.08330238610506058,
0.27131396532058716,
-0.2224230021238327,
0.257445186376... | |
you could just uninstall the Swedish language pack for .NET. On the production server, you'll most likely have an English-only Framework anyway. | [
0.4204467833042145,
-0.08025913685560226,
0.06062489375472069,
0.10243188589811325,
-0.023727526888251305,
-0.3486897647380829,
0.45181402564048767,
0.40865540504455566,
-0.1516527682542801,
-0.23470667004585266,
-0.2651876211166382,
0.4332997798919678,
-0.10863465815782547,
-0.16637600958... | |
I am currently porting a lot of code from an MFC-based application to a DLL for client branding purposes.
I've come across an unusual problem. This bit of code is the same in both systems:
```
// ...
CCommsProperties props;
pController->GetProperties( props );
if (props.handshake != HANDSHAKE_RTS_CTS)
... | [
0.2754661738872528,
0.11861824244260788,
0.7714686989784241,
-0.0250009186565876,
-0.04986526072025299,
0.027211902663111687,
0.1011204719543457,
-0.05581206828355789,
-0.2411584109067917,
-0.7785983681678772,
-0.018729696050286293,
0.6630949378013611,
-0.03238401189446449,
0.1996095925569... | |
is a wrapper for the comm settings, serialization of etc. and pController is of type ControllerSI which itself is a layer between the actual Comms and the Application.
On the original MFC version the setting of handshake to RTS-CTS sticks but when running as the DLL version it resets itself to 0 as soon as the functio... | [
0.17136800289154053,
-0.05372153967618942,
0.9917502403259277,
0.004124166909605265,
0.11952251195907593,
-0.11679567396640778,
-0.02363935112953186,
-0.11051977425813675,
-0.1424076408147812,
-0.369564026594162,
0.050785552710294724,
0.360618531703949,
-0.1915435642004013,
0.3943205773830... | |
an afternoon to this and I don't really want to lose any more...
After Saratv posting, I decided to ditch what I had done and restart it from working source again.
This time however it works...I guess I will never know why passing a structure caused it to change. | [
0.4807174801826477,
0.0047515458427369595,
0.47787585854530334,
-0.04045461490750313,
-0.18950772285461426,
-0.142996683716774,
0.4899936616420746,
0.15267886221408844,
-0.21644066274166107,
-0.47958341240882874,
0.45903027057647705,
0.29723936319351196,
-0.020492281764745712,
0.2845517694... | |
In Ruby, is it possible to pass by reference a parameter with value-type semantics (e.g. a Fixnum)?
I'm looking for something similar to C#'s '**ref**' keyword.
Example:
```
def func(x)
x += 1
end
a = 5
func(a) #this should be something like func(ref a)
puts a #should read '6'
```
Btw. I know I could just ... | [
0.41343066096305847,
0.2219967246055603,
0.3300245702266693,
-0.20486098527908325,
-0.4827759861946106,
-0.3298991024494171,
0.5846039056777954,
-0.2961260676383972,
-0.07657450437545776,
-0.3110702931880951,
-0.17274583876132965,
0.41091135144233704,
-0.6032053232192993,
0.190306156873703... | |
I've got a Method that gets a IDictionary as a parameter.
Now I want to provide a method that retrieves the value from this dictionary, but it should be case-invariant.
So my solution to this right now was to have a static function that loops through the keys and converts them toLower() like this:
```
private static ... | [
0.11366768926382065,
-0.1182907447218895,
0.3565789461135864,
-0.18899619579315186,
0.078385129570961,
0.24441389739513397,
0.056304726749658585,
-0.44282975792884827,
0.012636947445571423,
-0.41833698749542236,
-0.0292348675429821,
0.5764073133468628,
-0.5332654118537903,
-0.0670226812362... | |
IDictionary<string, string> convertedDictionatry = new Dictionary<string, string>();
foreach(string key in dictionaries[keyLanguage].Keys)
{
convertedDictionatry.Add(key.ToLower(), dictionaries[keyLanguage][key]);
}
resultingConvertedDictionaries.Add(keyLanguage, convertedDic... | [
0.39969491958618164,
-0.2399870604276657,
0.39873823523521423,
-0.09560756385326385,
0.011879165656864643,
0.05672900006175041,
0.36874040961265564,
-0.40974369645118713,
-0.0991869866847992,
-0.40465348958969116,
0.057321663945913315,
0.7276791930198669,
-0.5240159630775452,
-0.0559718236... | |
the dictionary doesn't differentiate between casing?
Yes - pass the Dictionary constructor `StringComparer.OrdinalIgnoreCase` (or another case-ignoring comparer, depending on your culture-sensitivity needs). | [
0.3931260108947754,
-0.005410613492131233,
0.34445807337760925,
0.22356949746608734,
-0.12312691658735275,
0.034455619752407074,
0.09264504164457321,
0.3723827600479126,
0.10354815423488617,
-0.3640526235103607,
-0.18931454420089722,
0.4845781922340393,
-0.0410589724779129,
-0.042088642716... | |
I'm completely new to AIR but what I'm trying to do feels like it should be quite easy.
I want my AIR app to execute (launch) an SWF in the standalone Flash Player (just like if I were to double click it).
Please note that I don't want the AIR app to embed the SWF. Just run it.
Can this be done?
The AIR-Runtime is ... | [
0.5480265021324158,
0.2975468933582306,
0.34791430830955505,
-0.002667802618816495,
-0.19719702005386353,
-0.2894708216190338,
0.023028500378131866,
-0.3860279321670532,
0.08740471303462982,
-0.674534797668457,
-0.2299351543188095,
0.6466172933578491,
-0.3327472507953644,
-0.14980639517307... | |
your plan, why AIR? | [
0.5593858361244202,
-0.13702629506587982,
-0.15143947303295135,
0.34392574429512024,
0.0011643795296549797,
-0.2057429999113083,
0.09872660040855408,
-0.36724162101745605,
-0.1537056267261505,
-0.19208332896232605,
-0.16310805082321167,
0.06721913814544678,
-0.4832051992416382,
-0.06827548... | |
Should methods in a Java interface be declared with or without the `public` access modifier?
Technically it doesn't matter, of course. A class method that implements an `interface` is always `public`. But what is a better convention?
Java itself is not consistent in this. See for instance `Collection` vs. `Comparable... | [
0.21071365475654602,
0.07623617351055145,
-0.06907834857702255,
0.049126967787742615,
-0.3448827266693115,
-0.43119314312934875,
0.23388586938381195,
-0.1994636207818985,
-0.20602338016033173,
-0.29136282205581665,
-0.29562681913375854,
0.37625861167907715,
-0.49029046297073364,
-0.0020200... | |
Consider the following subversion directory structure
/dir1/file.txt
/dir2/file.txt
I want to move the file.txt in dir1 to replace the same file in dir2 and ensure that the history for the dir1 file is maintained. I don't care about the history of original dir2 file.
Is this possible using subversion commands and n... | [
0.1727612316608429,
-0.40934768319129944,
0.3579087555408478,
-0.19727575778961182,
-0.2767939567565918,
-0.2462031990289688,
0.232967808842659,
-0.08000266551971436,
-0.11916939914226532,
-0.5637233853340149,
-0.16817930340766907,
0.6954686641693115,
-0.5060614347457886,
0.332502484321594... | |
I'm running zsh as the default shell on a Ubuntu box, and everything works fine using gnome-terminal (which as far as I know emulates xterm). When I login from a windows box via ssh and putty (which also emulates xterm) suddendly the home/end keys no longer work.
I've been able to solve that adding these lines to my ... | [
-0.1767796277999878,
0.01361442543566227,
0.5681714415550232,
-0.379558801651001,
-0.0457535944879055,
-0.09361761808395386,
0.27016761898994446,
0.4613566994667053,
0.147428497672081,
-0.8937479257583618,
-0.19452257454395294,
0.6397008895874023,
-0.29184606671333313,
0.47274643182754517,... | |
the normal actions the average user would expect in the global `/etc/zsh/zshrc` file. Following the relevant code (it is the same on Debian and Ubuntu):
```
if [[ "$TERM" != emacs ]]; then
[[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char
[[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$t... | [
-0.3125654458999634,
-0.19176311790943146,
0.5879743099212646,
-0.15153290331363678,
-0.0903441309928894,
0.035863399505615234,
0.6246166229248047,
-0.4148211181163788,
-0.18971134722232819,
-0.42754581570625305,
-0.7333856225013733,
0.7072985172271729,
-0.556175708770752,
-0.1396990716457... | |
vicmd "$terminfo[kich1]" overwrite-mode
[[ -z "$terminfo[cuu1]" ]] || bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history
[[ -z "$terminfo[cuf1]" ]] || bindkey -M viins "$terminfo[cuf1]" vi-forward-char
[[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history
[[ -z "$terminfo[kcud1... | [
-0.500562846660614,
0.05861838907003403,
1.0672909021377563,
0.5299104452133179,
-0.4426564872264862,
0.2484622597694397,
0.5113252401351929,
-0.376572847366333,
-0.477004736661911,
-0.16659770905971527,
-0.31820276379585266,
0.3804473876953125,
0.013519168831408024,
0.7704958915710449,
... | |
== "^[O"* ]] && bindkey -M viins "${terminfo[khome]/O/[}" beginning-of-line
[[ "$terminfo[kend]" == "^[O"* ]] && bindkey -M viins "${terminfo[kend]/O/[}" end-of-line
[[ "$terminfo[khome]" == "^[O"* ]] && bindkey -M emacs "${terminfo[khome]/O/[}" beginning-of-line
[[ "$terminfo[kend]" == "^[O"* ]] && bindkey -M emacs "$... | [
0.16249246895313263,
-0.1502770036458969,
0.753261148929596,
0.19731169939041138,
0.0643487498164177,
-0.1157989427447319,
0.2311723828315735,
-0.05821671336889267,
0.11452674865722656,
-0.48600226640701294,
-0.5493030548095703,
0.3720933198928833,
-0.6598657965660095,
0.16282914578914642,... | |
terminal type to the remote host. But messes up somewhere and doesn't send the correct control codes for `Home`, `End`, ... that one would expect from an `xterm`. Or an `xterm` terminal isn't expected to send those or whatever... (`Del` key does work in `xterm` however, if you configure it in ZSH). Also notice that you... | [
-0.31591978669166565,
-0.12792515754699707,
0.6106402277946472,
0.010741776786744595,
-0.042383722960948944,
0.09260402619838715,
-0.11183228343725204,
0.5274190306663513,
-0.08643464744091034,
-0.8982242345809937,
0.18523478507995605,
0.6581093072891235,
-0.16529521346092224,
0.6222637295... | |
set terminal type in Putty under Connection -> Data. Do not be tempted to set your terminal type in your `.zshrc` with `export TERM=linux`, that is just wrong. The terminal type should be specified by your terminal app. So that if, for example, you connect from a Mac box with a Mac SSH client it can set it's own termin... | [
0.05072099715471268,
-0.042489055544137955,
0.4589349031448364,
-0.043778374791145325,
-0.0659637451171875,
-0.2990439534187317,
-0.07662791758775711,
0.6245830059051514,
-0.17201298475265503,
-0.8720028400421143,
-0.1515943557024002,
0.7062146663665771,
-0.6014194488525391,
0.328750193119... | |
and you should be fine :) | [
0.5304022431373596,
0.23013876378536224,
0.23878847062587738,
0.06348280608654022,
0.31739628314971924,
-0.07713224738836288,
0.2660290002822876,
-0.06711272895336151,
-0.3015924394130707,
-0.20258474349975586,
0.16872218251228333,
0.3862219750881195,
-0.24422022700309753,
-0.0232575777918... | |
You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | [
0.1821451038122177,
-0.25128889083862305,
0.1306459605693817,
0.16147464513778687,
-0.2030283510684967,
-0.19388611614704132,
0.4353073239326477,
-0.07906882464885712,
-0.46811217069625854,
-0.36692437529563904,
-0.05050842463970184,
0.46550536155700684,
-0.2808281481266022,
-0.10496018826... | |
die.
# You can 'use Fatal qw(open)' if autodie is not installed.
use File::Find::Rule;
use Getopt::Std;
use constant SECONDS_IN_DAY => 24 * 60 * 60;
our %option = (
m => 1, # -m switch: days ago modified, defaults to 1
o => undef, # -o switch: output file, defaults to STDOUT
);
getop... | [
0.4217049181461334,
0.005555551964789629,
0.4243389070034027,
-0.08968476951122284,
0.3823705017566681,
0.15783974528312683,
0.30893534421920776,
-0.16064128279685974,
-0.13428115844726562,
-0.7251348495483398,
-0.26360028982162476,
0.5895572304725647,
-0.2232058346271515,
0.19582951068878... | |
( '.' );
}
print STDERR "Finding files changed in the last $option{m} day(s)\n";
# Convert our time in days into a timestamp in seconds from the epoch.
my $last_modified_timestamp = time() - SECONDS_IN_DAY * $option{m};
# Now find all the regular files, which have been modified in the last
# $option{m} days, looking... | [
0.15286795794963837,
-0.13411374390125275,
0.968748152256012,
-0.17634566128253937,
0.5528066158294678,
0.36130595207214355,
0.3042701482772827,
-0.13064032793045044,
-0.511843204498291,
-0.7107405662536621,
-0.2532806694507599,
0.5377877354621887,
-0.06929782032966614,
0.3419775068759918,... | |
->in(@ARGV);
# $out_fh will store the filehandle where we send the file list.
# It defaults to STDOUT.
my $out_fh = \*STDOUT;
if ($option{o}) {
open($out_fh, '>', $option{o});
}
# Print our results.
print {$out_fh} join("\n", @files), "\n";
``` | [
-0.23157832026481628,
0.2186790108680725,
0.7952293753623962,
-0.5689228177070618,
0.24110537767410278,
0.46685221791267395,
0.1729227602481842,
-0.0573081448674202,
-0.07635767757892609,
-0.5562795400619507,
-0.3621901273727417,
0.542133092880249,
-0.3455110192298889,
0.040445152670145035... | |
I'm using a local artifactory to proxy the request, but the build and test phases are still a bit slow. It's not the actual compile and tests that are slow, it's the "warmup" of the maven2 framework. Any ideas?
There are some possibilities to optimize some of the build tasks. For example the 'clean' task can be optimiz... | [
0.4873853623867035,
-0.10438638180494308,
0.2702213227748871,
-0.01537430938333273,
-0.069629967212677,
-0.01929856464266777,
0.3688798248767853,
-0.07150210440158844,
-0.14550156891345978,
-0.9137852787971497,
0.008765971288084984,
0.5716035962104797,
0.07288660109043121,
-0.1069449335336... | |
I am creating an ASP script that uses the application object to store the pages. The question in my mind is whether there is a size limit to this object. Anyone know?
An application pool may specifiy the Maximum virtual memory size that a worker process can allocate. This is setting will affect the maximum size of data... | [
0.32128849625587463,
0.07874183356761932,
0.3079337179660797,
0.030264096334576607,
-0.0396607331931591,
0.0454394593834877,
0.08937764912843704,
-0.005167064722627401,
-0.5709244012832642,
-0.6665828824043274,
0.07846377044916153,
0.3985656499862671,
-0.1864703893661499,
0.069533102214336... | |
(if that) in the application object regardless of how much memory is present on the server.
On 64 bit server running the worker process as a 64 bit process it would be able to consume as much RAM and pagefile that it can get. | [
-0.08816017210483551,
0.11594382673501968,
0.5049325227737427,
0.030500197783112526,
0.08756349235773087,
0.30445823073387146,
0.1161191388964653,
0.059084922075271606,
-0.33472949266433716,
-0.9229800701141357,
-0.14652857184410095,
0.3557996153831482,
-0.09524932503700256,
0.207869321107... | |
I know there is already a [question](https://stackoverflow.com/questions/133883/stop-and-start-a-service-via-batch-or-cmd-file) about this but my issue is more oriented to remote scenarios.
With *net start/stop* you can specify a */y* parameter to bounce users off current sessions but you cannot start/stop remotely.
... | [
0.27704960107803345,
0.13970011472702026,
0.2131495177745819,
0.13007570803165436,
-0.03462552651762962,
-0.40186965465545654,
0.27022334933280945,
0.09114579856395721,
-0.33513766527175903,
-0.39143019914627075,
-0.04997190088033676,
0.5260791778564453,
-0.16511614620685577,
0.21265527606... | |
answers Yes to the "Are you sure?" prompt. I'd think that sc could be used as well, though it may time out waiting for the service to stop if there's a lot of inflight transactions. Does it give you any specifics of why it can't stop?
Here's a couple of other methods to stop a remote SQL instance. Except for SHUTDOWN ... | [
0.37746909260749817,
-0.1827724277973175,
0.45230111479759216,
0.4919681251049042,
0.24932865798473358,
-0.3895404636859894,
0.28896743059158325,
0.19184742867946625,
-0.25893673300743103,
-0.44861555099487305,
-0.12094856798648834,
0.5404822826385498,
-0.09023161232471466,
-0.057951480150... | |
make shutdown faster (but subsequent startup slower, and could lead to lost data).
* Or you could use either [Configuration Manager](http://msdn.microsoft.com/en-us/library/ms187071.aspx) or [Management Studio](http://msdn.microsoft.com/en-us/library/ms190681.aspx) to stop a remote instance.
Edit: The error is [pretty... | [
-0.01944199949502945,
-0.024093125015497208,
0.292790949344635,
0.21440456807613373,
0.0684293881058693,
-0.25277578830718994,
0.5405065417289734,
0.21106193959712982,
-0.4316965341567993,
-0.5910612940788269,
-0.2882702052593231,
0.6737534403800964,
-0.1855829656124115,
0.2685829102993011... | |
There are truckloads of counters available in perfmon for ASP.NET. What are the best (I am thinking of choosing 5-10) that will be the best to monitor in our test environment so that we can feed back to developers.
I am thinking of things like request time, request queue length, active sessions etc.
For a normal (not ... | [
0.23044268786907196,
-0.04296452924609184,
0.3106595277786255,
0.30747541785240173,
-0.24360820651054382,
0.1918039172887802,
0.24728290736675262,
-0.2688189446926117,
-0.3707500696182251,
-0.6399509310722351,
0.19356878101825714,
0.5150801539421082,
0.12845942378044128,
0.0183644723147153... | |
probably want things like:
* % CPU Utilization *(make sure you're checking for very low CPU utilisation as well as it might indicate that something is dead)*
* Requests Queued
* Output Cache Hits | [
0.26342669129371643,
0.16561563313007355,
0.3292151093482971,
0.057963185012340546,
-0.0265283714979887,
0.12821157276630402,
0.09498453885316849,
0.16847355663776398,
-0.3531849682331085,
-0.7233198285102844,
-0.1895267218351364,
0.41075435280799866,
-0.06469983607530594,
-0.0020976257510... | |
What is the best MemCache solution for ASP.NET applications running in a windows server environment? Why?
You could also check out [Microsoft Velocity](http://code.msdn.microsoft.com/velocity), especially if you're at a place that prefers Microsoft products. | [
-0.16636717319488525,
-0.02177274227142334,
0.43804052472114563,
0.3682125210762024,
0.3373756408691406,
-0.13337577879428864,
0.0014368015108630061,
0.36219966411590576,
-0.1633232831954956,
-0.4742570221424103,
0.006414315197616816,
0.38350817561149597,
0.23770639300346375,
-0.1472496539... | |
I have a web page with `DIV`s with a `mouseover` handler that is intended to show a pop-up information bubble. I don't want more than one info bubble to be visible at a time. But when the user moves the mouse rapidly over two items, I sometimes get two bubbles. This should not happen, because the code for showing a pop... | [
0.504639744758606,
-0.010562547482550144,
0.2771702706813812,
-0.07713669538497925,
0.19171462953090668,
-0.15418687462806702,
0.028172198683023453,
0.23016583919525146,
-0.242777481675148,
-0.8215423822402954,
0.15529987215995789,
0.27459612488746643,
-0.3976435363292694,
0.33363798260688... | |
assumed JavaScript is always run single-threaded, which would prevent this. Am I wrong? Are event handlers running asynchronously, in which case I need synchronized access to shared data, or should I instead be looking for bugs in the library code for cancelling pop-ups?
Edited to add:
* The library in question is [S... | [
0.25984320044517517,
-0.3286369740962982,
0.021610161289572716,
0.033379774540662766,
0.10594812035560608,
-0.2736434042453766,
0.2793809771537781,
0.32629257440567017,
-0.428445041179657,
-0.4737129211425781,
-0.20301268994808197,
0.647903323173523,
-0.35782232880592346,
-0.10795688629150... | |
this being intended to prevent pop-ups flickering annoyingly but annoyingly having the reverse effect.
I'll have another poke at it and see if I can work out where I am going wrong. :-)
Yes, Javascript is single-threaded. Even with browsers like Google Chrome, there is one thread per tab.
Without knowing how you are ... | [
0.26611658930778503,
-0.030475089326500893,
0.3919285237789154,
0.043174054473638535,
-0.32838889956474304,
-0.47209432721138,
0.5582281351089478,
0.02156907320022583,
-0.4738489091396332,
-0.6690998673439026,
-0.19712063670158386,
0.3920558989048004,
-0.52376389503479,
0.06730248779058456... | |
I'm working on the K&R book. I've read farther ahead than I've done exercises, mostly for lack of time. I'm catching up, and have done almost all the exercises from chapter 1, which is the tutorial.
My issue was exercise 1-18. The exercise is to:
> Write a program to remove trailing blanks and
> tabs from line of i... | [
-0.056062329560518265,
0.04510681703686714,
0.21897882223129272,
-0.04877769201993942,
-0.1799875944852829,
-0.07722644507884979,
0.38841360807418823,
-0.1649913638830185,
-0.08714576810598373,
-0.5460094809532166,
-0.08455415815114975,
0.44698652625083923,
-0.02057522162795067,
-0.2669976... | |
probably go nuts. (C# being one of my specialties.)
Can anyone offer some advice on cleaning this up -- with the catch that said advice has to only use knowledge from Chapter 1 of K & R. (I know there are a zillion ways to clean this up using the full C library; we're just talking Chapter 1 and basic stdio.h here.) Al... | [
0.4391856789588928,
0.258306622505188,
0.18014630675315857,
-0.043136756867170334,
0.19654874503612518,
-0.043267808854579926,
0.38777485489845276,
-0.15597425401210785,
0.005758339539170265,
-0.7530678510665894,
-0.18997107446193695,
0.6848381161689758,
-0.020967181771993637,
-0.050395540... | |
ret[]);
int main()
{
char line[MAXLINE];
char out[MAXLINE];
int length;
while ((length = getline(line, MAXLINE)) > 0)
{
trim(line, out);
printf("%s", out);
}
return 0;
}
int getline(char line[], int max)
{
int c, i;
for (i = 0; i < max - 1 && (c = getchar()) != E... | [
0.04214271903038025,
-0.4988173544406891,
0.8180532455444336,
-0.5743229985237122,
0.38342761993408203,
0.647162914276123,
0.5991672873497009,
-0.5094609260559082,
-0.08411083370447159,
-0.23925673961639404,
-0.682527482509613,
0.7551353573799133,
-0.35225188732147217,
0.14239239692687988,... | |
c;
if (c == '\n')
{
line[i] = c;
++i;
}
line[i] = '\0';
return i;
}
void trim(char line[], char ret[])
{
int i = 0;
while ((ret[i] = line[i]) != '\0')
++i;
if (i == 1)
{
// Special case to remove entirely blank line | [
-0.25100502371788025,
-0.44642356038093567,
0.39628952741622925,
-0.28679895401000977,
0.26161977648735046,
0.33478182554244995,
0.26879647374153137,
-0.16224585473537445,
0.01717718504369259,
-0.27415958046913147,
-0.6338220238685608,
0.5723977088928223,
-0.1581830233335495,
0.01361348293... | |
ret[0] = '\0';
return;
}
for ( ; i >= 0; --i)
{
if (ret[i] == ' ' || ret[i] == '\t')
ret[i] = '\0';
else if (ret[i] != '\0' && ret[i] != '\r' && ret[i] != '\n')
break; | [
-0.4614439606666565,
-0.06993259489536285,
0.3035126328468323,
-0.5432770848274231,
0.4195035696029663,
-0.031245529651641846,
0.7797126770019531,
-0.3933297097682953,
-0.10504849255084991,
-0.17254792153835297,
-1.0826122760772705,
0.8055410981178284,
-0.2027975171804428,
0.01242078654468... | |
}
for (i = 0; i < MAXLINE; ++i)
{
if (ret[i] == '\n')
{
break;
}
else if (ret[i] == '\0')
{
ret[i] = '\n'; | [
-0.16122736036777496,
-0.26733508706092834,
0.40039220452308655,
-0.5529875755310059,
0.3437156081199646,
-0.009283279068768024,
0.6740223169326782,
-0.31257545948028564,
0.03700512275099754,
-0.3220181465148926,
-0.7331109046936035,
0.596930980682373,
-0.25766193866729736,
-0.013991918414... | |
ret[i + 1] = '\0';
break;
}
}
}
```
EDIT: I appreciate all the helpful tips I'm seeing here. I would like to remind folks that I'm still a n00b with C, and specifically haven't gotten up to pointers yet. (Remember the bit about Ch.1 of K&R -- Ch.1 doesn't do pointers.) I "kinda" get some of th... | [
-0.10167203098535538,
0.20946428179740906,
0.33654940128326416,
-0.06299450248479843,
0.1409311443567276,
-0.17331241071224213,
0.43703287839889526,
0.036446720361709595,
-0.3219798505306244,
-0.659633994102478,
-0.2305951863527298,
0.6977120041847229,
-0.12648478150367737,
-0.074620664119... | |
trim method itself -- specifically the fact that I'm looping through **3** times (which feels so dirty). I feel like if I were just a touch more clever (even without the advanced knowledge of C), this could have been cleaner.
There is no reason to have two buffers, you can trim the input line in place
```
int trim(cha... | [
0.24214357137680054,
-0.37601444125175476,
0.2378970831632614,
-0.16088883578777313,
0.1275087147951126,
0.11564953625202179,
0.24907100200653076,
-0.3606175184249878,
0.059589117765426636,
-0.447813481092453,
0.028342951089143753,
0.6263555884361267,
-0.2577524781227112,
-0.27249449491500... | |
line[len-1] == ' ' && line[len-1] == '\t' && line[len-1] == '\n')
line[--len] = 0;
return len;
}
```
By returning the line length, you can eliminate blank lines by testing for non-zero length lines
```
if (trim(line) != 0)
printf("%s\n", line);
```
EDIT: You can make the while loop even simpler, a... | [
-0.24380089342594147,
-0.5026729106903076,
0.2858811020851135,
-0.0991382822394371,
0.018909072503447533,
0.30314701795578003,
0.3789229393005371,
-0.10471606999635696,
-0.09131474047899246,
-0.24570907652378082,
-0.44388270378112793,
0.5138120055198669,
-0.1726415604352951,
-0.11258966475... | |
Quite often in ANSI C code I can see parenthesis sorrounding a single return value.
Like this:-
```
int foo(int x) {
if (x)
return (-1);
else
return (0);
}
```
Why use () around the return value in those cases? Any ideas? I can see no reason for that.
There really isn't a reason...it's just old convent... | [
0.1403670459985733,
0.4171251356601715,
-0.10130105912685394,
-0.2653563618659973,
-0.3404902219772339,
-0.24217486381530762,
0.2913828492164612,
0.02979278564453125,
-0.24976499378681183,
0.06396351009607315,
-0.3498567044734955,
0.28826677799224854,
-0.4919179081916809,
0.038325756788253... | |
returned, like this:
```
return (x+i*2);
```
instead of
```
int y = x+i*2;
return y;
```
The parenthesis became a habit and it stuck. | [
-0.23553252220153809,
0.01899930089712143,
0.2767001986503601,
-0.27749401330947876,
-0.30864864587783813,
0.16673892736434937,
0.371823251247406,
0.2678918242454529,
0.0017257900908589363,
-0.2495361715555191,
-0.4029124677181244,
0.3241916000843048,
-0.24921713769435883,
0.07275779545307... | |
For those of you that like puzzles: I had this problem recently and am sure there must be a nicer solution.
Consider :
* an ObservableCollection of **Foo** objects called *foos*.
* **Foo** contains a string ID field
* I have no control over *foos*
* *foos* will be changing
Then:
* I have another collection called *... | [
0.10363589972257614,
0.08497846126556396,
0.37908825278282166,
0.05000725015997887,
-0.2124776691198349,
-0.021109316498041153,
0.040379755198955536,
-0.1105651706457138,
-0.42898470163345337,
-0.5908300280570984,
0.014450235292315483,
0.4528530240058899,
-0.36461490392684937,
0.1026120781... | |
not appear in *foos*.
Is there a nice way to bind to and show in wpf the **Foo** objects in *foos* in the order defined by IDs in *sortLikeThis* ?
There really isn't a reason...it's just old convention.
To save space, programmers would often do the final math in the return line instead of on it's own line and the par... | [
0.19850823283195496,
0.2719303071498871,
0.25513702630996704,
-0.22596336901187897,
-0.4251217842102051,
-0.08160993456840515,
0.5175145268440247,
0.1774429827928543,
-0.27520790696144104,
-0.33662667870521545,
-0.5112074017524719,
0.2904949188232422,
-0.49177905917167664,
0.08865451812744... | |
In the process of updating a web app from ASP to ASP.NET, I want to insert one of the new files into the old app to test something - is this an offence against reason?
Yes but they will not share the session memory. I have an old ASP website and have replaced the main page with a asp.net page with a masterpage/content ... | [
0.37392163276672363,
0.09043734520673752,
0.3701535165309906,
-0.025981586426496506,
-0.18647068738937378,
0.060799431055784225,
0.06615153700113297,
-0.05727668106555939,
-0.580527126789093,
-0.7874330878257751,
0.1093803122639656,
0.43931007385253906,
-0.253530889749527,
0.10469615459442... | |
if you just add an asp page in your existing asp.net application it will not run. You'll need to set up the entire app in IIS so that both the ASP and ASP.NET pages will run like it will on the server. | [
0.23636256158351898,
-0.34986037015914917,
0.2096291333436966,
0.07470022886991501,
-0.04561225697398186,
-0.10749106109142303,
0.4069967269897461,
-0.18523746728897095,
-0.27041852474212646,
-0.9079902768135071,
-0.29171526432037354,
0.34215760231018066,
-0.4936191737651825,
-0.0181632917... | |
Is any way to tell the solution explorer of Visual Studio 2005 not to expand all projects on the first opening of the solutio after svn-checkout?
Edit:
Thanks for pointing out the PowerCommands. As I am using Visual Studio 2005 with .Net 2.0 it does not work for me. Are there similar tools available for VS2005?
Re: so... | [
-0.35237476229667664,
-0.2093750387430191,
0.389897882938385,
0.15673284232616425,
-0.18212953209877014,
-0.22778652608394623,
0.33405745029449463,
-0.16777931153774261,
-0.4215909242630005,
-0.4168701767921448,
-0.005705354269593954,
0.7629151940345764,
-0.2519485652446747,
-0.17796537280... | |
Ever since I started using .NET, I've just been creating Helper classes or Partial classes to keep code located and contained in their own little containers, etc.
What I'm looking to know is the best practices for making ones code as clean and polished as it possibly could be.
Obviously clean code is subjective, but... | [
0.8233382105827332,
0.2653171718120575,
-0.15486226975917816,
0.2174653261899948,
-0.034988369792699814,
-0.34090501070022583,
0.3094707131385803,
-0.06252893805503845,
-0.13589605689048767,
-0.811486005783081,
0.10710110515356064,
0.4284394085407257,
-0.07358331978321075,
0.05726429075002... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.